Made some tweaks to the save(as) auth

pull/1499/head
Richard 11 years ago
parent 6f78b4ef02
commit 3c31db5481
  1. 5
      app/controllers/api/experimental/work_packages_controller.rb
  2. 5
      public/templates/work_packages.list.html

@ -183,10 +183,9 @@ module Api
json_query = query.as_json(except: :filters, include: :filters, methods: [:starred])
links = {}
links[:create] = api_experimental_queries_path if user.allowed_to?(:save_queries, @project, :global => @project.nil?)
if query.new_record?
links[:create] = api_experimental_queries_path if user.allowed_to?(:save_queries, @project, :global => @project.nil?)
else
if !query.new_record?
links[:update] = api_experimental_query_path(query) if user.allowed_to?(:save_queries, @project, :global => @project.nil?)
links[:delete] = api_experimental_query_path(query) if user.allowed_to?(:save_queries, @project, :global => @project.nil?)
links[:publicize] = api_experimental_query_path(query) if user.allowed_to?(:manage_public_queries, @project, :global => @project.nil?)

@ -60,10 +60,11 @@
<li><a href ng-click="showGroupingModal()"><i class="icon-action-menu icon-group-by2"></i>{{ I18n.t('js.toolbar.settings.group_by') }}</a></li>
<li><a href ng-click="toggleDisplaySums()"><i ng-if="query.displaySums" class="icon-action-menu icon-yes"></i><i ng-if="!query.displaySums" class="icon-action-menu no-icon"></i>{{ I18n.t('js.toolbar.settings.display_sums') }}</a></li>
<li class="dropdown-divider"></li>
<li><a href ng-click="saveQuery($event)" ng-class="{'inactive': cannot(query, 'create')}">
<li><a href ng-click="saveQuery($event)"
ng-class="{'inactive': (!query.isNew() && cannot(query, 'update')) || (query.isNew() && cannot(query, 'create'))}">
<i class="icon-action-menu icon-save1"></i>{{ I18n.t('js.toolbar.settings.save') }}</a>
</li>
<li><a href ng-click="showSaveAsModal($event)" ng-class="{'inactive': query.isNew() || cannot(query, 'update')}">
<li><a href ng-click="showSaveAsModal($event)" ng-class="{'inactive': query.isNew() || cannot(query, 'create')}">
<i class="icon-action-menu icon-save1"></i>{{ I18n.t('js.toolbar.settings.save_as') }}</a>
</li>
<li><a href ng-click="deleteQuery($event)" ng-class="{'inactive': query.isNew() || cannot(query, 'delete')}">

Loading…
Cancel
Save