prime-rails 0.0.7 → 0.0.8
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +8 -8
- data/app/assets/javascripts/primefaces-rails.js +39 -2
- data/app/helpers/growl_helper.rb +50 -0
- data/app/helpers/radiobutton_helper.rb +34 -0
- data/lib/prime/rails/engine.rb +1 -3
- data/lib/prime/rails/form_helper.rb +64 -18
- data/lib/prime/rails/form_tag_helper.rb +45 -45
- data/lib/prime/rails/tags/check_box.rb +45 -0
- data/lib/prime/rails/tags/select.rb +50 -0
- data/lib/prime/rails/url_helper.rb +64 -0
- data/lib/prime/rails/version.rb +1 -1
- metadata +7 -2
checksums.yaml
CHANGED
@@ -1,15 +1,15 @@
|
|
1
1
|
---
|
2
2
|
!binary "U0hBMQ==":
|
3
3
|
metadata.gz: !binary |-
|
4
|
-
|
4
|
+
YmYyMmM4MDc3YWIwMmRiYzAzMGVmMzA1NmRiNzJmOWQ2NmQzOGViMQ==
|
5
5
|
data.tar.gz: !binary |-
|
6
|
-
|
6
|
+
ZmJlYWRiZmRhZGMwZDgwYjdmOTgwNjcwMmU0YzIyZDk1ODZjYmIzYg==
|
7
7
|
SHA512:
|
8
8
|
metadata.gz: !binary |-
|
9
|
-
|
10
|
-
|
11
|
-
|
9
|
+
ZmVkOGMyYTAyYWNiM2ZiMzY1NWZjNzdlNzNlNjhlOGQxYWM4MTViYTcxZjE5
|
10
|
+
NWZhOGI0MDMwZmE2NmE3NGI1NTI5YjMwYjE5NTgyNThmOWQ4NGZiNmQwMDY5
|
11
|
+
YzRkM2U1NGFmYzU0ZDNmNjkxMDQzYjAxOGUwZmY0ZGQyODQzYjk=
|
12
12
|
data.tar.gz: !binary |-
|
13
|
-
|
14
|
-
|
15
|
-
|
13
|
+
MDMzODI1YzQ4Zjc3Nzc0Y2FjOWNhM2Y3YzJkMDljYWY5ZTk3MzVkMmUyMTUw
|
14
|
+
MmYzZWI0MDc0MjcyMDRlNjYyZjZhYzQ0YmY5YzVmMDlhYmY4ZjkyZmIyMWYz
|
15
|
+
M2E1NzQ5MjAwODFhNjJkYjFjMTRlMGZkMGMzMWIxODk3ODI2M2E=
|
@@ -12,7 +12,11 @@ String.prototype.format = function (args) {
|
|
12
12
|
PrimeFaces.widget.InputText = PrimeFaces.widget.BaseWidget.extend({
|
13
13
|
init: function(cfg) {
|
14
14
|
this._super(cfg);
|
15
|
-
|
15
|
+
if (cfg.spinner) {
|
16
|
+
this.jq.puispinner(cfg);
|
17
|
+
} else {
|
18
|
+
this.jq.puiinputtext(cfg);
|
19
|
+
}
|
16
20
|
}
|
17
21
|
});
|
18
22
|
|
@@ -147,7 +151,11 @@ PrimeFaces.widget.Dropdown = PrimeFaces.widget.BaseWidget.extend({
|
|
147
151
|
contentFunc = cfg.content;
|
148
152
|
cfg.content = function(opt) { return contentFunc.format({ option: opt });};
|
149
153
|
}
|
150
|
-
|
154
|
+
if (cfg.listbox) {
|
155
|
+
this.jq.puilistbox(cfg);
|
156
|
+
} else {
|
157
|
+
this.jq.puidropdown(cfg);
|
158
|
+
}
|
151
159
|
}
|
152
160
|
});
|
153
161
|
|
@@ -161,3 +169,32 @@ PrimeFaces.widget.Accordion = PrimeFaces.widget.BaseWidget.extend({
|
|
161
169
|
this.jq.puiaccordion(cfg);
|
162
170
|
}
|
163
171
|
});
|
172
|
+
|
173
|
+
|
174
|
+
/**
|
175
|
+
* PrimeFaces Accordion Widget
|
176
|
+
*/
|
177
|
+
PrimeFaces.widget.RadioButton = PrimeFaces.widget.BaseWidget.extend({
|
178
|
+
init: function(cfg) {
|
179
|
+
this._super(cfg);
|
180
|
+
this.jq.find(':radio').puiradiobutton(cfg);
|
181
|
+
}
|
182
|
+
});
|
183
|
+
|
184
|
+
/**
|
185
|
+
* PrimeFaces Growl Widget
|
186
|
+
*/
|
187
|
+
PrimeFaces.widget.Growl = PrimeFaces.widget.BaseWidget.extend({
|
188
|
+
init: function(cfg) {
|
189
|
+
this._super(cfg);
|
190
|
+
_self = this;
|
191
|
+
|
192
|
+
this.jq.puigrowl(cfg);
|
193
|
+
|
194
|
+
addMessage = function(msg) {_self.jq.puigrowl('show', msg)}
|
195
|
+
|
196
|
+
if (cfg.messages){
|
197
|
+
addMessage(cfg.messages);
|
198
|
+
}
|
199
|
+
}
|
200
|
+
});
|
@@ -0,0 +1,50 @@
|
|
1
|
+
module GrowlHelper
|
2
|
+
ALERT_TYPES = [:error, :info, :warn]
|
3
|
+
|
4
|
+
def p_growl(id,options={})
|
5
|
+
output = growl_encode_markup(id,options)
|
6
|
+
output += growl_encode_script(id,options)
|
7
|
+
end
|
8
|
+
|
9
|
+
protected
|
10
|
+
|
11
|
+
def growl_encode_markup(id,options={})
|
12
|
+
clientid = sanitize_to_id(id)
|
13
|
+
options = options.stringify_keys
|
14
|
+
options = options.merge(:id => clientid)
|
15
|
+
content_tag(:div,nil, options)
|
16
|
+
end
|
17
|
+
|
18
|
+
def growl_encode_script(id,options={})
|
19
|
+
options = options.stringify_keys
|
20
|
+
clientid = sanitize_to_id(id)
|
21
|
+
widgetvar = options.has_key?("widgetVar") ? options["widgetVar"] : "widget_"+clientid
|
22
|
+
|
23
|
+
mens = []
|
24
|
+
flash.each do |type, message|
|
25
|
+
next if message.blank?
|
26
|
+
type = :info if type == :info
|
27
|
+
type = :warn if type == :warning
|
28
|
+
type = :error if type == :error
|
29
|
+
|
30
|
+
summ = options['info_title'] if type == :info
|
31
|
+
summ = options['warn_title'] if type == :warn
|
32
|
+
summ = options['error_title'] if type == :error
|
33
|
+
summ = '' if summ.nil?
|
34
|
+
next unless ALERT_TYPES.include?(type)
|
35
|
+
|
36
|
+
mens = mens + [severity: type, summary: summ, detail: message]
|
37
|
+
end
|
38
|
+
|
39
|
+
options = options.merge(:messages => mens)
|
40
|
+
options_ui = options
|
41
|
+
options_ui = options_ui.merge(:id => clientid)
|
42
|
+
options_ui = options_ui.to_json
|
43
|
+
|
44
|
+
script = '$(function() {'
|
45
|
+
script += "PrimeFaces.cw('Growl','#{widgetvar}',#{options_ui})"
|
46
|
+
script += '});'
|
47
|
+
javascript_tag(script, "id" => clientid+"_s")
|
48
|
+
end
|
49
|
+
|
50
|
+
end
|
@@ -0,0 +1,34 @@
|
|
1
|
+
module RadiobuttonHelper
|
2
|
+
|
3
|
+
def p_radio_button(id,options={},&block)
|
4
|
+
output = radiobutton_encode_markup(id,options,&block)
|
5
|
+
output += radiobutton_encode_script(id,options)
|
6
|
+
end
|
7
|
+
|
8
|
+
protected
|
9
|
+
|
10
|
+
def radiobutton_encode_markup(id,options={},&block)
|
11
|
+
clientid = sanitize_to_id(id)
|
12
|
+
options = options.stringify_keys
|
13
|
+
options = options.merge(:id => clientid)
|
14
|
+
output = content_tag('div', options) do
|
15
|
+
capture(&block)
|
16
|
+
end
|
17
|
+
output.html_safe
|
18
|
+
end
|
19
|
+
|
20
|
+
def radiobutton_encode_script(id,options={})
|
21
|
+
options = options.stringify_keys
|
22
|
+
clientid = sanitize_to_id(id)
|
23
|
+
widgetvar = options.has_key?("widgetVar") ? options["widgetVar"] : "widget_"+clientid
|
24
|
+
options_ui = options
|
25
|
+
options_ui = options_ui.merge(:id => clientid)
|
26
|
+
options_ui = options_ui.to_json
|
27
|
+
|
28
|
+
script = '$(function() {'
|
29
|
+
script += "PrimeFaces.cw('RadioButton','#{widgetvar}',#{options_ui})"
|
30
|
+
script += '});'
|
31
|
+
javascript_tag(script, "id" => clientid+"_s")
|
32
|
+
end
|
33
|
+
|
34
|
+
end
|
data/lib/prime/rails/engine.rb
CHANGED
@@ -4,9 +4,7 @@ require File.dirname(__FILE__) + '/prime-rails-breadcrumbs.rb'
|
|
4
4
|
require File.dirname(__FILE__) + '/utils.rb'
|
5
5
|
require File.dirname(__FILE__) + '/form_tag_helper.rb'
|
6
6
|
require File.dirname(__FILE__) + '/form_helper.rb'
|
7
|
-
require File.dirname(__FILE__) + '/
|
8
|
-
require File.dirname(__FILE__) + '/tags/text_area.rb'
|
9
|
-
|
7
|
+
require File.dirname(__FILE__) + '/url_helper.rb'
|
10
8
|
|
11
9
|
module Prime
|
12
10
|
module Rails
|
@@ -1,19 +1,65 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
1
|
+
require File.dirname(__FILE__) + '/tags/text_field.rb'
|
2
|
+
require File.dirname(__FILE__) + '/tags/text_area.rb'
|
3
|
+
require File.dirname(__FILE__) + '/tags/check_box.rb'
|
4
|
+
require File.dirname(__FILE__) + '/tags/select.rb'
|
5
|
+
|
6
|
+
module ActionView::Helpers
|
7
|
+
|
8
|
+
module FormHelper
|
9
|
+
|
10
|
+
def p_text_field(object_name, method, options = {})
|
11
|
+
Tags::TextField.new(object_name, method, self, options).p_render
|
12
|
+
end
|
13
|
+
|
14
|
+
def p_text_area(object_name, method, options = {})
|
15
|
+
Tags::TextArea.new(object_name, method, self, options).p_render
|
16
|
+
end
|
17
|
+
|
18
|
+
def p_check_box(object_name, method, options = {}, checked_value = "1", unchecked_value = "0")
|
19
|
+
Tags::CheckBox.new(object_name, method, self, checked_value, unchecked_value, options).p_render
|
20
|
+
end
|
21
|
+
|
22
|
+
def p_select(object, method, choices, options = {}, html_options = {})
|
23
|
+
Tags::Select.new(object, method, self, choices, options, html_options).p_render
|
24
|
+
end
|
25
|
+
|
26
|
+
def p_button(value = nil, options = {}, &block)
|
27
|
+
value, options = nil, value if value.is_a?(Hash)
|
28
|
+
value ||= submit_default_value
|
29
|
+
@template.p_button_tag(value, options, &block)
|
30
|
+
end
|
31
|
+
end
|
32
|
+
|
33
|
+
class FormBuilder
|
34
|
+
|
35
|
+
class_attribute :p_field_helpers
|
36
|
+
self.p_field_helpers = [:p_text_field,:p_text_area]
|
37
|
+
|
38
|
+
(p_field_helpers).each do |selector|
|
39
|
+
class_eval <<-RUBY_EVAL, __FILE__, __LINE__ + 1
|
40
|
+
def #{selector}(method, options = {}) # def text_field(method, options = {})
|
41
|
+
@template.send( # @template.send(
|
42
|
+
#{selector.inspect}, # "text_field",
|
43
|
+
@object_name, # @object_name,
|
44
|
+
method, # method,
|
45
|
+
objectify_options(options)) # objectify_options(options))
|
46
|
+
end # end
|
47
|
+
RUBY_EVAL
|
48
|
+
end
|
49
|
+
|
50
|
+
def p_button(value = nil, options = {}, &block)
|
51
|
+
value, options = nil, value if value.is_a?(Hash)
|
52
|
+
value ||= submit_default_value
|
53
|
+
@template.p_button_tag(value, options, &block)
|
54
|
+
end
|
55
|
+
|
56
|
+
def p_check_box(method, options = {}, checked_value = "1", unchecked_value = "0")
|
57
|
+
@template.p_check_box(@object_name, method, objectify_options(options), checked_value, unchecked_value)
|
58
|
+
end
|
59
|
+
|
60
|
+
def p_select(method, choices, options = {}, html_options = {})
|
61
|
+
@template.p_select(@object_name, method, choices, objectify_options(options), @default_options.merge(html_options))
|
62
|
+
end
|
63
|
+
|
64
|
+
end
|
19
65
|
end
|
@@ -41,50 +41,7 @@ module ActionView::Helpers::FormTagHelper
|
|
41
41
|
script += "PrimeFaces.cw('InputTextarea','#{widgetvar}',#{options_ui})"
|
42
42
|
script += '});'
|
43
43
|
output += javascript_tag(script, "id" => clientid+"_s")
|
44
|
-
end
|
45
|
-
|
46
|
-
def p_button_tag(content_or_options = nil, options = nil, &block)
|
47
|
-
options = content_or_options if block_given? && content_or_options.is_a?(Hash)
|
48
|
-
options ||= {}
|
49
|
-
options = options.stringify_keys
|
50
|
-
|
51
|
-
if disable_with = options.delete("disable_with")
|
52
|
-
message = ":disable_with option is deprecated and will be removed from Rails 4.1. " \
|
53
|
-
"Use 'data: { disable_with: \'Text\' }' instead."
|
54
|
-
ActiveSupport::Deprecation.warn message
|
55
|
-
|
56
|
-
options["data-disable-with"] = disable_with
|
57
|
-
end
|
58
|
-
|
59
|
-
if confirm = options.delete("confirm")
|
60
|
-
message = ":confirm option is deprecated and will be removed from Rails 4.1. " \
|
61
|
-
"Use 'data: { confirm: \'Text\' }' instead'."
|
62
|
-
ActiveSupport::Deprecation.warn message
|
63
|
-
|
64
|
-
options["data-confirm"] = confirm
|
65
|
-
end
|
66
|
-
|
67
|
-
options.reverse_merge! 'name' => 'button', 'type' => 'submit'
|
68
|
-
|
69
|
-
if options['ajax'] == 'true'
|
70
|
-
options['onclick'] = '' if !options.has_key?('onclick')
|
71
|
-
options['onclick'] += "PrimeFaces.ab({source: 'this'});return false;"
|
72
|
-
end
|
73
|
-
|
74
|
-
output = content_tag :button, content_or_options || 'Button', options, &block
|
75
|
-
|
76
|
-
clientid = sanitize_to_id(options["id"])
|
77
|
-
widgetvar = options.has_key?("widgetVar") ? options["widgetVar"] : "widget_"+clientid
|
78
|
-
|
79
|
-
options_ui = options
|
80
|
-
options_ui = options_ui.merge(:id => clientid )
|
81
|
-
options_ui = options_ui.to_json
|
82
|
-
|
83
|
-
script = '$(function() {'
|
84
|
-
script += "PrimeFaces.cw('Button','#{widgetvar}',#{options_ui})"
|
85
|
-
script += '});'
|
86
|
-
output += javascript_tag(script, "id" => clientid+"_s")
|
87
|
-
end
|
44
|
+
end
|
88
45
|
|
89
46
|
def p_check_box_tag(name, value = "1", checked = false, options = {})
|
90
47
|
html_options = { "type" => "checkbox", "name" => name, "id" => sanitize_to_id(name), "value" => value }.update(options.stringify_keys)
|
@@ -134,6 +91,49 @@ module ActionView::Helpers::FormTagHelper
|
|
134
91
|
script += "PrimeFaces.cw('Dropdown','#{widgetvar}',#{options_ui})"
|
135
92
|
script += '});'
|
136
93
|
output += javascript_tag(script, "id" => clientid+"_s")
|
137
|
-
end
|
94
|
+
end
|
95
|
+
|
96
|
+
def p_button_tag(content_or_options = nil, options = nil, &block)
|
97
|
+
options = content_or_options if block_given? && content_or_options.is_a?(Hash)
|
98
|
+
options ||= {}
|
99
|
+
options = options.stringify_keys
|
100
|
+
|
101
|
+
if disable_with = options.delete("disable_with")
|
102
|
+
message = ":disable_with option is deprecated and will be removed from Rails 4.1. " \
|
103
|
+
"Use 'data: { disable_with: \'Text\' }' instead."
|
104
|
+
ActiveSupport::Deprecation.warn message
|
105
|
+
|
106
|
+
options["data-disable-with"] = disable_with
|
107
|
+
end
|
108
|
+
|
109
|
+
if confirm = options.delete("confirm")
|
110
|
+
message = ":confirm option is deprecated and will be removed from Rails 4.1. " \
|
111
|
+
"Use 'data: { confirm: \'Text\' }' instead'."
|
112
|
+
ActiveSupport::Deprecation.warn message
|
113
|
+
|
114
|
+
options["data-confirm"] = confirm
|
115
|
+
end
|
116
|
+
|
117
|
+
options.reverse_merge! 'name' => 'button', 'type' => 'submit'
|
118
|
+
|
119
|
+
if options['ajax'] == 'true'
|
120
|
+
options['onclick'] = '' if !options.has_key?('onclick')
|
121
|
+
options['onclick'] += "PrimeFaces.ab({source: 'this'});return false;"
|
122
|
+
end
|
123
|
+
|
124
|
+
output = content_tag :button, content_or_options || 'Button', options, &block
|
125
|
+
|
126
|
+
clientid = sanitize_to_id(options["id"])
|
127
|
+
widgetvar = options.has_key?("widgetVar") ? options["widgetVar"] : "widget_"+clientid
|
128
|
+
|
129
|
+
options_ui = options
|
130
|
+
options_ui = options_ui.merge(:id => clientid )
|
131
|
+
options_ui = options_ui.to_json
|
132
|
+
|
133
|
+
script = '$(function() {'
|
134
|
+
script += "PrimeFaces.cw('Button','#{widgetvar}',#{options_ui})"
|
135
|
+
script += '});'
|
136
|
+
output += javascript_tag(script, "id" => clientid+"_s")
|
137
|
+
end
|
138
138
|
|
139
139
|
end
|
@@ -0,0 +1,45 @@
|
|
1
|
+
module ActionView
|
2
|
+
module Helpers
|
3
|
+
module Tags # :nodoc:
|
4
|
+
class CheckBox < Base #:nodoc:
|
5
|
+
include Helpers::JavaScriptHelper
|
6
|
+
def p_render
|
7
|
+
options = @options.stringify_keys
|
8
|
+
options["type"] = "checkbox"
|
9
|
+
options["value"] = @checked_value
|
10
|
+
options["checked"] = "checked" if input_checked?(object, options)
|
11
|
+
|
12
|
+
if options["multiple"]
|
13
|
+
add_default_name_and_id_for_value(@checked_value, options)
|
14
|
+
options.delete("multiple")
|
15
|
+
else
|
16
|
+
add_default_name_and_id(options)
|
17
|
+
end
|
18
|
+
|
19
|
+
include_hidden = options.delete("include_hidden") { true }
|
20
|
+
checkbox = tag("input", options)
|
21
|
+
|
22
|
+
if include_hidden
|
23
|
+
hidden = hidden_field_for_checkbox(options)
|
24
|
+
output = hidden + checkbox
|
25
|
+
else
|
26
|
+
output = checkbox
|
27
|
+
end
|
28
|
+
|
29
|
+
clientid = sanitize_to_id(options["id"])
|
30
|
+
widgetvar = options.has_key?("widgetVar") ? options["widgetVar"] : "widget_"+clientid
|
31
|
+
|
32
|
+
options_ui = options
|
33
|
+
options_ui = options_ui.merge(:id => clientid )
|
34
|
+
options_ui = options_ui.to_json
|
35
|
+
|
36
|
+
script = '$(function() {'
|
37
|
+
script += "PrimeFaces.cw('CheckBox','#{widgetvar}',#{options_ui})"
|
38
|
+
script += '});'
|
39
|
+
output += javascript_tag(script, "id" => clientid+"_s")
|
40
|
+
|
41
|
+
end
|
42
|
+
end
|
43
|
+
end
|
44
|
+
end
|
45
|
+
end
|
@@ -0,0 +1,50 @@
|
|
1
|
+
module ActionView
|
2
|
+
module Helpers
|
3
|
+
module Tags # :nodoc:
|
4
|
+
class Select < Base # :nodoc:
|
5
|
+
include Helpers::JavaScriptHelper
|
6
|
+
|
7
|
+
def p_render
|
8
|
+
option_tags_options = {
|
9
|
+
:selected => @options.fetch(:selected) { value(@object) },
|
10
|
+
:disabled => @options[:disabled]
|
11
|
+
}
|
12
|
+
|
13
|
+
option_tags = if grouped_choices?
|
14
|
+
grouped_options_for_select(@choices, option_tags_options)
|
15
|
+
else
|
16
|
+
options_for_select(@choices, option_tags_options)
|
17
|
+
end
|
18
|
+
|
19
|
+
p_select_content_tag(option_tags, @options, @html_options)
|
20
|
+
end
|
21
|
+
|
22
|
+
def p_select_content_tag(option_tags, options, html_options)
|
23
|
+
html_options = html_options.stringify_keys
|
24
|
+
add_default_name_and_id(html_options)
|
25
|
+
options[:include_blank] ||= true unless options[:prompt] || select_not_required?(html_options)
|
26
|
+
select = content_tag("select", add_options(option_tags, options, value(object)), html_options)
|
27
|
+
|
28
|
+
if html_options["multiple"] && options.fetch(:include_hidden, true)
|
29
|
+
output = tag("input", :disabled => html_options["disabled"], :name => html_options["name"], :type => "hidden", :value => "") + select
|
30
|
+
else
|
31
|
+
output = select
|
32
|
+
end
|
33
|
+
|
34
|
+
clientid = sanitize_to_id(html_options["id"])
|
35
|
+
widgetvar = options.has_key?("widgetVar") ? options["widgetVar"] : "widget_"+clientid
|
36
|
+
|
37
|
+
options_ui = options
|
38
|
+
options_ui = options_ui.merge(:id => clientid )
|
39
|
+
options_ui = options_ui.to_json
|
40
|
+
|
41
|
+
script = '$(function() {'
|
42
|
+
script += "PrimeFaces.cw('Dropdown','#{widgetvar}',#{options_ui})"
|
43
|
+
script += '});'
|
44
|
+
output += javascript_tag(script, "id" => clientid+"_s")
|
45
|
+
end
|
46
|
+
|
47
|
+
end
|
48
|
+
end
|
49
|
+
end
|
50
|
+
end
|
@@ -0,0 +1,64 @@
|
|
1
|
+
module ActionView::Helpers::UrlHelper
|
2
|
+
|
3
|
+
def p_button_to(name = nil, options = nil, html_options = nil, &block)
|
4
|
+
html_options, options = options, name if block_given?
|
5
|
+
options ||= {}
|
6
|
+
html_options ||= {}
|
7
|
+
|
8
|
+
html_options = html_options.stringify_keys
|
9
|
+
convert_boolean_attributes!(html_options, %w(disabled))
|
10
|
+
|
11
|
+
url = options.is_a?(String) ? options : url_for(options)
|
12
|
+
remote = html_options.delete('remote')
|
13
|
+
|
14
|
+
method = html_options.delete('method').to_s
|
15
|
+
method_tag = %w{patch put delete}.include?(method) ? method_tag(method) : ''.html_safe
|
16
|
+
|
17
|
+
form_method = method == 'get' ? 'get' : 'post'
|
18
|
+
form_options = html_options.delete('form') || {}
|
19
|
+
form_options[:class] ||= html_options.delete('form_class') || 'button_to'
|
20
|
+
form_options.merge!(method: form_method, action: url)
|
21
|
+
form_options.merge!("data-remote" => "true") if remote
|
22
|
+
|
23
|
+
request_token_tag = form_method == 'post' ? token_tag : ''
|
24
|
+
|
25
|
+
html_options = convert_options_to_data_attributes(options, html_options)
|
26
|
+
html_options['type'] = 'submit'
|
27
|
+
|
28
|
+
button = if block_given?
|
29
|
+
content_tag('button', html_options, &block)
|
30
|
+
else
|
31
|
+
html_options['value'] = name || url
|
32
|
+
content_tag('button', html_options) do
|
33
|
+
html_options['value']
|
34
|
+
end
|
35
|
+
end
|
36
|
+
|
37
|
+
output = button
|
38
|
+
|
39
|
+
options = html_options.stringify_keys
|
40
|
+
|
41
|
+
clientid = sanitize_to_id(options["id"])
|
42
|
+
widgetvar = options.has_key?("widgetVar") ? options["widgetVar"] : "widget_"+clientid
|
43
|
+
|
44
|
+
options_ui = options
|
45
|
+
options_ui = options_ui.merge(:id => clientid )
|
46
|
+
options_ui = options_ui.to_json
|
47
|
+
|
48
|
+
script = '$(function() {'
|
49
|
+
script += "PrimeFaces.cw('Button','#{widgetvar}',#{options_ui})"
|
50
|
+
script += '});'
|
51
|
+
output += javascript_tag(script, "id" => clientid+"_s")
|
52
|
+
|
53
|
+
button = output
|
54
|
+
|
55
|
+
|
56
|
+
|
57
|
+
inner_tags = method_tag.safe_concat(button).safe_concat(request_token_tag)
|
58
|
+
content_tag('form', content_tag('div', inner_tags), form_options)
|
59
|
+
|
60
|
+
|
61
|
+
|
62
|
+
end
|
63
|
+
|
64
|
+
end
|
data/lib/prime/rails/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: prime-rails
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.8
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Lazaro Nixon
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2013-09-
|
11
|
+
date: 2013-09-17 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: jquery-rails
|
@@ -36,8 +36,11 @@ files:
|
|
36
36
|
- lib/prime/rails/form_tag_helper.rb
|
37
37
|
- lib/prime/rails/prime-rails-breadcrumbs.rb
|
38
38
|
- lib/prime/rails/primerails.rb
|
39
|
+
- lib/prime/rails/tags/check_box.rb
|
40
|
+
- lib/prime/rails/tags/select.rb
|
39
41
|
- lib/prime/rails/tags/text_area.rb
|
40
42
|
- lib/prime/rails/tags/text_field.rb
|
43
|
+
- lib/prime/rails/url_helper.rb
|
41
44
|
- lib/prime/rails/utils.rb
|
42
45
|
- lib/prime/rails/version.rb
|
43
46
|
- lib/prime-rails.rb
|
@@ -650,8 +653,10 @@ files:
|
|
650
653
|
- app/helpers/breadcrumb_helper.rb
|
651
654
|
- app/helpers/dialog_helper.rb
|
652
655
|
- app/helpers/fieldset_helper.rb
|
656
|
+
- app/helpers/growl_helper.rb
|
653
657
|
- app/helpers/panel_helper.rb
|
654
658
|
- app/helpers/progressbar_helper.rb
|
659
|
+
- app/helpers/radiobutton_helper.rb
|
655
660
|
- app/helpers/tabview_helper.rb
|
656
661
|
- app/helpers/tooltip_helper.rb
|
657
662
|
- app/views/prime-rails/_breadcrumbs.html.erb
|