raffle_v1 0.0.4 → 0.0.5
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +6 -14
- data/README.md +11 -2
- data/app/assets/images/raffle_v1/game.png +0 -0
- data/app/assets/images/raffle_v1/gift.png +0 -0
- data/app/assets/images/raffle_v1/lifesaver.png +0 -0
- data/app/assets/images/raffle_v1/person01.jpg +0 -0
- data/app/assets/javascripts/raffle_v1/application.js +2 -1
- data/app/assets/javascripts/raffle_v1/home.js.coffee +3 -0
- data/app/assets/javascripts/raffle_v1/locales.js.coffee +3 -0
- data/app/assets/javascripts/raffle_v1/page_layouts.js.coffee +3 -0
- data/app/assets/javascripts/raffle_v1/pages.js.coffee +3 -0
- data/app/assets/javascripts/raffle_v1/programs.js.coffee +3 -0
- data/app/assets/javascripts/raffle_v1/roles.js.coffee +3 -0
- data/app/assets/javascripts/raffle_v1/stylesheets.js.coffee +3 -0
- data/app/assets/javascripts/raffle_v1/terms_and_conditions.js.coffee +3 -0
- data/app/assets/javascripts/raffle_v1/terms_of_conditions.js.coffee +3 -0
- data/app/assets/javascripts/raffle_v1/translation_keys.js.coffee +3 -0
- data/app/assets/javascripts/raffle_v1/translation_objects.js.coffee +3 -0
- data/app/assets/javascripts/raffle_v1/user.js.coffee +3 -0
- data/app/assets/javascripts/raffle_v1/versions.js.coffee +3 -0
- data/app/assets/stylesheets/raffle_v1/TableTools.css +264 -0
- data/app/assets/stylesheets/raffle_v1/TableTools.css.scss +264 -0
- data/app/assets/stylesheets/raffle_v1/TableTools_JUI.css +182 -0
- data/app/assets/stylesheets/raffle_v1/TableTools_JUI.css.scss +183 -0
- data/app/assets/stylesheets/raffle_v1/_custom.css.scss +3310 -0
- data/app/assets/stylesheets/raffle_v1/_variable.scss +122 -0
- data/app/assets/stylesheets/raffle_v1/_variable_defaults.scss +83 -0
- data/app/assets/stylesheets/raffle_v1/application.css.scss +34 -0
- data/app/assets/stylesheets/raffle_v1/application.css.scss.erb +32 -0
- data/app/assets/stylesheets/raffle_v1/bootstrap-responsive.css +570 -0
- data/app/assets/stylesheets/raffle_v1/bootstrap-responsive.css.scss +570 -0
- data/app/assets/stylesheets/raffle_v1/bootstrap.css +4226 -0
- data/app/assets/stylesheets/raffle_v1/bootstrap.css.scss +4226 -0
- data/app/assets/stylesheets/raffle_v1/colorbox.css +88 -0
- data/app/assets/stylesheets/raffle_v1/colorbox.css.scss +88 -0
- data/app/assets/stylesheets/raffle_v1/grid.css.scss +258 -0
- data/app/assets/stylesheets/raffle_v1/hierarchy.css.scss +16 -0
- data/app/assets/stylesheets/raffle_v1/home.css.scss +18 -0
- data/app/assets/stylesheets/raffle_v1/jquery.dataTables.css +83 -0
- data/app/assets/stylesheets/raffle_v1/jquery.dataTables.css.scss +83 -0
- data/app/assets/stylesheets/raffle_v1/jquery.jcarousel.css +206 -0
- data/app/assets/stylesheets/raffle_v1/jquery.wysiwyg.css +57 -0
- data/app/assets/stylesheets/raffle_v1/jquery.wysiwyg.css.scss +57 -0
- data/app/assets/stylesheets/raffle_v1/jqueryui/jquery.ui.core.css +38 -0
- data/app/assets/stylesheets/raffle_v1/jqueryui/jquery.ui.core.css.scss +38 -0
- data/app/assets/stylesheets/raffle_v1/jqueryui/jquery.ui.dialog.css +21 -0
- data/app/assets/stylesheets/raffle_v1/jqueryui/jquery.ui.dialog.css.scss +21 -0
- data/app/assets/stylesheets/raffle_v1/jqueryui/ui-lightness/images/ui-bg_diagonals-thick_18_b81900_40x40.png +0 -0
- data/app/assets/stylesheets/raffle_v1/jqueryui/ui-lightness/images/ui-bg_diagonals-thick_20_666666_40x40.png +0 -0
- data/app/assets/stylesheets/raffle_v1/jqueryui/ui-lightness/images/ui-bg_flat_10_000000_40x100.png +0 -0
- data/app/assets/stylesheets/raffle_v1/jqueryui/ui-lightness/images/ui-bg_glass_100_f6f6f6_1x400.png +0 -0
- data/app/assets/stylesheets/raffle_v1/jqueryui/ui-lightness/images/ui-bg_glass_100_fdf5ce_1x400.png +0 -0
- data/app/assets/stylesheets/raffle_v1/jqueryui/ui-lightness/images/ui-bg_glass_65_ffffff_1x400.png +0 -0
- data/app/assets/stylesheets/raffle_v1/jqueryui/ui-lightness/images/ui-bg_gloss-wave_35_f6a828_500x100.png +0 -0
- data/app/assets/stylesheets/raffle_v1/jqueryui/ui-lightness/images/ui-bg_highlight-soft_100_eeeeee_1x100.png +0 -0
- data/app/assets/stylesheets/raffle_v1/jqueryui/ui-lightness/images/ui-bg_highlight-soft_75_ffe45c_1x100.png +0 -0
- data/app/assets/stylesheets/raffle_v1/jqueryui/ui-lightness/images/ui-icons_222222_256x240.png +0 -0
- data/app/assets/stylesheets/raffle_v1/jqueryui/ui-lightness/images/ui-icons_228ef1_256x240.png +0 -0
- data/app/assets/stylesheets/raffle_v1/jqueryui/ui-lightness/images/ui-icons_ef8c08_256x240.png +0 -0
- data/app/assets/stylesheets/raffle_v1/jqueryui/ui-lightness/images/ui-icons_ffd27a_256x240.png +0 -0
- data/app/assets/stylesheets/raffle_v1/jqueryui/ui-lightness/images/ui-icons_ffffff_256x240.png +0 -0
- data/app/assets/stylesheets/raffle_v1/jqueryui/ui-lightness/jquery-ui-1.8.18.custom.css +563 -0
- data/app/assets/stylesheets/raffle_v1/jqueryui/ui-lightness/jquery-ui-1.8.18.custom.css.scss +563 -0
- data/app/assets/stylesheets/raffle_v1/locales.css.scss +3 -0
- data/app/assets/stylesheets/raffle_v1/page_layouts.css.scss +3 -0
- data/app/assets/stylesheets/raffle_v1/pages.css.scss +3 -0
- data/app/assets/stylesheets/raffle_v1/programs.css.scss +3 -0
- data/app/assets/stylesheets/raffle_v1/reset.css.scss +96 -0
- data/app/assets/stylesheets/raffle_v1/roles.css.scss +3 -0
- data/app/assets/stylesheets/raffle_v1/scaffolds.css.scss +42 -0
- data/app/assets/stylesheets/raffle_v1/stylesheets.css.scss +3 -0
- data/app/assets/stylesheets/raffle_v1/terms_and_conditions.css.scss +3 -0
- data/app/assets/stylesheets/raffle_v1/terms_of_conditions.css.scss +4 -0
- data/app/assets/stylesheets/raffle_v1/translation_keys.css.scss +3 -0
- data/app/assets/stylesheets/raffle_v1/translation_objects.css.scss +3 -0
- data/app/assets/stylesheets/raffle_v1/ui.multiselect.css +33 -0
- data/app/assets/stylesheets/raffle_v1/ui.multiselect.css.scss +33 -0
- data/app/assets/stylesheets/raffle_v1/user.css.scss +3 -0
- data/app/assets/stylesheets/raffle_v1/versions.css.scss +3 -0
- data/app/controllers/raffle_v1/application_controller.rb +80 -0
- data/app/controllers/raffle_v1/home_controller.rb +15 -0
- data/app/controllers/raffle_v1/locales_controller.rb +87 -0
- data/app/controllers/raffle_v1/page_layouts_controller.rb +87 -0
- data/app/controllers/raffle_v1/pages_controller.rb +180 -0
- data/app/controllers/raffle_v1/programs_controller.rb +140 -0
- data/app/controllers/raffle_v1/roles_controller.rb +87 -0
- data/app/controllers/raffle_v1/stylesheets_controller.rb +19 -0
- data/app/controllers/raffle_v1/terms_and_conditions_controller.rb +118 -0
- data/app/controllers/raffle_v1/translation_keys_controller.rb +119 -0
- data/app/controllers/raffle_v1/translation_objects_controller.rb +87 -0
- data/app/controllers/raffle_v1/user_controller.rb +138 -0
- data/app/controllers/raffle_v1/versions_controller.rb +15 -0
- data/app/models/raffle_v1/ability.rb +30 -0
- data/app/models/raffle_v1/admin.rb +35 -0
- data/app/models/raffle_v1/admin_ability.rb +28 -0
- data/app/models/raffle_v1/locale.rb +29 -0
- data/app/models/raffle_v1/page.rb +26 -0
- data/app/models/raffle_v1/page_layout.rb +6 -0
- data/app/models/raffle_v1/program.rb +84 -0
- data/app/models/raffle_v1/program_locale.rb +11 -0
- data/app/models/raffle_v1/program_setting.rb +5 -0
- data/app/models/raffle_v1/role.rb +5 -0
- data/app/models/raffle_v1/roles_users.rb +5 -0
- data/app/models/raffle_v1/stylesheet.rb +9 -0
- data/app/models/raffle_v1/terms_and_condition.rb +17 -0
- data/app/models/raffle_v1/translation.rb +29 -0
- data/app/models/raffle_v1/translation_key.rb +35 -0
- data/app/models/raffle_v1/translation_object.rb +11 -0
- data/app/models/raffle_v1/user.rb +108 -0
- data/config/rafflev1.rb +6 -0
- data/db/migrate/20130123214645_devise_create_users.rb +49 -0
- data/db/migrate/20130124004626_devise_create_admins.rb +49 -0
- data/db/migrate/20130124231541_create_versions.rb +18 -0
- data/db/migrate/20130127235347_create_programs.rb +9 -0
- data/db/migrate/20130129155515_add_domain_fields_to_programs.rb +6 -0
- data/db/migrate/20130129160949_create_terms_and_conditions.rb +18 -0
- data/db/migrate/20130129183112_add_program_to_users.rb +5 -0
- data/db/migrate/20130129204204_add_username_to_users.rb +6 -0
- data/db/migrate/20130129211205_create_roles.rb +9 -0
- data/db/migrate/20130129212302_create_roles_users.rb +12 -0
- data/db/migrate/20130130013315_create_locales.rb +11 -0
- data/db/migrate/20130130154500_create_program_locales.rb +8 -0
- data/db/migrate/20130130223342_add_settings_to_users.rb +5 -0
- data/db/migrate/20130130223609_add_locale_available_to_program.rb +5 -0
- data/db/migrate/20130130223810_add_locales_to_versions.rb +5 -0
- data/db/migrate/20130130224141_add_locale_name_to_program.rb +5 -0
- data/db/migrate/20130130224327_add_admin_type_to_admins.rb +5 -0
- data/db/migrate/20130130225223_add_deleted_at_to_models.rb +9 -0
- data/db/migrate/20130130230516_create_translations.rb +13 -0
- data/db/migrate/20130131005653_add_timeout_field_to_program.rb +7 -0
- data/db/migrate/20130131144951_create_stylesheets.rb +14 -0
- data/db/migrate/20130202132442_add_tos_to_program.rb +5 -0
- data/db/migrate/20130202133149_add_programid_to_terms.rb +23 -0
- data/db/migrate/20130202193646_add_akm_to_terms_and_conditions.rb +5 -0
- data/db/migrate/20130203035054_create_translation_keys.rb +10 -0
- data/db/migrate/20130203214314_create_program_settings.rb +9 -0
- data/db/migrate/20130204025824_add_translationkey_to_translation.rb +5 -0
- data/db/migrate/20130204030555_create_translation_objects.rb +39 -0
- data/db/migrate/20130205203152_create_pages.rb +25 -0
- data/db/migrate/20130208042652_add_fields_to_page.rb +6 -0
- data/db/migrate/20130208043123_create_page_layouts.rb +12 -0
- data/db/migrate/20130208051925_add_statusitem_to_page.rb +5 -0
- data/db/migrate/20130306012135_add_fields_to_user.rb +40 -0
- data/db/migrate/20130306162357_change_bad_fields_on_user.rb +11 -0
- data/db/migrate/20130306163554_add_password_created_at_to_user.rb +6 -0
- data/db/migrate/20130306165455_add_confirmable_to_user.rb +14 -0
- data/db/migrate/20130306211253_add_username_index_to_user.rb +41 -0
- data/db/migrate/20130313011833_add_field_to_user.rb +5 -0
- data/lib/database_cleaner-0.7.2/Gemfile.lock +163 -0
- data/lib/database_cleaner-0.7.2/History.txt +209 -0
- data/lib/database_cleaner-0.7.2/LICENSE +20 -0
- data/lib/database_cleaner-0.7.2/README.textile +223 -0
- data/lib/database_cleaner-0.7.2/Rakefile +65 -0
- data/lib/database_cleaner-0.7.2/TODO +3 -0
- data/lib/database_cleaner-0.7.2/VERSION.yml +5 -0
- data/lib/database_cleaner-0.7.2/cucumber.yml +1 -0
- data/lib/database_cleaner-0.7.2/examples/Gemfile +49 -0
- data/lib/database_cleaner-0.7.2/examples/Gemfile.lock +163 -0
- data/lib/database_cleaner-0.7.2/examples/config/database.yml.example +8 -0
- data/{test/dummy/db/test.sqlite3 → lib/database_cleaner-0.7.2/examples/db/sqlite_databases_go_here} +0 -0
- data/lib/database_cleaner-0.7.2/examples/features/example.feature +11 -0
- data/lib/database_cleaner-0.7.2/examples/features/example_multiple_db.feature +23 -0
- data/lib/database_cleaner-0.7.2/examples/features/example_multiple_orm.feature +22 -0
- data/lib/database_cleaner-0.7.2/examples/features/step_definitions/activerecord_steps.rb +31 -0
- data/lib/database_cleaner-0.7.2/examples/features/step_definitions/couchpotato_steps.rb +31 -0
- data/lib/database_cleaner-0.7.2/examples/features/step_definitions/datamapper_steps.rb +37 -0
- data/lib/database_cleaner-0.7.2/examples/features/step_definitions/mongoid_steps.rb +23 -0
- data/lib/database_cleaner-0.7.2/examples/features/step_definitions/mongomapper_steps.rb +31 -0
- data/lib/database_cleaner-0.7.2/examples/features/step_definitions/translation_steps.rb +55 -0
- data/lib/database_cleaner-0.7.2/examples/features/support/env.rb +62 -0
- data/lib/database_cleaner-0.7.2/examples/lib/activerecord_models.rb +41 -0
- data/lib/database_cleaner-0.7.2/examples/lib/couchpotato_models.rb +61 -0
- data/lib/database_cleaner-0.7.2/examples/lib/datamapper_models.rb +50 -0
- data/lib/database_cleaner-0.7.2/examples/lib/mongoid_models.rb +49 -0
- data/lib/database_cleaner-0.7.2/examples/lib/mongomapper_models.rb +51 -0
- data/lib/database_cleaner-0.7.2/features/cleaning.feature +22 -0
- data/lib/database_cleaner-0.7.2/features/cleaning_default_strategy.feature +19 -0
- data/lib/database_cleaner-0.7.2/features/cleaning_multiple_dbs.feature +21 -0
- data/lib/database_cleaner-0.7.2/features/cleaning_multiple_orms.feature +29 -0
- data/lib/database_cleaner-0.7.2/features/step_definitions/database_cleaner_steps.rb +32 -0
- data/lib/database_cleaner-0.7.2/features/support/env.rb +7 -0
- data/lib/database_cleaner-0.7.2/features/support/feature_runner.rb +39 -0
- data/lib/database_cleaner-0.7.2/lib/database_cleaner.rb +3 -0
- data/lib/database_cleaner-0.7.2/lib/database_cleaner/active_record/base.rb +53 -0
- data/lib/database_cleaner-0.7.2/lib/database_cleaner/active_record/deletion.rb +69 -0
- data/lib/database_cleaner-0.7.2/lib/database_cleaner/active_record/transaction.rb +28 -0
- data/lib/database_cleaner-0.7.2/lib/database_cleaner/active_record/truncation.rb +151 -0
- data/lib/database_cleaner-0.7.2/lib/database_cleaner/base.rb +138 -0
- data/lib/database_cleaner-0.7.2/lib/database_cleaner/configuration.rb +94 -0
- data/lib/database_cleaner-0.7.2/lib/database_cleaner/couch_potato/base.rb +7 -0
- data/lib/database_cleaner-0.7.2/lib/database_cleaner/couch_potato/truncation.rb +28 -0
- data/lib/database_cleaner-0.7.2/lib/database_cleaner/cucumber.rb +11 -0
- data/lib/database_cleaner-0.7.2/lib/database_cleaner/data_mapper/base.rb +21 -0
- data/lib/database_cleaner-0.7.2/lib/database_cleaner/data_mapper/transaction.rb +26 -0
- data/lib/database_cleaner-0.7.2/lib/database_cleaner/data_mapper/truncation.rb +175 -0
- data/lib/database_cleaner-0.7.2/lib/database_cleaner/generic/base.rb +20 -0
- data/lib/database_cleaner-0.7.2/lib/database_cleaner/generic/truncation.rb +37 -0
- data/lib/database_cleaner-0.7.2/lib/database_cleaner/mongo/truncation.rb +22 -0
- data/lib/database_cleaner-0.7.2/lib/database_cleaner/mongo_mapper/base.rb +20 -0
- data/lib/database_cleaner-0.7.2/lib/database_cleaner/mongo_mapper/truncation.rb +19 -0
- data/lib/database_cleaner-0.7.2/lib/database_cleaner/mongoid/base.rb +20 -0
- data/lib/database_cleaner-0.7.2/lib/database_cleaner/mongoid/truncation.rb +20 -0
- data/lib/database_cleaner-0.7.2/lib/database_cleaner/null_strategy.rb +15 -0
- data/lib/database_cleaner-0.7.2/lib/database_cleaner/sequel/base.rb +22 -0
- data/lib/database_cleaner-0.7.2/lib/database_cleaner/sequel/transaction.rb +25 -0
- data/lib/database_cleaner-0.7.2/lib/database_cleaner/sequel/truncation.rb +50 -0
- data/lib/database_cleaner-0.7.2/spec/database_cleaner/active_record/base_spec.rb +144 -0
- data/lib/database_cleaner-0.7.2/spec/database_cleaner/active_record/transaction_spec.rb +77 -0
- data/lib/database_cleaner-0.7.2/spec/database_cleaner/active_record/truncation_spec.rb +76 -0
- data/lib/database_cleaner-0.7.2/spec/database_cleaner/base_spec.rb +493 -0
- data/lib/database_cleaner-0.7.2/spec/database_cleaner/configuration_spec.rb +294 -0
- data/lib/database_cleaner-0.7.2/spec/database_cleaner/couch_potato/truncation_spec.rb +41 -0
- data/lib/database_cleaner-0.7.2/spec/database_cleaner/data_mapper/base_spec.rb +30 -0
- data/lib/database_cleaner-0.7.2/spec/database_cleaner/data_mapper/transaction_spec.rb +23 -0
- data/lib/database_cleaner-0.7.2/spec/database_cleaner/data_mapper/truncation_spec.rb +11 -0
- data/lib/database_cleaner-0.7.2/spec/database_cleaner/generic/base_spec.rb +22 -0
- data/lib/database_cleaner-0.7.2/spec/database_cleaner/generic/truncation_spec.rb +78 -0
- data/lib/database_cleaner-0.7.2/spec/database_cleaner/mongo_mapper/base_spec.rb +33 -0
- data/lib/database_cleaner-0.7.2/spec/database_cleaner/mongo_mapper/mongo_examples.rb +8 -0
- data/lib/database_cleaner-0.7.2/spec/database_cleaner/mongo_mapper/truncation_spec.rb +74 -0
- data/lib/database_cleaner-0.7.2/spec/database_cleaner/sequel/base_spec.rb +32 -0
- data/lib/database_cleaner-0.7.2/spec/database_cleaner/sequel/transaction_spec.rb +21 -0
- data/lib/database_cleaner-0.7.2/spec/database_cleaner/sequel/truncation_spec.rb +13 -0
- data/lib/database_cleaner-0.7.2/spec/database_cleaner/shared_strategy_spec.rb +13 -0
- data/lib/database_cleaner-0.7.2/spec/rcov.opts +1 -0
- data/lib/database_cleaner-0.7.2/spec/spec.opts +7 -0
- data/lib/database_cleaner-0.7.2/spec/spec_helper.rb +19 -0
- data/lib/generators/raffle_v1/install/USAGE +8 -0
- data/lib/generators/raffle_v1/install/install_generator.rb +2 -2
- data/lib/raffle_v1/version.rb +1 -1
- metadata +266 -80
- data/test/dummy/db/development.sqlite3 +0 -0
- data/test/dummy/log/development.log +0 -1304
- data/test/dummy/tmp/cache/assets/CA9/000/sprockets%2F4a08cdc7528358910b09a742236ce1d5 +0 -0
- data/test/dummy/tmp/cache/assets/CB2/BD0/sprockets%2F85aac33f66112e73231ea0779f646d48 +0 -0
- data/test/dummy/tmp/cache/assets/CC8/930/sprockets%2Ff75c059e31f23788564cdeb37454997a +0 -0
- data/test/dummy/tmp/cache/assets/CEF/E80/sprockets%2Fd1d95274bb399cd78c4372bc6330679f +0 -0
- data/test/dummy/tmp/cache/assets/D00/C30/sprockets%2F7d453e5233c35cc0664189bd1c060dca +0 -0
- data/test/dummy/tmp/cache/assets/D06/390/sprockets%2F2db5f5807daaf42647f3f1614b2061c7 +0 -0
- data/test/dummy/tmp/cache/assets/D06/5C0/sprockets%2F10f71b69148321ca26d0bb94df09ed46 +0 -0
- data/test/dummy/tmp/cache/assets/D1E/8D0/sprockets%2Fd0f3965813d75eefebe5353981159cb3 +0 -0
- data/test/dummy/tmp/cache/assets/D35/FB0/sprockets%2Ff706372b7e19b270321cbce180d7edd3 +0 -0
- data/test/dummy/tmp/cache/assets/D49/1E0/sprockets%2F1c8eb9a82d46a60faa9b194282db8976 +0 -0
- data/test/dummy/tmp/cache/assets/D67/FA0/sprockets%2F3072f540a4a5f4af3636dc9cee4bd821 +0 -0
- data/test/dummy/tmp/cache/assets/D76/180/sprockets%2Fe06d9366092cba68641ddefa60cb5e97 +0 -0
- data/test/dummy/tmp/cache/assets/D9B/470/sprockets%2Fb7bb6ac37b3929f36a390e4f5b70aec3 +0 -0
- data/test/dummy/tmp/cache/assets/D9F/080/sprockets%2F67fdbee8438ea0fdd3406c4f3b277a14 +0 -0
- data/test/dummy/tmp/cache/assets/DCD/970/sprockets%2Fb3d4eb65c6d389bff1cb035a7c4e74d2 +0 -0
- data/test/dummy/tmp/cache/assets/DD2/7D0/sprockets%2F6d8fc01a6bd28f831fdbe625ea56f2c7 +0 -0
- data/test/dummy/tmp/cache/assets/DF1/CA0/sprockets%2Faa2be5b854dacdce2a30a0fff7412887 +0 -0
- data/test/dummy/tmp/cache/assets/E0B/E40/sprockets%2F96b1b0fa8f4feee3299fc9dcd2078d0d +0 -0
@@ -0,0 +1,15 @@
|
|
1
|
+
require_dependency "raffle_v1/application_controller"
|
2
|
+
|
3
|
+
module RaffleV1
|
4
|
+
class VersionsController < ApplicationController
|
5
|
+
skip_authorization_check
|
6
|
+
|
7
|
+
def changeset
|
8
|
+
version = Version.find(params[:id])
|
9
|
+
|
10
|
+
if can? :manage, version.item.class
|
11
|
+
render :partial => 'helpers/version_history_changeset', :locals => { :version => version}
|
12
|
+
end
|
13
|
+
end
|
14
|
+
end
|
15
|
+
end
|
@@ -0,0 +1,30 @@
|
|
1
|
+
module RaffleV1
|
2
|
+
class Ability
|
3
|
+
include CanCan::Ability
|
4
|
+
|
5
|
+
def initialize(user)
|
6
|
+
# Define abilities for the passed in user here. For example:
|
7
|
+
#
|
8
|
+
# user ||= User.new # guest user (not logged in)
|
9
|
+
# if user.admin?
|
10
|
+
# can :manage, :all
|
11
|
+
# else
|
12
|
+
# can :read, :all
|
13
|
+
# end
|
14
|
+
#
|
15
|
+
# The first argument to `can` is the action you are giving the user permission to do.
|
16
|
+
# If you pass :manage it will apply to every action. Other common actions here are
|
17
|
+
# :read, :create, :update and :destroy.
|
18
|
+
#
|
19
|
+
# The second argument is the resource the user can perform the action on. If you pass
|
20
|
+
# :all it will apply to every resource. Otherwise pass a Ruby class of the resource.
|
21
|
+
#
|
22
|
+
# The third argument is an optional hash of conditions to further filter the objects.
|
23
|
+
# For example, here the user can only update published articles.
|
24
|
+
#
|
25
|
+
# can :update, Article, :published => true
|
26
|
+
#
|
27
|
+
# See the wiki for details: https://github.com/ryanb/cancan/wiki/Defining-Abilities
|
28
|
+
end
|
29
|
+
end
|
30
|
+
end
|
@@ -0,0 +1,35 @@
|
|
1
|
+
module RaffleV1
|
2
|
+
class Admin < ActiveRecord::Base
|
3
|
+
# Include default devise modules. Others available are:
|
4
|
+
# :token_authenticatable, :encryptable, :confirmable, :lockable, :timeoutable and :omniauthable
|
5
|
+
devise :database_authenticatable, #:registerable,
|
6
|
+
:recoverable, :rememberable, :trackable, :validatable,
|
7
|
+
:token_authenticatable, :lockable
|
8
|
+
|
9
|
+
# Setup accessible (or protected) attributes for your model
|
10
|
+
attr_accessible :email, :password, :password_confirmation, :remember_me, :admin_types, :program_ids
|
11
|
+
default_scope where(:deleted_at => nil)
|
12
|
+
|
13
|
+
has_and_belongs_to_many :programs
|
14
|
+
|
15
|
+
def has_type admin_type
|
16
|
+
if self.admin_types.present?
|
17
|
+
self.admin_types.split(",").include?(admin_type)
|
18
|
+
else
|
19
|
+
false
|
20
|
+
end
|
21
|
+
end
|
22
|
+
|
23
|
+
def self.admin_types
|
24
|
+
[
|
25
|
+
["Admin", "admin"],
|
26
|
+
["Service", "service"]
|
27
|
+
]
|
28
|
+
end
|
29
|
+
|
30
|
+
def password_required?
|
31
|
+
!persisted? || !password.nil? || !password_confirmation.nil?
|
32
|
+
end
|
33
|
+
|
34
|
+
end
|
35
|
+
end
|
@@ -0,0 +1,28 @@
|
|
1
|
+
module RaffleV1
|
2
|
+
class AdminAbility
|
3
|
+
include CanCan::Ability
|
4
|
+
|
5
|
+
def initialize(user, current_program)
|
6
|
+
|
7
|
+
case user.admin_types
|
8
|
+
when :service
|
9
|
+
can :manage, :all
|
10
|
+
#can :index, :home
|
11
|
+
#can :manage, :user
|
12
|
+
#can :manage, User
|
13
|
+
#can :reset_password_for, :user
|
14
|
+
#can :can_return_items_for, :order_line_item
|
15
|
+
when :admin
|
16
|
+
can :manage, :all
|
17
|
+
else
|
18
|
+
can :manage, :all
|
19
|
+
end
|
20
|
+
|
21
|
+
if current_program.present?
|
22
|
+
cannot :index, :program
|
23
|
+
else
|
24
|
+
# cannot :manage, [Permission]
|
25
|
+
end
|
26
|
+
end
|
27
|
+
end
|
28
|
+
end
|
@@ -0,0 +1,29 @@
|
|
1
|
+
module RaffleV1
|
2
|
+
class Locale < ActiveRecord::Base
|
3
|
+
attr_accessible :description, :name, :short_name
|
4
|
+
|
5
|
+
default_scope where(:deleted_at => nil)
|
6
|
+
validates :short_name, :presence => true
|
7
|
+
has_and_belongs_to_many :programs, join_table: :program_locales
|
8
|
+
|
9
|
+
before_save :uniform_data
|
10
|
+
|
11
|
+
def uniform_data
|
12
|
+
self.short_name = self.short_name.downcase
|
13
|
+
end
|
14
|
+
|
15
|
+
def deleted
|
16
|
+
self.unscoped.where('deleted_at IS NOT NULL')
|
17
|
+
end
|
18
|
+
|
19
|
+
def self.name_for(short_name)
|
20
|
+
locale = Locale.find_by_short_name(short_name)
|
21
|
+
if locale.present?
|
22
|
+
locale.name
|
23
|
+
else
|
24
|
+
""
|
25
|
+
end
|
26
|
+
end
|
27
|
+
end
|
28
|
+
end
|
29
|
+
|
@@ -0,0 +1,26 @@
|
|
1
|
+
module RaffleV1
|
2
|
+
class Page < ActiveRecord::Base
|
3
|
+
attr_accessible :archived, :body, :deleted_at, :expiration_date, :footer, :header,
|
4
|
+
:method, :nav, :override_page, :page_status, :page_to_override, :page_type, :points,
|
5
|
+
:program_id, :publish_date, :status, :item_status, :title
|
6
|
+
|
7
|
+
belongs_to :program
|
8
|
+
belongs_to :page_layout
|
9
|
+
|
10
|
+
validates :expiration_date, :item_status, presence: true
|
11
|
+
validates :publish_date, date: { before: :expiration_date, message: "must be before expiration date" }
|
12
|
+
|
13
|
+
#validate :ensure_content, if: Proc.new{|x| x.deleted_at == nil }
|
14
|
+
|
15
|
+
scope :published, where('published_date IS NOT AND publish_date <= (?) AND expiration_date IS NOT NULL AND expiration_date >= (?)', Date.today, Date.today)
|
16
|
+
.order("publish_date DESC")
|
17
|
+
|
18
|
+
TYPES = ['Free Form', 'Pre-Defined', 'Snippet', 'Content Box']
|
19
|
+
|
20
|
+
#def ensure_content
|
21
|
+
#if translations.present?
|
22
|
+
|
23
|
+
#end
|
24
|
+
#end
|
25
|
+
end
|
26
|
+
end
|
@@ -0,0 +1,84 @@
|
|
1
|
+
module RaffleV1
|
2
|
+
class Program < ActiveRecord::Base
|
3
|
+
#attr_accessible :name
|
4
|
+
default_scope where(:deleted_at => nil)
|
5
|
+
|
6
|
+
has_and_belongs_to_many :locales, join_table: :program_locales
|
7
|
+
has_and_belongs_to_many :admins
|
8
|
+
|
9
|
+
has_one :terms_and_conditions
|
10
|
+
has_one :program_stylesheet, class_name: "Stylesheet", conditions: ["program_default = ?", true]
|
11
|
+
has_one :program_stylesheet, class_name: "Stylesheet", conditions: ["program_default = ?", true]
|
12
|
+
|
13
|
+
has_many :users
|
14
|
+
has_many :stylesheets
|
15
|
+
has_many :pages
|
16
|
+
has_many :page_layouts, dependent: :destroy
|
17
|
+
|
18
|
+
before_save :set_program_locale
|
19
|
+
|
20
|
+
after_create :create_program_setting
|
21
|
+
|
22
|
+
after_initialize :init
|
23
|
+
|
24
|
+
validate :validate
|
25
|
+
validates :name, :presence => true
|
26
|
+
validates :sub_domain, uniqueness: {allow_blank: true},
|
27
|
+
format: {with: /^[a-z0-9\-]*?$/, message: 'only include lowercase letters, numbers and hyphens'}
|
28
|
+
validates :vanity_domain, uniqueness: {allow_blank: true},
|
29
|
+
format: {with: /^[a-z0-9]+([\-\.]{1}[a-z0-9]+)*\.[a-z]{2,6}(:[0-9]{1,5})?(\/.*)?$/ix, message: 'must be a vaild domain', if: Proc.new { |p| p.vanity_domain.present? } }
|
30
|
+
validates_inclusion_of :locale, if: Proc.new {|p| bb = []; p.locale_ids.each{ |l| bb << l.present?}; bb.include?(true) }, in: Proc.new {|p| Locale.find(p.locale_ids).collect { |l| l.short_name } }, message: "must be included in available locales"
|
31
|
+
validates_presence_of :locale
|
32
|
+
validates_numericality_of :user_timeout, :only_integer => true
|
33
|
+
validates_numericality_of :maximum_failed_login_attempts, :only_integer => true,
|
34
|
+
:greater_than_or_equal_to => 1, :less_than_or_equal_to => 100, if: Proc.new {|program| program.use_failed_login_attempts }
|
35
|
+
|
36
|
+
def available_locales_exist?
|
37
|
+
errors.add(:base, "Existing Locale should contain program default") unless self.locales.map{|x| x.short_name}.included?(self.locale)
|
38
|
+
end
|
39
|
+
|
40
|
+
def self.deleted
|
41
|
+
self.unscoped.where('deleted_at IS NOT NULL')
|
42
|
+
end
|
43
|
+
|
44
|
+
def locale_for locale
|
45
|
+
localeShortName = if locale.respond_to?(:short_name)
|
46
|
+
locale.short_name
|
47
|
+
else
|
48
|
+
locale
|
49
|
+
end
|
50
|
+
"#{self.locale_name.gsub(" ", "").underscore}"
|
51
|
+
end
|
52
|
+
|
53
|
+
def set_program_locale
|
54
|
+
self.locale_name = "#{self.name.gsub(" ", "").underscore}"
|
55
|
+
end
|
56
|
+
|
57
|
+
def program_portal_path
|
58
|
+
if !self.subdomain.blank?
|
59
|
+
"http://#{self.subdomain}.#{Phoenixv2::Application.config.full_domain}"
|
60
|
+
elsif !self.vanity_domain.nil?
|
61
|
+
"http://#{self.vanity_domain}"
|
62
|
+
end
|
63
|
+
end
|
64
|
+
|
65
|
+
def init
|
66
|
+
self.user_timeout ||= 20
|
67
|
+
self.maximum_failed_login_attempts ||= 20
|
68
|
+
self.password_notifier ||= 1
|
69
|
+
end
|
70
|
+
|
71
|
+
def validate
|
72
|
+
is_valid = true
|
73
|
+
if self.user_timeout < 0
|
74
|
+
errors.add(:user_timeout, "should be a positive numeric number")
|
75
|
+
is_valid = false
|
76
|
+
end
|
77
|
+
end
|
78
|
+
|
79
|
+
def create_program_setting
|
80
|
+
ProgramSetting.create(program_id: self.id)
|
81
|
+
end
|
82
|
+
|
83
|
+
end
|
84
|
+
end
|
@@ -0,0 +1,17 @@
|
|
1
|
+
module RaffleV1
|
2
|
+
class TermsAndCondition < ActiveRecord::Base
|
3
|
+
#include Commonscope
|
4
|
+
#include CheckBannedWords
|
5
|
+
#include ReachRoleExtensions
|
6
|
+
|
7
|
+
belongs_to :program
|
8
|
+
#has_reach
|
9
|
+
#has_paper_trail
|
10
|
+
#is_hierarchable
|
11
|
+
|
12
|
+
#is_dynamically_translatable title: { required: true }, content: { required: true }, akm_content: { required: false }, accept_text: { required: true }, decline_text: { required: true }, decline_message: { required: true }
|
13
|
+
|
14
|
+
attr_accessible :accept, :program_id, :accept_text, :active, :akm_content, :content, :decline,
|
15
|
+
:decline_message, :decline_text, :force_accept, :required_renewed, :title
|
16
|
+
end
|
17
|
+
end
|
@@ -0,0 +1,29 @@
|
|
1
|
+
module RaffleV1
|
2
|
+
class Translation < ActiveRecord::Base
|
3
|
+
#attr_accessible :interpolations, :key, :locale, :value
|
4
|
+
#include CommonScopes
|
5
|
+
|
6
|
+
belongs_to :translation_key
|
7
|
+
belongs_to :program
|
8
|
+
|
9
|
+
validates_presence_of :language
|
10
|
+
|
11
|
+
before_save :set_key
|
12
|
+
before_create :set_locale
|
13
|
+
|
14
|
+
def set_key
|
15
|
+
translation_key = TranslationKey.find(self.translation_key_id)
|
16
|
+
self.key = translation_key.key
|
17
|
+
end
|
18
|
+
|
19
|
+
def set_locale
|
20
|
+
program_prefix = ""
|
21
|
+
unless self.program_id.nil?
|
22
|
+
program = Program.find(self.program.id)
|
23
|
+
program_prefix = "#{program.name.underscore}_"
|
24
|
+
end
|
25
|
+
self.locale = "#{program_prefix}#{self.language}"
|
26
|
+
end
|
27
|
+
|
28
|
+
end
|
29
|
+
end
|
@@ -0,0 +1,35 @@
|
|
1
|
+
module RaffleV1
|
2
|
+
class TranslationKey < ActiveRecord::Base
|
3
|
+
attr_accessible :key, :name
|
4
|
+
#include CommonScopes
|
5
|
+
|
6
|
+
belongs_to :translation_object
|
7
|
+
has_many :translations, :dependent => :destroy
|
8
|
+
has_one :primary_translation, :class_name => "Translation", :condition => ['locale = ?', 'en']
|
9
|
+
|
10
|
+
before_save :set_key
|
11
|
+
|
12
|
+
def set_key
|
13
|
+
key_prefix = ""
|
14
|
+
translation_object = TranslationObject.find(self.translation_object_id)
|
15
|
+
key_override = nil
|
16
|
+
|
17
|
+
if translation_object.object_type == "Model"
|
18
|
+
if self.name == "model_name"
|
19
|
+
key_override = "#{translation_object.name.underscore.downcase}.one"
|
20
|
+
key_prefix = "activerecord.models."
|
21
|
+
elsif self.name == "model_name_plural"
|
22
|
+
key_override = "#{translation_object.name.underscore.downcase}.other"
|
23
|
+
key_prefix = "activerecord.models."
|
24
|
+
else
|
25
|
+
key_prefix = "activerecord.attributes.#{translation_object.name.underscore.downcase}."
|
26
|
+
end
|
27
|
+
else
|
28
|
+
key_prefix = "#{translation_object.object_type.underscore.downcase}.#{translation_object.name.underscore.downcase}."
|
29
|
+
end
|
30
|
+
|
31
|
+
self.key = "#{key_prefix}#{key_override || self.name.gsub(/\s+/, "").underscore.downcase}"
|
32
|
+
end
|
33
|
+
|
34
|
+
end
|
35
|
+
end
|
@@ -0,0 +1,108 @@
|
|
1
|
+
module RaffleV1
|
2
|
+
class User < ActiveRecord::Base
|
3
|
+
|
4
|
+
STATUSES = ["active", "terminated"]
|
5
|
+
# Include default devise modules. Others available are:
|
6
|
+
devise :database_authenticatable,
|
7
|
+
:recoverable, :rememberable, :trackable,
|
8
|
+
:token_authenticatable, :lockable, :authentication_keys => [:username, :program_id],
|
9
|
+
:lock_strategy => :failed_attempts, :unlock_strategy => :time,
|
10
|
+
:maximum_attempts => 1000, :unlock_in => 1000 # These are ignored and overridden by the attempts_exceeded? and lock_expired?
|
11
|
+
|
12
|
+
# Setup accessible (or protected) attributes for the user model
|
13
|
+
attr_accessible :email, :password, :password_confirmation, :remember_me, :first_name, :last_name, :middle_initial, :suffix,
|
14
|
+
:work_email, :employee_number, :employee_id, :work_address, :work_city, :work_state, :work_postal, :work_county, :home_address, :home_city,:home_state,
|
15
|
+
:home_postal,:home_county, :work_phone,:home_phone, :department_code, :department_name, :cost_center_cost, :user_name,
|
16
|
+
:job_title, :date_of_hire, :date_of_rehire, :date_of_birth, :preferred_language, :user_type, :employment_type, :vip_flag, :time_offset, :date_of_terminate, :manager_id,
|
17
|
+
:hierarchy_node, :hierarchy_node_id
|
18
|
+
|
19
|
+
default_scope where(:deleted_at => nil)
|
20
|
+
|
21
|
+
belongs_to :program
|
22
|
+
|
23
|
+
has_many :belongs_to_user_relationships, class_name: "UserRelationship", foreign_key: "user_id"
|
24
|
+
has_many :has_many_user_relationships, class_name: "UserRelationship", foreign_key: "related_user_id"
|
25
|
+
|
26
|
+
before_validation :generate_password_for_new_user
|
27
|
+
|
28
|
+
validates :username, :employee_id, :presence => true
|
29
|
+
validates_confirmation_of :password, unless: Proc.new{|u| u.is_temporary_password == true or u.deleted_at != nil}
|
30
|
+
validates :date_of_birth, date: { before: Date.today, message: "must be before #{Date.today}"}, if: Proc.new { self.date_of_birth.present? }
|
31
|
+
validates_presence_of :password, :if => :password_required?
|
32
|
+
validates_confirmation_of :password, :if => :password_required?
|
33
|
+
validates_length_of :password, :within => Devise.password_length, :allow_blank => true
|
34
|
+
|
35
|
+
validate :password, presence: true, unless: Proc.new {|u| u.is_temporary_password == true or u.deleted_at != nil}
|
36
|
+
validate :custom_password_strength, unless: Proc.new { |u| u.deleted_at != nil}
|
37
|
+
validate :unique_usernames, on: :create
|
38
|
+
|
39
|
+
def generate_password_for_new_user
|
40
|
+
if password.nil? and self.new_record?
|
41
|
+
self.password = SecureRadom.hex(8) + "!&4$"
|
42
|
+
self.password_created_at = Time.now
|
43
|
+
self.is_temporary_password = true
|
44
|
+
end
|
45
|
+
end
|
46
|
+
|
47
|
+
def reset_password_token_and_notify host = nil
|
48
|
+
self.password = User.reset_password_token
|
49
|
+
self.reset_password_sent_at = User.reset_password_token
|
50
|
+
self.reset_password_sent_at = Time.now
|
51
|
+
self.save
|
52
|
+
puts UserMailer.reset_password(self, host).deliver
|
53
|
+
end
|
54
|
+
|
55
|
+
def custom_password_strength
|
56
|
+
if self.password.present? && self.encrypted_password_changed?
|
57
|
+
program = Program.find(self.program.id)
|
58
|
+
strength = PasswordStrength.test(self.username, self.password)
|
59
|
+
unless strength.valid?(program.password_strength.to_sym)
|
60
|
+
is_valid = false
|
61
|
+
self.errors.add(:password, "is not secure. Password must be #{program.password_strength.to_sym}")
|
62
|
+
end
|
63
|
+
end
|
64
|
+
|
65
|
+
is_valid
|
66
|
+
end
|
67
|
+
|
68
|
+
def self.generate_random_password
|
69
|
+
start_length = 10
|
70
|
+
token = ""
|
71
|
+
|
72
|
+
#loop over token generation untill we get something matching our desired length
|
73
|
+
#the reason we loop is so that we can confidently filter our barred characters
|
74
|
+
#while resorting the gaps with the new random characters
|
75
|
+
while token.length < start_length
|
76
|
+
token << Devise.friendly_token.first(start_length)
|
77
|
+
token.gsub!(/[iIlLoO10]/, "")
|
78
|
+
end
|
79
|
+
#slice incase the string became too long
|
80
|
+
token = token[0, start_length]
|
81
|
+
|
82
|
+
#need to add special chars into the string
|
83
|
+
random = Random.new
|
84
|
+
|
85
|
+
token.insert(random.rand(0..token.length), "@")
|
86
|
+
token.insert(random.rand(0..token.length), "!")
|
87
|
+
|
88
|
+
token
|
89
|
+
end
|
90
|
+
|
91
|
+
def fullname
|
92
|
+
"#{self.first_name} #{self.last_name}"
|
93
|
+
end
|
94
|
+
|
95
|
+
def full_home_phone_number
|
96
|
+
"(#{home_telephone_country_code}) #{home_telephone_area_code}-#{home_telephone_number}"
|
97
|
+
end
|
98
|
+
|
99
|
+
def full_home_address
|
100
|
+
"#{home_address}\n #{home_city}, #{home_state}"
|
101
|
+
end
|
102
|
+
|
103
|
+
def active?
|
104
|
+
self.date_of_termination.blank? || self.date_of_termination < Date.new
|
105
|
+
end
|
106
|
+
|
107
|
+
end
|
108
|
+
end
|