OpenProject is the leading open source project management software.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 
openproject/app/views/work_packages/context_menus/index.html.erb

156 lines
7.2 KiB

<%#-- copyright
OpenProject is a project management system.
Copyright (C) 2012-2013 the OpenProject Foundation (OPF)
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License version 3.
OpenProject is a fork of ChiliProject, which is a fork of Redmine. The copyright follows:
Copyright (C) 2006-2013 Jean-Philippe Lang
Copyright (C) 2010-2013 the ChiliProject Team
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License
as published by the Free Software Foundation; either version 2
of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
See doc/COPYRIGHT.rdoc for more details.
++#%>
<ul class="menu">
<%= call_hook(:view_work_packages_context_menu_start, {:issues => @work_packages, :can => @can, :back => @back }) %>
<% if !@work_package.nil? -%>
<li class="edit">
<%= context_menu_link l(:button_edit), edit_work_package_path(@work_package),
:class => 'icon-edit',
:disabled => !@can[:edit] %>
</li>
<% else %>
<li class="edit">
<%= context_menu_link l(:button_edit), edit_work_packages_bulk_path(:ids => @work_packages.collect(&:id)),
:class => 'icon-edit',
:disabled => !@can[:edit] %>
</li>
<% end %>
<% updated_issues = @work_packages.collect(&:id) %>
<% default_params = { :back_url => @back,
:updated_object_ids => updated_issues } %>
<% if @allowed_statuses.present? %>
<% params = default_params.merge(:collection => @statuses,
:attribute => 'status',
:selected => lambda { |status| (@work_package && status == @work_package.status) },
:disabled => lambda { |status| !(@can[:update] && @allowed_statuses.include?(status)) }) %>
<%= context_menu_entry(params) %>
<% end %>
<% unless @types.nil? %>
<% params = default_params.merge(:collection => @types,
:attribute => 'type',
:selected => lambda { |type| (@work_package && type == @work_package.type) },
:disabled => lambda { |type| !@can[:edit] }) %>
<%= context_menu_entry(params) %>
<% end %>
<% params = default_params.merge(:collection => @priorities,
:attribute => 'priority',
:selected => lambda { |priority| (@work_package && priority == @work_package.priority) },
:disabled => lambda { |priority| !@can[:edit] || @work_packages.detect { |i| !i.leaf? } }) %>
<%= context_menu_entry(params) %>
<% #TODO: allow editing versions when multiple projects %>
<% unless @project.nil? || (versions = @project.shared_versions.open.sort).empty? -%>
<% versions = versions.map{ |v| [v, format_version_name(v)] } << ["none", l(:label_none)]%>
<% params = default_params.merge(:collection => versions,
:attribute => 'fixed_version',
:selected => lambda { |version| (@work_package && version == @work_package.fixed_version) },
:disabled => lambda { |version| !@can[:update] }) %>
<%= context_menu_entry(params) %>
<% end %>
<% if @assignables.present? -%>
<% assignables = @assignables.dup << [nil, l(:label_none)] %>
<% params = default_params.merge(:collection => assignables,
:attribute => 'assigned_to',
:selected => lambda { |user| @work_package && user == @work_package.assigned_to },
:disabled => lambda { |user| !@can[:update] }) %>
<%= context_menu_entry(params) %>
<% end %>
<% unless @project.nil? || (categories = @project.categories.to_a).empty? -%>
<% categories << [nil, l(:label_none)] %>
<% params = default_params.merge(:collection => categories,
:attribute => 'category',
:selected => lambda { |category| @work_package && category == @work_package.category },
:disabled => lambda { |category| !@can[:update] }) %>
<%= context_menu_entry(params) %>
<% end -%>
<% if WorkPackage.use_field_for_done_ratio? %>
<% params = default_params.merge(:collection => (0..10).map{ |x| x * 10 },
:attribute => 'done_ratio',
:db_attribute => 'done_ratio',
:selected => lambda { |ratio| @work_package && ratio == @work_package.done_ratio },
:disabled => lambda { |ratio| !@can[:edit] || @work_packages.detect { |i| !i.leaf? } }) %>
<%= context_menu_entry(params) %>
<% end -%>
<% if !@work_package.nil? %>
<% if @can[:log_time] -%>
<li class="log_time">
<%= context_menu_link l(:button_log_time),
new_work_package_time_entry_path(@work_package),
:class => 'context_item' %>
</li>
<% end %>
<% if User.current.logged? %>
<li class="watch">
<%= watcher_link(@work_package, User.current) %>
</li>
<% end %>
<% end %>
<% if @work_package.present? %>
<li>
<%= context_menu_link l(:button_duplicate), new_project_work_package_path({ :project_id => @project,
:copy_from => @work_package }),
:class => 'icon-duplicate',
:disabled => !@can[:copy] %>
</li>
<% end %>
<li class="move">
<%= context_menu_link l(:button_move), new_move_work_packages_path(:ids => @work_packages.collect(&:id)),
:class => 'context_item',
:disabled => !@can[:move] %>
</li>
<li class="copy">
<%= context_menu_link l(:button_copy), new_move_work_packages_path(:ids => @work_packages.collect(&:id),
copy: true),
:class => 'context_item' %>
</li>
<li class="delete">
<%= context_menu_link l(:button_delete), work_packages_bulk_path(:ids => @work_packages.collect(&:id)),
:method => :delete,
:confirm => l(:text_work_packages_destroy_confirmation),
:class => 'context_item',
:disabled => !@can[:delete] %>
</li>
<%= call_hook(:view_work_packages_context_menu_end, {:issues => @work_packages, :can => @can, :back => @back }) %>
</ul>