Cleaned up dropdowns and save dialog a bit.

pull/1272/head
Richard 11 years ago
parent fd7bb1d3ad
commit 796a6797c6
  1. 6
      app/assets/javascripts/angular/controllers/work-packages-controller.js
  2. 1
      app/assets/javascripts/angular/directives/components/selectable-title-directive.js
  3. 15
      app/assets/javascripts/angular/directives/components/with-dropdown.js
  4. 13
      app/assets/javascripts/angular/services/query-service.js
  5. 10
      public/templates/work_packages/modals/save.html

@ -109,7 +109,9 @@ angular.module('openproject.workPackages.controllers')
$scope.showSettingsModal = settingsModal.activate;
$scope.showShareModal = shareModal.activate;
$scope.showSortingModal = sortingModal.activate;
$scope.showSaveModal = function(saveAs){
$scope.$emit('hideAllDropdowns');
if( saveAs || $scope.query.isNew() ){
saveModal.activate();
} else {
@ -153,8 +155,8 @@ angular.module('openproject.workPackages.controllers')
$scope.setupWorkPackagesTable = function(json) {
var meta = json.meta;
if (!$scope.columns) $scope.columns = meta.columns;
if (!$scope.groupableColumns) $scope.groupableColumns = meta.groupable_columns;
$scope.columns = meta.columns;
$scope.groupableColumns = meta.groupable_columns;
$scope.query = QueryService.getQuery() || QueryService.initQuery($scope.query_id, meta.query, $scope.columns, afterQuerySetupCallback);
PaginationService.setPerPageOptions(meta.per_page_options);

@ -47,6 +47,7 @@ angular.module('openproject.uiComponents')
scope.reload = function(modelId, newTitle) {
scope.selectedTitle = newTitle;
scope.reloadMethod(modelId);
scope.$emit('hideAllDropdowns');
}
scope.filterModels = function(filterBy) {

@ -29,11 +29,7 @@
// TODO move to UI components
angular.module('openproject.uiComponents')
.directive('withDropdown', function () {
function hideAllDropdowns() {
jQuery('.dropdown').hide();
}
.directive('withDropdown', ['$rootScope', function ($rootScope) {
function position(dropdown, trigger) {
var hOffset = 0,
@ -67,6 +63,10 @@ angular.module('openproject.uiComponents')
dropdownId: '@'
},
link: function (scope, element, attributes) {
$rootScope.$on('hideAllDropdowns', function(event){
jQuery('.dropdown').hide();
});
element.on('click', function () {
var trigger = jQuery(this),
@ -74,11 +74,12 @@ angular.module('openproject.uiComponents')
event.preventDefault();
event.stopPropagation();
hideAllDropdowns();
scope.$emit('hideAllDropdowns');
dropdown.show();
position(dropdown, trigger);
});
}
};
});
}]);

@ -201,14 +201,11 @@ angular.module('openproject.services')
},
doQuery: function(url, params, method, callback) {
if(!method){
var method = 'GET';
}
if(!callback){
var callback = function(response){
return response.data;
};
}
method = method || 'GET';
callback = callback || function(response){
return response.data;
};
return $http({
method: method,
url: url,

@ -4,8 +4,14 @@
<h1>Save</h1>
<input type="text" name="query_name" ng-model="queryName"></input>
<button ng-click="saveQueryAs(queryName)">Save</button>
<div>
<label for="name">Name</label>
<input type="text" name="query_name" ng-model="queryName"></input>
</div>
<div>
<button ng-click="modal.closeMe()">Cancel</button>
<button ng-click="saveQueryAs(queryName)">Save</button>
</div>
</div>
</div>

Loading…
Cancel
Save