promethee 1.0.20 → 1.1.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (41) hide show
  1. checksums.yaml +4 -4
  2. data/app/assets/stylesheets/promethee-editor.sass +26 -57
  3. data/app/assets/stylesheets/promethee-editor/_move.sass +102 -0
  4. data/app/assets/stylesheets/promethee-editor/_preview.sass +2 -3
  5. data/app/assets/stylesheets/promethee-editor/_write.sass +58 -0
  6. data/app/views/promethee/_edit.html.erb +34 -99
  7. data/app/views/promethee/_localize.html.erb +1 -1
  8. data/app/views/promethee/_show.html.erb +1 -2
  9. data/app/views/promethee/edit/_move.html.erb +17 -38
  10. data/app/views/promethee/edit/_preview.html.erb +4 -36
  11. data/app/views/promethee/edit/_write.html.erb +9 -25
  12. data/app/views/promethee/edit/inspector/_inspector.html.erb +11 -0
  13. data/app/views/promethee/edit/inspector/component/_column.html.erb +2 -2
  14. data/app/views/promethee/edit/inspector/component/_cover.html.erb +1 -1
  15. data/app/views/promethee/edit/inspector/component/_details.html.erb +1 -1
  16. data/app/views/promethee/edit/inspector/component/_image.html.erb +3 -3
  17. data/app/views/promethee/edit/inspector/component/_text.html.erb +2 -11
  18. data/app/views/promethee/edit/inspector/component/_video.html.erb +1 -1
  19. data/app/views/promethee/edit/move/_component.html.erb +3 -1
  20. data/app/views/promethee/edit/move/_components.html.erb +10 -4
  21. data/app/views/promethee/edit/move/component/_column.html.erb +11 -9
  22. data/app/views/promethee/edit/move/component/_cover.html.erb +1 -1
  23. data/app/views/promethee/edit/move/component/_details.html.erb +1 -1
  24. data/app/views/promethee/edit/move/component/_row.html.erb +2 -2
  25. data/app/views/promethee/edit/shared/_data.html.erb +1 -0
  26. data/app/views/promethee/edit/shared/_navbar.html.erb +13 -19
  27. data/app/views/promethee/edit/write/_add_button.html.erb +23 -31
  28. data/app/views/promethee/edit/write/_toolbar.html.erb +1 -1
  29. data/app/views/promethee/edit/write/component/_column.html.erb +5 -37
  30. data/app/views/promethee/edit/write/component/_cover.html.erb +3 -22
  31. data/app/views/promethee/edit/write/component/_details.html.erb +3 -22
  32. data/app/views/promethee/edit/write/component/_image.html.erb +4 -23
  33. data/app/views/promethee/edit/write/component/_row.html.erb +4 -25
  34. data/app/views/promethee/edit/write/component/_slider.html.erb +3 -20
  35. data/app/views/promethee/edit/write/component/_text.html.erb +5 -24
  36. data/app/views/promethee/edit/write/component/_video.html.erb +7 -6
  37. data/lib/promethee/data.rb +56 -100
  38. data/lib/promethee/rails/version.rb +1 -1
  39. metadata +6 -4
  40. data/app/assets/stylesheets/promethee-editor/_component.sass +0 -27
  41. data/app/assets/stylesheets/promethee-editor/_mover.sass +0 -85
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 932ca1d52484c654de7f178f55548aa6753942cd
4
- data.tar.gz: a998da307c6021b046a87230f97301c522638757
3
+ metadata.gz: fedae453568a7c76951d9a5f5afac39107887fa1
4
+ data.tar.gz: d9999169433575cee9b82bb574241d4265d68c3e
5
5
  SHA512:
6
- metadata.gz: ec99cb5ea11a85d88149dacfbc2c4e266b85d6642f93e3cda86d8e92dd2e724729a5abc4b5e9dbcf7f02e1d00eff3172464c682c1df5fbfea4a6c5cc3052ef9d
7
- data.tar.gz: 63d672f686c5a4b9bb793fef19c422b107f8daf40fe780950bd83d69c956c5898862cfbeac50a319fdcba59476b065cc4b0b7f3b99af46f69f6556dd83c14867
6
+ metadata.gz: f9a7e5e765d5f8a2d770a2cba25e3c26b0dc2219e0e3936b9c25911934a0e6bb908b8b20d563f0cdd629e15d6299c77ebb200db1d2ebb098a217521a7309d1fb
7
+ data.tar.gz: 66d57d9ef3e5c6699aa773db250d6a233ad2ed5dbed2286bc44cc483d27ba54f848b25e22ced61c9c51b20a52a8a17f2c30fac013aab1f6c6ce6fa5b26b37c79
@@ -3,9 +3,9 @@ $promethee-transparent-grey: transparentize($promethee-grey, .8)
3
3
  $promethee-light-grey: #eee
