bastion 0.2.6 → 0.2.7

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,15 +1,15 @@
1
1
  ---
2
2
  !binary "U0hBMQ==":
3
3
  metadata.gz: !binary |-
4
- MzVmNGUwNmI0Y2IwZTcyMTBiYmMzYWRmYjNhN2NlNTE3MjA1NGYyYg==
4
+ MWFjYWVkN2QxYTY0ZGMwMDMxN2M1OTU1NjcxN2ZmYWIzODAxMThkZg==
5
5
  data.tar.gz: !binary |-
6
- MmZiOWE3M2U4OTFiZWU4MjEyZGU2MmYxNTk2OTIzZTIxYjk4ODZjYQ==
6
+ N2VlNGVjNjRiNzI1MWE4YWM2NmZiNGVkOTU5YjZiNWJjMzMyNGU3ZQ==
7
7
  SHA512:
8
8
  metadata.gz: !binary |-
9
- NGVmYWQ1YWZjZGYxZjI5ZTdlZTUyMjFkZTUwYzY5MTAzODcxNTk5Zjc1ZTI5
10
- MTUzMDQwYmQzY2RhN2IyMGYyNTY4Y2NjNDI2MjhlNDdhZWI3MjIyNTBhODVi
11
- MjliYmU4MzUxYmQ5MmMwMDczZmJlZWE1MTViNjU1YzRmZDljYjM=
9
+ M2RhMWQ5NDhhZmMyMDU4NTNhNTUwOWRhMmI4ZTgyZTBkZDA4M2VmZDBlZjE0
10
+ ODRlYzNkNDA4YWVjZjM3NTIxMTU3YjMwODdmMGEwMTEwYzBkYWRmZWRlMDk4
11
+ YzFiNDVhYWY3YzQ2YzRhZGEzNWVhNDY3ZGE0MzNmZWIzMmUxZmM=
12
12
  data.tar.gz: !binary |-
