flexa_lib 0.3.2 → 0.3.3
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.
- data/flexa_lib.gemspec +1 -1
- data/lib/flexa_formtastic_bootstrap/inputs/boolean_input.rb +20 -20
- data/lib/flexa_lib/inputs/boolean_input.rb +6 -4
- data/lib/flexa_lib/inputs/radio_input.rb +40 -0
- data/lib/flexa_lib/inputs.rb +1 -0
- data/lib/flexa_lib/model_extensions.rb +1 -20
- data/vendor/assets/images/icon_error.gif +0 -0
- data/vendor/assets/images/icon_sucess.gif +0 -0
- data/vendor/assets/stylesheets/flexa-theme.css.scss +5 -1
- metadata +6 -3
data/flexa_lib.gemspec
CHANGED
|
@@ -4,29 +4,29 @@ module FlexaFormtasticBootstrap
|
|
|
4
4
|
class BooleanInput < Formtastic::Inputs::BooleanInput
|
|
5
5
|
include Base
|
|
6
6
|
|
|
7
|
-
def to_html
|
|
8
|
-
clearfix_div_wrapping do
|
|
9
|
-
empty_label <<
|
|
10
|
-
hidden_field_html <<
|
|
11
|
-
input_div_wrapping(:block) do
|
|
12
|
-
template.content_tag(:ul, :class => "inputs-list") do
|
|
13
|
-
template.content_tag(:li) do
|
|
14
|
-
label_with_nested_checkbox
|
|
15
|
-
end
|
|
16
|
-
end
|
|
17
|
-
end
|
|
18
|
-
end
|
|
19
|
-
end
|
|
7
|
+
# def to_html
|
|
8
|
+
## clearfix_div_wrapping do
|
|
9
|
+
# empty_label <<
|
|
10
|
+
# hidden_field_html <<
|
|
11
|
+
# input_div_wrapping(:block) do
|
|
12
|
+
# template.content_tag(:ul, :class => "inputs-list") do
|
|
13
|
+
# template.content_tag(:li) do
|
|
14
|
+
# label_with_nested_checkbox
|
|
15
|
+
# end
|
|
16
|
+
# end
|
|
17
|
+
# end
|
|
18
|
+
# end
|
|
19
|
+
# end
|
|
20
20
|
|
|
21
|
-
def label_text_with_embedded_checkbox
|
|
22
|
-
# That newline matters! Why, I do no not know.
|
|
23
|
-
check_box_html << "\n" << template.content_tag(:span) do label_text end
|
|
24
|
-
|
|
21
|
+
# def label_text_with_embedded_checkbox
|
|
22
|
+
# # That newline matters! Why, I do no not know.
|
|
23
|
+
# check_box_html << "\n" << template.content_tag(:span) do label_text end
|
|
24
|
+
# end
|
|
25
25
|
|
|
26
26
|
# Need this for formatting to work.
|
|
27
|
-
def empty_label
|
|
28
|
-
template.content_tag(:label) do end
|
|
29
|
-
end
|
|
27
|
+
# def empty_label
|
|
28
|
+
# template.content_tag(:label) do end
|
|
29
|
+
# end
|
|
30
30
|
|
|
31
31
|
end
|
|
32
32
|
end
|
|
@@ -13,14 +13,16 @@ module FlexaFormtasticBootstrap
|
|
|
13
13
|
#empty_label <<
|
|
14
14
|
hidden_field_html <<
|
|
15
15
|
input_div_wrapping(:block) do
|
|
16
|
-
|
|
17
|
-
#template.content_tag(:li) do
|
|
16
|
+
|
|
18
17
|
label_with_nested_checkbox
|
|
19
|
-
#end
|
|
20
|
-
#end
|
|
21
18
|
end
|
|
22
19
|
end
|
|
23
20
|
end
|
|
21
|
+
|
|
22
|
+
def wrapper_html_options
|
|
23
|
+
new_class = [super[:class], "checkbox"].compact.join(" ")
|
|
24
|
+
super.merge(:class => new_class)
|
|
25
|
+
end
|
|
24
26
|
|
|
25
27
|
def label_text_with_embedded_checkbox
|
|
26
28
|
# That newline matters! Why, I do no not know.
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
module FlexaFormtasticBootstrap
|
|
2
|
+
module Inputs
|
|
3
|
+
class RadioInput < Formtastic::Inputs::RadioInput
|
|
4
|
+
include Base
|
|
5
|
+
include Base::Choices
|
|
6
|
+
|
|
7
|
+
def to_html
|
|
8
|
+
clearfix_div_wrapping do
|
|
9
|
+
legend_html <<
|
|
10
|
+
input_div_wrapping do
|
|
11
|
+
#choices_group_wrapping do
|
|
12
|
+
collection.map { |choice|
|
|
13
|
+
#choice_wrapping(choice_wrapping_html_options(choice)) do
|
|
14
|
+
choice_html(choice)
|
|
15
|
+
#end
|
|
16
|
+
}.join("\n").html_safe
|
|
17
|
+
#end
|
|
18
|
+
end
|
|
19
|
+
end
|
|
20
|
+
end
|
|
21
|
+
|
|
22
|
+
def choice_html(choice)
|
|
23
|
+
template.content_tag(:label, label_html_options.merge(:for => choice_input_dom_id(choice), :class => nil)) do
|
|
24
|
+
builder.radio_button(input_name, choice_value(choice), input_html_options.merge(choice_html_options(choice)).merge(:required => false)) <<
|
|
25
|
+
|
|
26
|
+
choice_label(choice)
|
|
27
|
+
end
|
|
28
|
+
end
|
|
29
|
+
|
|
30
|
+
def legend_html
|
|
31
|
+
if render_label?
|
|
32
|
+
template.content_tag(:label, label_text,:class => "label_radio")
|
|
33
|
+
else
|
|
34
|
+
"".html_safe
|
|
35
|
+
end
|
|
36
|
+
end
|
|
37
|
+
|
|
38
|
+
end
|
|
39
|
+
end
|
|
40
|
+
end
|
data/lib/flexa_lib/inputs.rb
CHANGED
|
@@ -32,26 +32,7 @@ module FlexaLib
|
|
|
32
32
|
paginate(options)
|
|
33
33
|
end
|
|
34
34
|
end
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
def flexa_search_by_sql(options)
|
|
38
|
-
options = options.dup
|
|
39
|
-
|
|
40
|
-
search_options = options.fetch(:search) { raise ArgumentError, ":search is required" }
|
|
41
|
-
likes_search = search_options.fetch(:fields) { raise ArgumentError, ":fields is required" }
|
|
42
|
-
text_search = search_options.fetch(:text) { raise ArgumentError, ":text is required" }
|
|
43
|
-
|
|
44
|
-
options.delete(:search)
|
|
45
|
-
|
|
46
|
-
if text_search.length > 0 and likes_search.count > 0
|
|
47
|
-
|
|
48
|
-
likes_search.collect! {|x| "(UPPER("+x+") LIKE UPPER(:search))"}
|
|
49
|
-
paginate(options).where(likes_search.join(' OR '), :search => "%"+text_search.to_s+"%")
|
|
50
|
-
else
|
|
51
|
-
paginate(options)
|
|
52
|
-
end
|
|
53
|
-
end
|
|
54
|
-
|
|
35
|
+
|
|
55
36
|
end #fim do modulo PesquisaWrapper
|
|
56
37
|
|
|
57
38
|
# adicionar ao ActiveRecord
|
|
Binary file
|
|
Binary file
|
metadata
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: flexa_lib
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
hash:
|
|
4
|
+
hash: 21
|
|
5
5
|
prerelease:
|
|
6
6
|
segments:
|
|
7
7
|
- 0
|
|
8
8
|
- 3
|
|
9
|
-
-
|
|
10
|
-
version: 0.3.
|
|
9
|
+
- 3
|
|
10
|
+
version: 0.3.3
|
|
11
11
|
platform: ruby
|
|
12
12
|
authors:
|
|
13
13
|
- Allan Freitas
|
|
@@ -149,6 +149,8 @@ files:
|
|
|
149
149
|
- vendor/assets/javascripts/bootstrap-tooltip.js
|
|
150
150
|
- vendor/assets/images/glyphicons-halflings.png
|
|
151
151
|
- vendor/assets/images/glyphicons-halflings-white.png
|
|
152
|
+
- vendor/assets/images/icon_error.gif
|
|
153
|
+
- vendor/assets/images/icon_sucess.gif
|
|
152
154
|
- lib/action_view/helpers/text_field_date_helper.rb
|
|
153
155
|
- lib/flexa_lib/inputs.rb
|
|
154
156
|
- lib/flexa_lib/model_extensions.rb
|
|
@@ -172,6 +174,7 @@ files:
|
|
|
172
174
|
- lib/flexa_lib/helpers/link_helpers.rb
|
|
173
175
|
- lib/flexa_lib/inputs/date_picker_input.rb
|
|
174
176
|
- lib/flexa_lib/inputs/lookup_input.rb
|
|
177
|
+
- lib/flexa_lib/inputs/radio_input.rb
|
|
175
178
|
- lib/flexa_lib/inputs/boolean_input.rb
|
|
176
179
|
- lib/flexa_lib/helpers.rb
|
|
177
180
|
- lib/generators/flexa_lib/crud/crud_generator.rb
|