WIP. started moving things around...

pull/1065/head
Richard 11 years ago
parent 64b13aedbc
commit 8ca35754b6
  1. 38
      app/assets/javascripts/angular/config/work-packages-config.js
  2. 8
      app/assets/javascripts/angular/controllers/work-packages-controller.js
  3. 5
      app/assets/javascripts/angular/openproject-app.js
  4. 4
      app/controllers/work_packages_controller.rb

@ -0,0 +1,38 @@
angular.module('openproject.workPackages.config')
.constant('AVAILABLE_COLUMNS', [
{
custom_field: false,
groupable: 'project',
meta_data: { data_type: 'object', link: { display: true, model_type: 'project' } },
name: 'project',
sortable: 'projects.name',
title: 'Project'
},
{
custom_field: false,
groupable: 'type',
meta_data: { data_type: 'object', link: { display: true } },
name: 'type',
sortable: 'types.postition',
title: 'Type'
}
])
.constant('INITIALLY_SELECT_COLUMNS', [
{
custom_field: false,
groupable: 'type',
meta_data: { data_type: 'object', link: { display: true } },
name: 'type',
sortable: 'types.postition',
title: 'Type'
}
])
.constant('AVAILABLE_WORK_PACKAGE_FILTERS', {
assigned_to_id: { name: 'Assignee', type: 'list_optional' }, // Note: we might want to put default "me" value here
created_at: { name: 'Created on', type: 'date_past' },
subject: { name: 'Subject', type: 'text' },
estimated_hours: { name: 'Estimated time', type: 'integer' }
})

@ -1,6 +1,6 @@
angular.module('openproject.workPackages.controllers')
.controller('WorkPackagesController', ['$scope', 'WorkPackagesTableHelper', 'Query', 'Sortation', 'WorkPackageService', function($scope, WorkPackagesTableHelper, Query, Sortation, WorkPackageService) {
.controller('WorkPackagesController', ['$scope', 'WorkPackagesTableHelper', 'Query', 'Sortation', 'WorkPackageService', 'AVAILABLE_COLUMNS', 'INITIALLY_SELECT_COLUMNS', function($scope, WorkPackagesTableHelper, Query, Sortation, WorkPackageService, AVAILABLE_COLUMNS, INITIALLY_SELECT_COLUMNS) {
function initialSetup() {
$scope.projectIdentifier = gon.project_identifier;
@ -16,8 +16,8 @@ angular.module('openproject.workPackages.controllers')
$scope.query.setSortation(sortation);
// Columns
$scope.columns = gon.columns;
$scope.availableColumns = WorkPackagesTableHelper.getColumnDifference(gon.available_columns, $scope.columns);
$scope.columns = INITIALLY_SELECT_COLUMNS;
$scope.availableColumns = WorkPackagesTableHelper.getColumnDifference(AVAILABLE_COLUMNS, $scope.columns);
$scope.currentSortation = gon.sort_criteria;
@ -52,7 +52,7 @@ angular.module('openproject.workPackages.controllers')
// Initially setup scope via gon
initialSetup();
setupQuery(gon);
setupQuery();
// Initialize work package table
$scope.setupWorkPackagesTable(gon);

@ -15,8 +15,9 @@ angular.module('openproject.timelines.directives', ['openproject.timelines.model
angular.module('openproject.workPackages', ['openproject.workPackages.controllers', 'openproject.workPackages.filters', 'openproject.workPackages.directives', 'openproject.uiComponents']);
angular.module('openproject.workPackages.helpers', ['openproject.helpers']);
angular.module('openproject.workPackages.filters', ['openproject.workPackages.helpers']);
angular.module('openproject.workPackages.controllers', ['openproject.models', 'openproject.workPackages.helpers', 'openproject.services']);
angular.module('openproject.workPackages.directives', ['openproject.helpers', 'openproject.workPackages.helpers', 'openproject.services']);
angular.module('openproject.workPackages.config', []);
angular.module('openproject.workPackages.controllers', ['openproject.models', 'openproject.workPackages.helpers', 'openproject.services', 'openproject.workPackages.config']);
angular.module('openproject.workPackages.directives', ['openproject.uiComponents', 'openproject.services']);
// main app
var openprojectApp = angular.module('openproject', ['ui.select2', 'ui.date', 'openproject.uiComponents', 'openproject.timelines', 'openproject.workPackages', 'ngAnimate']);

@ -572,8 +572,8 @@ class WorkPackagesController < ApplicationController
get_results_as_json(results, work_packages).merge(
project_identifier: @project.to_param,
query: get_query_as_json(@query),
columns: get_columns_for_json(@query.columns),
available_columns: get_columns_for_json(@query.available_columns),
# columns: get_columns_for_json(@query.columns),
# available_columns: get_columns_for_json(@query.available_columns),
sort_criteria: @sort_criteria.to_param
)
end

Loading…
Cancel
Save