promethee 1.2.31 → 1.3.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (39) hide show
  1. checksums.yaml +4 -4
  2. data/app/assets/stylesheets/promethee-edit.sass +10 -44
  3. data/app/assets/stylesheets/promethee-edit/_move.sass +95 -46
  4. data/app/views/promethee/_edit.html.erb +26 -24
  5. data/app/views/promethee/components/aside/_edit.define.html.erb +152 -11
  6. data/app/views/promethee/components/aside/_edit.move.html.erb +11 -12
  7. data/app/views/promethee/components/column/_edit.define.html.erb +32 -0
  8. data/app/views/promethee/components/column/_edit.inspect.html.erb +5 -4
  9. data/app/views/promethee/components/column/_edit.move.html.erb +21 -11
  10. data/app/views/promethee/components/cover/_edit.define.html.erb +151 -12
  11. data/app/views/promethee/components/cover/_edit.move.html.erb +7 -4
  12. data/app/views/promethee/components/cover/_localize.html.erb +1 -1
  13. data/app/views/promethee/components/image/_edit.define.html.erb +149 -13
  14. data/app/views/promethee/components/image/_edit.move.html.erb +13 -4
  15. data/app/views/promethee/components/image/_localize.html.erb +1 -1
  16. data/app/views/promethee/components/row/_edit.define.html.erb +151 -11
  17. data/app/views/promethee/components/row/_edit.move.html.erb +6 -3
  18. data/app/views/promethee/components/slider/_edit.define.html.erb +151 -11
  19. data/app/views/promethee/components/slider/_edit.move.html.erb +5 -3
  20. data/app/views/promethee/components/text/_edit.define.html.erb +150 -11
  21. data/app/views/promethee/components/text/_edit.move.html.erb +4 -1
  22. data/app/views/promethee/components/text/_localize.html.erb +1 -1
  23. data/app/views/promethee/components/video/_edit.define.html.erb +30 -11
  24. data/app/views/promethee/components/video/_edit.move.html.erb +30 -4
  25. data/app/views/promethee/edit/_move.close.html.erb +4 -0
  26. data/app/views/promethee/edit/_move.header.html.erb +7 -0
  27. data/app/views/promethee/edit/_move.html.erb +107 -15
  28. data/lib/promethee/rails/version.rb +1 -1
  29. metadata +5 -13
  30. data/app/assets/stylesheets/promethee-edit/_write.sass +0 -94
  31. data/app/views/promethee/components/aside/_edit.write.html.erb +0 -14
  32. data/app/views/promethee/components/column/_edit.write.html.erb +0 -17
  33. data/app/views/promethee/components/cover/_edit.write.html.erb +0 -23
  34. data/app/views/promethee/components/image/_edit.write.html.erb +0 -25
  35. data/app/views/promethee/components/row/_edit.write.html.erb +0 -34
  36. data/app/views/promethee/components/slider/_edit.write.html.erb +0 -47
  37. data/app/views/promethee/components/text/_edit.write.html.erb +0 -20
  38. data/app/views/promethee/components/video/_edit.write.html.erb +0 -39
  39. data/app/views/promethee/edit/_write.html.erb +0 -98
@@ -1,3 +1,6 @@
1
1
  <script type="text/ng-template" id="promethee/components/text/edit/move">
2
- <div ng-bind-html="component.attributes.body | htmlSafe"></div>
2
+ <%= render 'promethee/edit/move.header', type: 'text' %>
3
+ <div ng-bind-html="component.attributes.body | htmlSafe"></div>
4
+ </div>
5
+ </div>
3
6
  </script>
@@ -2,7 +2,7 @@
2
2
  <div class="row">
3
3
  <div class="col-md-6">
4
4
  <b>Local</b>
5
- <summernote config="summernoteConfig" ng-model="component.attributes.body"></summernote>
5
+ <summernote config="options" ng-model="component.attributes.body"></summernote>
6
6
  </div>
