promethee 1.3.1 → 1.3.2

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: df6de340e1248075527cd543a63f61b6e945906e
4
- data.tar.gz: 51c9b6dd8d36a655c0ef0d7d70e2bfa7aa76ed27
3
+ metadata.gz: d9d64c7758ac9560202c0c5e3a2df6a42290bb4a
4
+ data.tar.gz: 9e9b2f4dd45a864b334fae766af431d5187fe845
5
5
  SHA512:
6
- metadata.gz: ce27d68fe8214f2874d8636fce7be2b2b56358af1bff3515f9d5a7352aa97e56eca5a01d5773e19fd3984467e7e34e65b8338c6657d9cdf16bb6d6d7b8e934f0
7
- data.tar.gz: a01862be7b582b3adeeb126a868d0dd05ce8045d7af35caa4d15afbeb237d74d9e1a5b113c9f23dcd2f497926ebcf1c0b221674954abaf60bacf5515a5feb44d
6
+ metadata.gz: 185bc919628cd9e1a86ba9c4085c01f2e0ecfa32be03203699006d92254197c61be9f1e6260f35bfeb26f27168da11c758d3e6825453ffb28a78dfb7cd3f7d16
7
+ data.tar.gz: 53a3a042392290e5e179b73047749e53295cd60d8e63862ab0011a0ebc4b2e30c2e384a93b58f8e8918c1331fda7a6339fdbfcfa4baa8fa43a3e07cabdc9c11c
data/README.md CHANGED
@@ -97,7 +97,6 @@ With stylesheets set:
97
97
  ```
98
98
  @import 'bootstrap'
99
99
  @import 'font-awesome.css'
100
- @import 'material_icons.css'
101
100
  @import 'summernote'
102
101
  @import 'promethee'
103
102
  ```
