hobo 1.3.3 → 1.4.0.pre2
Sign up to get free protection for your applications and to get access to all the features.
- data/{CHANGES.txt → CHANGES-1.3.txt} +0 -0
- data/CHANGES-1.4.txt +678 -0
- data/Rakefile +13 -3
- data/TODO-1.4.txt +69 -0
- data/VERSION +1 -1
- data/app/helpers/hobo_debug_helper.rb +16 -0
- data/app/helpers/hobo_deprecated_helper.rb +45 -0
- data/app/helpers/hobo_helper_base.rb +8 -0
- data/app/helpers/hobo_permissions_helper.rb +136 -0
- data/app/helpers/hobo_route_helper.rb +196 -0
- data/{lib/hobo/helper/translations.rb → app/helpers/hobo_translations_helper.rb} +4 -7
- data/{lib/hobo/helper/translations/normalizer.rb → app/helpers/hobo_translations_normalizer_helper.rb} +3 -10
- data/app/helpers/hobo_type_helper.rb +24 -0
- data/app/helpers/hobo_view_hint_helper.rb +13 -0
- data/hobo.gemspec +3 -3
- data/lib/generators/hobo/admin_subsite/admin_subsite_generator.rb +0 -9
- data/lib/generators/hobo/admin_subsite/templates/application.dryml +2 -0
- data/lib/generators/hobo/admin_subsite/templates/gitkeep +0 -0
- data/lib/generators/hobo/admin_subsite/templates/site.css.erb +9 -0
- data/lib/generators/hobo/admin_subsite/templates/site.js.erb +10 -0
- data/lib/generators/hobo/assets/assets_generator.rb +16 -2
- data/lib/generators/hobo/assets/templates/application.css +9 -0
- data/lib/generators/hobo/assets/templates/application.dryml.erb +0 -5
- data/lib/generators/hobo/assets/templates/application.js +11 -0
- data/lib/generators/hobo/assets/templates/front.css +10 -0
- data/lib/generators/hobo/assets/templates/front.js +11 -0
- data/lib/generators/hobo/assets/templates/front_site.dryml.erb +6 -0
- data/lib/generators/hobo/assets/templates/gitkeep +0 -0
- data/lib/generators/hobo/dev_tweaks/dev_tweaks_generator.rb +31 -0
- data/lib/generators/hobo/i18n/templates/hobo.en.yml +1 -1
- data/lib/generators/hobo/install_plugin/USAGE +3 -0
- data/lib/generators/hobo/install_plugin/install_plugin_generator.rb +36 -0
- data/lib/generators/hobo/plugin.rb +112 -0
- data/lib/generators/hobo/setup_wizard/setup_wizard_generator.rb +31 -14
- data/lib/generators/hobo/subsite.rb +16 -2
- data/lib/generators/hobo/subsite/templates/gitkeep +0 -0
- data/lib/generators/hobo/subsite/templates/site.css.erb +9 -0
- data/lib/generators/hobo/subsite/templates/site.js.erb +10 -0
- data/lib/generators/hobo/subsite_taglib/templates/taglib.dryml.erb +0 -17
- data/lib/generators/hobo/test_framework/test_framework_generator.rb +1 -1
- data/lib/hobo.rb +3 -2
- data/lib/hobo/controller.rb +43 -24
- data/lib/hobo/controller/model.rb +63 -42
- data/lib/hobo/controller/user_base.rb +1 -3
- data/lib/hobo/engine.rb +1 -1
- data/lib/hobo/extensions/active_record/associations/association.rb +36 -0
- data/lib/hobo/extensions/active_record/associations/collection.rb +10 -19
- data/lib/hobo/extensions/active_record/associations/proxy.rb +3 -15
- data/lib/hobo/extensions/active_record/associations/scope.rb +2 -2
- data/lib/hobo/extensions/active_record/permissions.rb +32 -38
- data/lib/hobo/extensions/active_record/relation_with_origin.rb +5 -5
- data/lib/hobo/model.rb +12 -7
- data/lib/hobo/model/accessible_associations.rb +8 -15
- data/lib/hobo/model/lifecycles/creator.rb +1 -1
- data/lib/hobo/model/lifecycles/transition.rb +1 -1
- data/lib/hobo/model/permissions.rb +4 -4
- data/lib/hobo/model/scopes.rb +4 -17
- data/lib/hobo/model/scopes/automatic_scopes.rb +5 -13
- data/lib/hobo/rapid/helper.rb +1 -161
- data/lib/hobo/rapid/taglibs/rapid.dryml +3 -17
- data/test/doctest/hobo/hobo_helper.rdoctest +8 -44
- data/{doctests → test/doctest}/hobo/lifecycles.rdoctest +0 -0
- data/{doctests → test/doctest}/hobo/model.rdoctest +2 -4
- data/{doctests → test/doctest}/hobo/multi_model_forms.rdoctest +3 -24
- data/{doctests → test/doctest}/hobo/scopes.rdoctest +3 -53
- data/test/doctest/prepare_testapp.rb +11 -0
- data/test/irt/generators/admin_subsite.irt +1 -19
- data/test/irt/generators/assets.irt +4 -9
- data/test/irt/generators/controller.irt +0 -3
- data/test/irt/generators/front_controller.irt +0 -5
- data/test/irt/generators/{helper.rb → irt_helper.rb} +2 -2
- data/test/irt/generators/model.irt +1 -12
- data/test/irt/generators/partials/_account_user_model_tests.rb +0 -8
- data/test/irt/generators/partials/_accounts_users_controller_tests.rb +0 -2
- data/test/irt/generators/partials/_default_user_model_tests.rb +0 -8
- data/test/irt/generators/partials/_default_users_controller_tests.rb +0 -2
- data/test/irt/generators/partials/_house_controller_tests.rb +0 -2
- data/test/irt/generators/partials/_house_model_tests.rb +1 -9
- data/test/irt/generators/partials/_subsite_taglib_admin.rb +5 -2
- data/test/irt/generators/partials/_subsite_taglib_admin_invite_only.rb +1 -1
- data/test/irt/generators/partials/_subsite_taglib_noopt.rb +2 -2
- data/test/irt/generators/partials/_subsite_taglib_variables.rb +0 -15
- data/test/irt/generators/partials/_user_mailer_tests.rb +1 -3
- data/test/irt/generators/resource.irt +0 -3
- data/test/irt/generators/subsite.irt +6 -22
- data/test/irt/generators/subsite_taglib.irt +0 -18
- data/test/irt/generators/test_framework.irt +2 -5
- data/test/irt/generators/user_controller.irt +0 -3
- data/test/irt/generators/user_mailer.irt +0 -3
- data/test/irt/generators/user_model.irt +0 -3
- data/test/irt/generators/user_resource.irt +0 -3
- data/test/irt/readme.txt +6 -3
- metadata +116 -159
- data/app/controllers/dev_controller.rb +0 -25
- data/app/views/dev/summary.dryml +0 -102
- data/doctests/prepare_testapp.rb +0 -8
- data/lib/generators/hobo/admin_subsite/templates/admin.css +0 -20
- data/lib/generators/hobo/rapid/USAGE +0 -3
- data/lib/generators/hobo/rapid/rapid_generator.rb +0 -24
- data/lib/generators/hobo/rapid/templates/IE7.js +0 -2
- data/lib/generators/hobo/rapid/templates/blank.gif +0 -0
- data/lib/generators/hobo/rapid/templates/hobo-rapid.css +0 -94
- data/lib/generators/hobo/rapid/templates/hobo-rapid.js +0 -1015
- data/lib/generators/hobo/rapid/templates/ie7-recalc.js +0 -166
- data/lib/generators/hobo/rapid/templates/lowpro.js +0 -339
- data/lib/generators/hobo/rapid/templates/reset.css +0 -95
- data/lib/generators/hobo/rapid/templates/themes/clean/public/images/101-3B5F87-ACD3E6.png +0 -0
- data/lib/generators/hobo/rapid/templates/themes/clean/public/images/30-3E547A-242E42.png +0 -0
- data/lib/generators/hobo/rapid/templates/themes/clean/public/images/30-DBE1E5-FCFEF5.png +0 -0
- data/lib/generators/hobo/rapid/templates/themes/clean/public/images/300-ACD3E6-fff.png +0 -0
- data/lib/generators/hobo/rapid/templates/themes/clean/public/images/50-ACD3E6-fff.png +0 -0
- data/lib/generators/hobo/rapid/templates/themes/clean/public/images/fieldbg.gif +0 -0
- data/lib/generators/hobo/rapid/templates/themes/clean/public/images/pencil.png +0 -0
- data/lib/generators/hobo/rapid/templates/themes/clean/public/images/small_close.png +0 -0
- data/lib/generators/hobo/rapid/templates/themes/clean/public/images/spinner.gif +0 -0
- data/lib/generators/hobo/rapid/templates/themes/clean/public/stylesheets/clean.css +0 -327
- data/lib/generators/hobo/rapid/templates/themes/clean/public/stylesheets/rapid-ui.css +0 -102
- data/lib/generators/hobo/rapid/templates/themes/clean/views/clean.dryml +0 -10
- data/lib/hobo/helper.rb +0 -460
- data/lib/hobo/rapid/taglibs/rapid_core.dryml +0 -808
- data/lib/hobo/rapid/taglibs/rapid_document_tags.dryml +0 -56
- data/lib/hobo/rapid/taglibs/rapid_editing.dryml +0 -287
- data/lib/hobo/rapid/taglibs/rapid_forms.dryml +0 -1156
- data/lib/hobo/rapid/taglibs/rapid_generics.dryml +0 -48
- data/lib/hobo/rapid/taglibs/rapid_i18n.dryml +0 -173
- data/lib/hobo/rapid/taglibs/rapid_lifecycles.dryml +0 -96
- data/lib/hobo/rapid/taglibs/rapid_navigation.dryml +0 -108
- data/lib/hobo/rapid/taglibs/rapid_pages.dryml +0 -259
- data/lib/hobo/rapid/taglibs/rapid_plus.dryml +0 -247
- data/lib/hobo/rapid/taglibs/rapid_summary.dryml +0 -283
- data/lib/hobo/rapid/taglibs/rapid_support.dryml +0 -102
- data/lib/hobo/rapid/taglibs/rapid_user_pages.dryml +0 -182
- data/test/irt/generators/rapid.irt +0 -29
@@ -1,247 +0,0 @@
|
|
1
|
-
<!-- Tags that define higher level interactive 'widgets' -->
|
2
|
-
|
3
|
-
<!-- An enhanced version of Rapid's `<table>` that has support for column sorting, searching and pagination.
|
4
|
-
|
5
|
-
This tag calls `<table merge-params>`, so the parameters for `<table>` are also available.
|
6
|
-
|
7
|
-
An [worked example](/tutorials/agility#improve_the_project_page_with_a_searchable_sortable_table) of this tag is available in the [Agility Tutorial](/tutorials/agility)
|
8
|
-
|
9
|
-
-->
|
10
|
-
<def tag="table-plus" attrs="sort-field, sort-direction, sort-columns" >
|
11
|
-
<% sort_field ||= @sort_field; sort_direction ||= @sort_direction; sort_columns ||= {} %>
|
12
|
-
<% sort_columns['this'] ||= this.member_class.try.name_attribute %>
|
13
|
-
<div class="table-plus" merge-attrs="&attributes - attrs_for(:with_fields) - attrs_for(:table)">
|
14
|
-
<div class="header" param="header">
|
15
|
-
<div class="search">
|
16
|
-
<form param="search-form" method="get" action="" with="&nil">
|
17
|
-
<hidden-fields for-query-string skip="page, search"/>
|
18
|
-
<span><t key="hobo.table_plus.search">Search</t></span>
|
19
|
-
<input class="search" type="search" name="search" value="¶ms[:search]"/>
|
20
|
-
<submit label="&t('hobo.table_plus.submit_label', :default=>'Go')" class="search-button" param="search-submit"/>
|
21
|
-
</form>
|
22
|
-
</div>
|
23
|
-
</div>
|
24
|
-
|
25
|
-
<table merge-attrs="&attributes & (attrs_for(:table) + attrs_for(:with_fields))" empty merge-params>
|
26
|
-
<field-heading-row:>
|
27
|
-
<with-field-names merge-attrs="&all_attributes & attrs_for(:with_fields)">
|
28
|
-
<% col = sort_columns[scope.field_path] || scope.field_path
|
29
|
-
sort = sort_field == col && sort_direction == 'asc' ?
|
30
|
-
"-#{col}" : col
|
31
|
-
sort_url = url_for_page_path(params.merge(:sort => sort) - [:page])
|
32
|
-
col_heading_name = this.member_class.try.human_attribute_name(scope.field_name, :default=> scope.field_name.titleize) %>
|
33
|
-
|
34
|
-
<th param="#{scope.field_name}-heading">
|
35
|
-
<a href="&sort_url" class="column-sort"
|
36
|
-
param="#{scope.field_name}-heading-link"><%= col_heading_name %></a>
|
37
|
-
<if test="&col == sort_field">
|
38
|
-
<do param="up-arrow" if="&sort_direction == 'desc'">↑</do>
|
39
|
-
<do param="down-arrow" if="&sort_direction == 'asc'">↓</do>
|
40
|
-
</if>
|
41
|
-
</th>
|
42
|
-
</with-field-names>
|
43
|
-
<th if="&all_parameters[:controls]" class="controls"></th>
|
44
|
-
</field-heading-row>
|
45
|
-
</table>
|
46
|
-
<empty-collection-message param="empty-message"/>
|
47
|
-
|
48
|
-
<page-nav param params="&recognize_page_path.slice(:controller,:action)" if="&this.respond_to?(:page_count) || this.respond_to?(:total_pages)"/>
|
49
|
-
</div>
|
50
|
-
</def>
|
51
|
-
|
52
|
-
|
53
|
-
<!-- An enhanced version of Rapid's `<collection>` tag that supports drag-and-drop re-ordering.
|
54
|
-
|
55
|
-
Each item in the collection has a `<div class="ordering-handle" param="handle">` added, which can be used to drag the item up and down.
|
56
|
-
|
57
|
-
### Attributes
|
58
|
-
|
59
|
-
- `sortable-options` - a hash of options to pass to the `sortable_elemnt` helper. Default are:
|
60
|
-
|
61
|
-
{ :constraint => :vertical,
|
62
|
-
:overlap => :vertical,
|
63
|
-
:scroll => :window,
|
64
|
-
:handle => 'ordering-handle',
|
65
|
-
:complete => [visual_effect(:highlight, attributes[:id])] }
|
66
|
-
|
67
|
-
### Controller support
|
68
|
-
|
69
|
-
This tag assumes the controller has a `reorder` action and the model has a `position_column` method. This action is added automatically by Hobo's model-controller if the model declares `acts_as_list`. See also [Drag and Drop Reordering](/manual/controllers#drag_and_drop_reordering) in the [Controllers and Routing](/manual/controllers) chapter of the manual.
|
70
|
-
-->
|
71
|
-
<def tag="sortable-collection" attrs="sortable-options"><%
|
72
|
-
singular_name = this.member_class.name.underscore
|
73
|
-
attributes[:id] ||= "#{singular_name}_ordering"
|
74
|
-
route_method = subsite ? "#{subsite}_reorder_#{singular_name.pluralize}_url" : "reorder_#{singular_name.pluralize}_url"
|
75
|
-
reorder_url = send(route_method)
|
76
|
-
%>
|
77
|
-
<collection class="sortable" merge>
|
78
|
-
<item: id="#{singular_name}_#{this.id}" param>
|
79
|
-
<div class="ordering-handle" param="handle" if="&can_edit?(this.position_column)">↑<br/>↓</div>
|
80
|
-
<do param="default"><card param/></do>
|
81
|
-
</item:>
|
82
|
-
</collection>
|
83
|
-
<%= if Dryml.last_if
|
84
|
-
opts = { :url => reorder_url,
|
85
|
-
:constraint => :vertical,
|
86
|
-
:overlap => :vertical,
|
87
|
-
:scroll => :window,
|
88
|
-
:handle => 'ordering-handle',
|
89
|
-
:complete => [visual_effect(:highlight, attributes[:id])]
|
90
|
-
}
|
91
|
-
opts.update(sortable_options) if sortable_options
|
92
|
-
sortable_element attributes[:id], opts
|
93
|
-
end # FIXME: Make unobstrusive
|
94
|
-
%>
|
95
|
-
</def>
|
96
|
-
|
97
|
-
|
98
|
-
<!-- Deprecated: use collection-preview instead. -->
|
99
|
-
<def tag="preview-with-more"><collection-preview merge/></def>
|
100
|
-
|
101
|
-
|
102
|
-
<!-- Captures the common pattern of a list of "the first few" cards, along with a link to the rest. -->
|
103
|
-
<def tag="collection-preview" attrs="name">
|
104
|
-
<% model_class = this.member_class
|
105
|
-
name ||= model_class.name.downcase.pluralize -%>
|
106
|
-
<section class="#{name.dasherize} collection-preview" param="default">
|
107
|
-
<h3 param="heading">
|
108
|
-
<ht key="#{model_class.to_s.underscore}.collection.heading" count="&this.size">
|
109
|
-
<do param="heading-content"><%= name.pluralize.titleize %></do>
|
110
|
-
</ht>
|
111
|
-
</h3>
|
112
|
-
<a with="&model_class" action="new" if="&can_create?(model_class.new)" param="new-link">
|
113
|
-
<ht key="#{model_class.to_s.underscore}.actions.new">New <%= model_class.model_name.human %></ht>
|
114
|
-
</a>
|
115
|
-
<collection param/>
|
116
|
-
<unless test="&this.empty? || this.size == model_class.count">
|
117
|
-
<a param="show-all"><ht key="#{model_class.to_s.underscore}.actions.show_all" count="100">Show all <%= name.pluralize.titleize %>...</ht></a>
|
118
|
-
</unless>
|
119
|
-
</section>
|
120
|
-
</def>
|
121
|
-
|
122
|
-
|
123
|
-
<!-- Renders a gravatar (see [gravatar.com](http://gravatar.com)) image in side a link to `this`. Requires `this` to have an `email_address` field. Normally called with a user record in context.
|
124
|
-
|
125
|
-
### Attributes
|
126
|
-
|
127
|
-
- `size` - Size in pixels of the image. Defaults to 80.
|
128
|
-
- `rating` - The rating allowed. Defaults to 'g'. See [gravatar.com](http://gravatar.com) for information on ratings.
|
129
|
-
|
130
|
-
-->
|
131
|
-
<def tag="gravatar" attrs="size, rating">
|
132
|
-
<% size ||= 80; rating ||= 'g'; digest = Digest::MD5.hexdigest(this.email_address) -%>
|
133
|
-
<a class="gravatar"><img class="gravatar" src="http://www.gravatar.com/avatar/#{digest}?s=#{size}&r=#{rating}" merge-attrs/></a>
|
134
|
-
</def>
|
135
|
-
|
136
|
-
|
137
|
-
<!-- Provides an ajax-powered *find-as-you-type* live search field which is hooked up to Hobo's site-side search feature. At the moment this tag is not very flexible. It is not easy to use if for anything other than Hobo's site-wide search. -->
|
138
|
-
<def tag="live-search">
|
139
|
-
<div class="search">
|
140
|
-
<label for="search-field"><t key="hobo.live_search.label">Search</t></label><input type="search" class="live-search"/>
|
141
|
-
<spinner id="search-spinner"/>
|
142
|
-
</div>
|
143
|
-
<section class="hidden" id="search-results-panel">
|
144
|
-
<h2><t key="hobo.live_search.results_label">Search Results</t></h2><div param="close-button"><t key="hobo.live_search.close_button">close</t></div>
|
145
|
-
<section id="search-results"> </section>
|
146
|
-
</section>
|
147
|
-
</def>
|
148
|
-
|
149
|
-
<!-- A `<select>` menu intended to act as a filter for index pages.
|
150
|
-
|
151
|
-
### Example
|
152
|
-
|
153
|
-
Filtering on state is a common use. Here's the dryml for Order:
|
154
|
-
|
155
|
-
<filter-menu param-name="state" options="&Order::Lifecycle.states.keys" />
|
156
|
-
|
157
|
-
And the controller action:
|
158
|
-
|
159
|
-
def index
|
160
|
-
# always validate data given in URL's!!!
|
161
|
-
params[:state]=nil unless Order::Lifecycle.states.include?(params[:state]._?.to_sym)
|
162
|
-
finder = params[:state] ? Order.send(params[:state]) : Order
|
163
|
-
hobo_index finder
|
164
|
-
end
|
165
|
-
|
166
|
-
See [Filtering stories by status](/tutorials/agility#filtering_stories_by_status) in the [Agility Tutorial](/tutorials/agility) for an example.
|
167
|
-
|
168
|
-
### Attributes
|
169
|
-
|
170
|
-
- `param-name` - the name of the HTTP parameter to use for the filter
|
171
|
-
- `options` - an array of options or an array of arrays (useful for localized apps) for the menu.
|
172
|
-
It can be omitted if you provide the options as an array or array of arrays in the locale file.
|
173
|
-
- `no-filter` - The text of the first option which indicates no filter is in effect. Defaults to 'All'
|
174
|
-
- `first-value` - the value to be used with the first option. Typically not used,
|
175
|
-
meaning the option has a blank value.
|
176
|
-
- model - the model name (optional: needed if you use the "activerecord.attributes" namespace.
|
177
|
-
|
178
|
-
### I18n
|
179
|
-
|
180
|
-
It lookups the options attributes in `activerecord.attributes.#{model}.filter_menu.#{param\_name}.options`
|
181
|
-
with fallback to `filter_menu.#{param_name}.options`.
|
182
|
-
The passed options are used as a default in case the lookup fails.
|
183
|
-
Besides the `activerecord.attributes.#{model}.filter_menu.#{param_name}.no_filter` or
|
184
|
-
`tags.filter_menu.default.no_filter` key is used as default of the attribute "no-filter"
|
185
|
-
(or "All" if no default is found)
|
186
|
-
|
187
|
-
### I18n Example
|
188
|
-
|
189
|
-
|
190
|
-
es:
|
191
|
-
activerecord:
|
192
|
-
attributes:
|
193
|
-
<model_name>:
|
194
|
-
filter_menu:
|
195
|
-
period:
|
196
|
-
no_filter: Todos Períodos
|
197
|
-
options:
|
198
|
-
- [ "Hoy", "today" ]
|
199
|
-
- [ "Ayer", "yesterday" ]
|
200
|
-
|
201
|
-
or
|
202
|
-
|
203
|
-
es:
|
204
|
-
tags:
|
205
|
-
filter_menu:
|
206
|
-
period:
|
207
|
-
no_filter: Todos Períodos
|
208
|
-
options:
|
209
|
-
- [ "Hoy", "today" ]
|
210
|
-
- [ "Ayer", "yesterday" ]
|
211
|
-
|
212
|
-
|
213
|
-
TIME_PERIODS = %w[today yesterday]
|
214
|
-
|
215
|
-
<t-filter-menu param-name="period" options="&TIME_PERIODS" no-filter="All Periods"/>
|
216
|
-
|
217
|
-
with I18n.locale == :es
|
218
|
-
|
219
|
-
<select name="period">
|
220
|
-
<option value="">Todos Períodos</option>
|
221
|
-
<option value="today">Hoy</option>
|
222
|
-
<option value="yesterday">Ayer</option>
|
223
|
-
</select>
|
224
|
-
|
225
|
-
with I18n.locale == :en (i.e no locale file)
|
226
|
-
|
227
|
-
<select name="period">
|
228
|
-
<option value="">All Periods</option>
|
229
|
-
<option value="today">today</option>
|
230
|
-
<option value="yesterday">yesterday</option>
|
231
|
-
</select>
|
232
|
-
|
233
|
-
-->
|
234
|
-
<def tag="filter-menu" attrs="model, param-name, options, no-filter, id, first-value">
|
235
|
-
<% options = t("activerecord.attributes.#{model}.filter_menu.#{param_name}.options", :default=>[:"tags.filter_menu.#{param_name}.options", options])
|
236
|
-
raise ArgumentError, %(You must provide an "options" attribute, or set "activerecord.attributes.#{model}.filter_menu.#{param_name}.options" or "tags.filter_menu.#{param_name}.options" to an Array or to an Array of Arrays
|
237
|
-
in your locale file(s)) unless options.is_a?(Array)
|
238
|
-
no_filter = t("activerecord.attributes.#{model}.filter_menu.#{param_name}.no_filter", :default=>[:"tags.filter_menu.#{param_name}.no_filter", :"tags.filter_menu.default.no_filter", no_filter, "All"]) %>
|
239
|
-
<form action="&request.fullpath" method="get" class="filter-menu" merge-attrs="id">
|
240
|
-
<div>
|
241
|
-
<% opt = options.first.kind_of?(Array) ? options.*.last : options
|
242
|
-
selected = opt.detect {|o| o.to_s==params[param_name.gsub('-', '_')] } %>
|
243
|
-
<select-menu name="¶m_name" options="&options" selected="&selected"
|
244
|
-
first-option="&no_filter" first-value="&first_value" key="¶m_name" merge-params/>
|
245
|
-
</div>
|
246
|
-
</form>
|
247
|
-
</def>
|
@@ -1,283 +0,0 @@
|
|
1
|
-
<!-- These are a collection of tags that allow a application outline or summary to be created -->
|
2
|
-
|
3
|
-
<!-- Rails.version -->
|
4
|
-
<def tag="rails-version">
|
5
|
-
<%= Rails.version -%>
|
6
|
-
</def>
|
7
|
-
|
8
|
-
<!-- `Rails.root` -->
|
9
|
-
<def tag="rails-root">
|
10
|
-
<%= Rails.root -%>
|
11
|
-
</def>
|
12
|
-
|
13
|
-
<!-- `RAILS_ENV` -->
|
14
|
-
<def tag="rails-env">
|
15
|
-
<%= Rails.env -%>
|
16
|
-
</def>
|
17
|
-
|
18
|
-
<!-- Which change management system is in use: "git" "subversion" "other" -->
|
19
|
-
<def tag="cms-method">
|
20
|
-
<%= if File.exist?("#{Rails.root}/.git")
|
21
|
-
"git"
|
22
|
-
elsif File.exist?("#{Rails.root}/.svn")
|
23
|
-
"subversion"
|
24
|
-
else
|
25
|
-
"other"
|
26
|
-
end -%>
|
27
|
-
</def>
|
28
|
-
|
29
|
-
<!-- the git branch currently in use -->
|
30
|
-
<def tag="git-branch">
|
31
|
-
<%= File.basename(`git symbolic-ref HEAD`) -%>
|
32
|
-
</def>
|
33
|
-
|
34
|
-
<!-- the git version currently in use -->
|
35
|
-
<def tag="git-version" attrs="dir">
|
36
|
-
<% dir=Rails.root if dir.blank? -%>
|
37
|
-
<%= Dir.chdir(dir) {`git rev-parse --verify HEAD --short=7`} -%>
|
38
|
-
</def>
|
39
|
-
|
40
|
-
<!-- returns 'clean' if there are no modified or added files, 'dirty' otherwise. -->
|
41
|
-
<def tag="git-clean" attrs="dir">
|
42
|
-
<% dir=Rails.root if dir.blank? -%>
|
43
|
-
<%= Dir.chdir(dir) {`git status -s`}.blank? ? "clean" : "dirty" -%>
|
44
|
-
</def>
|
45
|
-
|
46
|
-
<!-- the time & date of the last commit -->
|
47
|
-
<def tag="git-last-commit-time">
|
48
|
-
<%= `git log -1 --format=%cD` -%>
|
49
|
-
</def>
|
50
|
-
|
51
|
-
<!-- calls `git-clean` or `svn-clean` as appropriate. `svn-clean` not yet written. -->
|
52
|
-
<def tag="cms-clean">
|
53
|
-
<% method = cms_method.strip -%>
|
54
|
-
<git-clean if="&method=='git'"/>
|
55
|
-
</def>
|
56
|
-
|
57
|
-
<!-- calls `git-last-commit-time` or `svn-last-commit-time` as appropriate. `svn-last-commit-time` not yet written. -->
|
58
|
-
<def tag="cms-last-commit-time">
|
59
|
-
<% method = cms_method.strip -%>
|
60
|
-
<git-last-commit-time if="&method=='git'"/>
|
61
|
-
</def>
|
62
|
-
|
63
|
-
<!-- calls `git-version` or `svn-version` as appropriate. `svn-version` not yet written. -->
|
64
|
-
<def tag="cms-version">
|
65
|
-
<% method = cms_method.strip -%>
|
66
|
-
<git-version if="&method=='git'"/>
|
67
|
-
</def>
|
68
|
-
|
69
|
-
<!-- calls `git-branch` or `svn-branch` as appropriate. `svn-branch` not yet written. -->
|
70
|
-
<def tag="cms-branch">
|
71
|
-
<% method = cms_method.strip -%>
|
72
|
-
<git-branch if="&method=='git'"/>
|
73
|
-
</def>
|
74
|
-
|
75
|
-
<!-- Hobo::VERSION -->
|
76
|
-
<def tag="hobo-version">
|
77
|
-
<%= Hobo::VERSION -%>
|
78
|
-
</def>
|
79
|
-
|
80
|
-
<!-- repeats on Rails.configuration.gems, including dependent gems -->
|
81
|
-
<def tag="with-gems">
|
82
|
-
<% gems = Bundler::LockfileParser.new(File.read('Gemfile.lock')).specs -%>
|
83
|
-
<repeat with="&gems">
|
84
|
-
<do param="default"/>
|
85
|
-
</repeat>
|
86
|
-
</def>
|
87
|
-
|
88
|
-
<!-- inside `<with-gems>`, returns the gem name -->
|
89
|
-
<def tag="gem-name">
|
90
|
-
<%= this.name -%>
|
91
|
-
</def>
|
92
|
-
|
93
|
-
<!-- inside `<with-gems>`, returns the version -->
|
94
|
-
<def tag="gem-version">
|
95
|
-
<%= this.version.to_s -%>
|
96
|
-
</def>
|
97
|
-
|
98
|
-
<!-- inside `<with-gems>`, returns the gem dependencies -->
|
99
|
-
<def tag="gem-dependencies">
|
100
|
-
<%= this.dependencies(&it.to_s).safe_join('<br>'.html_safe) -%>
|
101
|
-
</def>
|
102
|
-
|
103
|
-
<!-- repeats on the plugins used by the application -->
|
104
|
-
<def tag="with-plugins">
|
105
|
-
<% plugins = Rails.application.railties.plugins %>
|
106
|
-
<repeat with="&plugins">
|
107
|
-
<do param="default" />
|
108
|
-
</repeat>
|
109
|
-
</def>
|
110
|
-
|
111
|
-
<!-- within `<with-plugins>`, returns the plugin name -->
|
112
|
-
<def tag="plugin-name">
|
113
|
-
<%= this.name.to_s -%>
|
114
|
-
</def>
|
115
|
-
|
116
|
-
<!-- within `<with-plugins>`, returns the plugin location (directory) -->
|
117
|
-
<def tag="plugin-location">
|
118
|
-
<%= this.root.to_s -%>
|
119
|
-
</def>
|
120
|
-
|
121
|
-
<def tag="plugin-git-clean">
|
122
|
-
<git-clean dir="&this.root.to_s"/>
|
123
|
-
</def>
|
124
|
-
|
125
|
-
<def tag="plugin-git-version">
|
126
|
-
<git-version dir="&this.root.to_s"/>
|
127
|
-
</def>
|
128
|
-
|
129
|
-
<!-- within `<with-plugins>`, try and determine the method that was used to install the plugin. Returns "braid", "symlink", "git-submodule" or "other" -->
|
130
|
-
<def tag="plugin-method">
|
131
|
-
<%=
|
132
|
-
braids = File.open("#{Rails.root}/.braids") {|f| YAML::load(f) } rescue {}
|
133
|
-
if !braids[this.root.to_s.gsub(Rails.root.to_s+"/", "")].nil?
|
134
|
-
"braid"
|
135
|
-
elsif File.lstat(this.root.to_s).symlink?
|
136
|
-
"symlink"
|
137
|
-
elsif File.exist?(this.root.to_s+"/.git")
|
138
|
-
"git-submodule"
|
139
|
-
else
|
140
|
-
"other"
|
141
|
-
end
|
142
|
-
-%>
|
143
|
-
</def>
|
144
|
-
|
145
|
-
<!-- within `<with-plugins>`, determine if the plugin has been modified, returning "clean" or "modified". Returns a blank string if this information is not available. Uses `<plugin-git-clean>` or `<plugin-braid-clean>` to do the heavy lifting. -->
|
146
|
-
<def tag="plugin-clean">
|
147
|
-
<% method = plugin_method.strip -%>
|
148
|
-
<plugin-git-clean if="&method=='git-submodule'"/>
|
149
|
-
<plugin-braid-clean if="&method=='braid'"/>
|
150
|
-
</def>
|
151
|
-
|
152
|
-
<!-- within `<with-plugins>`, returns the plugin version. Returns a blank string if this information is not available. Uses `<plugin-git-version>` or `<plugin-braid-version>` to do the heavy lifting. -->
|
153
|
-
<def tag="plugin-version">
|
154
|
-
<% method = plugin_method.strip -%>
|
155
|
-
<plugin-git-version if="&method=='git-submodule'"/>
|
156
|
-
<plugin-braid-version if="&method=='braid'"/>
|
157
|
-
</def>
|
158
|
-
|
159
|
-
<def tag="plugin-braid-clean">
|
160
|
-
<%= diff=`braid diff #{this.directory.gsub(Rails.root+"/", "")}`
|
161
|
-
diff.strip.empty? ? "clean" : "modified" -%>
|
162
|
-
</def>
|
163
|
-
|
164
|
-
<def tag="plugin-braid-version">
|
165
|
-
<%= braids = File.open("#{Rails.root}/.braids") {|f| YAML::load(f) } rescue {}
|
166
|
-
b=braids[this.directory.gsub(Rails.root+"/", "")]
|
167
|
-
b['revision'][0...7] if b -%>
|
168
|
-
</def>
|
169
|
-
|
170
|
-
<!-- repeats on the available execution environments, which are usually 'development', 'test' and 'production' -->
|
171
|
-
<def tag="with-environments">
|
172
|
-
<repeat with="&Rails.configuration.database_configuration.keys">
|
173
|
-
<do param="default" />
|
174
|
-
</repeat>
|
175
|
-
</def>
|
176
|
-
|
177
|
-
<def tag="environment-name">
|
178
|
-
<%= this -%>
|
179
|
-
</def>
|
180
|
-
|
181
|
-
<!-- Given an environment name in the context, return the database adapter -->
|
182
|
-
<def tag="database-type">
|
183
|
-
<%= Rails.configuration.database_configuration[this]['adapter'] -%>
|
184
|
-
</def>
|
185
|
-
|
186
|
-
<!-- Given an environment name in the context, return the database name -->
|
187
|
-
<def tag="database-name">
|
188
|
-
<%= Rails.configuration.database_configuration[this]['database'] -%>
|
189
|
-
</def>
|
190
|
-
|
191
|
-
<!-- repeats on available models. Does not return models defined in libraries or plugins. -->
|
192
|
-
<def tag="with-models">
|
193
|
-
<% # stolen from railroad/model_diagram.rb
|
194
|
-
|
195
|
-
files = Dir.glob("app/models/**/*.rb")
|
196
|
-
models = files.map do |file|
|
197
|
-
model_name = (model_path = file.gsub(/^(app\/models\/)([\w_\/\\]+)\.rb/, '\2')).camelize
|
198
|
-
# Hack to skip all xxx_related.rb files
|
199
|
-
next if /_related/i =~ model_name
|
200
|
-
|
201
|
-
begin
|
202
|
-
model_name.constantize
|
203
|
-
rescue LoadError
|
204
|
-
oldlen = model_path.length
|
205
|
-
model_path.gsub!(/.*[\/\\]/, '')
|
206
|
-
model_name = model_path.camelize
|
207
|
-
if oldlen > model_path.length
|
208
|
-
retry
|
209
|
-
end
|
210
|
-
next
|
211
|
-
rescue NameError
|
212
|
-
next
|
213
|
-
end
|
214
|
-
end
|
215
|
-
-%>
|
216
|
-
<repeat with="&models.sort_by {|m| m.to_s}">
|
217
|
-
<do param="default" />
|
218
|
-
</repeat>
|
219
|
-
</def>
|
220
|
-
|
221
|
-
<def tag="model-name">
|
222
|
-
<%= this.to_s -%>
|
223
|
-
</def>
|
224
|
-
|
225
|
-
<!-- given a model, returns the table name -->
|
226
|
-
<def tag="model-table-name">
|
227
|
-
<%= this.try.table_name -%>
|
228
|
-
</def>
|
229
|
-
|
230
|
-
<!-- given a model, returns the table comment, if it exists and if you have the activerecord-comments plugin installed. -->
|
231
|
-
<def tag="model-table-comment">
|
232
|
-
<%= this.try.comment -%>
|
233
|
-
</def>
|
234
|
-
|
235
|
-
<!-- given a model, repeats on the database columns -->
|
236
|
-
<def tag="with-model-columns">
|
237
|
-
<repeat with="&this.try.content_columns">
|
238
|
-
<do param="default" />
|
239
|
-
</repeat>
|
240
|
-
</def>
|
241
|
-
|
242
|
-
<!-- given a column, returns the type -->
|
243
|
-
<def tag="model-column-type">
|
244
|
-
<%= this.type.to_s -%>
|
245
|
-
</def>
|
246
|
-
|
247
|
-
<!-- given a column, return the name -->
|
248
|
-
<def tag="model-column-name">
|
249
|
-
<%= this.name -%>
|
250
|
-
</def>
|
251
|
-
|
252
|
-
<!-- given a column in the context and the model as an attribute, returns the comment for the column. It returns the SQL comment if that is available (using the activerecord-comments plugin). If that is not available, it returns the HoboFields comment. -->
|
253
|
-
|
254
|
-
<def tag="model-column-comment" attrs="model">
|
255
|
-
<%= this.try.comment || model.try.field_specs.try.get(this.name).try.first.try.comment -%>
|
256
|
-
</def>
|
257
|
-
|
258
|
-
<!-- given a model, repeats on the associations -->
|
259
|
-
<def tag="with-model-associations">
|
260
|
-
<repeat with="&this.try.reflect_on_all_associations">
|
261
|
-
<do param="default" />
|
262
|
-
</repeat>
|
263
|
-
</def>
|
264
|
-
|
265
|
-
<!-- given an association, return the name -->
|
266
|
-
<def tag="model-association-name">
|
267
|
-
<%= this.name.to_s -%>
|
268
|
-
</def>
|
269
|
-
|
270
|
-
<!-- given an association, return the macro type (`has_many`, etc.) -->
|
271
|
-
<def tag="model-association-macro">
|
272
|
-
<%= if this.macro.to_s=='has_many' && this.options[:through]
|
273
|
-
'has_many :through'
|
274
|
-
else
|
275
|
-
this.macro.to_s
|
276
|
-
end -%>
|
277
|
-
</def>
|
278
|
-
|
279
|
-
<!-- given an association, return the name -->
|
280
|
-
<def tag="model-association-class-name">
|
281
|
-
<%= (this.class_name.try.respond_to? 'underscore') ? this.class_name.underscore.singularize.camelize : this.try.class_name -%>
|
282
|
-
</def>
|
283
|
-
|