flexa_lib 0.3.8 → 0.3.9

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.
Files changed (52) hide show
  1. data/flexa_lib.gemspec +1 -1
  2. data/lib/flexa_formtastic_bootstrap/inputs/OLD_boolean_input.rb +33 -0
  3. data/lib/{flexa_lib/inputs/radio_input.rb → flexa_formtastic_bootstrap/inputs/OLD_radio_input.rb} +4 -12
  4. data/lib/flexa_formtastic_bootstrap/inputs/boolean_input.rb +27 -21
  5. data/lib/{flexa_lib → flexa_formtastic_bootstrap}/inputs/date_picker_input.rb +0 -0
  6. data/lib/{flexa_lib → flexa_formtastic_bootstrap}/inputs/lookup_input.rb +0 -0
  7. data/lib/flexa_formtastic_bootstrap/inputs/radio_input.rb +12 -4
  8. data/lib/flexa_formtastic_bootstrap/inputs.rb +5 -0
  9. data/lib/flexa_lib/date_extensions.rb +27 -0
  10. data/lib/flexa_lib.rb +4 -2
  11. data/lib/generators/flexa_lib/crud/templates/view_tables.html.erb +1 -1
  12. data/vendor/assets/javascripts/flexa-themejs.js +79 -0
  13. metadata +292 -299
  14. data/docs/ActionView/Base.html +0 -132
  15. data/docs/ActionView.html +0 -114
  16. data/docs/FlexaLib.html +0 -151
  17. data/docs/created.rid +0 -2
  18. data/docs/images/add.png +0 -0
  19. data/docs/images/brick.png +0 -0
  20. data/docs/images/brick_link.png +0 -0
  21. data/docs/images/bug.png +0 -0
  22. data/docs/images/bullet_black.png +0 -0
  23. data/docs/images/bullet_toggle_minus.png +0 -0
  24. data/docs/images/bullet_toggle_plus.png +0 -0
  25. data/docs/images/date.png +0 -0
  26. data/docs/images/delete.png +0 -0
  27. data/docs/images/find.png +0 -0
  28. data/docs/images/loadingAnimation.gif +0 -0
  29. data/docs/images/macFFBgHack.png +0 -0
  30. data/docs/images/package.png +0 -0
  31. data/docs/images/page_green.png +0 -0
  32. data/docs/images/page_white_text.png +0 -0
  33. data/docs/images/page_white_width.png +0 -0
  34. data/docs/images/plugin.png +0 -0
  35. data/docs/images/ruby.png +0 -0
  36. data/docs/images/tag_blue.png +0 -0
  37. data/docs/images/tag_green.png +0 -0
  38. data/docs/images/transparent.png +0 -0
  39. data/docs/images/wrench.png +0 -0
  40. data/docs/images/wrench_orange.png +0 -0
  41. data/docs/images/zoom.png +0 -0
  42. data/docs/index.html +0 -73
  43. data/docs/js/darkfish.js +0 -153
  44. data/docs/js/jquery.js +0 -18
  45. data/docs/js/navigation.js +0 -142
  46. data/docs/js/search.js +0 -94
  47. data/docs/js/search_index.js +0 -1
  48. data/docs/js/searcher.js +0 -228
  49. data/docs/rdoc.css +0 -543
  50. data/docs/table_of_contents.html +0 -57
  51. data/lib/flexa_lib/inputs/boolean_input.rb +0 -39
  52. data/lib/flexa_lib/inputs.rb +0 -5
data/flexa_lib.gemspec CHANGED
@@ -7,7 +7,7 @@ require 'flexa_lib/version'
7
7
  Gem::Specification.new do |s|
8
8
  s.name = 'flexa_lib'
9
9
  # s.version = FlexaLib::VERSION
10
- s.version = '0.3.8'
10
+ s.version = '0.3.9'
11
11
  s.platform = Gem::Platform::RUBY
12
12
 
13
13
  s.authors = ['Allan Freitas','Marcio Sfalsin']
@@ -0,0 +1,33 @@
1
+ # TODO See if this can be refactored to make use of some of the Choices code.
2
+ module FlexaFormtasticBootstrap
3
+ module Inputs
4
+ class BooleanInput < Formtastic::Inputs::BooleanInput
5
+ include Base
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
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
+ # end
25
+
26
+ # Need this for formatting to work.
27
+ # def empty_label
28
+ # template.content_tag(:label) do end
29
+ # end
30
+
31
+ end
32
+ end
33
+ end
@@ -8,13 +8,13 @@ module FlexaFormtasticBootstrap
8
8
  clearfix_div_wrapping do
