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.
Files changed (133) hide show
  1. data/{CHANGES.txt → CHANGES-1.3.txt} +0 -0
  2. data/CHANGES-1.4.txt +678 -0
  3. data/Rakefile +13 -3
  4. data/TODO-1.4.txt +69 -0
  5. data/VERSION +1 -1
  6. data/app/helpers/hobo_debug_helper.rb +16 -0
  7. data/app/helpers/hobo_deprecated_helper.rb +45 -0
  8. data/app/helpers/hobo_helper_base.rb +8 -0
  9. data/app/helpers/hobo_permissions_helper.rb +136 -0
  10. data/app/helpers/hobo_route_helper.rb +196 -0
  11. data/{lib/hobo/helper/translations.rb → app/helpers/hobo_translations_helper.rb} +4 -7
  12. data/{lib/hobo/helper/translations/normalizer.rb → app/helpers/hobo_translations_normalizer_helper.rb} +3 -10
  13. data/app/helpers/hobo_type_helper.rb +24 -0
  14. data/app/helpers/hobo_view_hint_helper.rb +13 -0
  15. data/hobo.gemspec +3 -3
  16. data/lib/generators/hobo/admin_subsite/admin_subsite_generator.rb +0 -9
  17. data/lib/generators/hobo/admin_subsite/templates/application.dryml +2 -0
  18. data/lib/generators/hobo/admin_subsite/templates/gitkeep +0 -0
  19. data/lib/generators/hobo/admin_subsite/templates/site.css.erb +9 -0
  20. data/lib/generators/hobo/admin_subsite/templates/site.js.erb +10 -0
  21. data/lib/generators/hobo/assets/assets_generator.rb +16 -2
  22. data/lib/generators/hobo/assets/templates/application.css +9 -0
  23. data/lib/generators/hobo/assets/templates/application.dryml.erb +0 -5
  24. data/lib/generators/hobo/assets/templates/application.js +11 -0
  25. data/lib/generators/hobo/assets/templates/front.css +10 -0
  26. data/lib/generators/hobo/assets/templates/front.js +11 -0
  27. data/lib/generators/hobo/assets/templates/front_site.dryml.erb +6 -0
  28. data/lib/generators/hobo/assets/templates/gitkeep +0 -0
  29. data/lib/generators/hobo/dev_tweaks/dev_tweaks_generator.rb +31 -0
  30. data/lib/generators/hobo/i18n/templates/hobo.en.yml +1 -1
  31. data/lib/generators/hobo/install_plugin/USAGE +3 -0
  32. data/lib/generators/hobo/install_plugin/install_plugin_generator.rb +36 -0
  33. data/lib/generators/hobo/plugin.rb +112 -0
  34. data/lib/generators/hobo/setup_wizard/setup_wizard_generator.rb +31 -14
  35. data/lib/generators/hobo/subsite.rb +16 -2
  36. data/lib/generators/hobo/subsite/templates/gitkeep +0 -0
  37. data/lib/generators/hobo/subsite/templates/site.css.erb +9 -0
  38. data/lib/generators/hobo/subsite/templates/site.js.erb +10 -0
  39. data/lib/generators/hobo/subsite_taglib/templates/taglib.dryml.erb +0 -17
  40. data/lib/generators/hobo/test_framework/test_framework_generator.rb +1 -1
  41. data/lib/hobo.rb +3 -2
  42. data/lib/hobo/controller.rb +43 -24
  43. data/lib/hobo/controller/model.rb +63 -42
  44. data/lib/hobo/controller/user_base.rb +1 -3
  45. data/lib/hobo/engine.rb +1 -1
  46. data/lib/hobo/extensions/active_record/associations/association.rb +36 -0
  47. data/lib/hobo/extensions/active_record/associations/collection.rb +10 -19
  48. data/lib/hobo/extensions/active_record/associations/proxy.rb +3 -15
  49. data/lib/hobo/extensions/active_record/associations/scope.rb +2 -2
  50. data/lib/hobo/extensions/active_record/permissions.rb +32 -38
  51. data/lib/hobo/extensions/active_record/relation_with_origin.rb +5 -5
  52. data/lib/hobo/model.rb +12 -7
  53. data/lib/hobo/model/accessible_associations.rb +8 -15
  54. data/lib/hobo/model/lifecycles/creator.rb +1 -1
  55. data/lib/hobo/model/lifecycles/transition.rb +1 -1
  56. data/lib/hobo/model/permissions.rb +4 -4
  57. data/lib/hobo/model/scopes.rb +4 -17
  58. data/lib/hobo/model/scopes/automatic_scopes.rb +5 -13
  59. data/lib/hobo/rapid/helper.rb +1 -161
  60. data/lib/hobo/rapid/taglibs/rapid.dryml +3 -17
  61. data/test/doctest/hobo/hobo_helper.rdoctest +8 -44
  62. data/{doctests → test/doctest}/hobo/lifecycles.rdoctest +0 -0
  63. data/{doctests → test/doctest}/hobo/model.rdoctest +2 -4
  64. data/{doctests → test/doctest}/hobo/multi_model_forms.rdoctest +3 -24
  65. data/{doctests → test/doctest}/hobo/scopes.rdoctest +3 -53
  66. data/test/doctest/prepare_testapp.rb +11 -0
  67. data/test/irt/generators/admin_subsite.irt +1 -19
  68. data/test/irt/generators/assets.irt +4 -9
  69. data/test/irt/generators/controller.irt +0 -3
  70. data/test/irt/generators/front_controller.irt +0 -5
  71. data/test/irt/generators/{helper.rb → irt_helper.rb} +2 -2
  72. data/test/irt/generators/model.irt +1 -12
  73. data/test/irt/generators/partials/_account_user_model_tests.rb +0 -8
  74. data/test/irt/generators/partials/_accounts_users_controller_tests.rb +0 -2
  75. data/test/irt/generators/partials/_default_user_model_tests.rb +0 -8
  76. data/test/irt/generators/partials/_default_users_controller_tests.rb +0 -2
  77. data/test/irt/generators/partials/_house_controller_tests.rb +0 -2
  78. data/test/irt/generators/partials/_house_model_tests.rb +1 -9
  79. data/test/irt/generators/partials/_subsite_taglib_admin.rb +5 -2
  80. data/test/irt/generators/partials/_subsite_taglib_admin_invite_only.rb +1 -1
  81. data/test/irt/generators/partials/_subsite_taglib_noopt.rb +2 -2
  82. data/test/irt/generators/partials/_subsite_taglib_variables.rb +0 -15
  83. data/test/irt/generators/partials/_user_mailer_tests.rb +1 -3
  84. data/test/irt/generators/resource.irt +0 -3
  85. data/test/irt/generators/subsite.irt +6 -22
  86. data/test/irt/generators/subsite_taglib.irt +0 -18
  87. data/test/irt/generators/test_framework.irt +2 -5
  88. data/test/irt/generators/user_controller.irt +0 -3
  89. data/test/irt/generators/user_mailer.irt +0 -3
  90. data/test/irt/generators/user_model.irt +0 -3
  91. data/test/irt/generators/user_resource.irt +0 -3
  92. data/test/irt/readme.txt +6 -3
  93. metadata +116 -159
  94. data/app/controllers/dev_controller.rb +0 -25
  95. data/app/views/dev/summary.dryml +0 -102
  96. data/doctests/prepare_testapp.rb +0 -8
  97. data/lib/generators/hobo/admin_subsite/templates/admin.css +0 -20
  98. data/lib/generators/hobo/rapid/USAGE +0 -3
  99. data/lib/generators/hobo/rapid/rapid_generator.rb +0 -24
  100. data/lib/generators/hobo/rapid/templates/IE7.js +0 -2
  101. data/lib/generators/hobo/rapid/templates/blank.gif +0 -0
  102. data/lib/generators/hobo/rapid/templates/hobo-rapid.css +0 -94
  103. data/lib/generators/hobo/rapid/templates/hobo-rapid.js +0 -1015
  104. data/lib/generators/hobo/rapid/templates/ie7-recalc.js +0 -166
  105. data/lib/generators/hobo/rapid/templates/lowpro.js +0 -339
  106. data/lib/generators/hobo/rapid/templates/reset.css +0 -95
  107. data/lib/generators/hobo/rapid/templates/themes/clean/public/images/101-3B5F87-ACD3E6.png +0 -0
  108. data/lib/generators/hobo/rapid/templates/themes/clean/public/images/30-3E547A-242E42.png +0 -0
  109. data/lib/generators/hobo/rapid/templates/themes/clean/public/images/30-DBE1E5-FCFEF5.png +0 -0
  110. data/lib/generators/hobo/rapid/templates/themes/clean/public/images/300-ACD3E6-fff.png +0 -0
  111. data/lib/generators/hobo/rapid/templates/themes/clean/public/images/50-ACD3E6-fff.png +0 -0
  112. data/lib/generators/hobo/rapid/templates/themes/clean/public/images/fieldbg.gif +0 -0
  113. data/lib/generators/hobo/rapid/templates/themes/clean/public/images/pencil.png +0 -0
  114. data/lib/generators/hobo/rapid/templates/themes/clean/public/images/small_close.png +0 -0
  115. data/lib/generators/hobo/rapid/templates/themes/clean/public/images/spinner.gif +0 -0
  116. data/lib/generators/hobo/rapid/templates/themes/clean/public/stylesheets/clean.css +0 -327
  117. data/lib/generators/hobo/rapid/templates/themes/clean/public/stylesheets/rapid-ui.css +0 -102
  118. data/lib/generators/hobo/rapid/templates/themes/clean/views/clean.dryml +0 -10
  119. data/lib/hobo/helper.rb +0 -460
  120. data/lib/hobo/rapid/taglibs/rapid_core.dryml +0 -808
  121. data/lib/hobo/rapid/taglibs/rapid_document_tags.dryml +0 -56
  122. data/lib/hobo/rapid/taglibs/rapid_editing.dryml +0 -287
  123. data/lib/hobo/rapid/taglibs/rapid_forms.dryml +0 -1156
  124. data/lib/hobo/rapid/taglibs/rapid_generics.dryml +0 -48
  125. data/lib/hobo/rapid/taglibs/rapid_i18n.dryml +0 -173
  126. data/lib/hobo/rapid/taglibs/rapid_lifecycles.dryml +0 -96
  127. data/lib/hobo/rapid/taglibs/rapid_navigation.dryml +0 -108
  128. data/lib/hobo/rapid/taglibs/rapid_pages.dryml +0 -259
  129. data/lib/hobo/rapid/taglibs/rapid_plus.dryml +0 -247
  130. data/lib/hobo/rapid/taglibs/rapid_summary.dryml +0 -283
  131. data/lib/hobo/rapid/taglibs/rapid_support.dryml +0 -102
  132. data/lib/hobo/rapid/taglibs/rapid_user_pages.dryml +0 -182
  133. data/test/irt/generators/rapid.irt +0 -29
