promethee 1.2.5 → 1.2.6

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: f4b9d50abe08aefaa61c8396da39edd89033e566
4
- data.tar.gz: 9e8537becee50077661dff2c63bbbb684a36289b
3
+ metadata.gz: 3990e672da334008485f049f367526eb7d1de150
4
+ data.tar.gz: 734e6bf4740e8921560d4f9d7d2996097171b987
5
5
  SHA512:
6
- metadata.gz: c98cd1ec67d66a6caa5537701ab6fdfff18b13b7aaf243adebb492fb49b83453a0d08e4af4729925aa8f913b038062295efbd9501ab14bece35508df148d160f
7
- data.tar.gz: '091df77e01cf5c913ecbac0ec30d127c5e3f789b9ab75deb1d40b50424c59d1055a94aea397bdcebb7d03cf893b06cb3797cfaf02e59b8666800c51feecb52c9'
6
+ metadata.gz: ac9f482156241a315f378b62258e931d905543b4b74bdec8770cf44b09f65317fb2ec11cac484ec9b92f3e6735c9830d0b8de97b1e0021a9848d66f73dd98bd4
7
+ data.tar.gz: 35611d794ddf5c884e8ba4efd8b31e0785ecac3aca7d70d3bb579ee4ae40ffdfff538f62a3274f7cb1c6bd7e45f0230a0432433f285c97bb9489bd8ffe5baf62
@@ -52,6 +52,21 @@ var promethee = angular
52
52
 
53
53
  return words[0] === '' ? 0 : words.length;
54
54
  };
55
+ })
56
+ // Why doesn't this method just live in the adder controller ?
57
+ // Because the row component also need a special access to it in order to create cols with an id. So we make it global to the application.
58
+ .provider('identifier', function() {
59
+ this.$get = function() {
60
+ return {
61
+ // https://gist.github.com/gordonbrander/2230317
62
+ generate: function() {
63
+ // Math.random should be unique because of its seeding algorithm.
64
+ // Convert it to base 36 (numbers + letters), and grab the first 9 characters
65
+ // after the decimal.
66
+ return '' + Math.random().toString(36).substr(2, 9);
67
+ }
68
+ };
69
+ };
55
70
  });
56
71
 
57
72
  promethee.controller('PrometheeController', ['$scope', function($scope) {
@@ -1,7 +1,7 @@
1
1
  <script type="text/ng-template" id="promethee/components/row/edit/write">
2
2
  <div ng-controller="RowController"
3
3
  ng-click="inspect(component, $event)"
4
- class=" row
4
+ class=" row
5
5
  promethee-edit__component
6
6
  promethee-edit__component--row">
7
7
  <div class="promethee-edit__component-selected" ng-class="{'promethee-edit__component-selected--visible': promethee.inspected === component}">
@@ -17,10 +17,11 @@
17
17
  </script>
18
18
 
19
19
  <script>
20
- promethee.controller('RowController', ['$scope', function($scope) {
20
+ promethee.controller('RowController', ['$scope', 'identifier', function($scope, identifier) {
21
21
  $scope.addColumn = function() {
22
22
  this.component.children.push({
23
23
  type: 'column',
24
+ id: identifier.generate(),
24
25
  attributes: {
25
26
  size: 4,
26
27
  offset: 0
@@ -1,5 +1,5 @@
1
1
  <script type="text/javascript">
2
- promethee.controller('AdderController', ['$scope', '$rootScope', 'definitions', function($scope, $rootScope, definitions) {
2
+ promethee.controller('AdderController', ['$scope', '$rootScope', 'definitions', 'identifier', function($scope, $rootScope, definitions, identifier) {
3
3
 
4
4
  $scope.adding = false;
5
5
  $scope.childrenToAddTo = null;
@@ -12,7 +12,7 @@ promethee.controller('AdderController', ['$scope', '$rootScope', 'definitions',
12
12
 
13
13
  $scope.pushComponent = function(definition) {
14
14
  var definition = angular.copy(definition.data);
15
- definition.id = $scope.createIdentifier();
15
+ definition.id = identifier.generate();
16
16
  $scope.childrenToAddTo.push(definition);
17
17
  $scope.close();
18
18
  };
@@ -22,21 +22,13 @@ promethee.controller('AdderController', ['$scope', '$rootScope', 'definitions',
22
22
  $scope.childrenToAddTo = components;
23
23
  };
24
24
 
25
- // https://gist.github.com/gordonbrander/2230317
26
- $scope.createIdentifier = function () {
27
- // Math.random should be unique because of its seeding algorithm.
28
- // Convert it to base 36 (numbers + letters), and grab the first 9 characters
29
- // after the decimal.
30
- return '' + Math.random().toString(36).substr(2, 9);
31
- };
32
-
33
25
  }])
34
26
  </script>
35
27
 
36
28
  <div class="promethee-edit__write" ng-show="promethee.mode == 'write'">
37
29
  <div ng-class="{ 'container-fluid': promethee.fullscreen }">
38
30
  <div ng-init="component = promethee.data"
39
- class=" promethee-edit__component
31
+ class=" promethee-edit__component
40
32
  promethee-edit__component--page">
41
33
  <ng-include src="'promethee/write/components'"></ng-include>
42
34
  </div>
@@ -1,5 +1,5 @@
1
1
  module Promethee
2
2
  module Rails
3
- VERSION = '1.2.5'
3
+ VERSION = '1.2.6'
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: promethee
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.2.5
4
+ version: 1.2.6
5
5
  platform: ruby
6
6
  authors:
7
7
  - Julien Dargelos