13
- NWUyZTIyMmU5ZjNkMDJjOTI4MDEyMjM4ZTU2MjM3Yzc5NzQ3NWI3N2UyM2Y5
14
- ZjExNjFhMDBjZjliNmJlZTZlZjhiNzEyODY4MjExZmRjODI5MzUxMTAyYzJj
15
- MmYwYzI4ZGViODRkNDE1YmViYTAwNmRiN2E5NTg0MmFhOWIwOWI=
13
+ ODc1NWUwMTRiODkzOTU3ZmJmNmIyNWNmZjgxZTU1YWY2ODhiOTlhNjM2MmMx
14
+ YzIxOTBiYzYzYzBjNmQ5Njc5MWFjOWRkZmJiZTk2ZDUxNDhkODYzNjEyODlk
15
+ ZDc2NjdiYWY1OGMyYTA2ZjhjYjY0Yzg3NTZjMTgyZDEyMzczNTc=
@@ -25,56 +25,52 @@
25
25
  angular.module('Bastion.components').directive('bstModal',
26
26
  ['$templateCache', '$modal', function ($templateCache, $modal) {
27
27
  return {
28
- // To be expanded when we add additional type of modals
29
- templateUrl: 'components/views/bst-modal.html',
30
- replace: true,
28
+ transclude: true,
31
29
  scope: {
32
30
  action: '&bstModal',
33
31
  modelName: '@model',
34
- model: '=',
35
- modalHeader: '@',
36
- modalBody: '@'
32
+ model: '='
37
33
  },
38
- compile: function (element) {
39
- return function (scope) {
40
- var modalInstance, modalController, modalId;
34
+ link: function (scope, iElement, iAttrs, nullCtrl, transclude) {
35
+ var modalInstance, modalController, modalId;
41
36
 
42
- modalId = 'bstModal%d.html'.replace('%d', Math.random().toString());
37
+ modalId = 'bstModal%d.html'.replace('%d', Math.random().toString());
43
38
 
44
- modalController = ['$scope', '$modalInstance', 'model', function ($scope, $modalInstance, model) {
45
- $scope[scope.modelName] = model;
46
- $scope.modalHeader = scope.modalHeader;
47
- $scope.modalBody = scope.modalBody;
39
+ modalController = ['$scope', '$modalInstance', 'model', function ($scope, $modalInstance, model) {
40
+ $scope[scope.modelName] = model;
48
41
 
49
- $scope.ok = function () {
50
- $modalInstance.close();
51
- };
42
+ $scope.ok = function () {
43
+ $modalInstance.close();
44
+ };
52
45
 
53
- $scope.cancel = function () {
54
- $modalInstance.dismiss('cancel');
55
- };
56
- }];
46
+ $scope.cancel = function () {
47
+ $modalInstance.dismiss('cancel');
48
+ };
49
+ }];
57
50
 
58
- scope.openModal = function () {
59
- modalInstance = $modal.open({
60
- templateUrl: modalId,
61
- controller: modalController,
62
- resolve: {
63
- model: function () {
64
- return scope[scope.modelName];
65
- }
51
+ scope.openModal = function () {
52
+ modalInstance = $modal.open({
53
+ templateUrl: modalId,
54
+ controller: modalController,
55
+ resolve: {
56
+ model: function () {
57
+ return scope[scope.modelName];
66
58
  }
67
- });
59
+ }
60
+ });
68
61
 
69
- modalInstance.result.then(function () {
70
- scope.action();
71
- });
72
- };
62
+ modalInstance.result.then(function () {
63
+ scope.action();
64
+ });
65
+ };
73
66
 
74
- scope.$parent.openModal = scope.openModal;
67
+ scope.$parent.openModal = scope.openModal;
75
68
 
76
- $templateCache.put(modalId, element.html());
77
- };
69
+ transclude(function (clone) {
70
+ var template = angular.element('<div extend-template="components/views/bst-modal.html"></div>');
71
+ template.append(clone);
72
+ $templateCache.put(modalId, template);
73
+ });
78
74
  }
79
75
  };
80
76
  }]);
@@ -1,13 +1,16 @@
1
- <script type="text/ng-template">
2
- <div class="modal-header">
3
- <i class="fa fa-remove close" ng-click="cancel()"></i>
4
- <h3>{{ modalHeader | translate }}</h3>
5
- </div>
6
- <div class="modal-body">
7
- <p>{{ modalBody | translate }}</p>
8
- </div>
9
- <div class="modal-footer">
10
- <button class="btn btn-danger" ng-click="ok()" translate>Remove</button>
11
- <button class="btn btn-default" ng-click="cancel()" translate>Cancel</button>
12
- </div>
13
- </script>
1
+ <div class="modal-header">
2
+ <button type="button" class="close" aria-label="Close" ng-click="cancel()">
3
+ <span aria-hidden="true">&times;</span>
4
+ </button>
5
+
6
+ <h3 data-block="modal-header"></h3>
7
+ </div>
8
+ <div class="modal-body">
9
+ <p data-block="modal-body"></p>
10
+ </div>
11
+ <div class="modal-footer">
12
+ <button class="btn btn-danger" ng-click="ok()">
13
+ <span data-block="modal-confirm-button" translate>Remove</span>
14
+ </button>
15
+ <button class="btn btn-default" ng-click="cancel()" translate>Cancel</button>
16
+ </div>
@@ -1,3 +1,3 @@
1
1
  module Bastion
2
- VERSION = "0.2.6"
2
+ VERSION = "0.2.7"
3
3
  end
@@ -15,8 +15,9 @@ describe('Directive: bstModal', function() {
15
15
  var scope,
16
16
  compile,
17
17
  $modal,
18
+ $templateCache,
18
19
  $q,
19
- translate,
20
+ modalId,
20
21
  testItem,
21
22
  element,
22
23
  elementScope;
@@ -30,12 +31,6 @@ describe('Directive: bstModal', function() {
30
31
  delete: function() {}
31
32
  };
32
33
 
33
- translate = function() {
34
- this.$get = function() {
35
- return function() {};
36
- };
37
- };
38
-
39
34
  $modal = {
40
35
  $get: function() {
41
36
  return this;
@@ -50,25 +45,39 @@ describe('Directive: bstModal', function() {
50
45
  }
51
46
  };
52
47
 
53
- $provide.provider('translateFilter', translate);
54
48
  $provide.provider('$modal', $modal);
55
49
  }));
56
50
 
57
- beforeEach(inject(function(_$compile_, _$rootScope_, _$q_) {
51
+ beforeEach(inject(function(_$compile_, _$rootScope_, _$q_, _$templateCache_) {
58
52
  compile = _$compile_;
59
53
  scope = _$rootScope_;
60
54
  $q = _$q_;
55
+ $templateCache = _$templateCache_;
61
56
  }));
62
57
 
63
58
  beforeEach(function() {
64
- element = angular.element(
65
- '<span bst-modal="item.delete(item)" model="testItem">' +
66
- '<p>Hello!</p></span>');
59
+ var html = '<span bst-modal="item.delete(item)">' +
60
+ '<p data-block="modal-header">Header</p>' +
61
+ '<p data-block="modal-body">Body</p>' +
62
+ '</span>';
63
+
64
+ element = angular.element(html);
65
+ spyOn($templateCache, 'put').andCallThrough();
67
66
 
68
67
  compile(element)(scope);
69
68
  scope.$digest();
70
69
 
71
70
  elementScope = element.scope();
71
+ modalId = $templateCache.put.mostRecentCall.args[0];
72
+ });
73
+
74
+ it("uses angular-blocks to extend a modal template", function () {
75
+ var modal = $templateCache.get(modalId);
76
+
77
+ expect($templateCache.put).toHaveBeenCalled();
78
+ expect(modal.attr('extend-template')).toBe('components/views/bst-modal.html');
79
+ expect(modal.find('[data-block="modal-header"]').html()).toBe('Header');
80
+ expect(modal.find('[data-block="modal-body"]').html()).toBe('Body');
72
81
  });
73
82
 
74
83
  it("allows the opening of a modal dialog via bootstrap ui", function() {
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: bastion
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.6
4
+ version: 0.2.7
5
5
  platform: ruby
6
6
  authors:
7
7
  - Katello
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-02-18 00:00:00.000000000 Z
11
+ date: 2015-02-23 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: angular-rails-templates