@@ -1,48 +0,0 @@
1
- <!-- Rapid Generics provides tags that provide generic renderings that can adapt to the model being renderd. At the moment this library provides cards and collections of cards. -->
2
-
3
- <!-- A 'card' is a representation of an sub-object *within* a page, such as a comment on a blog-post, or a single product in a list of produtcs. This definition is just the very basic framework which gives the basis for the automatic cards that get generated. See `app/views/taglibs/auto/rapid/cards.dryml` for the cards that have been generated for your specific application. -->
4
- <def tag="card" polymorphic>
5
- <div class="card" param="default" merge-attrs>
6
- <header param/>
7
- <div param="body" if="&all_parameters[:body]"/>
8
- </div>
9
- </def>
10
-
11
-
12
- <!-- A special card which is used by live-search to render the results. By default this just calls card, but you can define your own search cards with `<def tag='search-card' for="MyModel">` to customise search results for that model. -->
13
- <def tag="search-card" polymorphic>
14
- <card merge/>
15
- </def>
16
-
17
-
18
- <!-- Renders a message such as "No products to display". If the collection (`this`) is empty, `style="display:none"` is added. This means the message is still present and can be revealed with JavaScript if all items in the collection are removed with ajax remove buttons.
19
- -->
20
- <def tag="empty-collection-message">
21
- <unless test="&this.member_class.nil?">
22
- <div class="empty-collection-message" style="#{'display:none' if !this.empty?}" param="default">
23
- <ht key="#{this.member_class.name.underscore}.collection.empty_message">
24
- No <collection-name/> to display
25
- </ht>
26
- </div>
27
- </unless>
28
- </def>
29
-
30
-
31
- <!-- Repeats the body of the tag inside a `<ul>` list with one item for each object in the collection (`this`). If no body is given, renders a `<card>` inside the `<li>`.
32
-
33
- The `<li>` tags are automatically given a 'model ID' CSS class, which means the ajax `<remove-button>` will automatically be able to remove items from the collection. Also adds 'even' and 'odd' CSS classes.
34
- -->
35
- <def tag="collection">
36
- <ul class="collection #{collection_name :dasherize => true}" merge-attrs unless="empty?">
37
- <li param="item" class="#{scope.even_odd} #{model_id_class}" repeat="&select_viewable">
38
- <do param="default"><card param/></do>
39
- </li>
40
- </ul>
41
- <empty-collection-message param="empty-message"/>
42
- </def>
43
-
44
- <!-- Renders a `separator` separated list of any fields passed in the `fields` attribute that are true (in the Ruby sense). For example, if a forum post had a boolean field `sticky`, this tag can be used to automatically label sticky posts "Sticky". Similarly, you could automatically add an "Administrator" label to the user's home page (this is seen in the default Hobo app). -->
45
- <def tag="record-flags" attrs="fields, separator"><%=
46
- separator ||= ', '
47
- comma_split(fields).select { |f| this.send(f) }.map { |f| this.class.human_attribute_name(f) }.join(separator)
48
- %></def>
@@ -1,173 +0,0 @@
1
- <!-- Rapid i18n provides tags related with the Rails-I18n project -->
2
-
3
- <!-- Wrapper around ActiveModel::Name#human
4
-
5
- #### Attributes
6
-
7
- - 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.
9
- -->
10
- <def tag="model-name-human" attrs="model, count"><%=
11
- model ||= this
12
- model = model.class unless model.kind_of? Class
13
- # prepare symbolized attributes for merging
14
- attrs = {}
15
- all_attributes.each_pair{|k,v| attrs[k.to_sym] = v}
16
- model.model_name.human( attrs )
17
- %>
18
- </def>
19
-
20
-
21
- <!-- Wrapper around ActiveRecord::Base.human_attribute_name.
22
-
23
- #### Attributes
24
-
25
- - attribute - the attribute to lookup
26
- - model - (optional) should be a model class or a record object (default to this)
27
- - count - (optional) should be an integer
28
-
29
- -->
30
- <def tag="human-attribute-name" attrs="attribute, model"><%=
31
- model ||= this
32
- model = model.class unless model.kind_of? Class
33
- # prepare symbolized attributes for merging
34
- attrs = {}
35
- all_attributes.each_pair{|k,v| attrs[k.to_sym] = v}
36
- model.human_attribute_name( attribute.to_sym, attrs )
37
- %>
38
- </def>
39
-
40
- <!-- 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.
42
-
43
- With the `your` attribute and in the special case the context is a Hobo::Model::UserMixin instance it automatically embeds the `your` tag funtionality. (note: :name is added by default as an interpolable variable)
44
-
45
- ### Attributes
46
-
47
- - collection - the attribute/collection key to lookup in the `activerecord.attributes` namespace. (e.g. 'roles')
48
- - count - used to pick the inflected string for the collection. It should be an integer.
49
- - your - wraps the collection name in a `Your` tag
50
-
51
- ### Example
52
-
53
-
54
- it:
55
- activerecord:
56
- attributes:
57
- post:
58
- comments:
59
- one: "Commento"
60
- other: "Commenti"
61
- user:
62
- roles:
63
- one: "Ruolo"
64
- other: "Ruoli"
65
- tags:
66
- your:
67
- roles:
68
- current_user:
69
- one: "Il tuo Ruolo"
70
- other: "I tuoi Ruoli"
71
- other_user:
72
- one: "Ruolo di {{name}}"
73
- other: Ruoli di {{name}}"
74
-
75
- context is a Post instance ('your' is ignored)
76
-
77
- <human-collection-name collection="comments" count="&user.comments.count" your/>
78
- I18n.locale = :en => "Comment" or "Comments"
79
- I18n.locale = :it => "Commento" or "Commenti"
80
-
81
- context is a User instance
82
-
83
- <human-collection-name collection="roles' count="&user.roles.count" your/>
84
- I18n.locale = :en => "Your Role" or "Jim's Role" or "Your Roles" or "Jim's Roles"
85
- I18n.locale = :it => "Il tuo Ruolo" or "Il Ruolo di Jim" or "I tuoi Ruoli" or "I Ruoli di Jim"
86
-
87
- (output is the same as `<Your key="roles" count=>"&user.roles.count"/>`)
88
-
89
- <human-collection-name collection="roles" count="&user.roles.count"/>
90
- I18n.locale = :en => "Role" or "Roles"
91
- I18n.locale = :it => "Ruolo" or "Ruoli"
92
- -->
93
- <def tag="human-collection-name" attrs="collection, count, your"><%
94
- raise Hobo::Error, "The 'collection' attribute must be defined" if collection.blank?
95
- belong_class = this.kind_of?(Class) ? this : this.class
96
- 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
97
- # prepare symbolized attributes for merging
98
- attrs = {}
99
- all_attributes.each_pair{|k,v| attrs[k.to_sym] = v} -%>
100
- <% if your && belong_class < Hobo::Model::UserBase && this.kind_of?(Hobo::Model::UserBase) && I18n.locale == :en -%>
101
- <your key="&collection" merge-attrs="&{:name=>name(:no_wrapper => true)}.merge(attrs)" capitalize>
102
- <%= belong_class.human_attribute_name(collection.to_sym, attrs) %>
103
- </your>
104
- <% else -%>
105
- <%= belong_class.human_attribute_name( collection.to_sym, attrs ) %>
106
- <% end %>
107
- </def>
108
-
109
- <!-- nodoc -->
110
- <def tag="fakedef">
111
- </def>
112
-
113
- <!-- Simple wrapper around I18n.t.
114
-
115
- The tag content is used as the :default option. It is overridden by an explicit 'default' attribute.
116
- There is a default :count => 1.
117
-
118
- ### Attributes
119
-
120
- - key: the key to lookup
121
- - all the attributes accepted by the wrapped method -->
122
- <fakedef tag="t" attrs="key">
123
- <!-- actually defined in i18n.rb -->
124
- </fakedef>
125
-
126
- <!--
127
- Wrapper around the Rails :translate helper with hobo added features.
128
-
129
- It can be used as a regular helper or as a dryml tag.
130
-
131
- ### Hobo Added Features
132
-
133
- `ht` adds some conventions for easier hobo translation.
134
-
135
- 1. Assumes the first part of the key to be a model name (e.g.: users.index.title -> user)
136
- 2. Tries to translate the model by lookup for: (e.g.: user-> activerecord.models.user)
137
- 3. Adds a default fallback to the beginning of the fallback chain by replacing the first part of the key with "hobo" and using the translated model name as additional attribute. This allows us to have default translations (e.g.: hobo.index.title: "{{model}} Index")
138
-
139
- You can also pass any other :translate option like for example :count.
140
-
141
- Is also used as a tag in the dryml-view files. The syntax is:
142
-
143
- <ht key="my.app">My Application</ht>
144
-
145
- Will lookup the "my.app"-key for your locale and replaces the "My Application" content if found.
146
-
147
- <ht key="my" app="Program">My Application</ht>
148
-
149
- Will look up both the "my"- and "app"-key for your locale, and replaces the "My Application" with the "my"-key contents (interpolated using the "app"-key.
150
-
151
- sample.no.yml-file:
152
-
153
- "no":
154
- my: "Mitt {{app}}"
155
-
156
- The output should be: Mitt Program
157
-
158
- Another example:
159
-
160
- <%= ht :key=>'user.index.title', :default=>'Index' %>
161
- <ht key="user.index.title">Index</ht>
162
- #=> "Index" # if "user.index.title" or "hobo.index.title" is not found
163
- #=> "User Index" # with the below en.yml file
164
-
165
- === en.yml ===
166
- en:
167
- hobo:
168
- index:
169
- title: %{model} Index
170
- -->
171
- <fakedef tag="ht">
172
- <!-- actually defined in translations.rb -->
173
- </fakedef>
@@ -1,96 +0,0 @@
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
-
3
- <!-- A push-button to invoke a lifecycle transition either as a page-reload or as an ajax call.
4
-
5
- ### Attributes
6
-
7
- - `transition` - the name of the transition to invoke. Required
8
- - `update` - one or more DOM IDs of ajax parts to update after the transition
9
- - `label` - the label on the button. Defaults to the name of the transition
10
-
11
- All of the [standard ajax attributes](/api_taglibs/rapid_forms) are also supported.
12
-
13
- ### Warning
14
-
15
- Transitions with parameters are implemented using a form. HTML does not allow forms to be nested, so a transitions with parameters should not be placed inside of a form.
16
-
17
- ### Invalid transitions
18
-
19
- If the transition could not be found, the user does not have permissions for the transition or the object is not in the correct state for the transition, the transition-button displays nothing. You can use an `<else>` to display an appropriate message.
20
-
21
- <transition-button transition="mogrify"/><else>Cannot mogrify</else>
22
-
23
- -->
24
- <def tag="transition-button" attrs="transition, update, label"><%=
25
- if transition.is_a?(String)
26
- transition = this.lifecycle.find_transition(transition, current_user)
27
- end
28
- if transition.nil?
29
- Dryml.last_if = false
30
- return ""
31
- end
32
- transition_name = transition.name
33
- has_params = !transition.options[:params].blank?
34
- ajax_attributes, html_attributes = attributes.partition_hash(Hobo::Rapid::Helper::AJAX_ATTRS)
35
-
36
- html_attributes[:method] ||= has_params ? :get : :put
37
- add_classes!(html_attributes, "transition-button #{transition_name}-button")
38
- label = t("activerecord.attributes.#{this.class.to_s.underscore}.lifecycle.transitions.#{transition_name}", :default => (label || transition_name.to_s.titleize))
39
- title = t("activerecord.attribute_help.#{this.class.to_s.underscore}.lifecycle.transitions.#{transition_name}")
40
- html_attributes.update(:title => title) unless title.empty?
41
- url = object_url(this, transition_name, :method => html_attributes[:method])
42
-
43
- if (update || !ajax_attributes.empty?) && !has_params
44
- ajax_attributes[:message] ||= label
45
- ajax_attributes[:method] = html_attributes[:method]
46
- func = ajax_updater(url, update, ajax_attributes)
47
- html_attributes.update(:onclick => "var e = this; " + func, :type =>'button', :value => label)
48
- element(:input, html_attributes, nil, true, true)
49
- else
50
- button_to(label, url, html_attributes)
51
- end
52
- %>
53
- </def>
54
-
55
-
56
- <!-- Displays a link to a lifecycle transition page if the transition is valid. If the transition is valid, this is equivalent to:
57
-
58
- <a action="&transition" ...
59
-
60
- If the transition is invalid, you may use the `<else>` tag to display an appropriate message:
61
-
62
- <transition-link transition="mogrify">Mogrify</transition-link>
63
- <else>Cannot mogrify</else>
64
-
65
- ### Attributes
66
-
67
- All attributes and parameters for the `<a>` tag are also valid.
68
-
69
- - `transition` - the name of the transition to invoke. Required
70
- -->
71
- <def tag="transition-link" attrs="transition"><%
72
- trans = this.lifecycle.find_transition(transition, current_user) %>
73
- <if test="&trans">
74
- <a action="&transition" merge/>
75
- </if>
76
- </def>
77
-
78
- <!-- Renders a div containing transition buttons for every transition available to the current user.
79
-
80
- For example, you could use this on a `Friendship` card: the person invited to have friendship would automatically see 'Accept' and 'Decline' buttons, while the person initiating the invite would see 'Retract'.
81
-
82
- This tag behaves similarly to repeat: an else tag may be used to handle the case of no buttons:
83
-
84
- <transition-buttons/><else>Sorry, no buttons to press.</else>
85
- -->
86
- <def tag="transition-buttons">
87
- <% ajax_attrs, html_attrs = attributes.partition_hash(Hobo::Rapid::Helper::AJAX_ATTRS) %>
88
- <div merge-attrs="&html_attrs" class="transitions">
89
- <% transitions = this.lifecycle.publishable_transitions_for(current_user) %>
90
- <if test="&transitions">
91
- <% transitions.each do |t| %>
92
- <transition-button merge-attrs="&ajax_attrs" transition="&t"/>
93
- <% end %>
94
- </if>
95
- </div>
96
- </def>
@@ -1,108 +0,0 @@
1
- <!-- Support for navigation links, account navigation (log in, out etc.) and pagination navigation. -->
2
-
3
- <!-- General purpose navigation bar. Renders a `<ul class="navigation">`. This tag is intended to be used in conunction with `<nav-item>`. The main feature of this pair of tags (over, say, just using a plain `<ul>` list), is that it's easy to have a 'current' CSS class added to the appropriate nav item (so you can highlight the page/section the user is)
4
-
5
- The main navigation in the default hobo app is implemented with `<navigation>` but this tag is also appropriate for any sub-navigation.
6
-
7
- ### Attributes
8
-
9
- - `current` - the textual content of the nav item that should have the 'current' CSS class added (see example)
10
-
11
- ### Example
12
-
13
- The normal usage is to define your own navigation tag that calls `<navigation>`.
14
-
15
- <def tag="sub-nav">
16
- <navigation merge>
17
- <nav-item>Red</nav-item>
18
- <nav-item>Green</nav-item>
19
- <nav-item>Blue</nav-item>
20
- </navigation>
21
- </def>
22
-
23
- Then in your pages you can call the tag like this
24
-
25
- - On the 'red' page: `<sub-nav current="red"/>`
26
- - On the 'green' page: `<sub-nav current="green"/>`
27
- - and so on.
28
-
29
- -->
30
- <def tag="navigation" attrs="current">
31
- <ul class="navigation" merge-attrs>
32
- <set-scoped current-navigation="&current">
33
- <do param="default"/>
34
- </set-scoped>
35
- </ul>
36
- </def>
37
-
38
-
39
- <!-- Renders a single item in a [`<navigation>`](/api_tag_defs/navigation).
40
-
41
- `<nav-item>` is basically an [`<a>`](/api_tag_defs/a) tag wrapped in an `<li>` tag. The attributes for [`<a>`](/api_tag_defs/a) may all be used on this tag, and work the same way.
42
-
43
- Example 1: explicit links. Note that we're using explicit routes for clarity. Named routes are better.
44
-
45
- <navigation current="home">
46
- <nav-item href="/">Home</nav-item>
47
- <nav-item href="/logout">Logout</nav-item>
48
- </navigation>
49
-
50
- Example 2: navigation based on a collection of items. Each item will be transformed into a link as described in [`<a>`](/api_tag_defs/a).
51
-
52
- <navigation with="&links">
53
- <repeat>
54
- <nav-item/>
55
- </repeat>
56
- </navigation>
57
-
58
- -->
59
- <def tag="nav-item" attrs="name">
60
- <% body = parameters.default
61
- body = h(this.to_s) if body.blank?
62
- name ||= body.gsub(/<.*?>/, '').strip
63
- -%>
64
- <li class="#{'current' if (c = scope.current_navigation) && c.downcase == name.downcase}"
65
- merge-attrs="&attributes - (attrs_for(:a)+['target'])">
66
- <a merge-attrs="&attributes & (attrs_for(:a)+['target'])"><%= body %></a>
67
- </li>
68
- </def>
69
-
70
-
71
- <!-- Account Navigation (log in / out / signup)
72
-
73
- When logged in, this renders:
74
-
75
- - "Logged in as ..."
76
- - Link to account page
77
- - Log out link
78
-
79
- When not logged in, renders:
80
-
81
- - Log in link
82
- - Sign up link
83
-
84
- This is a simple tag - just look at the source if you need to know more detail.
85
-
86
- -->
87
- <def tag="account-nav">
88
- <do with="&current_user">
89
- <ul class="navigation account-nav" param>
90
- <li if="&Rails.env.development?" param="dev-user-changer"><dev-user-changer/></li>
91
- <if test="&logged_in?">
92
- <li class='nav-item' param="logged-in-as"><a to="&current_user"><t key="hobo.actions.logged_in_as" name="&name">Logged in as <name/></t></a></li>
93
- <li class='nav-item' param="account"><a action="account"><t key="hobo.actions.account">Account</t></a></li>
94
- <li class='nav-item' param="log-out"><a href="&logout_url"><t key="hobo.actions.logout">Log out</t></a></li>
95
- </if>
96
- <else>
97
- <li class='nav-item' param="log-in"><a href="&login_url"><t key="hobo.actions.login">Log in</t></a></li>
98
- <li if="&signup_url" class="nav-item" param="sign-up"><a href="&signup_url"><t key="hobo.actions.signup">Sign up</t></a></li>
99
- </else>
100
- </ul>
101
- </do>
102
- </def>
103
-
104
-
105
- <!--- A simple wrapper around the `will_paginate` helper. All options to `will_paginate` are available as attributes -->
106
- <def tag="page-nav">
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
- </def>
@@ -1,259 +0,0 @@
1
- <!-- Rapid-Pages provides tags for working with entire pages. It includes the main `<page>` tag which is the starting point for all pages in Rapid, various supporting tags for things such as stylesheet and javascript includes. Also defines the standard error pages for permission-denied and not-found.
2
- -->
3
-
4
- <!-- The basic page structure for all the pages in a Hobo Rapid application. Providing the doctype, page title, standard stylesheet javascript includes, the ajax progress spinner, default header with app-name, account navigation, main navigation, and live search, empty section for the page content, flash message (if any) and an empty page footer.
5
-
6
- The easiest way to see what this tag does is to look at the source.
7
-
8
- ### Attributes
9
-
10
- - `title` - the page title, will have ": `<app-name>`" appended
11
- - `full-title` - the full page title. Set this if you do not want the app name suffix.
12
-
13
- -->
14
- <def tag="page" attrs="title, full-title">
15
- <% full_title ||= "#{title} : #{app_name}" %>
16
- <html merge-attrs>
17
- <head param>
18
- <title param><%= strip_tags full_title %></title>
19
- <do param="stylesheets">
20
- <!-- note that this is probably overridden in your app/views/taglibs/themes/xxx/xxx.dryml -->
21
- <stylesheet name="reset, hobo-rapid"/>
22
- <theme-stylesheet />
23
- <stylesheet name="application" param="app-stylesheet"/>
24
- </do>
25
-
26
- <do param="scripts">
27
- <javascript param name="prototype, effects, dragdrop, controls, rails, lowpro, hobo-rapid"/>
28
- <if-ie version="lt IE 7" param="fix-ie6">
29
- <javascript name="IE7"/>
30
- <javascript name="ie7-recalc"/>
31
- </if-ie>
32
- <do param="custom-scripts"/>
33
- <javascript param="application-javascript" name="application"/>
34
- </do>
35
- <%= csrf_meta_tag %>
36
- </head>
37
-
38
- <body param>
39
- <set-scoped flash-rendered="&false">
40
- <ajax-progress param/>
41
- <header class="page-header" param>
42
- <account-nav if="&login_url(Hobo::Model::UserBase.default_user_model)" param/>
43
- <h1 param="app-name"><a href="#{base_url}/"><app-name/></a></h1>
44
- <live-search param if="&defined_route? :site_search"/>
45
- <main-nav current="&title" param/>
46
- </header>
47
- <section with-flash-messages param="content"/>
48
- <footer class="page-footer" param/>
49
- <page-scripts param/>
50
- </set-scoped>
51
- </body>
52
- </html>
53
- </def>
54
-
55
-
56
- <!-- Renderes dynamically generated JavaScript required by `hobo-rapid.js`, including the information required to perform automatic part updates -->
57
- <def tag="page-scripts">
58
- <do param="default">
59
- <hobo-rapid-javascripts/>
60
- <part-contexts-javascripts/>
61
- </do>
62
- </def>
63
-
64
-
65
- <!-- nodoc. -->
66
- <def tag="index-page" polymorphic/>
67
- <!-- nodoc. -->
68
- <def tag="new-page" polymorphic/>
69
- <!-- nodoc. -->
70
- <def tag="show-page" polymorphic/>
71
- <!-- nodoc. -->
72
- <def tag="edit-page" polymorphic/>
73
-
74
- <!-- The page rendered by default in the case of a permission-denied error
75
-
76
- ### Attributes
77
-
78
- - `message` - The main message to display. Defaults to "That operation is not allowed"
79
-
80
- -->
81
- <def tag="permission-denied-page" attrs="message">
82
- <% message ||= "That operation is not allowed" %>
83
- <page merge>
84
- <body: class="permission-denied"/>
85
- <content: param>
86
- <header param="content-header">
87
- <h2 param="heading"><message/></h2>
88
- <div class="debug" if="&Rails.env.development?">
89
- <h3>Exception:</h3>
90
- <pre><%= h @permission_error.pretty_inspect %></pre>
91
- <h3>params:</h3>
92
- <pre><%= h params.pretty_inspect %></pre>
93
- </div>
94
- </header>
95
- </content:>
96
- </page>
97
- </def>
98
-
99
-
100
- <!-- The page rendered by default in the case of a not-found error
101
-
102
- ### Attributes
103
-
104
- - `message` - The main message to display. Defaults to "The page you requested cannot be found."
105
-
106
- -->
107
- <def tag="not-found-page" attrs="message">
108
- <% message ||= t("hobo.messages.not_found", :default=>["The page you requested cannot be found."]) %>
109
- <page merge>
110
- <body: class="not-found"/>
111
- <content: param>
112
- <header param="content-header">
113
- <h2 param="heading"><message/></h2>
114
- </header>
115
- </content:>
116
- </page>
117
- </def>
118
-
119
-
120
- <!-- Renders one of five HTML DOCTYPE declarations, according to the `version` attribute.
121
-
122
- ### Attributes
123
- - 'version' - the doctype version, must be one of:
124
-
125
- - HTML 4.01 STRICT
126
- - HTML 4.01 TRANSITIONAL
127
- - XHTML 1.0 STRICT
128
- - XHTML 1.0 TRANSITIONAL
129
- - XHTML 1.1
130
-
131
- See the source for the actual output
132
-
133
- -->
134
- <def tag="doctype" attrs="version"><%=raw(
135
- case version.upcase
136
- when "HTML 4.01 STRICT"
137
- '<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" ' +
138
- '"http://www.w3.org/TR/html4/strict.dtd">'
139
- when "HTML 4.01 TRANSITIONAL"
140
- '<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" ' +
141
- '"http://www.w3.org/TR/html4/loose.dtd">'
142
- when "XHTML 1.0 STRICT"
143
- '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" ' +
144
- '"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">'
145
- when "XHTML 1.0 TRANSITIONAL"
146
- '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" ' +
147
- '"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">'
148
- when "XHTML 1.1"
149
- '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" ' +
150
- '"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">'
151
- end)
152
- %></def>
153
-
154
-
155
- <!-- Renders an `<html>` tag along with the DOCTYPE specified in the `doctype` attribute.
156
-
157
- ### Attributes
158
-
159
- - `doctype` - the version of the DOCTYPE required. See the `version` attribute to `<doctype>`
160
- -->
161
- <def tag="html" attrs="doctype">
162
- <% doctype ||= 'XHTML 1.0 TRANSITIONAL' -%>
163
- <doctype version="&doctype"/>
164
- <% attributes.reverse_merge!(:xmlns => "http://www.w3.org/1999/xhtml") if doctype.upcase =~ /^XHTML/ -%>
165
- <%=raw "<html#{tag_options(attributes, true)}>" %>
166
- <set-scoped xmldoctype="&doctype.upcase =~ /^XHTML/"><do param="default"/></set-scoped>
167
- <%=raw "</html>" %>
168
- </def>
169
-
170
- <!-- empty tags should be written as <br> in HTML and <br /> in XHTML -->
171
- <!-- nodoc. -->
172
- <def tag="empty-tag" attrs="tag-name"><%= element(tag_name, attributes, nil, true, true) %></def>
173
- <!-- nodoc. -->
174
- <def tag="base"><empty-tag tag-name="base" merge/></def>
175
- <!-- nodoc. -->
176
- <def tag="meta"><empty-tag tag-name="meta" merge/></def>
177
- <!-- nodoc. -->
178
- <def tag="link"><empty-tag tag-name="link" merge/></def>
179
- <!-- nodoc. -->
180
- <def tag="img"><empty-tag tag-name="img" merge/></def>
181
- <!-- nodoc. -->
182
- <def tag="br"><empty-tag tag-name="br" merge/></def>
183
- <!-- nodoc. -->
184
- <def tag="hr"><empty-tag tag-name="hr" merge/></def>
185
- <!-- nodoc. -->
186
- <def tag="frame"><empty-tag tag-name="frame" merge/></def>
187
- <!-- nodoc. -->
188
- <def tag="area"><empty-tag tag-name="area" merge/></def>
189
- <!-- nodoc. -->
190
- <def tag="param"><empty-tag tag-name="param" merge/></def>
191
- <!-- nodoc. -->
192
- <def tag="col"><empty-tag tag-name="col" merge/></def>
193
-
194
-
195
- <!-- Renders a conditional comment in order to have some content ignored by all browsers other than Internet Explorer
196
-
197
- ### Example
198
-
199
-
200
- <if-ie version="lt IE 7"> ... </if-ie>
201
-
202
- -->
203
- <def tag="if-ie" attrs="version">
204
- <%=raw "<!--[if #{version || 'IE'}]>" %><do param="default"/><%=raw "<![endif]-->" %>
205
- </def>
206
-
207
- <!-- Simple wrapper for the `stylesheet_link_tag` helper. The `name` attribute can be a comma-separated list of stylesheet names.
208
- -->
209
- <def tag="stylesheet" attrs="name">
210
- <%= stylesheet_link_tag *(comma_split(name) + [attributes]) %>
211
- </def>
212
-
213
-
214
- <!-- Simple wrapper for the `javascript_include_tag` helper. The `name` attribute can be a comma-separated list of script file names.
215
- -->
216
- <def tag="javascript" attrs="name">
217
- <if test="&name.is_a?(Symbol)">
218
- <%= javascript_include_tag name %>
219
- </if>
220
- <else>
221
- <repeat with="&comma_split(name)">
222
- <%= javascript_include_tag this %>
223
- </repeat>
224
- </else>
225
- </def>
226
-
227
-
228
- <!-- Renders a Rails flash message wrapped in a `<div>` tag
229
-
230
- ### Attributes
231
-
232
- - `type` - which flash message to display. Defaults to `:notice`
233
-
234
- ### CSS Classes
235
-
236
- The flash is output in a `<div class="flash notice">`, where `notice` is the `type` specified.
237
-
238
- -->
239
- <def tag="flash-message" attrs="type">
240
- <% type = type ? type.to_sym : :notice -%>
241
- <div class="flash #{type}" if="&flash[type]" merge-attrs><%= flash[type] %></div>
242
- </def>
243
-
244
-
245
- <!-- Renders `<flash-message>` for every flash type given in the `names` attribute (comma separated), or for all flash messages that have been set if `names` is not given -->
246
- <def tag="flash-messages" attrs="names"><%=
247
- scope.flash_rendered = true if scope.respond_to? :flash_rendered
248
- names = names.nil? ? flash.keys : comma_split(names)
249
- names.map { |name| flash_message :type => name }.safe_join
250
- %></def>
251
-
252
- <!-- Renders `<div id="ajax-progress"><div><span id="ajax-progress-text"></span></div></div>`. The theme will style this as an ajax progress 'spinner' -->
253
- <def tag="ajax-progress">
254
- <div id="ajax-progress" merge-attrs>
255
- <div>
256
- <span id="ajax-progress-text"></span>
257
- </div>
258
- </div>
259
- </def>