effective_regions 1.10.3 → 1.11.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 569274e4566d124929e79f9f88656573e2d50d2d012c74b5709e5b27454edd00
4
- data.tar.gz: 4fd9c98375899a4ea8adb0b8e8dcbb6715ac2d3cd60420b8bf1f28e6c4efad10
3
+ metadata.gz: fbdc32d8440f1d8f9e084a3ab909d81865a0933738d483715540c4f1b887c9f9
4
+ data.tar.gz: a0fb8637faf3dca14693fd82149666a934c5058b9cd6660050455765e31a4916
5
5
  SHA512:
6
- metadata.gz: 5fdbc44857f5dda59b5a6ed6eb6fbf97a97218ce8d23dd4fda592837c27c45266a1c8cde7c2a9fdbe82d9adc9aff24d94096f286634f42b8cabf7bfa55e021c8
7
- data.tar.gz: bcfb0669cc3725125ca54bb6d4b37717da7f6743bf2e9513c9b6dd5e407f6eed991323462d3d620e51e7564e606dfd33acb4da4a907deb4afc26ed3c3a0b32d0
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
@@ -3,7 +3,6 @@ module EffectiveRegions
3
3
  engine_name 'effective_regions'
4
4
 
5
5
  config.autoload_paths += Dir["#{config.root}/app/models/concerns"]
6
- config.autoload_paths += Dir["#{config.root}/app/models/effective/snippets"]
7
6
 
8
7
  # Include Helpers to base application
9
8
  initializer 'effective_regions.action_controller' do |app|
@@ -1,3 +1,3 @@
1
1
  module EffectiveRegions
2
- VERSION = '1.10.3'.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.3
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: 2023-05-22 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