4
4
  $promethee-color: #ff9900 !default
5
5
 
6
- @import 'promethee-editor/mover'
6
+ @import 'promethee-editor/write'
7
+ @import 'promethee-editor/move'
7
8
  @import 'promethee-editor/preview'
8
- @import 'promethee-editor/component'
9
9
 
10
10
  .promethee-editor
11
11
  background: white
@@ -15,73 +15,42 @@ $promethee-color: #ff9900 !default
15
15
  left: 0
16
16
  right: 0
17
17
  bottom: 0
18
- top: 0
18
+ top: 50px
19
19
  z-index: 10000
20
20
  overflow: auto
21
- &--preview
22
- overflow: hidden
21
+ .promethee-editor__write
22
+ padding-right: 300px
23
+ padding-top: 15px
24
+ .promethee-editor__inspector
25
+ top: 65px
23
26
 
24
27
  &__navbar
25
28
  border-radius: 0
26
29
  border: none
27
- border-bottom: 2px solid $promethee-color
28
- background: transparent
30
+ background: #232323
31
+ margin-bottom: 0
32
+ ul.nav li a
33
+ color: white
34
+ &:hover
35
+ color: #eee
36
+ .dropdown-menu
37
+ background: #232323
38
+ min-width: 20px
29
39
 
30
40
  &__icon
31
41
  svg path
32
- fill: $promethee-color
42
+ fill: white
33
43
 
34
44
  &__button
35
- color: $promethee-color
36
- margin-left: 10px
37
-
38
- &__toolbar
39
- background: #eee
40
- padding: 10px
41
- font-size: 11px
42
- text-transform: uppercase
43
- font-weight: bold
44
- color: $promethee-color
45
- &, *
46
- user-select: none
45
+ color: white
47
46
 
48
47
  &__wrapper
49
48
  padding: 10px
50
49
 
51
- &__component-selected
52
- border: 2px solid transparent
53
-
54
- &--visible
55
- border-color: $promethee-color
56
-
57
- &__inspector
58
- background: #fff
59
- border: 1px solid rgba(0, 0, 0, .1)
60
- width: 300px
61
- height: calc(100vh - 30px)
62
- top: 15px
63
- left: 100%
64
- margin-left: -15px
65
- transform: translateX(-100%)
66
- z-index: 1000
67
- display: none
68
- position: fixed
69
-
70
- &--open
71
- display: block
72
-
73
- &__inspector-header
74
- padding: 15px
75
- border-bottom: 1px solid rgba(0, 0, 0, .1)
76
-
77
- &, h5
78
- font-size: 11px
79
-
80
- h5
81
- margin: 0
82
- font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif
83
- font-weight: bold
84
- text-transform: uppercase
85
-
86
- .promethee-editor__inspector-content
87
- padding: 15px
50
+ .video-neutralizing-overlay
51
+ background: transparent
52
+ position: absolute
53
+ top: 0
54
+ left: 0
55
+ right: 0
56
+ bottom: 0
@@ -0,0 +1,102 @@
1
+ .promethee-editor__move
2
+ width: 432px
3
+ margin: 0 auto
4
+ padding-bottom: 200px
5
+ *
6
+ font-size: 100%
7
+ line-height: 100%
8
+ margin: 0
9
+ .header
10
+ padding: 5px 0
11
+ font-size: 9px
12
+ text-transform: uppercase
13
+ border-bottom: 1px solid #ccc
14
+ &__component
15
+ user-select: none
16
+
17
+ .row
18
+ margin-left: -5px
19
+ margin-right: -5px
20
+ .col
21
+ padding-left: 5px
22
+ padding-right: 5px
23
+
24
+ &__droppable
25
+ visibility: hidden
26
+ margin: 10px 0
27
+ position: relative
28
+ background: #253742
29
+ width: 100%
30
+ height: 10px
31
+ transition: width .2s, height .2s
32
+ &.ui-droppable-active
33
+ visibility: visible
34
+ height: 10px
35
+ &.ui-droppable-hover
36
+ height: 20px
37
+ &--row
38
+ position: absolute
39
+ display: none
40
+ width: 10px
41
+ height: 100%
42
+ &.ui-droppable-active
43
+ width: 10px
44
+ height: 100%
45
+ &.ui-droppable-hover
46
+ width: 20px
47
+ height: 100%
48
+ &--first
49
+ display: block
50
+ left: -10px
51
+ top: 9px
52
+ &--inside-column
53
+ display: block
54
+ right: -10px
55
+ top: -11px
56
+
57
+ // All this is done to mask droppable that would put the draggable at the same position
58
+ // &--hidden
59
+ // visibility: hidden
60
+ // pointer-events: none
61
+ // &--row
62
+ // &:not(&--first)
63
+ // visibility: hidden
64
+ // pointer-events: none
65
+
66
+ // &--first
67
+ // position: absolute
68
+ // top: 0
69
+ // left: -25px
70
+ // width: 40px
71
+ // height: 400px
72
+
73
+ // &--inside-column
74
+ // position: absolute
75
+ // top: 0
76
+ // right: -25px
77
+ // width: 40px
78
+ // height: 400px
79
+
80
+
81
+ .ui-draggable-dragging
82
+ z-index: 1000
83
+ opacity: 0.5
84
+ // Nothing is droppable inside components being dragged
85
+ .promethee-editor__move__droppable
86
+ visibility: hidden !important
87
+
88
+ // By default, nothing is dropped in rows
89
+ &--dragging
90
+ .promethee-editor__move__droppable--row
91
+ display: none
92
+
93
+ // Except for columns, which can be dropped only on rows
94
+ &--dragging.promethee-editor__move--dragging--column
95
+ .promethee-editor__move__droppable
96
+ display: none
97
+ // It's a little specific, columns can be dropped on rows "first droppable", or on columns "inside droppables"
98
+ &.promethee-editor__move__droppable--row--inside-column,
99
+ &.promethee-editor__move__droppable--row--first
100
+ display: block
101
+
102
+
@@ -1,9 +1,8 @@
1
1
  .promethee-editor__preview
