<ul>
  <% if @template %>
    <% if @parent_project ? @parent_project.allowed_to_create_subproject_from_template? : Project.allowed_to_create_project_from_template? %>
      <%= content_tag(:li, context_menu_link(l(:button_create_project_from_template), { :controller => 'templates', :action => 'show_create_project', :id => @template, :parent_id => params[:parent_id] },
        :class => 'icon icon-add',
        :title => l(:title_button_template_create_project)
      )) -%>
    <% end %>

    <% if User.current.allowed_to_globally?(:create_project_from_template, {}) %>
      <%= content_tag(:li, context_menu_link(l(:button_copy_project_from_template), { :controller => 'templates', :action => 'show_copy_project', :id => @template },
        :class => 'icon icon-copy',
        :title => l(:title_button_template_copy_project)
      )) -%>
    <% end %>

    <% if User.current.allowed_to_globally?(:edit_project_template, {}) %>
      <%= content_tag :li, context_menu_link(l(:button_edit), {:controller => 'projects', :action => 'settings', :id => @template}, :class => 'icon icon-edit') -%>
    <% end -%>

    <% if User.current.admin? && Redmine::Plugin.installed?(:easy_data_templates)
      exportables = @template.enabled_modules.collect{ |m| m.name.to_sym }
      exportables << :issues if exportables.delete(:issue_tracking)
      exportables << :time_entries if exportables.delete(:time_tracking)
      exportables = exportables & EasyXmlData::Exporter.exportables %>
      <%= content_tag :li, context_menu_link(l(:label_export_template), easy_xml_data_export_path(format: 'xml', projects: [@template], exportables: exportables),
                                             :class => 'icon icon-export',
                                             :method => :post,
      ) -%>
      <% end %>
  <% end %>

  <% if User.current.allowed_to?(:delete_project_template, nil, :global => true) %>
    <%= content_tag :li, context_menu_link(l(:button_delete), { :controller => 'templates', :action => 'bulk_destroy', :ids => params[:ids] },
      :class => 'icon icon-del',
      :method => :delete,
      :data => {:confirm => l(:text_are_you_sure)}
    ) -%>
  <% end %>
</ul>
