hobo 1.1.0 → 1.3.0.RC
Sign up to get free protection for your applications and to get access to all the features.
- data/CHANGES.txt +238 -287
- data/Rakefile +14 -31
- data/VERSION +1 -0
- data/{lib/hobo → app/controllers}/dev_controller.rb +6 -6
- data/app/controllers/dryml_support_controller.rb +13 -0
- data/{rails_generators/hobo_front_controller/templates → app/views/dev}/summary.dryml +7 -10
- data/bin/hobo +12 -144
- data/config/initializers/inflections.rb +3 -0
- data/config/routes.rb +6 -0
- data/{doctest → doctests}/hobo/lifecycles.rdoctest +40 -59
- data/{doctest → doctests/hobo}/model.rdoctest +33 -40
- data/{doctest → doctests/hobo}/multi_model_forms.rdoctest +15 -19
- data/{doctest → doctests/hobo}/scopes.rdoctest +27 -41
- data/doctests/prepare_testapp.rb +8 -0
- data/hobo.gemspec +26 -199
- data/lib/generators/hobo/activation_email.rb +11 -0
- data/lib/generators/hobo/admin_subsite/admin_subsite_generator.rb +35 -0
- data/lib/generators/hobo/admin_subsite/templates/admin.css +20 -0
- data/lib/generators/hobo/admin_subsite/templates/admin_tag_injection.erb +10 -0
- data/{rails_generators/hobo_admin_site → lib/generators/hobo/admin_subsite}/templates/application.dryml +0 -0
- data/{rails_generators/hobo_admin_site/templates/controller.rb → lib/generators/hobo/admin_subsite/templates/controller.rb.erb} +5 -5
- data/lib/generators/hobo/admin_subsite/templates/users_index.dryml +7 -0
- data/lib/generators/hobo/assets/assets_generator.rb +18 -0
- data/{rails_generators/hobo → lib/generators/hobo/assets}/templates/application.css +0 -0
- data/lib/generators/hobo/assets/templates/application.dryml.erb +9 -0
- data/{rails_generators/hobo → lib/generators/hobo/assets}/templates/dryml-support.js +2 -2
- data/lib/generators/hobo/assets/templates/dryml_taglibs_initializer.rb +1 -0
- data/lib/generators/hobo/assets/templates/en_injection.yml +19 -0
- data/{rails_generators/hobo → lib/generators/hobo/assets}/templates/guest.rb +1 -1
- data/lib/generators/hobo/controller.rb +35 -0
- data/lib/generators/hobo/controller/controller_generator.rb +6 -0
- data/lib/generators/hobo/controller/templates/controller.rb.erb +7 -0
- data/{rails_generators/hobo_front_controller → lib/generators/hobo/front_controller}/USAGE +0 -0
- data/lib/generators/hobo/front_controller/front_controller_generator.rb +55 -0
- data/{rails_generators/hobo_front_controller/templates/controller.rb → lib/generators/hobo/front_controller/templates/controller.rb.erb} +0 -0
- data/{rails_generators/hobo_front_controller → lib/generators/hobo/front_controller}/templates/index.dryml +6 -12
- data/lib/generators/hobo/i18n/i18n_generator.rb +35 -0
- data/lib/generators/hobo/i18n/templates/app.de.yml +30 -0
- data/lib/generators/hobo/i18n/templates/app.en.yml +25 -0
- data/lib/generators/hobo/i18n/templates/app.es.yml +31 -0
- data/lib/generators/hobo/i18n/templates/app.fr.yml +26 -0
- data/lib/generators/hobo/i18n/templates/app.it.yml +28 -0
- data/lib/generators/hobo/i18n/templates/app.pt-PT.yml +25 -0
- data/lib/generators/hobo/i18n/templates/app.ru.yml +24 -0
- data/lib/generators/hobo/i18n/templates/hobo.de.yml +204 -0
- data/lib/generators/hobo/i18n/templates/hobo.en.yml +195 -0
- data/lib/generators/hobo/i18n/templates/hobo.es.yml +202 -0
- data/lib/generators/hobo/i18n/templates/hobo.fr.yml +195 -0
- data/lib/generators/hobo/i18n/templates/hobo.it.yml +202 -0
- data/lib/generators/hobo/i18n/templates/hobo.pt-PT.yml +196 -0
- data/lib/generators/hobo/i18n/templates/hobo.ru.yml +200 -0
- data/lib/generators/hobo/invite_only.rb +18 -0
- data/lib/generators/hobo/model/USAGE +19 -0
- data/lib/generators/hobo/model/model_generator.rb +11 -0
- data/{rails_generators/hobo_model/templates/model.rb → lib/generators/hobo/model/templates/model_injection.rb.erb} +0 -2
- data/{rails_generators/hobo_rapid → lib/generators/hobo/rapid}/USAGE +0 -0
- data/lib/generators/hobo/rapid/rapid_generator.rb +24 -0
- data/{rails_generators/hobo_rapid → lib/generators/hobo/rapid}/templates/IE7.js +0 -0
- data/{rails_generators/hobo_rapid → lib/generators/hobo/rapid}/templates/blank.gif +0 -0
- data/{rails_generators/hobo_rapid → lib/generators/hobo/rapid}/templates/hobo-rapid.css +0 -0
- data/{rails_generators/hobo_rapid → lib/generators/hobo/rapid}/templates/hobo-rapid.js +65 -65
- data/{rails_generators/hobo_rapid → lib/generators/hobo/rapid}/templates/ie7-recalc.js +21 -21
- data/{rails_generators/hobo_rapid → lib/generators/hobo/rapid}/templates/lowpro.js +31 -31
- data/{rails_generators/hobo_rapid → lib/generators/hobo/rapid}/templates/reset.css +1 -1
- 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/{rails_generators/hobo_rapid/templates/themes/clean → 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 +81 -0
- data/lib/generators/hobo/rapid/templates/themes/clean-sidemenu/views/clean-sidemenu.dryml +30 -0
- data/{rails_generators/hobo_rapid → lib/generators/hobo/rapid}/templates/themes/clean/public/images/101-3B5F87-ACD3E6.png +0 -0
- data/{rails_generators/hobo_rapid → lib/generators/hobo/rapid}/templates/themes/clean/public/images/30-3E547A-242E42.png +0 -0
- data/{rails_generators/hobo_rapid → lib/generators/hobo/rapid}/templates/themes/clean/public/images/30-DBE1E5-FCFEF5.png +0 -0
- data/{rails_generators/hobo_rapid → lib/generators/hobo/rapid}/templates/themes/clean/public/images/300-ACD3E6-fff.png +0 -0
- data/{rails_generators/hobo_rapid → lib/generators/hobo/rapid}/templates/themes/clean/public/images/50-ACD3E6-fff.png +0 -0
- data/{rails_generators/hobo_rapid → lib/generators/hobo/rapid}/templates/themes/clean/public/images/fieldbg.gif +0 -0
- data/{rails_generators/hobo_rapid → lib/generators/hobo/rapid}/templates/themes/clean/public/images/pencil.png +0 -0
- data/{rails_generators/hobo_rapid → lib/generators/hobo/rapid}/templates/themes/clean/public/images/small_close.png +0 -0
- data/lib/generators/hobo/rapid/templates/themes/clean/public/images/spinner.gif +0 -0
- data/{rails_generators/hobo_rapid → lib/generators/hobo/rapid}/templates/themes/clean/public/stylesheets/clean.css +16 -16
- data/{rails_generators/hobo_rapid → lib/generators/hobo/rapid}/templates/themes/clean/public/stylesheets/rapid-ui.css +3 -3
- data/{rails_generators/hobo_rapid → lib/generators/hobo/rapid}/templates/themes/clean/views/clean.dryml +1 -1
- data/lib/generators/hobo/resource/resource_generator.rb +23 -0
- data/lib/generators/hobo/routes/USAGE +9 -0
- data/lib/generators/hobo/routes/router.rb +115 -0
- data/lib/generators/hobo/routes/routes_generator.rb +40 -0
- data/lib/generators/hobo/routes/templates/hobo_routes.rb.erb +33 -0
- data/lib/generators/hobo/setup_wizard/USAGE +4 -0
- data/lib/generators/hobo/setup_wizard/setup_wizard_generator.rb +274 -0
- data/lib/generators/hobo/subsite.rb +48 -0
- data/lib/generators/hobo/subsite/subsite_generator.rb +16 -0
- data/{rails_generators/hobo_subsite → lib/generators/hobo/subsite}/templates/application.dryml +0 -0
- data/{rails_generators/hobo_subsite/templates/controller.rb → lib/generators/hobo/subsite/templates/controller.rb.erb} +1 -1
- data/lib/generators/hobo/subsite_taglib/subsite_taglib_generator.rb +16 -0
- data/{rails_generators/hobo_admin_site/templates/site_taglib.dryml → lib/generators/hobo/subsite_taglib/templates/taglib.dryml.erb} +9 -10
- data/lib/generators/hobo/taglib.rb +12 -0
- data/lib/generators/hobo/test_framework/test_framework_generator.rb +72 -0
- data/lib/generators/hobo/test_options.rb +19 -0
- data/{rails_generators/hobo_user_controller → lib/generators/hobo/user_controller}/templates/accept_invitation.dryml +0 -0
- data/lib/generators/hobo/user_controller/templates/controller.rb.erb +31 -0
- data/lib/generators/hobo/user_controller/user_controller_generator.rb +25 -0
- data/lib/generators/hobo/user_mailer/templates/activation.erb +9 -0
- data/{rails_generators/hobo_user_model → lib/generators/hobo/user_mailer}/templates/forgot_password.erb +2 -2
- data/{rails_generators/hobo_user_model → lib/generators/hobo/user_mailer}/templates/invite.erb +2 -2
- data/lib/generators/hobo/user_mailer/templates/mailer.rb.erb +25 -0
- data/lib/generators/hobo/user_mailer/user_mailer_generator.rb +33 -0
- data/lib/generators/hobo/user_model/USAGE +12 -0
- data/{rails_generators/hobo_user_model/templates/model.rb → lib/generators/hobo/user_model/templates/model_injection.rb.erb} +40 -20
- data/lib/generators/hobo/user_model/user_model_generator.rb +23 -0
- data/lib/generators/hobo/user_resource/user_resource_generator.rb +27 -0
- data/lib/hobo.rb +29 -129
- data/lib/hobo/controller.rb +37 -47
- data/lib/hobo/controller/authentication_support.rb +109 -0
- data/lib/hobo/{model_controller.rb → controller/model.rb} +71 -79
- data/lib/hobo/{user_controller.rb → controller/user.rb} +59 -49
- data/lib/hobo/engine.rb +80 -0
- data/lib/hobo/extensions/action_controller/hobo_methods.rb +44 -0
- data/lib/hobo/extensions/action_mailer/helper.rb +38 -0
- data/lib/{action_view_extensions/helpers → hobo/extensions/action_view}/tag_helper.rb +5 -2
- data/lib/hobo/extensions/action_view/translation_helper.rb +25 -0
- data/lib/hobo/extensions/active_model/name.rb +16 -0
- data/lib/hobo/extensions/active_model/translation.rb +35 -0
- data/lib/{active_record/association_collection.rb → hobo/extensions/active_record/associations/collection.rb} +8 -17
- data/lib/{active_record/association_proxy.rb → hobo/extensions/active_record/associations/proxy.rb} +6 -7
- data/lib/hobo/extensions/active_record/associations/reflection.rb +23 -0
- data/lib/hobo/extensions/active_record/associations/scope.rb +35 -0
- data/lib/hobo/extensions/active_record/hobo_methods.rb +11 -0
- data/lib/hobo/extensions/active_record/permissions.rb +159 -0
- data/lib/hobo/extensions/active_record/relation_with_origin.rb +28 -0
- data/lib/hobo/extensions/array.rb +27 -0
- data/lib/hobo/extensions/enumerable.rb +12 -0
- data/lib/hobo/extensions/i18n.rb +17 -0
- data/lib/hobo/{hobo_helper.rb → helper.rb} +58 -31
- data/lib/hobo/helper/translations.rb +54 -0
- data/lib/hobo/helper/translations/normalizer.rb +39 -0
- data/lib/hobo/model.rb +61 -95
- data/lib/hobo/model/accessible_associations.rb +178 -0
- data/lib/hobo/{find_for.rb → model/find_for.rb} +17 -17
- data/lib/hobo/model/guest.rb +25 -0
- data/lib/hobo/model/include_in_save.rb +55 -0
- data/lib/hobo/model/lifecycles.rb +119 -0
- data/lib/hobo/model/lifecycles/actions.rb +146 -0
- data/lib/hobo/model/lifecycles/creator.rb +74 -0
- data/lib/hobo/model/lifecycles/lifecycle.rb +243 -0
- data/lib/hobo/model/lifecycles/state.rb +22 -0
- data/lib/hobo/model/lifecycles/transition.rb +70 -0
- data/lib/hobo/model/permissions.rb +448 -0
- data/lib/hobo/model/scopes.rb +38 -0
- data/lib/hobo/model/scopes/apply_scopes.rb +21 -0
- data/lib/hobo/model/scopes/automatic_scopes.rb +428 -0
- data/lib/hobo/model/user_base.rb +184 -0
- data/lib/hobo/model/view_hints.rb +123 -0
- data/{rapid_generators → lib/hobo/rapid/generators}/rapid/cards.dryml.erb +2 -2
- data/{rapid_generators → lib/hobo/rapid/generators}/rapid/forms.dryml.erb +3 -3
- data/{rapid_generators → lib/hobo/rapid/generators}/rapid/pages.dryml.erb +38 -51
- data/lib/hobo/rapid/helper.rb +166 -0
- data/{taglibs → lib/hobo/rapid/taglibs}/rapid.dryml +6 -5
- data/{taglibs → lib/hobo/rapid/taglibs}/rapid_core.dryml +286 -118
- data/{taglibs → lib/hobo/rapid/taglibs}/rapid_document_tags.dryml +2 -2
- data/{taglibs → lib/hobo/rapid/taglibs}/rapid_editing.dryml +45 -45
- data/{taglibs → lib/hobo/rapid/taglibs}/rapid_forms.dryml +190 -158
- data/{taglibs → lib/hobo/rapid/taglibs}/rapid_generics.dryml +12 -9
- data/lib/hobo/rapid/taglibs/rapid_i18n.dryml +107 -0
- data/{taglibs → lib/hobo/rapid/taglibs}/rapid_lifecycles.dryml +7 -7
- data/{taglibs → lib/hobo/rapid/taglibs}/rapid_navigation.dryml +15 -15
- data/{taglibs → lib/hobo/rapid/taglibs}/rapid_pages.dryml +37 -36
- data/{taglibs → lib/hobo/rapid/taglibs}/rapid_plus.dryml +107 -43
- data/{taglibs → lib/hobo/rapid/taglibs}/rapid_summary.dryml +28 -57
- data/{taglibs → lib/hobo/rapid/taglibs}/rapid_support.dryml +9 -9
- data/{taglibs → lib/hobo/rapid/taglibs}/rapid_user_pages.dryml +41 -40
- data/lib/hobo/routes.rb +31 -0
- data/{doctest → test/doctest}/hobo/hobo_helper.rdoctest +11 -11
- data/test/irt/generators/admin_subsite.irt +27 -0
- data/test/irt/generators/assets.irt +16 -0
- data/test/irt/generators/controller.irt +6 -0
- data/test/irt/generators/front_controller.irt +30 -0
- data/test/irt/generators/helper.rb +31 -0
- data/test/irt/generators/model.irt +28 -0
- data/test/irt/generators/partials/_account_user_model_tests.rb +21 -0
- data/test/irt/generators/partials/_accounts_users_controller_tests.rb +15 -0
- data/test/irt/generators/partials/_default_user_model_tests.rb +21 -0
- data/test/irt/generators/partials/_default_users_controller_tests.rb +16 -0
- data/test/irt/generators/partials/_house_controller_tests.rb +15 -0
- data/test/irt/generators/partials/_house_model_tests.rb +18 -0
- data/test/irt/generators/partials/_subsite_taglib_admin.rb +4 -0
- data/test/irt/generators/partials/_subsite_taglib_admin_invite_only.rb +3 -0
- data/test/irt/generators/partials/_subsite_taglib_noopt.rb +4 -0
- data/test/irt/generators/partials/_subsite_taglib_variables.rb +27 -0
- data/test/irt/generators/partials/_user_mailer_tests.rb +19 -0
- data/test/irt/generators/rapid.irt +29 -0
- data/test/irt/generators/resource.irt +8 -0
- data/test/irt/generators/subsite.irt +52 -0
- data/test/irt/generators/subsite_taglib.irt +23 -0
- data/test/irt/generators/test_framework.irt +62 -0
- data/test/irt/generators/user_controller.irt +10 -0
- data/test/irt/generators/user_mailer.irt +20 -0
- data/test/irt/generators/user_model.irt +10 -0
- data/test/irt/generators/user_resource.irt +14 -0
- data/test/irt/readme.txt +7 -0
- data/test/permissions/models/models.rb +27 -24
- data/test/permissions/test_permissions.rb +104 -104
- metadata +239 -217
- data/lib/active_record/association_reflection.rb +0 -20
- data/lib/active_record/viewhints_validations_interceptor.rb +0 -9
- data/lib/hobo/accessible_associations.rb +0 -183
- data/lib/hobo/authentication_support.rb +0 -131
- data/lib/hobo/generator.rb +0 -26
- data/lib/hobo/guest.rb +0 -25
- data/lib/hobo/include_in_save.rb +0 -55
- data/lib/hobo/lifecycles.rb +0 -137
- data/lib/hobo/lifecycles/actions.rb +0 -142
- data/lib/hobo/lifecycles/creator.rb +0 -72
- data/lib/hobo/lifecycles/lifecycle.rb +0 -249
- data/lib/hobo/lifecycles/state.rb +0 -22
- data/lib/hobo/lifecycles/transition.rb +0 -70
- data/lib/hobo/model_router.rb +0 -290
- data/lib/hobo/permissions.rb +0 -451
- data/lib/hobo/permissions/associations.rb +0 -175
- data/lib/hobo/rapid_helper.rb +0 -157
- data/lib/hobo/scopes.rb +0 -43
- data/lib/hobo/scopes/apply_scopes.rb +0 -23
- data/lib/hobo/scopes/association_proxy_extensions.rb +0 -62
- data/lib/hobo/scopes/automatic_scopes.rb +0 -421
- data/lib/hobo/scopes/named_scope_extensions.rb +0 -39
- data/lib/hobo/tasks/rails.rb +0 -4
- data/lib/hobo/translations.rb +0 -93
- data/lib/hobo/undefined_access_error.rb +0 -5
- data/lib/hobo/user.rb +0 -182
- data/lib/hobo/view_hints.rb +0 -115
- data/rails/init.rb +0 -10
- data/rails_generators/hobo/USAGE +0 -4
- data/rails_generators/hobo/hobo_generator.rb +0 -53
- data/rails_generators/hobo/templates/application.dryml +0 -1
- data/rails_generators/hobo/templates/initializer.rb +0 -2
- data/rails_generators/hobo_admin_site/USAGE +0 -16
- data/rails_generators/hobo_admin_site/hobo_admin_site_generator.rb +0 -45
- data/rails_generators/hobo_admin_site/templates/admin.css +0 -2
- data/rails_generators/hobo_admin_site/templates/users_index.dryml +0 -5
- data/rails_generators/hobo_front_controller/hobo_front_controller_generator.rb +0 -95
- data/rails_generators/hobo_front_controller/templates/functional_test.rb +0 -8
- data/rails_generators/hobo_front_controller/templates/helper.rb +0 -2
- data/rails_generators/hobo_model/USAGE +0 -25
- data/rails_generators/hobo_model/hobo_model_generator.rb +0 -43
- data/rails_generators/hobo_model/templates/fixtures.yml +0 -6
- data/rails_generators/hobo_model/templates/hints.rb +0 -7
- data/rails_generators/hobo_model/templates/unit_test.rb +0 -8
- data/rails_generators/hobo_model_controller/USAGE +0 -30
- data/rails_generators/hobo_model_controller/hobo_model_controller_generator.rb +0 -46
- data/rails_generators/hobo_model_controller/templates/controller.rb +0 -7
- data/rails_generators/hobo_model_controller/templates/functional_test.rb +0 -8
- data/rails_generators/hobo_model_controller/templates/helper.rb +0 -2
- data/rails_generators/hobo_model_resource/USAGE +0 -38
- data/rails_generators/hobo_model_resource/hobo_model_resource_generator.rb +0 -73
- data/rails_generators/hobo_model_resource/templates/controller.rb +0 -7
- data/rails_generators/hobo_model_resource/templates/functional_test.rb +0 -8
- data/rails_generators/hobo_model_resource/templates/helper.rb +0 -2
- data/rails_generators/hobo_rapid/hobo_rapid_generator.rb +0 -94
- data/rails_generators/hobo_subsite/USAGE +0 -16
- data/rails_generators/hobo_subsite/hobo_subsite_generator.rb +0 -73
- data/rails_generators/hobo_subsite/templates/site_taglib.dryml +0 -13
- data/rails_generators/hobo_user_controller/USAGE +0 -34
- data/rails_generators/hobo_user_controller/hobo_user_controller_generator.rb +0 -65
- data/rails_generators/hobo_user_controller/templates/controller.rb +0 -29
- data/rails_generators/hobo_user_controller/templates/functional_test.rb +0 -8
- data/rails_generators/hobo_user_controller/templates/helper.rb +0 -2
- data/rails_generators/hobo_user_model/USAGE +0 -16
- data/rails_generators/hobo_user_model/hobo_user_model_generator.rb +0 -46
- data/rails_generators/hobo_user_model/templates/fixtures.yml +0 -19
- data/rails_generators/hobo_user_model/templates/mailer.rb +0 -29
- data/rails_generators/hobo_user_model/templates/unit_test.rb +0 -8
- data/script/destroy +0 -14
- data/script/generate +0 -14
- data/taglibs/rapid_translations.dryml +0 -36
- data/tasks/environments.rake +0 -19
- data/tasks/hobo_tasks.rake +0 -58
- data/test/generators/test_generator_helper.rb +0 -29
- data/test/generators/test_helper.rb +0 -1
- data/test/generators/test_hobo_model_controller_generator.rb +0 -56
File without changes
|
@@ -0,0 +1,24 @@
|
|
1
|
+
module Hobo
|
2
|
+
class RapidGenerator < Rails::Generators::Base
|
3
|
+
source_root File.expand_path('../templates', __FILE__)
|
4
|
+
|
5
|
+
def self.banner
|
6
|
+
"rails generate hobo:rapid"
|
7
|
+
end
|
8
|
+
|
9
|
+
def copy_rapid_files
|
10
|
+
copy_file "hobo-rapid.js", "public/javascripts/hobo-rapid.js"
|
11
|
+
copy_file "lowpro.js", "public/javascripts/lowpro.js"
|
12
|
+
copy_file "IE7.js", "public/javascripts/IE7.js"
|
13
|
+
copy_file "ie7-recalc.js", "public/javascripts/ie7-recalc.js"
|
14
|
+
copy_file "blank.gif", "public/javascripts/blank.gif"
|
15
|
+
copy_file "reset.css", "public/stylesheets/reset.css"
|
16
|
+
copy_file "hobo-rapid.css", "public/stylesheets/hobo-rapid.css"
|
17
|
+
directory "themes/clean/public","public/hobothemes/clean"
|
18
|
+
directory "themes/clean/views", "app/views/taglibs/themes/clean"
|
19
|
+
directory "themes/clean-sidemenu/public","public/hobothemes/clean-sidemenu"
|
20
|
+
directory "themes/clean-sidemenu/views", "app/views/taglibs/themes/clean-sidemenu"
|
21
|
+
end
|
22
|
+
|
23
|
+
end
|
24
|
+
end
|
File without changes
|
File without changes
|
File without changes
|
@@ -16,7 +16,7 @@ var Hobo = {
|
|
16
16
|
searchRequest: null,
|
17
17
|
uidCounter: 0,
|
18
18
|
ipeOldValues: {},
|
19
|
-
spinnerMinTime: 500, // milliseconds
|
19
|
+
spinnerMinTime: 500, // milliseconds
|
20
20
|
|
21
21
|
uid: function() {
|
22
22
|
Hobo.uidCounter += 1
|
@@ -53,7 +53,7 @@ var Hobo = {
|
|
53
53
|
i += 1
|
54
54
|
}
|
55
55
|
})
|
56
|
-
params.push("page_path=" + hoboPagePath)
|
56
|
+
params.push("page_path=" + encodeURIComponent(hoboPagePath))
|
57
57
|
}
|
58
58
|
|
59
59
|
if (resultUpdates) {
|
@@ -88,7 +88,7 @@ var Hobo = {
|
|
88
88
|
if (typeof(formAuthToken) != "undefined") {
|
89
89
|
params.push(formAuthToken.name + "=" + formAuthToken.value)
|
90
90
|
}
|
91
|
-
|
91
|
+
|
92
92
|
updateParams = Hobo.ajaxUpdateParams(updates, options.resultUpdate)
|
93
93
|
if (updateParams != "") { params.push(updateParams) }
|
94
94
|
|
@@ -102,7 +102,7 @@ var Hobo = {
|
|
102
102
|
}
|
103
103
|
|
104
104
|
if (options.message != false) Hobo.showSpinner(options.message, options.spinnerNextTo)
|
105
|
-
|
105
|
+
|
106
106
|
var complete = function() {
|
107
107
|
if (options.message != false) Hobo.hideSpinner();
|
108
108
|
if (options.onComplete) options.onComplete.apply(this, arguments)
|
@@ -111,7 +111,7 @@ var Hobo = {
|
|
111
111
|
}
|
112
112
|
var success = function() {
|
113
113
|
if (options.onSuccess) options.onSuccess.apply(this, arguments)
|
114
|
-
if (form && options.resetForm) form.reset();
|
114
|
+
if (form && options.resetForm) form.reset();
|
115
115
|
}
|
116
116
|
if (options.method && options.method.toLowerCase() == "put") {
|
117
117
|
delete options.method
|
@@ -154,7 +154,7 @@ var Hobo = {
|
|
154
154
|
}
|
155
155
|
}
|
156
156
|
},
|
157
|
-
|
157
|
+
|
158
158
|
onFieldEditComplete: function(el, newValue) {
|
159
159
|
el = $(el)
|
160
160
|
var oldValue = Hobo.ipeOldValues[el.id]
|
@@ -206,7 +206,7 @@ var Hobo = {
|
|
206
206
|
el.innerHTML = editable_text
|
207
207
|
}
|
208
208
|
if (el.innerHTML.gsub(" ", " ") == blank_message) {
|
209
|
-
el.innerHTML = ""
|
209
|
+
el.innerHTML = ""
|
210
210
|
} else {
|
211
211
|
Hobo.ipeOldValues[el.id] = el.innerHTML
|
212
212
|
}
|
@@ -227,7 +227,7 @@ var Hobo = {
|
|
227
227
|
var clear = function() { Hobo.hide(search_results_panel); el.clear() }
|
228
228
|
|
229
229
|
// Close window on [Escape]
|
230
|
-
Event.observe(el, 'keypress', function(ev) {
|
230
|
+
Event.observe(el, 'keypress', function(ev) {
|
231
231
|
if (ev.keyCode == 27) clear()
|
232
232
|
});
|
233
233
|
|
@@ -261,7 +261,7 @@ var Hobo = {
|
|
261
261
|
return urlBase + "/" + Hobo.pluralise(spec.name) + "/" + spec.id + "?_method=PUT"
|
262
262
|
},
|
263
263
|
|
264
|
-
|
264
|
+
|
265
265
|
urlForId: function(id) {
|
266
266
|
var spec = Hobo.parseModelSpec(id)
|
267
267
|
var url = urlBase + "/" + Hobo.pluralise(spec.name)
|
@@ -269,7 +269,7 @@ var Hobo = {
|
|
269
269
|
return url
|
270
270
|
},
|
271
271
|
|
272
|
-
|
272
|
+
|
273
273
|
fieldSetParam: function(el, val) {
|
274
274
|
var spec = Hobo.modelSpecForElement(el)
|
275
275
|
var res = spec.name + '[' + spec.field + ']=' + encodeURIComponent(val)
|
@@ -282,8 +282,8 @@ var Hobo = {
|
|
282
282
|
|
283
283
|
fadeObjectElement: function(el) {
|
284
284
|
var fadeEl = Hobo.objectElementFor(el)
|
285
|
-
new Effect.Fade(fadeEl, { duration: 0.5, afterFinish: function (ef) {
|
286
|
-
ef.element.remove()
|
285
|
+
new Effect.Fade(fadeEl, { duration: 0.5, afterFinish: function (ef) {
|
286
|
+
ef.element.remove()
|
287
287
|
} });
|
288
288
|
Hobo.showEmptyMessageAfterLastRemove(fadeEl)
|
289
289
|
},
|
@@ -330,13 +330,13 @@ var Hobo = {
|
|
330
330
|
new Effect.Appear(empty, {delay:0.3})
|
331
331
|
}
|
332
332
|
},
|
333
|
-
|
333
|
+
|
334
334
|
|
335
335
|
getClassData: function(el, name) {
|
336
336
|
var match = el.className.match(new RegExp("(^| )" + name + "::(\\S+)($| )"))
|
337
337
|
return match && match[2]
|
338
338
|
},
|
339
|
-
|
339
|
+
|
340
340
|
|
341
341
|
getModelId: function(el) {
|
342
342
|
return Hobo.getClassData(el, 'model')
|
@@ -442,8 +442,8 @@ var Hobo = {
|
|
442
442
|
|
443
443
|
return window.location.href.sub(/(\?.*|$)/, "?" + params.toQueryString())
|
444
444
|
},
|
445
|
-
|
446
|
-
|
445
|
+
|
446
|
+
|
447
447
|
fixSectionGroup: function(e) {
|
448
448
|
rows = e.childElements().map(function(e, i) {
|
449
449
|
cells = e.childElements().map(function(e, i) {
|
@@ -456,7 +456,7 @@ var Hobo = {
|
|
456
456
|
|
457
457
|
var attrs = e.outerHTML.match(/<DIV([^>]+)/)[1]
|
458
458
|
|
459
|
-
var table= "<table cellpadding='0' cellspacing='0' border='0' style='border-collapse: collapse; border-spacing: 0'" + attrs + ">" +
|
459
|
+
var table= "<table cellpadding='0' cellspacing='0' border='0' style='border-collapse: collapse; border-spacing: 0'" + attrs + ">" +
|
460
460
|
rows + "</table>"
|
461
461
|
e.outerHTML = table
|
462
462
|
},
|
@@ -500,8 +500,8 @@ Ajax.InPlaceEditor.prototype.enterEditMode = function(evt) {
|
|
500
500
|
// Fix Safari in-place-editor bug
|
501
501
|
Ajax.InPlaceEditor.prototype.removeForm = function() {
|
502
502
|
if (!this._form) return;
|
503
|
-
|
504
|
-
if (this._form.parentNode) { try { Element.remove(this._form); } catch (e) {}}
|
503
|
+
|
504
|
+
if (this._form.parentNode) { try { Element.remove(this._form); } catch (e) {}}
|
505
505
|
this._form = null;
|
506
506
|
this._controls = { };
|
507
507
|
}
|
@@ -522,7 +522,7 @@ Element.Methods.$$ = function(e, css) {
|
|
522
522
|
|
523
523
|
|
524
524
|
HoboBehavior = Class.create({
|
525
|
-
|
525
|
+
|
526
526
|
initialize: function(mainSelector, features) {
|
527
527
|
this.mainSelector = mainSelector
|
528
528
|
this.features = features
|
@@ -531,10 +531,10 @@ HoboBehavior = Class.create({
|
|
531
531
|
document.observe("dom:loaded", features.initialize);
|
532
532
|
}
|
533
533
|
},
|
534
|
-
|
534
|
+
|
535
535
|
addEvents: function(parentSelector, events) {
|
536
536
|
var self = this
|
537
|
-
|
537
|
+
|
538
538
|
for (selector in events) {
|
539
539
|
fullSelector = parentSelector + ' ' + selector
|
540
540
|
var rhs = events[selector]
|
@@ -544,9 +544,9 @@ HoboBehavior = Class.create({
|
|
544
544
|
this.addEvents(fullSelector, rhs)
|
545
545
|
}
|
546
546
|
}
|
547
|
-
|
547
|
+
|
548
548
|
},
|
549
|
-
|
549
|
+
|
550
550
|
addBehavior: function(selector, handler) {
|
551
551
|
var self = this
|
552
552
|
behavior = {}
|
@@ -556,12 +556,12 @@ HoboBehavior = Class.create({
|
|
556
556
|
}
|
557
557
|
Event.addBehavior(behavior)
|
558
558
|
}
|
559
|
-
|
559
|
+
|
560
560
|
})
|
561
561
|
|
562
562
|
|
563
563
|
HoboInputMany = {
|
564
|
-
|
564
|
+
|
565
565
|
events: {
|
566
566
|
"> li > div.buttons": {
|
567
567
|
".add-item:click": 'addOne',
|
@@ -598,12 +598,12 @@ HoboInputMany = {
|
|
598
598
|
|
599
599
|
createSortable: function() {
|
600
600
|
Sortable.create(this.id, {
|
601
|
-
constraint: 'vertical',
|
602
|
-
handle: 'ordering-handle',
|
603
|
-
overlap: 'vertical',
|
601
|
+
constraint: 'vertical',
|
602
|
+
handle: 'ordering-handle',
|
603
|
+
overlap: 'vertical',
|
604
604
|
scroll: 'window',
|
605
605
|
onUpdate: function(list) {
|
606
|
-
HoboInputMany.fixIndices.call(list);
|
606
|
+
HoboInputMany.fixIndices.call(list);
|
607
607
|
}
|
608
608
|
});
|
609
609
|
},
|
@@ -618,7 +618,7 @@ HoboInputMany = {
|
|
618
618
|
var id_sub = id_prefix + '_' + new_index.toString();
|
619
619
|
var class_re = RegExp(RegExp.escape(name_prefix)+ "\[\-?[0-9]+\]");
|
620
620
|
var class_sub = name_sub;
|
621
|
-
|
621
|
+
|
622
622
|
return function() {
|
623
623
|
if(this.name) {
|
624
624
|
this.name = this.name.replace(name_re, name_sub);
|
@@ -645,9 +645,9 @@ HoboInputMany = {
|
|
645
645
|
return Number(this.id.match(/_([-0-9]+)$/)[1]);
|
646
646
|
},
|
647
647
|
|
648
|
-
/* For some reason, select() and down() and all those useful functions aren't working for us. Roll our own replacement.
|
648
|
+
/* For some reason, select() and down() and all those useful functions aren't working for us. Roll our own replacement.
|
649
649
|
|
650
|
-
this: element to recurse on.
|
650
|
+
this: element to recurse on.
|
651
651
|
klass: class to filter on
|
652
652
|
f: function to invoke
|
653
653
|
*/
|
@@ -737,7 +737,7 @@ HoboInputMany = {
|
|
737
737
|
li.childWithClass("buttons").childWithClass("remove-item").removeClassName("hidden");
|
738
738
|
li.childWithClass("buttons").childWithClass("add-item").addClassName("hidden");
|
739
739
|
}
|
740
|
-
|
740
|
+
|
741
741
|
return;
|
742
742
|
},
|
743
743
|
|
@@ -757,10 +757,10 @@ HoboInputMany = {
|
|
757
757
|
// rename everybody from me onwards
|
758
758
|
var i=this.getIndex.call(li)
|
759
759
|
var n=li.next();
|
760
|
-
for(; n; i+=1, n=n.next()) {
|
760
|
+
for(; n; i+=1, n=n.next()) {
|
761
761
|
var name_updater = this.getNameUpdater.call(ul, i);
|
762
762
|
HoboInputMany.recurse_elements_with_class.call(n, null, function(el) {name_updater.call(el);});
|
763
|
-
}
|
763
|
+
}
|
764
764
|
|
765
765
|
// adjust +/- buttons on the button element as appropriate
|
766
766
|
var last=ul.childElements()[ul.childElements().length-1];
|
@@ -783,7 +783,7 @@ HoboInputMany = {
|
|
783
783
|
|
784
784
|
new Effect.BlindUp(li, { duration: 0.3, afterFinish: function (ef) {
|
785
785
|
ul.fire("rapid:change")
|
786
|
-
li.remove()
|
786
|
+
li.remove()
|
787
787
|
} });
|
788
788
|
|
789
789
|
}
|
@@ -791,7 +791,7 @@ HoboInputMany = {
|
|
791
791
|
|
792
792
|
|
793
793
|
}
|
794
|
-
|
794
|
+
|
795
795
|
new HoboBehavior("ul.input-many", HoboInputMany);
|
796
796
|
|
797
797
|
|
@@ -803,7 +803,7 @@ SelectManyInput = Behavior.create({
|
|
803
803
|
},
|
804
804
|
|
805
805
|
addOne : function() {
|
806
|
-
var select = this.element.down('select')
|
806
|
+
var select = this.element.down('select')
|
807
807
|
var selected = select.options[select.selectedIndex]
|
808
808
|
if ($F(select) != "") {
|
809
809
|
var newItem = $(DOM.Builder.fromHTML(this.element.down('.item-proto').innerHTML.strip()))
|
@@ -827,13 +827,13 @@ SelectManyInput = Behavior.create({
|
|
827
827
|
|
828
828
|
removeOne : function(el) {
|
829
829
|
var element = this.element
|
830
|
-
new Effect.BlindUp(el,
|
830
|
+
new Effect.BlindUp(el,
|
831
831
|
{ duration: 0.3,
|
832
|
-
afterFinish: function (ef) {
|
833
|
-
ef.element.remove()
|
832
|
+
afterFinish: function (ef) {
|
833
|
+
ef.element.remove()
|
834
834
|
element.fire("rapid:remove", { element: el })
|
835
835
|
element.fire("rapid:change", { element: el })
|
836
|
-
} } )
|
836
|
+
} } )
|
837
837
|
var label = el.down('span').innerHTML
|
838
838
|
var optgroup = element.down("optgroup[label="+label+"]")
|
839
839
|
var option = new Element("option", {value:optgroup.readAttribute("alt")})
|
@@ -846,7 +846,7 @@ SelectManyInput = Behavior.create({
|
|
846
846
|
},
|
847
847
|
|
848
848
|
hiddenField: function(item) {
|
849
|
-
return item.down('input[type=hidden]')
|
849
|
+
return item.down('input[type=hidden]')
|
850
850
|
//return item.getElementsByClassName("hidden-field")[0]
|
851
851
|
}
|
852
852
|
|
@@ -855,7 +855,7 @@ SelectManyInput = Behavior.create({
|
|
855
855
|
|
856
856
|
NameManyInput = Object.extend(SelectManyInput, {
|
857
857
|
addOne : function() {
|
858
|
-
var select = this.element.down('select')
|
858
|
+
var select = this.element.down('select')
|
859
859
|
var selected = select.options[select.selectedIndex]
|
860
860
|
if (selected.value != "") {
|
861
861
|
var newItem = $(DOM.Builder.fromHTML(this.element.down('.item-proto').innerHTML.strip()))
|
@@ -869,10 +869,10 @@ NameManyInput = Object.extend(SelectManyInput, {
|
|
869
869
|
}
|
870
870
|
})
|
871
871
|
|
872
|
-
|
872
|
+
|
873
873
|
AutocompleteBehavior = Behavior.create({
|
874
874
|
initialize : function() {
|
875
|
-
this.minChars = parseInt(Hobo.getClassData(this.element, "min-chars"));
|
875
|
+
this.minChars = parseInt(Hobo.getClassData(this.element, "min-chars"));
|
876
876
|
var match = this.element.className.match(/complete-on::([\S]+)/)
|
877
877
|
var target = match[1].split('::')
|
878
878
|
var typedId = target[0]
|
@@ -881,9 +881,9 @@ AutocompleteBehavior = Behavior.create({
|
|
881
881
|
var spec = Hobo.parseModelSpec(typedId)
|
882
882
|
var url = urlBase + "/" + Hobo.pluralise(spec.name) + "/complete_" + completer
|
883
883
|
var parameters = spec.id ? "id=" + spec.id : ""
|
884
|
-
this.autocompleter = new Ajax.Autocompleter(this.element,
|
885
|
-
this.element.next('.completions-popup'),
|
886
|
-
url,
|
884
|
+
this.autocompleter = new Ajax.Autocompleter(this.element,
|
885
|
+
this.element.next('.completions-popup'),
|
886
|
+
url,
|
887
887
|
{paramName:'query', method:'get', parameters: parameters, minChars: this.minChars,
|
888
888
|
afterUpdateElement: this.afterUpdateElement});
|
889
889
|
},
|
@@ -893,7 +893,7 @@ AutocompleteBehavior = Behavior.create({
|
|
893
893
|
this.element.value = '';
|
894
894
|
this.element.removeClassName("nil-value");
|
895
895
|
}
|
896
|
-
if(this.minChars==0) {
|
896
|
+
if(this.minChars==0) {
|
897
897
|
this.autocompleter.activate();
|
898
898
|
}
|
899
899
|
},
|
@@ -901,14 +901,14 @@ AutocompleteBehavior = Behavior.create({
|
|
901
901
|
afterUpdateElement: function(input, li) {
|
902
902
|
input.fire("rapid:autocomplete-assigned");
|
903
903
|
}
|
904
|
-
|
904
|
+
|
905
905
|
})
|
906
906
|
|
907
907
|
|
908
908
|
|
909
909
|
Event.addBehavior.reassignAfterAjax = true;
|
910
910
|
Event.addBehavior({
|
911
|
-
|
911
|
+
|
912
912
|
'div.section-group' : function() {
|
913
913
|
if (Prototype.Browser.IE) Hobo.fixSectionGroup(this);
|
914
914
|
},
|
@@ -923,7 +923,7 @@ Event.addBehavior({
|
|
923
923
|
var paramName = this.getAttribute('name')
|
924
924
|
var params = {}
|
925
925
|
var remove = [ 'page' ]
|
926
|
-
if ($F(this) == '') {
|
926
|
+
if ($F(this) == '') {
|
927
927
|
remove.push(paramName)
|
928
928
|
} else {
|
929
929
|
params[paramName] = $F(this)
|
@@ -953,10 +953,10 @@ Event.addBehavior({
|
|
953
953
|
if (Hobo.makeInPlaceHtmlEditor) {
|
954
954
|
Hobo.makeInPlaceHtmlEditor(this)
|
955
955
|
} else {
|
956
|
-
var options = {
|
956
|
+
var options = {
|
957
957
|
rows: 2, handleLineBreaks: false, okButton: true, cancelLink: true, okText: "Save", submitOnBlur: false
|
958
958
|
}
|
959
|
-
var ipe = Hobo._makeInPlaceEditor(this, options)
|
959
|
+
var ipe = Hobo._makeInPlaceEditor(this, options)
|
960
960
|
ipe.getText = function() {
|
961
961
|
// Be careful! we're not calling unescapeHTML() here!
|
962
962
|
return this.element.innerHTML
|
@@ -970,7 +970,7 @@ Event.addBehavior({
|
|
970
970
|
Hobo.ajaxSetFieldForElement(el, $F(el))
|
971
971
|
}
|
972
972
|
},
|
973
|
-
|
973
|
+
|
974
974
|
"input.live-search[type=search]" : function(e) {
|
975
975
|
var element = this
|
976
976
|
new Form.Element.Observer(element, 1.0, function() { Hobo.doSearch(element) })
|
@@ -980,23 +980,23 @@ Event.addBehavior({
|
|
980
980
|
});
|
981
981
|
|
982
982
|
ElementSet = Class.create(Enumerable, {
|
983
|
-
|
983
|
+
|
984
984
|
initialize: function(array) {
|
985
985
|
this.items = array
|
986
986
|
},
|
987
|
-
|
987
|
+
|
988
988
|
_each: function(fn) {
|
989
989
|
return this.items.each(fn)
|
990
990
|
},
|
991
|
-
|
991
|
+
|
992
992
|
selectChildren: function(selector) {
|
993
993
|
return new ElementSet(this.items.invoke('selectChildren', selector).pluck('items').flatten())
|
994
994
|
},
|
995
|
-
|
995
|
+
|
996
996
|
child: function(selector) {
|
997
997
|
return this.selectChildren(selector).first()
|
998
998
|
},
|
999
|
-
|
999
|
+
|
1000
1000
|
select: function(selector) {
|
1001
1001
|
return new ElementSet(this.items.invoke('select', selector).flatten())
|
1002
1002
|
},
|
@@ -1008,11 +1008,11 @@ ElementSet = Class.create(Enumerable, {
|
|
1008
1008
|
}
|
1009
1009
|
return null
|
1010
1010
|
},
|
1011
|
-
|
1011
|
+
|
1012
1012
|
size: function() {
|
1013
1013
|
return this.items.length
|
1014
1014
|
},
|
1015
|
-
|
1015
|
+
|
1016
1016
|
first: function() {
|
1017
1017
|
return this.items.first()
|
1018
1018
|
},
|
@@ -1020,7 +1020,7 @@ ElementSet = Class.create(Enumerable, {
|
|
1020
1020
|
last: function() {
|
1021
1021
|
return this.items.last()
|
1022
1022
|
}
|
1023
|
-
|
1023
|
+
|
1024
1024
|
})
|
1025
1025
|
|
1026
1026
|
Element.addMethods({
|