pageflow 14.0.0 → 14.1.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.

Files changed (72) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +59 -90
  3. data/admins/pageflow/accounts.rb +6 -2
  4. data/app/assets/javascripts/pageflow/dist/react-client.js +1 -1
  5. data/app/assets/javascripts/pageflow/dist/react-server.js +1 -1
  6. data/app/assets/javascripts/pageflow/editor/views/configuration_editors/groups/general.js +4 -1
  7. data/app/assets/javascripts/pageflow/editor/views/edit_meta_data_view.js +4 -0
  8. data/app/assets/javascripts/pageflow/page_types/mixins/default_page_content.js +1 -1
  9. data/app/assets/javascripts/pageflow/slideshow/page_split_layout.js +1 -1
  10. data/app/assets/javascripts/pageflow/slideshow/page_widget.js +4 -3
  11. data/app/assets/javascripts/pageflow/ui.js +1 -1
  12. data/app/assets/javascripts/pageflow/ui/templates/inputs/check_box_group_input.jst.ejs +5 -0
  13. data/app/assets/javascripts/pageflow/ui/templates/inputs/text_area_input.jst.ejs +45 -6
  14. data/app/assets/javascripts/pageflow/ui/views/inputs/check_box_group_input_view.js +75 -0
  15. data/app/assets/javascripts/pageflow/ui/views/inputs/text_area_input_view.js +131 -18
  16. data/app/assets/javascripts/pageflow/widgets/navigation.js +2 -2
  17. data/app/assets/javascripts/pageflow/widgets/share_menu.js +1 -1
  18. data/app/assets/stylesheets/pageflow/base.scss +7 -0
  19. data/app/assets/stylesheets/pageflow/editor/wysihtml5.scss +84 -5
  20. data/app/assets/stylesheets/pageflow/mixins/icons.scss +3 -1
  21. data/app/assets/stylesheets/pageflow/navigation_mobile.scss +13 -19
  22. data/app/assets/stylesheets/pageflow/subshare.scss +16 -14
  23. data/app/assets/stylesheets/pageflow/themes/default/base.scss +1 -0
  24. data/app/assets/stylesheets/pageflow/themes/default/mobile_navigation.scss +2 -2
  25. data/app/assets/stylesheets/pageflow/themes/default/navigation.scss +7 -1
  26. data/app/assets/stylesheets/pageflow/themes/default/navigation/dimensions.scss +34 -9
  27. data/app/assets/stylesheets/pageflow/themes/default/navigation/icons/icon_font.scss +1 -53
  28. data/app/assets/stylesheets/pageflow/themes/default/navigation/icons/sprite.scss +0 -12
  29. data/app/assets/stylesheets/pageflow/themes/default/navigation_share_box.scss +40 -0
  30. data/app/assets/stylesheets/pageflow/themes/default/navigation_share_box/icon_colors.scss +46 -0
  31. data/app/assets/stylesheets/pageflow/themes/default/overview/icons/icon_font.scss +1 -4
  32. data/app/assets/stylesheets/pageflow/themes/default/page.scss +7 -33
  33. data/app/assets/stylesheets/pageflow/themes/default/page/anchors.scss +10 -8
  34. data/app/assets/stylesheets/pageflow/themes/default/page/colors.scss +41 -0
  35. data/app/assets/stylesheets/pageflow/themes/default/page/content_text_margin.scss +1 -1
  36. data/app/assets/stylesheets/pageflow/themes/default/page/line_lengths.scss +3 -3
  37. data/app/assets/stylesheets/pageflow/ui.scss +1 -0
  38. data/app/assets/stylesheets/pageflow/ui/input/check_box_group_input.scss +15 -0
  39. data/app/controllers/pageflow/entries_controller.rb +2 -1
  40. data/app/helpers/pageflow/navigation_bar_helper.rb +7 -1
  41. data/app/helpers/pageflow/pages_helper.rb +1 -1
  42. data/app/helpers/pageflow/social_share_links_helper.rb +5 -1
  43. data/app/models/pageflow/draft_entry.rb +1 -0
  44. data/app/models/pageflow/published_entry.rb +1 -0
  45. data/app/models/pageflow/revision.rb +10 -0
  46. data/app/models/pageflow/theming.rb +19 -0
  47. data/app/views/admin/accounts/_form.html.erb +5 -0
  48. data/app/views/admin/accounts/_theming_details.html.arb +3 -0
  49. data/app/views/pageflow/config/_editor_seeds.json.jbuilder +2 -1
  50. data/app/views/pageflow/editor/entries/_entry.json.jbuilder +1 -1
  51. data/app/views/pageflow/entries/_mobile_navigation.html.erb +9 -11
  52. data/app/views/pageflow/entries/navigation/_bar_top.html.erb +1 -7
  53. data/app/views/pageflow/entries/navigation/_share_box_content.html.erb +9 -0
  54. data/app/views/pageflow/entries/share_menu/_email_link.html.erb +14 -0
  55. data/app/views/pageflow/entries/share_menu/_facebook_link.html.erb +11 -2
  56. data/app/views/pageflow/entries/share_menu/_linked_in_link.html.erb +18 -0
  57. data/app/views/pageflow/entries/share_menu/_telegram_link.html.erb +17 -0
  58. data/app/views/pageflow/entries/share_menu/_twitter_link.html.erb +16 -2
  59. data/app/views/pageflow/entries/share_menu/_whats_app_link.html.erb +21 -0
  60. data/config/initializers/paperclip.rb +0 -4
  61. data/config/locales/de.yml +22 -1
  62. data/config/locales/en.yml +22 -1
  63. data/db/migrate/20190408144136_add_default_share_providers_to_themings.rb +5 -0
  64. data/db/migrate/20190408161315_add_share_providers_to_revisions.rb +5 -0
  65. data/lib/generators/pageflow/initializer/templates/pageflow.rb +0 -14
  66. data/lib/pageflow/configuration.rb +27 -6
  67. data/lib/pageflow/engine.rb +1 -1
  68. data/lib/pageflow/version.rb +1 -1
  69. metadata +21 -11
  70. data/app/assets/images/pageflow/themes/default/mobile_navigation/sharing_icons_sprite.png +0 -0
  71. data/app/assets/stylesheets/pageflow/themes/default/navigation/share_box.scss +0 -28
  72. data/app/views/pageflow/entries/share_menu/_google_link.html.erb +0 -5
