pageflow 13.0.0.beta6 → 13.0.0.beta7
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.
- checksums.yaml +4 -4
- data/CHANGELOG.md +74 -0
- data/README.md +1 -0
- data/app/assets/audios/pageflow/unmute.mp3 +0 -0
- data/app/assets/images/pageflow/editor/help/phone_horizontal_slideshow_mode.gif +0 -0
- data/app/assets/javascripts/pageflow/asset_urls.js.erb +1 -1
- data/app/assets/javascripts/pageflow/audio/multi_player.js +4 -0
- data/app/assets/javascripts/pageflow/audio_player.js +1 -1
- data/app/assets/javascripts/pageflow/background_media.js +22 -0
- data/app/assets/javascripts/pageflow/base.js +1 -0
- data/app/assets/javascripts/pageflow/browser/agent.js +92 -78
- data/app/assets/javascripts/pageflow/browser/autoplay_support.js +2 -2
- data/app/assets/javascripts/pageflow/dist/react.js +711 -252
- data/app/assets/javascripts/pageflow/editor/api/page_type.js +4 -0
- data/app/assets/javascripts/pageflow/editor/base.js +1 -0
- data/app/assets/javascripts/pageflow/editor/collections/files_collection.js +8 -0
- data/app/assets/javascripts/pageflow/editor/initializers/boot.js +6 -4
- data/app/assets/javascripts/pageflow/editor/initializers/setup_asset_urls.js +3 -0
- data/app/assets/javascripts/pageflow/editor/models/entry.js +2 -2
- data/app/assets/javascripts/pageflow/editor/models/file_stage.js +6 -1
- data/app/assets/javascripts/pageflow/editor/models/mixins/stage_provider.js +9 -0
- data/app/assets/javascripts/pageflow/editor/models/mixins/transient_references.js +12 -2
- data/app/assets/javascripts/pageflow/editor/models/preview_entry_data.js +5 -0
- data/app/assets/javascripts/pageflow/editor/models/uploaded_file.js +6 -1
- data/app/assets/javascripts/pageflow/editor/templates/emulation_mode_button.jst.ejs +26 -0
- data/app/assets/javascripts/pageflow/editor/templates/entry_preview.jst.ejs +8 -3
- data/app/assets/javascripts/pageflow/editor/views/configuration_editors/groups/options.js +1 -1
- data/app/assets/javascripts/pageflow/editor/views/configuration_editors/groups/page_link.js +3 -6
- data/app/assets/javascripts/pageflow/editor/views/configuration_editors/groups/page_transitions.js +14 -4
- data/app/assets/javascripts/pageflow/editor/views/edit_storyline_view.js +3 -6
- data/app/assets/javascripts/pageflow/editor/views/embedded/background_image_embedded_view.js +47 -12
- data/app/assets/javascripts/pageflow/editor/views/emulation_mode_button_view.js +45 -0
- data/app/assets/javascripts/pageflow/editor/views/entry_preview_view.js +62 -8
- data/app/assets/javascripts/pageflow/editor/views/file_stage_item_view.js +7 -0
- data/app/assets/javascripts/pageflow/editor/views/help_image_view.js +9 -0
- data/app/assets/javascripts/pageflow/editor/views/info_box_view.js +1 -1
- data/app/assets/javascripts/pageflow/editor/views/inputs/file_processing_state_display_view.js +60 -0
- data/app/assets/javascripts/pageflow/editor/views/sidebar_footer_view.js +12 -0
- data/app/assets/javascripts/pageflow/editor/views/widget_types/phone_horizontal_slideshow_mode.js +14 -0
- data/app/assets/javascripts/pageflow/entry_data.js +4 -0
- data/app/assets/javascripts/pageflow/media_player.js +7 -3
- data/app/assets/javascripts/pageflow/media_player/handle_failed_play.js +34 -0
- data/app/assets/javascripts/pageflow/media_player/volume_fading/web_audio.js +29 -3
- data/app/assets/javascripts/pageflow/page_transitions.js +59 -15
- data/app/assets/javascripts/pageflow/page_type.js +5 -1
- data/app/assets/javascripts/pageflow/seed_entry_data.js +13 -0
- data/app/assets/javascripts/pageflow/slideshow.js +31 -11
- data/app/assets/javascripts/pageflow/slideshow/atmo.js +23 -12
- data/app/assets/javascripts/pageflow/slideshow/lazy_page_widget.js +9 -3
- data/app/assets/javascripts/pageflow/slideshow/navigation_direction.js +37 -0
- data/app/assets/javascripts/pageflow/slideshow/page_widget.js +12 -6
- data/app/assets/javascripts/pageflow/slideshow/scroll_indicator_widget.js +13 -16
- data/app/assets/javascripts/pageflow/slideshow/scroller_widget.js +49 -14
- data/app/assets/javascripts/pageflow/ui/views/mixins/input_view.js +10 -3
- data/app/assets/javascripts/pageflow/video_player/lazy.js +1 -1
- data/app/assets/stylesheets/pageflow/animations/bounce.scss +13 -1
- data/app/assets/stylesheets/pageflow/editor/base.scss +5 -0
- data/app/assets/stylesheets/pageflow/editor/emulation_mode_button.scss +78 -0
- data/app/assets/stylesheets/pageflow/editor/entry_preview.scss +41 -0
- data/app/assets/stylesheets/pageflow/editor/file_stages.scss +11 -3
- data/app/assets/stylesheets/pageflow/editor/help.scss +4 -14
- data/app/assets/stylesheets/pageflow/editor/help_image.scss +5 -0
- data/app/assets/stylesheets/pageflow/editor/info_box.scss +5 -0
- data/app/assets/stylesheets/pageflow/editor/inputs.scss +1 -0
- data/app/assets/stylesheets/pageflow/editor/inputs/file_processing_state_display.scss +18 -0
- data/app/assets/stylesheets/pageflow/editor/sidebar_footer.scss +12 -0
- data/app/assets/stylesheets/pageflow/entries.scss +29 -6
- data/app/assets/stylesheets/pageflow/mixins/breakpoints.scss +5 -3
- data/app/assets/stylesheets/pageflow/mixins/icons/fontawesome.scss +1 -1
- data/app/assets/stylesheets/pageflow/navigation_mobile.scss +5 -1
- data/app/assets/stylesheets/pageflow/page_transitions.scss +0 -6
- data/app/assets/stylesheets/pageflow/page_transitions/crossfade.scss +5 -1
- data/app/assets/stylesheets/pageflow/page_transitions/fade.scss +44 -36
- data/app/assets/stylesheets/pageflow/page_transitions/scroll.scss +96 -11
- data/app/assets/stylesheets/pageflow/slideshow.scss +0 -4
- data/app/assets/stylesheets/pageflow/themes/default/background_media_unmute_button.scss +68 -0
- data/app/assets/stylesheets/pageflow/themes/default/base.scss +1 -0
- data/app/assets/stylesheets/pageflow/themes/default/indicators/icons/icon_font.scss +7 -0
- data/app/assets/stylesheets/pageflow/ui/forms.scss +4 -0
- data/app/controllers/pageflow/editor/files_controller.rb +9 -1
- data/app/helpers/pageflow/asset_urls_helper.rb +9 -0
- data/app/helpers/pageflow/background_image_helper.rb +6 -10
- data/app/helpers/pageflow/file_background_images_helper.rb +78 -0
- data/app/helpers/pageflow/pages_helper.rb +2 -2
- data/app/helpers/pageflow/render_json_helper.rb +3 -2
- data/app/models/concerns/pageflow/hosted_file.rb +2 -9
- data/app/models/concerns/pageflow/uploaded_file.rb +9 -0
- data/app/models/pageflow/draft_entry.rb +2 -2
- data/app/models/pageflow/image_file.rb +5 -20
- data/app/models/pageflow/image_file_css_background_image_urls.rb +17 -0
- data/app/models/pageflow/video_file_css_background_image_urls.rb +13 -0
- data/app/views/pageflow/editor/asset_urls/_asset_urls.json.jbuilder +4 -0
- data/app/views/pageflow/editor/entries/seed.json.erb +3 -1
- data/app/views/pageflow/editor/image_files/_image_file.json.jbuilder +1 -1
- data/app/views/pageflow/entries/_indicators.html.erb +8 -3
- data/app/views/pageflow/entries/edit.html.erb +1 -1
- data/app/views/pageflow/entries/show.css.erb +6 -20
- data/app/views/pageflow/file_background_images/_rule.css.erb +3 -0
- data/config/initializers/features.rb +1 -0
- data/config/locales/de.yml +20 -8
- data/config/locales/en.yml +23 -11
- data/config/routes.rb +1 -0
- data/lib/pageflow/built_in_file_type.rb +4 -0
- data/lib/pageflow/built_in_widget_type.rb +12 -0
- data/lib/pageflow/built_in_widget_types_plugin.rb +5 -0
- data/lib/pageflow/file_type.rb +39 -0
- data/lib/pageflow/file_types.rb +6 -0
- data/lib/pageflow/version.rb +1 -1
- data/spec/factories/hosted_files.rb +12 -8
- data/vendor/assets/javascripts/audio5.min.js +280 -129
- data/vendor/assets/javascripts/iscroll.js +16 -11
- metadata +47 -16
- data/app/assets/javascripts/pageflow/media_player/catch_play_promise.js +0 -23
- data/app/assets/stylesheets/pageflow/page_transitions/scroll_in.scss +0 -66
- data/app/assets/stylesheets/pageflow/page_transitions/scroll_in_right.scss +0 -68
- data/app/assets/stylesheets/pageflow/page_transitions/scroll_left.scss +0 -20
- data/app/assets/stylesheets/pageflow/page_transitions/scroll_over_from_left.scss +0 -12
- data/app/assets/stylesheets/pageflow/page_transitions/scroll_over_from_right.scss +0 -12
- data/app/assets/stylesheets/pageflow/page_transitions/scroll_right.scss +0 -20
- data/lib/pageflow/images/palette.png +0 -0
@@ -24,6 +24,14 @@ pageflow.FilesCollection = Backbone.Collection.extend({
|
|
24
24
|
return Backbone.Collection.prototype.fetch.call(this, options);
|
25
25
|
},
|
26
26
|
|
27
|
+
findOrCreateBy: function(attributes) {
|
28
|
+
return this.findWhere(attributes) ||
|
29
|
+
this.create(attributes, {
|
30
|
+
noUpload: true,
|
31
|
+
fileType: this.fileType
|
32
|
+
});
|
33
|
+
},
|
34
|
+
|
27
35
|
getEntry: function() {
|
28
36
|
return this.entry || pageflow.entry;
|
29
37
|
},
|
@@ -12,9 +12,11 @@ pageflow.app.addInitializer(function(options) {
|
|
12
12
|
model: pageflow.entry
|
13
13
|
}));
|
14
14
|
|
15
|
-
pageflow.app.indicatorsRegion.show(new pageflow.DisabledAtmoIndicatorView()
|
16
|
-
pageflow.app.notificationsRegion.show(new pageflow.NotificationsView()
|
17
|
-
pageflow.app.
|
15
|
+
pageflow.app.indicatorsRegion.show(new pageflow.DisabledAtmoIndicatorView());
|
16
|
+
pageflow.app.notificationsRegion.show(new pageflow.NotificationsView());
|
17
|
+
pageflow.app.sidebarFooterRegion.show(new pageflow.SidebarFooterView({
|
18
|
+
model: pageflow.entry
|
19
|
+
}));
|
18
20
|
|
19
21
|
Backbone.history.start({root: options.root});
|
20
22
|
});
|
@@ -26,5 +28,5 @@ pageflow.app.addRegions({
|
|
26
28
|
sidebarRegion: 'sidebar .container',
|
27
29
|
dialogRegion: '.dialog_container',
|
28
30
|
notificationsRegion: 'sidebar .notifications_container',
|
29
|
-
|
31
|
+
sidebarFooterRegion: 'sidebar .sidebar_footer_container'
|
30
32
|
});
|
@@ -102,8 +102,8 @@ pageflow.Entry = Backbone.Model.extend({
|
|
102
102
|
});
|
103
103
|
},
|
104
104
|
|
105
|
-
getFileCollection: function(
|
106
|
-
return this.files[
|
105
|
+
getFileCollection: function(fileTypeOrFileTypeName) {
|
106
|
+
return this.files[fileTypeOrFileTypeName.collectionName || fileTypeOrFileTypeName];
|
107
107
|
},
|
108
108
|
|
109
109
|
pollForPendingFiles: function() {
|
@@ -56,6 +56,11 @@ pageflow.FileStage = Backbone.Model.extend({
|
|
56
56
|
},
|
57
57
|
|
58
58
|
localizedDescription: function() {
|
59
|
-
|
59
|
+
var prefix = 'pageflow.editor.files.stages.';
|
60
|
+
var suffix = this.get('name') + '.' + this.get('state');
|
61
|
+
|
62
|
+
return I18n.t(prefix + this.file.i18nKey + '.' + suffix, {
|
63
|
+
defaultValue: I18n.t(prefix + suffix)
|
64
|
+
});
|
60
65
|
}
|
61
66
|
});
|
@@ -14,6 +14,15 @@ pageflow.stageProvider = {
|
|
14
14
|
|
15
15
|
return fileStage;
|
16
16
|
}, this).reverse().value());
|
17
|
+
|
18
|
+
this.unfinishedStages = new pageflow.SubsetCollection({
|
19
|
+
parent: this.stages,
|
20
|
+
watchAttribute: 'finished',
|
21
|
+
|
22
|
+
filter: function(stage) {
|
23
|
+
return !stage.get('finished');
|
24
|
+
}
|
25
|
+
});
|
17
26
|
},
|
18
27
|
|
19
28
|
currentStage: function() {
|
@@ -38,11 +38,20 @@ pageflow.transientReferences = {
|
|
38
38
|
|
39
39
|
_setIdOnceSynced: function(attribute, record) {
|
40
40
|
record.once('change:id', function() {
|
41
|
-
|
42
|
-
|
41
|
+
this._onceRecordCanBeFoundInCollection(record, function() {
|
42
|
+
delete this.transientReferences[attribute];
|
43
|
+
this.set(attribute, record.id);
|
44
|
+
});
|
43
45
|
}, this);
|
44
46
|
},
|
45
47
|
|
48
|
+
_onceRecordCanBeFoundInCollection: function(record, callback) {
|
49
|
+
// Backbone collections update their modelsById map in the change
|
50
|
+
// event which is dispatched after the `change:<attribute>`
|
51
|
+
// events.
|
52
|
+
record.once('change', _.bind(callback, this));
|
53
|
+
},
|
54
|
+
|
46
55
|
_listenForReady: function(attribute, record) {
|
47
56
|
if (!record.isReady()) {
|
48
57
|
this.pendingReferences[attribute] = record;
|
@@ -51,6 +60,7 @@ pageflow.transientReferences = {
|
|
51
60
|
if (record.isReady()) {
|
52
61
|
this._cleanUpReadyListener(attribute);
|
53
62
|
this.trigger('change');
|
63
|
+
this.trigger('change:' + attribute + ':ready');
|
54
64
|
}
|
55
65
|
});
|
56
66
|
}
|
@@ -10,6 +10,11 @@ pageflow.PreviewEntryData = pageflow.EntryData.extend({
|
|
10
10
|
return this.entry.getTheme().get(name);
|
11
11
|
},
|
12
12
|
|
13
|
+
getFile: function(collectionName, id) {
|
14
|
+
var file = this.entry.getFileCollection(collectionName).get(id);
|
15
|
+
return file && file.attributes;
|
16
|
+
},
|
17
|
+
|
13
18
|
getStorylineConfiguration: function(id) {
|
14
19
|
var storyline = this.storylines.get(id);
|
15
20
|
return storyline ? storyline.configuration.attributes : {};
|
@@ -38,7 +38,12 @@ pageflow.UploadedFile = Backbone.Model.extend({
|
|
38
38
|
},
|
39
39
|
|
40
40
|
urlRoot: function() {
|
41
|
-
|
41
|
+
if (this.isNew() && this.options.noUpload) {
|
42
|
+
return this.collection.url() + '/empty';
|
43
|
+
}
|
44
|
+
else {
|
45
|
+
return this.collection.url();
|
46
|
+
}
|
42
47
|
},
|
43
48
|
|
44
49
|
fileType: function() {
|
@@ -0,0 +1,26 @@
|
|
1
|
+
<div class="emulation_mode_button-menu">
|
2
|
+
<div class="emulation_mode_button-menu_header">
|
3
|
+
<%= I18n.t('pageflow.editor.templates.emulation_mode_button.header') %>
|
4
|
+
</div>
|
5
|
+
<ul>
|
6
|
+
<li class="emulation_mode_button-menu_item emulation_mode_button-desktop">
|
7
|
+
<a class="emulation_mode_button-menu_link">
|
8
|
+
<%= I18n.t('pageflow.editor.templates.emulation_mode_button.desktop') %>
|
9
|
+
</a>
|
10
|
+
</li>
|
11
|
+
<li class="emulation_mode_button-menu_item emulation_mode_button-phone">
|
12
|
+
<a class="emulation_mode_button-menu_link">
|
13
|
+
<%= I18n.t('pageflow.editor.templates.emulation_mode_button.phone') %>
|
14
|
+
<div class="emulation_mode_button-disabled_hint">
|
15
|
+
<%= I18n.t('pageflow.editor.templates.emulation_mode_button.disabled_hint') %>
|
16
|
+
</div>
|
17
|
+
</a>
|
18
|
+
</li>
|
19
|
+
</ul>
|
20
|
+
</div>
|
21
|
+
<div class="emulation_mode_button-display emulation_mode_button-desktop">
|
22
|
+
<%= I18n.t('pageflow.editor.templates.emulation_mode_button.desktop') %>
|
23
|
+
</div>
|
24
|
+
<div class="emulation_mode_button-display emulation_mode_button-phone">
|
25
|
+
<%= I18n.t('pageflow.editor.templates.emulation_mode_button.phone') %>
|
26
|
+
</div>
|
@@ -1,4 +1,9 @@
|
|
1
|
-
<div class="
|
2
|
-
<div class="
|
1
|
+
<div class="container">
|
2
|
+
<div class="header"></div>
|
3
|
+
<div class="overview"></div>
|
3
4
|
|
4
|
-
<div class="entry"></div>
|
5
|
+
<div class="entry"></div>
|
6
|
+
</div>
|
7
|
+
<div class="navigation_disabled_hint">
|
8
|
+
<%= I18n.t('pageflow.editor.templates.entry_preview.navigation_disabled_hint') %>
|
9
|
+
</div>
|
@@ -7,7 +7,7 @@ pageflow.ConfigurationEditorTabView.groups.define('options', function(options) {
|
|
7
7
|
this.input('emphasize_in_navigation', pageflow.CheckBoxInputView);
|
8
8
|
}
|
9
9
|
|
10
|
-
this.group('page_transitions');
|
10
|
+
this.group('page_transitions', {propertyName: 'transition'});
|
11
11
|
|
12
12
|
if (pageflow.features.isEnabled('delayed_text_fade_in')) {
|
13
13
|
this.input('delayed_text_fade_in', pageflow.SelectInputView, {values: pageflow.Page.delayedTextFadeIn});
|
@@ -1,10 +1,7 @@
|
|
1
1
|
pageflow.ConfigurationEditorTabView.groups.define('page_link', function() {
|
2
2
|
this.input('label', pageflow.TextInputView);
|
3
3
|
this.input('target_page_id', pageflow.PageLinkInputView);
|
4
|
-
this.
|
5
|
-
|
6
|
-
includeBlank: true,
|
7
|
-
blankTranslationKey: 'pageflow.editor.views.edit_page_link_view.default_page_transition',
|
8
|
-
values: pageflow.pageTransitions.names()
|
4
|
+
this.group('page_transitions', {
|
5
|
+
includeBlank: true
|
9
6
|
});
|
10
|
-
});
|
7
|
+
});
|
data/app/assets/javascripts/pageflow/editor/views/configuration_editors/groups/page_transitions.js
CHANGED
@@ -1,6 +1,16 @@
|
|
1
|
-
pageflow.ConfigurationEditorTabView.groups.define('page_transitions', function() {
|
2
|
-
|
1
|
+
pageflow.ConfigurationEditorTabView.groups.define('page_transitions', function(options) {
|
2
|
+
var inputOptions = {
|
3
3
|
translationKeyPrefix: 'pageflow.page_transitions',
|
4
|
+
blankTranslationKey: 'pageflow.page_transitions.default',
|
4
5
|
values: pageflow.pageTransitions.names()
|
5
|
-
}
|
6
|
-
|
6
|
+
};
|
7
|
+
|
8
|
+
if (pageflow.navigationDirection.isHorizontalOnPhone()) {
|
9
|
+
inputOptions.additionalInlineHelpText =
|
10
|
+
I18n.t('pageflow.editor.phone_horizontal_slideshow_mode.page_transitions_inline_help');
|
11
|
+
}
|
12
|
+
|
13
|
+
this.input(options.propertyName || 'page_transition',
|
14
|
+
pageflow.SelectInputView,
|
15
|
+
_.extend(inputOptions, options));
|
16
|
+
});
|
@@ -49,11 +49,8 @@ pageflow.EditStorylineView = Backbone.Marionette.Layout.extend({
|
|
49
49
|
disabled: true,
|
50
50
|
visibleBinding: 'main'
|
51
51
|
});
|
52
|
-
this.
|
53
|
-
|
54
|
-
includeBlank: true,
|
55
|
-
blankTranslationKey: 'pageflow.editor.views.edit_storyline_view.default_parent_page_transition',
|
56
|
-
values: pageflow.pageTransitions.names()
|
52
|
+
this.group('page_transitions', {
|
53
|
+
includeBlank: true
|
57
54
|
});
|
58
55
|
this.input('main', pageflow.CheckBoxInputView, {
|
59
56
|
visibleBinding: 'main',
|
@@ -94,4 +91,4 @@ pageflow.EditStorylineView = Backbone.Marionette.Layout.extend({
|
|
94
91
|
goBack: function() {
|
95
92
|
editor.navigate('/?storyline=' + this.model.id, {trigger: true});
|
96
93
|
}
|
97
|
-
});
|
94
|
+
});
|
data/app/assets/javascripts/pageflow/editor/views/embedded/background_image_embedded_view.js
CHANGED
@@ -9,25 +9,60 @@ pageflow.BackgroundImageEmbeddedView = Backbone.Marionette.View.extend({
|
|
9
9
|
},
|
10
10
|
|
11
11
|
update: function() {
|
12
|
+
if (this.options.useInlineStyles !== false){
|
13
|
+
this.updateInlineStyle();
|
14
|
+
}
|
15
|
+
else {
|
16
|
+
this.updateClassName();
|
17
|
+
}
|
18
|
+
|
19
|
+
if (this.options.dataSizeAttributes) {
|
20
|
+
this.updateDataSizeAttributes();
|
21
|
+
}
|
22
|
+
},
|
23
|
+
|
24
|
+
updateClassName: function() {
|
25
|
+
this.$el.addClass('load_image');
|
26
|
+
|
27
|
+
var propertyName = this.options.propertyName.call ?
|
28
|
+
this.options.propertyName() :
|
29
|
+
this.options.propertyName;
|
30
|
+
var id = this.model.get(propertyName);
|
31
|
+
var prefix = this.options.backgroundImageClassNamePrefix.call ?
|
32
|
+
this.options.backgroundImageClassNamePrefix() :
|
33
|
+
this.options.backgroundImageClassNamePrefix;
|
34
|
+
|
35
|
+
prefix = prefix || 'image';
|
36
|
+
var backgroundImageClassName = id && prefix + '_' + id;
|
37
|
+
|
38
|
+
if (this.currentBackgroundImageClassName !== backgroundImageClassName) {
|
39
|
+
this.$el.removeClass(this.currentBackgroundImageClassName);
|
40
|
+
this.$el.addClass(backgroundImageClassName);
|
41
|
+
|
42
|
+
this.currentBackgroundImageClassName = backgroundImageClassName;
|
43
|
+
}
|
44
|
+
},
|
45
|
+
|
46
|
+
updateInlineStyle: function() {
|
12
47
|
this.$el.css({
|
13
48
|
backgroundImage: this.imageValue(),
|
14
49
|
backgroundPosition: this.model.getFilePosition(this.options.propertyName, 'x') + '% ' +
|
15
50
|
this.model.getFilePosition(this.options.propertyName, 'y') + '%'
|
16
51
|
});
|
52
|
+
},
|
17
53
|
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
}
|
29
|
-
this.$el.css({backgroundPosition:'0 0'});
|
54
|
+
updateDataSizeAttributes: function() {
|
55
|
+
var imageFile = this.model.getImageFile(this.options.propertyName);
|
56
|
+
|
57
|
+
if (imageFile && imageFile.isReady()) {
|
58
|
+
this.$el.attr('data-width', imageFile.get('width'));
|
59
|
+
this.$el.attr('data-height', imageFile.get('height'));
|
60
|
+
}
|
61
|
+
else {
|
62
|
+
this.$el.attr('data-width', '16');
|
63
|
+
this.$el.attr('data-height', '9');
|
30
64
|
}
|
65
|
+
this.$el.css({backgroundPosition:'0 0'});
|
31
66
|
},
|
32
67
|
|
33
68
|
imageValue: function() {
|
@@ -0,0 +1,45 @@
|
|
1
|
+
pageflow.EmulationModeButtonView = Backbone.Marionette.ItemView.extend({
|
2
|
+
template: 'templates/emulation_mode_button',
|
3
|
+
className: 'emulation_mode_button',
|
4
|
+
|
5
|
+
ui: {
|
6
|
+
phoneItem: '.emulation_mode_button-phone',
|
7
|
+
desktopItem: '.emulation_mode_button-desktop',
|
8
|
+
|
9
|
+
phoneDisplay: '.emulation_mode_button-display.emulation_mode_button-phone',
|
10
|
+
desktopDisplay: '.emulation_mode_button-display.emulation_mode_button-desktop'
|
11
|
+
},
|
12
|
+
|
13
|
+
events: {
|
14
|
+
'click .emulation_mode_button-desktop a': function() {
|
15
|
+
this.model.unset('emulation_mode');
|
16
|
+
},
|
17
|
+
|
18
|
+
'click .emulation_mode_button-phone a': function() {
|
19
|
+
if (!this.model.get('current_page_supports_emulation_mode')) {
|
20
|
+
return;
|
21
|
+
}
|
22
|
+
|
23
|
+
this.model.set('emulation_mode', 'phone');
|
24
|
+
}
|
25
|
+
},
|
26
|
+
|
27
|
+
modelEvents: {
|
28
|
+
'change:emulation_mode change:current_page_supports_emulation_mode': 'update'
|
29
|
+
},
|
30
|
+
|
31
|
+
onRender: function() {
|
32
|
+
this.update();
|
33
|
+
},
|
34
|
+
|
35
|
+
update: function() {
|
36
|
+
this.ui.phoneItem.toggleClass('disabled',
|
37
|
+
!this.model.get('current_page_supports_emulation_mode'));
|
38
|
+
|
39
|
+
this.ui.phoneItem.toggleClass('active', this.model.has('emulation_mode'));
|
40
|
+
this.ui.desktopItem.toggleClass('active', !this.model.has('emulation_mode'));
|
41
|
+
|
42
|
+
this.ui.phoneDisplay.toggleClass('active', this.model.has('emulation_mode'));
|
43
|
+
this.ui.desktopDisplay.toggleClass('active', !this.model.has('emulation_mode'));
|
44
|
+
}
|
45
|
+
});
|
@@ -1,11 +1,13 @@
|
|
1
1
|
pageflow.EntryPreviewView = Backbone.Marionette.ItemView.extend({
|
2
2
|
template: 'templates/entry_preview',
|
3
|
-
className: '
|
3
|
+
className: 'entry_preview',
|
4
4
|
|
5
5
|
ui: {
|
6
|
-
|
7
|
-
|
8
|
-
|
6
|
+
container: '> .container',
|
7
|
+
header: '> .container > .header',
|
8
|
+
entry: '> .container > .entry',
|
9
|
+
overview: '> .container > .overview',
|
10
|
+
navigationDisabledHint: '.navigation_disabled_hint'
|
9
11
|
},
|
10
12
|
|
11
13
|
initialize: function() {
|
@@ -31,6 +33,7 @@ pageflow.EntryPreviewView = Backbone.Marionette.ItemView.extend({
|
|
31
33
|
this.listenTo(pageflow.entry, 'change:configuration', function() {
|
32
34
|
pageflow.entry.once('sync', this.update, this);
|
33
35
|
});
|
36
|
+
this.listenTo(pageflow.entry, 'change:emulation_mode', this.updateEmulationMode);
|
34
37
|
|
35
38
|
this.listenTo(pageflow.storylines, 'sync', this.update);
|
36
39
|
this.listenTo(pageflow.chapters, 'sync', this.update);
|
@@ -39,6 +42,23 @@ pageflow.EntryPreviewView = Backbone.Marionette.ItemView.extend({
|
|
39
42
|
this.listenTo(pageflow.audioFiles, 'sync', this.update);
|
40
43
|
this.listenTo(pageflow.imageFiles, 'sync', this.update);
|
41
44
|
this.listenTo(pageflow.videoFiles, 'sync', this.update);
|
45
|
+
|
46
|
+
this.listenTo(pageflow.events, 'page:changing', function(event) {
|
47
|
+
if (pageflow.entry.get('emulation_mode')) {
|
48
|
+
this.ui.navigationDisabledHint.css('opacity', 1);
|
49
|
+
|
50
|
+
clearTimeout(this.navigationDisabledHintTimeout);
|
51
|
+
this.navigationDisabledHintTimeout = setTimeout(_.bind(function() {
|
52
|
+
this.ui.navigationDisabledHint.css('opacity', 0);
|
53
|
+
}, this), 2000);
|
54
|
+
|
55
|
+
event.cancel();
|
56
|
+
}
|
57
|
+
});
|
58
|
+
|
59
|
+
this.listenTo(pageflow.events, 'page:change', function(page) {
|
60
|
+
this.updateEmulationModeSupport(page.getPermaId());
|
61
|
+
});
|
42
62
|
},
|
43
63
|
|
44
64
|
onShow: function() {
|
@@ -57,6 +77,12 @@ pageflow.EntryPreviewView = Backbone.Marionette.ItemView.extend({
|
|
57
77
|
});
|
58
78
|
|
59
79
|
this.listenTo(this.pages, 'edit', function(model) {
|
80
|
+
if (this.lastEditedPage != model) {
|
81
|
+
pageflow.entry.unset('emulation_mode');
|
82
|
+
}
|
83
|
+
|
84
|
+
this.lastEditedPage = model;
|
85
|
+
|
60
86
|
slideshow.goTo(this.pageViews.itemViews.findByModel(model).$el);
|
61
87
|
});
|
62
88
|
|
@@ -65,17 +91,29 @@ pageflow.EntryPreviewView = Backbone.Marionette.ItemView.extend({
|
|
65
91
|
this.updateSimulatedMediaQueryClasses();
|
66
92
|
});
|
67
93
|
|
94
|
+
this.listenTo(pageflow.pages, 'change:template', function() {
|
95
|
+
this.updateEmulationModeSupport(slideshow.currentPagePermaId());
|
96
|
+
});
|
97
|
+
|
68
98
|
this.updateSimulatedMediaQueryClasses();
|
69
99
|
},
|
70
100
|
|
101
|
+
updateEmulationModeSupport: function(permaId) {
|
102
|
+
var model = pageflow.pages.getByPermaId(permaId);
|
103
|
+
|
104
|
+
pageflow.entry.set('current_page_supports_emulation_mode',
|
105
|
+
model && model.pageType().supportsPhoneEmulation());
|
106
|
+
},
|
107
|
+
|
71
108
|
updateSimulatedMediaQueryClasses: function() {
|
72
|
-
var width = this
|
73
|
-
var
|
109
|
+
var width = this.ui.container.width();
|
110
|
+
var height = this.ui.container.height();
|
111
|
+
var portrait = width < height;
|
74
112
|
|
75
113
|
$('html')
|
76
114
|
.toggleClass('simulate_mobile', width <= 900)
|
77
|
-
.toggleClass('simulate_phone', width <=
|
78
|
-
.toggleClass('simulate_desktop', width >
|
115
|
+
.toggleClass('simulate_phone', (portrait && width <= 500) || (!portrait && height <= 500))
|
116
|
+
.toggleClass('simulate_desktop', (portrait && width > 500) || (!portrait && height > 500))
|
79
117
|
.toggleClass('simulate_narrow_desktop', width <= 1200)
|
80
118
|
.toggleClass('simulate_wide_desktop', width > 1600)
|
81
119
|
.toggleClass('simulate_pad_portrait', width <= 768 && portrait)
|
@@ -137,5 +175,21 @@ pageflow.EntryPreviewView = Backbone.Marionette.ItemView.extend({
|
|
137
175
|
return widgets.map(function() {
|
138
176
|
return 'widget_' + $(this).data('widget') + '_present';
|
139
177
|
}).get();
|
178
|
+
},
|
179
|
+
|
180
|
+
updateEmulationMode: function() {
|
181
|
+
if (pageflow.entry.previous('emulation_mode')) {
|
182
|
+
this.$el.removeClass(this.emulationModeClassName(pageflow.entry.previous('emulation_mode')));
|
183
|
+
}
|
184
|
+
|
185
|
+
if (pageflow.entry.get('emulation_mode')) {
|
186
|
+
this.$el.addClass(this.emulationModeClassName(pageflow.entry.get('emulation_mode')));
|
187
|
+
}
|
188
|
+
|
189
|
+
pageflow.app.trigger('resize');
|
190
|
+
},
|
191
|
+
|
192
|
+
emulationModeClassName: function(mode) {
|
193
|
+
return 'emulation_mode_' + mode;
|
140
194
|
}
|
141
195
|
});
|