Made a rudimentary attempt at loading query if id is given.

had to put some stuff back into work packages controller again sorry Till.
pull/1065/head
Richard 11 years ago committed by Till Breuer
parent 20ef2c3cf2
commit 3ec128d246
  1. 51
      Gemfile.lock
  2. 3
      app/assets/javascripts/angular/config/work-packages-config.js
  3. 9
      app/assets/javascripts/angular/controllers/work-packages-controller.js
  4. 17
      app/controllers/api/v3/work_packages_controller.rb
  5. 7
      app/controllers/work_packages_controller.rb
  6. 1
      app/models/user.rb

@ -20,9 +20,33 @@ GIT
specs:
prototype_legacy_helper (0.0.0)
PATH
remote: ../openproject-plugins
specs:
openproject-plugins (1.0.6)
rails (~> 3.2.9)
PATH
remote: /home/richard/projects/finnlabs/openproject-backlogs
specs:
openproject-backlogs (3.0.5.pre3)
acts_as_silent_list
openproject-pdf_export
openproject-plugins
rails (~> 3.2.9)
PATH
remote: /home/richard/projects/finnlabs/openproject-pdf_export
specs:
openproject-pdf_export (0.0.1)
openproject-plugins (~> 1.0.5)
prawn (~> 0.14.0)
rails (~> 3.2.14)
GEM
remote: https://rubygems.org/
specs:
Ascii85 (1.0.2)
actionmailer (3.2.17)
actionpack (= 3.2.17)
mail (~> 2.5.4)
@ -54,10 +78,14 @@ GEM
multi_json (~> 1.0)
acts_as_list (0.2.0)
activerecord (>= 3.0)
acts_as_silent_list (1.2.0)
addressable (2.3.4)
arel (3.0.3)
awesome_nested_set (2.1.6)
activerecord (>= 3.0.0)
better_errors (1.1.0)
coderay (>= 1.0.0)
erubis (>= 2.6.6)
binding_of_caller (0.7.2)
debug_inspector (>= 0.0.1)
bourne (1.4.0)
@ -158,6 +186,7 @@ GEM
guard-test (1.0.0)
guard (>= 1.8)
test-unit (~> 2.2)
hashery (2.1.1)
hike (1.2.3)
htmldiff (0.0.1)
i18n (0.6.5)
@ -195,8 +224,20 @@ GEM
paper_trail (2.7.2)
activerecord (~> 3.0)
railties (~> 3.0)
pdf-inspector (1.1.0)
pdf-reader (~> 1.0)
pdf-reader (1.3.3)
Ascii85 (~> 1.0.0)
afm (~> 0.2.0)
hashery (~> 2.0)
ruby-rc4
ttfunk
pg (0.17.1)
polyglot (0.3.3)
prawn (0.14.0)
pdf-reader (~> 1.2)
ruby-rc4
ttfunk (~> 1.0.3)
prototype-rails (3.2.1)
rails (~> 3.2)
pry (0.9.12.2)
@ -220,6 +261,8 @@ GEM
pry-stack_explorer (0.4.9.1)
binding_of_caller (>= 0.7)
pry (>= 0.9.11)
quiet_assets (1.0.2)
railties (>= 3.1, < 5.0)
rabl (0.9.3)
activesupport (>= 2.3.14)
rack (1.4.5)
@ -280,6 +323,7 @@ GEM
ruby-openid (2.2.3)
ruby-prof (0.13.0)
ruby-progressbar (1.2.0)
ruby-rc4 (0.1.5)
rubytree (0.8.3)
json (>= 1.7.5)
structured_warnings (>= 0.1.3)
@ -294,6 +338,8 @@ GEM
multi_json (~> 1.0)
rubyzip
websocket (~> 1.0.4)
sextant (0.2.4)
rails (>= 3.2)
shoulda (3.5.0)
shoulda-context (~> 1.0, >= 1.0.1)
shoulda-matchers (>= 1.4.1, < 3.0)
@ -334,6 +380,7 @@ GEM
treetop (1.4.15)
polyglot
polyglot (>= 0.3.1)
ttfunk (1.0.3)
tzinfo (0.3.38)
uglifier (2.1.1)
execjs (>= 0.3.0)
@ -354,6 +401,7 @@ DEPENDENCIES
activerecord-tableless (~> 1.0)
acts_as_list (~> 0.2.0)
awesome_nested_set
better_errors
capybara
capybara-screenshot
codeclimate-test-reporter
@ -386,6 +434,7 @@ DEPENDENCIES
object-daddy (~> 1.1.0)
oj
pg (~> 0.17.1)
prawn
prototype-rails
prototype_legacy_helper (= 0.0.0)!
pry-byebug
@ -394,6 +443,7 @@ DEPENDENCIES
pry-rails
pry-rescue
pry-stack_explorer
quiet_assets
rabl (= 0.9.3)
rack-protection!
rack_session_access
@ -413,6 +463,7 @@ DEPENDENCIES
rubytree (~> 0.8.3)
sass-rails (~> 3.2.3)
selenium-webdriver
sextant
shoulda
shoulda-matchers
simplecov (>= 0.8.pre)