7
7
  <div class="col-md-6">
8
8
  <b>Master</b>
@@ -1,12 +1,31 @@
1
- <script>
2
- angular.injector(['ng', 'Promethee']).get('definitions').push({
3
- name: 'Video',
4
- thumb: 'http://via.placeholder.com/300x200',
5
- data: {
6
- type: 'video',
7
- attributes: {
8
- url: 'https://vimeo.com/115082758'
9
- }
1
+ <%
2
+ icon = '
3
+ <?xml version="1.0" encoding="utf-8"?>
4
+ <!-- Generator: Adobe Illustrator 22.0.1, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
5
+ <svg version="1.1" id="Calque_2" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
6
+ viewBox="0 0 100 100" enable-background="new 0 0 100 100" xml:space="preserve">
7
+ <rect x="18.9" y="28" fill="none" stroke="#FFFFFF" stroke-miterlimit="10" width="62.1" height="44"/>
8
+ <g>
9
+ <path fill="#FFFFFF" d="M84.5,25v50h-69V25H84.5 M86.5,23h-73v54h73V23L86.5,23z"/>
10
+ </g>
11
+ <g>
12
+ <polygon fill="#FFFFFF" points="47.2,44.6 47.2,55.4 56.3,50 "/>
13
+ <g>
14
+ <path fill="#FFFFFF" d="M50,41.6c4.6,0,8.4,3.8,8.4,8.4s-3.8,8.4-8.4,8.4s-8.4-3.8-8.4-8.4S45.4,41.6,50,41.6 M50,40.6
15
+ c-5.2,0-9.4,4.2-9.4,9.4s4.2,9.4,9.4,9.4c5.2,0,9.4-4.2,9.4-9.4S55.2,40.6,50,40.6L50,40.6z"/>
16
+ </g>
17
+ </g>
18
+ </svg>
19
+ '
20
+ %>
21
+
22
+ <div ng-init="promethee.definitions.push({
23
+ name: 'Video',
24
+ icon: '<%= icon %>',
25
+ data: {
26
+ type: 'video',
27
+ attributes: {
28
+ url: 'https://vimeo.com/115082758'
10
29
  }
11
- });
12
- </script>
30
+ }
31
+ })"></div>
@@ -1,8 +1,34 @@
1
1
  <script type="text/ng-template" id="promethee/components/video/edit/move">
2
- <div ng-controller="VideoController">
3
- <div class="embed-responsive embed-responsive-16by9">
4
- <iframe ng-if="embed" frameborder="0" webkitallowfullscreen="" mozallowfullscreen="" allowfullscreen="allowfullscreen" ng-src="{{embed | urlSafe}}"></iframe>
5
- <div class="video-neutralizing-overlay"></div>
2
+ <%= render 'promethee/edit/move.header', type: 'video' %>
3
+ <div ng-controller="VideoController">
4
+ <div class="embed-responsive embed-responsive-16by9">
5
+ <iframe ng-if="embed" frameborder="0" webkitallowfullscreen="" mozallowfullscreen="" allowfullscreen="allowfullscreen" ng-src="{{embed | urlSafe}}"></iframe>
6
+ <div class="video-neutralizing-overlay"></div>
7
+ </div>
8
+ </div>
6
9
  </div>
7
10
  </div>
8
11
  </script>