@@ -88,18 +88,6 @@
88
88
  @include pageflow-sprite-icon-credits;
89
89
  }
90
90
 
91
- .share_google {
92
- @include pageflow-sprite-icon-google($offset: -5px);
93
- }
94
-
95
- .share_twitter {
96
- @include pageflow-sprite-icon-twitter($offset: -5px);
97
- }
98
-
99
- .share_facebook {
100
- @include pageflow-sprite-icon-facebook($offset: -5px);
101
- }
102
-
103
91
  .volume-control {
104
92
  &:before,
105
93
  &:after {
@@ -0,0 +1,40 @@
1
+ .navigation_share_box {
2
+ @import "./navigation_share_box/icon_colors";
3
+
4
+ padding: 15px;
5
+ text-align: center;
6
+
7
+ .share_box_icons {
8
+ display: flex;
9
+ text-align: center;
10
+
11
+ .menu_item {
12
+ min-height: 50px;
13
+ margin: 0 auto;
14
+ }
15
+
16
+ a {
17
+ float: left;
18
+ position: relative;
19
+ width: 70px;
20
+ height: 45px;
21
+ text-align: center;
22
+ text-decoration: none;
23
+ margin: 0 auto;
24
+
25
+ svg {
26
+ width: 70px;
27
+ height: 25px;
28
+ margin-bottom: 7px;
29
+ }
30
+
31
+ p {
32
+ font-family: SourceSansPro;
33
+ font-size: 13px;
34
+ text-align: center;
35
+ line-height: 1;
36
+ margin: 0;
37
+ }
38
+ }
39
+ }
40
+ }
@@ -0,0 +1,46 @@
1
+ $share-icon-color: #fff !default;
2
+ $share-icon-hover-color: $main-color !default;
3
+ $share-icon-active-color: $share-icon-hover-color !default;
4
+
5
+ a {
6
+ color: $share-icon-color;
7
+
8
+ svg {
9
+ fill: $share-icon-color;
10
+ }
11
+
12
+ p {
13
+ color: $share-icon-color;
14
+ }
15
+ }
16
+
17
+ a:hover {
18
+ color: $share-icon-hover-color;
19
+
20
+ svg {
21
+ fill: $share-icon-hover-color;
22
+ }
23
+
24
+ p {
25
+ color: $share-icon-hover-color;
26
+ }
27
+ }
28
+
29
+ a.active,
30
+ button.pressed {
31
+ color: $share-icon-active-color;
32
+
33
+ svg {
34
+ fill: $share-icon-active-color;
35
+ }
36
+
37
+ p {
38
+ color: $share-icon-active-color;
39
+ }
40
+ }
41
+
42
+ .sub_share {
43
+ a, a:hover {
44
+ color: #ffffff;
45
+ }
46
+ }
@@ -4,10 +4,7 @@
4
4
 
5
5
  $button-icon-color,
6
6
  $active-button-icon-color,
7
- $deactivated-button-icon-color,
8
-
9
- $share-icon-color: null,
10
- $active-share-icon-color: null
7
+ $deactivated-button-icon-color
11
8
  ) {
12
9
 
13
10
  .button {
@@ -14,25 +14,6 @@ $page-content-font-size: 1em !default;
14
14
  /// Base font size for page content in phone layout
15
15
  $page-content-phone-font-size: 0.7em !default;
16
16
 
17
- /// Color of text
18
- /// @group page-colors
19
- $page-text-color: #fff !default;
20
-
21
- /// Color of text on inverted pages
22
- /// @group page-colors
23
- $page-inverted-text-color: #000 !default;
24
-
25
- /// Color of title on inverted pages
26
- /// @group page-colors
27
- $page-inverted-title-color: null !default;
28
-
29
- /// Background-color of pages
30
- /// @group page-colors
31
- $page-background-color: #000 !default;
32
-
33
- /// Background-color of inverted pages
34
- /// @group page-colors
35
- $page-inverted-background-color: #fff !default;
36
17
 
37
18
  // Deprecated. Use typography variables above.
38
19
 
@@ -41,8 +22,11 @@ $page-font-size: 16px !default;
41
22
  $page-content-text-font-family: $page-font-family !default;
42
23
  $page-content-text-font-size: 1.2em !default;
43
24
  $page-content-text-line-height: 1.5em !default;
25
+ $page-content-list-margin: 1em !default;
26
+ $page-content-list-indent: 40px !default;
44
27
 
45
28
  @import "./page/anchors";
29
+ @import "./page/colors";
46
30
  @import "./page/header";
47
31
  @import "./page/hyphenate";
48
32
  @import "./page/paddings";
@@ -61,18 +45,6 @@ $page-content-text-line-height: 1.5em !default;
61
45
  )
62
46
  );
63
47
 
64
- color: $page-text-color;
65
- background-color: $page-background-color;
66
-
67
- &.invert {
68
- color: $page-inverted-text-color;
69
- background-color: $page-inverted-background-color;
70
-
71
- .page_header-title {
72
- color: $page-inverted-title-color;
73
- }
74
- }
75
-
76
48
  .content {
77
49
  font-size: $page-content-font-size;
78
50
 
@@ -92,7 +64,9 @@ $page-content-text-line-height: 1.5em !default;
92
64
  );
93
65
  }
