effective_regions 1.10.2 → 1.11.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: e524f4fbaed0d1a7b576b17b8a53d1d290549abaa90e7b1d6006fd06803e3ee1
4
- data.tar.gz: d194dc40db088c50b15b1a7c1b672303667a9214dd8dc5d683cfadca3aabc962
3
+ metadata.gz: fbdc32d8440f1d8f9e084a3ab909d81865a0933738d483715540c4f1b887c9f9
4
+ data.tar.gz: a0fb8637faf3dca14693fd82149666a934c5058b9cd6660050455765e31a4916
5
5
  SHA512:
6
- metadata.gz: d74ad70f5eaeca444e44718f3fb699599725f39754e15f70b3cb57a692c1ee74790456c2f3adb366155e829b713f7271ea4ff5072db4d7bb9f81f07e12926c57
7
- data.tar.gz: a6b086403cd36c5b4280ac3b398ba4f46da9d11c62e9f070e5062a91a71279b92aebc25a30dbc7e9a75b44d195dbc5d61b5ce0959d84146869c5c75adf715830
6
+ metadata.gz: 49046530bc9140dcc1a5520c6eb0646aacf671bd28eae8b48cde96e749a4dfca7c3f007fb0c8762cbd38511aa1b248ece8d1ae85c0c0c588be049f4ec0f2aafa
7
+ data.tar.gz: '08605edae72311b555fd24a23e788ac241cb94e203d506c9bfca8a400af49952e46f9b85367324500ae562b0678dbc319eac7b58569581bf13ce79240bea0647'
@@ -0,0 +1,22 @@
1
+ CKEDITOR.dialog.add 'read_more_divider', (editor) -> # Must match the class name of the snippet
2
+ title: 'Read more divider',
3
+ minWidth: 200,
4
+ minHeight: 100,
5
+ contents: [
6
+ {
7
+ id: 'read_more_info', # Just an html id, doesn't really matter what is here
8
+ elements: [
9
+ {
10
+ id: 'throwaway'
11
+ type: 'html',
12
+ html: 'Insert a read more divider to separate excerpt content from the full content.',
13
+ setup: (widget) -> this.setValue(widget.data.throwaway)
14
+ commit: (widget) -> widget.setData('throwaway', 'throwaway')
15
+ },
16
+ {
17
+ type: 'html',
18
+ html: 'Anything above the read more divider will be treated as excerpt content<br>and everything below the divider will also be included in the full content.'
19
+ }
20
+ ]
21
+ }
22
+ ]
@@ -23,6 +23,7 @@ module Effective
23
23
  def update
24
24
  refresh_page = false
25
25
  response = {}
26
+ success = false
26
27
 
27
28
  Effective::Region.transaction do
28
29
  (request.fullpath.slice!(0..4) rescue nil) if request.fullpath.to_s.starts_with?('/edit') # This is so the before_save_method can reference the real current page
@@ -64,11 +65,15 @@ module Effective
64
65
 
65
66
  response[:refresh] = true if refresh_page
66
67
 
68
+ success = true
69
+ end
70
+
71
+ if success
67
72
  render(json: response.to_json(), status: 200)
68
- return
73
+ else
74
+ render(text: 'error', status: :unprocessable_entity)
69
75
  end
70
76
 
71
- render(text: 'error', status: :unprocessable_entity)
72
77
  end
73
78
 
74
79
  def snippet # This is a GET. CKEDITOR passes us data, we need to render the non-editable content
@@ -0,0 +1,12 @@
1
+ module Effective
2
+ module Snippets
3
+ class ReadMoreDivider < Snippet
4
+ TOKEN = "<div style='display: none;'>READ_MORE_DIVIDER</div>"
5
+
6
+ def snippet_attributes
7
+ super + [:throwaway]
8
+ end
9
+
10
+ end
11
+ end
12
+ end
@@ -0,0 +1,6 @@
1
+ - if effectively_editting?
2
+ %p.show-block-adjust{:style => 'border-top: 2px dashed black; text-align: center;', :title => 'anything above this line will be treated as excerpt content'}
3
+ %span{:style => 'background: #ddd; display: inline-block; padding: 0px 6px 4px 6px; border-radius: 0px 0px 10px 10px;'}
4
+ Read more...
5
+ - else
6
+ = Effective::Snippets::ReadMoreDivider::TOKEN.html_safe
@@ -1,3 +1,3 @@
1
1
  module EffectiveRegions
2
- VERSION = '1.10.2'.freeze
2
+ VERSION = '1.11.0'.freeze
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: effective_regions
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.10.2
4
+ version: 1.11.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Code and Effect
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2022-05-19 00:00:00.000000000 Z
11
+ date: 2023-05-26 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails
@@ -83,6 +83,7 @@ files:
83
83
  - app/assets/javascripts/effective/snippets/current_date_time.js.coffee
84
84
  - app/assets/javascripts/effective/snippets/current_user_info.js.coffee
85
85
  - app/assets/javascripts/effective/snippets/drop_cap.js.coffee
86
+ - app/assets/javascripts/effective/snippets/read_more_divider.js.coffee
86
87
  - app/assets/stylesheets/ck_assets.scss
87
88
  - app/assets/stylesheets/drop_cap.scss
88
89
  - app/controllers/effective/ck_assets_controller.rb
@@ -96,6 +97,7 @@ files:
96
97
  - app/models/effective/snippets/current_user_info.rb
97
98
  - app/models/effective/snippets/drop_cap.rb
98
99
  - app/models/effective/snippets/effective_asset.rb
100
+ - app/models/effective/snippets/read_more_divider.rb
99
101
  - app/models/effective/snippets/snippet.rb
100
102
  - app/models/effective/templates/image_and_title.rb
101
103
  - app/models/effective/templates/template.rb
@@ -106,6 +108,7 @@ files:
106
108
  - app/views/effective/snippets/_current_date_time.html.haml
107
109
  - app/views/effective/snippets/_current_user_info.html.haml
108
110
  - app/views/effective/snippets/_drop_cap.html.haml
111
+ - app/views/effective/snippets/_read_more_divider.html.haml
109
112
  - app/views/effective/templates/_image_and_title.html.haml
110
113
  - app/views/effective/templates/_three_column.html.haml
111
114
  - app/views/effective/templates/_two_column.html.haml