diff --git a/horizon/static/framework/widgets/modal-wait-spinner/modal-wait-spinner.js b/horizon/static/framework/widgets/modal-wait-spinner/modal-wait-spinner.js
index ba4f6f34ed..010b9feae7 100644
--- a/horizon/static/framework/widgets/modal-wait-spinner/modal-wait-spinner.js
+++ b/horizon/static/framework/widgets/modal-wait-spinner/modal-wait-spinner.js
@@ -17,44 +17,45 @@
(function () {
'use strict';
-/**
- @ngdoc overview
- @name horizon.framework.widgets.modal-wait-spinner
- @description
- A "global" wait spinner that displays a line of text followed by "...".
-
- Requires {@link http://angular-ui.github.io/bootstrap/ `Angular-bootstrap`}
-
- Used when the user must wait before any additional action is possible. Can be launched from modal dialogs.
-
- @example
-
- .controller('MyController', [
- '$scope',
- 'horizon.framework.widgets.modal.modal-wait-spinner.service',
- function (modalWaitSpinnerService) {
- $scope.showSpinner = function () {
- modalWaitSpinnerService.showModalSpinner(gettext("Loading"));
- }
- $scope.hideSpinner = function () {
- modalWaitSpinnerService.hideModalSpinner();
- }
- }
- ])
-
-
+ * .controller('MyController', [
+ * '$scope',
+ * 'horizon.framework.widgets.modal.modal-wait-spinner.service',
+ * function (modalWaitSpinnerService) {
+ * $scope.showSpinner = function () {
+ * modalWaitSpinnerService.showModalSpinner(gettext("Loading"));
+ * }
+ * $scope.hideSpinner = function () {
+ * modalWaitSpinnerService.hideModalSpinner();
+ * }
+ * }
+ * ])
+ *
+ *
{$text$}…
' - }; + return { + scope: { + text: '@text' // One-direction binding (reads from parent) + }, + restrict: 'A', + link: link, + template: '{$text$}…
' + }; - function link($scope, element) { - element.spin(spinner_options.modal); - /* - At the time link is executed, element may not have been sized by the browser. - Spin.js may mistakenly places the spinner at 50% of 0 (left:0, top:0). To work around - this, explicitly set 50% left and top to center the spinner in the parent - container - */ - element.find('.spinner').css({'left': '50%', 'top': '50%'}); - } - }]); + function link($scope, element) { + element.spin(spinnerOptions.modal); + /* + * At the time link is executed, element may not have been sized by the browser. + * Spin.js may mistakenly places the spinner at 50% of 0 (left:0, top:0). To work around + * this, explicitly set 50% left and top to center the spinner in the parent + * container + */ + element.find('.spinner').css({'left': '50%', 'top': '50%'}); + } + }]); })(); diff --git a/horizon/static/framework/widgets/modal/modal.js b/horizon/static/framework/widgets/modal/modal.js index 1384f6ce96..b6223882cd 100644 --- a/horizon/static/framework/widgets/modal/modal.js +++ b/horizon/static/framework/widgets/modal/modal.js @@ -37,8 +37,8 @@ .controller('simpleModalCtrl', [ '$scope', '$modalInstance', 'context', function($scope, $modalInstance, context) { $scope.context = context; - $scope.submit = function(){ $modalInstance.close(); }; - $scope.cancel = function(){ $modalInstance.dismiss('cancel'); }; + $scope.submit = function() { $modalInstance.close(); }; + $scope.cancel = function() { $modalInstance.dismiss('cancel'); }; } // end of function ]) // end of controller @@ -74,7 +74,7 @@ 'horizon.framework.util.i18n.gettext', function($modal, path, gettext) { return function(params) { - if (params && params.title && params.body){ + if (params && params.title && params.body) { var options = { controller: 'simpleModalCtrl', templateUrl: path + 'modal/simple-modal.html', diff --git a/horizon/static/framework/widgets/table/basic-table.js b/horizon/static/framework/widgets/table/basic-table.js index 526d25f2a2..35c0f4ea1b 100644 --- a/horizon/static/framework/widgets/table/basic-table.js +++ b/horizon/static/framework/widgets/table/basic-table.js @@ -30,32 +30,33 @@ * * ``` */ - .directive('searchBar', [ 'horizon.framework.widgets.table.filterPlaceholderText', 'horizon.framework.widgets.basePath', + .directive('searchBar', ['horizon.framework.widgets.table.filterPlaceholderText', + 'horizon.framework.widgets.basePath', function(FILTER_PLACEHOLDER_TEXT, path) { - return { - restrict: 'E', - templateUrl: path + 'table/search-bar.html', - transclude: true, - link: function (scope, element, attrs, ctrl, transclude) { - if (angular.isDefined(attrs.groupClasses)) { - element.find('.input-group').addClass(attrs.groupClasses); - } - if (angular.isDefined(attrs.iconClasses)) { - element.find('.fa').addClass(attrs.iconClasses); - } - var searchInput = element.find('[st-search]'); + return { + restrict: 'E', + templateUrl: path + 'table/search-bar.html', + transclude: true, + link: function (scope, element, attrs, ctrl, transclude) { + if (angular.isDefined(attrs.groupClasses)) { + element.find('.input-group').addClass(attrs.groupClasses); + } + if (angular.isDefined(attrs.iconClasses)) { + element.find('.fa').addClass(attrs.iconClasses); + } + var searchInput = element.find('[st-search]'); - if (angular.isDefined(attrs.inputClasses)) { - searchInput.addClass(attrs.inputClasses); + if (angular.isDefined(attrs.inputClasses)) { + searchInput.addClass(attrs.inputClasses); + } + var placeholderText = attrs.placeholder || FILTER_PLACEHOLDER_TEXT; + searchInput.attr('placeholder', placeholderText); + + transclude(scope, function(clone) { + element.find('.input-group').append(clone); + }); } - var placeholderText = attrs.placeholder || FILTER_PLACEHOLDER_TEXT; - searchInput.attr('placeholder', placeholderText); + }; + }]); - transclude(scope, function(clone){ - element.find('.input-group').append(clone); - }); - } - }; - }]); - -}()); \ No newline at end of file +}()); diff --git a/horizon/static/framework/widgets/table/basic-table.spec.js b/horizon/static/framework/widgets/table/basic-table.spec.js index b64f54566a..378ef2b6be 100644 --- a/horizon/static/framework/widgets/table/basic-table.spec.js +++ b/horizon/static/framework/widgets/table/basic-table.spec.js @@ -57,4 +57,4 @@ }); -})(); \ No newline at end of file +})(); diff --git a/horizon/static/framework/widgets/table/table.js b/horizon/static/framework/widgets/table/table.js index 49dfa43d7b..a01b7e9e42 100644 --- a/horizon/static/framework/widgets/table/table.js +++ b/horizon/static/framework/widgets/table/table.js @@ -295,46 +295,47 @@ * ``` * */ - app.directive('hzExpandDetail', ['horizon.framework.widgets.table.expandSettings', function(settings) { - return { - restrict: 'A', - scope: { - icons: '@hzExpandDetail', - duration: '@' - }, - link: function(scope, element) { - element.on('click', function() { - var iconClasses = scope.icons || settings.expandIconClasses; - element.toggleClass(iconClasses); + app.directive('hzExpandDetail', ['horizon.framework.widgets.table.expandSettings', + function(settings) { + return { + restrict: 'A', + scope: { + icons: '@hzExpandDetail', + duration: '@' + }, + link: function(scope, element) { + element.on('click', function() { + var iconClasses = scope.icons || settings.expandIconClasses; + element.toggleClass(iconClasses); - var summaryRow = element.closest('tr'); - var detailCell = summaryRow.next('tr').find('.detail'); - var duration = scope.duration ? parseInt(scope.duration) : settings.duration; + var summaryRow = element.closest('tr'); + var detailCell = summaryRow.next('tr').find('.detail'); + var duration = scope.duration ? parseInt(scope.duration) : settings.duration; - if (summaryRow.hasClass('expanded')) { - var options = { - duration: duration, - complete: function() { - // Hide the row after the slide animation finishes - summaryRow.toggleClass('expanded'); + if (summaryRow.hasClass('expanded')) { + var options = { + duration: duration, + complete: function() { + // Hide the row after the slide animation finishes + summaryRow.toggleClass('expanded'); + } + }; + + detailCell.find('.detail-expanded').slideUp(options); + } else { + summaryRow.toggleClass('expanded'); + + if (detailCell.find('.detail-expanded').length === 0) { + // Slide down animation doesn't work on table cells + // so a