effective_bootstrap 0.11.14 → 0.11.16

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: 848fb136fecffedd81eac47539676db7be177b0416fb222e4b9e152233308dc3
4
- data.tar.gz: 1b514490cbc2b00d40ab118a455df977ff0b3f2cd9293ae9db5e74b7675c4e8d
3
+ metadata.gz: e2175b1d7e4f1ac7a6a097555260b36d6ddae38e76bdd48fc95b8aad3d2b74ab
4
+ data.tar.gz: ca1d58ee920c2d55afb4e5df81b01774e978aeb5ba1b3826f747d803e13f252f
5
5
  SHA512:
6
- metadata.gz: dc6df6d54902724a5a96b537f73dc325025f8fffd2ba086ee2bd857378cd06839a971e78ea59f870a066eacd7408c6073ba1d48346624f71500dcba09e229aa3
7
- data.tar.gz: dbe501f91e7ebb8524cbc8effff86ee1e499bc18beed91765176263b35ac529b98154529130667466ab3475e3f1597f7d436d876563e682402e71a192b5b8d38
6
+ metadata.gz: 75c6c84817311517738d7726bfe72bf4748aae7cd22a772a2de7c4a2450184c6e6e1ea951ca65dbdb00502d1d33f8a751a8abf32d81bc62188d27f8d04e05bbc
7
+ data.tar.gz: 4ae8ad5fd75245078c5c61565d49887f46e2c3505cedbb91f629cf868d7271c9e3d03243ec45d8046b2499f5b42f5599c1ee148df5f7eb8ea2e3343fcfc4c346
@@ -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,8 +72,37 @@ 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'],
105
+
97
106
  quote: {
98
107
  template: '<blockquote class="blockquote text-center"><p class="mb-0"><strong>A well-known quote, contained in a blockquote element.</strong></p></blockquote>'
99
108
  },
@@ -105,26 +114,29 @@ module Effective
105
114
  'striped': { title: 'Striped', classname: 'table-striped' },
106
115
  }
107
116
  },
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
- }
117
+ topbar: {
118
+ undoredo: true,
119
+ shortcuts: true
120
+ },
119
121
  }
120
122
  end
121
123
 
122
- def content
123
- if defined?(ActionText::RichText) && value.kind_of?(ActionText::RichText)
124
- return value.body&.to_html
125
- end
124
+ def default_mode
125
+ self.class.defaults
126
+ end
126
127
 
127
- value
128
+ def restricted_mode
129
+ self.class.defaults.merge(
130
+ code: false,
131
+ editor: { csscache: true, https: true, drop: false },
132
+ embed: false,
133
+ image: false,
134
+ plugins: ['blockcode', 'cellcolor', 'inlineformat', 'listitem', 'removeformat', 'reorder', 'style']
135
+ )
136
+ end
137
+
138
+ def content
139
+ (defined?(ActionText::RichText) && value.kind_of?(ActionText::RichText)) ? value.body&.to_html : value
128
140
  end
129
141
 
130
142
  def build_input(&block)
@@ -136,7 +148,14 @@ module Effective
136
148
  end
137
149
 
138
150
  def input_js_options
139
- self.class.defaults.merge(active_storage: active_storage, css: css, custom: { css: custom_css })
151
+ case mode
152
+ when :default, :admin
153
+ default_mode.merge(active_storage: active_storage, css: css, custom: { css: custom_css })
154
+ when :restricted
155
+ restricted_mode.merge(active_storage: false, css: css, custom: { css: custom_css })
156
+ else
157
+ raise("unexpected mode: #{mode}. Try :default or :restricted")
158
+ end
140
159
  end
141
160
 
142
161
  def css
@@ -178,6 +197,20 @@ module Effective
178
197
  end
179
198
  end
180
199
 
200
+ def mode
201
+ return @mode unless @mode.nil?
202
+
203
+ @mode = if options.key?(:mode)
204
+ options.delete(:mode)
205
+ else
206
+ select_mode()
207
+ end
208
+ end
209
+
210
+ def select_mode
211
+ EffectiveResources.authorized?(@template, :admin, :effective_article_editor) ? :default : :restricted
212
+ end
213
+
181
214
  end
182
215
  end
183
216
  end
@@ -1,3 +1,3 @@
1
1
  module EffectiveBootstrap
2
- VERSION = '0.11.14'.freeze
2
+ VERSION = '0.11.16'.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.14
4
+ version: 0.11.16
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-22 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