2
- background: #000
2
+ background: black
3
3
  position: relative
4
- height: calc(100% - 52px)
4
+ height: 100%
5
5
  min-height: 500px
6
- margin-top: -20px
7
6
 
8
7
  &-frame
9
8
  top: 0
@@ -0,0 +1,58 @@
1
+ .promethee-editor__write
2
+
3
+ .promethee-editor__toolbar
4
+ background: #253742
5
+ padding: 10px
6
+ font-size: 11px
7
+ text-transform: uppercase
8
+ color: white
9
+ text-align: center
10
+ &, *
11
+ user-select: none
12
+
13
+ .promethee-editor__inspector
14
+ background: #fff
15
+ width: 300px
16
+ top: 15px
17
+ right: 0
18
+ bottom: 15px
19
+ z-index: 1000
20
+ position: fixed
21
+ border-left: 1px solid #253742
22
+ border-bottom: 1px solid #253742
23
+ &-header
24
+ background: #253742
25
+ padding: 15px
26
+ color: white
27
+ &, h5
28
+ font-size: 11px
29
+ margin: 0
30
+ text-transform: uppercase
31
+ &-content
32
+ padding: 15px
33
+
34
+ .promethee-editor__adder__button
35
+ display: block
36
+ text-align: center
37
+ margin: 50px 0
38
+
39
+ .promethee-editor__component
40
+ margin-bottom: 5px
41
+ &--cover
42
+ .promethee-editor__cover-content
43
+ padding: 150px 30px
44
+ background-repeat: no-repeat
45
+ background-position: center center
46
+ background-size: cover
47
+ &--row > div > .promethee-editor__toolbar
48
+ margin-bottom: 5px
49
+ &--column > div > .promethee-editor__toolbar
50
+ margin-bottom: 5px
51
+ &--slider
52
+ .fontawesome-carousel-control .fa
53
+ top: 50%
54
+ position: absolute
55
+ transform: translateY(-50%)
56
+ font-size: 30px
57
+ &-selected--visible
58
+ border: 2px solid #253742
@@ -4,53 +4,11 @@ promethee_data = Promethee::Data.new master_data
4
4
  %>
5
5
 
6
6
  <script>
7
- var State = function(value) {
8
- this.default = this.current = value;
9
- };
10
-
11
- State.prototype = {
12
- get enabled() {
13
- return !!this.current;
14
- },
15
-
16
- get disabled() {
17
- return !this.enabled;
18
- },
19
-
20
- enable: function() {
21
- this.set(true);
22
- },
23
-
24
- disable: function() {
25
- this.set(false);
26
- },
27
-
28
- is: function(state) {
29
- return this.current === state;
30
- },
31
-
32
- set: function(state) {
33
- this.current = state
34
- },
35
-
36
- exit: function(state) {
37
- if(this.is(state)) this.current = this.default;
38
- },
39
-
40
- toggle: function(state) {
41
- if(arguments.length === 0) state = true;
42
- this.is(state) ? this.exit(state) : this.set(state)
43
- }
44
- };
45
7
 
46
8
  var promethee = angular
47
9
  .module('Promethee', ['summernote', 'ngAnimate'])
48
10
  .value('data', <%= promethee_data.to_json.html_safe %>)
49
11
  .value('definitions', [])
