Merge branch 'dev' into fix/8386-reset-query-title-on-clear

pull/1385/head
Richard 11 years ago
commit a9a78a097b
  1. 13
      app/assets/javascripts/angular/controllers/dialogs/settings.js
  2. 46
      app/assets/javascripts/angular/directives/work_packages/options-dropdown-directive.js
  3. 1
      app/assets/javascripts/angular/models/query.js
  4. 8
      app/assets/javascripts/angular/services/query-service.js
  5. 13
      app/assets/stylesheets/content/_work_packages_table.sass
  6. 11
      app/controllers/api/v3/queries_controller.rb
  7. 6
      app/controllers/members_controller.rb
  8. 4
      app/views/api/v3/queries/destroy.api.rabl
  9. 9
      config/locales/js-de.yml
  10. 9
      config/locales/js-en.yml
  11. 4
      config/routes.rb
  12. 1
      doc/CHANGELOG.md
  13. 10
      karma.conf.js
  14. 28
      package.json
  15. 2
      public/templates/work_packages.html
  16. 11
      public/templates/work_packages/modals/settings.html
  17. 4
      public/templates/work_packages/work_packages_table.html

@ -36,7 +36,18 @@ angular.module('openproject.workPackages.controllers')
});
}])
.controller('SettingsModalController', ['settingsModal', function(settingsModal) {
.controller('SettingsModalController', ['$scope', 'settingsModal', 'QueryService',
function($scope, settingsModal, QueryService) {
this.name = 'Settings';
this.closeMe = settingsModal.deactivate;
$scope.query = QueryService.getQuery();
$scope.deleteQuery = false;
$scope.updateQuery = function(deleteQuery) {
QueryService.saveQuery()
.then(function(data){
settingsModal.deactivate();
$scope.$emit('flashMessage', data.status);
});
};
}]);

@ -49,11 +49,7 @@ angular.module('openproject.workPackages.directives')
});
// Modals
scope.showColumnsModal = columnsModal.activate;
scope.showExportModal = exportModal.activate;
scope.showSettingsModal = settingsModal.activate;
scope.showShareModal = shareModal.activate;
scope.showGroupingModal = groupingModal.activate;
scope.showSaveModal = function(saveAs){
scope.$emit('hideAllDropdowns');
@ -67,20 +63,50 @@ angular.module('openproject.workPackages.directives')
}
};
scope.showColumnsModal = function(){
scope.$emit('hideAllDropdowns');
columnsModal.activate();
scope.deleteQuery = function(){
if( deleteConfirmed() ){
QueryService.deleteQuery()
.then(function(data){
settingsModal.deactivate();
scope.$emit('flashMessage', data.status);
scope.$emit('queryResetRequired');
})
}
};
scope.showSortingModal = function(){
scope.$emit('hideAllDropdowns');
sortingModal.activate();
scope.showColumnsModal = function(){
showModal.call(columnsModal);
};
scope.showSortingModal = function(){
showModal.call(sortingModal);
};
scope.showSettingsModal = function(){
showModal.call(settingsModal);
};
scope.showGroupingModal = function(){
showModal.call(groupingModal);
};
scope.showShareModal = function(){
showModal.call(shareModal);
};
scope.toggleDisplaySums = function(){
scope.$emit('hideAllDropdowns');
scope.query.displaySums = !scope.query.displaySums;
};
function showModal() {
scope.$emit('hideAllDropdowns');
this.activate();
}
function deleteConfirmed() {
return $window.confirm(I18n.t('js.text_query_destroy_confirmation'));
}
}
};
}]);

@ -75,6 +75,7 @@ angular.module('openproject.models')
'group_by': this.groupBy,
'sort': this.sortation.encode(),
'display_sums': this.displaySums,
'name': this.name,
'is_public': this.isPublic
}].concat(this.getActiveConfiguredFilters().map(function(filter) {
return filter.toParams();

@ -291,6 +291,14 @@ angular.module('openproject.services')
});
},
deleteQuery: function() {
var url = PathHelper.apiProjectQueryPath(query.project_id, query.id);
return QueryService.doQuery(url, query.toUpdateParams(), 'DELETE', function(response){
QueryService.resetQuery();
return angular.extend(response.data, { status: { text: I18n.t('js.notice_successful_delete') }} );
});
},
doGet: function(url, success, failure) {
return QueryService.doQuery(url, null, 'GET', success, failure);
},

@ -79,6 +79,19 @@ table.workpackages-table
p:hover
background: #fff598
.sort-header
width: 100%
clear: both
display: table
& > a,
& > span
display: table-cell
& > span
width: 1em
text-align: right
div.active-column
position: absolute
top: 10px

