pageflow 13.0.0.beta5 → 13.0.0.beta6

Sign up to get free protection for your applications and to get access to all the features.

Potentially problematic release.


This version of pageflow might be problematic. Click here for more details.

Files changed (65) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +17 -0
  3. data/README.md +4 -0
  4. data/admins/pageflow/accounts.rb +1 -0
  5. data/app/assets/javascripts/pageflow/base.js +1 -0
  6. data/app/assets/javascripts/pageflow/cookie_notice.js +7 -0
  7. data/app/assets/javascripts/pageflow/dist/react.js +505 -74
  8. data/app/assets/javascripts/pageflow/editor/models/configuration.js +5 -5
  9. data/app/assets/javascripts/pageflow/editor/templates/background_positioning_sliders.jst.ejs +8 -0
  10. data/app/assets/javascripts/pageflow/editor/views/background_positioning_sliders_view.js +37 -23
  11. data/app/assets/javascripts/pageflow/editor/views/background_positioning_view.js +2 -2
  12. data/app/assets/javascripts/pageflow/editor/views/configuration_editors/video.js +1 -1
  13. data/app/assets/javascripts/pageflow/editor/views/edit_widget_view.js +9 -0
  14. data/app/assets/javascripts/pageflow/editor/views/info_box_view.js +8 -0
  15. data/app/assets/javascripts/pageflow/editor/views/widget_types/cookie_notice_bar.js +15 -0
  16. data/app/assets/javascripts/pageflow/seed_entry_data.js +3 -3
  17. data/app/assets/javascripts/pageflow/slideshow/adjacent_preparer.js +11 -4
  18. data/app/assets/javascripts/pageflow/ui/views/configuration_editor_view.js +2 -2
  19. data/app/assets/javascripts/pageflow/visited.js +2 -0
  20. data/app/assets/stylesheets/pageflow/admin.scss +5 -22
  21. data/app/assets/stylesheets/pageflow/admin/active_admin_patches.scss +21 -0
  22. data/app/assets/stylesheets/pageflow/editor/background_positioning.scss +34 -10
  23. data/app/assets/stylesheets/pageflow/page_types/video.scss +1 -4
  24. data/app/assets/stylesheets/pageflow/page_types/video/mobile_poster.scss +15 -0
  25. data/app/assets/stylesheets/pageflow/themes/default/base.scss +1 -0
  26. data/app/assets/stylesheets/pageflow/themes/default/cookie_notice_bar.scss +57 -0
  27. data/app/assets/stylesheets/pageflow/themes/default/page.scss +1 -0
  28. data/app/assets/stylesheets/pageflow/themes/default/page/hyphenate.scss +24 -0
  29. data/app/assets/stylesheets/pageflow/themes/default/slideshow.scss +1 -0
  30. data/app/controllers/pageflow/admin/initial_passwords_controller.rb +8 -0
  31. data/app/helpers/pageflow/common_entry_seed_helper.rb +1 -0
  32. data/app/helpers/pageflow/entries_helper.rb +20 -2
  33. data/app/helpers/pageflow/entry_json_seed_helper.rb +1 -1
  34. data/app/helpers/pageflow/public_i18n_helper.rb +6 -1
  35. data/app/models/pageflow/published_entry.rb +14 -1
  36. data/app/views/admin/accounts/_form.html.erb +1 -0
  37. data/app/views/pageflow/admin/initial_passwords/edit.html.erb +16 -0
  38. data/app/views/pageflow/entry_json_seed/_entry.json.jbuilder +1 -1
  39. data/app/views/pageflow/user_mailer/invitation.html.erb +2 -2
  40. data/app/views/pageflow/user_mailer/invitation.text.erb +1 -1
  41. data/config/locales/de.yml +11 -1
  42. data/config/locales/en.yml +10 -0
  43. data/config/routes.rb +6 -0
  44. data/db/migrate/20180528144334_add_privacy_link_url_to_themings.rb +5 -0
  45. data/lib/pageflow/built_in_widget_type.rb +4 -0
  46. data/lib/pageflow/built_in_widget_types_plugin.rb +1 -0
  47. data/lib/pageflow/version.rb +1 -1
  48. data/spec/factories/accounts.rb +7 -7
  49. data/spec/factories/audio_files.rb +11 -11
  50. data/spec/factories/chapters.rb +2 -2
  51. data/spec/factories/entries.rb +7 -7
  52. data/spec/factories/file_usages.rb +2 -2
  53. data/spec/factories/folders.rb +1 -1
  54. data/spec/factories/hosted_files.rb +8 -8
  55. data/spec/factories/image_files.rb +10 -10
  56. data/spec/factories/invited_user.rb +2 -2
  57. data/spec/factories/memberships.rb +3 -3
  58. data/spec/factories/pages.rb +4 -4
  59. data/spec/factories/revisions.rb +8 -8
  60. data/spec/factories/text_track_files.rb +9 -9
  61. data/spec/factories/themings.rb +1 -1
  62. data/spec/factories/users.rb +7 -7
  63. data/spec/factories/video_files.rb +12 -12
  64. data/spec/factories/widgets.rb +2 -2
  65. metadata +16 -6
