hobo 0.5.3
Sign up to get free protection for your applications and to get access to all the features.
- data/LICENSE.txt +22 -0
- data/README.txt +18 -0
- data/bin/hobo +81 -0
- data/hobo_files/plugin/CHANGES.txt +963 -0
- data/hobo_files/plugin/LICENSE.txt +22 -0
- data/hobo_files/plugin/README +4 -0
- data/hobo_files/plugin/Rakefile +11 -0
- data/hobo_files/plugin/generators/hobo/hobo_generator.rb +37 -0
- data/hobo_files/plugin/generators/hobo/templates/application.dryml +2 -0
- data/hobo_files/plugin/generators/hobo/templates/guest.rb +31 -0
- data/hobo_files/plugin/generators/hobo_front_controller/USAGE +11 -0
- data/hobo_files/plugin/generators/hobo_front_controller/hobo_front_controller_generator.rb +90 -0
- data/hobo_files/plugin/generators/hobo_front_controller/templates/controller.rb +51 -0
- data/hobo_files/plugin/generators/hobo_front_controller/templates/functional_test.rb +18 -0
- data/hobo_files/plugin/generators/hobo_front_controller/templates/helper.rb +2 -0
- data/hobo_files/plugin/generators/hobo_front_controller/templates/index.dryml +43 -0
- data/hobo_files/plugin/generators/hobo_front_controller/templates/login.dryml +44 -0
- data/hobo_files/plugin/generators/hobo_front_controller/templates/search.dryml +18 -0
- data/hobo_files/plugin/generators/hobo_front_controller/templates/signup.dryml +45 -0
- data/hobo_files/plugin/generators/hobo_model/USAGE +26 -0
- data/hobo_files/plugin/generators/hobo_model/hobo_model_generator.rb +38 -0
- data/hobo_files/plugin/generators/hobo_model/templates/fixtures.yml +11 -0
- data/hobo_files/plugin/generators/hobo_model/templates/migration.rb +13 -0
- data/hobo_files/plugin/generators/hobo_model/templates/model.rb +24 -0
- data/hobo_files/plugin/generators/hobo_model/templates/unit_test.rb +10 -0
- data/hobo_files/plugin/generators/hobo_model_controller/USAGE +30 -0
- data/hobo_files/plugin/generators/hobo_model_controller/hobo_model_controller_generator.rb +43 -0
- data/hobo_files/plugin/generators/hobo_model_controller/templates/controller.rb +5 -0
- data/hobo_files/plugin/generators/hobo_model_controller/templates/functional_test.rb +18 -0
- data/hobo_files/plugin/generators/hobo_model_controller/templates/helper.rb +2 -0
- data/hobo_files/plugin/generators/hobo_model_controller/templates/view.rhtml +2 -0
- data/hobo_files/plugin/generators/hobo_rapid/hobo_rapid_generator.rb +51 -0
- data/hobo_files/plugin/generators/hobo_rapid/templates/hobo_rapid.js +436 -0
- data/hobo_files/plugin/generators/hobo_rapid/templates/themes/default/default_mapping.rb +11 -0
- data/hobo_files/plugin/generators/hobo_rapid/templates/themes/default/public/images/banner.gif +0 -0
- data/hobo_files/plugin/generators/hobo_rapid/templates/themes/default/public/images/bkg_bodytop.gif +0 -0
- data/hobo_files/plugin/generators/hobo_rapid/templates/themes/default/public/images/bkg_corner_01.gif +0 -0
- data/hobo_files/plugin/generators/hobo_rapid/templates/themes/default/public/images/bkg_corner_02.gif +0 -0
- data/hobo_files/plugin/generators/hobo_rapid/templates/themes/default/public/images/bkg_corner_03.gif +0 -0
- data/hobo_files/plugin/generators/hobo_rapid/templates/themes/default/public/images/bkg_corner_04.gif +0 -0
- data/hobo_files/plugin/generators/hobo_rapid/templates/themes/default/public/images/bkg_shadow_bottom.gif +0 -0
- data/hobo_files/plugin/generators/hobo_rapid/templates/themes/default/public/images/bkg_shadow_left.gif +0 -0
- data/hobo_files/plugin/generators/hobo_rapid/templates/themes/default/public/images/bkg_shadow_right.gif +0 -0
- data/hobo_files/plugin/generators/hobo_rapid/templates/themes/default/public/images/bkg_shadow_top.gif +0 -0
- data/hobo_files/plugin/generators/hobo_rapid/templates/themes/default/public/images/header_blue.gif +0 -0
- data/hobo_files/plugin/generators/hobo_rapid/templates/themes/default/public/images/header_dblue.gif +0 -0
- data/hobo_files/plugin/generators/hobo_rapid/templates/themes/default/public/images/header_green.gif +0 -0
- data/hobo_files/plugin/generators/hobo_rapid/templates/themes/default/public/images/header_purple.gif +0 -0
- data/hobo_files/plugin/generators/hobo_rapid/templates/themes/default/public/images/header_red.gif +0 -0
- data/hobo_files/plugin/generators/hobo_rapid/templates/themes/default/public/images/logo.gif +0 -0
- data/hobo_files/plugin/generators/hobo_rapid/templates/themes/default/public/images/spinner.gif +0 -0
- data/hobo_files/plugin/generators/hobo_rapid/templates/themes/default/public/images/txt_list_img_dblue.gif +0 -0
- data/hobo_files/plugin/generators/hobo_rapid/templates/themes/default/public/images/txt_list_img_green.gif +0 -0
- data/hobo_files/plugin/generators/hobo_rapid/templates/themes/default/public/images/txt_list_img_purple.gif +0 -0
- data/hobo_files/plugin/generators/hobo_rapid/templates/themes/default/public/images/txt_list_img_red.gif +0 -0
- data/hobo_files/plugin/generators/hobo_rapid/templates/themes/default/public/images/window_corner_01.gif +0 -0
- data/hobo_files/plugin/generators/hobo_rapid/templates/themes/default/public/images/window_corner_02.gif +0 -0
- data/hobo_files/plugin/generators/hobo_rapid/templates/themes/default/public/images/window_corner_03.gif +0 -0
- data/hobo_files/plugin/generators/hobo_rapid/templates/themes/default/public/images/window_corner_04.gif +0 -0
- data/hobo_files/plugin/generators/hobo_rapid/templates/themes/default/public/images/window_shadow_bottom.gif +0 -0
- data/hobo_files/plugin/generators/hobo_rapid/templates/themes/default/public/images/window_shadow_left.gif +0 -0
- data/hobo_files/plugin/generators/hobo_rapid/templates/themes/default/public/images/window_shadow_right.gif +0 -0
- data/hobo_files/plugin/generators/hobo_rapid/templates/themes/default/public/images/window_shadow_top.gif +0 -0
- data/hobo_files/plugin/generators/hobo_rapid/templates/themes/default/public/stylesheets/application.css +390 -0
- data/hobo_files/plugin/generators/hobo_rapid/templates/themes/default/views/application.dryml +104 -0
- data/hobo_files/plugin/generators/hobo_user_model/USAGE +26 -0
- data/hobo_files/plugin/generators/hobo_user_model/hobo_user_model_generator.rb +38 -0
- data/hobo_files/plugin/generators/hobo_user_model/templates/fixtures.yml +11 -0
- data/hobo_files/plugin/generators/hobo_user_model/templates/migration.rb +15 -0
- data/hobo_files/plugin/generators/hobo_user_model/templates/model.rb +58 -0
- data/hobo_files/plugin/generators/hobo_user_model/templates/unit_test.rb +10 -0
- data/hobo_files/plugin/init.rb +44 -0
- data/hobo_files/plugin/lib/action_view_extensions/base.rb +14 -0
- data/hobo_files/plugin/lib/active_record/has_many_association.rb +54 -0
- data/hobo_files/plugin/lib/active_record/has_many_through_association.rb +22 -0
- data/hobo_files/plugin/lib/active_record/table_definition.rb +34 -0
- data/hobo_files/plugin/lib/extensions.rb +245 -0
- data/hobo_files/plugin/lib/extensions/test_case.rb +130 -0
- data/hobo_files/plugin/lib/hobo.rb +353 -0
- data/hobo_files/plugin/lib/hobo/HtmlString +3 -0
- data/hobo_files/plugin/lib/hobo/authenticated_user.rb +106 -0
- data/hobo_files/plugin/lib/hobo/authentication_support.rb +108 -0
- data/hobo_files/plugin/lib/hobo/composite_model.rb +66 -0
- data/hobo_files/plugin/lib/hobo/controller.rb +134 -0
- data/hobo_files/plugin/lib/hobo/controller_helpers.rb +135 -0
- data/hobo_files/plugin/lib/hobo/core.rb +475 -0
- data/hobo_files/plugin/lib/hobo/define_tags.rb +56 -0
- data/hobo_files/plugin/lib/hobo/dryml.rb +161 -0
- data/hobo_files/plugin/lib/hobo/dryml/dryml_builder.rb +126 -0
- data/hobo_files/plugin/lib/hobo/dryml/tag_module.rb +9 -0
- data/hobo_files/plugin/lib/hobo/dryml/taglib.rb +57 -0
- data/hobo_files/plugin/lib/hobo/dryml/template.rb +586 -0
- data/hobo_files/plugin/lib/hobo/dryml/template_environment.rb +302 -0
- data/hobo_files/plugin/lib/hobo/dryml/template_handler.rb +19 -0
- data/hobo_files/plugin/lib/hobo/generator.rb +25 -0
- data/hobo_files/plugin/lib/hobo/html_string.rb +3 -0
- data/hobo_files/plugin/lib/hobo/lazy_hash.rb +28 -0
- data/hobo_files/plugin/lib/hobo/mapping_tags.rb +262 -0
- data/hobo_files/plugin/lib/hobo/markdown_string.rb +7 -0
- data/hobo_files/plugin/lib/hobo/model.rb +391 -0
- data/hobo_files/plugin/lib/hobo/model_controller.rb +676 -0
- data/hobo_files/plugin/lib/hobo/model_queries.rb +92 -0
- data/hobo_files/plugin/lib/hobo/model_support.rb +44 -0
- data/hobo_files/plugin/lib/hobo/password_string.rb +3 -0
- data/hobo_files/plugin/lib/hobo/predicate_dispatch.rb +78 -0
- data/hobo_files/plugin/lib/hobo/proc_binding.rb +32 -0
- data/hobo_files/plugin/lib/hobo/rapid.rb +447 -0
- data/hobo_files/plugin/lib/hobo/static_tags +92 -0
- data/hobo_files/plugin/lib/hobo/text.rb +3 -0
- data/hobo_files/plugin/lib/hobo/textile_string.rb +13 -0
- data/hobo_files/plugin/lib/hobo/undefined.rb +41 -0
- data/hobo_files/plugin/lib/hobo/undefined_access_error.rb +5 -0
- data/hobo_files/plugin/lib/hobo/where_fragment.rb +23 -0
- data/hobo_files/plugin/lib/rexml.rb +345 -0
- data/hobo_files/plugin/tags/core.dryml +6 -0
- data/hobo_files/plugin/tags/rapid.dryml +177 -0
- data/hobo_files/plugin/tags/rapid_editing.dryml +168 -0
- data/hobo_files/plugin/tags/rapid_navigation.dryml +95 -0
- data/hobo_files/plugin/tags/rapid_pages.dryml +175 -0
- data/hobo_files/plugin/tasks/environments.rake +19 -0
- data/hobo_files/plugin/tasks/hobo_tasks.rake +4 -0
- data/hobo_files/plugin/test/hobo_dryml_template_test.rb +7 -0
- data/hobo_files/plugin/test/hobo_test.rb +7 -0
- data/hobo_files/plugin/uninstall.rb +1 -0
- metadata +206 -0
@@ -0,0 +1,177 @@
|
|
1
|
+
<taglib module="Hobo::Rapid"/>
|
2
|
+
|
3
|
+
<taglib src="rapid_pages"/>
|
4
|
+
<taglib src="rapid_editing"/>
|
5
|
+
<taglib src="rapid_navigation"/>
|
6
|
+
|
7
|
+
<def tag="clearer"><div class='clearer'> </div></def>
|
8
|
+
|
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
|
+
|
38
|
+
|
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
|
+
|
46
|
+
<% for field in associations.select{|f| can_view?(this, f)} %>
|
47
|
+
<tr>
|
48
|
+
<td class="field_label" content_option="#field.to_s + '_label'"><%= no_break(field.to_s.titleize) %>:</td>
|
49
|
+
<td><edit attr="#field" replace_option="#field.to_s + '_editor'"/></td>
|
50
|
+
</tr>
|
51
|
+
<% end %>
|
52
|
+
|
53
|
+
<tagbody/>
|
54
|
+
|
55
|
+
</table>
|
56
|
+
</def>
|
57
|
+
|
58
|
+
|
59
|
+
<def tag="has_many_table" attrs="part_id, delete_buttons, headings, id">
|
60
|
+
<table_for headings="#headings" xattrs="">
|
61
|
+
<:empty>
|
62
|
+
<p>There are no <%= this_type.klass.name.titleize.pluralize.downcase %></p>
|
63
|
+
</:empty>
|
64
|
+
|
65
|
+
<tagbody/>
|
66
|
+
|
67
|
+
<if q="#delete_buttons != false and can_delete?(this)">
|
68
|
+
<td><delete_button/></td>
|
69
|
+
</if>
|
70
|
+
</table_for>
|
71
|
+
<div>
|
72
|
+
<create_button update="#id || part_id"/>
|
73
|
+
</div>
|
74
|
+
</def>
|
75
|
+
|
76
|
+
|
77
|
+
<def tag="ul_for" attrs="else">
|
78
|
+
<if q="#this.empty? and else_">
|
79
|
+
<%= else_ %>
|
80
|
+
</if>
|
81
|
+
<else>
|
82
|
+
<ul xattrs="">
|
83
|
+
<% even_odd = "odd" %>
|
84
|
+
<repeat>
|
85
|
+
<if_can_view>
|
86
|
+
<li class="<%= even_odd %> <%= this_type.name.underscore %>" hobo_model_id="<%= dom_id this %>">
|
87
|
+
<%= tagbody.nil? ? object_link : tagbody.call %>
|
88
|
+
</li>
|
89
|
+
</if_can_view>
|
90
|
+
<% even_odd = even_odd == "even" ? "odd" : "even" %>
|
91
|
+
</repeat>
|
92
|
+
</ul>
|
93
|
+
</else>
|
94
|
+
</def>
|
95
|
+
|
96
|
+
|
97
|
+
<def tag="table_for" attrs="headings, row_class, footer, else">
|
98
|
+
<if q="#this.empty? and else_">
|
99
|
+
<%= else_ %>
|
100
|
+
</if>
|
101
|
+
<else>
|
102
|
+
<table xattrs="">
|
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>
|
116
|
+
</else>
|
117
|
+
</def>
|
118
|
+
|
119
|
+
|
120
|
+
<def tag="add_by_name" attrs="action_name, add_text, update, part_id">
|
121
|
+
<% add_to = this
|
122
|
+
refl = this_type
|
123
|
+
joins = this_parent.send(refl.through_reflection.name)
|
124
|
+
add_name = refl.klass.name.titleize
|
125
|
+
action_name ||= "Add #{add_name}"
|
126
|
+
add_text ||= "To #{action_name.downcase} #{a_or_an add_name.downcase}, " +
|
127
|
+
"enter its name"
|
128
|
+
source = refl.source_reflection.name
|
129
|
+
%>
|
130
|
+
<tagbody obj="#joins"/>
|
131
|
+
<with obj="#joins.new_without_appending">
|
132
|
+
<if_can_create>
|
133
|
+
<object_form update="#[update, part_id]" message="#action_name" hidden_fields="*">
|
134
|
+
<p>
|
135
|
+
<%= add_text %>:
|
136
|
+
<belongs_to_autocompleting_field attr="#source" where_not_in="#dom_id(add_to)" class="autosubmit"/>
|
137
|
+
</p>
|
138
|
+
</object_form>
|
139
|
+
</if_can_create>
|
140
|
+
</with>
|
141
|
+
</def>
|
142
|
+
|
143
|
+
|
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
|
+
|
@@ -0,0 +1,168 @@
|
|
1
|
+
|
2
|
+
<def tag="submit" attrs="label">
|
3
|
+
<input type="submit" value="<%= label %>" xattrs="" class="button_input submit_button"/>
|
4
|
+
</def>
|
5
|
+
|
6
|
+
|
7
|
+
<def tag="autocompleter" attrs="completer_model, completer_attr, id, filter, name, value">
|
8
|
+
<% refl = this_type
|
9
|
+
if refl.respond_to?(:macro) && refl.macro == :belongs_to
|
10
|
+
completer_model ||= refl.klass
|
11
|
+
completer_attr ||= refl.klass.id_name_column
|
12
|
+
else
|
13
|
+
completer_model = completer_model.constantize if completer_model.is_a? String
|
14
|
+
end
|
15
|
+
id ||= this_field_dom_id + "_completer"
|
16
|
+
url = object_url(completer_model, "completions",
|
17
|
+
{ :for => completer_attr },
|
18
|
+
options.select_hash {|k,v| k.to_s.starts_with? "where_"})
|
19
|
+
%>
|
20
|
+
<input type="text" name="<%= name %>" id="<%= id %>" class="autocomplete_bhv"
|
21
|
+
autocomplete_url="<%= url %>" value="<%= value %>"
|
22
|
+
xattrs=""/>
|
23
|
+
<div id="<%= id %>_completions" class="completions_popup" style="display:none"></div>
|
24
|
+
</def>
|
25
|
+
|
26
|
+
|
27
|
+
<def tag="belongs_to_menu_field"><%
|
28
|
+
raise HoboError.new("Not allowed to edit") unless can_edit_this?
|
29
|
+
#Todo: switch to autocompleter for id_name when too many records, and id_name supported
|
30
|
+
select_options = this_type.klass.find(:all).select {|x| can_view?(x)}.map { |x|
|
31
|
+
[ display_name(:obj => x, :no_span => true), x.id ]
|
32
|
+
}
|
33
|
+
select_options.insert(0, ["(No #{this_type.name.to_s.titleize})", ""]) if this.nil?
|
34
|
+
%>
|
35
|
+
<select name="<%= param_name_for_this(true) %>">
|
36
|
+
<%= options_for_select(select_options.sort, this ? this.id : "") %>
|
37
|
+
</select>
|
38
|
+
</def>
|
39
|
+
|
40
|
+
|
41
|
+
<def tag="belongs_to_menu_editor"><%
|
42
|
+
raise HoboError.new("Not allowed to edit") unless can_edit_this?
|
43
|
+
link_id = "#{this_field_dom_id}_editor" %>
|
44
|
+
<span id="#link_id" part_id="rapid_belongs_to_edit">
|
45
|
+
<% select_options = this_type.klass.find(:all).select {|x| can_view?(x)}.map {|x|
|
46
|
+
[ display_name(:obj => x, :no_span => true), x.id ]
|
47
|
+
}
|
48
|
+
select_options.insert(0, ["(No #{this_type.name.to_s.titleize})", ""]) if this.nil?
|
49
|
+
link_id = "#{this_field_dom_id}_editor"
|
50
|
+
f = ajax_updater(object_url(this_parent),
|
51
|
+
"Change #{this_field.to_s.titleize}", [link_id],
|
52
|
+
:method => "put",
|
53
|
+
:params => { this_parent.class.name.underscore => {
|
54
|
+
this_type.primary_key_name => Hobo.raw_js('this.value')
|
55
|
+
} })
|
56
|
+
%>
|
57
|
+
<select onchange="<%= f %>" id="#link_id">
|
58
|
+
<%= options_for_select(select_options.sort, this ? this.id : "") %>
|
59
|
+
</select>
|
60
|
+
<if_this><object_link>View</object_link></if_this>
|
61
|
+
</span>
|
62
|
+
</def>
|
63
|
+
|
64
|
+
|
65
|
+
<def tag="belongs_to_autocompleting_field">
|
66
|
+
<% refl = this_type
|
67
|
+
completer_model ||= refl.klass
|
68
|
+
completer_attr ||= refl.klass.id_name_column
|
69
|
+
id ||= this_field_dom_id + "_completer"
|
70
|
+
where_options = options.select_hash {|k,v| k.to_s.starts_with? "where_"}
|
71
|
+
url = object_url(completer_model, :completions, { :for => completer_attr }.update(where_options))
|
72
|
+
%>
|
73
|
+
|
74
|
+
<input type="text" id="<%= id %>" class="autocomplete_bhv" autocomplete_url="<%= url %>"
|
75
|
+
name="<%= param_name_for_this %>" xattrs=""/>
|
76
|
+
<div id="<%= id %>_completions" class="completions_popup" style="display:none"></div>
|
77
|
+
</def>
|
78
|
+
|
79
|
+
|
80
|
+
<def tag="belongs_to_autocompleting_editor" attrs="update">
|
81
|
+
<if_can_edit><%
|
82
|
+
return object_link unless can_edit_this?
|
83
|
+
|
84
|
+
id ||= this_field_dom_id + "_completer"
|
85
|
+
f = ajax_updater(object_url(this_parent),
|
86
|
+
"Change #{this_field.to_s.titleize}", update,
|
87
|
+
:method => "put",
|
88
|
+
:params => { this_parent.class.name.underscore => {
|
89
|
+
this_field => Hobo.raw_js("$('#{id}').value")
|
90
|
+
} })
|
91
|
+
refl = this_type
|
92
|
+
completer_model ||= refl.klass
|
93
|
+
completer_attr ||= refl.klass.id_name_column
|
94
|
+
url = object_url(completer_model, "completions",
|
95
|
+
{ :for => completer_attr },
|
96
|
+
options.select_hash {|k,v| k.to_s.starts_with? "where_"})
|
97
|
+
%>
|
98
|
+
<form onsubmit="<%= f %>; $('<%= id %>').blur(); return false">
|
99
|
+
<input type="text" class="autocomplete_bhv autosubmit" id="<%= id %>" autocomplete_url="<%= url %>"
|
100
|
+
value="<%= this && this.id_name %>" xattrs="" />
|
101
|
+
<div id="<%= id %>_completions" class="completions_popup" style="display:none"></div>
|
102
|
+
</form>
|
103
|
+
</if_can_edit>
|
104
|
+
<else>
|
105
|
+
<object_link/>
|
106
|
+
</else>
|
107
|
+
</def>
|
108
|
+
|
109
|
+
|
110
|
+
<def tag="boolean_checkbox_editor" attrs="update"><%
|
111
|
+
raise HoboError.new("Not allowed to edit") unless can_edit_this?
|
112
|
+
f = ajax_updater(object_url(this_parent),
|
113
|
+
"Change #{this_field.to_s.titleize}", update,
|
114
|
+
:method => "put",
|
115
|
+
:params => { this_parent.class.name.underscore => {
|
116
|
+
this_field => Hobo.raw_js('this.checked')
|
117
|
+
} })
|
118
|
+
options = add_classes(options, editor_class)
|
119
|
+
%>
|
120
|
+
<input type="checkbox" value="1" onchange="<%= f %>"
|
121
|
+
xattrs="# this ? options.merge(:checked => 'checked') : options" />
|
122
|
+
</def>
|
123
|
+
|
124
|
+
|
125
|
+
<def tag="sti_type_field">
|
126
|
+
<select name="<%= param_name_for(form_this, form_field_path + ['type']) %>">
|
127
|
+
<%= options_for_select(this.class.send(:subclasses).omap{[name.titleize, name]}, this.class.name) %>
|
128
|
+
</select>
|
129
|
+
</def>
|
130
|
+
|
131
|
+
|
132
|
+
<def tag="sti_type_editor" attrs="update">
|
133
|
+
<% base_class = this.class
|
134
|
+
base_class = base_class.superclass while base_class.superclass != ActiveRecord::Base
|
135
|
+
f = ajax_updater("#{urlb}/#{controller_for base_class}/#{this.id}",
|
136
|
+
"Change #{this_field.to_s.titleize}", update,
|
137
|
+
:method => "put",
|
138
|
+
:params => { base_class.name.underscore => {
|
139
|
+
"type" => Hobo.raw_js('this.value')
|
140
|
+
} })
|
141
|
+
%>
|
142
|
+
|
143
|
+
<select onchange="<%= f %>">
|
144
|
+
<if q="#tagbody">
|
145
|
+
<tagbody/>
|
146
|
+
</if>
|
147
|
+
<else>
|
148
|
+
<%= options_for_select(base_class.send(:subclasses).omap{[name.titleize, name]}, this.class.name) %>
|
149
|
+
</else>
|
150
|
+
</select>
|
151
|
+
</def>
|
152
|
+
|
153
|
+
|
154
|
+
<def tag="integer_select_editor" attrs="min, max, update, nil_option, message">
|
155
|
+
<select class="number_editor_bhv" hobo_update="<%= update %>"
|
156
|
+
hobo_model_id="<%= this_field_dom_id %>"
|
157
|
+
xattrs="#message ? options.merge(:hobo_message => message) : options">
|
158
|
+
<if q="#this.nil?"><option value=""><%= nil_option || "Choose a value" %></option></if>
|
159
|
+
<%= options_for_select((min.to_i..max.to_i).to_a, this) %>
|
160
|
+
</select>
|
161
|
+
</def>
|
162
|
+
|
163
|
+
|
164
|
+
<def tag="select_field">
|
165
|
+
<select name="<%= param_name_for_this %>">
|
166
|
+
<tagbody/>
|
167
|
+
</select>
|
168
|
+
</def>
|
@@ -0,0 +1,95 @@
|
|
1
|
+
<!-- Navigation
|
2
|
+
Main nav bar, account nav bar (login, signup...), page nav
|
3
|
+
-->
|
4
|
+
|
5
|
+
|
6
|
+
<def tag="navigation" attrs="current, item, link_current">
|
7
|
+
<nav_container xattrs="">
|
8
|
+
<repeat obj="#item">
|
9
|
+
<% c = this[:content]; klass = c == current ? "current" : "" %>
|
10
|
+
<if q="#!link_current && c == current">
|
11
|
+
<nav_item class="#klass" content_option="li"><%= c %></nav_item>
|
12
|
+
</if>
|
13
|
+
<else>
|
14
|
+
<nav_item content_option="item_el" class="#klass">
|
15
|
+
<a href="#this[:href]" content_option="link"><%= c %></a>
|
16
|
+
</nav_item>
|
17
|
+
</else>
|
18
|
+
</repeat>
|
19
|
+
<tagbody/>
|
20
|
+
</nav_container>
|
21
|
+
</def>
|
22
|
+
|
23
|
+
|
24
|
+
<def tag="nav_container"><ul xattrs=""><tagbody/></ul></def>
|
25
|
+
|
26
|
+
|
27
|
+
<def tag="nav_item"><li xattrs=""><tagbody/></li></def>
|
28
|
+
|
29
|
+
|
30
|
+
<def tag="application_account_nav">
|
31
|
+
<if q="#logged_in?">
|
32
|
+
<div class='nav_item'>Logged in as <%= h current_user.login %></div>
|
33
|
+
<div class='nav_item'><a href="<%= logout_url%>">Log out</a></div>
|
34
|
+
</if>
|
35
|
+
<else>
|
36
|
+
<div class='nav_item'><a href="<%= login_url%>">Log in</a></div>
|
37
|
+
<if q="#signup_url"> <div class='nav_item'><a href="<%= signup_url%>">Sign up</a></div> </if>
|
38
|
+
</else>
|
39
|
+
</def>
|
40
|
+
|
41
|
+
|
42
|
+
<def tag="previous_page_link" attrs="query_params">
|
43
|
+
<% opts = { :page => @pages.current.previous }.merge(query_params || {}) %>
|
44
|
+
<%= link_to(tagbody ? tagbody.call : '« Previous page', opts) if @pages and @pages.current.previous %>
|
45
|
+
</def>
|
46
|
+
|
47
|
+
|
48
|
+
<def tag="next_page_link" attrs="query_params">
|
49
|
+
<% opts = { :page => @pages.current.next }.merge(query_params || {}) %>
|
50
|
+
<%= link_to(tagbody ? tagbody.call : 'Next page »', opts) if @pages and @pages.current.next %>
|
51
|
+
</def>
|
52
|
+
|
53
|
+
|
54
|
+
<def tag="first_page_link" attrs="query_params">
|
55
|
+
<% opts = { :page => @pages.first }.merge(query_params || {}) %>
|
56
|
+
<%= link_to(tagbody ? tagbody.call : '« First page', opts) if @pages and @pages.current != @pages.first %>
|
57
|
+
</def>
|
58
|
+
|
59
|
+
|
60
|
+
<def tag="last_page_link" attrs="query_params">
|
61
|
+
<% opts = { :page => @pages.last }.merge(query_params || {}) %>
|
62
|
+
<%= link_to(tagbody ? tagbody.call : '« Last page', opts) if @pages and @pages.current != @pages.last %>
|
63
|
+
</def>
|
64
|
+
|
65
|
+
|
66
|
+
<def tag="page_n_of_count">
|
67
|
+
Page <%= @pages.current_page.number %> of <%= @pages.length %>
|
68
|
+
</def>
|
69
|
+
|
70
|
+
|
71
|
+
<def tag="page_nav" attrs="query_params">
|
72
|
+
<if q="#@pages.length > 1">
|
73
|
+
<p>
|
74
|
+
<page_n_of_count/> -
|
75
|
+
<first_page_link query_params="#query_params">|<</first_page_link>
|
76
|
+
<previous_page_link query_params="#query_params">Previous</previous_page_link>
|
77
|
+
<next_page_link query_params="#query_params">Next</next_page_link>
|
78
|
+
<last_page_link query_params="#query_params">>|</last_page_link>
|
79
|
+
</p>
|
80
|
+
</if>
|
81
|
+
</def>
|
82
|
+
|
83
|
+
<def tag="link_to_resource" attrs="type">
|
84
|
+
<%= link_to type, self.send("formatted_#{model.to_s.downcase}_url", this, type.downcase) %>
|
85
|
+
</def>
|
86
|
+
|
87
|
+
<def tag="link_to_resources" attrs="types">
|
88
|
+
<ul class="resource_list">
|
89
|
+
<% comma_split(types).each do |t| %>
|
90
|
+
<li class="<%= t.downcase %>_resource">
|
91
|
+
<link_to_resource type="#t" />
|
92
|
+
</li>
|
93
|
+
<% end %>
|
94
|
+
</ul>
|
95
|
+
</def>
|
@@ -0,0 +1,175 @@
|
|
1
|
+
<def tag="page" attrs="title_prefix, title">
|
2
|
+
<%= '<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">' %>
|
3
|
+
<html>
|
4
|
+
<head>
|
5
|
+
<title><%= title_prefix %><%= title || human_type + ": " + display_name %></title>
|
6
|
+
<%= stylesheet_link_tag 'application' %>
|
7
|
+
<%= javascript_include_tag :defaults %>
|
8
|
+
<hobo_rapid_javascripts replace_option="rapid_javascripts" tiny_mce="#true"/>
|
9
|
+
</head>
|
10
|
+
<body onload="Hobo.applyEvents();" content_option="body">
|
11
|
+
<div content_option="header"/>
|
12
|
+
<div content_option="intro"/>
|
13
|
+
<div content_option="main"/>
|
14
|
+
<div content_option="footer"/>
|
15
|
+
</body>
|
16
|
+
</html>
|
17
|
+
</def>
|
18
|
+
|
19
|
+
|
20
|
+
<def tag="index_page">
|
21
|
+
<% model_name = @model.name.titleize %>
|
22
|
+
<page title="All #{model_name.pluralize}" xattrs="">
|
23
|
+
|
24
|
+
<:intro>
|
25
|
+
<h1><%= model_name.pluralize %></h1>
|
26
|
+
</:intro>
|
27
|
+
|
28
|
+
<:main>
|
29
|
+
<panel replace_option="main_panel">
|
30
|
+
<h2 replace_option="panel_heading"><count label="#model_name"/></h2>
|
31
|
+
<section>
|
32
|
+
<table_for replace_option="table">
|
33
|
+
<td><object_link/></td><td><delete_button class='text'/></td>
|
34
|
+
</table_for>
|
35
|
+
</section>
|
36
|
+
|
37
|
+
<if q="#@pages.length > 1">
|
38
|
+
<section replace_option="page_nav">
|
39
|
+
<div class="page_links">
|
40
|
+
<page_nav/>
|
41
|
+
</div>
|
42
|
+
</section>
|
43
|
+
</if>
|
44
|
+
|
45
|
+
<section_if replace_option="new_link">
|
46
|
+
<p><new_object_link for="#@model"/></p>
|
47
|
+
</section_if>
|
48
|
+
</panel>
|
49
|
+
</:main>
|
50
|
+
</page>
|
51
|
+
</def>
|
52
|
+
|
53
|
+
|
54
|
+
<def tag="new_page">
|
55
|
+
<page title="New #{human_type}" xattrs="">
|
56
|
+
<:intro>
|
57
|
+
<h1>New <human_type/></h1>
|
58
|
+
</:intro>
|
59
|
+
|
60
|
+
<:main>
|
61
|
+
<panel replace_option="main_panel">
|
62
|
+
<h2 replace_option="pannel_heading">Details</h2>
|
63
|
+
<section>
|
64
|
+
<div class="error_messages" replace_option="error_messages">
|
65
|
+
<%= error_messages_for 'this' %>
|
66
|
+
</div>
|
67
|
+
|
68
|
+
<object_form hidden_fields="*">
|
69
|
+
<object_table associations="belongs_to" replace_option="fields"/>
|
70
|
+
<submit label="Create" class="create_button" replace_option="submit_button"/>
|
71
|
+
</object_form>
|
72
|
+
</section>
|
73
|
+
</panel>
|
74
|
+
</:main>
|
75
|
+
|
76
|
+
</page>
|
77
|
+
</def>
|
78
|
+
|
79
|
+
|
80
|
+
<def tag="show_page">
|
81
|
+
<% has_many_assocs = this.class.reflections.values.map do |refl|
|
82
|
+
this.send(refl.name) if Hobo.simple_has_many_association?(refl)
|
83
|
+
end.compact
|
84
|
+
%>
|
85
|
+
<page xattrs="">
|
86
|
+
|
87
|
+
<:intro>
|
88
|
+
<h1><human_type/><if q="#this.respond_to? :name">: <edit attr="name"/></if></h1>
|
89
|
+
<p><delete_button ajax="#false"/></p>
|
90
|
+
</:intro>
|
91
|
+
|
92
|
+
<:main>
|
93
|
+
<panel replace_option="main_panel">
|
94
|
+
<h2 replace_option="panel_heading">Details</h2>
|
95
|
+
<section>
|
96
|
+
<object_table associations="*" skip_fields="name" replace_option="fields"/>
|
97
|
+
</section>
|
98
|
+
|
99
|
+
<section_if replace_option="new_links">
|
100
|
+
<repeat obj="#has_many_assocs">
|
101
|
+
<p><new_object_link/></p>
|
102
|
+
</repeat>
|
103
|
+
</section_if>
|
104
|
+
</panel>
|
105
|
+
</:main>
|
106
|
+
|
107
|
+
</page>
|
108
|
+
</def>
|
109
|
+
|
110
|
+
|
111
|
+
<def tag="new_in_collection_page">
|
112
|
+
<page title="New #{human_type}" xattrs="">
|
113
|
+
|
114
|
+
<:intro>
|
115
|
+
<h1>New <human_type/></h1>
|
116
|
+
<h2>For: <object_link obj="#@owner" /></h2>
|
117
|
+
</:intro>
|
118
|
+
|
119
|
+
<:main>
|
120
|
+
<panel replace_option="main_panel">
|
121
|
+
<h2 replace_option="panel_heading">Details</h2>
|
122
|
+
<section>
|
123
|
+
<div class="error_messages" replace_option="error_messages">
|
124
|
+
<%= error_messages_for 'this' %>
|
125
|
+
</div>
|
126
|
+
|
127
|
+
<object_form hidden_fields="*">
|
128
|
+
<object_table associations="belongs_to" replace_option="fields"/>
|
129
|
+
<submit label='#"Add to #{display_name(:obj => @owner, :no_span => true)}"'
|
130
|
+
replace_option="submit_button"/>
|
131
|
+
</object_form>
|
132
|
+
</section>
|
133
|
+
|
134
|
+
</panel>
|
135
|
+
</:main>
|
136
|
+
|
137
|
+
</page>
|
138
|
+
</def>
|
139
|
+
|
140
|
+
|
141
|
+
<def tag="show_collection_page">
|
142
|
+
<% title = "#{@reflection.name.to_s.titleize} for #{display_name(:obj => @owner, :no_span => true)}" %>
|
143
|
+
<page title="#title" xattrs="">
|
144
|
+
|
145
|
+
<:intro>
|
146
|
+
<h1><%= title %></h1>
|
147
|
+
<h2>Back to <object_link obj="#@owner"/></h2>
|
148
|
+
</:intro>
|
149
|
+
|
150
|
+
<:main>
|
151
|
+
<panel replace_option="main_panel">
|
152
|
+
<h2 replace_option="panel_heading"><count label="#@reflection.klass.name.titleize"/></h2>
|
153
|
+
<section>
|
154
|
+
<table_for replace_option="table">
|
155
|
+
<if_can_view><td><object_link/></td><td><delete_button class='text'/></td></if_can_view>
|
156
|
+
</table_for>
|
157
|
+
</section>
|
158
|
+
|
159
|
+
<if q="#@pages.length > 1">
|
160
|
+
<section replace_option="page_nav">
|
161
|
+
<div class="page_links">
|
162
|
+
<page_nav/>
|
163
|
+
</div>
|
164
|
+
</section>
|
165
|
+
</if>
|
166
|
+
|
167
|
+
<if q="#Hobo.simple_has_many_association?(@association)">
|
168
|
+
<section replace_option="new_link">
|
169
|
+
<new_object_link for="#@association"/>
|
170
|
+
</section>
|
171
|
+
</if>
|
172
|
+
</panel>
|
173
|
+
</:main>
|
174
|
+
</page>
|
175
|
+
</def>
|