@ -40,7 +40,7 @@ module Api::V3
before_filter :find_optional_project
before_filter :setup_query_for_create, only: [:create]
before_filter :setup_query_for_update, only: [:update]
before_filter :setup_existing_query, only: [:update, :destroy]
before_filter :setup_query, only: [:available_columns, :custom_field_filters]
def available_columns
@ -93,6 +93,13 @@ module Api::V3
end
end
def destroy
@query.destroy
respond_to do |format|
format.api
end
end
private
def setup_query
@ -107,7 +114,7 @@ module Api::V3
@query.user = User.current
end
def setup_query_for_update
def setup_existing_query
@query = Query.find(params[:id])
prepare_query(@query)
end

@ -61,7 +61,7 @@ class MembersController < ApplicationController
page.replace_html "tab-content-members", :partial => 'projects/settings/members'
page.insert_html :top, "tab-content-members", render_flash_messages
page << TAB_SCRIPTS
page << MembersController.tab_scripts
end
end
else
@ -98,7 +98,7 @@ class MembersController < ApplicationController
page.replace_html "tab-content-members", :partial => 'projects/settings/members'
end
page.insert_html :top, "tab-content-members", render_flash_messages
page << TAB_SCRIPTS
page << MembersController.tab_scripts
page.visual_effect(:highlight, "member-#{@member.id}") unless Member.find_by_id(@member.id).nil?
end
end
@ -117,7 +117,7 @@ class MembersController < ApplicationController
render(:update) do |page|
page.replace_html "tab-content-members", :partial => 'projects/settings/members'
page.insert_html :top, "tab-content-members", render_flash_messages
page << TAB_SCRIPTS
page << MembersController.tab_scripts
end
end
end

@ -0,0 +1,4 @@
object @query => :query
attributes :id, :name

@ -141,6 +141,7 @@ de:
other: "Sie dürfen nur {{limit}} Elemente auswählen"
zero: "Sie dürfen keine Elemente auswählen"
text_work_packages_destroy_confirmation: "Sind Sie sicher, dass Sie die ausgewählten Arbeitspakete löschen möchten?"
text_query_destroy_confirmation: "Möchten Sie die ausgewählte Abfrage wirklich löschen?"
timelines:
cancel: "Abbrechen"
change: "Planungsveränderung"
@ -228,8 +229,16 @@ de:
save_as: "Speichern unter ..."
export: "Exportieren ..."
share: "Sichtbarkeit ..."
page_settings: "Konfiguration ..."
delete: "Löschen"
filter: "Filter"
unselected_title: "Arbeitspakete"
modals:
label_settings: "Konfiguration"
label_name: "Name"
label_delete_page: "Aktuelle Seite löschen"
button_submit: "OK"
button_cancel: "Abbrechen"
notice_successful_create: "Erfolgreich angelegt"
notice_successful_delete: "Erfolgreich gelöscht."
notice_successful_update: "Erfolgreich aktualisiert."

@ -140,6 +140,7 @@ en:
other: "You can only select {{limit}} items"
zero: "You cannot select any items"
text_work_packages_destroy_confirmation: "Are you sure you want to delete the selected work package(s)?"
text_query_destroy_confirmation: "Are you sure you want to delete the selected query?"
timelines:
cancel: Cancel
change: "Change in planning"
@ -231,8 +232,16 @@ en:
save_as: "Save as ..."
export: "Export ..."
share: "Share ..."
page_settings: "Page settings ..."
delete: "Delete"
filter: "Filter"
unselected_title: "Work packages"
modals:
label_settings: "Settings"
label_name: "Name"
label_delete_page: "Delete current page"
button_submit: "Submit"
button_cancel: "Cancel"
notice_successful_create: "Successful creation."
notice_successful_delete: "Successful deletion."
notice_successful_update: "Successful update."

@ -118,7 +118,7 @@ OpenProject::Application.routes.draw do
get :column_data, on: :collection
get :column_sums, on: :collection
end
resources :queries, only: [:show, :create, :update] do
resources :queries, only: [:show, :create, :update, :destroy] do
get :available_columns, on: :collection
get :custom_field_filters, on: :collection
get :grouped, on: :collection
@ -128,7 +128,7 @@ OpenProject::Application.routes.draw do
resources :work_packages, only: [:index] do
get :column_sums, on: :collection
end
resources :queries, only: [:show, :create, :update] do
resources :queries, only: [:show, :create, :update, :destroy] do
get :available_columns, on: :collection
get :custom_field_filters, on: :collection
get :grouped, on: :collection

@ -77,6 +77,7 @@ See doc/COPYRIGHT.rdoc for more details.
* `#7562` Regression: creating ticket via API fails with HTTP 422
* `#7608` Make highlight buttons styleable
* `#8228` Icons in select2 elements missing
* `#8277` Fix arrow of column headers not restrained to one line
* Allowed sending of mails with only cc: or bcc: fields
* Allow adding attachments to created work packages via planning elements controller
* Remove unused rmagick dependency