@@ -138,7 +137,6 @@ With stylesheets set:
138
137
  ```
139
138
  @import 'bootstrap'
140
139
  @import 'font-awesome.css'
141
- @import 'material_icons.css'
142
140
  @import 'summernote'
143
141
  @import 'promethee'
144
142
  @import 'promethee-edit'
@@ -41,6 +41,7 @@
41
41
  background: black
42
42
  &__page
43
43
  z-index: 1
44
+ padding-bottom: 200px
44
45
  &__columns, &__page
45
46
  .row
46
47
  margin-left: -5px
@@ -60,16 +61,15 @@
60
61
  &__droppable
61
62
  visibility: hidden
62
63
  opacity: .2
63
- margin: 10px 0
64
+ margin: 2px 0
64
65
  position: relative
65
66
  background: white
66
67
  width: 100%
67
- height: 10px
68
+ height: 20px
68
69
  border: 1px dashed #253742
69
70
  transition: width .2s, height .2s, opacity .2s
70
71
  &.ui-droppable-active
71
72
  visibility: visible
72
- height: 10px
73
73
  &.ui-droppable-hover
74
74
  opacity: 1
75
75
  height: 100px
@@ -112,61 +112,51 @@
112
112
  .promethee-edit__move__droppable
113
113
  display: none
114
114
  // It's a little specific, columns can be dropped on rows "first droppable", or on columns "inside droppables"
115
- &.promethee-edit__move__droppable--row--inside-column,
116
- &.promethee-edit__move__droppable--row--first
115
+ &.promethee-edit__move__droppable--row--first,
116
+ &.promethee-edit__move__droppable--row--inside-column
117
117
  display: block
118
118
 
119
- .promethee-edit__inspect
120
- background: white
121
- position: fixed
122
- width: calc(50vw - 420px)
123
- min-width: 100px
124
- top: 80px
125
- right: 30px
126
- bottom: 15px
127
- z-index: 1000
128
- &-header
129
- font-size: 18px
130
- font-weight: bold
131
- text-transform: uppercase
132
- margin-bottom: 20px
133
- &-content
134
- overflow: scroll
135
- label.label-control
136
- font-weight: normal
137
-
138
- .promethee-edit__library
139
- background: white
140
- position: fixed
141
- width: calc(50vw - 420px)
142
- min-width: 100px
143
- top: 80px
144
- left: 30px
145
- bottom: 15px
146
- z-index: 1000
147
- &-header
148
- font-size: 18px
149
- font-weight: bold
150
- text-transform: uppercase
151
- margin-bottom: 20px
152
- &-content
153
- overflow: scroll
154
- &__item
155
- max-width: 300px
156
- z-index: 100000
157
- background-color: #253742
158
- margin-bottom: 30px
159
- height: 100px
119
+ .promethee-edit
120
+ &__inspect, &__library
160
121
  min-width: 100px
161
- padding-top: 10px
162
- text-align: center
163
- color: white
164
- &__icon
165
- display: block
166
- svg
167
- width: 60px
168
- &__name
169
- margin-top: -10px
170
- font-size: 11px
171
- font-weight: normal
122
+ max-width: 400px
123
+ background: white
124
+ position: fixed
125
+ top: 80px
126
+ bottom: 15px
127
+ z-index: 1000
128
+ width: calc(50vw - 420px)
129
+ overflow-x: hidden
130
+ overflow-y: scroll
131
+ &-header
132
+ font-size: 18px
133
+ font-weight: bold
172
134
  text-transform: uppercase
135
+ margin-bottom: 20px
136
+
137
+ &__inspect
138
+ right: 30px
139
+ label.label-control
140
+ font-weight: normal
141
+
142
+ &__library
143
+ left: 30px
144
+ &__item
145
+ max-width: 300px
146
+ z-index: 100000
147
+ background-color: #253742
148
+ margin-bottom: 30px
149
+ height: 100px
150
+ min-width: 100px
151
+ padding-top: 10px
152
+ text-align: center
153
+ color: white
154
+ &__icon
155
+ display: block
156
+ svg
157
+ width: 60px
158
+ &__name
159
+ margin-top: -10px
160
+ font-size: 11px
161
+ font-weight: normal
162
+ text-transform: uppercase
@@ -32,8 +32,8 @@ promethee.controller('PrometheeController', ['$scope', 'summernoteConfig', funct
32
32
  inspected: null,
33
33
  mode: 'move',
34
34
  preview: 'desktop',
35
- fullscreen: false
36
- // fullscreen: true
35
+ // fullscreen: false
36
+ fullscreen: true
37
37
  };
38
38
 
39
39
  $scope.inspect = function(component, event) {
@@ -67,6 +67,7 @@ promethee.controller('PrometheeController', ['$scope', 'summernoteConfig', funct
67
67
  $scope.remove = function(component, components) {
68
68
  var index = components.indexOf(component);
69
69
  components.splice(index, 1);
70
+ this.promethee.inspected = null;
70
71
  }
71
72
 
72
73
  $scope.submit = function() {
@@ -1,8 +1,7 @@
1
1
  <script type="text/ng-template" id="promethee/components/column/edit/move">
2
2
  <div ng-click="inspect(component, $event)"
3
3
  ng-class="{'promethee-edit__component--selected': promethee.inspected === component}"
4
- class=" promethee-edit__component
5
- promethee-edit__component--column
4
+ class=" <%= promethee_bem_classes 'promethee-edit__component', "--column" %>
6
5
  col
7
6
  col-md-{{component.attributes.size}}
8
7
  col-md-offset-{{component.attributes.offset}}">
@@ -11,12 +10,11 @@
11
10
  <div class="header">Column</div>
12
11
  <ng-include src="'promethee/move/components'"></ng-include>
13
12
  <div
14
- class=" promethee-edit__move__droppable
15
- promethee-edit__move__droppable--row
16
- promethee-edit__move__droppable--row--inside-column"
17
13
  droppable
14
+ class=" <%= promethee_bem_classes 'promethee-edit__move__droppable', '--row', '--inside-column' %>"
18
15
  data-index="{{$index+1}}"
19
- data-type="{{type}}"
16
+ data-id="{{parent_id}}"
17
+ data-type="{{parent_type}}"
20
18
  >
21
19
  </div>
22
20
  </div>
@@ -1,7 +1,6 @@
1
1
  <%# This causes an infinite loop when imported as angular, so i import it as erb %>
2
2
  <div ng-click="inspect(component, $event)"
3
3
  ng-class="{'promethee-edit__component--selected': promethee.inspected === component}"
4
- class=" promethee-edit__component
5
- promethee-edit__component--<%= type %>">
4
+ class="<%= promethee_bem_classes 'promethee-edit__component', "--#{type}" %>">
6
5
  <div class="promethee-edit__component__inner">
7
6
  <%= render 'promethee/edit/move.close' %>
@@ -10,8 +10,17 @@ promethee
10
10
  scroll: true,
11
11
  refreshPositions: true,
12
12
  cursor: 'move',
13
+ cursorAt: { top: 0, left: 0 },
13
14
  helper: 'clone',
14
- appendTo: '.promethee-edit__move'
15
+ appendTo: '.promethee-edit__move',
16
+ start: function(event, ui) {
17
+ var type = $(element[0]).data('type');
18
+ $('.promethee-edit__move').addClass('promethee-edit__move--dragging promethee-edit__move--dragging--' + type);
19
+ },
20
+ stop: function(event, ui) {
21
+ var type = $(element[0]).data('type');
22
+ $('.promethee-edit__move').removeClass('promethee-edit__move--dragging promethee-edit__move--dragging--' + type);
23
+ }
15
24
  });
16
25
  }
17
26
  }
@@ -30,23 +39,17 @@ promethee
30
39
  var $elementDragged = $(element[0]);
31
40
  var type = $elementDragged.data('type');
32
41
  $('.promethee-edit__move').addClass('promethee-edit__move--dragging promethee-edit__move--dragging--' + type);
33
-
34
- // The droppable zone immediately before has no use, it would put the object at the same position
35
- // FIXME the selector is not correct
36
- /*
37
- var $droppableBefore = $elementDragged.prev('.promethee-edit__move__draggable').find('.promethee-edit__move__droppable').last();
38
- if ($droppableBefore.length === 0) {
39
- // For the first child, we look for the previous droppable zone
40
- $droppableBefore = $elementDragged.prev('.promethee-edit__move__droppable');
41
- }
42
- $droppableBefore.addClass('promethee-edit__move__droppable--hidden');
43
- */
42
+ var listId = $elementDragged.data('list-id');
43
+ var listIndex = $elementDragged.data('list-index');
44
+ $('.promethee-edit__move__droppable[data-id="' + listId + '"][data-index="' + listIndex + '"]').hide();
44
45
  },
45
46
  stop: function() {
46
47
  var $elementDragged = $(element[0]);
47
48
  var type = $elementDragged.data('type');
48
49
  $('.promethee-edit__move').removeClass('promethee-edit__move--dragging promethee-edit__move--dragging--' + type);
49
- // $('.promethee-edit__move__droppable').removeClass('promethee-edit__move__droppable--hidden');
50
+ var listId = $elementDragged.data('list-id');
51
+ var listIndex = $elementDragged.data('list-index');
52
+ $('.promethee-edit__move__droppable[data-id="' + listId + '"][data-index="' + listIndex + '"]').show();
50
53
  }
51
54
  });
52
55
  }
@@ -80,7 +83,7 @@ promethee
80
83
  }
81
84
  component.id = guid();
82
85
  } else {
83
- var draggedFromIndex = parseInt(ui.draggable[0].getAttribute('data-index'));
86
+ var draggedFromIndex = parseInt(ui.draggable[0].getAttribute('data-list-index'));
84
87
  // console.log('dragged', draggedFromList, draggedFromIndex);
85
88
  draggedFromList.splice(draggedFromIndex, 1);
86
89
 
@@ -138,12 +141,17 @@ promethee.controller('AdderController',
138
141
  <div class="row">
139
142
  <div ng-repeat="definition in promethee.definitions"
140
143
  class="col-md-12 col-lg-6">
141
- <div class="promethee-edit__library__item" addable>
144
+ <div addable
145
+ class="promethee-edit__library__item"
146
+ data-type="{{definition.data.type}}">
142
147
  <div class="promethee-edit__library__item__icon" ng-bind-html="definition.icon | htmlSafe"></div>
143
148
  <div class="promethee-edit__library__item__name">{{definition.name}}</div>
144
149
  </div>
145
150
  </div>
151
+ </div>
146
152
  </div>
153
+ <div class="promethee-edit__library-header">Presets</div>
154
+ <div class="promethee-edit__library-content">
147
155
  </div>
148
156
  </div>
149
157
 
@@ -180,30 +188,32 @@ promethee.controller('AdderController',
180
188
  </script>
181
189
 
182
190
  <script type="text/ng-template" id="promethee/move/components">
183
- <div ng-init="type = component.type; components = component.children">
191
+ <div ng-init="parent_id = component.id; parent_type = component.type; components = component.children">
184
192
  <div
185
193
  droppable
186
- class=" promethee-edit__move__droppable
187
- promethee-edit__move__droppable--{{type}}
188
- promethee-edit__move__droppable--{{type}}--first"
194
+ class="<%= promethee_bem_classes 'promethee-edit__move__droppable', '--{{parent_type}}', '--first' %>"
195
+ data-id="{{parent_id}}"
196
+ data-type="{{parent_type}}"
189
197
  data-index="0"
190
198
  >
191
199
  </div>
192
200
  <div
193
201
  draggable
194
202
  ng-repeat="component in components"
195
- class=" promethee-edit__move__draggable
196
- promethee-edit__move__draggable--{{type}}"
197
- data-index="{{$index}}"
203
+ class="<%= promethee_bem_classes 'promethee-edit__move__draggable', '--{{component.type}}' %>"
204
+ data-id="{{component.id}}"
198
205
  data-type="{{component.type}}"
206
+ data-list-id="{{parent_id}}"
207
+ data-list-type="{{parent_type}}"
208
+ data-list-index="{{$index}}"
199
209
  >
200
210
  <ng-include src="'promethee/move/component'"></ng-include>
201
211
  <div
202
212
  droppable
203
- class=" promethee-edit__move__droppable
204
- promethee-edit__move__droppable--{{type}}"
213
+ class="<%= promethee_bem_classes 'promethee-edit__move__droppable', '--{{parent_type}}' %>"
214
+ data-id="{{parent_id}}"
215
+ data-type="{{parent_type}}"
205
216
  data-index="{{$index+1}}"
206
- data-type="{{type}}"
207
217
  >
208
218
  </div>
209
219
  </div>
data/lib/promethee.rb CHANGED
@@ -1,11 +1,8 @@
1
1
  require 'bootstrap-sass'
2
2
  require 'font-awesome-rails'
3
- require 'material_icons'
4
3
  require 'jquery-rails'
5
4
  require 'jquery-ui-rails'
6
- require 'tinymce-rails'
7
5
  require 'angularjs-rails'
8
- require 'angular-ui-tinymce/rails'
9
6
  require 'angular_rails_csrf'
10
7
 
11
8
  module Promethee
@@ -22,6 +22,18 @@ module Promethee::Rails::Helper
22
22
  promethee_partials_for 'utils/_*.html.erb'
23
23
  end
24
24
 
25
+ # promethee_bem_classes 'promethee-edit__move__droppable', '--{{type}}', '--first'
26
+ # -> promethee-edit__move__droppable promethee-edit__move__droppable--{{type}} promethee-edit__move__droppable--{{type}}--first"
27
+ def promethee_bem_classes(*args)
28
+ classes = ''
29
+ current_class = ''
30
+ args.each do |arg|
31
+ current_class << arg
32
+ classes << "#{current_class} "
33
+ end
34
+ classes
35
+ end
36
+
25
37
  protected
26
38
 
27
39
  # Example: promethee_partials_for 'components/*/_edit.*.html.erb'
@@ -1,5 +1,5 @@
1
1
  module Promethee
2
2
  module Rails
3
- VERSION = '1.3.1'
3
+ VERSION = '1.3.2'
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.3.1
4
+ version: 1.3.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Julien Dargelos
@@ -13,7 +13,7 @@ authors:
13
13
  autorequire:
14
14
  bindir: bin
15
15
  cert_chain: []
16
- date: 2018-03-19 00:00:00.000000000 Z
16
+ date: 2018-03-22 00:00:00.000000000 Z
17
17
  dependencies:
18
18
  - !ruby/object:Gem::Dependency
19
19
  name: rails