9
9
  legend_html <<
10
10
  input_div_wrapping do
11
- #choices_group_wrapping do
11
+ choices_group_wrapping do
12
12
  collection.map { |choice|
13
- #choice_wrapping(choice_wrapping_html_options(choice)) do
13
+ choice_wrapping(choice_wrapping_html_options(choice)) do
14
14
  choice_html(choice)
15
- #end
15
+ end
16
16
  }.join("\n").html_safe
17
- #end
17
+ end
18
18
  end
19
19
  end
20
20
  end
@@ -26,14 +26,6 @@ module FlexaFormtasticBootstrap
26
26
  choice_label(choice)
27
27
  end
28
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
29
 
38
30
  end
39
31
  end
@@ -1,32 +1,38 @@
1
- # TODO See if this can be refactored to make use of some of the Choices code.
2
1
  module FlexaFormtasticBootstrap
3
2
  module Inputs
4
3
  class BooleanInput < Formtastic::Inputs::BooleanInput
5
4
  include Base
6
5
 
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
6
+ def to_html
7
+
8
+ #options[:boolean][:class] = 'checkbox'
9
+
10
+ #label_html_options.merge()
11
+
12
+ clearfix_div_wrapping do
13
+ #empty_label <<
14
+ hidden_field_html <<
15
+ input_div_wrapping(:block) do
20
16
 
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
17
+ label_with_nested_checkbox
18
+ end
19
+ end
20
+ end
21
+
22
+ def wrapper_html_options
23
+ new_class = [super[:class], "checkbox"].compact.join(" ")
24
+ super.merge(:class => new_class)
25
+ end
26
+
27
+ def label_text_with_embedded_checkbox
28
+ # That newline matters! Why, I do no not know.
29
+ check_box_html << "\n" << template.content_tag(:span) do label_text end
30
+ end
25
31
 
26
32
  # Need this for formatting to work.
27
- # def empty_label
28
- # template.content_tag(:label) do end
29
- # end
33
+ def empty_label
34
+ template.content_tag(:label) do end
35
+ end
30
36
 
31
37
  end
32
38
  end
@@ -8,13 +8,13 @@ module FlexaFormtasticBootstrap
8
8
  clearfix_div_wrapping do
9
9
  legend_html <<
10
10
  input_div_wrapping do
11
- choices_group_wrapping do
11
+ #choices_group_wrapping do
12
12
  collection.map { |choice|
13
- choice_wrapping(choice_wrapping_html_options(choice)) do
13
+ #choice_wrapping(choice_wrapping_html_options(choice)) do
14
14
  choice_html(choice)
15
- end
15
+ #end
16
16
  }.join("\n").html_safe
17
- end
17
+ #end
18
18
  end
19
19
  end
20
20
  end
@@ -26,6 +26,14 @@ module FlexaFormtasticBootstrap
26
26
  choice_label(choice)
27
27
  end
28
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
29
37
 
30
38
  end
31
39
  end
@@ -19,6 +19,11 @@ require "flexa_formtastic_bootstrap/inputs/time_input"
19
19
  require "flexa_formtastic_bootstrap/inputs/time_zone_input"
20
20
  require "flexa_formtastic_bootstrap/inputs/url_input"
21
21
 
22
+ #
23
+ #
24
+ require "flexa_formtastic_bootstrap/inputs/date_picker_input"
25
+ require "flexa_formtastic_bootstrap/inputs/lookup_input"
26
+
22
27
  module FlexaFormtasticBootstrap
23
28
  module Inputs
24
29
 
