Added back in clear and save buttons/links.

pull/993/head
Richard 11 years ago
parent ceab6e45cc
commit a5cc64f367
  1. 17
      app/assets/javascripts/angular/directives/work_packages/filter-clear-directive.js
  2. 6
      app/assets/javascripts/angular/models/query.js
  3. 19
      app/views/work_packages/_query_form.html.erb
  4. 3
      public/templates/work_packages/filter_clear.html

@ -0,0 +1,17 @@
angular.module('openproject.workPackages.directives')
.directive('filterClear', [function(){
return {
restrict: 'E',
templateUrl: '/templates/work_packages/filter_clear.html',
// scope: {
// query: '='
// },
scope: true,
link: function(scope, element, attributes) {
scope.clearFilter = function(){
scope.query.clearFilters();
}
}
};
}]);

@ -71,6 +71,12 @@ angular.module('openproject.models')
return this.getActiveFilters().filter(function(filter){
return filter.isConfigured();
});
},
clearFilters: function(){
this.filters.map(function(filter){
filter.deactivated = true;
});
}
};

@ -1,24 +1,11 @@
<%= form_tag({ controller: '/queries', action: 'new' }, id: 'query_form', name: 'queryForm') do %>
<%= hidden_field_tag('project_id', project.to_param) if project %>
<work-packages-options/>
<work-packages-options></work-packages-options>
<p class="buttons hide-when-print">
<%= link_to_remote l(:button_apply),
{ :url => { :set_filter => 1 },
:before => 'selectAllOptions("selected_columns");',
:update => "content",
:method => :get,
:complete => "apply_filters_observer(); resetSelectedMenuItem(); initQuerySelectBehaviour();",
:with => "jQuery('#query_form').serialize()"
}, :class => 'icon icon-yes' %>
<%= link_to_remote l(:button_clear),
{ :url => { :set_filter => 1, :sort => WorkPackagesController::DEFAULT_SORT_ORDER.join(':'), :project_id => project },
:method => :get,
:update => "content",
:complete => 'resetSelectedMenuItem(); initQuerySelectBehaviour();',
}, :class => 'icon icon-undo' %>
<filter-clear query="query">
</filter-clear>
<% if query.new_record? && User.current.allowed_to?(:save_queries, project, :global => true) %>
<%= link_to l(:button_save), {}, :onclick => "selectAllOptions('selected_columns'); jQuery('#query_form').submit(); return false;", :class => 'icon icon-save1' %>

@ -0,0 +1,3 @@
<span>
<a href="" class="icon icon-undo" ng-click="clearFilter()">Clear</a>
</span>
Loading…
Cancel
Save