OpenProject is the leading open source project management software for product, project and portfolio management. A powerful Jira alternative with agile planning, issue tracking, roadmaps, Gantt charts, time tracking, collaboration features, and more. Available on premises or in the cloud. ⭐ Star us on GitHub
Ruby agile-developmentangularbcfboardsbug-trackerganttgantt-chartifcissue-trackerjira-alternativekanbanopenprojectproduct-managementproject-managementproject-planningroadmaprubyscrumtimelineworkflows
Add forum management in "Forums" module
Henriette Dinger91a459ee20ab
diff --git a/app/controllers/forums_controller.rb b/app/controllers/forums_controller.rbindex c6d03c192d1..5ee64e20445 100644--- a/app/controllers/forums_controller.rb+++ b/app/controllers/forums_controller.rb@@ -96,7 +96,7 @@ class ForumsController < ApplicationControllerdef createif @forum.saveflash[:notice] = l(:notice_successful_create)- redirect_to_settings_in_projects+ redirect_to action: 'index'elserender :newend@@ -107,7 +107,7 @@ class ForumsController < ApplicationControllerdef updateif @forum.update(permitted_params.forum)flash[:notice] = l(:notice_successful_update)- redirect_to_settings_in_projects+ redirect_to action: 'index'elserender :editend@@ -120,21 +120,17 @@ class ForumsController < ApplicationControllerflash.now[:error] = t('forum_could_not_be_saved')render action: 'edit'end- redirect_to_settings_in_projects(@forum.project_id)+ redirect_to action: 'index'enddef destroy@forum.destroyflash[:notice] = l(:notice_successful_delete)- redirect_to_settings_in_projects+ redirect_to action: 'index'endprivate- def redirect_to_settings_in_projects(id = @project)- redirect_to controller: '/project_settings', action: 'show', id: id, tab: 'forums'- end-def find_forum@forum = @project.forums.find(params[:id])rescue ActiveRecord::RecordNotFounddiff --git a/app/views/forums/edit.html.erb b/app/views/forums/edit.html.erbindex d7ddd88d996..bcff16b45be 100644--- a/app/views/forums/edit.html.erb+++ b/app/views/forums/edit.html.erb@@ -31,5 +31,5 @@ See docs/COPYRIGHT.rdoc for more details.<%= labelled_tabular_form_for [@project, @forum] do |f| %><%= render partial: 'form', locals: { f: f } %><%= f.button t(:button_save), class: 'button -highlight -with-icon icon-checkmark' %>- <%= link_to t(:button_cancel), project_forum_path(@project, @forum), class: 'button -with-icon icon-cancel' %>+ <%= link_to t(:button_cancel), project_forums_path(@project), class: 'button -with-icon icon-cancel' %><% end %>diff --git a/app/views/forums/index.html.erb b/app/views/forums/index.html.erbindex c8af86e9dd2..017d3219743 100644--- a/app/views/forums/index.html.erb+++ b/app/views/forums/index.html.erb@@ -27,7 +27,19 @@ See docs/COPYRIGHT.rdoc for more details.++#%><% html_title t(:label_forum_plural) %>-<%= toolbar title: t(:label_forum_plural) %>+<%= toolbar title: t(:label_forum_plural) do %>+ <% if User.current.allowed_to?(:manage_forums, @project) %>+ <li class="toolbar-item">+ <%= link_to({ controller: '/forums', action: 'new', project_id: @project },+ { aria: { label: t(:label_forum_new) },+ title: t(:label_forum_new),+ class: 'button -highlight' }) do %>+ <%= op_icon('button--icon icon-add') %>+ <span class="button--text"><%= t('activerecord.models.forum') %></span>+ <% end %>+ </li>+ <% end %>+<% end %><div class="generic-table--container"><div class="generic-table--results-container"><table class="generic-table boards">@@ -36,6 +48,10 @@ See docs/COPYRIGHT.rdoc for more details.<col highlight-col><col highlight-col><col highlight-col>+ <% if User.current.allowed_to?(:manage_forums, @project) %>+ <col highlight-col>+ <col>+ <% end %></colgroup><thead><tr>@@ -75,6 +91,18 @@ See docs/COPYRIGHT.rdoc for more details.</div></div></th>+ <% if User.current.allowed_to?(:manage_forums, @project) %>+ <th>+ <div class="generic-table--sort-header-outer">+ <div class="generic-table--sort-header">+ <span>+ <%=l(:button_sort)%>+ </span>+ </div>+ </div>+ </th>+ <th><div class="generic-table--empty-header"></div></th>+ <% end %></tr></thead><tbody>@@ -93,6 +121,28 @@ See docs/COPYRIGHT.rdoc for more details.<%= link_to_message forum.last_message, no_root: true %><% end %></td>+ <% if User.current.allowed_to?(:manage_forums, @project) %>+ <td class="small-icons">+ <% if authorize_for 'forums', 'edit' %>+ <%= reorder_links 'forum', controller: '/forums',+ action: 'move',+ project_id: @project,+ id: forum %>+ <% end %>+ </td>+ <td class="buttons">+ <%= link_to_if_authorized '',+ { controller: '/forums', action: 'edit', project_id: @project, id: forum },+ class: 'icon icon-edit',+ title: t(:button_edit) %>+ <%= link_to_if_authorized '',+ { controller: '/forums', action: 'destroy', project_id: @project, id: forum },+ data: { confirm: l(:text_are_you_sure) },+ method: :delete,+ class: 'icon icon-delete',+ title: t(:button_delete) %>+ </td>+ <% end %></tr><% end %></tbody>