@ -117,6 +117,7 @@ module.exports = function(config) {
// preprocess matching files before serving them to the browser
// available preprocessors: https://npmjs.org/browse/keyword/karma-preprocessor
preprocessors: {
'app/assets/javascripts/angular/**/*.js': ['coverage'],
'public/templates/**/*.html': ['ng-html2js']
},
@ -124,7 +125,7 @@ module.exports = function(config) {
// test results reporter to use
// possible values: 'dots', 'progress'
// available reporters: https://npmjs.org/browse/keyword/karma-reporter
reporters: ['progress', 'junit'],
reporters: ['progress', 'coverage', 'junit'],
// web server port
@ -159,6 +160,13 @@ module.exports = function(config) {
outputFile: 'karma/reports/test-results.xml'
},
coverageReporter: {
reporters: [
{ type: 'html', dir:'coverage/' },
{ type: 'cobertura' }
]
},
ngHtml2JsPreprocessor: {
stripPrefix: 'public',
moduleName: 'templates'

@ -3,30 +3,30 @@
"version": "0.1.0",
"devDependencies": {
"bower": "~1.3.3",
"chai": "~1.9.1",
"exec": "0.0.6",
"grunt": "~0.4.2",
"grunt-contrib-jshint": "~0.8.0",
"phantomjs": "~1.9.2",
"grunt-contrib-watch": "~0.5.3",
"grunt-jscoverage": "0.0.3",
"rimraf": "~2.2.5",
"grunt-karma": "~0.8.2",
"json2htmlcov": "~0.1.1",
"exec": "0.0.6",
"readable-stream": "1.1.11",
"karma": "~0.12.3",
"karma-coverage": "~0.0.3",
"karma-phantomjs-launcher": "~0.1.4",
"grunt-karma": "~0.8.2",
"mocha": "~1.18.2",
"karma-mocha": "~0.1.3",
"karma-chai": "~0.1.0",
"karma-chai-sinon": "~0.1.3",
"karma-chrome-launcher": "~0.1.3",
"karma-coverage": "^0.2.3",
"karma-firefox-launcher": "~0.1.3",
"chai": "~1.9.1",
"karma-chai": "~0.1.0",
"karma-ng-html2js-preprocessor": "~0.1.0",
"karma-junit-reporter": "~0.2.2",
"karma-mocha": "~0.1.3",
"karma-ng-html2js-preprocessor": "~0.1.0",
"karma-phantomjs-launcher": "~0.1.4",
"mocha": "~1.18.2",
"phantomjs": "~1.9.2",
"readable-stream": "1.1.11",
"rimraf": "~2.2.5",
"sinon": "~1.9.1",
"sinon-chai": "~2.5.0",
"karma-chai-sinon": "~0.1.3"
"sinon-chai": "~2.5.0"
},
"scripts": {
"test": "./node_modules/karma/bin/karma start --single-run --browsers Firefox,PhantomJS"

@ -65,7 +65,9 @@
<li class="dropdown-divider"></li>
<li><a href ng-click="showSaveModal()"><i class="icon-action-menu icon-save1"></i>{{ I18n.t('js.toolbar.settings.save') }}</a></li>
<li ng-show="!query.isNew()"><a href ng-click="showSaveModal(true)"><i class="icon-action-menu icon-save1"></i>{{ I18n.t('js.toolbar.settings.save_as') }}</a></li>
<li ng-show="!query.isNew()"><a href ng-click="deleteQuery()"><i class="icon-action-menu icon-delete"></i>{{ I18n.t('js.toolbar.settings.delete') }}</a></li>
<li ng-show="!query.isNew()"><a href ng-click="showShareModal()"><i class="icon-action-menu icon-publish"></i>{{ I18n.t('js.toolbar.settings.share') }}</a></li>
<li ng-show="!query.isNew()"><a href ng-click="showSettingsModal()"><i class="icon-action-menu icon-settings"></i>{{ I18n.t('js.toolbar.settings.page_settings') }}</a></li>
</ul>
</div>

@ -2,7 +2,16 @@
<div class="ng-modal-inner">
<div class="modal-header"><i class="icon-close" ng-click="modal.closeMe()"></i></div>
<h3>Settings</h3>
<h3>{{ I18n.t('js.modals.label_settings') }}</h3>
<div>
<label for="name">{{ I18n.t('js.modals.label_name') }}</label>
<input class="short" type="text" name="query_name" ng-model="query.name"></input>
</div>
<div>
<button class="button_highlight" ng-click="updateQuery(deleteQuery)">{{ I18n.t('js.modals.button_submit') }}</button>
<button class="button" ng-click="modal.closeMe()">{{ I18n.t('js.modals.button_cancel') }}</button>
</div>
</div>
</div>

@ -29,9 +29,7 @@
target="columnContextMenu"
process-event="adaptVerticalPosition"
trigger-on-event="click">
<span style="float: right">
<icon-wrapper icon-name="pulldown-arrow1" title="{{I18n.t('js.label_open_menu')}}"></icon-wrapper>
</span>
<icon-wrapper icon-name="pulldown-arrow1" title="{{I18n.t('js.label_open_menu')}}"></icon-wrapper>
</span>
</th>
</tr>

Loading…
Cancel
Save