pageflow 14.0.0.beta1 → 14.0.0.beta2
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 +17 -0
- data/app/assets/javascripts/pageflow/dist/react-client.js +667 -253
- data/app/assets/javascripts/pageflow/dist/react-server.js +663 -249
- data/app/assets/javascripts/pageflow/editor/collections/files_collection.js +2 -1
- data/app/assets/javascripts/pageflow/editor/sync.js +1 -1
- data/app/assets/javascripts/pageflow/page_types/mixins/default_page_content.js +8 -0
- data/app/assets/javascripts/pageflow/ready.js +2 -2
- data/app/assets/javascripts/pageflow/slideshow/dom_order_scroll_navigator.js +6 -4
- data/app/assets/javascripts/pageflow/slideshow.js +1 -1
- data/app/assets/stylesheets/pageflow/overview.scss +2 -2
- data/app/assets/stylesheets/pageflow/themes/default/overview/colors.scss +1 -1
- data/app/assets/stylesheets/pageflow/themes/default/overview/typography.scss +2 -1
- data/app/controllers/pageflow/editor/files_controller.rb +1 -0
- data/app/helpers/pageflow/common_entry_seed_helper.rb +1 -0
- data/app/helpers/pageflow/entries_helper.rb +1 -1
- data/app/helpers/pageflow/entry_json_seed_helper.rb +2 -1
- data/app/helpers/pageflow/meta_tags_helper.rb +6 -1
- data/app/helpers/pageflow/page_background_asset_helper.rb +6 -2
- data/app/helpers/pageflow/react_server_side_rendering_helper.rb +25 -0
- data/app/helpers/pageflow/structured_data_helper.rb +22 -0
- data/app/models/pageflow/draft_entry.rb +2 -0
- data/app/models/pageflow/published_entry.rb +2 -0
- data/app/models/pageflow/revision.rb +6 -1
- data/app/views/pageflow/audio_files/_audio_file.json.jbuilder +2 -0
- data/app/views/pageflow/chapters/_chapter.html.erb +5 -0
- data/app/views/pageflow/entries/_entry.html.erb +3 -2
- data/app/views/pageflow/entries/_multimedia_alert.html.erb +1 -1
- data/app/views/pageflow/entries/overview/_entry.html.erb +3 -3
- data/app/views/pageflow/files/_file.json.jbuilder +1 -0
- data/app/views/pageflow/image_files/_image_file.json.jbuilder +2 -0
- data/app/views/pageflow/page_background_asset/_element.html.erb +3 -3
- data/app/views/pageflow/pages/_page.html.erb +9 -3
- data/app/views/pageflow/react/_widget.html.erb +1 -4
- data/app/views/pageflow/react/page.html.erb +1 -4
- data/app/views/pageflow/structured_data/_entry.json.jbuilder +46 -0
- data/app/views/pageflow/video_files/_video_file.json.jbuilder +2 -1
- data/config/initializers/features.rb +3 -0
- data/config/locales/de.yml +2 -0
- data/config/locales/en.yml +2 -0
- data/lib/pageflow/built_in_file_type.rb +2 -0
- data/lib/pageflow/theme.rb +4 -0
- data/lib/pageflow/version.rb +1 -1
- data/spec/factories/audio_files.rb +7 -1
- data/spec/factories/entries.rb +3 -1
- data/spec/factories/image_files.rb +7 -1
- data/spec/factories/pages.rb +11 -0
- metadata +11 -4
@@ -27,7 +27,8 @@ pageflow.FilesCollection = Backbone.Collection.extend({
|
|
27
27
|
findOrCreateBy: function(attributes) {
|
28
28
|
return this.findWhere(attributes) ||
|
29
29
|
this.create(attributes, {
|
30
|
-
fileType: this.fileType
|
30
|
+
fileType: this.fileType,
|
31
|
+
queryParams: { no_upload: true }
|
31
32
|
});
|
32
33
|
},
|
33
34
|
|
@@ -0,0 +1,8 @@
|
|
1
|
+
pageflow.defaultPageContent = {
|
2
|
+
updateDefaultPageContent: function(pageElement, configuration) {
|
3
|
+
pageElement.find('.page_header-tagline').text(configuration.get('tagline') || '');
|
4
|
+
pageElement.find('.page_header-title').text(configuration.get('title') || '');
|
5
|
+
pageElement.find('.page_header-subtitle').text(configuration.get('subtitle') || '');
|
6
|
+
pageElement.find('.page_text p').html(configuration.get('text') || '');
|
7
|
+
}
|
8
|
+
};
|
@@ -8,13 +8,13 @@ pageflow.ready = new $.Deferred(function(readyDeferred) {
|
|
8
8
|
var slideshow = $('[data-role=slideshow]');
|
9
9
|
var body = $('body');
|
10
10
|
|
11
|
+
pageflow.Visited.setup();
|
12
|
+
|
11
13
|
pagePreloaded.then(function() {
|
12
14
|
readyDeferred.resolve();
|
13
15
|
pageflow.events.trigger('ready');
|
14
16
|
});
|
15
17
|
|
16
|
-
pageflow.Visited.setup();
|
17
|
-
|
18
18
|
slideshow.each(function() {
|
19
19
|
pageflow.events.trigger('seed:loaded');
|
20
20
|
|
@@ -32,7 +32,8 @@ pageflow.DomOrderScrollNavigator = function(slideshow, entryData) {
|
|
32
32
|
};
|
33
33
|
|
34
34
|
this.getNextPage = function(currentPage, pages) {
|
35
|
-
var
|
35
|
+
var currentPageIndex = pages.index(currentPage);
|
36
|
+
var nextPage = currentPageIndex < pages.length - 1 ? $(pages.get(currentPageIndex + 1)) : $();
|
36
37
|
|
37
38
|
if (sameStoryline(currentPage, nextPage)) {
|
38
39
|
return nextPage;
|
@@ -48,7 +49,8 @@ pageflow.DomOrderScrollNavigator = function(slideshow, entryData) {
|
|
48
49
|
};
|
49
50
|
|
50
51
|
this.getPreviousPage = function(currentPage, pages) {
|
51
|
-
var
|
52
|
+
var currentPageIndex = pages.index(currentPage);
|
53
|
+
var previousPage = currentPageIndex > 0 ? $(pages.get(currentPageIndex - 1)) : $();
|
52
54
|
|
53
55
|
if (sameStoryline(currentPage, previousPage)) {
|
54
56
|
return previousPage;
|
@@ -57,8 +59,8 @@ pageflow.DomOrderScrollNavigator = function(slideshow, entryData) {
|
|
57
59
|
return getParentPage(currentPage, pages);
|
58
60
|
};
|
59
61
|
|
60
|
-
this.getTransitionDirection = function(previousPage, currentPage, options) {
|
61
|
-
return (
|
62
|
+
this.getTransitionDirection = function(previousPage, currentPage, pages, options) {
|
63
|
+
return (pages.index(currentPage) > pages.index(previousPage) ? 'forwards' : 'backwards');
|
62
64
|
};
|
63
65
|
|
64
66
|
this.getDefaultTransition = function(previousPage, currentPage, pages) {
|
@@ -113,7 +113,7 @@ pageflow.Slideshow = function($el, configurations) {
|
|
113
113
|
this.scrollNavigator.getDefaultTransition(previousPage, currentPage, pages);
|
114
114
|
|
115
115
|
var direction =
|
116
|
-
this.scrollNavigator.getTransitionDirection(previousPage, currentPage, options);
|
116
|
+
this.scrollNavigator.getTransitionDirection(previousPage, currentPage, pages, options);
|
117
117
|
|
118
118
|
var outDuration = previousPage.page('deactivate', {
|
119
119
|
direction: direction,
|
@@ -19,11 +19,12 @@ $overview-close-button-typography: () !default;
|
|
19
19
|
|
20
20
|
@include standard-typography($overview-typography, ());
|
21
21
|
|
22
|
-
|
22
|
+
.overview_headline {
|
23
23
|
@include typography(
|
24
24
|
$overview-header-typography,
|
25
25
|
(
|
26
26
|
font-size: 3em,
|
27
|
+
font-weight: bold
|
27
28
|
)
|
28
29
|
);
|
29
30
|
}
|
@@ -10,6 +10,7 @@ module Pageflow
|
|
10
10
|
{
|
11
11
|
locale: entry.locale,
|
12
12
|
theming: entry.theming.as_json(only: [:privacy_link_url]),
|
13
|
+
enabled_feature_names: entry.enabled_feature_names,
|
13
14
|
page_types: PageTypesSeed.new(config).as_json,
|
14
15
|
file_url_templates: FileUrlTemplatesSeed.new(config).as_json,
|
15
16
|
file_model_types: config.file_types
|
@@ -53,7 +53,7 @@ module Pageflow
|
|
53
53
|
end
|
54
54
|
|
55
55
|
if links.any?
|
56
|
-
content_tag(:
|
56
|
+
content_tag(:span, I18n.t('pageflow.helpers.entries.global_links'), class: 'hidden') + safe_join(links, ''.html_safe)
|
57
57
|
else
|
58
58
|
''
|
59
59
|
end
|
@@ -1,7 +1,12 @@
|
|
1
1
|
module Pageflow
|
2
|
+
# @api private
|
2
3
|
module MetaTagsHelper
|
3
4
|
def meta_tags_for_entry(entry)
|
4
|
-
render partial: 'pageflow/meta_tags/entry', locals:
|
5
|
+
render partial: 'pageflow/meta_tags/entry', locals: meta_tags_data_for_entry(entry)
|
6
|
+
end
|
7
|
+
|
8
|
+
def meta_tags_data_for_entry(entry)
|
9
|
+
{
|
5
10
|
keywords: entry.keywords.presence || Pageflow.config.default_keywords_meta_tag,
|
6
11
|
author: entry.author.presence || Pageflow.config.default_author_meta_tag,
|
7
12
|
publisher: entry.publisher.presence || Pageflow.config.default_publisher_meta_tag
|
@@ -1,8 +1,12 @@
|
|
1
1
|
module Pageflow
|
2
2
|
module PageBackgroundAssetHelper
|
3
|
-
|
3
|
+
include EntryJsonSeedHelper
|
4
|
+
include ReactServerSideRenderingHelper
|
5
|
+
|
6
|
+
def page_background_asset(page, entry = @entry)
|
4
7
|
render('pageflow/page_background_asset/element',
|
5
|
-
|
8
|
+
entry: entry,
|
9
|
+
page: page)
|
6
10
|
end
|
7
11
|
end
|
8
12
|
end
|
@@ -0,0 +1,25 @@
|
|
1
|
+
module Pageflow
|
2
|
+
# @api private
|
3
|
+
module ReactServerSideRenderingHelper
|
4
|
+
def render_page_react_component(entry, page, component_name)
|
5
|
+
return '' if page.perma_id.blank?
|
6
|
+
extra_props_string = %("pageId": #{page.perma_id}, "pageType": "#{page.template}")
|
7
|
+
render_react_component_with_seed(entry, component_name, extra_props_string)
|
8
|
+
end
|
9
|
+
|
10
|
+
def render_widget_react_component(entry, widget_type_name, component_name)
|
11
|
+
render_react_component_with_seed(entry,
|
12
|
+
component_name,
|
13
|
+
%("widgetTypeName": "#{widget_type_name}"))
|
14
|
+
end
|
15
|
+
|
16
|
+
private
|
17
|
+
|
18
|
+
def render_react_component_with_seed(entry, component_name, extra_props_string)
|
19
|
+
seed = (@_pageflow_react_entry_seed ||= entry_json_seed(entry))
|
20
|
+
props_string = %({ "resolverSeed": #{seed}, #{extra_props_string} })
|
21
|
+
|
22
|
+
::React::ServerRendering.render(component_name, props_string, true)
|
23
|
+
end
|
24
|
+
end
|
25
|
+
end
|
@@ -0,0 +1,22 @@
|
|
1
|
+
module Pageflow
|
2
|
+
# @api private
|
3
|
+
module StructuredDataHelper
|
4
|
+
include RenderJsonHelper
|
5
|
+
include SocialShareHelper
|
6
|
+
include MetaTagsHelper
|
7
|
+
|
8
|
+
def structured_data_for_entry(entry)
|
9
|
+
return '' unless Pageflow.config_for(entry).features.enabled?('structured_data')
|
10
|
+
|
11
|
+
content_tag(:script, type: 'application/ld+json') do
|
12
|
+
render_json_partial('pageflow/structured_data/entry',
|
13
|
+
entry: entry,
|
14
|
+
meta_data: meta_tags_data_for_entry(entry))
|
15
|
+
end
|
16
|
+
end
|
17
|
+
|
18
|
+
def structured_data_normalize_protocol(url)
|
19
|
+
url.gsub(%r{^//}, 'https://')
|
20
|
+
end
|
21
|
+
end
|
22
|
+
end
|
@@ -10,6 +10,7 @@ module Pageflow
|
|
10
10
|
:published_until, :published?,
|
11
11
|
:password_digest,
|
12
12
|
:to_model, :to_key, :persisted?, :to_json,
|
13
|
+
:first_published_at,
|
13
14
|
:to => :entry)
|
14
15
|
|
15
16
|
delegate(:title, :summary, :credits, :manual_start,
|
@@ -23,6 +24,7 @@ module Pageflow
|
|
23
24
|
:locale,
|
24
25
|
:author, :publisher, :keywords,
|
25
26
|
:theme,
|
27
|
+
:published_at,
|
26
28
|
:to => :draft)
|
27
29
|
|
28
30
|
def initialize(entry, draft = nil)
|
@@ -11,6 +11,7 @@ module Pageflow
|
|
11
11
|
:enabled_feature_names,
|
12
12
|
:to_model, :to_key, :persisted?,
|
13
13
|
:authenticate,
|
14
|
+
:first_published_at,
|
14
15
|
:to => :entry)
|
15
16
|
|
16
17
|
delegate(:widgets,
|
@@ -25,6 +26,7 @@ module Pageflow
|
|
25
26
|
:author, :publisher, :keywords,
|
26
27
|
:theme,
|
27
28
|
:password_protected?,
|
29
|
+
:published_at,
|
28
30
|
:to => :revision)
|
29
31
|
|
30
32
|
def initialize(entry, revision = nil)
|
@@ -6,6 +6,11 @@ module Pageflow
|
|
6
6
|
'pageflow_pages.position ASC'
|
7
7
|
].join(',')
|
8
8
|
|
9
|
+
CHAPTER_ORDER = [
|
10
|
+
'pageflow_storylines.position ASC',
|
11
|
+
'pageflow_chapters.position ASC'
|
12
|
+
].join(',')
|
13
|
+
|
9
14
|
include ThemeReferencer
|
10
15
|
|
11
16
|
belongs_to :entry, touch: :edited_at
|
@@ -15,7 +20,7 @@ module Pageflow
|
|
15
20
|
has_many :widgets, as: :subject, dependent: :destroy
|
16
21
|
|
17
22
|
has_many :storylines, -> { order('pageflow_storylines.position ASC') }, dependent: :destroy
|
18
|
-
has_many :chapters, -> { order(
|
23
|
+
has_many :chapters, -> { order(CHAPTER_ORDER) }, through: :storylines
|
19
24
|
has_many :pages, -> { reorder(PAGE_ORDER) }, through: :storylines
|
20
25
|
|
21
26
|
has_many :file_usages, dependent: :destroy
|
@@ -2,16 +2,17 @@
|
|
2
2
|
id: 'outer_wrapper',
|
3
3
|
data: {theme: entry.theme.name},
|
4
4
|
class: entry_css_class(entry)) do %>
|
5
|
+
<%= structured_data_for_entry(entry) %>
|
5
6
|
|
6
7
|
<%= render 'pageflow/entries/skip_links' %>
|
7
8
|
|
8
9
|
<h1 class="hidden"><%= entry.title %></h1>
|
9
10
|
|
10
|
-
<img src="<%= image_path(
|
11
|
+
<img src="<%= image_path(entry.theme.print_logo_path) %>" class="print_image" alt="<%= t('pageflow.public.logo') %>">
|
11
12
|
<span class="print_only page_url"><%= request.original_url %></span>
|
12
13
|
|
13
14
|
<%= content_tag :div, :id => 'content', :class => 'entry', :data => {:role => 'slideshow'} do %>
|
14
|
-
<%= render entry.
|
15
|
+
<%= render entry.chapters, entry: entry %>
|
15
16
|
<%= render 'pageflow/entries/indicators', :theme => entry.theme %>
|
16
17
|
<% end %>
|
17
18
|
|
@@ -1,7 +1,7 @@
|
|
1
1
|
<div class="multimedia_alert">
|
2
2
|
<div class="multimedia_alert_box">
|
3
3
|
<div class="alert_block">
|
4
|
-
<
|
4
|
+
<div class="alert_headline"><%= t('pageflow.public.notice') %></div>
|
5
5
|
<div class="alert_icon speaker"></div>
|
6
6
|
<p>
|
7
7
|
<%= t('pageflow.public.sound_hint') %>
|
@@ -1,9 +1,9 @@
|
|
1
|
-
<
|
1
|
+
<div class="overview">
|
2
2
|
<div class="content">
|
3
3
|
<a class="close button">
|
4
4
|
<span class="label"><%= t('pageflow.public.close') %></span>
|
5
5
|
</a>
|
6
|
-
<
|
6
|
+
<div class="overview_headline"><%= t('pageflow.public.overview') %></div>
|
7
7
|
|
8
8
|
<a class="overview_scroll_indicator left button"
|
9
9
|
tabindex="1"
|
@@ -25,4 +25,4 @@
|
|
25
25
|
<span class="hint"><%= t('pageflow.public.scroll_right') %></span>
|
26
26
|
</a>
|
27
27
|
</div>
|
28
|
-
</
|
28
|
+
</div>
|
@@ -1,3 +1,3 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
|
1
|
+
<%= content_tag(:div, class: 'page_background_asset', style: 'height: 100%;') do -%>
|
2
|
+
<% concat render_page_react_component(entry, page, 'pageflow.react.ServerSidePageBackgroundAsset') %>
|
3
|
+
<% end %>
|
@@ -1,6 +1,12 @@
|
|
1
1
|
<%= cache page do %>
|
2
|
-
<%= content_tag
|
3
|
-
|
4
|
-
|
2
|
+
<%= content_tag(:section,
|
3
|
+
id: page.perma_id,
|
4
|
+
class: page_css_class(page),
|
5
|
+
data: {
|
6
|
+
template: page.template,
|
7
|
+
id: page.id, chapter_id: page.chapter_id
|
8
|
+
}) do -%>
|
9
|
+
<% concat(render_page_template(page, entry: entry)) -%>
|
5
10
|
<% end %>
|
11
|
+
<a class="to_top" href="#content"><%= t('pageflow.public.goto_top') %></a>
|
6
12
|
<% end %>
|
@@ -1,8 +1,5 @@
|
|
1
1
|
<%= content_tag(:div, '', data: {widget: name}) do -%>
|
2
2
|
<% if server_rendering -%>
|
3
|
-
<% concat
|
4
|
-
'pageflow.react.ServerSideWidget',
|
5
|
-
%Q'{ "resolverSeed": #{@_pageflow_react_entry_seed ||= entry_json_seed(entry)}, "widgetTypeName": "#{name}" }',
|
6
|
-
true) %>
|
3
|
+
<% concat render_widget_react_component(entry, name, 'pageflow.react.ServerSideWidget') %>
|
7
4
|
<% end %>
|
8
5
|
<% end %>
|
@@ -1,6 +1,3 @@
|
|
1
1
|
<% if page.template.present? %>
|
2
|
-
<% concat
|
3
|
-
'pageflow.react.ServerSidePage',
|
4
|
-
%Q'{ "resolverSeed": #{@_pageflow_react_entry_seed ||= entry_json_seed(entry)}, "pageId": #{page.perma_id}, "pageType": "#{page.template}" }',
|
5
|
-
true) %>
|
2
|
+
<% concat render_page_react_component(entry, page, 'pageflow.react.ServerSidePage') %>
|
6
3
|
<% end %>
|
@@ -0,0 +1,46 @@
|
|
1
|
+
json.key_format!(camelize: :lower)
|
2
|
+
|
3
|
+
json.set! '@context', 'http://schema.org'
|
4
|
+
json.set! '@type', 'Article'
|
5
|
+
|
6
|
+
json.headline pretty_entry_title(entry)
|
7
|
+
json.description social_share_entry_description(entry)
|
8
|
+
|
9
|
+
json.keywords(meta_data[:keywords]) if meta_data[:keywords].present?
|
10
|
+
|
11
|
+
if meta_data[:author].present?
|
12
|
+
json.author do
|
13
|
+
json.set! '@type', 'Organization'
|
14
|
+
json.name meta_data[:author]
|
15
|
+
end
|
16
|
+
end
|
17
|
+
|
18
|
+
if meta_data[:publisher].present?
|
19
|
+
json.publisher do
|
20
|
+
json.set! '@type', 'Organization'
|
21
|
+
json.name meta_data[:publisher]
|
22
|
+
json.logo do
|
23
|
+
json.set! '@type', 'ImageObject'
|
24
|
+
json.url structured_data_normalize_protocol(asset_url(entry.theme.print_logo_path))
|
25
|
+
end
|
26
|
+
end
|
27
|
+
end
|
28
|
+
|
29
|
+
json.date_published entry.first_published_at.try(:iso8601, 0)
|
30
|
+
json.date_modified entry.published_at.try(:iso8601, 0)
|
31
|
+
|
32
|
+
json.main_entity_of_page do
|
33
|
+
json.set! '@type', 'WebPage'
|
34
|
+
json.set! '@id', structured_data_normalize_protocol(social_share_entry_url(entry))
|
35
|
+
end
|
36
|
+
|
37
|
+
thumbnail_file = entry.thumbnail_file
|
38
|
+
|
39
|
+
if thumbnail_file.present?
|
40
|
+
json.image do
|
41
|
+
json.set! '@type', 'ImageObject'
|
42
|
+
json.url structured_data_normalize_protocol(thumbnail_file.thumbnail_url(:thumbnail_large))
|
43
|
+
json.width 560
|
44
|
+
json.height 315
|
45
|
+
end
|
46
|
+
end
|
@@ -8,4 +8,7 @@ Pageflow.configure do |config|
|
|
8
8
|
config.features.register('selectable_themes')
|
9
9
|
config.features.register('editor_emulation_mode')
|
10
10
|
config.features.register('waveform_player_controls')
|
11
|
+
config.features.register('structured_data')
|
12
|
+
|
13
|
+
config.features.enable_by_default('structured_data')
|
11
14
|
end
|
data/config/locales/de.yml
CHANGED
@@ -1765,6 +1765,8 @@ de:
|
|
1765
1765
|
feature_name: Erzählstränge
|
1766
1766
|
main: Hauptstrang
|
1767
1767
|
untitled: Unbenannter Erzählstrang
|
1768
|
+
structured_data:
|
1769
|
+
feature_name: Eingebettete strukturierte Daten
|
1768
1770
|
title_loading_spinner:
|
1769
1771
|
feature_name: "'Titel und Bild'-Lade-Ansicht"
|
1770
1772
|
widget_type_name: Titel und Bild
|
data/config/locales/en.yml
CHANGED
@@ -1737,6 +1737,8 @@ en:
|
|
1737
1737
|
feature_name: Storylines
|
1738
1738
|
main: Main storyline
|
1739
1739
|
untitled: Unnamed storyline
|
1740
|
+
structured_data:
|
1741
|
+
feature_name: Embedded structured data
|
1740
1742
|
title_loading_spinner:
|
1741
1743
|
feature_name: "'Title and image' loading view"
|
1742
1744
|
widget_type_name: Title and Image
|
@@ -5,6 +5,7 @@ module Pageflow
|
|
5
5
|
# available as built-ins.
|
6
6
|
def self.image
|
7
7
|
FileType.new(model: 'Pageflow::ImageFile',
|
8
|
+
partial: 'pageflow/image_files/image_file',
|
8
9
|
editor_partial: 'pageflow/editor/image_files/image_file',
|
9
10
|
collection_name: 'image_files',
|
10
11
|
url_templates: ImageFileUrlTemplates.new,
|
@@ -27,6 +28,7 @@ module Pageflow
|
|
27
28
|
|
28
29
|
def self.audio
|
29
30
|
FileType.new(model: 'Pageflow::AudioFile',
|
31
|
+
partial: 'pageflow/audio_files/audio_file',
|
30
32
|
editor_partial: 'pageflow/editor/audio_files/audio_file',
|
31
33
|
collection_name: 'audio_files',
|
32
34
|
url_templates: AudioFileUrlTemplates.new,
|
data/lib/pageflow/theme.rb
CHANGED
data/lib/pageflow/version.rb
CHANGED
@@ -9,6 +9,7 @@ module Pageflow
|
|
9
9
|
|
10
10
|
transient do
|
11
11
|
used_in { nil }
|
12
|
+
with_configuration { nil }
|
12
13
|
end
|
13
14
|
|
14
15
|
before(:create) do |file, evaluator|
|
@@ -16,7 +17,12 @@ module Pageflow
|
|
16
17
|
end
|
17
18
|
|
18
19
|
after(:create) do |file, evaluator|
|
19
|
-
|
20
|
+
if evaluator.used_in
|
21
|
+
create(:file_usage,
|
22
|
+
file: file,
|
23
|
+
revision: evaluator.used_in,
|
24
|
+
configuration: evaluator.with_configuration)
|
25
|
+
end
|
20
26
|
end
|
21
27
|
|
22
28
|
trait :uploading do
|
data/spec/factories/entries.rb
CHANGED
@@ -20,6 +20,7 @@ module Pageflow
|
|
20
20
|
with_manager { nil }
|
21
21
|
|
22
22
|
with_feature { nil }
|
23
|
+
without_feature { nil }
|
23
24
|
end
|
24
25
|
|
25
26
|
after(:create) do |entry, evaluator|
|
@@ -43,7 +44,8 @@ module Pageflow
|
|
43
44
|
|
44
45
|
after(:build) do |entry, evaluator|
|
45
46
|
entry.features_configuration =
|
46
|
-
entry.features_configuration.merge(evaluator.with_feature => true
|
47
|
+
entry.features_configuration.merge(evaluator.with_feature => true,
|
48
|
+
evaluator.without_feature => false)
|
47
49
|
end
|
48
50
|
|
49
51
|
trait :published do
|
@@ -9,6 +9,7 @@ module Pageflow
|
|
9
9
|
|
10
10
|
transient do
|
11
11
|
used_in { nil }
|
12
|
+
with_configuration { nil }
|
12
13
|
end
|
13
14
|
|
14
15
|
before(:create) do |file, evaluator|
|
@@ -16,7 +17,12 @@ module Pageflow
|
|
16
17
|
end
|
17
18
|
|
18
19
|
after(:create) do |file, evaluator|
|
19
|
-
|
20
|
+
if evaluator.used_in
|
21
|
+
create(:file_usage,
|
22
|
+
file: file,
|
23
|
+
revision: evaluator.used_in,
|
24
|
+
configuration: evaluator.with_configuration)
|
25
|
+
end
|
20
26
|
end
|
21
27
|
|
22
28
|
trait :uploading do
|
data/spec/factories/pages.rb
CHANGED
@@ -4,6 +4,17 @@ module Pageflow
|
|
4
4
|
chapter
|
5
5
|
template { 'background_image' }
|
6
6
|
configuration { {} }
|
7
|
+
|
8
|
+
transient do
|
9
|
+
revision { nil }
|
10
|
+
end
|
11
|
+
|
12
|
+
before(:create) do |page, evaluator|
|
13
|
+
if evaluator.revision
|
14
|
+
storyline = create(:storyline, revision: evaluator.revision)
|
15
|
+
page.chapter = create(:chapter, storyline: storyline)
|
16
|
+
end
|
17
|
+
end
|
7
18
|
end
|
8
19
|
|
9
20
|
factory :valid_page, :class => Page do
|