12
+
13
+ <script>
14
+ promethee.controller('VideoController', ['$scope', function($scope) {
15
+ Object.defineProperty($scope, 'embed', {
16
+ get: function() {
17
+ var embed = null;
18
+ var url = this.component.attributes.url + '';
19
+
20
+ if(url.includes('vimeo')) {
21
+ var id = url.replace(/^(?:https?:)?\/\/(?:(?:www|player)\.)?vimeo\.com\/(?:video\/)?(\d+).*?$/, '$1');
22
+ embed = 'https://player.vimeo.com/video/' + id + '?color=ffffff&title=0&byline=0&portrait=0';
23
+ }
24
+ else if(url.includes('youtube')) {
25
+ var parts = url.split('watch?v=');
26
+ var id = parts[parts.length - 1];
27
+ embed = 'http://www.youtube.com/embed/' + id;
28
+ }
29
+
30
+ return embed;
31
+ }
32
+ })
33
+ }]);
34
+ </script>
@@ -0,0 +1,4 @@
1
+ <%# This causes an infinite loop when imported as angular, so i import it as erb %>
2
+ <div class="promethee-edit__component__close"
3
+ ng-click="remove(component, components)"
4
+ ng-show="promethee.inspected === component"><%= fa_icon :times %></div>
@@ -0,0 +1,7 @@
1
+ <%# This causes an infinite loop when imported as angular, so i import it as erb %>
2
+ <div ng-click="inspect(component, $event)"
3
+ ng-class="{'promethee-edit__component--selected': promethee.inspected === component}"
4
+ class=" promethee-edit__component
5
+ promethee-edit__component--<%= type %>">
6
+ <div class="promethee-edit__component__inner">
7
+ <%= render 'promethee/edit/move.close' %>
@@ -1,6 +1,21 @@
1
-
2
1
  <script type="text/javascript">
3
2
  promethee
