pageflow 0.9.2 → 0.10.0
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 +5 -13
- data/CHANGELOG.md +193 -11
- data/README.md +9 -1
- data/Rakefile +5 -0
- data/admins/pageflow/accounts.rb +2 -1
- data/admins/pageflow/entry.rb +21 -1
- data/admins/pageflow/revisions.rb +1 -1
- data/app/assets/fonts/pageflow/entypo-license.txt +358 -0
- data/app/assets/fonts/pageflow/fontawesome-license.txt +1 -0
- data/app/assets/fonts/pageflow/sourcesanspro-bold-webfont.eot +0 -0
- data/app/assets/fonts/pageflow/sourcesanspro-bold-webfont.svg +1236 -194
- data/app/assets/fonts/pageflow/sourcesanspro-bold-webfont.ttf +0 -0
- data/app/assets/fonts/pageflow/sourcesanspro-bold-webfont.woff +0 -0
- data/app/assets/fonts/pageflow/sourcesanspro-license.txt +93 -0
- data/app/assets/fonts/pageflow/sourcesanspro-light-webfont.eot +0 -0
- data/app/assets/fonts/pageflow/sourcesanspro-light-webfont.svg +1153 -839
- data/app/assets/fonts/pageflow/sourcesanspro-light-webfont.ttf +0 -0
- data/app/assets/fonts/pageflow/sourcesanspro-light-webfont.woff +0 -0
- data/app/assets/fonts/pageflow/sourcesanspro-regular-webfont.eot +0 -0
- data/app/assets/fonts/pageflow/sourcesanspro-regular-webfont.svg +1252 -199
- data/app/assets/fonts/pageflow/sourcesanspro-regular-webfont.ttf +0 -0
- data/app/assets/fonts/pageflow/sourcesanspro-regular-webfont.woff +0 -0
- data/app/assets/javascripts/pageflow/base.js +2 -0
- data/app/assets/javascripts/pageflow/browser/agent.js +25 -0
- data/app/assets/javascripts/pageflow/browser/css_animations.js +18 -0
- data/app/assets/javascripts/pageflow/browser/mobile_platform.js +1 -4
- data/app/assets/javascripts/pageflow/browser/video.js +8 -1
- data/app/assets/javascripts/pageflow/chapter_filter.js +6 -16
- data/app/assets/javascripts/pageflow/editor/api.js +6 -2
- data/app/assets/javascripts/pageflow/editor/api/page_type.js +12 -0
- data/app/assets/javascripts/pageflow/editor/base.js +4 -0
- data/app/assets/javascripts/pageflow/editor/collections/chapter_pages_collection.js +4 -1
- data/app/assets/javascripts/pageflow/editor/collections/chapters_collection.js +1 -5
- data/app/assets/javascripts/pageflow/editor/collections/mixins/add_and_return_model.js +11 -0
- data/app/assets/javascripts/pageflow/editor/collections/mixins/ordered_collection.js +6 -4
- data/app/assets/javascripts/pageflow/editor/collections/ordered_page_links_collection.js +9 -0
- data/app/assets/javascripts/pageflow/editor/collections/page_links_collection.js +78 -0
- data/app/assets/javascripts/pageflow/editor/collections/pages_collection.js +9 -3
- data/app/assets/javascripts/pageflow/editor/collections/storyline_chapters_collection.js +35 -0
- data/app/assets/javascripts/pageflow/editor/collections/storylines_collection.js +33 -0
- data/app/assets/javascripts/pageflow/editor/controllers/sidebar_controller.js +19 -2
- data/app/assets/javascripts/pageflow/editor/initializers/edit_lock.js +1 -1
- data/app/assets/javascripts/pageflow/editor/initializers/setup_collections.js +11 -0
- data/app/assets/javascripts/pageflow/editor/initializers/setup_common_seed.js +3 -0
- data/app/assets/javascripts/pageflow/editor/initializers/stylesheet_reloading.js +11 -0
- data/app/assets/javascripts/pageflow/editor/models/chapter.js +14 -7
- data/app/assets/javascripts/pageflow/editor/models/chapter_scaffold.js +13 -0
- data/app/assets/javascripts/pageflow/editor/models/edit_lock_container.js +4 -4
- data/app/assets/javascripts/pageflow/editor/models/entry.js +33 -4
- data/app/assets/javascripts/pageflow/editor/models/mixins/persited_promise.js +18 -0
- data/app/assets/javascripts/pageflow/editor/models/page.js +4 -0
- data/app/assets/javascripts/pageflow/editor/models/page_link.js +37 -0
- data/app/assets/javascripts/pageflow/editor/models/page_link_file_selection_handler.js +14 -0
- data/app/assets/javascripts/pageflow/editor/models/preview_entry_data.js +15 -0
- data/app/assets/javascripts/pageflow/editor/models/scaffold.js +26 -0
- data/app/assets/javascripts/pageflow/editor/models/storyline.js +99 -0
- data/app/assets/javascripts/pageflow/editor/models/storyline_configuration.js +15 -0
- data/app/assets/javascripts/pageflow/editor/models/storyline_ordering.js +117 -0
- data/app/assets/javascripts/pageflow/editor/models/storyline_scaffold.js +23 -0
- data/app/assets/javascripts/pageflow/editor/models/storyline_transitive_child_pages.js +33 -0
- data/app/assets/javascripts/pageflow/editor/routers/sidebar_router.js +3 -0
- data/app/assets/javascripts/pageflow/editor/templates/edit_entry.jst.ejs +1 -6
- data/app/assets/javascripts/pageflow/editor/templates/edit_page_link.jst.ejs +3 -0
- data/app/assets/javascripts/pageflow/editor/templates/edit_storyline.jst.ejs +12 -0
- data/app/assets/javascripts/pageflow/editor/templates/page_link_item.jst.ejs +1 -0
- data/app/assets/javascripts/pageflow/editor/templates/page_selection.jst.ejs +2 -2
- data/app/assets/javascripts/pageflow/editor/templates/storyline_outline.jst.ejs +4 -0
- data/app/assets/javascripts/pageflow/editor/templates/storyline_picker.jst.ejs +7 -0
- data/app/assets/javascripts/pageflow/editor/utils/reload_stylesheet.js +9 -0
- data/app/assets/javascripts/pageflow/editor/views/configuration_editors/groups/options.js +2 -2
- data/app/assets/javascripts/pageflow/editor/views/configuration_editors/groups/page_link.js +10 -0
- data/app/assets/javascripts/pageflow/editor/views/edit_chapter_view.js +0 -4
- data/app/assets/javascripts/pageflow/editor/views/edit_entry_view.js +9 -15
- data/app/assets/javascripts/pageflow/editor/views/edit_meta_data_view.js +14 -6
- data/app/assets/javascripts/pageflow/editor/views/edit_page_link_view.js +47 -0
- data/app/assets/javascripts/pageflow/editor/views/edit_storyline_view.js +97 -0
- data/app/assets/javascripts/pageflow/editor/views/editor_view.js +6 -3
- data/app/assets/javascripts/pageflow/editor/views/entry_preview_view.js +13 -7
- data/app/assets/javascripts/pageflow/editor/views/file_item_view.js +1 -1
- data/app/assets/javascripts/pageflow/editor/views/inputs/page_link_input_view.js +3 -1
- data/app/assets/javascripts/pageflow/editor/views/locked_view.js +3 -3
- data/app/assets/javascripts/pageflow/editor/views/mixins/loadable.js +1 -1
- data/app/assets/javascripts/pageflow/editor/views/page_item_view.js +2 -0
- data/app/assets/javascripts/pageflow/editor/views/page_link_configuration_editor_view.js +7 -0
- data/app/assets/javascripts/pageflow/editor/views/page_link_item_view.js +8 -1
- data/app/assets/javascripts/pageflow/editor/views/page_preview_view.js +1 -1
- data/app/assets/javascripts/pageflow/editor/views/page_selection_view.js +13 -12
- data/app/assets/javascripts/pageflow/editor/views/storyline_outline_view.js +33 -0
- data/app/assets/javascripts/pageflow/editor/views/storyline_picker_view.js +114 -0
- data/app/assets/javascripts/pageflow/entry_data.js +38 -4
- data/app/assets/javascripts/pageflow/highlighted_page.js +5 -5
- data/app/assets/javascripts/pageflow/history.js +1 -1
- data/app/assets/javascripts/pageflow/native_scrolling.js +14 -0
- data/app/assets/javascripts/pageflow/page_transitions.js +3 -1
- data/app/assets/javascripts/pageflow/page_type.js +2 -0
- data/app/assets/javascripts/pageflow/ready.js +4 -1
- data/app/assets/javascripts/pageflow/seed_entry_data.js +28 -1
- data/app/assets/javascripts/pageflow/slideshow.js +11 -8
- data/app/assets/javascripts/pageflow/slideshow/dom_order_scroll_navigator.js +93 -8
- data/app/assets/javascripts/pageflow/slideshow/hidden_text_indicator_widget.js +5 -3
- data/app/assets/javascripts/pageflow/slideshow/lazy_page_widget.js +4 -0
- data/app/assets/javascripts/pageflow/slideshow/page_widget.js +15 -6
- data/app/assets/javascripts/pageflow/ui/templates/tooltip.jst.ejs +2 -0
- data/app/assets/javascripts/pageflow/ui/views/inputs/text_area_input_view.js +17 -4
- data/app/assets/javascripts/pageflow/ui/views/mixins/tooltip_container.js +42 -0
- data/app/assets/javascripts/pageflow/ui/views/tooltip_view.js +49 -0
- data/app/assets/javascripts/pageflow/video_player.js +2 -2
- data/app/assets/javascripts/pageflow/video_player/{filter_for_silk.js → filter_sources.js} +2 -2
- data/app/assets/javascripts/pageflow/widgets/navigation.js +17 -14
- data/app/assets/javascripts/pageflow/widgets/navigation_mobile.js +7 -2
- data/app/assets/javascripts/pageflow/widgets/overview.js +9 -6
- data/app/assets/javascripts/pageflow/widgets/page_navigation_list.js +51 -13
- data/app/assets/javascripts/pageflow/widgets/page_navigation_list_animation.js +48 -0
- data/app/assets/javascripts/pageflow/widgets/parent_page_button.js +9 -2
- data/app/assets/stylesheets/pageflow/admin.css.scss +2 -15
- data/app/assets/stylesheets/pageflow/admin/features.scss +5 -0
- data/app/assets/stylesheets/pageflow/admin/forms.scss +18 -0
- data/app/assets/stylesheets/pageflow/animations.css.scss +1 -0
- data/app/assets/stylesheets/pageflow/animations/navigation_bar.scss +89 -0
- data/app/assets/stylesheets/pageflow/delayed_text_fade_in.css.scss +1 -1
- data/app/assets/stylesheets/pageflow/editor/base.css.scss +5 -0
- data/app/assets/stylesheets/pageflow/editor/menu.css.scss +1 -0
- data/app/assets/stylesheets/pageflow/editor/outline.css.scss +5 -0
- data/app/assets/stylesheets/pageflow/editor/page_links.css.scss +9 -1
- data/app/assets/stylesheets/pageflow/editor/page_selection.css.scss +7 -1
- data/app/assets/stylesheets/pageflow/editor/storyline_picker.css.scss +32 -0
- data/app/assets/stylesheets/pageflow/extendables.scss +26 -0
- data/app/assets/stylesheets/pageflow/mixins/pageflow.css.scss +25 -0
- data/app/assets/stylesheets/pageflow/navigation_bar.css.scss +64 -4
- data/app/assets/stylesheets/pageflow/navigation_mobile.css.scss +56 -0
- data/app/assets/stylesheets/pageflow/page_transitions.css.scss +4 -1
- data/app/assets/stylesheets/pageflow/page_transitions/scroll_over_from_left.scss +12 -0
- data/app/assets/stylesheets/pageflow/page_transitions/scroll_over_from_right.scss +12 -0
- data/app/assets/stylesheets/pageflow/page_types/video.css.scss +5 -1
- data/app/assets/stylesheets/pageflow/themes/default/page.css.scss +180 -42
- data/app/assets/stylesheets/pageflow/ui.css.scss +1 -0
- data/app/assets/stylesheets/pageflow/ui/forms.css.scss +11 -2
- data/app/assets/stylesheets/pageflow/ui/input/extended_select_input.css.scss +1 -0
- data/app/assets/stylesheets/pageflow/ui/tabs_view.css.scss +0 -3
- data/app/assets/stylesheets/pageflow/ui/tooltip.scss +57 -0
- data/app/controllers/concerns/pageflow/entry_password_protection.rb +13 -0
- data/app/controllers/pageflow/chapters_controller.rb +24 -9
- data/app/controllers/pageflow/edit_locks_controller.rb +2 -2
- data/app/controllers/pageflow/editor/files_controller.rb +0 -2
- data/app/controllers/pageflow/editor/widgets_controller.rb +1 -1
- data/app/controllers/pageflow/entries_controller.rb +5 -9
- data/app/controllers/pageflow/files_controller.rb +3 -0
- data/app/controllers/pageflow/storylines_controller.rb +69 -0
- data/app/helpers/pageflow/admin/features_helper.rb +17 -6
- data/app/helpers/pageflow/admin/widgets_helper.rb +18 -0
- data/app/helpers/pageflow/audio_files_helper.rb +2 -2
- data/app/helpers/pageflow/common_entry_seed_helper.rb +52 -0
- data/app/helpers/pageflow/entries_helper.rb +7 -1
- data/app/helpers/pageflow/entry_json_seed_helper.rb +27 -10
- data/app/helpers/pageflow/meta_tags_helper.rb +11 -0
- data/app/helpers/pageflow/page_types_helper.rb +9 -5
- data/app/helpers/pageflow/pages_helper.rb +9 -96
- data/app/helpers/pageflow/public_i18n_helper.rb +13 -0
- data/app/helpers/pageflow/social_share_helper.rb +1 -1
- data/app/helpers/pageflow/video_files_helper.rb +133 -0
- data/app/helpers/pageflow/widgets_helper.rb +3 -9
- data/app/models/concerns/pageflow/feature_target.rb +21 -3
- data/app/models/concerns/pageflow/hosted_file.rb +4 -0
- data/app/models/pageflow/account.rb +2 -2
- data/app/models/pageflow/chapter.rb +4 -4
- data/app/models/pageflow/chapter_scaffold.rb +33 -0
- data/app/models/pageflow/cname_theming_request_scope.rb +7 -1
- data/app/models/pageflow/draft_entry.rb +13 -2
- data/app/models/pageflow/edit_lock.rb +2 -2
- data/app/models/pageflow/entry.rb +3 -2
- data/app/models/pageflow/image_file.rb +6 -0
- data/app/models/pageflow/published_entry.rb +13 -2
- data/app/models/pageflow/revision.rb +17 -4
- data/app/models/pageflow/storyline.rb +23 -0
- data/app/models/pageflow/storyline_scaffold.rb +27 -0
- data/app/models/pageflow/theming.rb +4 -0
- data/app/models/pageflow/widget.rb +16 -12
- data/app/views/admin/accounts/_form.html.erb +8 -12
- data/app/views/admin/accounts/_widgets_inline_help.html.erb +5 -0
- data/app/views/layouts/pageflow/application.html.erb +4 -1
- data/app/views/pageflow/admin/widgets/_fields.html.erb +9 -0
- data/app/views/pageflow/config/_editor_seeds.json.jbuilder +1 -1
- data/app/views/pageflow/editor/entries/_entry.json.jbuilder +2 -2
- data/app/views/pageflow/editor/entries/_other_entry.json.jbuilder +1 -0
- data/app/views/pageflow/editor/entries/index.json.jbuilder +1 -1
- data/app/views/pageflow/editor/entries/seed.json.erb +4 -1
- data/app/views/pageflow/editor/files/_file.json.jbuilder +4 -0
- data/app/views/pageflow/editor/themings/_theming.json.jbuilder +1 -0
- data/app/views/pageflow/entries/_entry.html.erb +2 -2
- data/app/views/pageflow/entries/_ie8_hint.html.erb +2 -2
- data/app/views/pageflow/entries/_indicators.html.erb +3 -3
- data/app/views/pageflow/entries/_mobile_navigation.html.erb +6 -5
- data/app/views/pageflow/entries/_multimedia_alert.html.erb +6 -6
- data/app/views/pageflow/entries/_non_js_hint.html.erb +1 -1
- data/app/views/pageflow/entries/_skip_links.html.erb +3 -3
- data/app/views/pageflow/entries/edit.html.erb +4 -2
- data/app/views/pageflow/entries/navigation/_bar_bottom.html.erb +6 -5
- data/app/views/pageflow/entries/navigation/_bar_top.html.erb +13 -13
- data/app/views/pageflow/entries/navigation/_home_button.html.erb +2 -2
- data/app/views/pageflow/entries/navigation/_page.html.erb +1 -1
- data/app/views/pageflow/entries/overview/_chapter.html.erb +1 -1
- data/app/views/pageflow/entries/overview/_entry.html.erb +7 -6
- data/app/views/pageflow/entries/share_menu/_facebook_link.html.erb +1 -1
- data/app/views/pageflow/entries/share_menu/_google_link.html.erb +1 -1
- data/app/views/pageflow/entries/share_menu/_twitter_link.html.erb +1 -1
- data/app/views/pageflow/entries/show.html.erb +4 -1
- data/app/views/pageflow/file_types/_thumbnails.css.erb +2 -0
- data/app/views/pageflow/meta_tags/_entry.html.erb +4 -0
- data/app/views/pageflow/pages/_page.html.erb +2 -2
- data/app/views/pageflow/pages/templates/_audio.html.erb +2 -2
- data/app/views/pageflow/pages/templates/_audio_loop.html.erb +1 -1
- data/app/views/pageflow/pages/templates/_background_video.html.erb +8 -3
- data/app/views/pageflow/pages/templates/_video.html.erb +9 -4
- data/app/views/pageflow/public_i18n/_javascript_tag.html.erb +5 -0
- data/app/views/pageflow/social_share/_entry_meta_tags.html.erb +1 -1
- data/app/views/pageflow/video_files/_script_tag.html.erb +3 -0
- data/app/views/pageflow/video_files/_video_file.html.erb +4 -1
- data/app/views/pageflow/video_files/_video_tag.html.erb +7 -0
- data/config/initializers/admin_resource_tabs.rb +1 -0
- data/config/initializers/features.rb +3 -1
- data/config/initializers/paperclip.rb +5 -0
- data/config/locales/de.yml +205 -601
- data/config/locales/en.yml +198 -405
- data/config/routes.rb +10 -2
- data/db/migrate/20150826125417_create_pageflow_storylines.rb +12 -0
- data/db/migrate/20150826125744_add_storyline_id_to_chapters.rb +6 -0
- data/db/migrate/20150826125745_insert_main_storylines.rb +28 -0
- data/db/migrate/20150830105831_remove_revision_id_from_chapters.rb +5 -0
- data/db/migrate/20150830110006_remove_entry_id_from_chapters.rb +5 -0
- data/db/migrate/20160201130118_add_additional_cnames_to_themings.rb +5 -0
- data/db/migrate/20160216130336_add_meta_fields_to_revision.rb +7 -0
- data/lib/generators/pageflow/initializer/templates/pageflow.rb +7 -0
- data/lib/pageflow/ability_mixin.rb +7 -1
- data/lib/pageflow/configuration.rb +27 -2
- data/lib/pageflow/engine.rb +4 -1
- data/lib/pageflow/features.rb +24 -0
- data/lib/pageflow/global_config_api.rb +1 -0
- data/lib/pageflow/seeds.rb +4 -2
- data/lib/pageflow/theme.rb +4 -0
- data/lib/pageflow/version.rb +1 -1
- data/spec/factories/chapters.rb +6 -3
- data/spec/factories/storylines.rb +13 -0
- metadata +1021 -928
- data/app/assets/fonts/pageflow/FranklinGothic-Demi-webfont.eot +0 -0
- data/app/assets/fonts/pageflow/FranklinGothic-Demi-webfont.svg +0 -768
- data/app/assets/fonts/pageflow/FranklinGothic-Demi-webfont.ttf +0 -0
- data/app/assets/fonts/pageflow/FranklinGothic-Demi-webfont.woff +0 -0
- data/app/assets/fonts/pageflow/FranklinGothic-Hvy-webfont.eot +0 -0
- data/app/assets/fonts/pageflow/FranklinGothic-Hvy-webfont.svg +0 -968
- data/app/assets/fonts/pageflow/FranklinGothic-Hvy-webfont.ttf +0 -0
- data/app/assets/fonts/pageflow/FranklinGothic-Hvy-webfont.woff +0 -0
- data/app/assets/fonts/pageflow/thesansboldplain.eot +0 -0
- data/app/assets/fonts/pageflow/thesansboldplain.svg +0 -228
- data/app/assets/fonts/pageflow/thesansboldplain.ttf +0 -0
- data/app/assets/fonts/pageflow/thesansboldplain.woff +0 -0
- data/app/assets/fonts/pageflow/thesanssemiboldplain.eot +0 -0
- data/app/assets/fonts/pageflow/thesanssemiboldplain.svg +0 -228
- data/app/assets/fonts/pageflow/thesanssemiboldplain.ttf +0 -0
- data/app/assets/fonts/pageflow/thesanssemiboldplain.woff +0 -0
- data/app/assets/javascripts/pageflow/browser/hashchange_support.js +0 -8
- data/app/assets/javascripts/pageflow/widgets/button.js +0 -22
- data/app/views/layouts/pageflow/_meta_tags.html.erb +0 -5
- data/app/views/pageflow/pages/_video_tag.html.erb +0 -13
@@ -4,9 +4,9 @@ module Pageflow
|
|
4
4
|
|
5
5
|
has_many :users
|
6
6
|
has_many :entries
|
7
|
-
has_many :folders
|
7
|
+
has_many :folders, dependent: :destroy
|
8
8
|
|
9
|
-
has_many :themings
|
9
|
+
has_many :themings, dependent: :destroy
|
10
10
|
belongs_to :default_theming, :class_name => 'Theming'
|
11
11
|
|
12
12
|
validates :default_theming, :presence => true
|
@@ -1,9 +1,9 @@
|
|
1
1
|
module Pageflow
|
2
2
|
class Chapter < ActiveRecord::Base
|
3
|
-
belongs_to :
|
3
|
+
belongs_to :storyline, touch: true
|
4
4
|
has_many :pages, -> { order('position ASC') }
|
5
5
|
|
6
|
-
delegate :entry, :
|
6
|
+
delegate :entry, to: :storyline
|
7
7
|
|
8
8
|
serialize :configuration, JSON
|
9
9
|
|
@@ -11,9 +11,9 @@ module Pageflow
|
|
11
11
|
super || {}
|
12
12
|
end
|
13
13
|
|
14
|
-
def copy_to(
|
14
|
+
def copy_to(storyline)
|
15
15
|
chapter = dup
|
16
|
-
|
16
|
+
storyline.chapters << chapter
|
17
17
|
|
18
18
|
pages.each do |page|
|
19
19
|
page.copy_to(chapter)
|
@@ -0,0 +1,33 @@
|
|
1
|
+
module Pageflow
|
2
|
+
class ChapterScaffold
|
3
|
+
def initialize(chapter, options)
|
4
|
+
@chapter = chapter
|
5
|
+
@options = options
|
6
|
+
end
|
7
|
+
|
8
|
+
delegate :save!, to: :@chapter
|
9
|
+
|
10
|
+
def build
|
11
|
+
if @options[:depth] == 'page'
|
12
|
+
@page = @chapter.pages.build(template: 'background_image')
|
13
|
+
end
|
14
|
+
|
15
|
+
self
|
16
|
+
end
|
17
|
+
|
18
|
+
def as_json(_ = {})
|
19
|
+
{
|
20
|
+
chapter: @chapter,
|
21
|
+
page: @page
|
22
|
+
}
|
23
|
+
end
|
24
|
+
|
25
|
+
def to_model
|
26
|
+
@chapter
|
27
|
+
end
|
28
|
+
|
29
|
+
def self.build(storyline, attributes, options)
|
30
|
+
new(storyline.chapters.build(attributes), options).build
|
31
|
+
end
|
32
|
+
end
|
33
|
+
end
|
@@ -1,7 +1,13 @@
|
|
1
1
|
module Pageflow
|
2
2
|
class CnameThemingRequestScope
|
3
3
|
def call(themings, request)
|
4
|
-
themings.where(
|
4
|
+
themings.where(<<-SQL, host: request.host)
|
5
|
+
cname = :host OR
|
6
|
+
FIND_IN_SET(
|
7
|
+
:host,
|
8
|
+
REPLACE(additional_cnames, SPACE(1), "")
|
9
|
+
)
|
10
|
+
SQL
|
5
11
|
end
|
6
12
|
end
|
7
13
|
end
|
@@ -13,13 +13,15 @@ module Pageflow
|
|
13
13
|
:to => :entry)
|
14
14
|
|
15
15
|
delegate(:title, :summary, :credits, :manual_start,
|
16
|
-
:widgets,
|
16
|
+
:widgets,
|
17
|
+
:storylines, :main_storyline_chapters, :chapters, :pages,
|
17
18
|
:emphasize_chapter_beginning,
|
18
19
|
:emphasize_new_pages,
|
19
20
|
:share_image_id, :share_image_x, :share_image_y,
|
20
21
|
:files,
|
21
22
|
:image_files, :video_files, :audio_files,
|
22
23
|
:locale,
|
24
|
+
:author, :publisher, :keywords,
|
23
25
|
:to => :draft)
|
24
26
|
|
25
27
|
def initialize(entry, draft = nil)
|
@@ -27,6 +29,11 @@ module Pageflow
|
|
27
29
|
@draft = draft || entry.draft
|
28
30
|
end
|
29
31
|
|
32
|
+
# So we can always get to the original Entry title.
|
33
|
+
def entry_title
|
34
|
+
entry.title
|
35
|
+
end
|
36
|
+
|
30
37
|
def create_file(model, attributes)
|
31
38
|
file = model.create(attributes) do |f|
|
32
39
|
f.entry = entry
|
@@ -64,7 +71,7 @@ module Pageflow
|
|
64
71
|
end
|
65
72
|
|
66
73
|
def self.accessible_by(ability, action)
|
67
|
-
Entry.accessible_by(ability, action).map do |entry|
|
74
|
+
Entry.includes(:draft).accessible_by(ability, action).map do |entry|
|
68
75
|
DraftEntry.new(entry)
|
69
76
|
end
|
70
77
|
end
|
@@ -80,5 +87,9 @@ module Pageflow
|
|
80
87
|
def home_button
|
81
88
|
HomeButton.new(draft, theming)
|
82
89
|
end
|
90
|
+
|
91
|
+
def resolve_widgets(options = {})
|
92
|
+
widgets.resolve(Pageflow.config_for(entry), options)
|
93
|
+
end
|
83
94
|
end
|
84
95
|
end
|
@@ -36,7 +36,7 @@ module Pageflow
|
|
36
36
|
Time.now > self.updated_at + TIME_TO_LIVE
|
37
37
|
end
|
38
38
|
|
39
|
-
def
|
39
|
+
def acquire(current_user, options = {})
|
40
40
|
verify!(current_user, options)
|
41
41
|
rescue Error
|
42
42
|
if options[:force] || timed_out?
|
@@ -73,7 +73,7 @@ module Pageflow
|
|
73
73
|
true
|
74
74
|
end
|
75
75
|
|
76
|
-
def
|
76
|
+
def acquire(user, options = {})
|
77
77
|
entry.create_edit_lock!(:user => user)
|
78
78
|
end
|
79
79
|
|
@@ -41,6 +41,7 @@ module Pageflow
|
|
41
41
|
|
42
42
|
after_create unless: :skip_draft_creation do
|
43
43
|
create_draft!(home_button_enabled: theming.home_button_enabled_by_default)
|
44
|
+
draft.storylines.create!(configuration: {main: true})
|
44
45
|
theming.widgets.copy_all_to(draft)
|
45
46
|
end
|
46
47
|
|
@@ -48,8 +49,8 @@ module Pageflow
|
|
48
49
|
super || EditLock::Null.new(self)
|
49
50
|
end
|
50
51
|
|
51
|
-
def
|
52
|
-
|
52
|
+
def inherited_feature_state(name)
|
53
|
+
account.feature_state(name)
|
53
54
|
end
|
54
55
|
|
55
56
|
def publish(options = {})
|
@@ -13,13 +13,16 @@ module Pageflow
|
|
13
13
|
:authenticate,
|
14
14
|
:to => :entry)
|
15
15
|
|
16
|
-
delegate(:widgets,
|
16
|
+
delegate(:widgets,
|
17
|
+
:storylines, :main_storyline_chapters, :chapters, :pages,
|
18
|
+
:files,
|
17
19
|
:image_files, :video_files, :audio_files,
|
18
|
-
:
|
20
|
+
:summary, :credits, :manual_start,
|
19
21
|
:emphasize_chapter_beginning,
|
20
22
|
:emphasize_new_pages,
|
21
23
|
:share_image_id, :share_image_x, :share_image_y,
|
22
24
|
:locale,
|
25
|
+
:author, :publisher, :keywords,
|
23
26
|
:password_protected?,
|
24
27
|
:to => :revision)
|
25
28
|
|
@@ -29,6 +32,10 @@ module Pageflow
|
|
29
32
|
@custom_revision = !!revision
|
30
33
|
end
|
31
34
|
|
35
|
+
def title
|
36
|
+
revision.title.presence || entry.title
|
37
|
+
end
|
38
|
+
|
32
39
|
def stylesheet_model
|
33
40
|
custom_revision? ? revision : entry
|
34
41
|
end
|
@@ -59,6 +66,10 @@ module Pageflow
|
|
59
66
|
HomeButton.new(revision, theming)
|
60
67
|
end
|
61
68
|
|
69
|
+
def resolve_widgets(options = {})
|
70
|
+
widgets.resolve(Pageflow.config_for(entry), options)
|
71
|
+
end
|
72
|
+
|
62
73
|
private
|
63
74
|
|
64
75
|
def custom_revision?
|
@@ -1,12 +1,19 @@
|
|
1
1
|
module Pageflow
|
2
2
|
class Revision < ActiveRecord::Base
|
3
|
+
PAGE_ORDER = [
|
4
|
+
'pageflow_storylines.position ASC',
|
5
|
+
'pageflow_chapters.position ASC',
|
6
|
+
'pageflow_pages.position ASC'
|
7
|
+
].join(',')
|
8
|
+
|
3
9
|
belongs_to :entry, :touch => true
|
4
10
|
belongs_to :creator, :class_name => 'User'
|
5
11
|
belongs_to :restored_from, :class_name => 'Pageflow::Revision'
|
6
12
|
|
7
13
|
has_many :widgets, :as => :subject
|
8
|
-
has_many :
|
9
|
-
has_many :
|
14
|
+
has_many :storylines, -> { order('pageflow_storylines.position ASC') }
|
15
|
+
has_many :chapters, -> { order('position ASC') }, through: :storylines
|
16
|
+
has_many :pages, -> { reorder(PAGE_ORDER) }, through: :storylines
|
10
17
|
|
11
18
|
has_many :file_usages
|
12
19
|
|
@@ -34,6 +41,11 @@ module Pageflow
|
|
34
41
|
validate :published_until_unchanged, :if => :published_until_was_in_past?
|
35
42
|
validate :published_until_blank, :if => :published_at_blank?
|
36
43
|
|
44
|
+
def main_storyline_chapters
|
45
|
+
main_storyline = storylines.first
|
46
|
+
main_storyline ? main_storyline.chapters : Chapter.none
|
47
|
+
end
|
48
|
+
|
37
49
|
def files(model)
|
38
50
|
model
|
39
51
|
.select("#{model.table_name}.*, pageflow_file_usages.id AS usage_id")
|
@@ -76,14 +88,15 @@ module Pageflow
|
|
76
88
|
|
77
89
|
def copy(&block)
|
78
90
|
revision = dup
|
91
|
+
|
79
92
|
yield(revision) if block_given?
|
80
93
|
|
81
94
|
widgets.each do |widget|
|
82
95
|
widget.copy_to(revision)
|
83
96
|
end
|
84
97
|
|
85
|
-
|
86
|
-
|
98
|
+
storylines.each do |storyline|
|
99
|
+
storyline.copy_to(revision)
|
87
100
|
end
|
88
101
|
|
89
102
|
file_usages.each do |file_usage|
|
@@ -0,0 +1,23 @@
|
|
1
|
+
module Pageflow
|
2
|
+
class Storyline < ActiveRecord::Base
|
3
|
+
include RevisionComponent
|
4
|
+
|
5
|
+
belongs_to :revision, touch: true
|
6
|
+
|
7
|
+
has_many :chapters, -> { order('pageflow_chapters.position ASC') }
|
8
|
+
has_many :pages, through: :chapters
|
9
|
+
|
10
|
+
delegate :entry, to: :revision
|
11
|
+
|
12
|
+
serialize :configuration, JSON
|
13
|
+
|
14
|
+
def copy_to(revision)
|
15
|
+
storyline = dup
|
16
|
+
revision.storylines << storyline
|
17
|
+
|
18
|
+
chapters.each do |chapter|
|
19
|
+
chapter.copy_to(storyline)
|
20
|
+
end
|
21
|
+
end
|
22
|
+
end
|
23
|
+
end
|
@@ -0,0 +1,27 @@
|
|
1
|
+
module Pageflow
|
2
|
+
class StorylineScaffold
|
3
|
+
def initialize(storyline, options)
|
4
|
+
@storyline = storyline
|
5
|
+
@options = options
|
6
|
+
end
|
7
|
+
|
8
|
+
delegate :save!, to: :@storyline
|
9
|
+
|
10
|
+
def build
|
11
|
+
@chapter_scaffold = ChapterScaffold.build(@storyline, {}, @options)
|
12
|
+
self
|
13
|
+
end
|
14
|
+
|
15
|
+
def as_json(_ = {})
|
16
|
+
@chapter_scaffold.as_json.merge(storyline: @storyline)
|
17
|
+
end
|
18
|
+
|
19
|
+
def to_model
|
20
|
+
@storyline
|
21
|
+
end
|
22
|
+
|
23
|
+
def self.build(revision, attributes, options)
|
24
|
+
new(revision.storylines.build(attributes), options).build
|
25
|
+
end
|
26
|
+
end
|
27
|
+
end
|
@@ -11,6 +11,10 @@ module Pageflow
|
|
11
11
|
validates :account, :presence => true
|
12
12
|
validates_inclusion_of :theme_name, :in => ->(_) { Pageflow.config.themes.names }
|
13
13
|
|
14
|
+
def resolve_widgets(options = {})
|
15
|
+
widgets.resolve(Pageflow.config_for(account), options)
|
16
|
+
end
|
17
|
+
|
14
18
|
def cname_domain
|
15
19
|
cname.split('.').pop(2).join('.')
|
16
20
|
end
|
@@ -4,6 +4,8 @@ module Pageflow
|
|
4
4
|
|
5
5
|
validates :subject, presence: true
|
6
6
|
|
7
|
+
attr_accessor :widget_type
|
8
|
+
|
7
9
|
def copy_to(subject)
|
8
10
|
record = dup
|
9
11
|
record.subject = subject
|
@@ -20,12 +22,6 @@ module Pageflow
|
|
20
22
|
end
|
21
23
|
end
|
22
24
|
|
23
|
-
def widget_type
|
24
|
-
Pageflow.config.widget_types.fetch_by_name(type_name) do
|
25
|
-
WidgetType::Null.new(role)
|
26
|
-
end
|
27
|
-
end
|
28
|
-
|
29
25
|
def self.copy_all_to(subject)
|
30
26
|
all.each do |widget|
|
31
27
|
widget.copy_to(subject)
|
@@ -38,13 +34,13 @@ module Pageflow
|
|
38
34
|
end
|
39
35
|
end
|
40
36
|
|
41
|
-
def self.resolve(options = {})
|
42
|
-
Resolver.new(options).result
|
37
|
+
def self.resolve(config, options = {})
|
38
|
+
Resolver.new(config, options).result
|
43
39
|
end
|
44
40
|
|
45
|
-
|
41
|
+
Resolver = Struct.new(:config, :options) do
|
46
42
|
def result
|
47
|
-
all.select do |widget|
|
43
|
+
assign_widget_types(all).select do |widget|
|
48
44
|
widget.enabled?(options)
|
49
45
|
end
|
50
46
|
end
|
@@ -63,7 +59,7 @@ module Pageflow
|
|
63
59
|
end
|
64
60
|
|
65
61
|
def defaults_by_role
|
66
|
-
|
62
|
+
config.widget_types.defaults_by_role.each_with_object({}) do |(role, widget_type), result|
|
67
63
|
result[role] = Widget.new(role: role, type_name: widget_type.name, subject: nil)
|
68
64
|
end
|
69
65
|
end
|
@@ -71,10 +67,18 @@ module Pageflow
|
|
71
67
|
def placeholders_by_role
|
72
68
|
return {} unless options[:include_placeholders]
|
73
69
|
|
74
|
-
|
70
|
+
config.widget_types.roles.each_with_object({}) do |role, result|
|
75
71
|
result[role] = Widget.new(role: role, type_name: nil, subject: nil)
|
76
72
|
end
|
77
73
|
end
|
74
|
+
|
75
|
+
def assign_widget_types(widgets)
|
76
|
+
widgets.each do |widget|
|
77
|
+
widget.widget_type = config.widget_types.fetch_by_name(widget.type_name) do
|
78
|
+
WidgetType::Null.new(widget.role)
|
79
|
+
end
|
80
|
+
end
|
81
|
+
end
|
78
82
|
end
|
79
83
|
end
|
80
84
|
end
|
@@ -12,9 +12,10 @@
|
|
12
12
|
|
13
13
|
<%= f.semantic_fields_for :default_theming do |theming| %>
|
14
14
|
<%= f.inputs do %>
|
15
|
-
<%= theming.input :theme_name, :
|
16
|
-
<%= theming.input :cname %>
|
17
|
-
<%= theming.input :
|
15
|
+
<%= theming.input :theme_name, include_blank: false, collection: Pageflow.config.themes.names %>
|
16
|
+
<%= theming.input :cname, hint: t('pageflow.admin.themings.cname_hint') %>
|
17
|
+
<%= theming.input :additional_cnames, hint: t('pageflow.admin.themings.additional_cnames_hint') %>
|
18
|
+
<%= theming.input :home_url, hint: t('pageflow.admin.themings.home_url_hint') %>
|
18
19
|
<% end %>
|
19
20
|
|
20
21
|
<%= f.inputs do %>
|
@@ -27,16 +28,11 @@
|
|
27
28
|
<% account_config.admin_form_inputs.find_all_for(:theming).each do |form_input| %>
|
28
29
|
<%= form_input.build(theming) %>
|
29
30
|
<% end %>
|
31
|
+
<% end %>
|
30
32
|
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
:label => t(widget.role, :scope => 'pageflow.widgets.roles'),
|
35
|
-
:input_html => {:name => "widgets[#{widget.role}]"},
|
36
|
-
:include_blank => t('pageflow.widgets.none'),
|
37
|
-
:collection => widget_types_collection_for_role(account_config, widget.role)) %>
|
38
|
-
<% end %>
|
39
|
-
<% end %>
|
33
|
+
<%= f.inputs do %>
|
34
|
+
<%= render('admin/accounts/widgets_inline_help') %>
|
35
|
+
<%= admin_widgets_fields(theming, account_config) %>
|
40
36
|
<% end %>
|
41
37
|
<% end %>
|
42
38
|
<%= f.actions do %>
|