@@ -0,0 +1,27 @@
1
+ Date::DATE_FORMATS[:default] = '%d/%m/%Y'
2
+ Time::DATE_FORMATS[:default]= '%d/%m/%Y %H:%M:%S'
3
+
4
+
5
+ class Date
6
+ class << self
7
+ def _parse_with_us_format(date, *args)
8
+ if date.nil?
9
+ return ''
10
+ end
11
+
12
+ if date =~ %r{^(\d+)/(\d+)/(\d+)$}
13
+ _parse_without_us_format("#{$3.length == 2 ? "20#{$3}" : $3}-#{$1}-#{$2}", *args)
14
+ else
15
+ _parse_without_us_format(date, *args)
16
+ end
17
+ end
18
+ alias_method_chain :_parse, :us_format
19
+ end
20
+ end
21
+
22
+ class NilClass
23
+
24
+ def to_date
25
+ ''
26
+ end
27
+ end
data/lib/flexa_lib.rb CHANGED
@@ -64,8 +64,7 @@ require 'flexa_lib/engine' if defined?(::Rails) # For tests
64
64
  require 'flexa_lib/version'
65
65
 
66
66
  #inputs flexa
67
- require 'flexa_lib/inputs'
68
-
67
+ #require 'flexa_lib/inputs'
69
68
 
70
69
  #helpers flexa
71
70
  require 'flexa_lib/helpers'
@@ -77,6 +76,9 @@ module ActionView
77
76
  end
78
77
 
79
78
 
79
+ #Extensões e Conversoes de DATA
80
+ require 'flexa_lib/date_extensions'
81
+
80
82
 
81
83
  #Extensoes para ActiveRecord
82
84
  require 'active_support'
@@ -1,4 +1,4 @@
1
- <%%= flexa_table_for @<%= plural_resource_name %> do -%>
1
+ <%%= flexa_table_for @<%= plural_resource_name %>,:actions=>[:show,:edit,:delete] do -%>
2
2
  <% columns.each do |col| -%>
3
3
  <%% column :<%=col.name%>, :title=>"<%=col.name.humanize%>" %>
4
4
  <% end %>
@@ -80,6 +80,85 @@ $(document).ready(function(){
80
80
  } catch(err) {
81
81
  null;
82
82
  }
83
+
84
+ $('.datepicker_flexa').keydown( function(evt) {
85
+ var obj = this;
86
+
87
+ if (evt.keyCode == 9){
88
+ ExitDate(obj);
89
+ //evt.returnValue=false;
90
+ //return false;
91
+ }
92
+
93
+ if ((evt.keyCode==48)||(evt.keyCode==49)||(evt.keyCode==50)||(evt.keyCode==51)||(evt.keyCode==52)||(evt.keyCode==53)||(evt.keyCode==54)||(evt.keyCode==55)||(evt.keyCode==56)||(evt.keyCode==57)||(evt.keyCode==96)||(evt.keyCode==97)||(evt.keyCode==98)||(evt.keyCode==99)||(evt.keyCode==100)||(evt.keyCode==101)||(evt.keyCode==102)||(evt.keyCode==103)||(evt.keyCode==104)||(evt.keyCode==105))
94
+ {
95
+ if (obj.value.length==2){
96
+ obj.value = obj.value+"/";
97
+ }
98
+ if (obj.value.length==5){
99
+ obj.value = obj.value+"/";
100
+ }
101
+ if (obj.value.substr(0,2)>31){
102
+ alert("Data inválida!");
103
+ evt.returnValue=false;
104
+ return false;
105
+ }
106
+ if (obj.value.substr(3,2)>12){
107
+ alert("Data inválida!");
108
+ evt.returnValue=false;
109
+ return false;
110
+ }
111
+ }else if ((evt.keyCode!=8)&&(evt.keyCode!=46)&&(evt.keyCode!=9)&&(evt.keyCode!=37)&&(evt.keyCode!=38)&&(evt.keyCode!=39)&&(evt.keyCode!=40)){
112
+ evt.returnValue=false;
113
+ return false;
114
+ }
115
+ });//fim do keydown
116
+
83
117
 
118
+
119
+ $('.datepicker_flexa').change( function() {
120
+
121
+ });//fim do change
84
122
  });
123
+
124
+
125
+
126
+ function ExitDate(obj)
127
+
128
+ {
129
+
130
+ if (((obj.value.length<8)&&(obj.value.length>0))||(obj.value.length==9))
131
+
132
+ {
133
+
134
+ alert("Data inválida!");
135
+
136
+ obj.focus();
137
+
138
+ }
139
+
140
+ if (obj.value.length==8)
141
+
142
+ {
143
+
144
+ if (obj.value.substr(6,2)<17)
145
+
146
+ {
147
+
148
+ obj.value = obj.value.substr(0,6)+"20"+obj.value.substr(6,2);
149
+
150
+ }
151
+
152
+ else
153
+
154
+ {
155
+
156
+ obj.value = obj.value.substr(0,6)+"19"+obj.value.substr(6,2);
157
+
158
+ }
159
+
160
+ }
161
+
162
+ }
163
+
85
164
  //fim do arquivo flexa-themejs.js