diff --git a/app/controllers/context_menus_controller.rb b/app/controllers/context_menus_controller.rb index 1fd34aabd..f4ecb9547 100644 --- a/app/controllers/context_menus_controller.rb +++ b/app/controllers/context_menus_controller.rb @@ -95,4 +95,17 @@ class ContextMenusController < ApplicationController render :layout => false end + + def projects + @projects = Project.where(id: params[:ids]).to_a + if @projects.empty? + render_404 + return + end + + if @projects.size == 1 + @project = @projects.first + end + render layout: false + end end diff --git a/app/views/projects/_list.html.erb b/app/views/projects/_list.html.erb index ba26e9d61..39978ee64 100644 --- a/app/views/projects/_list.html.erb +++ b/app/views/projects/_list.html.erb @@ -1,13 +1,21 @@ +<% @admin_list = User.current.admin? && controller_name == 'admin' && action_name == 'projects' %> <%= render_query_totals(@query) %> +<%= form_tag({}, data: {cm_url: projects_context_menu_path}) do -%> +<%= hidden_field_tag 'back_url', url_for(params: request.query_parameters), id: nil %>
| + <% if @admin_list %> + | <% end %> | + <% if @admin_list %> + | <% end %> <% end %> - |
|---|---|
| - <%= link_to(l(:button_archive), archive_project_path(entry, :status => params[:status]), :data => {:confirm => l(:text_are_you_sure)}, :method => :post, :class => 'icon icon-lock') unless entry.archived? %> - <%= link_to(l(:button_unarchive), unarchive_project_path(entry, :status => params[:status]), :method => :post, :class => 'icon icon-unlock') if entry.archived? %> - <%= link_to(l(:button_copy), copy_project_path(entry), :class => 'icon icon-copy') %> - <%= link_to(l(:button_delete), project_path(entry), :method => :delete, :class => 'icon icon-del') %> - | + <% if @admin_list %> +<%= link_to_context_menu %> | <% end %>