94
66
 
95
- p {
96
- margin-top: 0;
67
+ .page_text > .paragraph ul,
68
+ .page_text > .paragraph ol {
69
+ margin: $page-content-list-margin 0;
70
+ padding: 0 0 0 $page-content-list-indent;
97
71
  }
98
72
  }
@@ -11,13 +11,15 @@ $page-anchor-inverted-color: #000 !default;
11
11
  /// Typography settings of links in page content text
12
12
  $page-anchor-typography: () !default;
13
13
 
14
- .page_text a {
15
- @extend %anchor;
16
- color: $page-anchor-color;
17
- pointer-events: all;
18
- @include typography($page-anchor-typography)
19
- }
14
+ .page {
15
+ .page_text a {
16
+ @extend %anchor;
17
+ color: $page-anchor-color;
18
+ pointer-events: all;
19
+ @include typography($page-anchor-typography)
20
+ }
20
21
 
21
- .invert .page_text a {
22
- color: $page-anchor-inverted-color;
22
+ &.invert .page_text a {
23
+ color: $page-anchor-inverted-color;
24
+ }
23
25
  }
@@ -0,0 +1,41 @@
1
+ /// Color of text
2
+ /// @group page-colors
3
+ $page-text-color: #fff !default;
4
+
5
+ /// Color of text on inverted pages
6
+ /// @group page-colors
7
+ $page-inverted-text-color: #000 !default;
8
+
9
+ /// Background-color of pages
10
+ /// @group page-colors
11
+ $page-background-color: #000 !default;
12
+
13
+ /// Background-color of inverted pages
14
+ /// @group page-colors
15
+ $page-inverted-background-color: #fff !default;
16
+
17
+ /// Color of title
18
+ /// @group page-colors
19
+ $page-title-color: null !default;
20
+
21
+ /// Color of title on inverted pages
22
+ /// @group page-colors
23
+ $page-inverted-title-color: null !default;
24
+
25
+ .page {
26
+ color: $page-text-color;
27
+ background-color: $page-background-color;
28
+
29
+ .page_header-title {
30
+ color: $page-title-color;
31
+ }
32
+
33
+ &.invert {
34
+ color: $page-inverted-text-color;
35
+ background-color: $page-inverted-background-color;
36
+
37
+ .page_header-title {
38
+ color: $page-inverted-title-color;
39
+ }
40
+ }
41
+ }
@@ -1,4 +1,4 @@
1
- .page_text {
1
+ .page .page_text {
2
2
  // This has to be the default behavior since all non-React pages
3
3
  // still do not apply additional modifier classes to the content
4
4
  // text
@@ -22,7 +22,7 @@ $page-content-width: 60% !default;
22
22
  &_header-subtitle,
23
23
  &_header-tagline,
24
24
  &_sub_header,
25
- p {
25
+ .paragraph {
26
26
  max-width: $page-content-max-width;
27
27
  width: $page-content-width;
28
28
 
@@ -73,7 +73,7 @@ $page-content-width: 60% !default;
73
73
  .page_header-title,
74
74
  .page_header-tagline,
75
75
  .page_sub_header,
76
- p {
76
+ .paragraph {
77
77
  width: $page-content-split-layout-width;
78
78
  }
79
79
  }
@@ -84,7 +84,7 @@ $page-content-width: 60% !default;
84
84
  .page_header-title,
85
85
  .page_header-tagline,
86
86
  .page_sub_header,
87
- p {
87
+ .paragraph {
88
88
  @include margin-start(auto);
89
89
  max-width: $page-content-position-right-max-width;
90
90
  width: 60%;
@@ -14,3 +14,4 @@
14
14
  }
15
15
 
16
16
  @import "./ui/input/extended_select_input";
17
+ @import "./ui/input/check_box_group_input";
@@ -0,0 +1,15 @@
1
+ .check_box_group_input {
2
+ .check_box {
3
+ margin: 5px 0;
4
+
5
+ input {
6
+ display: inline;
7
+ width: auto;
8
+ margin: 0 5px 0 0;
9
+ }
10
+
11
+ label {
12
+ display: inline;
13
+ }
14
+ }
15
+ }
@@ -92,7 +92,8 @@ module Pageflow
92
92
  :overview_button_enabled,
93
93
  :emphasize_chapter_beginning, :emphasize_new_pages,
94
94
  :share_url, :share_image_id, :share_image_x, :share_image_y,
95
- :locale, :author, :publisher, :keywords, :theme_name)
95
+ :locale, :author, :publisher, :keywords, :theme_name,
96
+ share_providers: {})
96
97
  end
97
98
 
98
99
  def entry_request_scope
@@ -4,8 +4,14 @@ module Pageflow
4
4
  [
5
5
  options[:class],
6
6
  entry.home_button.enabled? ? 'with_home_button' : nil,
7
- entry.overview_button.enabled? ? 'with_overview_button' : nil
7
+ entry.overview_button.enabled? ? 'with_overview_button' : nil,
8
+ entry.active_share_providers.empty? ? 'without_sharing_button' : nil,
9
+ mobile_share_providers_only?(entry) ? 'mobile_sharing_only' : nil
8
10
  ].compact.join(' ')
9
11
  end
12
+
13
+ def mobile_share_providers_only?(entry)
14
+ entry.active_share_providers.sort.eql?(%w[telegram whats_app].sort)
15
+ end
10
16
  end
11
17
  end
@@ -49,7 +49,7 @@ module Pageflow
49
49
 
50
50
  def page_text(page)
51
51
  content_tag(:div, class: 'page_text') do
52
- content_tag(:p, raw(page.configuration['text']))
52
+ content_tag(:div, raw(page.configuration['text']), class: 'paragraph')
53
53
  end
54
54
  end
55
55
 
@@ -3,9 +3,13 @@ module Pageflow
3
3
  include SocialShareHelper
4
4
 
5
5
  PROVIDER_URL_TEMPLATES = {
6
+ email: 'mailto:?body=%{url}',
6
7
  facebook: 'http://www.facebook.com/sharer/sharer.php?u=%{url}',
7
8
  google: 'https://plus.google.com/share?url=%{url}',
8
- twitter: 'http://twitter.com/home?status=%{url}'
9
+ linked_in: 'https://www.linkedin.com/shareArticle?mini=true&url=%{url}',
10
+ telegram: 'tg://msg?text=%{url}',
11
+ twitter: 'http://twitter.com/home?status=%{url}',
12
+ whats_app: 'WhatsApp://send?text=%{url}'
9
13
  }.freeze
10
14
 
11
15
  def social_share_link(provider, entry, &block)
@@ -19,6 +19,7 @@ module Pageflow
19
19
  :emphasize_chapter_beginning,
20
20
  :emphasize_new_pages,
21
21
  :share_url, :share_image_id, :share_image_x, :share_image_y,
22
+ :share_providers, :active_share_providers,
22
23
  :find_files, :find_file,
23
24
  :image_files, :video_files, :audio_files,
24
25
  :locale,
@@ -22,6 +22,7 @@ module Pageflow
22
22
  :emphasize_chapter_beginning,
23
23
  :emphasize_new_pages,
24
24
  :share_url, :share_image_id, :share_image_x, :share_image_y,
25
+ :share_providers, :active_share_providers,
25
26
  :locale,
26
27
  :author, :publisher, :keywords,
27
28
  :theme,
@@ -13,6 +13,8 @@ module Pageflow
13
13
 
14
14
  include ThemeReferencer
15
15
 
16
+ serialize :share_providers, JSON
17
+
16
18
  belongs_to :entry, touch: :edited_at
17
19
  belongs_to :creator, class_name: 'User', optional: true
18
20
  belongs_to :restored_from, class_name: 'Pageflow::Revision', optional: true
@@ -91,6 +93,14 @@ module Pageflow
91
93
  UsedFile.new(file)
92
94
  end
93
95
 
96
+ def share_providers
97
+ self[:share_providers] || entry.theming.default_share_providers
98
+ end
99
+
100
+ def active_share_providers
101
+ share_providers.select { |_k, v| v }.keys
102
+ end
103
+
94
104
  def creator
95
105
  super || NullUser.new
96
106
  end
@@ -2,6 +2,8 @@ module Pageflow
2
2
  class Theming < ApplicationRecord
3
3
  include ThemeReferencer
4
4
 
5
+ serialize :default_share_providers, JSON
6
+
5
7
  belongs_to :account
6
8
  has_many :widgets, as: :subject, dependent: :destroy
7
9
 
@@ -29,6 +31,18 @@ module Pageflow
29
31
  copy_attributes_to(revision)
30
32
  end
31
33
 
34
+ def share_providers=(share_providers_array)
35
+ self.default_share_providers = hashify_provider_array(share_providers_array)
36
+ end
37
+
38
+ def share_providers
39
+ default_share_providers.to_a
40
+ end
41
+
42
+ def default_share_providers
43
+ self[:default_share_providers].presence || hashify_provider_array(Pageflow.config.default_share_providers)
44
+ end
45
+
32
46
  private
33
47
 
34
48
  def copy_attributes_to(revision)
@@ -36,6 +50,7 @@ module Pageflow
36
50
  author: default_author.presence || Pageflow.config.default_author_meta_tag,
37
51
  publisher: default_publisher.presence || Pageflow.config.default_publisher_meta_tag,
38
52
  keywords: default_keywords.presence || Pageflow.config.default_keywords_meta_tag,
53
+ share_providers: default_share_providers,
39
54
  theme_name: theme_name,
40
55
  home_button_enabled: home_button_enabled_by_default,
41
56
  locale: default_locale
@@ -45,5 +60,9 @@ module Pageflow
45
60
  def available_themes
46
61
  Pageflow.config_for(account).themes
47
62
  end
63
+
64
+ def hashify_provider_array(arr)
65
+ Hash[arr.reject(&:blank?).map { |v| [v.to_s, true] }]
66
+ end
48
67
  end
49
68
  end