3
+ .directive('addable', function() {
4
+ return {
5
+ restrict:'A',
6
+ link: function(scope, element, attrs) {
7
+ element.draggable({
8
+ revert: true,
9
+ revertDuration: 0,
10
+ scroll: true,
11
+ refreshPositions: true,
12
+ cursor: 'move',
13
+ helper: 'clone',
14
+ appendTo: '.promethee-edit__move'
15
+ });
16
+ }
17
+ }
18
+ })
4
19
  .directive('draggable', function() {
5
20
  return {
6
21
  restrict:'A',
@@ -44,19 +59,38 @@ promethee
44
59
  element.droppable({
45
60
  tolerance: 'pointer',
46
61
  drop: function(event, ui) {
62
+ var draggedFromLibrary = false;
47
63
  var draggedFromList = angular.element(ui.draggable).parent().scope().components;
48
- var draggedFromIndex = parseInt(ui.draggable[0].getAttribute('data-index'));
49
- // console.log('dragged', draggedFromList, draggedFromIndex);
50
- draggedFromList.splice(draggedFromIndex, 1);
51
-
52
- var component = angular.element(ui.draggable).scope().component;
53
64
  var droppedToList = angular.element(this).scope().components;
54
65
  var droppedToIndex = parseInt(this.getAttribute('data-index'));
55
- if (draggedFromList == droppedToList) {
56
- // The object we dragged was removed from the list
57
- if (draggedFromIndex < droppedToIndex) {
58
- // It was before the dropped index, so removing it changed the index
59
- droppedToIndex -= 1;
66
+ if (draggedFromList === undefined) {
67
+ draggedFromLibrary = true;
68
+ }
69
+ if (draggedFromLibrary) {
70
+ var definition = angular.element(ui.draggable).scope().definition;
71
+ var component = angular.copy(definition.data);
72
+ // FIXME dirty
73
+ function guid() {
74
+ function s4() {
75
+ return Math.floor((1 + Math.random()) * 0x10000)
76
+ .toString(16)
77
+ .substring(1);
78
+ }
79
+ return s4() + s4() + '-' + s4() + '-' + s4() + '-' + s4() + '-' + s4() + s4() + s4();
80
+ }
81
+ component.id = guid();
82
+ } else {
83
+ var draggedFromIndex = parseInt(ui.draggable[0].getAttribute('data-index'));
84
+ // console.log('dragged', draggedFromList, draggedFromIndex);
85
+ draggedFromList.splice(draggedFromIndex, 1);
86
+
87
+ var component = angular.element(ui.draggable).scope().component;
88
+ if (draggedFromList == droppedToList) {
89
+ // The object we dragged was removed from the list
90
+ if (draggedFromIndex < droppedToIndex) {
91
+ // It was before the dropped index, so removing it changed the index
92
+ droppedToIndex -= 1;
93
+ }
60
94
  }
61
95
  }
62
96
  // console.log('dropped', component, droppedToList, droppedToIndex);
@@ -68,17 +102,75 @@ promethee
68
102
  }
69
103
  }
70
104
  });
105
+
106
+ promethee.controller('AdderController',
107
+ ['$scope', '$rootScope', 'definitions', 'identifier',
108
+ function($scope, $rootScope, definitions, identifier) {
109
+
110
+ $scope.adding = false;
111
+ $scope.childrenToAddTo = null;
112
+ $scope.definitions = definitions;
113
+
114
+ $scope.close = function() {
115
+ $scope.adding = false;
116
+ $scope.addingToChildren = null;
117
+ };
118
+
119
+ $scope.pushComponent = function(definition) {
120
+ var definition = angular.copy(definition.data);
121
+ definition.id = identifier.generate();
122
+ $scope.childrenToAddTo.push(definition);
123
+ $scope.close();
124
+ };
125
+
126
+ $rootScope.addComponentTo = function(components) {
127
+ $scope.adding = true;
128
+ $scope.childrenToAddTo = components;
129
+ };
130
+
131
+ }])
71
132
  </script>
72
133
 
73
134
  <div class="promethee-edit__move" ng-show="promethee.mode == 'move'">
74
- <div class="promethee-edit__move__columns row">
75
- <% 12.times do %>
76
- <div class="col col-md-1"><div class="color"></div></div>
77
- <% end %>
135
+ <div class="promethee-edit__library">
136
+ <div class="promethee-edit__library-header">Library</div>
137
+ <div class="promethee-edit__library-content">
138
+ <div class="row">
139
+ <div ng-repeat="definition in promethee.definitions"
140
+ class="col-md-12 col-lg-6">
141
+ <div class="promethee-edit__library__item" addable>
142
+ <div class="promethee-edit__library__item__icon" ng-bind-html="definition.icon | htmlSafe"></div>
143
+ <div class="promethee-edit__library__item__name">{{definition.name}}</div>
144
+ </div>
145
+ </div>
146
+ </div>
147
+ </div>
78
148
  </div>
149
+
150
+ <div class="promethee-edit__move__columns">
151
+ <div class="row">
152
+ <% 12.times do %>
153
+ <div class="col col-md-1"><div class="color"></div></div>
154
+ <% end %>
155
+ </div>
156
+ </div>
157
+
79
158
  <div class="promethee-edit__move__page">
80
159
  <ng-include src="'promethee/move/components'"></ng-include>
81
160
  </div>
161
+
162
+ <div class="promethee-edit__inspect" ng-show="promethee.inspected">
163
+ <div class="promethee-edit__inspect-header">
164
+ <div class="pull-right">
165
+ <span ng-click="promethee.inspected = null"><%= fa_icon 'minus-square' %></span>
166
+ </div>
167
+ {{promethee.inspected.type}}
168
+ </div>
169
+ <div class="promethee-edit__inspect-content">
170
+ <ng-include ng-if="promethee.inspected"
171
+ src="'promethee/components/' + promethee.inspected.type + '/edit/inspect'"></ng-include>
172
+ </div>
173
+ </div>
82
174
  </div>
83
175
 
84
176
  <script type="text/ng-template" id="promethee/move/component">
@@ -1,5 +1,5 @@
1
1
  module Promethee
2
2
  module Rails
3
- VERSION = '1.2.31'
3
+ VERSION = '1.3.0'
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.31
4
+ version: 1.3.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Julien Dargelos
@@ -11,7 +11,7 @@ authors:
11
11
  autorequire:
12
12
  bindir: bin
13
13
  cert_chain: []
14
- date: 2018-03-05 00:00:00.000000000 Z
14
+ date: 2018-03-19 00:00:00.000000000 Z
15
15
  dependencies:
16
16
  - !ruby/object:Gem::Dependency
17
17
  name: rails
@@ -200,7 +200,6 @@ files:
200
200
  - app/assets/stylesheets/promethee-edit.sass
201
201
  - app/assets/stylesheets/promethee-edit/_move.sass
202
202
  - app/assets/stylesheets/promethee-edit/_preview.sass
203
- - app/assets/stylesheets/promethee-edit/_write.sass
204
203
  - app/assets/stylesheets/promethee.sass
205
204
  - app/controllers/promethee_controller.rb
206
205
  - app/views/promethee/_edit.html.erb
@@ -209,54 +208,47 @@ files:
209
208
  - app/views/promethee/components/aside/_edit.define.html.erb
210
209
  - app/views/promethee/components/aside/_edit.inspect.html.erb
211
210
  - app/views/promethee/components/aside/_edit.move.html.erb
212
- - app/views/promethee/components/aside/_edit.write.html.erb
213
211
  - app/views/promethee/components/aside/_localize.html.erb
214
212
  - app/views/promethee/components/aside/_show.html.erb
215
213
  - app/views/promethee/components/column/_edit.define.html.erb
216
214
  - app/views/promethee/components/column/_edit.inspect.html.erb
217
215
  - app/views/promethee/components/column/_edit.move.html.erb
218
- - app/views/promethee/components/column/_edit.write.html.erb
219
216
  - app/views/promethee/components/column/_localize.html.erb
220
217
  - app/views/promethee/components/column/_show.html.erb
221
218
  - app/views/promethee/components/cover/_edit.define.html.erb
222
219
  - app/views/promethee/components/cover/_edit.inspect.html.erb
223
220
  - app/views/promethee/components/cover/_edit.move.html.erb
224
- - app/views/promethee/components/cover/_edit.write.html.erb
225
221
  - app/views/promethee/components/cover/_localize.html.erb
226
222
  - app/views/promethee/components/cover/_show.html.erb
227
223
  - app/views/promethee/components/image/_edit.define.html.erb
228
224
  - app/views/promethee/components/image/_edit.inspect.html.erb
229
225
  - app/views/promethee/components/image/_edit.move.html.erb
230
- - app/views/promethee/components/image/_edit.write.html.erb
231
226
  - app/views/promethee/components/image/_localize.html.erb
232
227
  - app/views/promethee/components/image/_show.html.erb
233
228
  - app/views/promethee/components/row/_edit.define.html.erb
234
229
  - app/views/promethee/components/row/_edit.inspect.html.erb
235
230
  - app/views/promethee/components/row/_edit.move.html.erb
236
- - app/views/promethee/components/row/_edit.write.html.erb
237
231
  - app/views/promethee/components/row/_localize.html.erb
238
232
  - app/views/promethee/components/row/_show.html.erb
239
233
  - app/views/promethee/components/slider/_edit.define.html.erb
240
234
  - app/views/promethee/components/slider/_edit.inspect.html.erb
241
235
  - app/views/promethee/components/slider/_edit.move.html.erb
242
- - app/views/promethee/components/slider/_edit.write.html.erb
243
236
  - app/views/promethee/components/slider/_localize.html.erb
244
237
  - app/views/promethee/components/slider/_show.html.erb
245
238
  - app/views/promethee/components/text/_edit.define.html.erb
246
239
  - app/views/promethee/components/text/_edit.inspect.html.erb
247
240
  - app/views/promethee/components/text/_edit.move.html.erb
248
- - app/views/promethee/components/text/_edit.write.html.erb
249
241
  - app/views/promethee/components/text/_localize.html.erb
250
242
  - app/views/promethee/components/text/_show.html.erb
251
243
  - app/views/promethee/components/video/_edit.define.html.erb
252
244
  - app/views/promethee/components/video/_edit.inspect.html.erb
253
245
  - app/views/promethee/components/video/_edit.move.html.erb
254
- - app/views/promethee/components/video/_edit.write.html.erb
255
246
  - app/views/promethee/components/video/_localize.html.erb
256
247
  - app/views/promethee/components/video/_show.html.erb
248
+ - app/views/promethee/edit/_move.close.html.erb
249
+ - app/views/promethee/edit/_move.header.html.erb
257
250
  - app/views/promethee/edit/_move.html.erb
258
251
  - app/views/promethee/edit/_preview.html.erb
259
- - app/views/promethee/edit/_write.html.erb
260
252
  - app/views/promethee/preview.html.erb
261
253
  - app/views/promethee/show/_component.html.erb
262
254
  - app/views/promethee/show/_components.html.erb
@@ -357,7 +349,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
357
349
  version: '0'
358
350
  requirements: []
359
351
  rubyforge_project:
360
- rubygems_version: 2.6.12
352
+ rubygems_version: 2.6.13
361
353
  signing_key:
362
354
  specification_version: 4
363
355
  summary: Bring fire to your page
@@ -1,94 +0,0 @@
1
- .promethee-edit__write
2
-
3
- .promethee-edit__toolbar
4
- background: #253742
5
- height: 36px
6
- padding: 0 8px
7
- font-size: 11px
8
- text-transform: uppercase
9
- color: white
10
- line-height: 36px
11
- text-align: center
12
-
13
- &, *
14
- user-select: none
15
-
16
- &--transparent
17
- background: none
18
- width: 100%
19
- color: transparent
20
- z-index: 2
21
- position: absolute
22
-
23
- .promethee-edit__toolbar-buttons
24
- opacity: 0
25
- transition: .2s
26
- transform: translateX(20px)
27
-
28
- .promethee-edit__component:hover
29
- > .promethee-edit__toolbar, > * > .promethee-edit__toolbar
30
- .promethee-edit__toolbar-buttons
31
- opacity: 1
32
- transform: translateX(0)
33
-
34
- .promethee-edit__inspect
35
- background: #fff
36
- width: 300px
37
- top: 15px
38
- right: 15px
39
- bottom: 15px
40
- z-index: 1000
41
- position: fixed
42
- display: flex
43
- flex-direction: column
44
- border: 1px solid #253742
45
- &-header
46
- background: #253742
47
- height: 36px
48
- padding: 0 8px
49
- color: white
50
- flex-grow: 0
51
- flex-shrink: 0
52
- line-height: 36px
53
- text-transform: uppercase
54
- font-size: 11px
55
-
56
- &-content
57
- flex-grow: 1
58
- flex-shrink: 1
59
- padding: 15px
60
- overflow: scroll
61
-
62
- .promethee-edit__adder__button
63
- display: block
64
- text-align: center
65
- margin: 50px 0
66
-
67
- .promethee-edit__component
68
- margin-bottom: 5px
69
- position: relative
70
- &--cover
71
- .promethee-edit__cover-content
72
- padding: 150px 30px
73
- background-repeat: no-repeat
74
- background-position: center center
75
- background-size: cover
76
- &--row > div > .promethee-edit__toolbar
77
- margin-bottom: 5px
78
- &--column > div > .promethee-edit__toolbar
79
- margin-bottom: 5px
80
- &--slider
81
- .fontawesome-carousel-control .fa
82
- top: 50%
83
- position: absolute
84
- transform: translateY(-50%)
85
- font-size: 30px
86
- &-selected
87
- position: relative
88
- border: 2px solid transparent
89
-
90
- &--visible
91
- border-color: #253742
92
-
93
- &:hover
94
- background: rgba(0, 0, 0, .05)