Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix move/resize issues and improve styling #2797

Merged
merged 3 commits into from
Aug 11, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
12 changes: 12 additions & 0 deletions contribs/gmf/less/base.less
Original file line number Diff line number Diff line change
Expand Up @@ -49,3 +49,15 @@ i, cite, em, var, address, dfn {
.control-label {
font-weight: normal;
}

.modal-content {
border-radius: 0;
}
.modal-body, .modal-header {
padding: 10px;
}
.modal-title {
font-weight: bold;
font-size: inherit;
line-height: 1;
}
1 change: 1 addition & 0 deletions contribs/gmf/less/desktop.less
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,7 @@ main {
position: relative;
height: 100%;
background-image: url('data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAwAAAAMCAAAAABzHgM7AAAAAnRSTlMAAHaTzTgAAAARSURBVHgBY3iKBFEAOp/+MgB+UQnYeBZPWAAAAABJRU5ErkJggg==');
overflow: hidden;
}

@footer-height: @input-height-base + 2 * @padding-base-vertical;
Expand Down
3 changes: 3 additions & 0 deletions contribs/gmf/less/displayquerywindow.less
Original file line number Diff line number Diff line change
Expand Up @@ -120,6 +120,9 @@
height: @map-tools-size;
display: flex;
justify-content: space-between;
position: absolute;
bottom: 0;
width: 100%;
.gmf-displayquerywindow-placeholder {
// these elements are necessary when only the middle element (results)
// is shown to center it in the middle (with 'justify-content')
Expand Down
14 changes: 13 additions & 1 deletion contribs/gmf/src/directives/displayquerywindow.js
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,7 @@ gmf.module.component('gmfDisplayquerywindow', gmf.displayquerywindowComponent);


/**
* @param {!jQuery} $element Element.
* @param {!angular.Scope} $scope Angular scope.
* @param {!ngeox.QueryResult} ngeoQueryResult ngeo query result.
* @param {!ngeo.FeatureHelper} ngeoFeatureHelper the ngeo FeatureHelper service.
Expand All @@ -96,7 +97,7 @@ gmf.module.component('gmfDisplayquerywindow', gmf.displayquerywindowComponent);
* @ngdoc controller
* @ngname GmfDisplayquerywindowController
*/
gmf.DisplayquerywindowController = function($scope, ngeoQueryResult,
gmf.DisplayquerywindowController = function($element, $scope, ngeoQueryResult,
ngeoFeatureHelper, ngeoFeatureOverlayMgr) {

/**
Expand Down Expand Up @@ -209,6 +210,12 @@ gmf.DisplayquerywindowController = function($scope, ngeoQueryResult,
*/
this.open = false;

/**
* @const {!jQuery}
* @private
*/
this.element_ = $element;

$scope.$watchCollection(
() => ngeoQueryResult,
(newQueryResult, oldQueryResult) => {
Expand Down Expand Up @@ -255,6 +262,11 @@ gmf.DisplayquerywindowController.prototype.$onInit = function() {
});
}
this.highlightFeatureOverlay_.setStyle(highlightFeatureStyle);

if (this.desktop) {
this.element_.find('.gmf-displayquerywindow').draggable();
this.element_.find('.gmf-displayquerywindow-container').resizable();
}
};


Expand Down
4 changes: 3 additions & 1 deletion contribs/gmf/test/spec/directives/displayquerywindow.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,14 @@ describe('gmf.displayquerywindowComponent', () => {

let displayQueriesController;
let ngeoQueryResult;
let $element;
let $scope;
let $rootScope;

beforeEach(inject(($injector, _$controller_, _$rootScope_) => {
ngeoQueryResult = $injector.get('ngeoQueryResult');
const $controller = _$controller_;
$element = angular.element('<div></div>');
$rootScope = _$rootScope_;
$scope = $rootScope.$new();
const data = {
Expand All @@ -21,7 +23,7 @@ describe('gmf.displayquerywindowComponent', () => {
}
};
displayQueriesController = $controller(
'GmfDisplayquerywindowController', {$scope}, data);
'GmfDisplayquerywindowController', {$element, $scope}, data);
}));

describe('#show', () => {
Expand Down
11 changes: 7 additions & 4 deletions src/directives/modal.js
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,6 @@ ngeo.modalDirective = function($parse) {
angular.element(document.body).append(modal);

modal.find('.modal-dialog').draggable();
modal.find('.modal-content').resizable();

ngModelController.$render = function() {
modal.modal(ngModelController.$viewValue ? 'show' : 'hide');
Expand All @@ -86,19 +85,23 @@ ngeo.modalDirective = function($parse) {
modal.on('hide.bs.modal', onHide);
modal.on('show.bs.modal', onShow);
} else {
modal.find('.modal-content').append(transcludeFn());
modal.find('.modal-content').resizable().append(transcludeFn());
}

function onShow(e) {
childScope = scope.$new();
transcludeFn(childScope, (clone) => {
modal.find('.modal-content').append(clone);
modal.find('.modal-content').resizable().append(clone);
});
}

function onHide(e) {
childScope.$destroy();
modal.find('.modal-content').empty();
const content = modal.find('.modal-content');
if (content.hasClass('ui-resizable')) {
content.resizable('destroy');
}
content.empty();
}
}
};
Expand Down