effective_bootstrap 0.9.27 → 0.9.32
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 +4 -4
- data/MIT-LICENSE +1 -1
- data/app/assets/images/icons/reorder.svg +10 -0
- data/app/assets/javascripts/effective_article_editor/initialize.js.coffee +18 -0
- data/app/assets/javascripts/effective_article_editor/input.js +1 -0
- data/app/assets/javascripts/effective_bootstrap.js +1 -0
- data/app/assets/stylesheets/effective_article_editor/content.scss +3 -0
- data/app/assets/stylesheets/effective_article_editor/input.scss +3 -0
- data/app/assets/stylesheets/effective_bootstrap.scss +1 -0
- data/app/assets/stylesheets/effective_bootstrap_article_editor.scss +1 -0
- data/app/models/effective/form_builder.rb +4 -0
- data/app/models/effective/form_inputs/article_editor.rb +82 -0
- data/app/models/effective/form_inputs/has_many.rb +1 -1
- data/config/effective_bootstrap.rb +0 -22
- data/lib/effective_bootstrap.rb +4 -23
- data/lib/effective_bootstrap/engine.rb +5 -1
- data/lib/effective_bootstrap/version.rb +1 -1
- metadata +25 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 5e4006da022d1652bd4ca72bdc01f74262206efc1353d73b98e532b4c19c08b7
|
4
|
+
data.tar.gz: 2211cb0defef54a536616e3990f055454e09fb6344e9f612f014884122e76ad6
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 854a6a64b6df52e43acd1ea92657bf77b3772046e6b09f244077347f9d060d9642ee17793e0f80ded0b77606505d883b2ffc2af49a6c595e1ed1509ac2415244
|
7
|
+
data.tar.gz: bec57138a80b59d82faa2647682636ae054a6cffebfdb3a00d1f1eb13452e534195d1b36cbedd6471d28aaa2520ddd2b5b7792e32eb5193c8a1378cb266c65e2
|
data/MIT-LICENSE
CHANGED
@@ -0,0 +1,10 @@
|
|
1
|
+
<svg width="24" height="21" viewBox="0 0 24 24" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" class="feather feather-reorder">
|
2
|
+
<g stroke="none" stroke-width="1" fill="none" fill-rule="evenodd">
|
3
|
+
<rect fill="currentColor" x="4" y="0" width="14" height="3"></rect>
|
4
|
+
<rect fill="currentColor" x="0" y="6" width="14" height="3"></rect>
|
5
|
+
<rect fill="currentColor" x="4" y="12" width="14" height="3"></rect>
|
6
|
+
<rect fill="currentColor" x="4" y="18" width="14" height="3"></rect>
|
7
|
+
<path d="M20,1.5 C20.4444444,1.5 20.9444444,1.5 21.5,1.5 C22.5,1.5 23,2.5 23,4.5 C23,6.5 22.5,7.5 21.5,7.5 C20.1111111,7.5 18.9444444,7.5 18,7.5" stroke="currentColor" stroke-width="1.5" stroke-linecap="square"></path>
|
8
|
+
<path d="M17,6.25929613 L19.3981159,9 L14.6018841,9 L17,6.25929613 Z" stroke="currentColor" fill="currentColor" transform="translate(17.000000, 7.500000) scale(-1, 1) rotate(90.000000) translate(-17.000000, -7.500000) "></path>
|
9
|
+
</g>
|
10
|
+
</svg>
|
@@ -0,0 +1,18 @@
|
|
1
|
+
# https://imperavi.com/article/
|
2
|
+
|
3
|
+
uploadActiveStorage = (editor, data) ->
|
4
|
+
for file in data.files
|
5
|
+
upload = new ActiveStorage.DirectUpload(file, '/rails/active_storage/direct_uploads')
|
6
|
+
|
7
|
+
upload.create (error, blob) =>
|
8
|
+
url = '/rails/active_storage/blobs/redirect/' + blob.signed_id + '/' + blob.filename
|
9
|
+
editor.complete({ file: { url: url }}, data.e)
|
10
|
+
|
11
|
+
(this.EffectiveBootstrap || {}).effective_article_editor = ($element, options) ->
|
12
|
+
|
13
|
+
if options['active_storage']
|
14
|
+
options['image'] = {
|
15
|
+
upload: (editor, data) -> uploadActiveStorage(editor, data)
|
16
|
+
}
|
17
|
+
|
18
|
+
ArticleEditor($element, options)
|
@@ -0,0 +1 @@
|
|
1
|
+
//= require ./initialize
|
@@ -0,0 +1 @@
|
|
1
|
+
@import 'effective_article_editor/content';
|
@@ -22,6 +22,10 @@ module Effective
|
|
22
22
|
alias_method :super_text_area, :text_area
|
23
23
|
alias_method :super_hidden_field, :hidden_field
|
24
24
|
|
25
|
+
def article_editor(name, options = {}, &block)
|
26
|
+
Effective::FormInputs::ArticleEditor.new(name, options, builder: self).to_html(&block)
|
27
|
+
end
|
28
|
+
|
25
29
|
def clear(name = 'Clear', options = {})
|
26
30
|
(options = name; name = 'Clear') if name.kind_of?(Hash)
|
27
31
|
Effective::FormInputs::Clear.new(name, options, builder: self).to_html
|
@@ -0,0 +1,82 @@
|
|
1
|
+
module Effective
|
2
|
+
module FormInputs
|
3
|
+
class ArticleEditor < Effective::FormInput
|
4
|
+
|
5
|
+
# https://imperavi.com/article/docs/settings/
|
6
|
+
def self.defaults
|
7
|
+
{
|
8
|
+
active_storage: nil,
|
9
|
+
css: '/assets/article_editor/',
|
10
|
+
custom: {
|
11
|
+
css: ['/assets/application.css', '/assets/effective_bootstrap_article_editor.css']
|
12
|
+
},
|
13
|
+
classes: {
|
14
|
+
body: 'article-editor-body',
|
15
|
+
table: 'table'
|
16
|
+
},
|
17
|
+
grid: {
|
18
|
+
classname: 'row',
|
19
|
+
columns: 12,
|
20
|
+
gutter: '1px',
|
21
|
+
offset: {
|
22
|
+
left: '15px',
|
23
|
+
right: '15px',
|
24
|
+
},
|
25
|
+
patterns: {
|
26
|
+
'6|6': 'col-sm-6|col-sm-6',
|
27
|
+
'4|4|4': 'col-sm-4|col-sm-4|col-sm-4',
|
28
|
+
'3|3|3|3': 'col-sm-3|col-sm-3|col-sm-3|col-sm-3',
|
29
|
+
'2|2|2|2|2|2': 'col-sm-2|col-sm-2|col-sm-2|col-sm-2|col-sm-2|col-sm-2',
|
30
|
+
'3|6|3': 'col-sm-3|col-sm-6|col-sm-3',
|
31
|
+
'2|8|2': 'col-sm-2|col-sm-8|col-sm-2',
|
32
|
+
'5|7': 'col-sm-5|col-sm-7',
|
33
|
+
'7|5': 'col-sm-7|col-sm-5',
|
34
|
+
'4|8': 'col-sm-4|col-sm-8',
|
35
|
+
'8|4': 'col-sm-8|col-sm-4',
|
36
|
+
'3|9': 'col-sm-3|col-sm-9',
|
37
|
+
'9|3': 'col-sm-9|col-sm-3',
|
38
|
+
'2|10': 'col-sm-2|col-sm-10',
|
39
|
+
'10|2': 'col-sm-10|col-sm-2',
|
40
|
+
'12': 'col-sm-12'
|
41
|
+
}
|
42
|
+
},
|
43
|
+
plugins: ['blockcode', 'imageposition', 'imageresize', 'inlineformat', 'removeformat', 'reorder', 'style'],
|
44
|
+
quote: {
|
45
|
+
template: '<blockquote><p></p></blockquote>'
|
46
|
+
},
|
47
|
+
styles: {
|
48
|
+
table: {
|
49
|
+
'bordered': { title: 'Bordered', classname: 'table-bordered' },
|
50
|
+
'responsive': { title: 'Responsive', classname: 'table-responsive' },
|
51
|
+
'small': { title: 'Small', classname: 'table-sm' },
|
52
|
+
'striped': { title: 'Striped', classname: 'table-striped' },
|
53
|
+
}
|
54
|
+
}
|
55
|
+
}
|
56
|
+
end
|
57
|
+
|
58
|
+
def build_input(&block)
|
59
|
+
@builder.super_text_area(name, options[:input])
|
60
|
+
end
|
61
|
+
|
62
|
+
def input_html_options
|
63
|
+
{ class: 'effective_article_editor form-control', id: unique_id, autocomplete: 'off' }
|
64
|
+
end
|
65
|
+
|
66
|
+
def input_js_options
|
67
|
+
self.class.defaults.merge(active_storage: active_storage)
|
68
|
+
end
|
69
|
+
|
70
|
+
def active_storage
|
71
|
+
return @active_storage unless @active_storage.nil?
|
72
|
+
|
73
|
+
@active_storage = if options.key?(:active_storage)
|
74
|
+
options.delete(:active_storage)
|
75
|
+
else
|
76
|
+
defined?(ActiveStorage).present?
|
77
|
+
end
|
78
|
+
end
|
79
|
+
|
80
|
+
end
|
81
|
+
end
|
82
|
+
end
|
@@ -1,26 +1,4 @@
|
|
1
1
|
EffectiveBootstrap.setup do |config|
|
2
|
-
# Authorization Method
|
3
|
-
#
|
4
|
-
# This method is called by all controller actions with the appropriate action and resource
|
5
|
-
# If it raises an exception or returns false, an Effective::AccessDenied Error will be raised
|
6
|
-
#
|
7
|
-
# Use via Proc:
|
8
|
-
# Proc.new { |controller, action, resource| authorize!(action, resource) } # CanCan
|
9
|
-
# Proc.new { |controller, action, resource| can?(action, resource) } # CanCan with skip_authorization_check
|
10
|
-
# Proc.new { |controller, action, resource| authorize "#{action}?", resource } # Pundit
|
11
|
-
# Proc.new { |controller, action, resource| current_user.is?(:admin) } # Custom logic
|
12
|
-
#
|
13
|
-
# Use via Boolean:
|
14
|
-
# config.authorization_method = true # Always authorized
|
15
|
-
# config.authorization_method = false # Always unauthorized
|
16
|
-
#
|
17
|
-
# Use via Method (probably in your application_controller.rb):
|
18
|
-
# config.authorization_method = :my_authorization_method
|
19
|
-
# def my_authorization_method(resource, action)
|
20
|
-
# true
|
21
|
-
# end
|
22
|
-
config.authorization_method = Proc.new { |controller, action, resource| authorize!(action, resource) }
|
23
|
-
|
24
2
|
# Replaces rails_ujs data-confirm with a custom inline implementation.
|
25
3
|
# You will need to recompile assets (or "rm -rf tmp/") if you change this.
|
26
4
|
config.use_custom_data_confirm = true
|
data/lib/effective_bootstrap.rb
CHANGED
@@ -1,33 +1,14 @@
|
|
1
1
|
require 'inline_svg'
|
2
|
+
require 'effective_resources'
|
2
3
|
require 'effective_bootstrap/engine'
|
3
4
|
require 'effective_bootstrap/version'
|
4
5
|
|
5
6
|
module EffectiveBootstrap
|
6
7
|
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
mattr_accessor :use_custom_data_confirm
|
11
|
-
|
12
|
-
def self.setup
|
13
|
-
yield self
|
8
|
+
def self.config_keys
|
9
|
+
[:use_custom_data_confirm]
|
14
10
|
end
|
15
11
|
|
16
|
-
|
17
|
-
@_exceptions ||= [Effective::AccessDenied, (CanCan::AccessDenied if defined?(CanCan)), (Pundit::NotAuthorizedError if defined?(Pundit))].compact
|
18
|
-
|
19
|
-
return !!authorization_method unless authorization_method.respond_to?(:call)
|
20
|
-
controller = controller.controller if controller.respond_to?(:controller)
|
21
|
-
|
22
|
-
begin
|
23
|
-
!!(controller || self).instance_exec((controller || self), action, resource, &authorization_method)
|
24
|
-
rescue *@_exceptions
|
25
|
-
false
|
26
|
-
end
|
27
|
-
end
|
28
|
-
|
29
|
-
def self.authorize!(controller, action, resource)
|
30
|
-
raise Effective::AccessDenied.new('Access Denied', action, resource) unless authorized?(controller, action, resource)
|
31
|
-
end
|
12
|
+
include EffectiveGem
|
32
13
|
|
33
14
|
end
|
@@ -8,7 +8,11 @@ module EffectiveBootstrap
|
|
8
8
|
end
|
9
9
|
|
10
10
|
initializer 'effective_bootstrap.assets' do |app|
|
11
|
-
app.config.assets.precompile += [
|
11
|
+
app.config.assets.precompile += [
|
12
|
+
'effective_bootstrap_manifest.js',
|
13
|
+
'effective_bootstrap_article_editor.css',
|
14
|
+
'icons/*'
|
15
|
+
]
|
12
16
|
end
|
13
17
|
|
14
18
|
initializer 'effective_bootstrap.action_text' do |app|
|
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.9.
|
4
|
+
version: 0.9.32
|
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: 2021-
|
11
|
+
date: 2021-06-14 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|
@@ -26,18 +26,32 @@ dependencies:
|
|
26
26
|
version: 4.0.0
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: bootstrap
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - "<"
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '5'
|
34
|
+
type: :runtime
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - "<"
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '5'
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: effective_resources
|
29
43
|
requirement: !ruby/object:Gem::Requirement
|
30
44
|
requirements:
|
31
45
|
- - ">="
|
32
46
|
- !ruby/object:Gem::Version
|
33
|
-
version:
|
47
|
+
version: '0'
|
34
48
|
type: :runtime
|
35
49
|
prerelease: false
|
36
50
|
version_requirements: !ruby/object:Gem::Requirement
|
37
51
|
requirements:
|
38
52
|
- - ">="
|
39
53
|
- !ruby/object:Gem::Version
|
40
|
-
version:
|
54
|
+
version: '0'
|
41
55
|
- !ruby/object:Gem::Dependency
|
42
56
|
name: inline_svg
|
43
57
|
requirement: !ruby/object:Gem::Requirement
|
@@ -319,6 +333,7 @@ files:
|
|
319
333
|
- app/assets/images/icons/radio.svg
|
320
334
|
- app/assets/images/icons/refresh-ccw.svg
|
321
335
|
- app/assets/images/icons/refresh-cw.svg
|
336
|
+
- app/assets/images/icons/reorder.svg
|
322
337
|
- app/assets/images/icons/repeat.svg
|
323
338
|
- app/assets/images/icons/rewind.svg
|
324
339
|
- app/assets/images/icons/rotate-ccw.svg
|
@@ -405,6 +420,8 @@ files:
|
|
405
420
|
- app/assets/images/icons/zap.svg
|
406
421
|
- app/assets/images/icons/zoom-in.svg
|
407
422
|
- app/assets/images/icons/zoom-out.svg
|
423
|
+
- app/assets/javascripts/effective_article_editor/initialize.js.coffee
|
424
|
+
- app/assets/javascripts/effective_article_editor/input.js
|
408
425
|
- app/assets/javascripts/effective_bootstrap.js
|
409
426
|
- app/assets/javascripts/effective_bootstrap/base.js.coffee
|
410
427
|
- app/assets/javascripts/effective_bootstrap/confirm.js.coffee.erb
|
@@ -594,11 +611,14 @@ files:
|
|
594
611
|
- app/assets/javascripts/moment/locale/zh-hk.js
|
595
612
|
- app/assets/javascripts/moment/locale/zh-tw.js
|
596
613
|
- app/assets/javascripts/moment/moment.js
|
614
|
+
- app/assets/stylesheets/effective_article_editor/content.scss
|
615
|
+
- app/assets/stylesheets/effective_article_editor/input.scss
|
597
616
|
- app/assets/stylesheets/effective_bootstrap.scss
|
598
617
|
- app/assets/stylesheets/effective_bootstrap/base.scss
|
599
618
|
- app/assets/stylesheets/effective_bootstrap/forms.scss
|
600
619
|
- app/assets/stylesheets/effective_bootstrap/icons.scss
|
601
620
|
- app/assets/stylesheets/effective_bootstrap/overrides.scss
|
621
|
+
- app/assets/stylesheets/effective_bootstrap_article_editor.scss
|
602
622
|
- app/assets/stylesheets/effective_bootstrap_editor.scss
|
603
623
|
- app/assets/stylesheets/effective_checks/input.scss
|
604
624
|
- app/assets/stylesheets/effective_datetime/bootstrap-datetimepicker.scss
|
@@ -624,6 +644,7 @@ files:
|
|
624
644
|
- app/helpers/effective_icons_helper.rb
|
625
645
|
- app/models/effective/form_builder.rb
|
626
646
|
- app/models/effective/form_input.rb
|
647
|
+
- app/models/effective/form_inputs/article_editor.rb
|
627
648
|
- app/models/effective/form_inputs/check_box.rb
|
628
649
|
- app/models/effective/form_inputs/checks.rb
|
629
650
|
- app/models/effective/form_inputs/ck_editor.rb
|