@ -39,8 +39,7 @@ angular.module('openproject.workPackages.config')
.constant('DEFAULT_QUERY', {
display_sums: false,
// filters: [{ status_id: {"operator":"o","values":[""], name: "status_id" }}],
group_by: null,
id: null
group_by: null
})
.constant('DEFAULT_PAGINATION_OPTIONS', {

@ -5,6 +5,7 @@ angular.module('openproject.workPackages.controllers')
function initialSetup() {
$scope.projectIdentifier = gon.project_identifier;
if(gon.query_id) $scope.query_id = gon.query_id;
$scope.operatorsAndLabelsByFilterType = OPERATORS_AND_LABELS_BY_FILTER_TYPE;
$scope.loading = false;
$scope.disableFilters = false;
@ -28,7 +29,11 @@ angular.module('openproject.workPackages.controllers')
}
function setupQuery() {
$scope.query = new Query(DEFAULT_QUERY, { available_work_package_filters: AVAILABLE_WORK_PACKAGE_FILTERS});
var query = DEFAULT_QUERY;
if($scope.query_id){
angular.extend(query, { id: $scope.query_id });
}
$scope.query = new Query(query, { available_work_package_filters: AVAILABLE_WORK_PACKAGE_FILTERS});
sortation = new Sortation(DEFAULT_SORT_CRITERIA);
$scope.query.setSortation(sortation);
@ -54,6 +59,8 @@ angular.module('openproject.workPackages.controllers')
};
$scope.setupWorkPackagesTable = function(json) {
// TODO: We need to set the columns based on what's returned by the query for when we are loading using a query id.
// Also perhaps the filters... and everything:/
var meta = json.meta;
$scope.workPackageCountByGroup = meta.work_package_count_by_group;
$scope.rows = WorkPackagesTableHelper.getRows(json.work_packages, $scope.query.group_by);

@ -59,7 +59,9 @@ module Api
end
def authorize_request
authorize_global unless performed?
# TODO: need to give this action a global role i think. tried making load_column_data role in reminde.rb
# but couldn't get it working.
# authorize_global unless performed?
end
def assign_planning_elements
@ -81,18 +83,6 @@ module Api
work_packages
end
# TODO: This needs to assign the meta data:
# project_identifier
# query
# work_package_count_by_group
# sort_criteria
# sums
# group_sums
# page
# per_page
# per_page_options
# total_entries
# Most of which can be lifted from work_packages_controller hopefully as long as the query is set up in the same way
def set_planning_elements_meta(query, results, work_packages)
@display_meta = true
@columns = if params[:c]
@ -102,6 +92,7 @@ module Api
end
@work_packages_meta = {
query: query,
work_package_count_by_group: results.work_package_count_by_group,
sums: query.columns.map { |column| results.total_sum_of(column) },
group_sums: query.group_by_column && query.columns.map { |column| results.grouped_sums(column) },

@ -46,6 +46,7 @@ class WorkPackagesController < ApplicationController
include QueriesHelper
include PaginationHelper
include SortHelper
accept_key_auth :index, :show, :create, :update
@ -209,7 +210,7 @@ class WorkPackagesController < ApplicationController
def index
respond_to do |format|
format.html do
push_project_id_via_gon
push_identifiers_via_gon
render :index, :locals => { :query => @query,
:project => @project },
@ -442,9 +443,9 @@ class WorkPackagesController < ApplicationController
# ------------------- Form JSON reponse for angular -------------------
# TODO get from params
def push_project_id_via_gon
def push_identifiers_via_gon
gon.project_identifier = @project.to_param
gon.query_id = params[:query_id] if params[:query_id]
# TODO later versions of gon support gon.push {Hash} - on the other hand they make it harder to deliver data to gon inside views
end

@ -647,7 +647,6 @@ class User < Principal
evaluator.denied_for_global? candidate, action, options
end
!denied && @registered_allowance_evaluators.any? do |evaluator|
evaluator.granted_for_global? candidate, action, options
end

Loading…
Cancel
Save