effective_bootstrap 0.11.13 → 0.11.15

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: 92c48deef88d8891fbd457afbd1294dab443032fc2fb2c4fceef1f6c6bb76d7a
4
- data.tar.gz: bc74c439babfe29ef5ffe484e1bb1b31b1274ff6f73deed035f28d02c3e5bd2d
3
+ metadata.gz: 135872e85367ae5e9997d208b8f7761af52f58c9372c75e619b0ad2fb07c9b7e
4
+ data.tar.gz: 204a7bdee71fddc4008f6667fa484b9ba3b40dbde7906f605b705a8a0ac89bae
5
5
  SHA512:
6
- metadata.gz: eb5873bc5b64b2626e9d981f24a228e84d472706b1bb47c390f6f4ed76e00d9cff42bf7b8736c396e6ee17a1e70ea2f84716b4d7b9ba2b2b102f89afe2be12f0
7
- data.tar.gz: b3062220f045454fb4fe86cad596ac9a34ad3aef7b5618db96c8456a1115324abd78ac2dfa25d4eb1ee6bc95afceaad7fe7cb8796d341e8f21864b28a57ee84f
6
+ metadata.gz: e7a8fddb1d2d2811b2781a5154e0c5e0ea656a5af12b64e03b24b6034393eafbb4b46d6ec08b1e1080ad1af36fc51a95c053cb36a05c9d0c4d14f1a0546d1ce3
7
+ data.tar.gz: e73fd06ebaccc00dc9613bde686a2aa2b3b672d25897e11afa40cc3e5e39aeb63da0ba3705d6217df7496610dc7efd495bafae1d098b030796f9ddbe6b669800
@@ -15,10 +15,7 @@ module Effective
15
15
 
16
16
  # This is overridden by the custom_css() method below
17
17
  custom: {
18
- css: [
19
- 'application.css',
20
- '/assets/effective_bootstrap_article_editor.css'
21
- ]
18
+ css: ['application.css', '/assets/effective_bootstrap_article_editor.css']
22
19
  },
23
20
 
24
21
  # The rest of these are just normal Hash options
@@ -28,40 +25,23 @@ module Effective
28
25
  'right': 'text-right',
29
26
  'justify': false
30
27
  },
31
- makebutton: {
32
- items: {
33
- primary: {
34
- title: 'Primary',
35
- params: { classname: 'btn btn-primary' }
36
- },
37
- secondary: {
38
- title: 'Secondary',
39
- params: { classname: 'btn btn-secondary' }
40
- },
41
- danger: {
42
- title: 'Danger',
43
- params: { classname: 'btn btn-danger' }
44
- },
45
- primary_large: {
46
- title: 'Primary (large)',
47
- params: { classname: 'btn btn-lg btn-primary' }
48
- },
49
- secondary_large: {
50
- title: 'Secondary (large)',
51
- params: { classname: 'btn btn-lg btn-secondary' }
52
- },
53
- danger_large: {
54
- title: 'Danger (large)',
55
- params: { classname: 'btn btn-lg btn-danger' }
56
- }
57
- }
58
- },
59
- classes: {
60
- table: 'table'
28
+ cellcolors: {
29
+ 'primary': { title: 'Primary', classname: 'table-primary' },
30
+ 'secondary': { title: 'Secondary', classname: 'table-secondary' },
31
+ 'active': { title: 'Active', classname: 'table-active' },
32
+ 'success': { title: 'Success', classname: 'table-success' },
33
+ 'danger': { title: 'Danger', classname: 'table-danger' },
34
+ 'warning': { title: 'Warning', classname: 'table-warning' },
35
+ 'info': { title: 'Info', classname: 'table-info' },
36
+ 'light': { title: 'Light', classname: 'table-light' },
37
+ 'dark': { title: 'Dark', classname: 'table-dark' }
61
38
  },
62
- embed: {
63
- script: false # do not strip out script tag from embeds
39
+ classes: { table: 'table' },
40
+ editor: {
41
+ csscache: true, # Do not add ?=timestamp to css requests
42
+ https: true # Embed links use https
64
43
  },
44
+ embed: { script: false }, # do not strip out script tag from embeds
65
45
  filelink: nil,
66
46
  format: ['p', 'h2', 'h3', 'h4', 'h5', 'ul', 'ol'],
67
47
  grid: {
@@ -92,6 +72,34 @@ module Effective
92
72
  },
93
73
  layer: false, # the layer button is confusing for the layperson
94
74
  link: { size: 500 }, # truncate after this length
75
+ makebutton: {
76
+ items: {
77
+ primary: {
78
+ title: 'Primary',
79
+ params: { classname: 'btn btn-primary' }
80
+ },
81
+ secondary: {
82
+ title: 'Secondary',
83
+ params: { classname: 'btn btn-secondary' }
84
+ },
85
+ danger: {
86
+ title: 'Danger',
87
+ params: { classname: 'btn btn-danger' }
88
+ },
89
+ primary_large: {
90
+ title: 'Primary (large)',
91
+ params: { classname: 'btn btn-lg btn-primary' }
92
+ },
93
+ secondary_large: {
94
+ title: 'Secondary (large)',
95
+ params: { classname: 'btn btn-lg btn-secondary' }
96
+ },
97
+ danger_large: {
98
+ title: 'Danger (large)',
99
+ params: { classname: 'btn btn-lg btn-danger' }
100
+ }
101
+ }
102
+ },
95
103
  outset: false, # tricky to design around
96
104
  plugins: ['blockcode', 'carousel', 'cellcolor', 'collapse', 'filelink', 'imageposition', 'imageresize', 'inlineformat', 'listitem', 'makebutton', 'removeformat', 'reorder', 'style'],
97
105
  quote: {
@@ -104,27 +112,26 @@ module Effective
104
112
  'small': { title: 'Small', classname: 'table-sm' },
105
113
  'striped': { title: 'Striped', classname: 'table-striped' },
106
114
  }
107
- },
108
- cellcolors: {
109
- 'primary': { title: 'Primary', classname: 'table-primary' },
110
- 'secondary': { title: 'Secondary', classname: 'table-secondary' },
111
- 'active': { title: 'Active', classname: 'table-active' },
112
- 'success': { title: 'Success', classname: 'table-success' },
113
- 'danger': { title: 'Danger', classname: 'table-danger' },
114
- 'warning': { title: 'Warning', classname: 'table-warning' },
115
- 'info': { title: 'Info', classname: 'table-info' },
116
- 'light': { title: 'Light', classname: 'table-light' },
117
- 'dark': { title: 'Dark', classname: 'table-dark' }
118
115
  }
119
116
  }
