ui_bibz 2.0.0.alpha12 → 2.0.0.alpha13
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CONTRIBUTORS.md +2 -1
- data/Gemfile.lock +62 -56
- data/app/assets/javascripts/ui_bibz.coffee +4 -0
- data/app/assets/stylesheets/ui_bibz.sass +2 -0
- data/app/inputs/custom_inputs/markdown_editor_input.rb +11 -0
- data/lib/ui_bibz.rb +1 -0
- data/lib/ui_bibz/helpers/ui_core_helper.rb +4 -0
- data/lib/ui_bibz/ui/core/input/autocomplete_field.rb +1 -1
- data/lib/ui_bibz/ui/core/input/date_picker_field.rb +1 -1
- data/lib/ui_bibz/ui/core/input/dropdown_select_field.rb +1 -1
- data/lib/ui_bibz/ui/core/input/formula_field.rb +1 -1
- data/lib/ui_bibz/ui/core/input/markdown_editor_field.rb +112 -0
- data/lib/ui_bibz/ui/core/input/multi_column_field.rb +1 -1
- data/lib/ui_bibz/ui/core/input/multi_select_field.rb +1 -1
- data/lib/ui_bibz/ui/core/input/surround_field.rb +1 -1
- data/lib/ui_bibz/ui/core/list/components/list.rb +1 -1
- data/lib/ui_bibz/version.rb +1 -1
- data/test/dummy/config/environments/test.rb +2 -2
- data/test/ui/inputs_test.rb +8 -0
- data/vendor/assets/javascripts/bootstrap-markdown.js +1470 -0
- data/vendor/assets/javascripts/marked.js +1272 -0
- data/vendor/assets/javascripts/to-markdown.js +785 -0
- data/vendor/assets/stylesheets/bootstrap-markdown.min.css +1 -0
- metadata +8 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 5445470503d84e12fb8edf794a73fd83f93e3932
|
4
|
+
data.tar.gz: 54275fdf4e05e2c8f58a04477fa3230ea47e9423
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: b029329ffab60ff04889dc9878eff875e67c0672f19bb87e3477e8a6173c8b04867a03b8b51d2131626b05b35bb76f97c8889b0f7449e8979ce1dc010d0d819d
|
7
|
+
data.tar.gz: da46770e967c4f0ec9bb3d22cb5a6075077c301de08e5573b447353386c969495809b5a1f476c3ec1aa5db7626036849a84c0ef6914d5ad7d1853077d67ff586
|
data/CONTRIBUTORS.md
CHANGED
@@ -20,4 +20,5 @@
|
|
20
20
|
* [bootstrap-multiselect](https://github.com/davidstutz/bootstrap-multiselect)
|
21
21
|
* [Louis Cuny](https://github.com/lou)
|
22
22
|
* [multi-select](https://github.com/lou/multi-select/)
|
23
|
-
|
23
|
+
* [Taufan Aditya](https://github.com/toopay)
|
24
|
+
* [boostrap-markdown](https://github.com/toopay/bootstrap-markdown)
|
data/Gemfile.lock
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
ui_bibz (2.0.0.
|
4
|
+
ui_bibz (2.0.0.alpha13)
|
5
5
|
bootstrap (< 4.0.0.alpha3)
|
6
6
|
bundler (>= 1.8.4)
|
7
7
|
font-awesome-sass
|
@@ -16,50 +16,52 @@ PATH
|
|
16
16
|
GEM
|
17
17
|
remote: https://rubygems.org/
|
18
18
|
specs:
|
19
|
-
|
20
|
-
actionpack (=
|
21
|
-
|
22
|
-
|
19
|
+
actioncable (5.0.0)
|
20
|
+
actionpack (= 5.0.0)
|
21
|
+
nio4r (~> 1.2)
|
22
|
+
websocket-driver (~> 0.6.1)
|
23
|
+
actionmailer (5.0.0)
|
24
|
+
actionpack (= 5.0.0)
|
25
|
+
actionview (= 5.0.0)
|
26
|
+
activejob (= 5.0.0)
|
23
27
|
mail (~> 2.5, >= 2.5.4)
|
24
|
-
rails-dom-testing (~>
|
25
|
-
actionpack (
|
26
|
-
actionview (=
|
27
|
-
activesupport (=
|
28
|
-
rack (~>
|
29
|
-
rack-test (~> 0.6.
|
30
|
-
rails-dom-testing (~>
|
28
|
+
rails-dom-testing (~> 2.0)
|
29
|
+
actionpack (5.0.0)
|
30
|
+
actionview (= 5.0.0)
|
31
|
+
activesupport (= 5.0.0)
|
32
|
+
rack (~> 2.0)
|
33
|
+
rack-test (~> 0.6.3)
|
34
|
+
rails-dom-testing (~> 2.0)
|
31
35
|
rails-html-sanitizer (~> 1.0, >= 1.0.2)
|
32
|
-
actionview (
|
33
|
-
activesupport (=
|
36
|
+
actionview (5.0.0)
|
37
|
+
activesupport (= 5.0.0)
|
34
38
|
builder (~> 3.1)
|
35
39
|
erubis (~> 2.7.0)
|
36
|
-
rails-dom-testing (~>
|
40
|
+
rails-dom-testing (~> 2.0)
|
37
41
|
rails-html-sanitizer (~> 1.0, >= 1.0.2)
|
38
|
-
activejob (
|
39
|
-
activesupport (=
|
40
|
-
globalid (>= 0.3.
|
41
|
-
activemodel (
|
42
|
-
activesupport (=
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
42
|
+
activejob (5.0.0)
|
43
|
+
activesupport (= 5.0.0)
|
44
|
+
globalid (>= 0.3.6)
|
45
|
+
activemodel (5.0.0)
|
46
|
+
activesupport (= 5.0.0)
|
47
|
+
activerecord (5.0.0)
|
48
|
+
activemodel (= 5.0.0)
|
49
|
+
activesupport (= 5.0.0)
|
50
|
+
arel (~> 7.0)
|
51
|
+
activesupport (5.0.0)
|
52
|
+
concurrent-ruby (~> 1.0, >= 1.0.2)
|
49
53
|
i18n (~> 0.7)
|
50
|
-
json (~> 1.7, >= 1.7.7)
|
51
54
|
minitest (~> 5.1)
|
52
|
-
thread_safe (~> 0.3, >= 0.3.4)
|
53
55
|
tzinfo (~> 1.1)
|
54
|
-
arel (
|
55
|
-
autoprefixer-rails (6.3.
|
56
|
+
arel (7.0.0)
|
57
|
+
autoprefixer-rails (6.3.7)
|
56
58
|
execjs
|
57
59
|
awesome_print (1.7.0)
|
58
60
|
bootstrap (4.0.0.alpha2)
|
59
61
|
autoprefixer-rails (>= 6.0.3)
|
60
62
|
sass (>= 3.4.19)
|
61
63
|
builder (3.2.2)
|
62
|
-
codeclimate-test-reporter (0.
|
64
|
+
codeclimate-test-reporter (0.6.0)
|
63
65
|
simplecov (>= 0.7.1, < 1.0.0)
|
64
66
|
concurrent-ruby (1.0.2)
|
65
67
|
docile (1.1.5)
|
@@ -93,40 +95,41 @@ GEM
|
|
93
95
|
nokogiri (>= 1.5.9)
|
94
96
|
mail (2.6.4)
|
95
97
|
mime-types (>= 1.16, < 4)
|
98
|
+
method_source (0.8.2)
|
96
99
|
mime-types (3.1)
|
97
100
|
mime-types-data (~> 3.2015)
|
98
101
|
mime-types-data (3.2016.0521)
|
99
102
|
mini_portile2 (2.1.0)
|
100
103
|
minitest (5.9.0)
|
104
|
+
nio4r (1.2.1)
|
101
105
|
nokogiri (1.6.8)
|
102
106
|
mini_portile2 (~> 2.1.0)
|
103
107
|
pkg-config (~> 1.1.7)
|
104
108
|
pkg-config (1.1.7)
|
105
|
-
rack (
|
109
|
+
rack (2.0.1)
|
106
110
|
rack-test (0.6.3)
|
107
111
|
rack (>= 1.0)
|
108
|
-
rails (
|
109
|
-
|
110
|
-
|
111
|
-
|
112
|
-
|
113
|
-
|
114
|
-
|
115
|
-
|
112
|
+
rails (5.0.0)
|
113
|
+
actioncable (= 5.0.0)
|
114
|
+
actionmailer (= 5.0.0)
|
115
|
+
actionpack (= 5.0.0)
|
116
|
+
actionview (= 5.0.0)
|
117
|
+
activejob (= 5.0.0)
|
118
|
+
activemodel (= 5.0.0)
|
119
|
+
activerecord (= 5.0.0)
|
120
|
+
activesupport (= 5.0.0)
|
116
121
|
bundler (>= 1.3.0, < 2.0)
|
117
|
-
railties (=
|
118
|
-
sprockets-rails
|
119
|
-
rails-
|
120
|
-
activesupport (>= 4.2.0.
|
121
|
-
rails-dom-testing (1.0.7)
|
122
|
-
activesupport (>= 4.2.0.beta, < 5.0)
|
122
|
+
railties (= 5.0.0)
|
123
|
+
sprockets-rails (>= 2.0.0)
|
124
|
+
rails-dom-testing (2.0.1)
|
125
|
+
activesupport (>= 4.2.0, < 6.0)
|
123
126
|
nokogiri (~> 1.6.0)
|
124
|
-
rails-deprecated_sanitizer (>= 1.0.1)
|
125
127
|
rails-html-sanitizer (1.0.3)
|
126
128
|
loofah (~> 2.0)
|
127
|
-
railties (
|
128
|
-
actionpack (=
|
129
|
-
activesupport (=
|
129
|
+
railties (5.0.0)
|
130
|
+
actionpack (= 5.0.0)
|
131
|
+
activesupport (= 5.0.0)
|
132
|
+
method_source
|
130
133
|
rake (>= 0.8.7)
|
131
134
|
thor (>= 0.18.1, < 2.0)
|
132
135
|
rake (11.2.2)
|
@@ -135,22 +138,22 @@ GEM
|
|
135
138
|
ruby_parser (3.8.2)
|
136
139
|
sexp_processor (~> 4.1)
|
137
140
|
sass (3.4.22)
|
138
|
-
sass-rails (5.0.
|
139
|
-
railties (>= 4.0.0, <
|
141
|
+
sass-rails (5.0.5)
|
142
|
+
railties (>= 4.0.0, < 6)
|
140
143
|
sass (~> 3.1)
|
141
144
|
sprockets (>= 2.8, < 4.0)
|
142
145
|
sprockets-rails (>= 2.0, < 4.0)
|
143
146
|
tilt (>= 1.1, < 3)
|
144
147
|
sexp_processor (4.7.0)
|
145
|
-
simplecov (0.
|
148
|
+
simplecov (0.12.0)
|
146
149
|
docile (~> 1.1.0)
|
147
|
-
json (
|
150
|
+
json (>= 1.8, < 3)
|
148
151
|
simplecov-html (~> 0.10.0)
|
149
152
|
simplecov-html (0.10.0)
|
150
|
-
sprockets (3.6.
|
153
|
+
sprockets (3.6.3)
|
151
154
|
concurrent-ruby (~> 1.0)
|
152
155
|
rack (> 1, < 3)
|
153
|
-
sprockets-rails (3.
|
156
|
+
sprockets-rails (3.1.1)
|
154
157
|
actionpack (>= 4.0)
|
155
158
|
activesupport (>= 4.0)
|
156
159
|
sprockets (>= 3.0.0)
|
@@ -160,6 +163,9 @@ GEM
|
|
160
163
|
tilt (2.0.5)
|
161
164
|
tzinfo (1.2.2)
|
162
165
|
thread_safe (~> 0.1)
|
166
|
+
websocket-driver (0.6.4)
|
167
|
+
websocket-extensions (>= 0.1.0)
|
168
|
+
websocket-extensions (0.1.2)
|
163
169
|
will-paginate-i18n (0.1.15)
|
164
170
|
will_paginate (3.1.0)
|
165
171
|
will_paginate-bootstrap (1.0.1)
|
@@ -24,6 +24,8 @@ $states_colors: (success: $brand-success, primary: $brand-primary, secondary: $b
|
|
24
24
|
@import bootstrap-multiselect.min
|
25
25
|
// dropdown_select_field component
|
26
26
|
@import bootstrap-select.min
|
27
|
+
// mardown-editor component
|
28
|
+
@import bootstrap-markdown.min
|
27
29
|
|
28
30
|
// fix plugins
|
29
31
|
@import fix-bootstrap-4
|
@@ -0,0 +1,11 @@
|
|
1
|
+
module CustomInputs
|
2
|
+
class MarkdownEditorInput < SimpleForm::Inputs::StringInput
|
3
|
+
include UiBibz::Ui::Core
|
4
|
+
|
5
|
+
def input(wrapper_options)
|
6
|
+
options = @options.merge({ builder: @builder })
|
7
|
+
UiBibz::Ui::Core::MarkdownEditorField.new(attribute_name, options, input_html_options).render
|
8
|
+
end
|
9
|
+
|
10
|
+
end
|
11
|
+
end
|
data/lib/ui_bibz.rb
CHANGED
@@ -31,6 +31,7 @@ module UiBibz
|
|
31
31
|
autoload :DatePickerField, "ui_bibz/ui/core/input/date_picker_field"
|
32
32
|
autoload :DropdownSelectField, "ui_bibz/ui/core/input/dropdown_select_field"
|
33
33
|
autoload :FormulaField, "ui_bibz/ui/core/input/formula_field"
|
34
|
+
autoload :MarkdownEditorField, "ui_bibz/ui/core/input/markdown_editor_field"
|
34
35
|
autoload :MultiColumnField, "ui_bibz/ui/core/input/multi_column_field"
|
35
36
|
autoload :MultiSelectField, "ui_bibz/ui/core/input/multi_select_field"
|
36
37
|
autoload :SurroundField, "ui_bibz/ui/core/input/surround_field"
|
@@ -53,6 +53,10 @@ module UiBibz::Helpers::UiCoreHelper
|
|
53
53
|
UiBibz::Ui::Core::DatePickerField.new(content, options, html_options, &block).render
|
54
54
|
end
|
55
55
|
|
56
|
+
def markdown_editor_field content = nil, options = nil, html_options = nil, &block
|
57
|
+
UiBibz::Ui::Core::MarkdownEditorField.new(content, options, html_options, &block).render
|
58
|
+
end
|
59
|
+
|
56
60
|
def multi_column_field content = nil, options = nil, html_options = nil, &block
|
57
61
|
UiBibz::Ui::Core::MultiColumnField.new(content, options, html_options, &block).render
|
58
62
|
end
|
@@ -68,7 +68,7 @@ module UiBibz::Ui::Core
|
|
68
68
|
|
69
69
|
def component_html_options
|
70
70
|
args = { autocomplete: true, list: data_list_name }
|
71
|
-
args = args.merge(options[:state] == :
|
71
|
+
args = args.merge(options[:state] == :disabled ? { disabled: 'disabled' } : {})
|
72
72
|
args
|
73
73
|
end
|
74
74
|
|
@@ -0,0 +1,112 @@
|
|
1
|
+
module UiBibz::Ui::Core
|
2
|
+
|
3
|
+
# Create a MarkdownEditorField
|
4
|
+
#
|
5
|
+
# This element is an extend of UiBibz::Ui::Core::Component.
|
6
|
+
#
|
7
|
+
# ==== Attributes
|
8
|
+
#
|
9
|
+
# * +content+ - Content of element
|
10
|
+
# * +options+ - Options of element
|
11
|
+
# * +html_options+ - Html Options of element
|
12
|
+
#
|
13
|
+
# ==== Options
|
14
|
+
#
|
15
|
+
# You can add HTML attributes using the +html_options+.
|
16
|
+
# You can pass arguments in options attribute:
|
17
|
+
#
|
18
|
+
# * +state+ - (:disabled, :active)
|
19
|
+
# * +autofocus+ - Boolean
|
20
|
+
# * +savable+ - Boolean
|
21
|
+
# * +hideable+ - Boolean
|
22
|
+
# * +hidden_buttons+ - (Array || String)
|
23
|
+
# * +disabled_buttons+ - (Array || String)
|
24
|
+
#
|
25
|
+
# ==== Signatures
|
26
|
+
#
|
27
|
+
# UiBibz::Ui::Core::MarkdownEditorField.new(content, options = {}, html_options = {}).render
|
28
|
+
#
|
29
|
+
# UiBibz::Ui::Core::MarkdownEditorField.new(options = {}, html_options = {}) do
|
30
|
+
# content
|
31
|
+
# end.render
|
32
|
+
#
|
33
|
+
# ==== Examples
|
34
|
+
#
|
35
|
+
# UiBibz::Ui::Core::MarkdownEditorField.new('search', prepend: 'Prepend content', append: 'Append content', class: 'test')
|
36
|
+
#
|
37
|
+
# UiBibz::Ui::Core::MarkdownEditorField.new(prepend: glyph('pencil'), append: glyph('camera-retro')) do
|
38
|
+
# #content
|
39
|
+
# end
|
40
|
+
#
|
41
|
+
# ==== Helper
|
42
|
+
#
|
43
|
+
# markdown_editor_field(options = {}, html_options = {}) do
|
44
|
+
# # content
|
45
|
+
# end
|
46
|
+
#
|
47
|
+
class MarkdownEditorField < Component
|
48
|
+
|
49
|
+
# See UiBibz::Ui::Core::Component.initialize
|
50
|
+
def initialize content = nil, options = nil, html_options = nil, &block
|
51
|
+
super
|
52
|
+
end
|
53
|
+
|
54
|
+
# Render html tag
|
55
|
+
def render
|
56
|
+
if options[:builder].nil?
|
57
|
+
text_area_tag content, html_options[:value], html_options
|
58
|
+
else
|
59
|
+
options[:builder].text_area content, html_options
|
60
|
+
end
|
61
|
+
end
|
62
|
+
|
63
|
+
private
|
64
|
+
|
65
|
+
def component_html_data
|
66
|
+
provide
|
67
|
+
autofocus
|
68
|
+
savable
|
69
|
+
hideable
|
70
|
+
icon_library
|
71
|
+
hidden_buttons
|
72
|
+
disabled_buttons
|
73
|
+
end
|
74
|
+
|
75
|
+
def provide
|
76
|
+
add_html_data('provide', 'markdown')
|
77
|
+
end
|
78
|
+
|
79
|
+
def autofocus
|
80
|
+
add_html_data('autofocus') if options[:autofocus]
|
81
|
+
end
|
82
|
+
|
83
|
+
def savable
|
84
|
+
add_html_data('savable') if options[:savable]
|
85
|
+
end
|
86
|
+
|
87
|
+
def hideable
|
88
|
+
add_html_data('hideable') if options[:hideable]
|
89
|
+
end
|
90
|
+
|
91
|
+
def icon_library
|
92
|
+
add_html_data('iconlibrary', 'fa')
|
93
|
+
end
|
94
|
+
|
95
|
+
def hidden_buttons
|
96
|
+
add_html_data('hiddenButtons', options[:hidden_buttons]) if options[:hidden_buttons]
|
97
|
+
end
|
98
|
+
|
99
|
+
def disabled_buttons
|
100
|
+
add_html_data('disabledButtons', options[:disabled_buttons]) if options[:disabled_buttons]
|
101
|
+
end
|
102
|
+
|
103
|
+
def status
|
104
|
+
"has-#{ options[:status] }" if options[:status]
|
105
|
+
end
|
106
|
+
|
107
|
+
def component_html_options
|
108
|
+
options[:state] == :disabled ? { disabled: 'disabled' } : {}
|
109
|
+
end
|
110
|
+
|
111
|
+
end
|
112
|
+
end
|
@@ -62,7 +62,7 @@ module UiBibz::Ui::Core
|
|
62
62
|
end
|
63
63
|
|
64
64
|
def component_html_options
|
65
|
-
{ multiple: true }.merge(options[:state] == :
|
65
|
+
{ multiple: true }.merge(options[:state] == :disabled ? { disabled: 'disabled' } : {})
|
66
66
|
end
|
67
67
|
|
68
68
|
def searchable
|
@@ -56,7 +56,7 @@ module UiBibz::Ui::Core
|
|
56
56
|
private
|
57
57
|
|
58
58
|
def component_html_options
|
59
|
-
{ multiple: true }.merge(options[:state] == :
|
59
|
+
{ multiple: true }.merge(options[:state] == :disabled ? { disabled: 'disabled' } : {})
|
60
60
|
end
|
61
61
|
|
62
62
|
def component_html_classes
|
@@ -17,7 +17,7 @@ module UiBibz::Ui::Core
|
|
17
17
|
# You can add HTML attributes using the +html_options+.
|
18
18
|
# You can pass arguments in options attribute:
|
19
19
|
# * +state+ - status of élement with symbol value:
|
20
|
-
# (+:active+, +:
|
20
|
+
# (+:active+, +:disabled+)
|
21
21
|
# * +url+
|
22
22
|
# * +tap+ - Boolean to add header and body
|
23
23
|
# * +status+ - status of élement with symbol value:
|