hobo 0.6.4 → 0.7.0
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/bin/hobo +4 -6
- data/hobo_files/plugin/CHANGES.txt +170 -0
- data/hobo_files/plugin/generators/hobo_front_controller/templates/index.dryml +9 -9
- data/hobo_files/plugin/generators/hobo_front_controller/templates/search.dryml +9 -9
- data/hobo_files/plugin/generators/hobo_migration/hobo_migration_generator.rb +7 -2
- data/hobo_files/plugin/generators/hobo_rapid/hobo_rapid_generator.rb +4 -4
- data/hobo_files/plugin/generators/hobo_rapid/templates/{hobo_rapid.css → hobo-rapid.css} +0 -0
- data/hobo_files/plugin/generators/hobo_rapid/templates/{hobo_rapid.js → hobo-rapid.js} +66 -47
- data/hobo_files/plugin/generators/hobo_rapid/templates/lowpro.js +130 -44
- data/hobo_files/plugin/generators/hobo_rapid/templates/{hobo_base.css → reset.css} +0 -5
- data/hobo_files/plugin/generators/hobo_rapid/templates/themes/clean/public/images/pencil.png +0 -0
- data/hobo_files/plugin/generators/hobo_rapid/templates/themes/clean/public/images/small_close.png +0 -0
- data/hobo_files/plugin/generators/hobo_rapid/templates/themes/clean/public/stylesheets/application.css +45 -0
- data/hobo_files/plugin/generators/hobo_rapid/templates/themes/clean/public/stylesheets/rapid_ui.css +167 -0
- data/hobo_files/plugin/generators/hobo_rapid/templates/themes/clean/views/application.dryml +10 -0
- data/hobo_files/plugin/generators/hobo_rapid/templates/themes/default/public/images/{bkg_bodytop.gif → bkg-bodytop.gif} +0 -0
- data/hobo_files/plugin/generators/hobo_rapid/templates/themes/default/public/images/{bkg_corner_01.gif → bkg-corner-01.gif} +0 -0
- data/hobo_files/plugin/generators/hobo_rapid/templates/themes/default/public/images/{bkg_corner_02.gif → bkg-corner-02.gif} +0 -0
- data/hobo_files/plugin/generators/hobo_rapid/templates/themes/default/public/images/{bkg_corner_03.gif → bkg-corner-03.gif} +0 -0
- data/hobo_files/plugin/generators/hobo_rapid/templates/themes/default/public/images/{bkg_corner_04.gif → bkg-corner-04.gif} +0 -0
- data/hobo_files/plugin/generators/hobo_rapid/templates/themes/default/public/images/{bkg_shadow_bottom.gif → bkg-shadow-bottom.gif} +0 -0
- data/hobo_files/plugin/generators/hobo_rapid/templates/themes/default/public/images/{bkg_shadow_left.gif → bkg-shadow-left.gif} +0 -0
- data/hobo_files/plugin/generators/hobo_rapid/templates/themes/default/public/images/{bkg_shadow_right.gif → bkg-shadow-right.gif} +0 -0
- data/hobo_files/plugin/generators/hobo_rapid/templates/themes/default/public/images/{bkg_shadow_top.gif → bkg-shadow-top.gif} +0 -0
- data/hobo_files/plugin/generators/hobo_rapid/templates/themes/default/public/images/{header_blue.gif → header-blue.gif} +0 -0
- data/hobo_files/plugin/generators/hobo_rapid/templates/themes/default/public/images/{header_dblue.gif → header-dblue.gif} +0 -0
- data/hobo_files/plugin/generators/hobo_rapid/templates/themes/default/public/images/{header_green.gif → header-green.gif} +0 -0
- data/hobo_files/plugin/generators/hobo_rapid/templates/themes/default/public/images/{header_purple.gif → header-purple.gif} +0 -0
- data/hobo_files/plugin/generators/hobo_rapid/templates/themes/default/public/images/{header_red.gif → header-red.gif} +0 -0
- data/hobo_files/plugin/generators/hobo_rapid/templates/themes/default/public/images/{txt_list_img_dblue.gif → txt-list-img-dblue.gif} +0 -0
- data/hobo_files/plugin/generators/hobo_rapid/templates/themes/default/public/images/{txt_list_img_green.gif → txt-list-img-green.gif} +0 -0
- data/hobo_files/plugin/generators/hobo_rapid/templates/themes/default/public/images/{txt_list_img_purple.gif → txt-list-img-purple.gif} +0 -0
- data/hobo_files/plugin/generators/hobo_rapid/templates/themes/default/public/images/{txt_list_img_red.gif → txt-list-img-red.gif} +0 -0
- data/hobo_files/plugin/generators/hobo_rapid/templates/themes/default/public/images/{window_corner_01.gif → window-corner-01.gif} +0 -0
- data/hobo_files/plugin/generators/hobo_rapid/templates/themes/default/public/images/{window_corner_02.gif → window-corner-02.gif} +0 -0
- data/hobo_files/plugin/generators/hobo_rapid/templates/themes/default/public/images/{window_corner_03.gif → window-corner-03.gif} +0 -0
- data/hobo_files/plugin/generators/hobo_rapid/templates/themes/default/public/images/{window_corner_04.gif → window-corner-04.gif} +0 -0
- data/hobo_files/plugin/generators/hobo_rapid/templates/themes/default/public/images/{window_shadow_bottom.gif → window-shadow-bottom.gif} +0 -0
- data/hobo_files/plugin/generators/hobo_rapid/templates/themes/default/public/images/{window_shadow_left.gif → window-shadow-left.gif} +0 -0
- data/hobo_files/plugin/generators/hobo_rapid/templates/themes/default/public/images/{window_shadow_right.gif → window-shadow-right.gif} +0 -0
- data/hobo_files/plugin/generators/hobo_rapid/templates/themes/default/public/images/{window_shadow_top.gif → window-shadow-top.gif} +0 -0
- data/hobo_files/plugin/generators/hobo_rapid/templates/themes/default/public/stylesheets/application.css +69 -69
- data/hobo_files/plugin/generators/hobo_rapid/templates/themes/default/views/application.dryml +39 -53
- data/hobo_files/plugin/generators/hobo_user_model/templates/model.rb +1 -1
- data/hobo_files/plugin/lib/extensions.rb +0 -16
- data/hobo_files/plugin/lib/hobo/dryml/part_context.rb +1 -1
- data/hobo_files/plugin/lib/hobo/dryml/tag_parameters.rb +35 -0
- data/hobo_files/plugin/lib/hobo/dryml/taglib.rb +2 -2
- data/hobo_files/plugin/lib/hobo/dryml/template.rb +165 -236
- data/hobo_files/plugin/lib/hobo/dryml/template_environment.rb +158 -123
- data/hobo_files/plugin/lib/hobo/hobo_helper.rb +15 -4
- data/hobo_files/plugin/lib/hobo/model.rb +30 -11
- data/hobo_files/plugin/lib/hobo/model_controller.rb +13 -9
- data/hobo_files/plugin/lib/hobo/model_router.rb +27 -7
- data/hobo_files/plugin/lib/hobo/static_tags +0 -2
- data/hobo_files/plugin/lib/hobo/user.rb +3 -3
- data/hobo_files/plugin/lib/rexml.rb +10 -3
- data/hobo_files/plugin/tags/core.dryml +11 -16
- data/hobo_files/plugin/tags/rapid.dryml +147 -110
- data/hobo_files/plugin/tags/rapid_document_tags.dryml +22 -20
- data/hobo_files/plugin/tags/rapid_editing.dryml +41 -41
- data/hobo_files/plugin/tags/rapid_forms.dryml +51 -49
- data/hobo_files/plugin/tags/rapid_navigation.dryml +34 -34
- data/hobo_files/plugin/tags/rapid_pages.dryml +174 -174
- data/hobo_files/plugin/tags/rapid_plus.dryml +19 -19
- data/hobo_files/plugin/tags/rapid_support.dryml +5 -5
- data/hobo_files/plugin/tasks/dump_fixtures.rake +62 -53
- data/hobo_files/plugin/tasks/fix_dryml.rake +144 -0
- data/hobo_files/plugin/tasks/hobo_tasks.rake +0 -4
- metadata +43 -32
- data/hobo_files/plugin/lib/hobo/dryml/tag_module.rb +0 -9
|
@@ -1,53 +1,55 @@
|
|
|
1
|
-
<def tag="
|
|
1
|
+
<def tag="labelled-item-list"><table class="field-list" merge-attrs><do param="default"/></table></def>
|
|
2
2
|
|
|
3
|
-
<def tag="
|
|
3
|
+
<def tag="labelled-item"><tr merge-attrs><do param="default"/></tr></def>
|
|
4
4
|
|
|
5
|
-
<def tag="
|
|
5
|
+
<def tag="item-label"><th merge-attrs><do param="default"/></th></def>
|
|
6
6
|
|
|
7
|
-
<def tag="
|
|
7
|
+
<def tag="item-value"><td merge-attrs><do param="default"/></td></def>
|
|
8
8
|
|
|
9
9
|
|
|
10
10
|
<def tag="heading">
|
|
11
|
-
|
|
11
|
+
<%= element("h#{scope.heading_level || '1'}", attributes, parameters.default) %>
|
|
12
12
|
</def>
|
|
13
13
|
|
|
14
|
-
<def tag="
|
|
15
|
-
|
|
16
|
-
|
|
14
|
+
<def tag="sub-heading"><%=
|
|
15
|
+
element("h#{scope.heading_level ? scope.heading_level.to_i + 1 : '2'}",
|
|
16
|
+
attributes.merge(:class => "subheading"),
|
|
17
|
+
parameters.default)
|
|
18
|
+
%></def>
|
|
17
19
|
|
|
18
20
|
<def tag="nav">
|
|
19
|
-
<div class="nav"
|
|
21
|
+
<div class="nav" merge-attrs><do param="default"/></div>
|
|
20
22
|
</def>
|
|
21
23
|
|
|
22
24
|
<!-- section represents a generic document or application section. -->
|
|
23
25
|
<def tag="section" attrs="empty">
|
|
24
|
-
<set body="&
|
|
25
|
-
<div class="section"
|
|
26
|
+
<set body="¶meters.default"/>
|
|
27
|
+
<div class="section" merge-attrs if="&!body.blank? || empty"><%= body %></div>
|
|
26
28
|
</def>
|
|
27
29
|
|
|
28
30
|
<def tag="aside" attrs="empty">
|
|
29
|
-
<set body="&
|
|
30
|
-
<div class="aside"
|
|
31
|
+
<set body="¶meters.default"/>
|
|
32
|
+
<div class="aside" merge-attrs if="&!body.blank? || empty"><%= body %></div>
|
|
31
33
|
</def>
|
|
32
34
|
|
|
33
35
|
<def tag="header" attrs="empty">
|
|
34
|
-
<set body="&
|
|
35
|
-
<div class="header"
|
|
36
|
+
<set body="¶meters.default"/>
|
|
37
|
+
<div class="header" merge-attrs if="&!body.blank? || empty"><%= body %></div>
|
|
36
38
|
</def>
|
|
37
39
|
|
|
38
40
|
<def tag="footer" attrs="empty">
|
|
39
|
-
<set body="&
|
|
40
|
-
<div class="footer"
|
|
41
|
+
<set body="¶meters.default"/>
|
|
42
|
+
<div class="footer" merge-attrs if="&!body.blank? || empty"><%= body %></div>
|
|
41
43
|
</def>
|
|
42
44
|
|
|
43
45
|
<!-- article represents an independent piece of content of a -->
|
|
44
46
|
<!-- document, such as a blog entry or newspaper article. -->
|
|
45
47
|
<def tag="article" attrs="empty">
|
|
46
|
-
<set body="&
|
|
47
|
-
<div class="article"
|
|
48
|
+
<set body="¶meters.default"/>
|
|
49
|
+
<div class="article" merge-attrs if="&!body.blank? || empty"><%= body %></div>
|
|
48
50
|
</def>
|
|
49
51
|
|
|
50
52
|
<!-- temporary tag -->
|
|
51
53
|
<def tag="panel">
|
|
52
|
-
<div class="panel"
|
|
54
|
+
<div class="panel" merge-attrs><do param="default"/></div>
|
|
53
55
|
</def>
|
|
@@ -16,12 +16,12 @@
|
|
|
16
16
|
%></def>
|
|
17
17
|
|
|
18
18
|
|
|
19
|
-
<def tag="
|
|
19
|
+
<def tag="has-many-editor">
|
|
20
20
|
<% #TODO: Implement %>
|
|
21
|
-
<a
|
|
21
|
+
<a merge-attrs/>
|
|
22
22
|
</def>
|
|
23
23
|
|
|
24
|
-
<def tag="
|
|
24
|
+
<def tag="belongs-to-editor"><%= belongs_to_menu_editor(attributes) %></def>
|
|
25
25
|
|
|
26
26
|
<def tag="editor" for="string"><%= in_place_editor "in_place_textfield_bhv", attributes %></def>
|
|
27
27
|
|
|
@@ -39,12 +39,16 @@
|
|
|
39
39
|
|
|
40
40
|
<def tag="editor" for="password"><% raise HoboError, "passwords cannot be edited in place" %></def>
|
|
41
41
|
|
|
42
|
-
<def tag="editor" for="boolean"><
|
|
42
|
+
<def tag="editor" for="boolean"><boolean-checkbox-editor merge-attrs/></def>
|
|
43
43
|
|
|
44
44
|
<def tag="editor" for="big_integer"><%= in_place_editor "in_place_textfield_bhv", attributes %></def>
|
|
45
45
|
|
|
46
|
+
<def tag="editor" for="Hobo::EnumString">
|
|
47
|
+
<string-select-editor values="&this_type.values"/>
|
|
48
|
+
</def>
|
|
49
|
+
|
|
46
50
|
|
|
47
|
-
<def tag="autocompleter" attrs="
|
|
51
|
+
<def tag="autocompleter" attrs="completer-model, completer-attr, id, filter, name, value">
|
|
48
52
|
<% refl = this_type
|
|
49
53
|
if refl.respond_to?(:macro) && refl.macro == :belongs_to
|
|
50
54
|
completer_model ||= refl.klass
|
|
@@ -56,17 +60,17 @@
|
|
|
56
60
|
url = object_url(completer_model, "completions",
|
|
57
61
|
{ :for => completer_attr }.update(attributes.select_hash {|k,v| k.to_s.starts_with? "where_"}))
|
|
58
62
|
%>
|
|
59
|
-
<input type="text" name="#{name}" id="#{id}" class="
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
<div id="<%= id
|
|
63
|
+
<input type="text" name="#{name}" id="#{id}" class="autocomplete-bhv"
|
|
64
|
+
autocomplete-url="#{url}" value="#{value}"
|
|
65
|
+
merge-attrs/>
|
|
66
|
+
<div id="<%= id %>-completions" class="completions-popup" style="display:none"></div>
|
|
63
67
|
</def>
|
|
64
68
|
|
|
65
69
|
|
|
66
|
-
<def tag="
|
|
70
|
+
<def tag="belongs-to-menu-editor"><%
|
|
67
71
|
raise HoboError.new("Not allowed to edit") unless can_edit?
|
|
68
72
|
link_id = "#{this_field_dom_id}_editor" %>
|
|
69
|
-
<span id="#{link_id}" part="
|
|
73
|
+
<span id="#{link_id}" part="rapid-belongs-to-edit">
|
|
70
74
|
<% select_options = this_type.klass.find(:all).select {|x| can_view?(x)}.map {|x|
|
|
71
75
|
[ name(:with => x, :no_wrapper => true), x.id ]
|
|
72
76
|
}
|
|
@@ -86,8 +90,8 @@
|
|
|
86
90
|
</def>
|
|
87
91
|
|
|
88
92
|
|
|
89
|
-
<def tag="
|
|
90
|
-
<
|
|
93
|
+
<def tag="belongs-to-autocompleting-editor" attrs="update">
|
|
94
|
+
<if-can-edit><%
|
|
91
95
|
return object_link unless can_edit?
|
|
92
96
|
|
|
93
97
|
id ||= this_field_dom_id + "_completer"
|
|
@@ -105,18 +109,18 @@
|
|
|
105
109
|
attributes.select_hash {|k,v| k.to_s.starts_with? "where_"})
|
|
106
110
|
%>
|
|
107
111
|
<form onsubmit="#{f}; $('#{id}').blur(); return false">
|
|
108
|
-
<input type="text" class="
|
|
109
|
-
value="#{this && this.id_name}"
|
|
110
|
-
<div id="#{id}
|
|
112
|
+
<input type="text" class="autocomplete-bhv autosubmit" id="#{id}" autocomplete-url="#{url}"
|
|
113
|
+
value="#{this && this.id_name}" merge-attrs />
|
|
114
|
+
<div id="#{id}-completions" class="completions-popup" style="display:none"></div>
|
|
111
115
|
</form>
|
|
112
|
-
</
|
|
116
|
+
</if-can-edit>
|
|
113
117
|
<else>
|
|
114
|
-
<
|
|
118
|
+
<object-link/>
|
|
115
119
|
</else>
|
|
116
120
|
</def>
|
|
117
121
|
|
|
118
122
|
|
|
119
|
-
<def tag="
|
|
123
|
+
<def tag="string-select-editor" attrs="update, values"><%
|
|
120
124
|
raise HoboError.new("Not allowed to edit") unless can_edit?
|
|
121
125
|
|
|
122
126
|
values = comma_split(values)
|
|
@@ -128,13 +132,13 @@
|
|
|
128
132
|
} })
|
|
129
133
|
html_attributes = add_classes(attributes, editor_class)
|
|
130
134
|
%>
|
|
131
|
-
<select onchange="#{f}"
|
|
135
|
+
<select onchange="#{f}" merge-attrs="&html_attributes">
|
|
132
136
|
<%= options_for_select(values, this) %>
|
|
133
137
|
</select>
|
|
134
138
|
</def>
|
|
135
139
|
|
|
136
140
|
|
|
137
|
-
<def tag="
|
|
141
|
+
<def tag="boolean-checkbox-editor" attrs="update"><%
|
|
138
142
|
raise HoboError.new("Not allowed to edit") unless can_edit?
|
|
139
143
|
f = ajax_updater(object_url(this_parent),
|
|
140
144
|
"Change #{this_field.to_s.titleize}", update,
|
|
@@ -145,11 +149,11 @@
|
|
|
145
149
|
attributes = add_classes(attributes, editor_class)
|
|
146
150
|
%>
|
|
147
151
|
<input type="checkbox" value="1" onclick="#{f}"
|
|
148
|
-
|
|
152
|
+
merge-attrs="& this ? attributes.merge(:checked => 'checked') : attributes" />
|
|
149
153
|
</def>
|
|
150
154
|
|
|
151
155
|
|
|
152
|
-
<def tag="
|
|
156
|
+
<def tag="sti-type-editor" attrs="update">
|
|
153
157
|
<% base_class = this.class
|
|
154
158
|
base_class = base_class.superclass while base_class.superclass != ActiveRecord::Base
|
|
155
159
|
f = ajax_updater("#{base_url}/#{controller_for base_class}/#{this.id}",
|
|
@@ -161,27 +165,23 @@
|
|
|
161
165
|
%>
|
|
162
166
|
|
|
163
167
|
<select onchange="#{f}">
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
</if>
|
|
167
|
-
<else>
|
|
168
|
-
<%= options_for_select(base_class.send(:subclasses).map{|x| [x.name.titleize, x.name]}, this.class.name) %>
|
|
169
|
-
</else>
|
|
168
|
+
<%= parameters.default || options_for_select(base_class.send(:subclasses).map{|x| [x.name.titleize, x.name]},
|
|
169
|
+
this.class.name) %>
|
|
170
170
|
</select>
|
|
171
171
|
</def>
|
|
172
172
|
|
|
173
173
|
|
|
174
|
-
<def tag="
|
|
175
|
-
<select class="
|
|
176
|
-
|
|
177
|
-
|
|
174
|
+
<def tag="integer-select-editor" attrs="min, max, update, nil-option, message">
|
|
175
|
+
<select class="number-editor-bhv" hobo-update="#{update}"
|
|
176
|
+
hobo-model-id="#{this_field_dom_id}"
|
|
177
|
+
merge-attrs="&message ? attributes.merge(:hobo_message => message) : attributes">
|
|
178
178
|
<if test="&this.nil?"><option value=""><%= nil_option || "Choose a value" %></option></if>
|
|
179
179
|
<%= options_for_select((min.to_i..max.to_i).to_a, this) %>
|
|
180
180
|
</select>
|
|
181
181
|
</def>
|
|
182
182
|
|
|
183
183
|
|
|
184
|
-
<def tag="
|
|
184
|
+
<def tag="has-many-checkbox-editor" attrs="model, update, message"><%=
|
|
185
185
|
raise HoboError.new("no update specified") unless update
|
|
186
186
|
|
|
187
187
|
fields = attributes.delete_if{|k,v|!k.ends_with? "_id"}
|
|
@@ -208,15 +208,15 @@
|
|
|
208
208
|
checkbox_attrs[:onclick] = ajax_updater(object_url(obj, "destroy"), message, update, {:method => 'delete'})
|
|
209
209
|
end
|
|
210
210
|
end
|
|
211
|
-
|
|
212
|
-
|
|
211
|
+
element(:input, add_classes(attributes.merge(checkbox_attrs),
|
|
212
|
+
"checkbox_input has_many_checkbox has_many_#{class_name}_checkbox")) if permission
|
|
213
213
|
%></def>
|
|
214
214
|
|
|
215
|
-
<def tag="
|
|
216
|
-
<
|
|
217
|
-
<tr
|
|
218
|
-
<td><
|
|
215
|
+
<def tag="has-many-checkbox-editors">
|
|
216
|
+
<table>
|
|
217
|
+
<tr:>
|
|
218
|
+
<td><has-many-checkbox-editor param="editor" merge-attrs/></td>
|
|
219
219
|
<td><name param/></td>
|
|
220
220
|
</tr>
|
|
221
|
-
</
|
|
221
|
+
</table>
|
|
222
222
|
</def>
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
<def tag="
|
|
1
|
+
<def tag="hidden-fields" attrs="fields, skip, for-query-string"><%=
|
|
2
2
|
pairs = if for_query_string
|
|
3
3
|
query_params.to_a
|
|
4
4
|
else
|
|
@@ -20,7 +20,7 @@
|
|
|
20
20
|
%></def>
|
|
21
21
|
|
|
22
22
|
|
|
23
|
-
<def tag="form" attrs="message, update,
|
|
23
|
+
<def tag="form" attrs="message, update, hidden-fields, action, method, web-method"><%=
|
|
24
24
|
ajax_attrs, html_attrs = attributes.partition_hash(Hobo::RapidHelper::AJAX_ATTRS)
|
|
25
25
|
|
|
26
26
|
html_attrs[:action] = action || object_url(this, web_method)
|
|
@@ -48,7 +48,7 @@
|
|
|
48
48
|
|
|
49
49
|
body, field_names = scope.new_scope do
|
|
50
50
|
scope[:in_form] = true
|
|
51
|
-
with_form_context {
|
|
51
|
+
with_form_context { parameters.default }
|
|
52
52
|
end
|
|
53
53
|
|
|
54
54
|
hiddens = hidden_fields(:fields => hidden_fields, :skip => field_names) if new_record
|
|
@@ -56,9 +56,9 @@
|
|
|
56
56
|
auth_token = if request_forgery_protection_token.nil?
|
|
57
57
|
''
|
|
58
58
|
else
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
59
|
+
element(:input, :type => "hidden",
|
|
60
|
+
:name => request_forgery_protection_token.to_s,
|
|
61
|
+
:value => form_authenticity_token)
|
|
62
62
|
end
|
|
63
63
|
|
|
64
64
|
page_path_hidden = hidden_field_tag("page_path", view_name)
|
|
@@ -71,21 +71,21 @@
|
|
|
71
71
|
add_classes!(html_attrs, "#{'new_' if new_record}#{type_id}")
|
|
72
72
|
end
|
|
73
73
|
|
|
74
|
-
|
|
74
|
+
element("form", html_attrs, body)
|
|
75
75
|
%></def>
|
|
76
76
|
|
|
77
77
|
|
|
78
78
|
<def tag="submit" attrs="label, image">
|
|
79
|
-
<input if="&image" type="image" src="&image"
|
|
79
|
+
<input if="&image" type="image" src="&image" merge-attrs class="image-button submit-button"/>
|
|
80
80
|
<else>
|
|
81
|
-
<input type="submit" value="#{label}"
|
|
81
|
+
<input type="submit" value="#{label}" merge-attrs class="button submit-button"/>
|
|
82
82
|
</else>
|
|
83
83
|
</def>
|
|
84
84
|
|
|
85
85
|
|
|
86
86
|
<def tag="input"><%=
|
|
87
87
|
if attributes[:type]
|
|
88
|
-
|
|
88
|
+
element :input, attributes
|
|
89
89
|
elsif !can_edit?
|
|
90
90
|
view
|
|
91
91
|
else
|
|
@@ -107,7 +107,7 @@
|
|
|
107
107
|
raise HoboError, ("No input tag for #{this_field}:#{this_type} (this=#{this.inspect})")
|
|
108
108
|
end
|
|
109
109
|
if this_parent.errors[this_field]
|
|
110
|
-
"<div class='
|
|
110
|
+
"<div class='field-with-errors'>#{the_input}</div>"
|
|
111
111
|
else
|
|
112
112
|
the_input
|
|
113
113
|
end
|
|
@@ -163,7 +163,7 @@
|
|
|
163
163
|
<def tag="input" for="Hobo::EnumString" attrs="labels,titleize">
|
|
164
164
|
<% labels ||= {} %>
|
|
165
165
|
<% titleize = true if titleize.nil? %>
|
|
166
|
-
<select name="#{param_name_for_this}"
|
|
166
|
+
<select name="#{param_name_for_this}" merge-attrs>
|
|
167
167
|
<%= options_for_select(this_type.values.map {|v| [labels.fetch(v.to_sym, titleize ? v.titleize : v), v] }, this) %>
|
|
168
168
|
</select>
|
|
169
169
|
</def>
|
|
@@ -173,42 +173,42 @@
|
|
|
173
173
|
</def>
|
|
174
174
|
|
|
175
175
|
|
|
176
|
-
<def tag="
|
|
176
|
+
<def tag="belongs-to-input">
|
|
177
177
|
<%= belongs_to_menu_input(attributes) %>
|
|
178
178
|
</def>
|
|
179
179
|
|
|
180
180
|
<!--- Buttons --->
|
|
181
181
|
|
|
182
|
-
<def tag="
|
|
182
|
+
<def tag="remote-method-button" attrs="method, update, result-update, params, label, message"><%=
|
|
183
183
|
ajax_attributes, html_attributes = attributes.partition_hash(Hobo::RapidHelper::AJAX_ATTRS)
|
|
184
184
|
|
|
185
185
|
url = object_url(this, method)
|
|
186
|
-
add_classes!(html_attributes, "button
|
|
186
|
+
add_classes!(html_attributes, "button remote-method-button #{method}-button")
|
|
187
187
|
if update || result_update
|
|
188
188
|
message ||= method.titleize
|
|
189
189
|
func = ajax_updater(url, message, update,
|
|
190
190
|
ajax_attributes.merge(:params => params, :result_update => result_update))
|
|
191
191
|
html_attributes.update(:onclick => "var e = this; " + func, :type =>'button', :value => label)
|
|
192
|
-
|
|
192
|
+
element(:input, html_attributes)
|
|
193
193
|
else
|
|
194
194
|
button_to(label, url, html_attributes)
|
|
195
195
|
end
|
|
196
196
|
%></def>
|
|
197
197
|
|
|
198
198
|
|
|
199
|
-
<def tag="
|
|
199
|
+
<def tag="update-button" attrs="label, message, update, fields, params"><%=
|
|
200
200
|
raise HoboError.new("no update specified") unless update
|
|
201
201
|
message ||= label
|
|
202
202
|
func = ajax_updater(object_url(this), message, update,
|
|
203
203
|
:params => { this.class.name.underscore => fields }.merge(params || {}),
|
|
204
204
|
:method => :put)
|
|
205
|
-
|
|
206
|
-
"button
|
|
205
|
+
element :input, add_classes(attributes.merge(:type =>'button', :onclick => func, :value => label),
|
|
206
|
+
"button update-button update-#{this.class.name.underscore}-button") %>
|
|
207
207
|
</def>
|
|
208
208
|
|
|
209
209
|
|
|
210
|
-
<def tag="
|
|
211
|
-
if can_delete?
|
|
210
|
+
<def tag="delete-button" attrs="label, message, update, in-place, image, confirm, fade, subsite"><%=
|
|
211
|
+
if (Hobo::Dryml.last_if = can_delete?)
|
|
212
212
|
attributes = attributes.merge(if image
|
|
213
213
|
{ :type => "image", :src => "#{base_url}/images/#{image}" }
|
|
214
214
|
else
|
|
@@ -218,9 +218,9 @@
|
|
|
218
218
|
confirm = "Are you sure?" if confirm.nil?
|
|
219
219
|
|
|
220
220
|
add_classes!(attributes,
|
|
221
|
-
image ? "
|
|
222
|
-
"
|
|
223
|
-
url = object_url(this, "destroy")
|
|
221
|
+
image ? "image-button" : "button",
|
|
222
|
+
"delete-button delete-#{this.class.name.underscore.dasherize}-button")
|
|
223
|
+
url = object_url(this, "destroy", :subsite => subsite)
|
|
224
224
|
if in_place == false
|
|
225
225
|
attributes[:confirm] = confirm if confirm
|
|
226
226
|
button_to(label, url, attributes)
|
|
@@ -228,13 +228,15 @@
|
|
|
228
228
|
fade = true if fade.nil?
|
|
229
229
|
attributes[:value] = label
|
|
230
230
|
attributes[:onclick] = "Hobo.removeButton(this, '#{url}', #{js_updates(update)}, {fade:#{fade}, confirm: #{confirm.inspect}})"
|
|
231
|
-
|
|
231
|
+
element(:input, attributes)
|
|
232
232
|
end
|
|
233
|
+
else
|
|
234
|
+
""
|
|
233
235
|
end
|
|
234
236
|
%></def>
|
|
235
237
|
|
|
236
238
|
|
|
237
|
-
<def tag="
|
|
239
|
+
<def tag="create-button" attrs="model, update, label, message, fields"><%=
|
|
238
240
|
raise HoboError.new("no update specified") unless update
|
|
239
241
|
|
|
240
242
|
fields ||= {}
|
|
@@ -244,7 +246,7 @@
|
|
|
244
246
|
fields[this.proxy_reflection.primary_key_name] = this.proxy_owner.id
|
|
245
247
|
this
|
|
246
248
|
else
|
|
247
|
-
raise HoboError.new("invalid context for <
|
|
249
|
+
raise HoboError.new("invalid context for <create-button>")
|
|
248
250
|
end
|
|
249
251
|
new = class_or_assoc.new(fields)
|
|
250
252
|
new.set_creator(current_user)
|
|
@@ -254,13 +256,13 @@
|
|
|
254
256
|
class_name = new.class.name.underscore
|
|
255
257
|
func = ajax_updater(object_url(new.class), message, update,
|
|
256
258
|
({:params => { class_name => fields }} unless fields.empty?))
|
|
257
|
-
|
|
258
|
-
"button
|
|
259
|
+
element :input, add_classes(attributes.merge(:type =>'button', :onclick => func, :value => label),
|
|
260
|
+
"button create-button create-#{class_name}-button")
|
|
259
261
|
end
|
|
260
262
|
%></def>
|
|
261
263
|
|
|
262
264
|
|
|
263
|
-
<def tag="
|
|
265
|
+
<def tag="belongs-to-menu-input" attrs="include-none, blank-message, options"><%
|
|
264
266
|
raise HoboError.new("Not allowed to edit") unless can_edit?
|
|
265
267
|
|
|
266
268
|
blank_message ||= "(No #{this_type.name.to_s.titleize})"
|
|
@@ -272,13 +274,13 @@
|
|
|
272
274
|
select_options.insert(0, [blank_message, ""]) if include_none || (this.nil? && include_none != false)
|
|
273
275
|
attributes = add_classes(attributes, "input", "belongs_to", type_and_field)
|
|
274
276
|
%>
|
|
275
|
-
<select name="#{param_name_for_this(true)}"
|
|
277
|
+
<select name="#{param_name_for_this(true)}" merge-attrs>
|
|
276
278
|
<%= options_for_select(select_options, this ? this.id : "") %>
|
|
277
279
|
</select>
|
|
278
280
|
</def>
|
|
279
281
|
|
|
280
282
|
|
|
281
|
-
<def tag="
|
|
283
|
+
<def tag="belongs-to-autocompleting-input">
|
|
282
284
|
<% refl = this_type
|
|
283
285
|
completer_model ||= refl.klass
|
|
284
286
|
completer_attr ||= refl.klass.id_name_column
|
|
@@ -287,65 +289,65 @@
|
|
|
287
289
|
url = object_url(completer_model, :completions, { :for => completer_attr }.update(where_attributes))
|
|
288
290
|
%>
|
|
289
291
|
|
|
290
|
-
<input type="text" id="#{id}" class="
|
|
291
|
-
name="#{param_name_for_this}"
|
|
292
|
-
<div id="#{id}
|
|
292
|
+
<input type="text" id="#{id}" class="autocomplete-bhv" autocomplete-url="#{url}"
|
|
293
|
+
name="#{param_name_for_this}" merge-attrs/>
|
|
294
|
+
<div id="#{id}-completions" class="completions-popup" style="display:none"></div>
|
|
293
295
|
</def>
|
|
294
296
|
|
|
295
297
|
|
|
296
|
-
<def tag="
|
|
298
|
+
<def tag="sti-type-input">
|
|
297
299
|
<select name="#{param_name_for(form_this, form_field_path + ['type'])}">
|
|
298
300
|
<%= options_for_select(this.class.send(:subclasses).map{|x| [x.name.titleize, x.name]}, this.class.name) %>
|
|
299
301
|
</select>
|
|
300
302
|
</def>
|
|
301
303
|
|
|
302
304
|
|
|
303
|
-
<def tag="
|
|
305
|
+
<def tag="select-input">
|
|
304
306
|
<select name="#{param_name_for_this}">
|
|
305
|
-
<
|
|
307
|
+
<do param="default"/>
|
|
306
308
|
</select>
|
|
307
309
|
</def>
|
|
308
310
|
|
|
309
311
|
|
|
310
|
-
<def tag="
|
|
311
|
-
<section class="
|
|
312
|
+
<def tag="error-messages">
|
|
313
|
+
<section class="error-messages" merge-attrs if="&this.errors.length > 0">
|
|
312
314
|
<h2 param="heading">In order to proceed please correct the following:</h2>
|
|
313
|
-
<
|
|
315
|
+
<ul:errors.full_messages param>
|
|
314
316
|
<li param><%= this %></li>
|
|
315
|
-
</
|
|
317
|
+
</ul>
|
|
316
318
|
</section>
|
|
317
319
|
</def>
|
|
318
320
|
|
|
319
321
|
|
|
320
|
-
<def tag="
|
|
322
|
+
<def tag="name-array-input" attrs="targets, remove-label">
|
|
321
323
|
<%
|
|
322
324
|
all ||= this.member_class.find(:all)
|
|
323
325
|
values = this
|
|
324
326
|
%>
|
|
325
|
-
<div class="input
|
|
326
|
-
<div style="display:none" class="
|
|
327
|
+
<div class="input has-many-through" merge-attrs>
|
|
328
|
+
<div style="display:none" class="item-proto">
|
|
327
329
|
<div class="item">
|
|
328
330
|
<span></span>
|
|
329
331
|
<input type="hidden" name="#{param_name_for_this}[]" />
|
|
330
|
-
<input type="button" class="
|
|
332
|
+
<input type="button" class="remove-item" value="#{remove_label || 'Remove'}"/>
|
|
331
333
|
</div>
|
|
332
334
|
</div>
|
|
333
335
|
<div class="items">
|
|
334
336
|
<div class="item" repeat>
|
|
335
337
|
<span><%= this %></span>
|
|
336
338
|
<input type="hidden" name="#{param_name_for_this}[]" value="#{this}"/>
|
|
337
|
-
<input type="button" class="
|
|
339
|
+
<input type="button" class="remove-item" value="#{remove_label || 'Remove'}"/>
|
|
338
340
|
</div>
|
|
339
341
|
</div>
|
|
340
342
|
<select>
|
|
341
343
|
<option value="">Add a <%= this_field.titleize.singularize %></option>
|
|
342
344
|
<option repeat="&all.sort_by {|x| name(:no_wrapper => true, :with => x).downcase}"
|
|
343
|
-
|
|
345
|
+
merge-attrs="&{:style => 'display:none'} if this.in?(values)"><name/></option>
|
|
344
346
|
</select>
|
|
345
347
|
</div>
|
|
346
348
|
</def>
|
|
347
349
|
|
|
348
350
|
|
|
349
|
-
<def tag="
|
|
351
|
+
<def tag="after-submit" attrs="uri">
|
|
350
352
|
<input type="hidden" value="¶ms[:after_submit] || uri" name="after_submit"/>
|
|
351
353
|
</def>
|