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
@@ -20,8 +20,8 @@
|
|
20
20
|
<def tag="empty-collection-message">
|
21
21
|
<unless test="&this.member_class.nil?">
|
22
22
|
<div class="empty-collection-message" style="#{'display:none' if !this.empty?}" param="default">
|
23
|
-
<ht key="#{this.member_class.name.
|
24
|
-
No <collection-name/> to display
|
23
|
+
<ht key="#{this.member_class.name.tableize}.collection.empty_message">
|
24
|
+
No <collection-name lowercase/> to display
|
25
25
|
</ht>
|
26
26
|
</div>
|
27
27
|
</unless>
|
@@ -1,19 +1,43 @@
|
|
1
1
|
<!-- Rapid i18n provides tags related with the Rails-I18n project -->
|
2
2
|
|
3
|
-
<!--
|
3
|
+
<!-- Simple wrapper around I18n.t.
|
4
|
+
The tag content is used as the :default option. It is overridden by an explicit 'default' attribute.
|
5
|
+
There is a default :count => 1
|
6
|
+
|
7
|
+
### Attributes
|
8
|
+
|
9
|
+
- key: the key to lookup
|
10
|
+
- all the attributes accepted by the wrapped method
|
11
|
+
|
12
|
+
-->
|
13
|
+
<def tag="t"><%=
|
14
|
+
options = {}
|
15
|
+
attributes.each_pair{|k,v| options[k.to_sym] = h(v)}
|
16
|
+
k = options.delete(:key)
|
17
|
+
I18n.t(k, {:default=>all_parameters.default}.merge(options)).html_safe
|
18
|
+
%></def>
|
19
|
+
|
20
|
+
<!-- Wrapper around ActiveModel::Name#human with added sugar.
|
21
|
+
It dynamically pluralizes the human name by using the implicit model.count.
|
4
22
|
|
5
23
|
#### Attributes
|
6
24
|
|
7
25
|
- model - (optional) should be a model class or a record object (default to this)
|
8
|
-
- count - (optional) used to pick the inflected string for the model. It should be an integer
|
26
|
+
- count - (optional) used to pick the inflected string for the model. It should be an integer
|
27
|
+
or the symbol :dynamic if you want to have the pluralization consistent with the model.count.
|
28
|
+
If you don't pass any count it uses the ApplicationHelper#default_count.
|
9
29
|
-->
|
30
|
+
|
10
31
|
<def tag="model-name-human" attrs="model, count"><%=
|
11
32
|
model ||= this
|
12
33
|
model = model.class unless model.kind_of? Class
|
34
|
+
# adapted from count tag
|
35
|
+
count = default_count if count.blank?
|
36
|
+
c = count.try.to_int || count==:dynamic && this.try.total_entries || (this.try.loaded? && this.try.length) || this.try.count || this.try.length
|
13
37
|
# prepare symbolized attributes for merging
|
14
38
|
attrs = {}
|
15
|
-
|
16
|
-
model.model_name.human( attrs )
|
39
|
+
attributes.each_pair{|k,v| attrs[k.to_sym] = v}
|
40
|
+
model.model_name.human( {:count=>c}.merge(attrs) )
|
17
41
|
%>
|
18
42
|
</def>
|
19
43
|
|
@@ -27,82 +51,83 @@
|
|
27
51
|
- count - (optional) should be an integer
|
28
52
|
|
29
53
|
-->
|
54
|
+
|
30
55
|
<def tag="human-attribute-name" attrs="attribute, model"><%=
|
31
56
|
model ||= this
|
32
57
|
model = model.class unless model.kind_of? Class
|
33
58
|
# prepare symbolized attributes for merging
|
34
59
|
attrs = {}
|
35
|
-
|
60
|
+
attributes.each_pair{|k,v| attrs[k.to_sym] = v}
|
36
61
|
model.human_attribute_name( attribute.to_sym, attrs )
|
37
62
|
%>
|
38
63
|
</def>
|
39
64
|
|
40
65
|
<!-- Used to localize and pluralize collection names.
|
41
|
-
A collection name is a special case of an attribute name, (indeed you should store the collection names as attribute names in the locale files), so this tag internally uses human_attribute_name to return them.
|
66
|
+
A collection name is a special case of an attribute name, (indeed you should store the collection names as attribute names in the locale files), so this tag internally uses human_attribute_name to return them. It does also the default pluralization by calling count on the collection attribute (that you can override passing an explicit `count` attribute).
|
42
67
|
|
43
|
-
With the `your` attribute and in the special case the context is a Hobo::Model::
|
68
|
+
With the `your` attribute and in the special case the context is a Hobo::Model::User instance it automatically embeds the `your` tag funtionality. (note: :name is added by default as an interpolable variable)
|
44
69
|
|
45
70
|
### Attributes
|
46
71
|
|
47
72
|
- collection - the attribute/collection key to lookup in the `activerecord.attributes` namespace. (e.g. 'roles')
|
48
|
-
- count -
|
73
|
+
- count - It should be an integer or the symbol :dynamic if you want to have the pluralization
|
74
|
+
consistent with the collection.count. If you don't pass any count it uses the ApplicationHelper#default_count.
|
49
75
|
- your - wraps the collection name in a `Your` tag
|
50
76
|
|
51
77
|
### Example
|
52
78
|
|
53
79
|
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
roles:
|
63
|
-
one: "Ruolo"
|
64
|
-
other: "Ruoli"
|
65
|
-
tags:
|
66
|
-
your:
|
80
|
+
it:
|
81
|
+
activerecord:
|
82
|
+
attributes:
|
83
|
+
post:
|
84
|
+
comments:
|
85
|
+
one: "Commento"
|
86
|
+
other: "Commenti"
|
87
|
+
user:
|
67
88
|
roles:
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
|
86
|
-
|
87
|
-
|
88
|
-
|
89
|
-
|
90
|
-
|
91
|
-
|
89
|
+
one: "Ruolo"
|
90
|
+
other: "Ruoli"
|
91
|
+
tags:
|
92
|
+
your:
|
93
|
+
roles:
|
94
|
+
current_user:
|
95
|
+
one: "Il tuo Ruolo"
|
96
|
+
other: "I tuoi Ruoli"
|
97
|
+
other_user:
|
98
|
+
one: "Ruolo di {{name}}"
|
99
|
+
other: Ruoli di {{name}}"
|
100
|
+
|
101
|
+
# context is a Post instance ('your' is ignored)
|
102
|
+
<human-collection-name collection="comments" your/>
|
103
|
+
I18n.locale = :en => "Comment" or "Comments"
|
104
|
+
I18n.locale = :it => "Commento" or "Commenti"
|
105
|
+
|
106
|
+
# context is an User instance
|
107
|
+
<human-collection-name collection="roles' your/>
|
108
|
+
I18n.locale = :en => "Your Role" or "Jim's Role" or "Your Roles" or "Jim's Roles"
|
109
|
+
I18n.locale = :it => "Il tuo Ruolo" or "Il Ruolo di Jim" or "I tuoi Ruoli" or "I Ruoli di Jim"
|
110
|
+
(output is the same as <Your key="roles" count=>"&user.roles.count"/> )
|
111
|
+
|
112
|
+
<human-collection-name collection="roles"/>
|
113
|
+
I18n.locale = :en => "Role" or "Roles"
|
114
|
+
I18n.locale = :it => "Ruolo" or "Ruoli"
|
92
115
|
-->
|
93
116
|
<def tag="human-collection-name" attrs="collection, count, your"><%
|
94
117
|
raise Hobo::Error, "The 'collection' attribute must be defined" if collection.blank?
|
95
118
|
belong_class = this.kind_of?(Class) ? this : this.class
|
96
119
|
raise Hobo::Error, "The context is not an ActiveRecord::Base instance or class. (this = #{this.typed_id rescue this.inspect})" unless belong_class < ActiveRecord::Base
|
120
|
+
count = default_count if count.blank?
|
121
|
+
c = count.try.to_int || count==:dynamic && this.kind_of?(ActiveRecord::Base) && this.send(collection.to_sym).count
|
97
122
|
# prepare symbolized attributes for merging
|
98
123
|
attrs = {}
|
99
|
-
|
100
|
-
<% if your && belong_class < Hobo::Model::
|
101
|
-
<your key="&collection" merge-attrs="&{:name=>name
|
102
|
-
<%= belong_class.human_attribute_name(collection.to_sym, attrs) %>
|
124
|
+
attributes.each_pair{|k,v| attrs[k.to_sym] = v} -%>
|
125
|
+
<% if your && belong_class < Hobo::Model::User && this.kind_of?(Hobo::Model::User) && I18n.locale == :en -%>
|
126
|
+
<your key="&collection" merge-attrs="&{:count=>c, :name=>this.name}.merge(attrs)" capitalize>
|
127
|
+
<%= belong_class.human_attribute_name(collection.to_sym, {:count=>c}.merge(attrs)) %>
|
103
128
|
</your>
|
104
129
|
<% else -%>
|
105
|
-
<%= belong_class.human_attribute_name( collection.to_sym, attrs ) %>
|
130
|
+
<%= belong_class.human_attribute_name( collection.to_sym, {:count=>c}.merge(attrs) ) %>
|
106
131
|
<% end %>
|
107
132
|
</def>
|
108
133
|
|
@@ -1,14 +1,14 @@
|
|
1
1
|
<!-- Contains view-layer support for Hobo's lifecycles. Note that lifecycle forms are generated automatically in `app/views/taglibs/auto/rapid/forms.dryml` - this library contains only lifecycle push-buttons. -->
|
2
2
|
|
3
3
|
<!-- A push-button to invoke a lifecycle transition either as a page-reload or as an ajax call.
|
4
|
-
|
4
|
+
|
5
5
|
### Attributes
|
6
6
|
|
7
7
|
- `transition` - the name of the transition to invoke. Required
|
8
8
|
- `update` - one or more DOM IDs of ajax parts to update after the transition
|
9
9
|
- `label` - the label on the button. Defaults to the name of the transition
|
10
10
|
|
11
|
-
All of the [standard ajax attributes](/api_taglibs/rapid_forms) are also supported.
|
11
|
+
All of the [standard ajax attributes](/api_taglibs/rapid_forms) are also supported.
|
12
12
|
|
13
13
|
### Warning
|
14
14
|
|
@@ -25,9 +25,7 @@ Transitions with parameters are implemented using a form. HTML does not allow f
|
|
25
25
|
|
26
26
|
html_attributes[:method] ||= has_params ? :get : :put
|
27
27
|
add_classes!(html_attributes, "transition-button #{transition_name}-button")
|
28
|
-
label =
|
29
|
-
title = t("activerecord.attribute_help.#{this.class.to_s.underscore}.lifecycle.transitions.#{transition_name}")
|
30
|
-
html_attributes.update(:title => title) unless title.empty?
|
28
|
+
label = ht("#{this.class.name.tableize}.actions.#{transition_name}", :default => (label || transition_name.to_s.titleize))
|
31
29
|
url = object_url(this, transition_name, :method => html_attributes[:method])
|
32
30
|
|
33
31
|
if (update || !ajax_attributes.empty?) && !has_params
|
@@ -50,7 +48,7 @@ For example, you could use this on a `Friendship` card: the person invited to ha
|
|
50
48
|
This tag behaves similarly to repeat: an else tag may be used to handle the case of no buttons:
|
51
49
|
|
52
50
|
<transition-buttons/><else>Sorry, no buttons to press.</else>
|
53
|
-
-->
|
51
|
+
-->
|
54
52
|
<def tag="transition-buttons">
|
55
53
|
<% ajax_attrs, html_attrs = attributes.partition_hash(Hobo::Rapid::Helper::AJAX_ATTRS) %>
|
56
54
|
<div merge-attrs="&html_attrs" class="transitions">
|
@@ -61,4 +59,4 @@ This tag behaves similarly to repeat: an else tag may be used to handle the case
|
|
61
59
|
<% end %>
|
62
60
|
</if>
|
63
61
|
</div>
|
64
|
-
</def>
|
62
|
+
</def>
|
@@ -89,7 +89,7 @@ This is a simple tag - just look at the source if you need to know more detail.
|
|
89
89
|
<ul class="navigation account-nav" param>
|
90
90
|
<li if="&Rails.env.development?" param="dev-user-changer"><dev-user-changer/></li>
|
91
91
|
<if test="&logged_in?">
|
92
|
-
<li class='nav-item' param="logged-in-as"><a to="¤t_user"><t key="hobo.actions.logged_in_as" name="&name">Logged in as <name/></t></a></li>
|
92
|
+
<li class='nav-item' param="logged-in-as"><a to="¤t_user"><t key="hobo.actions.logged_in_as" name="&name.html_safe">Logged in as <name/></t></a></li>
|
93
93
|
<li class='nav-item' param="account"><a action="account"><t key="hobo.actions.account">Account</t></a></li>
|
94
94
|
<li class='nav-item' param="log-out"><a href="&logout_url"><t key="hobo.actions.logout">Log out</t></a></li>
|
95
95
|
</if>
|
@@ -104,5 +104,5 @@ This is a simple tag - just look at the source if you need to know more detail.
|
|
104
104
|
|
105
105
|
<!--- A simple wrapper around the `will_paginate` helper. All options to `will_paginate` are available as attributes -->
|
106
106
|
<def tag="page-nav">
|
107
|
-
<%= will_paginate this, attributes.symbolize_keys.reverse_merge(:inner_window => 2, :previous_label => translate("hobo.actions.previous", :default=>"
|
107
|
+
<%= will_paginate this, attributes.symbolize_keys.reverse_merge(:inner_window => 2, :previous_label => translate("hobo.actions.previous", :default=>"« Prev"), :next_label =>translate("hobo.actions.next", :default=>"Next »")) %>
|
108
108
|
</def>
|
@@ -24,7 +24,7 @@ The easiest way to see what this tag does is to look at the source.
|
|
24
24
|
</do>
|
25
25
|
|
26
26
|
<do param="scripts">
|
27
|
-
<javascript param name="prototype, effects, dragdrop, controls,
|
27
|
+
<javascript param name="prototype, effects, dragdrop, controls, lowpro, hobo-rapid"/>
|
28
28
|
<if-ie version="lt IE 7" param="fix-ie6">
|
29
29
|
<javascript name="IE7"/>
|
30
30
|
<javascript name="ie7-recalc"/>
|
@@ -32,14 +32,13 @@ The easiest way to see what this tag does is to look at the source.
|
|
32
32
|
<do param="custom-scripts"/>
|
33
33
|
<javascript param="application-javascript" name="application"/>
|
34
34
|
</do>
|
35
|
-
<%= csrf_meta_tag %>
|
36
35
|
</head>
|
37
36
|
|
38
37
|
<body param>
|
39
38
|
<set-scoped flash-rendered="&false">
|
40
39
|
<ajax-progress param/>
|
41
40
|
<header class="page-header" param>
|
42
|
-
<account-nav if="&login_url(Hobo::Model::
|
41
|
+
<account-nav if="&login_url(Hobo::Model::User.default_user_model)" param/>
|
43
42
|
<h1 param="app-name"><a href="#{base_url}/"><app-name/></a></h1>
|
44
43
|
<live-search param if="&defined_route? :site_search"/>
|
45
44
|
<main-nav current="&title" param/>
|
@@ -55,10 +54,10 @@ The easiest way to see what this tag does is to look at the source.
|
|
55
54
|
|
56
55
|
<!-- Renderes dynamically generated JavaScript required by `hobo-rapid.js`, including the information required to perform automatic part updates -->
|
57
56
|
<def tag="page-scripts">
|
58
|
-
<
|
57
|
+
<script type="text/javascript" param="default">
|
59
58
|
<hobo-rapid-javascripts/>
|
60
|
-
<part-contexts-
|
61
|
-
</
|
59
|
+
<part-contexts-storage/>
|
60
|
+
</script>
|
62
61
|
</def>
|
63
62
|
|
64
63
|
|
@@ -101,11 +100,11 @@ The easiest way to see what this tag does is to look at the source.
|
|
101
100
|
|
102
101
|
### Attributes
|
103
102
|
|
104
|
-
- `message` - The main message to display. Defaults to "The page you
|
103
|
+
- `message` - The main message to display. Defaults to "The page you were looking for could not be found"
|
105
104
|
|
106
105
|
-->
|
107
106
|
<def tag="not-found-page" attrs="message">
|
108
|
-
<% message ||=
|
107
|
+
<% message ||= "The page you were looking for could not be found" %>
|
109
108
|
<page merge>
|
110
109
|
<body: class="not-found"/>
|
111
110
|
<content: param>
|
@@ -13,11 +13,11 @@ An [worked example](/tutorials/agility#improve_the_project_page_with_a_searchabl
|
|
13
13
|
<div class="table-plus" merge-attrs="&attributes - attrs_for(:with_fields) - attrs_for(:table)">
|
14
14
|
<div class="header" param="header">
|
15
15
|
<div class="search">
|
16
|
-
<form param="search-form" method="get" action=""
|
16
|
+
<form param="search-form" method="get" action="">
|
17
17
|
<hidden-fields for-query-string skip="page, search"/>
|
18
18
|
<span><t key="hobo.table_plus.search">Search</t></span>
|
19
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"/>
|
20
|
+
<submit label="&I18n.t('hobo.table_plus.submit_label', :default=>'Go')" class="search-button" param="search-submit"/>
|
21
21
|
</form>
|
22
22
|
</div>
|
23
23
|
</div>
|
@@ -28,12 +28,12 @@ An [worked example](/tutorials/agility#improve_the_project_page_with_a_searchabl
|
|
28
28
|
<% col = sort_columns[scope.field_path] || scope.field_path
|
29
29
|
sort = sort_field == col && sort_direction == 'asc' ?
|
30
30
|
"-#{col}" : col
|
31
|
-
sort_url =
|
31
|
+
sort_url = url_for(params.merge(:sort => sort) - [:page])
|
32
32
|
col_heading_name = this.member_class.try.human_attribute_name(scope.field_name, :default=> scope.field_name.titleize) %>
|
33
33
|
|
34
|
-
<th param="#{scope.
|
34
|
+
<th param="#{scope.field-name}-heading">
|
35
35
|
<a href="&sort_url" class="column-sort"
|
36
|
-
param="#{scope.
|
36
|
+
param="#{scope.field-name}-heading-link"><%= col_heading_name %></a>
|
37
37
|
<if test="&col == sort_field">
|
38
38
|
<do param="up-arrow" if="&sort_direction == 'desc'">↑</do>
|
39
39
|
<do param="down-arrow" if="&sort_direction == 'asc'">↓</do>
|
@@ -45,7 +45,7 @@ An [worked example](/tutorials/agility#improve_the_project_page_with_a_searchabl
|
|
45
45
|
</table>
|
46
46
|
<empty-collection-message param="empty-message"/>
|
47
47
|
|
48
|
-
<page-nav param
|
48
|
+
<page-nav param if="&this.respond_to?(:page_count) || this.respond_to?(:total_pages)"/>
|
49
49
|
</div>
|
50
50
|
</def>
|
51
51
|
|
@@ -105,16 +105,16 @@ This tag assumes the controller has a `reorder` action and the model has a `posi
|
|
105
105
|
name ||= model_class.name.downcase.pluralize -%>
|
106
106
|
<section class="#{name.dasherize} collection-preview" param="default">
|
107
107
|
<h3 param="heading">
|
108
|
-
<ht key="#{
|
108
|
+
<ht key="#{name.to_s.tableize}.collection.heading" count="&this.size">
|
109
109
|
<do param="heading-content"><%= name.pluralize.titleize %></do>
|
110
110
|
</ht>
|
111
111
|
</h3>
|
112
112
|
<a with="&model_class" action="new" if="&can_create?(model_class.new)" param="new-link">
|
113
|
-
<ht key="#{model_class.to_s.
|
113
|
+
<ht key="#{model_class.to_s.tableize}.actions.new">New <%= model_class.model_name.human %></ht>
|
114
114
|
</a>
|
115
115
|
<collection param/>
|
116
|
-
<unless test="&this.empty?
|
117
|
-
<a param="show-all"><ht key="#{model_class.to_s.
|
116
|
+
<unless test="&this.empty?">
|
117
|
+
<a param="show-all"><ht key="#{model_class.to_s.tableize}.actions.show_all">Show all <%= name.pluralize.titleize %>...</ht></a>
|
118
118
|
</unless>
|
119
119
|
</section>
|
120
120
|
</def>
|
@@ -171,77 +171,54 @@ See [Filtering stories by status](/tutorials/agility#filtering_stories_by_status
|
|
171
171
|
- `options` - an array of options or an array of arrays (useful for localized apps) for the menu.
|
172
172
|
It can be omitted if you provide the options as an array or array of arrays in the locale file.
|
173
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
174
|
|
178
175
|
### I18n
|
179
176
|
|
180
|
-
It lookups the options attributes in
|
181
|
-
with fallback to `filter_menu.#{param_name}.options`.
|
177
|
+
It lookups the options attributes in filter_menu.#{param_name}.options.
|
182
178
|
The passed options are used as a default in case the lookup fails.
|
183
|
-
Besides the
|
184
|
-
`tags.filter_menu.default.no_filter` key is used as default of the attribute "no-filter"
|
179
|
+
Besides the "tags.filter_menu.default.no_filter" key is used as default of the attribute "no-filter"
|
185
180
|
(or "All" if no default is found)
|
186
181
|
|
187
182
|
### I18n Example
|
188
183
|
|
189
|
-
|
190
|
-
|
191
|
-
|
192
|
-
|
193
|
-
|
194
|
-
|
195
|
-
|
196
|
-
|
197
|
-
|
198
|
-
|
199
|
-
|
200
|
-
|
201
|
-
|
202
|
-
|
203
|
-
|
204
|
-
|
205
|
-
|
206
|
-
|
207
|
-
|
208
|
-
|
209
|
-
|
210
|
-
|
211
|
-
|
212
|
-
|
213
|
-
|
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>
|
184
|
+
es:
|
185
|
+
tags:
|
186
|
+
filter_menu:
|
187
|
+
period:
|
188
|
+
no_filter: Todos Períodos
|
189
|
+
options:
|
190
|
+
- [ "Hoy", "today" ]
|
191
|
+
- [ "Ayer", "yesterday" ]
|
192
|
+
|
193
|
+
TIME_PERIODS = %w[today yesterday]
|
194
|
+
|
195
|
+
<t-filter-menu param-name="period" options="&TIME_PERIODS" no-filter="All Periods"/>
|
196
|
+
|
197
|
+
with I18n.locale == :es
|
198
|
+
<select name="period">
|
199
|
+
<option value="">Todos Períodos</option>
|
200
|
+
<option value="today">Hoy</option>
|
201
|
+
<option value="yesterday">Ayer</option>
|
202
|
+
</select>
|
203
|
+
|
204
|
+
with I18n.locale == :en (i.e no locale file)
|
205
|
+
<select name="period">
|
206
|
+
<option value="">All Periods</option>
|
207
|
+
<option value="today">today</option>
|
208
|
+
<option value="yesterday">yesterday</option>
|
209
|
+
</select>
|
232
210
|
|
233
211
|
-->
|
234
|
-
<def tag="filter-menu" attrs="
|
235
|
-
<%
|
236
|
-
|
237
|
-
|
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"]) %>
|
212
|
+
<def tag="filter-menu" attrs="param-name, options, no-filter, id">
|
213
|
+
<% opt = I18n.t("tags.filter_menu.#{param_name}.options", :default=>'')
|
214
|
+
options = opt unless opt.blank?
|
215
|
+
no_filter = I18n.t("tags.filter_menu.#{param_name}.no_filter", :default=>[:"tags.filter_menu.default.no_filter", no_filter, "All"]) %>
|
239
216
|
<form action="&request.fullpath" method="get" class="filter-menu" merge-attrs="id">
|
240
217
|
<div>
|
241
218
|
<% opt = options.first.kind_of?(Array) ? options.*.last : options
|
242
219
|
selected = opt.detect {|o| o.to_s==params[param_name.gsub('-', '_')] } %>
|
243
220
|
<select-menu name="¶m_name" options="&options" selected="&selected"
|
244
|
-
first-option="&no_filter"
|
221
|
+
first-option="&no_filter" key="¶m_name" merge-params/>
|
245
222
|
</div>
|
246
223
|
</form>
|
247
224
|
</def>
|