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,102 +0,0 @@
1
- <!-- Rapid Support is the home for some tags that are useful in defining other tags. -->
2
-
3
-
4
- <!-- Call with the context set to a record. Repeats the content of the tag with `this` and `this_field` set to the value and name of each of the record's fields in turn. E.g. this is useful for generating a form containing each of the fields. Tags like `<field-list>` and `<table>` forward their attributes to this tag and also have the features described here. For example, the `fields` attribute to `<field-list>` supports the same options as described here.
5
-
6
- This tag is in need of a review - it's a bit funky.
7
-
8
- ### Attributes
9
-
10
- - `fields` - set to one of:
11
- - A model class - equivalent to listing all of the regular 'content columns' of that model
12
- - '`*`' - equivalent to listing all of the regular 'content columns' of the current record
13
- - A comma separated list of field names.
14
- Defaults to '`*`'
15
- - `associations` - set to `has_many` to select the associations `has_many` relationships used as the "fields". Do not also give the `fields` attribute.
16
- - `skip` - comma separated list of field names to omit.
17
- - `skip-associations` - set to `has-many` to omit all `has_many` associations.
18
- - `include-timestamps` - whether or not to include the standard ActiveRecord timestamp fields such as `created_at` and `updated_at`. Defaults to false.
19
- - `force-all` - by default fields are skipped if the current user does not have view permission. Set `force-all` to true to skip this permission check and include all the fields.
20
-
21
- -->
22
- <def tag="with-fields" attrs="fields, associations, skip, skip-associations, include-timestamps, force-all"><%
23
- fields.nil? || associations.nil? or raise ArgumentError, "with-fields -- specify either fields or associations but not both"
24
-
25
- field_names = if associations == "has_many"
26
- this.class.reflections.values.select { |refl| refl.macro == :has_many }.map { |refl| refl.name.to_s }
27
-
28
- elsif fields.nil? || fields == "*" || fields.is_a?(Class)
29
- klass = fields.is_a?(Class) ? fields : this.class
30
- columns = standard_fields(klass, include_timestamps)
31
-
32
- if skip_associations == "has_many"
33
- assocs = this.class.reflections.values.reject {|r| r.macro == :has_many }.map &its.name.to_s
34
- columns + assocs
35
- elsif skip_associations
36
- columns
37
- else
38
- assocs = klass.reflections.values.map &its.name.to_s
39
- columns + assocs
40
- end
41
- else
42
- comma_split(fields.gsub('-', '_'))
43
- end
44
- field_names -= comma_split(skip) if skip
45
- field_names = field_names.select {|f| can_view?(this, f)} unless force_all
46
- field_names.each do |field|
47
- %><set-scoped field-name="&field"><%
48
- if field == "this"
49
- %><do param="default"/><%
50
- else
51
- %><with field="&field"><do param="default"/></with><%
52
- end
53
- %></set-scoped><%
54
- end
55
- %></def>
56
-
57
- <!-- Call with the context set to a model class. Repeats the content of the tag with `this` set name of each of the model's fields in turn. E.g. this tag is used when generating the heading row in a `<table fields='...'/>`.
58
-
59
- This tag is in need of a review - it's a bit funky.
60
-
61
- ### Attributes
62
-
63
- - `fields` - set to one of:
64
- - A model class - equivalent to listing all of the regular 'content columns' of that model
65
- - '`*`' - equivalent to listing all of the regular 'content columns' of the current record
66
- - A comma separated list of field names.
67
- Defaults to '`*`'
68
- - `skip` - comma separated list of field names to omit.
69
- - `skip-associations` - set to `has-many` to omit all `has_many` associations.
70
- - `include-timestamps` - whether or not to include the standard ActiveRecord timestamp fields such as `created_at` and `updated_at`. Defaults to false.
71
-
72
- -->
73
- <def tag="with-field-names" attrs="fields, skip, skip-associations, include-timestamps"><%=
74
- field_names = if fields.nil? || fields == "*" || fields.is_a?(Class)
75
- klass = fields.is_a?(Class) ? fields : this.member_class
76
- columns = klass.content_columns.*.name
77
- columns -= %w{created_at updated_at created_on updated_on deleted_at} unless include_timestamps
78
-
79
- if skip_associations == "has_many"
80
- assocs = this.reflections.values.reject {|r| r.macro == :has_many }.map &its.name.to_s
81
- columns + assocs
82
- elsif skip_associations
83
- columns
84
- else
85
- assocs = klass.reflections.values.map &its.name.to_s
86
- columns + assocs
87
- end
88
- else
89
- comma_split(fields)
90
- end
91
-
92
- field_names -= comma_split(skip) if skip
93
- scope.new_scope :field_name => nil, :field_path => nil do
94
- field_names.map do |n|
95
- scope.field_name = n == "this" ? this.member_class.try.name : n.to_s.gsub("." , "_")
96
- scope.field_path = n
97
- parameters.default
98
- end.safe_join
99
- end
100
- %>
101
- </def>
102
-
@@ -1,182 +0,0 @@
1
- <!-- Rapid User Pages contains tags that implement the basics of Hobo's user management: log in, sign up, forgot password etc. -->
2
-
3
- <!-- Some of the user pages use a simplified layout that does not feature things like the main nav and live-search. This tag defines that page -->
4
- <def tag="simple-page">
5
- <page without-live-search without-main-nav merge>
6
- <account-nav: replace />
7
- </page>
8
- </def>
9
-
10
- <!-- Simple log-in form.
11
-
12
- ### Attributes
13
-
14
- - `user-model`: The User class
15
- - all other attributes are passed on to `<form>`. You will probably need to set the action attribute: `action="&user_login_path"`.
16
- -->
17
- <def tag="login-form" attrs="user-model">
18
- <% user_model ||= self.try.model -%>
19
- <form action="&request.fullpath" class="login" merge>
20
- <labelled-item-list param>
21
- <labelled-item>
22
-
23
- <item-label param="login-label"><t key="hobo.login.#{user_model.login_attribute}"><%= user_model.login_attribute.to_s.titleize %></t></item-label>
24
- <item-value><input type="text" name="login" id="login" class="string" param="login-input" /></item-value>
25
- </labelled-item>
26
-
27
- <labelled-item>
28
- <item-label param="password-label"><t key="hobo.login.password">Password</t></item-label>
29
- <item-value>
30
- <input type="password" name="password" id="password" class="string" param="password-input"/>
31
- </item-value>
32
- </labelled-item>
33
-
34
- <labelled-item param="remember-me">
35
- <item-label class="field-label" param="remember-me-label"><t key="hobo.login.remember_me">Remember me:</t></item-label>
36
- <item-value>
37
- <input type="checkbox" name="remember_me" id="remember-me" param="remember-me-input" checked/>
38
- </item-value>
39
- </labelled-item>
40
- </labelled-item-list>
41
- <div param="actions">
42
- <submit label="#{t 'hobo.actions.login', :default=>['Log in'] }" param/><if test="&signup_url" class='nav-item'>
43
- <t key="hobo.support.or">or</t> <a param="signup" href="&signup_url"><t key="hobo.login.signup">Sign up</t></a></if>
44
- </div>
45
- </form>
46
- </def>
47
-
48
- <!-- Simple log-in page -->
49
- <def tag="login-page">
50
- <% remember_me = true if remember_me.nil? %>
51
- <simple-page title="#{t 'hobo.login.title', :default=>['Log in'] }" merge>
52
-
53
- <body: class="login-page" param/>
54
-
55
- <content: param>
56
- <header param="content-header">
57
- <h2 param="heading"><t key="hobo.login.heading">Log In</t></h2>
58
- </header>
59
-
60
- <section param="content-body">
61
- <login-form param="form" user-model="&model"/>
62
- <a href="&forgot_password_url" param="forgot-password" if="&forgot_password_url"><t key="hobo.login.forgot_password">Forgot your password?</t></a>
63
- </section>
64
- </content:>
65
- </simple-page>
66
- </def>
67
-
68
-
69
- <!-- The page that initiates the forgotten password process. Contains a single text-input where the user can provide
70
- their email address -->
71
- <def tag="forgot-password-page">
72
- <simple-page title="#{t 'hobo.forgot_password.title', :default=>['Forgotten Password'] }" merge>
73
-
74
- <body: class="forgot-password-page" param/>
75
-
76
- <content: param>
77
- <header param="content-header">
78
- <h2 param="heading"><t key="hobo.forgot_password.heading">Forgotten Password</t></h2>
79
- <p><t key="hobo.forgot_password.text">Enter the email address you signed up with. If we have it in
80
- our records we'll send you an email allowing you to choose a new
81
- password.</t></p>
82
- </header>
83
-
84
- <section param="content-body">
85
- <form action="" class="forgot-password" param>
86
- <labelled-item-list param>
87
- <labelled-item>
88
- <item-label param="email-address-label"><t key="hobo.forgot_password.email_address">Email Address</t></item-label>
89
- <item-value>
90
- <input type="text" name="email_address" id="email-address" class="email-address" param="email-address-input" />
91
- </item-value>
92
- </labelled-item>
93
- </labelled-item-list>
94
- <div param="actions">
95
- <submit label="#{t 'hobo.actions.send', :default=>['Send'] }" param/>
96
- </div>
97
- </form>
98
- </section>
99
- </content:>
100
-
101
- </simple-page>
102
- </def>
103
-
104
- <!-- Second page in the forgotten password process. Informs the user that the email has been sent "If the e-mail address you
105
- entered is in our records". This is to avoid a privacy concern that the forgotten-password mechanism can be otherwise used to tell
106
- if a given email is associated with an account or not. -->
107
- <def tag="forgot-password-email-sent-page">
108
- <simple-page title="#{t 'hobo.forgot_password_sent.title', :default=>['Forgotten Password - Sent'] }" merge>
109
- <body: class="forgot-password-page" param/>
110
-
111
- <content: param>
112
- <header param="content-header">
113
- <h2 param><t key="hobo.forgot_password_sent.heading">Forgotten Password - Sent</t></h2>
114
- </header>
115
-
116
- <section param="content-body">
117
- <p param="message">
118
- <t key="hobo.forgot_password_sent.text" email-address="#{params[:email_address]}">
119
- If the e-mail address you entered, <%= h params[:email_address] %>,
120
- is in our records, you will
121
- receive an e-mail from us with instructions for resetting your
122
- password. If you don't receive this e-mail, please check your
123
- junk mail folder.</t></p>
124
- <p><a href="#{base_url}/"><t key="hobo.actions.back">Back to</t> <app-name/></a></p>
125
- </section>
126
- </content:>
127
-
128
- </simple-page>
129
- </def>
130
-
131
-
132
- <!-- The page that is displayed on attempting to log in to an account that has been disabled. -->
133
- <def tag="account-disabled-page">
134
-
135
- <simple-page title="#{t 'hobo.account_disabled_page.title', :default=>['Account Disabled'] }" merge>
136
-
137
- <body: class="account-disabled-page" param/>
138
-
139
- <content: param>
140
- <header param="content-header">
141
- <h2 param><t key="hobo.account_disabled_page.heading">Account is disabled</t></h2>
142
- </header>
143
-
144
- <section param="content-body">
145
- <p><t key="hobo.account_disabled_page.text">Your account is disabled at this time.</t></p>
146
- </section>
147
- </content:>
148
- </simple-page>
149
-
150
- </def>
151
-
152
-
153
- <!-- Basic account page that provides the ability for the user to change their email address and password. -->
154
- <def tag="account-page">
155
-
156
- <page title="#{t 'hobo.account_page.title', :default=>['Your Account'] }" merge>
157
-
158
- <body: class="user-account-page #{type_name}" param/>
159
-
160
- <content: param>
161
- <header param="content-header">
162
- <h2 param="heading"><name/></h2>
163
- </header>
164
-
165
- <section param="content-body">
166
- <error-messages param/>
167
- <form class="change-password" param>
168
- <field-list fields="email_address, current_password, password, password_confirmation" param>
169
- <password-label:><t key="hobo.account_page.new_password">New Password</t></password-label:>
170
- <password-confirmation-label:><t key="hobo.account_page.confirm_new_password">Confirm New Password</t></password-confirmation-label:>
171
- </field-list>
172
-
173
- <div class="actions" param="actions">
174
- <submit label="#{t 'hobo.actions.save_account', :default=>'Save'}" param/>
175
- </div>
176
- </form>
177
- </section>
178
- </content:>
179
-
180
- </page>
181
-
182
- </def>
@@ -1,29 +0,0 @@
1
- require File.expand_path('../helper.rb', __FILE__)
2
-
3
-
4
- desc "hobo:rapid invoke"
5
- invoke 'hobo:rapid', %w(-q)
6
-
7
- files_exist? %w[ public/javascripts/hobo-rapid.js
8
- public/javascripts/lowpro.js
9
- public/javascripts/IE7.js
10
- public/javascripts/ie7-recalc.js
11
- public/javascripts/blank.gif
12
- public/stylesheets/reset.css
13
- public/stylesheets/hobo-rapid.css
14
- public/hobothemes/clean
15
- public/hobothemes/clean/images/101-3B5F87-ACD3E6.png
16
- public/hobothemes/clean/images/30-3E547A-242E42.png
17
- public/hobothemes/clean/images/30-DBE1E5-FCFEF5.png
18
- public/hobothemes/clean/images/300-ACD3E6-fff.png
19
- public/hobothemes/clean/images/50-ACD3E6-fff.png
20
- public/hobothemes/clean/images/fieldbg.gif
21
- public/hobothemes/clean/images/pencil.png
22
- public/hobothemes/clean/images/small_close.png
23
- public/hobothemes/clean/images/spinner.gif
24
- public/hobothemes/clean/stylesheets/clean.css
25
- public/hobothemes/clean/stylesheets/rapid-ui.css
26
- app/views/taglibs/themes/clean
27
- app/views/taglibs/themes/clean/clean.dryml
28
- ]
29
- test_value_eql? true