50
- .value('inspected', {component: null})
51
- .value('action', new State('write'))
52
- .value('preview', new State('desktop'))
53
- .value('fullscreen', new State(false))
54
12
  .config(function($rootScopeProvider) {
55
13
  $rootScopeProvider.digestTtl(20);
56
14
  })
@@ -102,7 +60,8 @@ promethee_data = Promethee::Data.new master_data
102
60
  };
103
61
  });
104
62
 
105
- promethee.controller('PrometheeController', ['data', '$scope', 'definitions', '$http', 'action', 'preview', 'fullscreen', 'inspected', function(data, $scope, definitions, $http, action, preview, fullscreen, inspected) {
63
+ promethee.controller('PrometheeController', ['data', '$scope', 'definitions', '$http',
64
+ function(data, $scope, definitions, $http) {
106
65
 
107
66
  // Data (TODO use Adder and probably page definition to init)
108
67
  if(data === null || data === '') {
@@ -114,43 +73,35 @@ promethee_data = Promethee::Data.new master_data
114
73
  };
115
74
  }
116
75
 
76
+ $scope.promethee = { inspected: null };
117
77
  $scope.data = $scope.component = data;
118
- $scope.inspected = inspected;
119
-
120
- // Application states
121
- $scope.action = action;
122
- $scope.preview = preview;
123
- $scope.fullscreen = fullscreen;
124
-
125
- // $scope.enablePreview = function() {
126
- // this.preview = true;
127
- // this.move = false;
128
-
129
- // var form = document.createElement('form');
130
- // document.body.appendChild(form);
131
- // form.method = 'POST';
132
- // form.action = <%= promethee_preview_path.to_json.html_safe %>;
133
- // form.target = 'preview';
134
- // var input = document.createElement('input');
135
- // input.type = 'text';
136
- // input.value = JSON.stringify(data);
137
- // input.name = 'data';
138
- // form.appendChild(input);
139
- // form.submit();
140
- // document.body.removeChild(form);
141
- // }
142
-
143
- // $scope.disablePreview = function() {
144
- // this.preview = false;
145
- // }
146
-
147
- // $scope.enableFullscreen = function() {
148
- // this.fullscreen = true;
149
- // }
150
-
151
- // $scope.disableFullscreen = function() {
152
- // this.fullscreen = false;
153
- // }
78
+ $scope.mode = 'write';
79
+ $scope.preview = 'desktop';
80
+ $scope.fullscreen = false;
81
+
82
+ $scope.inspect = function(component, event) {
83
+ $scope.promethee.inspected = component;
84
+ event.stopPropagation();
85
+ }
86
+
87
+ $scope.enablePreview = function() {
88
+ if (this.mode === 'preview') return;
89
+ this.mode = 'preview';
90
+
91
+ var form = document.createElement('form');
92
+ document.body.appendChild(form);
93
+ form.method = 'POST';
94
+ form.action = <%= promethee_preview_path.to_json.html_safe %>;
95
+ form.target = 'preview';
96
+
97
+ var input = document.createElement('input');
98
+ input.type = 'text';
99
+ input.value = JSON.stringify(data);
100
+ input.name = 'data';
101
+ form.appendChild(input);
102
+ form.submit();
103
+ document.body.removeChild(form);
104
+ }
154
105
 
155
106
  $scope.remove = function(component, components) {
156
107
  var index = components.indexOf(component);
@@ -163,31 +114,15 @@ promethee_data = Promethee::Data.new master_data
163
114
 
164
115
  <div
165
116
  id="promethee"
166
- ng-class="{
167
- 'promethee-editor': true,
168
- 'promethee-editor--fullscreen': fullscreen.enabled
169
- }"
117
+ class="promethee-editor"
118
+ ng-class="{ 'promethee-editor--fullscreen': fullscreen }"
170
119
  ng-app="Promethee"
171
120
  ng-controller="PrometheeController as prometheeController"
172
- >
121
+ >
122
+ <%= render 'promethee/edit/shared/data' %>
173
123
  <%= render 'promethee/edit/shared/navbar' %>
174
-
175
124
  <%= render 'promethee/edit/write' %>
176
125
  <%= render 'promethee/edit/move' %>
177
126
  <%= render 'promethee/edit/preview' %>
178
-
179
- <input type="hidden" name="page[data]" id="page_data" value="{{data}}" />
180
-
181
- <div ng-show="action.is('write')" class="promethee__write">
182
- <ng-include src="'promethee/write'"></ng-include>
183
- </div>
184
-
185
- <div ng-show="action.is('move')" class="promethee__move">
186
- <ng-include src="'promethee/move'"></ng-include>
187
- </div>
188
-
189
- <div ng-show="action.is('preview')" class="promethee__preview">
190
- <ng-include src="'promethee/preview'"></ng-include>
191
- </div>
192
127
  </div>
193
128