120
117
  end
121
118
 
122
- def content
123
- if defined?(ActionText::RichText) && value.kind_of?(ActionText::RichText)
124
- return value.body&.to_html
125
- end
119
+ def default_mode
120
+ self.class.defaults
121
+ end
126
122
 
127
- value
123
+ def restricted_mode
124
+ self.class.defaults.merge(
125
+ code: false,
126
+ editor: { csscache: true, https: true, drop: false },
127
+ embed: false,
128
+ image: false,
129
+ plugins: ['blockcode', 'cellcolor', 'inlineformat', 'listitem', 'removeformat', 'reorder', 'style']
130
+ )
131
+ end
132
+
133
+ def content
134
+ (defined?(ActionText::RichText) && value.kind_of?(ActionText::RichText)) ? value.body&.to_html : value
128
135
  end
129
136
 
130
137
  def build_input(&block)
@@ -136,7 +143,14 @@ module Effective
136
143
  end
137
144
 
138
145
  def input_js_options
139
- self.class.defaults.merge(active_storage: active_storage, css: css, custom: { css: custom_css })
146
+ case mode
147
+ when :default, :admin
148
+ default_mode.merge(active_storage: active_storage, css: css, custom: { css: custom_css })
149
+ when :restricted
150
+ restricted_mode.merge(active_storage: false, css: css, custom: { css: custom_css })
151
+ else
152
+ raise("unexpected mode: #{mode}. Try :default or :restricted")
153
+ end
140
154
  end
141
155
 
142
156
  def css
@@ -178,6 +192,20 @@ module Effective
178
192
  end
179
193
  end
180
194
 
195
+ def mode
196
+ return @mode unless @mode.nil?
197
+
198
+ @mode = if options.key?(:mode)
199
+ options.delete(:mode)
200
+ else
201
+ select_mode()
202
+ end
203
+ end
204
+
205
+ def select_mode
206
+ EffectiveResources.authorized?(@template, :admin, :effective_article_editor) ? :default : :restricted
207
+ end
208
+
181
209
  end
182
210
  end
183
211
  end
@@ -30,5 +30,11 @@ module EffectiveBootstrap
30
30
  end
31
31
  end
32
32
 
33
+ initializer 'effective_bootstrap.action_mailer' do |app|
34
+ app.config.to_prepare do
35
+ ActionMailer::Base.send(:helper, EffectiveArticleEditorHelper)
36
+ end
37
+ end
38
+
33
39
  end
34
40
  end
@@ -1,3 +1,3 @@
1
1
  module EffectiveBootstrap
2
- VERSION = '0.11.13'.freeze
2
+ VERSION = '0.11.15'.freeze
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: effective_bootstrap
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.11.13
4
+ version: 0.11.15
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-10-13 00:00:00.000000000 Z
11
+ date: 2022-11-07 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails