hobo 0.5.3 → 0.6
Sign up to get free protection for your applications and to get access to all the features.
- data/bin/hobo +18 -4
- data/hobo_files/plugin/CHANGES.txt +511 -0
- data/hobo_files/plugin/README +8 -3
- data/hobo_files/plugin/Rakefile +81 -0
- data/hobo_files/plugin/generators/hobo/hobo_generator.rb +4 -4
- data/hobo_files/plugin/generators/hobo/templates/guest.rb +1 -1
- data/hobo_files/plugin/generators/hobo_front_controller/hobo_front_controller_generator.rb +1 -1
- data/hobo_files/plugin/generators/hobo_front_controller/templates/index.dryml +16 -22
- data/hobo_files/plugin/generators/hobo_front_controller/templates/login.dryml +4 -6
- data/hobo_files/plugin/generators/hobo_front_controller/templates/search.dryml +6 -5
- data/hobo_files/plugin/generators/hobo_front_controller/templates/signup.dryml +4 -6
- data/hobo_files/plugin/generators/hobo_migration/hobo_migration_generator.rb +237 -0
- data/hobo_files/plugin/generators/hobo_migration/templates/migration.rb +9 -0
- data/hobo_files/plugin/generators/hobo_model/USAGE +2 -3
- data/hobo_files/plugin/generators/hobo_model/hobo_model_generator.rb +1 -14
- data/hobo_files/plugin/generators/hobo_model/templates/fixtures.yml +1 -6
- data/hobo_files/plugin/generators/hobo_model/templates/model.rb +10 -4
- data/hobo_files/plugin/generators/hobo_rapid/hobo_rapid_generator.rb +7 -6
- data/hobo_files/plugin/generators/hobo_rapid/templates/hobo_base.css +68 -0
- data/hobo_files/plugin/generators/hobo_rapid/templates/hobo_rapid.css +93 -0
- data/hobo_files/plugin/generators/hobo_rapid/templates/hobo_rapid.js +11 -6
- data/hobo_files/plugin/generators/hobo_rapid/templates/themes/default/public/images/plus.png +0 -0
- data/hobo_files/plugin/generators/hobo_rapid/templates/themes/default/public/stylesheets/application.css +24 -14
- data/hobo_files/plugin/generators/hobo_rapid/templates/themes/default/views/application.dryml +28 -44
- data/hobo_files/plugin/generators/hobo_user_model/USAGE +2 -12
- data/hobo_files/plugin/generators/hobo_user_model/hobo_user_model_generator.rb +1 -14
- data/hobo_files/plugin/generators/hobo_user_model/templates/fixtures.yml +0 -6
- data/hobo_files/plugin/generators/hobo_user_model/templates/model.rb +8 -1
- data/hobo_files/plugin/init.rb +6 -2
- data/hobo_files/plugin/lib/active_record/has_many_association.rb +23 -12
- data/hobo_files/plugin/lib/extensions.rb +134 -40
- data/hobo_files/plugin/lib/extensions/test_case.rb +0 -1
- data/hobo_files/plugin/lib/hobo.rb +77 -46
- data/hobo_files/plugin/lib/hobo/authenticated_user.rb +24 -2
- data/hobo_files/plugin/lib/hobo/authentication_support.rb +2 -1
- data/hobo_files/plugin/lib/hobo/controller.rb +35 -12
- data/hobo_files/plugin/lib/hobo/define_tags.rb +4 -4
- data/hobo_files/plugin/lib/hobo/dryml.rb +33 -51
- data/hobo_files/plugin/lib/hobo/dryml/dryml_builder.rb +47 -34
- data/hobo_files/plugin/lib/hobo/dryml/scoped_variables.rb +37 -0
- data/hobo_files/plugin/lib/hobo/dryml/taglib.rb +27 -5
- data/hobo_files/plugin/lib/hobo/dryml/template.rb +545 -302
- data/hobo_files/plugin/lib/hobo/dryml/template_environment.rb +305 -135
- data/hobo_files/plugin/lib/hobo/email_address.rb +5 -0
- data/hobo_files/plugin/lib/hobo/field_spec.rb +66 -0
- data/hobo_files/plugin/lib/hobo/hobo_helper.rb +325 -0
- data/hobo_files/plugin/lib/hobo/html_string.rb +2 -0
- data/hobo_files/plugin/lib/hobo/lazy_hash.rb +13 -1
- data/hobo_files/plugin/lib/hobo/markdown_string.rb +3 -1
- data/hobo_files/plugin/lib/hobo/model.rb +185 -66
- data/hobo_files/plugin/lib/hobo/model_controller.rb +56 -49
- data/hobo_files/plugin/lib/hobo/password_string.rb +2 -0
- data/hobo_files/plugin/lib/hobo/plugins.rb +75 -0
- data/hobo_files/plugin/lib/hobo/rapid_helper.rb +98 -0
- data/hobo_files/plugin/lib/hobo/static_tags +0 -3
- data/hobo_files/plugin/lib/hobo/textile_string.rb +11 -1
- data/hobo_files/plugin/lib/hobo/undefined.rb +1 -1
- data/hobo_files/plugin/lib/rexml.rb +166 -75
- data/hobo_files/plugin/spec/fixtures/users.yml +9 -0
- data/hobo_files/plugin/spec/spec.opts +6 -0
- data/hobo_files/plugin/spec/spec_helper.rb +28 -0
- data/hobo_files/plugin/spec/unit/hobo/dryml/template_spec.rb +650 -0
- data/hobo_files/plugin/tags/core.dryml +58 -4
- data/hobo_files/plugin/tags/rapid.dryml +289 -135
- data/hobo_files/plugin/tags/rapid_document_tags.dryml +49 -0
- data/hobo_files/plugin/tags/rapid_editing.dryml +92 -69
- data/hobo_files/plugin/tags/rapid_forms.dryml +242 -0
- data/hobo_files/plugin/tags/rapid_navigation.dryml +65 -65
- data/hobo_files/plugin/tags/rapid_pages.dryml +197 -124
- data/hobo_files/plugin/tags/rapid_support.dryml +23 -0
- metadata +29 -22
- data/hobo_files/plugin/generators/hobo_model/templates/migration.rb +0 -13
- data/hobo_files/plugin/generators/hobo_rapid/templates/themes/default/default_mapping.rb +0 -11
- data/hobo_files/plugin/generators/hobo_user_model/templates/migration.rb +0 -15
- data/hobo_files/plugin/lib/hobo/HtmlString +0 -3
- data/hobo_files/plugin/lib/hobo/controller_helpers.rb +0 -135
- data/hobo_files/plugin/lib/hobo/core.rb +0 -475
- data/hobo_files/plugin/lib/hobo/rapid.rb +0 -447
- data/hobo_files/plugin/test/hobo_dryml_template_test.rb +0 -7
- data/hobo_files/plugin/test/hobo_test.rb +0 -7
@@ -1,6 +1,60 @@
|
|
1
|
-
<
|
1
|
+
<def tag="call_tag" attrs="tag">
|
2
|
+
<%= send(tag, attributes) %>
|
3
|
+
</def>
|
4
|
+
|
5
|
+
|
6
|
+
<def tag="CallTemplate" attrs="template">
|
7
|
+
<%= send(template, attributes, all_parameters) %>
|
8
|
+
</def>
|
2
9
|
|
3
|
-
|
4
|
-
|
5
|
-
|
10
|
+
|
11
|
+
<def tag="partial" attrs="as">
|
12
|
+
<%= render(:partial => find_partial(this, as), :locals => { :this => this }) %>
|
6
13
|
</def>
|
14
|
+
|
15
|
+
|
16
|
+
<def tag="repeat" attrs="even_odd, join"><%=
|
17
|
+
if !this.blank?
|
18
|
+
if even_odd
|
19
|
+
map_this do
|
20
|
+
klass = [attributes[:class], cycle("even", "odd")].compact.join(' ')
|
21
|
+
content_tag(even_odd, tagbody.call, attributes.merge(:class => klass, :hobo_model_id => dom_id(this)))
|
22
|
+
end.join(join)
|
23
|
+
else
|
24
|
+
scope.new_scope do
|
25
|
+
scope[:even_odd] = "odd"
|
26
|
+
map_this do
|
27
|
+
res = tagbody.call
|
28
|
+
scope.even_odd = scope.even_odd == "even" ? "odd" : "even"
|
29
|
+
res
|
30
|
+
end.join(join)
|
31
|
+
end
|
32
|
+
end
|
33
|
+
else
|
34
|
+
""
|
35
|
+
end
|
36
|
+
%></def>
|
37
|
+
|
38
|
+
|
39
|
+
<def tag="do"><tagbody/></def>
|
40
|
+
<def tag="with"><tagbody/></def>
|
41
|
+
|
42
|
+
|
43
|
+
<def tag="if" attrs="test"><%=
|
44
|
+
test = all_attributes.fetch(:test, this)
|
45
|
+
res = (cond = !test.blank?) ? tagbody.call : ""
|
46
|
+
Hobo::Dryml.last_if = cond
|
47
|
+
res
|
48
|
+
%></def>
|
49
|
+
|
50
|
+
|
51
|
+
<def tag="else"><tagbody unless="&Hobo::Dryml.last_if"/></def>
|
52
|
+
|
53
|
+
|
54
|
+
<def tag="unless" attrs="test"><%=
|
55
|
+
test = all_attributes.fetch(:test, this)
|
56
|
+
res = (cond = test.blank?) ? "" : tagbody.call
|
57
|
+
Hobo::Dryml.last_if = cond
|
58
|
+
res
|
59
|
+
%></def>
|
60
|
+
|
@@ -1,119 +1,307 @@
|
|
1
|
-
<
|
1
|
+
<include module="Hobo::RapidHelper"/>
|
2
2
|
|
3
|
-
<
|
4
|
-
<
|
5
|
-
<
|
3
|
+
<include src="rapid_support"/>
|
4
|
+
<include src="rapid_document_tags"/>
|
5
|
+
<include src="rapid_pages"/>
|
6
|
+
<include src="rapid_editing"/>
|
7
|
+
<include src="rapid_forms"/>
|
8
|
+
<include src="rapid_navigation"/>
|
6
9
|
|
7
|
-
<def tag="
|
10
|
+
<def tag="FieldList" attrs="tag">
|
11
|
+
<% tag ||= (this.respond_to?(:new_record?) && this.new_record?) ? "input" : "editor" %>
|
12
|
+
<field_list merge_attrs="&attributes - attrs_for(:with_fields)">
|
13
|
+
<with_fields merge_attrs="&attributes & attrs_for(:with_fields)">
|
14
|
+
<field_list_item>
|
15
|
+
<item_label param="#{this_field.to_s.sub('?', '')}_label"><%= this_field.to_s.titleize %></item_label>
|
16
|
+
<item_value param="#{this_field.to_s.sub('?', '')}_view"><call_tag tag="&tag" /></item_value>
|
17
|
+
</field_list_item>
|
18
|
+
</with_fields>
|
19
|
+
</field_list>
|
20
|
+
</def>
|
8
21
|
|
9
|
-
<def tag="object_table" attrs="fields, skip, associations">
|
10
|
-
<% field_inner_tag_options, options = options.partition_hash {|k,v| k.to_s =~ /_label$|_editor$/ }
|
11
|
-
inner_tag_options.merge!(field_inner_tag_options)
|
12
|
-
fields = if fields.nil?
|
13
|
-
this.class.content_columns.every(:name) - %w{created_at updated_at}
|
14
|
-
else
|
15
|
-
comma_split(fields)
|
16
|
-
end
|
17
|
-
fields -= comma_split(skip) if skip
|
18
|
-
associations = if associations == '*'
|
19
|
-
this.class.reflections.values.every(:name)
|
20
|
-
elsif associations == 'belongs_to'
|
21
|
-
this.class.reflections.values.oselect{macro == :belongs_to}.every(:name)
|
22
|
-
else
|
23
|
-
comma_split(associations)
|
24
|
-
end
|
25
|
-
associations -= comma_split(skip) if skip
|
26
|
-
options = add_classes(options, "object_table", ("new_record" if this.new_record?))
|
27
|
-
# force load
|
28
|
-
Hobo.models
|
29
|
-
%>
|
30
|
-
<table xattrs="">
|
31
|
-
<if q="#this.new_record? && 'type'.in?(this.class.column_names) && !this.class.send(:subclasses).empty?">
|
32
|
-
<tr>
|
33
|
-
<td class="field_label">Type:</td>
|
34
|
-
<td><sti_type_field/></td>
|
35
|
-
</tr>
|
36
|
-
</if>
|
37
22
|
|
23
|
+
<def tag="item"><% scope.items << tagbody.call %></def>
|
38
24
|
|
39
|
-
<% for field in fields.select{|f| can_view?(this, f)} %>
|
40
|
-
<tr>
|
41
|
-
<td class="field_label" content_option="#field + '_label'"><%= no_break(field.titleize) %>:</td>
|
42
|
-
<td><edit attr="#field" replace_option="#field + '_editor'"/></td>
|
43
|
-
</tr>
|
44
|
-
<% end %>
|
45
25
|
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
26
|
+
<def tag="UL">
|
27
|
+
<ul merge_attrs unless="&this.empty?">
|
28
|
+
<repeat>
|
29
|
+
<li param if="&can_view?" class="#{scope.even_odd} #{this_type.name.underscore}"
|
30
|
+
hobo_model_id="#{dom_id this}">
|
31
|
+
<tagbody><a/></tagbody>
|
32
|
+
</li>
|
33
|
+
</repeat>
|
34
|
+
</ul>
|
35
|
+
</def>
|
52
36
|
|
53
|
-
<tagbody/>
|
54
37
|
|
38
|
+
<def tag="Table">
|
39
|
+
<table merge_attrs unless="&this.empty?">
|
40
|
+
<thead if="&all_parameters[:thead]" param/>
|
41
|
+
<tbody>
|
42
|
+
<repeat>
|
43
|
+
<tr param if="&can_view?"
|
44
|
+
class="#{scope.even_odd} #{this_type.name.underscore}"
|
45
|
+
hobo_model_id="#{dom_id(this)}">
|
46
|
+
</tr>
|
47
|
+
</repeat>
|
48
|
+
</tbody>
|
49
|
+
<tfoot if="&all_parameters[:tfoot]" param/>
|
55
50
|
</table>
|
56
51
|
</def>
|
57
52
|
|
58
53
|
|
59
|
-
<def tag="
|
60
|
-
<
|
61
|
-
|
62
|
-
<p>There are no <%= this_type.klass.name.titleize.pluralize.downcase %></p>
|
63
|
-
</:empty>
|
54
|
+
<def tag="image" attrs="src">
|
55
|
+
<img src="#{base_url}/images/#{src}" merge_attrs/>
|
56
|
+
</def>
|
64
57
|
|
65
|
-
<tagbody/>
|
66
58
|
|
67
|
-
|
68
|
-
|
69
|
-
</if>
|
70
|
-
</table_for>
|
71
|
-
<div>
|
72
|
-
<create_button update="#id || part_id"/>
|
73
|
-
</div>
|
59
|
+
<def tag="spinner">
|
60
|
+
<img src="#{base_url}/hobothemes/#{Hobo.current_theme}/images/spinner.gif" class="hidden" merge_attrs/>
|
74
61
|
</def>
|
75
62
|
|
76
63
|
|
77
|
-
<def tag="
|
78
|
-
<
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
|
86
|
-
|
87
|
-
|
88
|
-
|
89
|
-
|
90
|
-
|
91
|
-
|
92
|
-
|
93
|
-
|
64
|
+
<def tag="theme_image" attrs="src">
|
65
|
+
<img src="#{theme_asset('images/' + src)}" merge_attrs/>
|
66
|
+
</def>
|
67
|
+
|
68
|
+
|
69
|
+
<def tag="card">
|
70
|
+
<%= poly = call_polymorphic_tag('card', attributes) %>
|
71
|
+
<div class="card" unless="&poly"><human_type/>: <a/></div>
|
72
|
+
</def>
|
73
|
+
|
74
|
+
|
75
|
+
<def tag="hobo_rapid_javascripts" attrs="tiny_mce"><%=
|
76
|
+
res = javascript_include_tag("hobo_rapid")
|
77
|
+
res += '<script type="text/javascript">'
|
78
|
+
unless Hobo.all_controllers.empty?
|
79
|
+
res += "var controllerNames = {" +
|
80
|
+
Hobo.all_controllers.map {|c| "#{c.singularize}: '#{c}'"}.join(', ') +
|
81
|
+
"}; "
|
82
|
+
end
|
83
|
+
res += "urlBase = '#{base_url}'; hoboPartPage = '#{view_name}'</script>"
|
84
|
+
|
85
|
+
if tiny_mce
|
86
|
+
res += javascript_include_tag("tiny_mce/tiny_mce_src") + %{
|
87
|
+
<script type="text/javascript">
|
88
|
+
tinyMCE.init({ mode: "textareas", editor_selector: "tiny_mce",
|
89
|
+
plugins: 'save',
|
90
|
+
theme_advanced_buttons1 : "bold, italic, separator, " +
|
91
|
+
"bullist, outdent, indent, separator, " +
|
92
|
+
"undo, redo, separator, link, unlink",
|
93
|
+
theme_advanced_buttons2 : "",
|
94
|
+
theme_advanced_buttons3 : ""
|
95
|
+
});
|
96
|
+
</script>}
|
97
|
+
end
|
98
|
+
res
|
99
|
+
%></def>
|
100
|
+
|
101
|
+
|
102
|
+
<def tag="name"><%=
|
103
|
+
if this.nil?
|
104
|
+
"(not available)"
|
105
|
+
else
|
106
|
+
name_tag = find_polymorphic_tag("name")
|
107
|
+
if name_tag != "name"
|
108
|
+
send(name_tag)
|
109
|
+
elsif this.is_a?(Array) && this.respond_to?(:proxy_reflection)
|
110
|
+
count
|
111
|
+
elsif this.is_a? Class and this < ActiveRecord::Base
|
112
|
+
this.name.pluralize.titleize
|
113
|
+
elsif this.respond_to?(:name)
|
114
|
+
view(merge_attrs(attributes, {:field => 'name'}))
|
115
|
+
elsif this.respond_to?(:title)
|
116
|
+
view(merge_attrs(attributes, {:field => 'title'}))
|
117
|
+
else
|
118
|
+
this.to_s
|
119
|
+
end
|
120
|
+
end
|
121
|
+
%></def>
|
122
|
+
|
123
|
+
|
124
|
+
<def tag="a" attrs="action, to, params, resource_type, href"><%=
|
125
|
+
content = tagbody.call if tagbody
|
126
|
+
|
127
|
+
if href || attributes[:name]
|
128
|
+
# Regular link - skip all this stuff
|
129
|
+
else
|
130
|
+
target = to || this
|
131
|
+
|
132
|
+
return "(Not Available)" if target.nil?
|
133
|
+
|
134
|
+
if action == "new"
|
135
|
+
# Link to a new object form
|
136
|
+
|
137
|
+
new_class_name = if target.respond_to?(:proxy_reflection)
|
138
|
+
target.proxy_reflection.klass.name
|
139
|
+
else
|
140
|
+
target.name
|
141
|
+
end
|
142
|
+
|
143
|
+
href = object_url(target, "new")
|
144
|
+
add_classes!(attributes, "new_#{new_class_name.underscore}_link")
|
145
|
+
content ||= "New #{new_class_name.titleize}"
|
146
|
+
else
|
147
|
+
# Link to an existing object
|
148
|
+
|
149
|
+
href = if resource_type
|
150
|
+
send("formatted_#{model.to_s.downcase}_url", this, resource_type.downcase)
|
151
|
+
else
|
152
|
+
object_url(target, action, params)
|
153
|
+
end
|
154
|
+
add_classes!(attributes, "#{target.class.name.underscore}_link")
|
155
|
+
|
156
|
+
# Set default link text if none given
|
157
|
+
content ||= name
|
158
|
+
end
|
159
|
+
end
|
160
|
+
content_tag :a, content, attributes.update(:href => href)
|
161
|
+
%></def>
|
162
|
+
|
163
|
+
|
164
|
+
<def tag="view" attrs="inline, block, if_blank, no_wrapper"><%=
|
165
|
+
raise HoboError, "view of non-viewable field '#{this_field}' of #{this_parent.typed_id rescue this_parent}" unless
|
166
|
+
can_view?
|
167
|
+
|
168
|
+
if this == nil
|
169
|
+
this_type.is_a?(Class) && this_type <= String ? "" : "(Not Available)"
|
170
|
+
elsif this_type.respond_to?(:macro)
|
171
|
+
if this_type.macro == :belongs_to
|
172
|
+
belongs_to_view(attributes)
|
173
|
+
elsif this_type.macro == :has_many
|
174
|
+
has_many_view(attributes)
|
175
|
+
end
|
176
|
+
else
|
177
|
+
attrs = add_classes(attributes, "view", type_name, type_and_field)
|
178
|
+
attrs[:hobo_model_id] = this_field_dom_id if this_parent && this_parent.respond_to?(:typed_id)
|
179
|
+
|
180
|
+
view_tag = find_polymorphic_tag("view")
|
181
|
+
|
182
|
+
if view_tag == "view" # i.e. it didn't find a type specific tag
|
183
|
+
raise HoboError, "Cannot view: #{this.inspect} (field is #{this_field}, type is #{this.class})"
|
184
|
+
else
|
185
|
+
view_attrs = attrs_for(view_tag)
|
186
|
+
the_view = send(view_tag, attrs & view_attrs)
|
187
|
+
|
188
|
+
the_view = if_blank if if_blank && the_view.blank?
|
189
|
+
|
190
|
+
if no_wrapper
|
191
|
+
the_view
|
192
|
+
else
|
193
|
+
wrapper = if inline
|
194
|
+
:span
|
195
|
+
elsif block || (this.class.const_defined?(:COLUMN_TYPE) && this.class::COLUMN_TYPE == :text)
|
196
|
+
:div
|
197
|
+
else
|
198
|
+
:span
|
199
|
+
end
|
200
|
+
content_tag(wrapper, the_view, attrs - view_attrs)
|
201
|
+
end
|
202
|
+
end
|
203
|
+
end
|
204
|
+
%></def>
|
205
|
+
|
206
|
+
|
207
|
+
<def tag="belongs_to_view"><a/></def>
|
208
|
+
|
209
|
+
<def tag="has_many_view"><%= this.empty? ? "(none)" : map_this { a }.join(", ") %></def>
|
210
|
+
|
211
|
+
<def tag="view" for="Date"><%= this.to_s(:long) %></def>
|
212
|
+
|
213
|
+
<def tag="view" for="Time"><%= this.to_s(:long) %></def>
|
214
|
+
|
215
|
+
<def tag="view" for="Numeric" attrs="format"><%= format ? format % this : this.to_s %></def>
|
216
|
+
|
217
|
+
<def tag="view" for="Hobo::Text"><%= h(this).gsub("\n", "<br/>") %></def>
|
218
|
+
|
219
|
+
<def tag="view" for="html"><%= this %></def>
|
220
|
+
|
221
|
+
<def tag="view" for="Hobo::MarkdownString"><%= this.to_html %></def>
|
222
|
+
|
223
|
+
<def tag="view" for="Hobo::TextileString"><%= this.to_html %></def>
|
224
|
+
|
225
|
+
<def tag="view" for="Hobo::PasswordString">[password withheld]</def>
|
226
|
+
|
227
|
+
<def tag="view" for="String"><%= h(this).gsub("\n", "<br/>") %></def>
|
228
|
+
|
229
|
+
<def tag="view" for="TrueClass"><%= this ? 'Yes' : 'No' %></def>
|
230
|
+
|
231
|
+
<def tag="human_type" attrs="style"><%=
|
232
|
+
if can_view?
|
233
|
+
res = if this.respond_to? :proxy_reflection
|
234
|
+
this.proxy_reflection.klass.name.pluralize
|
235
|
+
elsif this.is_a? Class
|
236
|
+
this.name
|
237
|
+
else
|
238
|
+
this.class.name
|
239
|
+
end
|
240
|
+
res.underscore.humanize.send(style || :titleize)
|
241
|
+
end
|
242
|
+
%></def>
|
243
|
+
|
244
|
+
|
245
|
+
<def tag="count" attrs="label, prefix, unless_none"><%=
|
246
|
+
raise Exception.new("asked for count of a string") if this.is_a?(String)
|
247
|
+
|
248
|
+
if this.is_a?(Class) and this < ActiveRecord::Base
|
249
|
+
c = this.count
|
250
|
+
label ||= this.name.titleize
|
251
|
+
else
|
252
|
+
label ||= this.respond_to?(:proxy_reflection) && this.proxy_reflection.name.to_s.singularize.titleize
|
253
|
+
c = if this.is_a?(Fixnum)
|
254
|
+
this
|
255
|
+
elsif this.respond_to?(:count)
|
256
|
+
this.count
|
257
|
+
else
|
258
|
+
this.length
|
259
|
+
end
|
260
|
+
end
|
261
|
+
|
262
|
+
Dryml.last_if = c > 0 if unless_none
|
263
|
+
if unless_none && c == 0
|
264
|
+
""
|
265
|
+
else
|
266
|
+
main = label.blank? ? c : pluralize(c, label)
|
267
|
+
|
268
|
+
if prefix.in? %w(are is)
|
269
|
+
p = c == 1 ? "is" : "are"
|
270
|
+
p + ' ' + main
|
271
|
+
else
|
272
|
+
main
|
273
|
+
end
|
274
|
+
end
|
275
|
+
%></def>
|
276
|
+
|
277
|
+
|
278
|
+
<def tag="theme_stylesheet">
|
279
|
+
<link href="<%= base_url %>/hobothemes/<%= Hobo.current_theme %>/stylesheets/application.css"
|
280
|
+
media="screen" rel="Stylesheet" type="text/css" />
|
94
281
|
</def>
|
95
282
|
|
96
283
|
|
97
|
-
<def tag="
|
98
|
-
|
99
|
-
|
100
|
-
|
284
|
+
<def tag="clearer"><div class='clearer'> </div></def>
|
285
|
+
|
286
|
+
|
287
|
+
<!-- The Tags defined below here are a bit rough and will be improved
|
288
|
+
in the future - use at your own risk. -->
|
289
|
+
|
290
|
+
<def tag="has_many_table" attrs="part_id, delete_buttons, headings, id">
|
291
|
+
<table_for headings="&headings" merge_attrs="&true">
|
292
|
+
|
293
|
+
<tagbody/>
|
294
|
+
|
295
|
+
<if test="&delete_buttons != false and can_delete?(this)">
|
296
|
+
<td><DeleteButton/></td>
|
297
|
+
</if>
|
298
|
+
</table_for>
|
101
299
|
<else>
|
102
|
-
<
|
103
|
-
<if q="#headings"><tr><%= headings %></tr></if>
|
104
|
-
<% even_odd = "odd" %>
|
105
|
-
<repeat>
|
106
|
-
<if_can_view>
|
107
|
-
<tr class="<%= even_odd %> <%= row_class %> <%= this_type.name.underscore %>"
|
108
|
-
hobo_model_id="<%= dom_id(this) %>">
|
109
|
-
<%= tagbody && tagbody.call %>
|
110
|
-
</tr>
|
111
|
-
<% even_odd = even_odd == "even" ? "odd" : "even" %>
|
112
|
-
</if_can_view>
|
113
|
-
</repeat>
|
114
|
-
<%= footer %>
|
115
|
-
</table>
|
300
|
+
<p>There are no <%= this_type.klass.name.titleize.pluralize.downcase %></p>
|
116
301
|
</else>
|
302
|
+
<div>
|
303
|
+
<CreateButton update="&id || part_id"/>
|
304
|
+
</div>
|
117
305
|
</def>
|
118
306
|
|
119
307
|
|
@@ -127,51 +315,17 @@
|
|
127
315
|
"enter its name"
|
128
316
|
source = refl.source_reflection.name
|
129
317
|
%>
|
130
|
-
<tagbody
|
131
|
-
<with
|
132
|
-
<
|
133
|
-
<
|
318
|
+
<tagbody with="&joins"/>
|
319
|
+
<with with="&joins.new_without_appending">
|
320
|
+
<if test="can_create?">
|
321
|
+
<form update="&[update, part_id]" message="&action_name" hidden_fields="*">
|
134
322
|
<p>
|
135
323
|
<%= add_text %>:
|
136
|
-
<belongs_to_autocompleting_field
|
324
|
+
<belongs_to_autocompleting_field field="&source" where_not_in="&dom_id(add_to)" class="autosubmit"/>
|
137
325
|
</p>
|
138
|
-
</
|
139
|
-
</
|
326
|
+
</form>
|
327
|
+
</if>
|
140
328
|
</with>
|
141
329
|
</def>
|
142
330
|
|
143
331
|
|
144
|
-
<def tag="spinner">
|
145
|
-
<img src="<%= urlb %>/hobothemes/<%= Hobo.current_theme %>/images/spinner.gif" class="hidden" xattrs=""/>
|
146
|
-
</def>
|
147
|
-
|
148
|
-
|
149
|
-
<def tag="image" attrs="src">
|
150
|
-
<img src="<%= urlb %>/images/<%= src %>" xattrs=""/>
|
151
|
-
</def>
|
152
|
-
|
153
|
-
|
154
|
-
<def tag="theme_img" attrs="src">
|
155
|
-
<img src="<%= theme_asset('images/' + src)%>" xattrs=""/>
|
156
|
-
</def>
|
157
|
-
|
158
|
-
|
159
|
-
<def tag="search_result">
|
160
|
-
<div class='search_result'>
|
161
|
-
<human_type/>: <object_link/>
|
162
|
-
</div>
|
163
|
-
</def>
|
164
|
-
|
165
|
-
|
166
|
-
<def tag="object_card">
|
167
|
-
<div class="object_card">
|
168
|
-
<object_link/>
|
169
|
-
</div>
|
170
|
-
</def>
|
171
|
-
|
172
|
-
|
173
|
-
<def tag="section_if">
|
174
|
-
<% body = tagbody.call %>
|
175
|
-
<%= body.blank? ? "" : section{body} %>
|
176
|
-
</def>
|
177
|
-
|