hobo 1.3.0.RC4 → 1.3.0.pre10
Sign up to get free protection for your applications and to get access to all the features.
- data/CHANGES.txt +234 -282
- data/Rakefile +3 -3
- data/VERSION +1 -1
- data/app/controllers/dev_controller.rb +2 -2
- data/bin/hobo +3 -3
- data/config/routes.rb +1 -1
- data/doctests/hobo/lifecycles.rdoctest +1 -0
- data/doctests/hobo/model.rdoctest +5 -0
- data/doctests/hobo/multi_model_forms.rdoctest +5 -4
- data/doctests/hobo/scopes.rdoctest +8 -11
- data/doctests/prepare_testapp.rb +1 -2
- data/hobo.gemspec +2 -2
- data/lib/generators/hobo/admin_subsite/admin_subsite_generator.rb +11 -5
- data/lib/generators/hobo/admin_subsite/templates/admin.css +2 -20
- data/lib/generators/hobo/admin_subsite/templates/admin_tag_injection.erb +1 -3
- data/lib/generators/hobo/admin_subsite/templates/controller.rb.erb +5 -5
- data/lib/generators/hobo/admin_subsite/templates/users_index.dryml +1 -3
- data/lib/generators/hobo/basic/basic_generator.rb +17 -0
- data/lib/generators/hobo/{assets → basic}/templates/application.css +0 -0
- data/lib/generators/hobo/{assets → basic}/templates/application.dryml.erb +1 -1
- data/lib/generators/hobo/{assets → basic}/templates/dryml-support.js +2 -2
- data/lib/generators/hobo/{assets → basic}/templates/en_injection.yml +0 -0
- data/lib/generators/hobo/{assets → basic}/templates/guest.rb +0 -0
- data/lib/generators/hobo/controller.rb +1 -6
- data/lib/generators/hobo/front_controller/front_controller_generator.rb +3 -2
- data/{app/views/dev → lib/generators/hobo/front_controller/templates}/summary.dryml +10 -7
- data/lib/generators/hobo/hints/hints_generator.rb +12 -0
- data/lib/generators/hobo/hints/templates/hints.rb.erb +5 -0
- data/lib/generators/hobo/hints/templates/model_injection.rb.erb +36 -0
- data/lib/generators/hobo/i18n/i18n_generator.rb +9 -1
- data/lib/generators/hobo/i18n/templates/app.en.yml +1 -1
- data/lib/generators/hobo/i18n/templates/app.es-DO.yml +24 -0
- data/lib/generators/hobo/i18n/templates/app.it.yml +1 -5
- data/lib/generators/hobo/i18n/templates/app.pt-PT.yml +0 -1
- data/lib/generators/hobo/i18n/templates/default_count_injection.rb +10 -0
- data/lib/generators/hobo/i18n/templates/hobo.en.yml +10 -26
- data/lib/generators/hobo/i18n/templates/{hobo.es.yml → hobo.es-DO.yml} +10 -27
- data/lib/generators/hobo/i18n/templates/hobo.it.yml +4 -20
- data/lib/generators/hobo/i18n/templates/hobo.pt-PT.yml +9 -25
- data/lib/generators/hobo/model.rb +13 -0
- data/lib/generators/hobo/model/USAGE +3 -2
- data/lib/generators/hobo/model/model_generator.rb +1 -2
- data/lib/generators/hobo/rapid/rapid_generator.rb +0 -2
- data/lib/generators/hobo/rapid/templates/hobo-rapid.js +93 -78
- data/lib/generators/hobo/rapid/templates/ie7-recalc.js +21 -21
- data/lib/generators/hobo/rapid/templates/lowpro.js +31 -31
- data/lib/generators/hobo/rapid/templates/reset.css +1 -1
- data/lib/generators/hobo/rapid/templates/themes/clean/public/stylesheets/clean.css +16 -17
- data/lib/generators/hobo/rapid/templates/themes/clean/public/stylesheets/rapid-ui.css +3 -3
- data/lib/generators/hobo/rapid/templates/themes/clean/views/clean.dryml +1 -1
- data/lib/generators/hobo/resource/resource_generator.rb +1 -1
- data/lib/generators/hobo/routes/router.rb +4 -4
- data/lib/generators/hobo/routes/routes_generator.rb +1 -12
- data/lib/generators/hobo/routes/templates/hobo_routes.rb.erb +1 -1
- data/lib/generators/hobo/setup_wizard/setup_wizard_generator.rb +43 -88
- data/lib/generators/hobo/subsite.rb +5 -18
- data/lib/generators/hobo/subsite/subsite_generator.rb +1 -1
- data/lib/generators/hobo/subsite/templates/controller.rb.erb +1 -1
- data/lib/generators/hobo/subsite_taglib/templates/taglib.dryml.erb +2 -2
- data/lib/generators/hobo/test_framework/test_framework_generator.rb +7 -7
- data/lib/generators/hobo/user_controller/templates/controller.rb.erb +3 -8
- data/lib/generators/hobo/user_mailer/templates/activation.erb +2 -2
- data/lib/generators/hobo/user_mailer/templates/forgot_password.erb +2 -2
- data/lib/generators/hobo/user_mailer/templates/invite.erb +2 -2
- data/lib/generators/hobo/user_mailer/templates/mailer.rb.erb +17 -10
- data/lib/generators/hobo/user_mailer/user_mailer_generator.rb +1 -1
- data/lib/generators/hobo/user_model/USAGE +9 -2
- data/lib/generators/hobo/user_model/user_model_generator.rb +1 -2
- data/lib/hobo.rb +7 -13
- data/lib/hobo/controller.rb +14 -21
- data/lib/hobo/controller/authentication_support.rb +23 -1
- data/lib/hobo/controller/model.rb +53 -48
- data/lib/hobo/controller/{user_base.rb → user.rb} +36 -47
- data/lib/hobo/engine.rb +11 -25
- data/lib/hobo/extensions/action_controller/hobo_methods.rb +1 -25
- data/lib/hobo/extensions/active_model/translation.rb +1 -1
- data/lib/hobo/extensions/active_record/{associations/collection.rb → association_collection.rb} +3 -12
- data/lib/hobo/extensions/active_record/{associations/proxy.rb → association_proxy.rb} +7 -6
- data/lib/hobo/extensions/active_record/association_reflection.rb +19 -0
- data/lib/hobo/extensions/active_record/hobo_methods.rb +1 -1
- data/lib/hobo/extensions/active_record/scopes.rb +31 -0
- data/lib/hobo/extensions/array.rb +1 -13
- data/lib/hobo/helper.rb +6 -27
- data/lib/hobo/helper/translations.rb +90 -39
- data/lib/hobo/model.rb +20 -72
- data/lib/hobo/model/lifecycles.rb +11 -12
- data/lib/hobo/model/lifecycles/lifecycle.rb +4 -12
- data/lib/hobo/model/lifecycles/transition.rb +0 -1
- data/lib/hobo/model/permissions.rb +3 -2
- data/lib/hobo/model/scopes/apply_scopes.rb +1 -1
- data/lib/hobo/model/scopes/automatic_scopes.rb +80 -78
- data/lib/hobo/model/{user_base.rb → user.rb} +7 -9
- data/lib/hobo/rapid/generators/rapid/cards.dryml.erb +2 -2
- data/lib/hobo/rapid/generators/rapid/forms.dryml.erb +4 -5
- data/lib/hobo/rapid/generators/rapid/pages.dryml.erb +27 -26
- data/lib/hobo/rapid/helper.rb +5 -10
- data/lib/hobo/rapid/taglibs/rapid.dryml +1 -1
- data/lib/hobo/rapid/taglibs/rapid_core.dryml +42 -72
- data/lib/hobo/rapid/taglibs/rapid_document_tags.dryml +2 -2
- data/lib/hobo/rapid/taglibs/rapid_editing.dryml +16 -36
- data/lib/hobo/rapid/taglibs/rapid_forms.dryml +49 -87
- data/lib/hobo/rapid/taglibs/rapid_generics.dryml +2 -2
- data/lib/hobo/rapid/taglibs/rapid_i18n.dryml +75 -50
- data/lib/hobo/rapid/taglibs/rapid_lifecycles.dryml +5 -7
- data/lib/hobo/rapid/taglibs/rapid_navigation.dryml +2 -2
- data/lib/hobo/rapid/taglibs/rapid_pages.dryml +7 -8
- data/lib/hobo/rapid/taglibs/rapid_plus.dryml +43 -66
- data/lib/hobo/rapid/taglibs/rapid_summary.dryml +45 -16
- data/lib/hobo/rapid/taglibs/rapid_translations.dryml +36 -0
- data/lib/hobo/rapid/taglibs/rapid_user_pages.dryml +8 -8
- data/lib/hobo/routes.rb +23 -22
- data/lib/hobo/view_hints.rb +101 -0
- data/test/irt/generators/admin_subsite.irt +1 -1
- data/test/irt/generators/{assets.irt → basic.irt} +2 -2
- data/test/irt/generators/front_controller.irt +4 -2
- data/test/irt/generators/partials/_subsite_taglib_variables.rb +1 -1
- data/test/irt/generators/subsite.irt +1 -1
- data/test/permissions/test_permissions.rb +103 -103
- metadata +108 -69
- data/lib/generators/hobo/admin_subsite/USAGE +0 -25
- data/lib/generators/hobo/admin_subsite/templates/application.dryml +0 -1
- data/lib/generators/hobo/assets/USAGE +0 -5
- data/lib/generators/hobo/assets/assets_generator.rb +0 -18
- data/lib/generators/hobo/assets/templates/dryml_taglibs_initializer.rb +0 -1
- data/lib/generators/hobo/controller/USAGE +0 -3
- data/lib/generators/hobo/i18n/USAGE +0 -3
- data/lib/generators/hobo/i18n/templates/app.de.yml +0 -30
- data/lib/generators/hobo/i18n/templates/app.es.yml +0 -31
- data/lib/generators/hobo/i18n/templates/app.fr.yml +0 -26
- data/lib/generators/hobo/i18n/templates/app.nb.yml +0 -25
- data/lib/generators/hobo/i18n/templates/app.ru.yml +0 -24
- data/lib/generators/hobo/i18n/templates/hobo.de.yml +0 -204
- data/lib/generators/hobo/i18n/templates/hobo.fr.yml +0 -195
- data/lib/generators/hobo/i18n/templates/hobo.nb.yml +0 -198
- data/lib/generators/hobo/i18n/templates/hobo.ru.yml +0 -200
- data/lib/generators/hobo/rapid/templates/themes/clean-sidemenu/public/images/100-ACD3E6-DBE1E5-H.png +0 -0
- data/lib/generators/hobo/rapid/templates/themes/clean-sidemenu/public/images/100-DBE1E5-FCFEF5-H.png +0 -0
- data/lib/generators/hobo/rapid/templates/themes/clean-sidemenu/public/images/300-3B5F87-ACD3E6-H.png +0 -0
- data/lib/generators/hobo/rapid/templates/themes/clean-sidemenu/public/images/spinner.gif +0 -0
- data/lib/generators/hobo/rapid/templates/themes/clean-sidemenu/public/stylesheets/clean-sidemenu.css +0 -81
- data/lib/generators/hobo/rapid/templates/themes/clean-sidemenu/views/clean-sidemenu.dryml +0 -30
- data/lib/generators/hobo/resource/USAGE +0 -39
- data/lib/generators/hobo/subsite/USAGE +0 -24
- data/lib/generators/hobo/subsite_taglib/USAGE +0 -4
- data/lib/generators/hobo/test_framework/USAGE +0 -2
- data/lib/generators/hobo/user_controller/USAGE +0 -3
- data/lib/generators/hobo/user_mailer/USAGE +0 -2
- data/lib/generators/hobo/user_resource/USAGE +0 -10
- data/lib/hobo/extensions/action_view/translation_helper.rb +0 -25
- data/lib/hobo/extensions/active_record/associations/reflection.rb +0 -23
- data/lib/hobo/extensions/active_record/associations/scope.rb +0 -35
- data/lib/hobo/extensions/active_record/relation_with_origin.rb +0 -32
- data/lib/hobo/extensions/i18n.rb +0 -17
- data/lib/hobo/helper/translations/normalizer.rb +0 -39
- data/lib/hobo/model/view_hints.rb +0 -123
data/lib/hobo/rapid/helper.rb
CHANGED
@@ -102,15 +102,11 @@ module Hobo
|
|
102
102
|
s.gsub(' ', ' ')
|
103
103
|
end
|
104
104
|
|
105
|
-
|
106
|
-
def collection_count
|
107
|
-
this.try.to_int || this.try.total_entries || (this.try.loaded? && this.try.length) || this.try.count || this.try.length
|
108
|
-
end
|
105
|
+
|
109
106
|
|
110
107
|
|
111
108
|
def in_place_editor(attributes, this=nil)
|
112
|
-
blank_message = attributes.delete(:blank_message) ||
|
113
|
-
t('hobo.in_place_editor.click_to_edit', :default => '(click to edit)')
|
109
|
+
blank_message = attributes.delete(:blank_message) || "(click to edit)"
|
114
110
|
|
115
111
|
attributes = add_classes(attributes, "in-place-edit", model_id_class(this_parent, this_field))
|
116
112
|
attributes.update(:hobo_blank_message => blank_message,
|
@@ -120,16 +116,15 @@ module Hobo
|
|
120
116
|
edit_text = this._?.to_s
|
121
117
|
attributes.update(:hobo_edit_text => edit_text) unless edit_text.nil?
|
122
118
|
|
123
|
-
|
124
|
-
|
125
|
-
end
|
119
|
+
update = attributes.delete(:update)
|
120
|
+
attributes[:hobo_update] = update if update
|
126
121
|
|
127
122
|
view(attributes)
|
128
123
|
end
|
129
124
|
|
130
125
|
|
131
126
|
|
132
|
-
AJAX_CALLBACKS = [ :success, :failure, :complete ]
|
127
|
+
AJAX_CALLBACKS = [ :before, :success, :failure, :complete ]
|
133
128
|
|
134
129
|
AJAX_ATTRS = AJAX_CALLBACKS + [ :update, :type, :method,
|
135
130
|
:script, :form, :params, :confirm, :message,
|
@@ -1,6 +1,6 @@
|
|
1
1
|
<!--
|
2
2
|
|
3
|
-
The Rapid tag library makes web development go fast. The Rapid tag library is your friend.
|
3
|
+
The Rapid tag library makes web development go fast. The Rapid tag library is your friend.
|
4
4
|
|
5
5
|
(This taglib defines no tags - it just includes all the other taglibs. Move along. Nothing to see here.)
|
6
6
|
|
@@ -93,15 +93,7 @@ This will use `<input/>` as the tag in each table cell instead of `<view/>`
|
|
93
93
|
<table fields="name, created_at, description">
|
94
94
|
<controls:/>
|
95
95
|
</table>
|
96
|
-
|
97
|
-
The controls can be further customised using the "edit-link" and "delete-button" parameters:
|
98
|
-
|
99
|
-
<table fields="name, created_at, description">
|
100
|
-
<controls:/>
|
101
|
-
<delete-button: label="Nuke Me"/>
|
102
|
-
</table>
|
103
|
-
|
104
|
-
or by providing completely new content for the control column:
|
96
|
+
The controls can be further customised using the "edit-link" and "delete-button" parameters or by providing completely new content for the control column, e.g.
|
105
97
|
|
106
98
|
<table fields="name, created_at, description">
|
107
99
|
<controls:>my controls!</controls:>
|
@@ -132,9 +124,7 @@ This will use `<input/>` as the tag in each table cell instead of `<view/>`
|
|
132
124
|
<td param="#{scope.field_name.to_s.sub('?', '').gsub('.', '-')}-view"><call-tag tag="&field_tag"/></td>
|
133
125
|
</with-fields>
|
134
126
|
<td class="controls" param="controls" if="&all_parameters[:controls]">
|
135
|
-
<a param="edit-link" action="edit" if="&can_edit?">
|
136
|
-
<t key="hobo.actions.edit_control">Edit</t>
|
137
|
-
</a>
|
127
|
+
<a param="edit-link" action="edit" if="&can_edit?"><t key="hobo.action.edit">Edit</t></a>
|
138
128
|
<delete-button param/>
|
139
129
|
</td>
|
140
130
|
</if>
|
@@ -167,35 +157,24 @@ Provides a short hand way of displaying images in public/images
|
|
167
157
|
|
168
158
|
|
169
159
|
<!-- Renders some standard JavaScript code that various features of the Rapid library rely on. This tag would typicallu be called from your `<page>` tag. The default Rapid pages include this already. -->
|
170
|
-
<def tag="hobo-rapid-javascripts"
|
171
|
-
|
172
|
-
|
173
|
-
|
174
|
-
unless
|
175
|
-
|
176
|
-
|
177
|
-
|
178
|
-
|
179
|
-
|
180
|
-
|
181
|
-
|
182
|
-
|
183
|
-
|
184
|
-
|
185
|
-
|
186
|
-
|
187
|
-
|
188
|
-
%></script>
|
189
|
-
</def>
|
190
|
-
|
191
|
-
|
192
|
-
<def tag="part-contexts-javascripts">
|
193
|
-
<% unless (storage = part_contexts_storage).blank? %>
|
194
|
-
<script type="text/javascript"><%=
|
195
|
-
storage
|
196
|
-
%></script>
|
197
|
-
<% end %>
|
198
|
-
</def>
|
160
|
+
<def tag="hobo-rapid-javascripts"><%=
|
161
|
+
res = 'var hoboParts = {};'
|
162
|
+
# FIXME: This should interrogate the model-router - not the models
|
163
|
+
unless Hobo::Model.all_models.empty?
|
164
|
+
# Tell JS code how to pluralize names, unless they follow the simple rule
|
165
|
+
names = Hobo::Model.all_models.map do |m|
|
166
|
+
m = m.name.underscore
|
167
|
+
"#{m}: '#{m.pluralize}'" unless m.pluralize == m + 's'
|
168
|
+
end.compact
|
169
|
+
res << "var pluralisations = {#{names * ', '}}; "
|
170
|
+
end
|
171
|
+
base = [base_url, subsite].compact.join("/")
|
172
|
+
res << "urlBase = '#{base}'; hoboPagePath = '#{view_name}'"
|
173
|
+
if protect_against_forgery?
|
174
|
+
res << "; formAuthToken = { name: '#{request_forgery_protection_token}', value: '#{form_authenticity_token}' }"
|
175
|
+
end
|
176
|
+
res
|
177
|
+
%></def>
|
199
178
|
|
200
179
|
<!-- Renders the name of the current context using a variety of methods.
|
201
180
|
|
@@ -257,8 +236,6 @@ Provides a short hand way of displaying images in public/images
|
|
257
236
|
|
258
237
|
<!-- Renders a human readable name of a collection
|
259
238
|
|
260
|
-
Use this tag for en locale only. Use human-collection-name for i18n.
|
261
|
-
|
262
239
|
### Details
|
263
240
|
|
264
241
|
- Uses `this.origin_attribute` as the name.
|
@@ -389,7 +366,7 @@ Or a new page if the context is a class:
|
|
389
366
|
|
390
367
|
content = name if content.blank?
|
391
368
|
|
392
|
-
href = object_url(target, action, (params || {}).merge(:subsite => subsite))
|
369
|
+
href = object_url(target, action, (params || {}).merge(:subsite => subsite))
|
393
370
|
if href.nil?
|
394
371
|
# This target is registered with Hobo::Routes as not linkable
|
395
372
|
content
|
@@ -440,7 +417,7 @@ Assuming the context is a blog post...
|
|
440
417
|
<view:created_at no-wrapper/> -> June 09, 2008 15:36
|
441
418
|
-->
|
442
419
|
<def tag="view" attrs="inline, block, if-blank, no-wrapper, truncate"><%=
|
443
|
-
raise Hobo::
|
420
|
+
raise Hobo::Error, "view of non-viewable field '#{this_field}' of #{this_parent.typed_id rescue this_parent}" unless
|
444
421
|
can_view?
|
445
422
|
|
446
423
|
res = if this.nil? && if_blank.nil?
|
@@ -466,7 +443,7 @@ Assuming the context is a blog post...
|
|
466
443
|
|
467
444
|
truncate = 30 if truncate == true
|
468
445
|
the_view = self.truncate(the_view, :length => truncate.to_i) if truncate
|
469
|
-
the_view = the_view.
|
446
|
+
the_view = the_view.strip
|
470
447
|
|
471
448
|
if no_wrapper
|
472
449
|
the_view
|
@@ -493,30 +470,28 @@ Assuming the context is a blog post...
|
|
493
470
|
<def tag="links-for-collection"><%= this.empty? ? "(none)" : context_map { a }.safe_join(", ") %></def>
|
494
471
|
|
495
472
|
<!-- Renders `this` in localized :default format. `format` can be a symbol representing a locale key or a standard format string (see strftime) -->
|
496
|
-
<def tag="view" for="
|
473
|
+
<def tag="view" for="Date" attrs="format"><%= this && (format||= :default) && I18n.backend.localize(I18n.locale, this, format) %></def>
|
497
474
|
|
498
|
-
<!-- Renders `this` in localized :default format. `format` can be a symbol representing a
|
499
|
-
<def tag="view" for="
|
475
|
+
<!-- Renders `this` in localized :default format. `format` can be a symbol representing a locale key or a standard format string (see strftime) -->
|
476
|
+
<def tag="view" for="Time" attrs="format"><%= this && (format||= :default) && I18n.backend.localize(I18n.locale, this, format) %></def>
|
500
477
|
|
501
478
|
<!-- Renders `this` in localized :default format. `format` can be a symbol representing a locale key or a standard format string (see strftime) -->
|
502
|
-
<def tag="view" for="
|
479
|
+
<def tag="view" for="ActiveSupport::TimeWithZone" attrs="format"><%= this && (format||= :default) && I18n.backend.localize(I18n.locale, this, format) %></def>
|
503
480
|
|
504
481
|
<!-- Renders localized `number_with_delimiter this`, or `format % this` if the `format` attribute is given -->
|
505
482
|
<def tag="view" for="Numeric" attrs="format"><%= format ? format % this : number_with_delimiter(this) %></def>
|
506
483
|
|
507
|
-
<!--
|
484
|
+
<!-- Renders `this` with HTML escaping and newlines replaced with `<br>` tags -->
|
508
485
|
<def tag="view" for="string"><%=
|
509
|
-
if this.
|
510
|
-
this
|
511
|
-
elsif !(this.class == String) && this.respond_to?(:to_html) # workaround for Maruku which adds String#to_html : (
|
486
|
+
if !(this.class == String) && this.respond_to?(:to_html) # workaround for Maruku which adds String#to_html : (
|
512
487
|
this.to_html(scope.xmldoctype)
|
513
488
|
else
|
514
|
-
h(this).gsub("\n", "<br#{scope.xmldoctype ? ' /' : ''}>")
|
489
|
+
h(this).gsub("\n", "<br#{scope.xmldoctype ? ' /' : ''}>")
|
515
490
|
end
|
516
491
|
%></def>
|
517
492
|
|
518
493
|
<!-- Renders 'Yes' for true and 'No' for false -->
|
519
|
-
<def tag="view" for="boolean"><%= this ? t('hobo.boolean_yes', :default => 'Yes') : t('hobo.boolean_no', :default => 'No') %></def>
|
494
|
+
<def tag="view" for="boolean"><%= this ? I18n.t('hobo.boolean_yes', :default => 'Yes') : I18n.t('hobo.boolean_no', :default => 'No') %></def>
|
520
495
|
|
521
496
|
<!-- Renders a link (`<a>`) to `this` -->
|
522
497
|
<def tag="view" for="ActiveRecord::Base"><a merge-attrs/></def>
|
@@ -587,7 +562,7 @@ You can pass a summary attribute, which will generate a complete localized sente
|
|
587
562
|
raise Exception.new("asked for count of a string") if this.is_a?(String)
|
588
563
|
Rails.logger.warn('The "prefix" attribute is deprecated: please, use a locale string') unless prefix.blank?
|
589
564
|
|
590
|
-
c =
|
565
|
+
c = this.try.to_int || this.try.total_entries || (this.try.loaded? && this.try.length) || this.try.count || this.try.length
|
591
566
|
|
592
567
|
# generated label will be pluralized
|
593
568
|
label ||= case
|
@@ -614,7 +589,7 @@ You can pass a summary attribute, which will generate a complete localized sente
|
|
614
589
|
else
|
615
590
|
key = summary.kind_of?(String) ? summary : "default"
|
616
591
|
default = c == 1 ? "There is 1 #{label}" : "There are #{c} #{label}"
|
617
|
-
t "tags.count.#{key}", {:count=>c, :label=>label, :default=>default}.merge(attributes)
|
592
|
+
I18n.t "tags.count.#{key}", {:count=>c, :label=>label, :default=>default}.merge(attributes)
|
618
593
|
end
|
619
594
|
end
|
620
595
|
%></span></def>
|
@@ -669,11 +644,6 @@ that you add the keys in the correct namespaces.
|
|
669
644
|
|
670
645
|
- capitalize: the first letter of the resulting sentence will be capitalized
|
671
646
|
|
672
|
-
|
673
|
-
### Additional Notes
|
674
|
-
|
675
|
-
The "titleize" attribute is deprecated: use "capitalize" instead.
|
676
|
-
|
677
647
|
-->
|
678
648
|
<def tag="you" attrs="titleize, capitalize">
|
679
649
|
<% Rails.logger.warn "'titleize' is a deprecated attribute of the 'you' tag. Please, use 'capitalize' instead." -%>
|
@@ -684,13 +654,13 @@ The "titleize" attribute is deprecated: use "capitalize" instead.
|
|
684
654
|
when attributes[:do] then 'do'
|
685
655
|
end -%>
|
686
656
|
<if test="&this == current_user">
|
687
|
-
<%= s = t("tags.you.current_user.#{k || attributes.keys.first || 'default'}",:default=>"you #{k}")
|
657
|
+
<%= s = I18n.t("tags.you.current_user.#{k || attributes.keys.first || 'default'}",:default=>"you #{k}")
|
688
658
|
(titleize||capitalize) ? s.sub(/^./){|c| c.upcase} : s %>
|
689
659
|
</if>
|
690
660
|
<else>
|
691
661
|
<do param="default">
|
692
|
-
<%= s = t("tags.you.other_user.#{k || attributes.keys.first || 'default'}", :name=>name
|
693
|
-
:default=>"#{name
|
662
|
+
<%= s = I18n.t("tags.you.other_user.#{k || attributes.keys.first || 'default'}", :name=>this.name,
|
663
|
+
:default=>"#{this.name} #{'has' if attributes[:have]}#{'is' if attributes[:are]}#{'does' if attributes[:do]}")
|
694
664
|
(titleize||capitalize) ? s.sub(/^./){|c| c.upcase} : s %>
|
695
665
|
</do>
|
696
666
|
</else>
|
@@ -758,17 +728,17 @@ Notes
|
|
758
728
|
attrs = {}
|
759
729
|
attributes.each_pair{|k,v| attrs[k.to_sym] = v}
|
760
730
|
d = "#{your_default} #{all_parameters.default}"
|
761
|
-
options = {:default=>[d], :count=>(attrs[:count]||1), :name=>name
|
731
|
+
options = {:default=>[d], :count=>(attrs[:count]||1), :name=>this.name}
|
762
732
|
your_key = key.split('.').last
|
763
733
|
unless key.eql?(your_key) || attrs.has_key?(your_key.to_sym)
|
764
|
-
options[your_key.to_sym] = t(key, :count=>options[:count], :default=>your_key.titleize)
|
734
|
+
options[your_key.to_sym] = I18n.t(key, :count=>options[:count], :default=>your_key.titleize)
|
765
735
|
end
|
766
736
|
s = if this == current_user
|
767
737
|
options[:default].unshift :"tags.your.default.current_user"
|
768
|
-
t("tags.your.#{your_key}.current_user", options.merge(attrs))
|
738
|
+
I18n.t("tags.your.#{your_key}.current_user", options.merge(attrs))
|
769
739
|
else
|
770
740
|
options[:default].unshift :"tags.your.default.other_user"
|
771
|
-
t("tags.your.#{your_key}.other_user", options.merge(attrs))
|
741
|
+
I18n.t("tags.your.#{your_key}.other_user", options.merge(attrs))
|
772
742
|
end
|
773
743
|
capitalize ? s.sub(/^./){|c| c.upcase} : s
|
774
744
|
%></def>
|
@@ -795,9 +765,9 @@ Notes
|
|
795
765
|
|
796
766
|
<!-- Development mode only - a menu to change the `current_user` -->
|
797
767
|
<def tag="dev-user-changer">
|
798
|
-
<set user="&Hobo::Model::
|
768
|
+
<set user="&Hobo::Model::User.default_user_model"/>
|
799
769
|
<select-menu if="&user && Rails.env.development?"
|
800
|
-
first-option="#{t('hobo.dev_user_changer.guest', {:default=>'Guest'})}" options="&user.all(:limit => 30).*.login"
|
770
|
+
first-option="#{I18n.t('hobo.dev_user_changer.guest', {:default=>'Guest'})}" options="&user.all(:limit => 30).*.login"
|
801
771
|
onchange="location.href = '#{dev_support_path :action=>:set_current_user}?login=' + encodeURIComponent(this.options[this.selectedIndex].value)"
|
802
772
|
selected="#{current_user.login}"
|
803
773
|
class="dev-user-changer"
|
@@ -1,6 +1,6 @@
|
|
1
1
|
<!-- Extra tags for semantic markup -->
|
2
2
|
|
3
|
-
<!-- Used as a semantic wrapper around a group of sections and asides. CSS layouts can be provided based on this structure.
|
3
|
+
<!-- Used as a semantic wrapper around a group of sections and asides. CSS layouts can be provided based on this structure.
|
4
4
|
|
5
5
|
### Usage
|
6
6
|
|
@@ -13,7 +13,7 @@
|
|
13
13
|
<def tag="section-group"><div class="section-group"><div class="section-group-inner" merge-attrs param="default"></div></div></def>
|
14
14
|
|
15
15
|
<!-- A proposed HTML 5 tag for representing a generic document or application section. Slightly more semantic than `<div>` for indicating document structure. For the time being, `<section>` is output as `<div class="section">`. In Hobo, `<section>` also has one other important behaviour which is different to using `<div>` directly, when the content of the section is empty, the wrapper tag will disappear. e.g.
|
16
|
-
|
16
|
+
|
17
17
|
<section>My Section</section> -> <div class="section">My Section</div>
|
18
18
|
<section><% # empty %></section> -> (nothing is generated)
|
19
19
|
-->
|
@@ -81,45 +81,25 @@ This tag does not sanitize HTML; this is provided by HtmlString before saving to
|
|
81
81
|
|
82
82
|
### Attributes
|
83
83
|
|
84
|
-
|
85
|
-
|
86
|
-
|
87
|
-
|
88
|
-
|
89
|
-
|
90
|
-
|
84
|
+
- include-none: Should the menu include a "none" option (true/false). Defaults: false, or true if the association is nil at render-time.
|
85
|
+
|
86
|
+
- blank-message: The text for the "none" option. Default: "(No Product)" (or whatever the model name is)
|
87
|
+
|
88
|
+
- sort: Sort the options (true/false)? Default: false
|
89
|
+
|
90
|
+
- update: one or more DOM ID's (comma separated string or an array) to be updated as part of the ajax call.
|
91
91
|
|
92
92
|
NOTE: yes that's *DOM ID's* not part-names. A common source of confusion because by default the part name and DOM ID are the same.
|
93
93
|
|
94
94
|
-->
|
95
|
-
<def tag="select-one-editor" attrs="include-none, blank-message,
|
95
|
+
<def tag="select-one-editor" attrs="include-none, blank-message, sort, update, options"><%
|
96
96
|
raise Hobo::Error.new("Not allowed to edit") unless can_edit?
|
97
|
-
blank_message ||=
|
98
|
-
|
99
|
-
|
100
|
-
|
101
|
-
|
102
|
-
|
103
|
-
order = this_field_reflection.klass.default_order
|
104
|
-
this_field_reflection.klass.all(:conditions => conditions, :limit => limit, :order => order).select {|x| can_view?(x)}
|
105
|
-
end
|
106
|
-
|
107
|
-
id_method = this_field_reflection.options[:primary_key] || this_field_reflection.klass.primary_key
|
108
|
-
if text_method.nil?
|
109
|
-
select_options = options.map { |x| [name(:with => x, :no_wrapper => true), x.send(id_method)] }
|
110
|
-
else
|
111
|
-
select_options = options.map do |x|
|
112
|
-
[ text_method.split(".").inject(x) { |v, method| v.send(method) },
|
113
|
-
x.send(id_method) ]
|
114
|
-
end
|
115
|
-
end
|
116
|
-
else
|
117
|
-
# handle the old style, where options could be passed an options_for_select style array
|
118
|
-
select_options = options
|
119
|
-
end
|
120
|
-
select_options = select_options.sort if sort
|
121
|
-
select_options.insert(0, [blank_message, ""]) if include_none || (this.nil? && include_none != false)
|
122
|
-
|
97
|
+
blank_message ||= "(No #{this_type.name.to_s.titleize})"
|
98
|
+
options ||= this_field_reflection.klass.all.select {|x| can_view?(x)}.map {|x|
|
99
|
+
[ name(:with => x, :no_wrapper => true), x.id ]
|
100
|
+
}
|
101
|
+
options = options.sort if sort
|
102
|
+
options.insert(0, [blank_message, ""]) if this.nil? || include_none
|
123
103
|
f = ajax_updater(object_url(this_parent, :method => :put),
|
124
104
|
update,
|
125
105
|
:method => "put",
|
@@ -128,7 +108,7 @@ This tag does not sanitize HTML; this is provided by HtmlString before saving to
|
|
128
108
|
} })
|
129
109
|
%>
|
130
110
|
<select onchange="#{f}" merge-attrs>
|
131
|
-
<%= options_for_select(
|
111
|
+
<%= options_for_select(options, this ? this.id : "") %>
|
132
112
|
</select>
|
133
113
|
</def>
|
134
114
|
|
@@ -236,7 +216,7 @@ This tag does not sanitize HTML; this is provided by HtmlString before saving to
|
|
236
216
|
-->
|
237
217
|
<def tag="integer-select-editor" attrs="options, min, max, update, nil-option, message">
|
238
218
|
<% options ||= (min.to_i..max.to_i).to_a %>
|
239
|
-
<select class="integer editor #{
|
219
|
+
<select class="integer editor #{'update:' + comma_split(update).join(':') unless update.blank?} #{model_id_class(this_parent, this_field)}"
|
240
220
|
merge-attrs="&message ? attributes.merge(:hobo_message => message) : attributes">
|
241
221
|
<if test="&this.nil?"><option value=""><%= nil_option || "Choose a value" %></option></if>
|
242
222
|
<%= options_for_select(options.*.to_s, this.to_s) %>
|
@@ -32,6 +32,8 @@ Several of the tags in this taglib support the following set of ajax attributes:
|
|
32
32
|
The following attributes are also supported by all the ajax tags. Set them to fragments of javascript to have that script
|
33
33
|
executed at various points in the ajax request cycle:
|
34
34
|
|
35
|
+
- before: script to run before the request
|
36
|
+
|
35
37
|
- success: script to run on successful completion of the request
|
36
38
|
|
37
39
|
- failure: script to run on a request failure
|
@@ -221,7 +223,7 @@ The standard form tag does not have any parameters, nor does it have any default
|
|
221
223
|
page_path = if (request.post? || request.put?) && params[:page_path]
|
222
224
|
params[:page_path]
|
223
225
|
else
|
224
|
-
|
226
|
+
view_name.sub(Dryml::EMPTY_PAGE, params[:action] || '')
|
225
227
|
end
|
226
228
|
page_path_hidden = hidden_field_tag("page_path", page_path)
|
227
229
|
end
|
@@ -371,51 +373,34 @@ edit collections a `Category` model in your application:
|
|
371
373
|
|
372
374
|
### Attributes
|
373
375
|
|
374
|
-
-
|
375
|
-
helper
|
376
|
+
- order: The order of the year, month and day menus. A comma separated string or an array. Default: "year, month, day"
|
376
377
|
|
377
|
-
|
378
|
+
Any other attributes are passed through to the `select_date` helper.
|
378
379
|
|
379
380
|
The menus default to the current date if the current value is nil.
|
380
381
|
|
381
|
-
Examples:
|
382
|
-
|
383
|
-
- override the input for date tag in a form
|
384
|
-
|
385
|
-
<my-special-date-view:>
|
386
|
-
<input start-year="&1940" order="day,month,year" />
|
387
|
-
</my-special-date-view:>
|
388
|
-
|
389
|
-
- override the tag application-wide
|
390
|
-
|
391
|
-
<extend tag='input' for='date'>
|
392
|
-
<old-input merge order="day,month,year" start-year="&1940" />
|
393
|
-
</extend>
|
394
|
-
|
395
382
|
-->
|
396
|
-
<def tag="input" for="date" attrs="
|
383
|
+
<def tag="input" for="date" attrs="order">
|
397
384
|
<% order = order.nil? ? [:year, :month, :day] : comma_split(order).*.to_sym -%>
|
398
|
-
<%= select_date(this || current_time,
|
399
|
-
(all_attributes - attributes.keys).reverse_merge(:prefix => param_name_for_this).merge(:order => order),
|
400
|
-
attributes - [:name]) %>
|
385
|
+
<%= select_date(this || current_time, attributes.merge(:prefix => param_name_for_this, :order => order)) %>
|
401
386
|
</def>
|
402
387
|
|
403
388
|
|
404
|
-
<!-- A date/time picker, using the `
|
389
|
+
<!-- A date/time picker, using the `select_date` helper from Rails
|
405
390
|
|
406
391
|
### Attributes
|
407
392
|
|
408
|
-
-
|
393
|
+
- order: The order of the year, month and date menus. A comma separated string or an array. Default: "year, month,
|
394
|
+
day, hour, minute, second"
|
409
395
|
|
410
|
-
|
396
|
+
Any other attributes are passed through to the `select_date` helper.
|
411
397
|
|
412
398
|
The menus default to the current time if the current value is nil.
|
413
399
|
|
414
400
|
-->
|
415
|
-
<def tag="input" for="time" attrs="
|
416
|
-
|
417
|
-
|
418
|
-
attributes - [:name] ) %>
|
401
|
+
<def tag="input" for="time" attrs="order">
|
402
|
+
<% order = order.nil? ? [:year, :month, :day, :hour, :minute, :second] : comma_split(order).*.to_sym -%>
|
403
|
+
<%= select_date(this || current_time, attributes.merge(:prefix => param_name_for_this, :order => order)) %>
|
419
404
|
</def>
|
420
405
|
|
421
406
|
|
@@ -425,21 +410,18 @@ The menus default to the current time if the current value is nil.
|
|
425
410
|
|
426
411
|
- order: The order of the year, month and date menus. A comma separated string or an array. Default: "year, month,
|
427
412
|
day, hour, minute"
|
428
|
-
- date-separator, discard-type, prompt and prefix are passed to the select_date helper as options
|
429
413
|
|
430
|
-
|
414
|
+
Any other attributes are passed through to the `select_datetime` helper.
|
431
415
|
|
432
416
|
The menus default to the current time if the current value is nil.
|
433
417
|
|
434
418
|
-->
|
435
|
-
<def tag="input" for="datetime" attrs="order
|
419
|
+
<def tag="input" for="datetime" attrs="order">
|
436
420
|
<% if ! order.nil?
|
437
421
|
order = comma_split(order).*.to_sym
|
438
422
|
attributes.merge!(:order => order)
|
439
423
|
end -%>
|
440
|
-
<%= select_datetime(this || current_time,
|
441
|
-
(all_attributes - attributes.keys).reverse_merge(:prefix => param_name_for_this).merge(:order => order),
|
442
|
-
attributes - [:name] ) %>
|
424
|
+
<%= select_datetime(this || current_time, attributes.merge(:prefix => param_name_for_this)) %>
|
443
425
|
</def>
|
444
426
|
|
445
427
|
<!-- An `<input type='text'>` input. -->
|
@@ -585,7 +567,7 @@ All the standard ajax attributes *except the callbacks* are supported (see the m
|
|
585
567
|
|
586
568
|
-->
|
587
569
|
<def tag="delete-button" attrs="label, update, in-place, image, confirm, fade, subsite"><%=
|
588
|
-
in_place = false if in_place.nil? && this == @this && request.method
|
570
|
+
in_place = false if in_place.nil? && this == @this && request.method == :get
|
589
571
|
url = object_url(this, :method => :delete, :subsite => subsite)
|
590
572
|
if (Dryml.last_if = url && can_delete?)
|
591
573
|
attributes = attributes.merge(if image
|
@@ -593,8 +575,8 @@ All the standard ajax attributes *except the callbacks* are supported (see the m
|
|
593
575
|
else
|
594
576
|
{ :type => "button" }
|
595
577
|
end)
|
596
|
-
label ||= t("hobo.actions.remove", :default=>"Remove")
|
597
|
-
confirm = t("hobo.messages.confirm", :default=>"Are you sure?") if confirm.nil?
|
578
|
+
label ||= I18n.t("hobo.actions.remove", :default=>"Remove")
|
579
|
+
confirm = I18n.t("hobo.messages.confirm", :default=>"Are you sure?") if confirm.nil?
|
598
580
|
|
599
581
|
add_classes!(attributes,
|
600
582
|
image ? "image-button" : "button",
|
@@ -607,7 +589,7 @@ All the standard ajax attributes *except the callbacks* are supported (see the m
|
|
607
589
|
else
|
608
590
|
fade = true if fade.nil?
|
609
591
|
attributes[:value] = label
|
610
|
-
attributes[:onclick] = "Hobo.removeButton(this, '#{url}', #{js_updates(update)}, {fade:#{fade}, confirm:
|
592
|
+
attributes[:onclick] = "Hobo.removeButton(this, '#{url}', #{js_updates(update)}, {fade:#{fade}, confirm: #{confirm.inspect}})"
|
611
593
|
element(:input, attributes, nil, true, true)
|
612
594
|
end
|
613
595
|
end
|
@@ -633,8 +615,7 @@ All of the standard ajax attributes are supported (see the main taglib documenti
|
|
633
615
|
class_or_assoc = if model
|
634
616
|
model.is_a?(String) ? model.constantize : model
|
635
617
|
elsif Hobo.simple_has_many_association?(this)
|
636
|
-
|
637
|
-
fields[this_field_reflection.primary_key_name] = this.proxy_owner.send(id_method)
|
618
|
+
fields[this_field_reflection.primary_key_name] = this.proxy_owner.id
|
638
619
|
this
|
639
620
|
else
|
640
621
|
raise Hobo::Error.new("invalid context for <create-button>")
|
@@ -642,18 +623,12 @@ All of the standard ajax attributes are supported (see the main taglib documenti
|
|
642
623
|
new = class_or_assoc.new(fields)
|
643
624
|
new.set_creator(current_user)
|
644
625
|
if can_create?(new)
|
645
|
-
label ||= ht("#{new.class.
|
626
|
+
label ||= ht("#{new.class.name.tableize}.actions.new", :default=>"New #{new.class.model_name.human}")
|
627
|
+
ajax_attributes = { :message => message }
|
646
628
|
class_name = new.class.name.underscore
|
647
|
-
params
|
648
|
-
params = params.merge(class_name => fields) unless fields.blank?
|
649
|
-
|
650
|
-
ajax_attributes, html_attributes = attributes.partition_hash(Hobo::Rapid::Helper::AJAX_ATTRS)
|
651
|
-
|
652
|
-
ajax_attributes.reverse_merge!(:message => message, :params => params)
|
629
|
+
ajax_attributes[:params] = { class_name => fields } unless fields.empty?
|
653
630
|
func = ajax_updater(object_url(new.class, :method => :post), update, ajax_attributes)
|
654
|
-
|
655
|
-
|
656
|
-
element :input, add_classes(html_attributes,
|
631
|
+
element :input, add_classes(attributes.merge(:type =>'button', :onclick => func, :value => label),
|
657
632
|
"button create-button create-#{class_name}-button"), nil, true, true
|
658
633
|
end
|
659
634
|
%></def>
|
@@ -668,7 +643,6 @@ This is the default input that Rapid uses for `belongs_to` associations. The men
|
|
668
643
|
- `include-none` - whether to include a 'none' option (i.e. set the foreign key to null). If this value is not supplied, the default is "true" if the current value is nil; otherwise the default is "false". One implication of this is that the default may change when the form is re-rendered due to a validation failure. Setting this value explicitly is recommended.
|
669
644
|
- `blank-message` - the message for the 'none' option. Defaults to "(No `<model-name>`)", e.g. "(No Product)"
|
670
645
|
- `options` - an array of records to include in the menu. Defaults to the all the records in the target table that match any `:conditions` declared on the `belongs_to` (subject to `limit`)
|
671
|
-
- `sort` - whether to sort the array of options. Defaults to no sorting.
|
672
646
|
- `limit` - if `options` is not specified, this limits the number of records. Default: 100
|
673
647
|
- `text_method` - The method to call on each record to get the text for the option. Multiple methods are supported ie "institution.name"
|
674
648
|
|
@@ -678,23 +652,21 @@ For situations where there are too many target records to practically include in
|
|
678
652
|
|
679
653
|
-->
|
680
654
|
<def tag="select-one" attrs="include-none, blank-message, options, sort, limit, text-method"><%
|
681
|
-
raise Hobo::
|
682
|
-
blank_message ||= ht("#{this_type.name.
|
655
|
+
raise Hobo::Error.new("Not allowed to edit #{this_field}") if !attributes[:disabled] && !can_edit?
|
656
|
+
blank_message ||= ht("#{this_type.name.tableize}.message.no", :default=>"(No #{this_type.model_name.human})")
|
683
657
|
limit ||= 100
|
684
658
|
|
685
659
|
options ||= begin
|
686
660
|
conditions = ActiveRecord::Associations::BelongsToAssociation.new(this_parent, this_field_reflection).send(:conditions)
|
687
|
-
|
688
|
-
this_field_reflection.klass.all(:conditions => conditions, :limit => limit, :order => order).select {|x| can_view?(x)}
|
661
|
+
this_field_reflection.klass.all(:conditions => conditions, :limit => limit).select {|x| can_view?(x)}
|
689
662
|
end
|
690
663
|
|
691
|
-
id_method = this_field_reflection.options[:primary_key] || this_field_reflection.klass.primary_key
|
692
664
|
if text_method.nil?
|
693
|
-
select_options = options.map { |x| [
|
665
|
+
select_options = options.map { |x| [x.to_s, x.id] }
|
694
666
|
else
|
695
667
|
select_options = options.map do |x|
|
696
668
|
[ text_method.split(".").inject(x) { |v, method| v.send(method) },
|
697
|
-
x.
|
669
|
+
x.id ]
|
698
670
|
end
|
699
671
|
end
|
700
672
|
select_options = select_options.sort if sort
|
@@ -702,7 +674,7 @@ For situations where there are too many target records to practically include in
|
|
702
674
|
attributes = add_classes(attributes, "input", "belongs_to", type_and_field)
|
703
675
|
-%>
|
704
676
|
<select name="#{param_name_for_this(true)}" merge-attrs="&attributes.except :name">
|
705
|
-
<%= options_for_select(select_options, this ? this.
|
677
|
+
<%= options_for_select(select_options, this ? this.id : "") %>
|
706
678
|
</select>
|
707
679
|
</def>
|
708
680
|
|
@@ -773,13 +745,11 @@ If you wish to set `min-chars` to 0, you will require this [patch to controls.js
|
|
773
745
|
min_chars ||= 1
|
774
746
|
value = name(:no_wrapper => true, :if_present => true)
|
775
747
|
-%>
|
776
|
-
<
|
777
|
-
|
778
|
-
|
779
|
-
|
780
|
-
|
781
|
-
<div class="completions-popup" style="display:none"></div>
|
782
|
-
</wrap>
|
748
|
+
<input type="text" name="#{param_name_for_this}"
|
749
|
+
class="autocompleter #{type_and_field._?.dasherize} #{css_data :complete_on, typed_id(complete_target), completer} #{css_data :min_chars, min_chars} #{'nil-value' if value==''}"
|
750
|
+
value="#{value=='' ? nil_value : value}"
|
751
|
+
merge-attrs/>
|
752
|
+
<div class="completions-popup" style="display:none"></div>
|
783
753
|
</def>
|
784
754
|
|
785
755
|
|
@@ -809,19 +779,11 @@ If you wish to set `min-chars` to 0, you will require this [patch to controls.js
|
|
809
779
|
<!-- Renders a localized list of error messages following a form submission. Expects the errors to be in `this.errors`. Renders nothing if there are no errors.
|
810
780
|
-->
|
811
781
|
<def tag="error-messages">
|
812
|
-
<section class="error-messages" merge-attrs if="&this.errors.
|
813
|
-
<h2 param="heading">
|
814
|
-
|
815
|
-
<%= model = this.class.model_name.human
|
816
|
-
count = this.errors.size
|
817
|
-
count==1 ? "1 error prohibited this #{model} from being saved" :
|
818
|
-
"#{count} errors prohibited this #{model} from being saved"
|
819
|
-
%>
|
820
|
-
</t>
|
821
|
-
</h2>
|
822
|
-
<t key="activerecord.errors.template.body">There were problems with the following fields:</t>
|
782
|
+
<section class="error-messages" merge-attrs if="&this.errors.length > 0">
|
783
|
+
<h2 param="heading"><t key="activerecord.errors.template.header" model="&this.class.model_name.human" count="&this.errors.size"/></h2>
|
784
|
+
<t key="activerecord.errors.template.body"></t>
|
823
785
|
<ul param>
|
824
|
-
<% this.errors.
|
786
|
+
<% this.errors.each_full do |message| -%>
|
825
787
|
<li param><%= message %></li>
|
826
788
|
<% end -%>
|
827
789
|
</ul>
|
@@ -835,12 +797,12 @@ An input for `has_many :through` associations that lets the user chose the items
|
|
835
797
|
To use this tag, the model of the items the user is chosing *must* have unique names, and the
|
836
798
|
-->
|
837
799
|
<def tag="select-many" attrs="options, targets, remove-label, prompt, disabled, name"><%
|
838
|
-
prompt ||= ht("#{
|
800
|
+
prompt ||= ht("#{this_field.tableize}.form.select_many.prompt", :default=>"Add #{this_field.titleize.singularize}")
|
839
801
|
options ||= this_field_reflection.klass.all(:conditions =>this.send(:conditions)).select {|x| can_view?(x)}
|
840
802
|
name ||= param_name_for_this
|
841
803
|
|
842
804
|
values = this
|
843
|
-
remove_label ||= t("hobo.actions.remove", :default=>'Remove')
|
805
|
+
remove_label ||= I18n.t("hobo.actions.remove", :default=>'Remove')
|
844
806
|
-%>
|
845
807
|
<div class="input select-many" merge-attrs>
|
846
808
|
<div style="display:none" class="item-proto">
|
@@ -886,7 +848,7 @@ Use the `stay-here` attribute to remain on the current page:
|
|
886
848
|
...
|
887
849
|
</form>
|
888
850
|
|
889
|
-
Use the `go-back` option to return to the page
|
851
|
+
Use the `go-back` option to return to the previous page:
|
890
852
|
|
891
853
|
<form>
|
892
854
|
<after-submit go-back/>
|
@@ -921,14 +883,14 @@ Use the `uri` option to specify a redirect location:
|
|
921
883
|
<def tag="select-menu" attrs="options, selected, first-option, first-value, key">
|
922
884
|
<% key ||= 'default'
|
923
885
|
%w[options first_option first_value].each do |a|
|
924
|
-
str = t("tags.select_menu.#{key}.#{a}", :default=>'')
|
886
|
+
str = I18n.t("tags.select_menu.#{key}.#{a}", :default=>'')
|
925
887
|
eval "#{a} = str unless str.blank?"
|
926
888
|
end
|
927
889
|
-%>
|
928
890
|
<select merge-attrs param="default">
|
929
891
|
<% selected=this if selected.nil? %>
|
930
892
|
<option value="#{first_value}" unless="&first_option.nil?"><first-option/></option>
|
931
|
-
<do param="options"
|
893
|
+
<do param="options"><% options_for_select(options, selected) %></do>
|
932
894
|
</select>
|
933
895
|
</def>
|
934
896
|
|
@@ -953,8 +915,8 @@ Use the `uri` option to specify a redirect location:
|
|
953
915
|
<input type="hidden" name="#{param_name}[]" value=""/><% # ensure all items are removed when nothing checked
|
954
916
|
%>
|
955
917
|
<li repeat="&options" param>
|
956
|
-
<input
|
957
|
-
<
|
918
|
+
<input type="checkbox" name="#{param_name}[]" value="@#{this.id}" checked="&this.in?(collection)" disabled="&disabled"/>
|
919
|
+
<name param/>
|
958
920
|
</li>
|
959
921
|
</ul>
|
960
922
|
</def>
|
@@ -1064,7 +1026,7 @@ end
|
|
1064
1026
|
<input type="hidden" class="empty-input" id="#{underize param_name_for_this}" name="#{param_name_for_this}" value="" disabled="&(!this.empty? || minimum>0)" />
|
1065
1027
|
<fake-field-context fake-field="-1" context="&template">
|
1066
1028
|
<div param="empty-message">
|
1067
|
-
<ht key="#{this.class.
|
1029
|
+
<ht key="#{this.class.name.tableize}.collection.empty_message">
|
1068
1030
|
No <%= this.class.name.titleize.downcase.pluralize %>.
|
1069
1031
|
</ht>
|
1070
1032
|
</div>
|