@@ -40,25 +40,25 @@ pageflow.Configuration = Backbone.Model.extend({
40
40
  },
41
41
 
42
42
  getFilePosition: function(attribute, coord) {
43
- var propertyName = this._filePositionProperty(attribute, coord);
43
+ var propertyName = this.filePositionProperty(attribute, coord);
44
44
  return this.has(propertyName) ? this.get(propertyName) : 50;
45
45
  },
46
46
 
47
47
  setFilePosition: function(attribute, coord, value) {
48
- var propertyName = this._filePositionProperty(attribute, coord);
48
+ var propertyName = this.filePositionProperty(attribute, coord);
49
49
  this.set(propertyName, value);
50
50
  },
51
51
 
52
52
  setFilePositions: function(attribute, x, y) {
53
53
  var attributes = {};
54
54
 
55
- attributes[this._filePositionProperty(attribute, 'x')] = x;
56
- attributes[this._filePositionProperty(attribute, 'y')] = y;
55
+ attributes[this.filePositionProperty(attribute, 'x')] = x;
56
+ attributes[this.filePositionProperty(attribute, 'y')] = y;
57
57
 
58
58
  this.set(attributes);
59
59
  },
60
60
 
61
- _filePositionProperty: function(attribute, coord) {
61
+ filePositionProperty: function(attribute, coord) {
62
62
  return attribute.replace(/_id$/, '_' + coord);
63
63
  },
64
64
 
@@ -3,4 +3,12 @@
3
3
  </div>
4
4
  <div class="slider vertical">
5
5
  </div>
6
+ <div class="percent horizontal">
7
+ <input type="number" min="0" max="100">
8
+ %
9
+ </div>
10
+ <div class="percent vertical">
11
+ <input type="number" min="0" max="100">
12
+ %
13
+ </div>
6
14
  </div>
@@ -6,7 +6,10 @@ pageflow.BackgroundPositioningSlidersView = Backbone.Marionette.ItemView.extend(
6
6
  container: '.container',
7
7
 
8
8
  sliderHorizontal: '.horizontal.slider',
9
- sliderVertical: '.vertical.slider'
9
+ sliderVertical: '.vertical.slider',
10
+
11
+ inputHorizontal: '.percent.horizontal input',
12
+ inputVertical: '.percent.vertical input'
10
13
  },
11
14
 
12
15
  events: {
@@ -34,6 +37,10 @@ pageflow.BackgroundPositioningSlidersView = Backbone.Marionette.ItemView.extend(
34
37
  }
35
38
  },
36
39
 
40
+ modelEvents: {
41
+ change: 'update'
42
+ },
43
+
37
44
  onRender: function() {
38
45
  var view = this;
39
46
  var file = this.model.getReference(this.options.propertyName, this.options.filesCollection),
@@ -43,52 +50,59 @@ pageflow.BackgroundPositioningSlidersView = Backbone.Marionette.ItemView.extend(
43
50
 
44
51
  this.ui.sliderVertical.slider({
45
52
  orientation: 'vertical',
46
- step: 0.01,
47
- value: 100 - this.model.getFilePosition(this.options.propertyName, 'y'),
48
53
 
49
- change: function() {
50
- view.save();
54
+ change: function(event, ui) {
55
+ view.save('y', 100 - ui.value);
51
56
  },
52
57
 
53
58
  slide: function(event, ui) {
54
- view.save({y: ui.value});
59
+ view.save('y', 100 - ui.value);
55
60
  }
56
61
  });
57
62
 
58
63
  this.ui.sliderHorizontal.slider({
59
64
  orientation: 'horizontal',
60
- step: 0.01,
61
- value: this.model.getFilePosition(this.options.propertyName, 'x'),
62
65
 
63
- change: function() {
64
- view.save();
66
+ change: function(event, ui) {
67
+ view.save('x', ui.value);
65
68
  },
66
69
 
67
70
  slide: function(event, ui) {
68
- view.save({y: ui.value});
71
+ view.save('x', ui.value);
69
72
  }
70
73
  });
74
+
75
+ this.ui.inputVertical.on('change', function() {
76
+ view.save('y', $(this).val());
77
+ });
78
+
79
+ this.ui.inputHorizontal.on('change', function() {
80
+ view.save('x', $(this).val());
81
+ });
82
+
83
+ this.update();
71
84
  },
72
85
 
73
- onShow: function() {
86
+ update: function() {
87
+ var x = this.model.getFilePosition(this.options.propertyName, 'x');
88
+ var y = this.model.getFilePosition(this.options.propertyName, 'y');
89
+
90
+ this.ui.sliderVertical.slider('value', 100 - y);
91
+ this.ui.sliderHorizontal.slider('value', x);
92
+
93
+ this.ui.inputVertical.val(y);
94
+ this.ui.inputHorizontal.val(x);
74
95
  },
75
96
 
76
97
  saveFromEvent: function(event) {
77
98
  var x = event.pageX - this.ui.container.offset().left;
78
99
  var y = event.pageY - this.ui.container.offset().top;
79
100
 
80
- this.ui.sliderHorizontal.slider('value', x / this.ui.container.width() * 100);
81
- this.ui.sliderVertical.slider('value', (1 - y / this.ui.container.height()) * 100);
82
- this.save();
101
+ this.save('x', Math.round(x / this.ui.container.width() * 100));
102
+ this.save('y', Math.round(y / this.ui.container.width() * 100));
83
103
  },
84
104
 
85
- save: function(options) {
86
- options = options || {};
87
-
88
- var x = x in options ? options.x : this.ui.sliderHorizontal.slider('value');
89
- var y = y in options ? options.y : 100 - this.ui.sliderVertical.slider('value');
90
-
91
- this.model.setFilePosition(this.options.propertyName, 'x', x);
92
- this.model.setFilePosition(this.options.propertyName, 'y', y);
105
+ save: function(coord, value) {
106
+ this.model.setFilePosition(this.options.propertyName, coord, Math.min(100, Math.max(0, value)));
93
107
  }
94
108
  });
@@ -63,5 +63,5 @@ pageflow.BackgroundPositioningView = Backbone.Marionette.ItemView.extend({
63
63
  });
64
64
 
65
65
  pageflow.BackgroundPositioningView.open = function(options) {
66
- pageflow.app.dialogRegion.show(new pageflow.BackgroundPositioningView(options).render());
67
- };
66
+ pageflow.app.dialogRegion.show(new pageflow.BackgroundPositioningView(options));
67
+ };
@@ -19,7 +19,7 @@ pageflow.ConfigurationEditorView.register('video', {
19
19
  });
20
20
  this.input('mobile_poster_image_id', pageflow.FileInputView, {
21
21
  collection: pageflow.imageFiles,
22
- positioning: false
22
+ positioning: true
23
23
  });
24
24
  this.input('thumbnail_image_id', pageflow.FileInputView, {
25
25
  collection: pageflow.imageFiles,
@@ -8,6 +8,15 @@ pageflow.EditWidgetView = Backbone.Marionette.ItemView.extend({
8
8
  }
9
9
  },
10
10
 
11
+ initialize: function() {
12
+ this.model.set('editing', true);
13
+ },
14
+
15
+ onClose: function() {
16
+ Backbone.Marionette.ItemView.prototype.onClose.call(this);
17
+ this.model.set('editing', false);
18
+ },
19
+
11
20
  onRender: function() {
12
21
  var configurationEditor = this.model.widgetType().createConfigurationEditorView({
13
22
  model: this.model.configuration,
@@ -0,0 +1,8 @@
1
+ pageflow.InfoBoxView = Backbone.Marionette.View.extend({
2
+ className: 'info_box',
3
+
4
+ render: function() {
5
+ this.$el.text(this.options.text);
6
+ return this;
7
+ }
8
+ });
@@ -0,0 +1,15 @@
1
+ pageflow.editor.widgetTypes.registerRole('cookie_notice', {
2
+ isOptional: true
3
+ });
4
+
5
+ pageflow.editor.widgetTypes.register('cookie_notice_bar', {
6
+ configurationEditorView: pageflow.ConfigurationEditorView.extend({
7
+ configure: function() {
8
+ this.tab('cookie_notice_bar', function() {
9
+ this.view(pageflow.InfoBoxView, {
10
+ text: I18n.t('pageflow.editor.cookie_notice_bar.widget_type_info_box_text')
11
+ });
12
+ });
13
+ }
14
+ })
15
+ });
@@ -1,6 +1,6 @@
1
1
  pageflow.SeedEntryData = pageflow.EntryData.extend({
2
2
  initialize: function(options) {
3
- this.theming = options.theming;
3
+ this.theme = options.theme;
4
4
 
5
5
  this.storylineConfigurations = _(options.storylines).reduce(function(memo, storyline) {
6
6
  memo[storyline.id] = storyline.configuration;
@@ -40,7 +40,7 @@ pageflow.SeedEntryData = pageflow.EntryData.extend({
40
40
  },
41
41
 
42
42
  getThemingOption: function(name) {
43
- return this.theming[name];
43
+ return this.theme[name];
44
44
  },
45
45
 
46
46
  getChapterConfiguration: function(id) {
@@ -70,4 +70,4 @@ pageflow.SeedEntryData = pageflow.EntryData.extend({
70
70
  getStorylineIdByChapterId: function(id) {
71
71
  return this.storylineIdsByChapterIds[id];
72
72
  }
73
- });
73
+ });
@@ -1,8 +1,10 @@
1
1
  //= require ./adjacent_pages
2
2
 
3
3
  pageflow.AdjacentPreparer = pageflow.Object.extend({
4
- initialize: function(adjacentPages) {
4
+ initialize: function(adjacentPages, settings, debugMode) {
5
5
  this.adjacentPages = adjacentPages;
6
+ this.settings = settings || new Backbone.Model();
7
+ this.debugMode = debugMode;
6
8
  },
7
9
 
8
10
  attach: function(events) {
@@ -17,7 +19,10 @@ pageflow.AdjacentPreparer = pageflow.Object.extend({
17
19
  },
18
20
 
19
21
  prepareAdjacent: function(page) {
20
- var adjacentPages = this.adjacentPages.of(page);
22
+ var max = this.settings.has('max_prepared_adjacent_pages') && this.debugMode ?
23
+ this.settings.get('max_prepared_adjacent_pages') :
24
+ 5;
25
+ var adjacentPages = _.first(this.adjacentPages.of(page), max);
21
26
  var noLongerPreparedPages = _.difference(this.lastPreparedPages, adjacentPages, [page]);
22
27
  var newAdjacentPages = _.difference(adjacentPages, this.lastPreparedPages);
23
28
 
@@ -41,6 +46,8 @@ pageflow.AdjacentPreparer.create = function(pages, scrollNavigator) {
41
46
  new pageflow.AdjacentPages(
42
47
  pages,
43
48
  scrollNavigator
44
- )
49
+ ),
50
+ pageflow.settings,
51
+ pageflow.debugMode()
45
52
  );
46
- };
53
+ };
@@ -3,7 +3,7 @@ pageflow.ConfigurationEditorView = Backbone.Marionette.View.extend({
3
3
 
4
4
  initialize: function() {
5
5
  this.tabsView = new pageflow.TabsView({
6
- i18n: 'pageflow.ui.configuration_editor.tabs',
6
+ i18n: this.options.tabTranslationKeyPrefix || 'pageflow.ui.configuration_editor.tabs',
7
7
  defaultTab: this.options.tab
8
8
  });
9
9
  this.configure();
@@ -40,4 +40,4 @@ _.extend(pageflow.ConfigurationEditorView, {
40
40
  register: function(pageTypeName, prototype) {
41
41
  this.repository[pageTypeName] = pageflow.ConfigurationEditorView.extend(prototype);
42
42
  }
43
- });
43
+ });
@@ -4,6 +4,8 @@ pageflow.Visited = function(entryId, pages, events, cookies) {
4
4
  var unvisitedPages = [];
5
5
 
6
6
  function init() {
7
+ pageflow.cookieNotice.request();
8
+
7
9
  if (!cookies.hasItem(cookieName)) {
8
10
  storeVisitedPageIds(getAllIds());
9
11
  }
@@ -1,5 +1,10 @@
1
1
  @import "active_admin/searchable_select";
2
2
 
3
+ // Needs to be imported before bourbon which redefines functions used
4
+ // by active admin mixins (i.e. `linear-gradient` used by
5
+ // `light-button`)
6
+ @import "pageflow/admin/active_admin_patches";
7
+
3
8
  @import "bourbon";
4
9
  @import "pageflow/mixins";
5
10
 
@@ -19,25 +24,3 @@
19
24
  @import "pageflow/admin/status_tags";
20
25
  @import "pageflow/admin/tabs_view";
21
26
  @import "pageflow/admin/tooltip_bubble";
22
-
23
- #wrapper {
24
- overflow: hidden;
25
- position: relative;
26
- }
27
-
28
- .action_items {
29
- form, div {
30
- display: inline;
31
- }
32
-
33
- input[type="submit"] {
34
- @include light-button;
35
- padding: 12px 17px 10px;
36
- span.icon { vertical-align: bottom; margin-right: 4px;}
37
- margin: 0px;
38
- }
39
- }
40
-
41
- .blank_slate_container {
42
- margin: 10px 0;
43
- }
@@ -0,0 +1,21 @@
1
+ #wrapper {
2
+ overflow: hidden;
3
+ position: relative;
4
+ }
5
+
6
+ .action_items {
7
+ form,
8
+ div {
9
+ display: inline;
10
+ }
11
+
12
+ input[type="submit"] {
13
+ @include light-button;
14
+ padding: 12px 17px 10px;
15
+ margin: 0;
16
+ }
17
+ }
18
+
19
+ .blank_slate_container {
20
+ margin: 10px 0;
21
+ }
@@ -47,7 +47,7 @@
47
47
 
48
48
  .wrapper {
49
49
  text-align: center;
50
- margin: 20px;
50
+ margin: 35px;
51
51
  }
52
52
 
53
53
  .previews {
@@ -96,6 +96,7 @@
96
96
  .slider {
97
97
  position: absolute;
98
98
  border: none;
99
+ background: #ddd;
99
100
 
100
101
  a {
101
102
  @include background-icon-center($font-size: 20px);
@@ -113,10 +114,10 @@
113
114
  }
114
115
 
115
116
  &.horizontal {
116
- bottom: 0;
117
- left: 40px;
118
- right: 40px;
119
- height: 0;
117
+ bottom: -10px;
118
+ left: 9px;
119
+ right: 11px;
120
+ height: 2px;
120
121
 
121
122
  a {
122
123
  @include transform(rotate(90deg));
@@ -126,10 +127,10 @@
126
127
  }
127
128
 
128
129
  &.vertical {
129
- right: 0;
130
- top: 40px;
131
- bottom: 40px;
132
- width: 0;
130
+ right: -10px;
131
+ top: 12px;
132
+ bottom: 11px;
133
+ width: 2px;
133
134
  height: auto;
134
135
 
135
136
  a {
@@ -139,6 +140,29 @@
139
140
  }
140
141
  }
141
142
 
143
+ .percent {
144
+ position: absolute;
145
+ font-size: 12px;
146
+ white-space: nowrap;
147
+
148
+ input {
149
+ width: 45px;
150
+ height: 25px;
151
+ box-sizing: border-box;
152
+ text-align: right;
153
+ }
154
+
155
+ &.horizontal {
156
+ left: -65px;
157
+ bottom: -26px;
158
+ }
159
+
160
+ &.vertical {
161
+ left: 100%;
162
+ top: -30px;
163
+ }
164
+ }
165
+
142
166
  a.save {
143
167
  @include check-icon;
144
168
  @include icon-button;
@@ -147,4 +171,4 @@
147
171
  a.close {
148
172
  @include icon-button(#888);
149
173
  }
150
- }
174
+ }
@@ -1,4 +1,5 @@
1
1
  @import "./video/content_hiding";
2
+ @import "./video/mobile_poster";
2
3
 
3
4
  .has_native_video_player .page .videoPage .videoWrapper {
4
5
  margin-right: 0;
@@ -114,7 +115,3 @@
114
115
  .js .non_js_video {
115
116
  display: none;
116
117
  }
117
-
118
- .has_no_native_video_player .videoPage .background_image {
119
- display: none;
120
- }