voluntary 0.0.1
Sign up to get free protection for your applications and to get access to all the features.
- data/MIT-LICENSE +20 -0
- data/README.rdoc +48 -0
- data/Rakefile +27 -0
- data/app/assets/javascripts/voluntary/application.js +6 -0
- data/app/assets/javascripts/voluntary/base.js.coffee +34 -0
- data/app/assets/javascripts/voluntary/bootstrap.js.coffee +4 -0
- data/app/assets/javascripts/voluntary/functions.js +24 -0
- data/app/assets/javascripts/voluntary/users.js.coffee +12 -0
- data/app/assets/stylesheets/voluntary/application.css +15 -0
- data/app/assets/stylesheets/voluntary/base.css.scss +40 -0
- data/app/assets/stylesheets/voluntary/bootstrap_and_overrides.css.less +67 -0
- data/app/controllers/areas_controller.rb +66 -0
- data/app/controllers/candidatures_controller.rb +79 -0
- data/app/controllers/comments_controller.rb +70 -0
- data/app/controllers/devise_extensions/registrations_controller.rb +37 -0
- data/app/controllers/home_controller.rb +7 -0
- data/app/controllers/organizations_controller.rb +67 -0
- data/app/controllers/pages_controller.rb +54 -0
- data/app/controllers/products_controller.rb +62 -0
- data/app/controllers/professions_controller.rb +66 -0
- data/app/controllers/projects_controller.rb +56 -0
- data/app/controllers/results_controller.rb +93 -0
- data/app/controllers/stories_controller.rb +96 -0
- data/app/controllers/tasks_controller.rb +88 -0
- data/app/controllers/users_controller.rb +52 -0
- data/app/controllers/vacancies_controller.rb +79 -0
- data/app/controllers/voluntary/application_controller.rb +92 -0
- data/app/controllers/workflow/candidatures_controller.rb +20 -0
- data/app/controllers/workflow/products_controller.rb +6 -0
- data/app/controllers/workflow/project_owner_controller.rb +33 -0
- data/app/controllers/workflow/stories_controller.rb +6 -0
- data/app/controllers/workflow/tasks_controller.rb +147 -0
- data/app/controllers/workflow/user_controller.rb +6 -0
- data/app/controllers/workflow/vacancies_controller.rb +17 -0
- data/app/controllers/workflow_controller.rb +7 -0
- data/app/helpers/application_helper.rb +65 -0
- data/app/helpers/collection_helper.rb +31 -0
- data/app/helpers/comments_helper.rb +11 -0
- data/app/helpers/form_helper.rb +39 -0
- data/app/helpers/language_helper.rb +15 -0
- data/app/helpers/layout_helper.rb +24 -0
- data/app/helpers/product_helper.rb +32 -0
- data/app/helpers/show_helper.rb +65 -0
- data/app/helpers/wizard_helper.rb +27 -0
- data/app/models/area.rb +19 -0
- data/app/models/area_user.rb +19 -0
- data/app/models/candidature.rb +35 -0
- data/app/models/comment.rb +16 -0
- data/app/models/history_tracker.rb +3 -0
- data/app/models/mongo_db_document.rb +11 -0
- data/app/models/organization.rb +19 -0
- data/app/models/page.rb +30 -0
- data/app/models/product.rb +99 -0
- data/app/models/product/new_product.rb +3 -0
- data/app/models/product/project_management.rb +29 -0
- data/app/models/profession.rb +13 -0
- data/app/models/project.rb +66 -0
- data/app/models/project_user.rb +13 -0
- data/app/models/result.rb +55 -0
- data/app/models/role.rb +8 -0
- data/app/models/role/admin.rb +2 -0
- data/app/models/role/master.rb +2 -0
- data/app/models/role/project_owner.rb +2 -0
- data/app/models/role/user.rb +2 -0
- data/app/models/state_machines/candidature.rb +42 -0
- data/app/models/state_machines/page.rb +18 -0
- data/app/models/state_machines/story.rb +51 -0
- data/app/models/state_machines/task.rb +46 -0
- data/app/models/state_machines/vacancy.rb +41 -0
- data/app/models/story.rb +82 -0
- data/app/models/task.rb +85 -0
- data/app/models/user.rb +95 -0
- data/app/models/user_role.rb +6 -0
- data/app/models/vacancy.rb +41 -0
- data/app/observers/candidature_observer.rb +29 -0
- data/app/observers/story_observer.rb +6 -0
- data/app/observers/task_observer.rb +34 -0
- data/app/presenters/layout/application_presenter.rb +3 -0
- data/app/presenters/layout_presenter.rb +9 -0
- data/app/presenters/presenter.rb +46 -0
- data/app/presenters/resource_presenter.rb +30 -0
- data/app/presenters/resources/general/wizard_presenter.rb +17 -0
- data/app/presenters/resources/general/wizards/story/steps/activate_presenter.rb +3 -0
- data/app/presenters/resources/general/wizards/story/steps/setup_tasks_presenter.rb +5 -0
- data/app/presenters/resources/general/wizards/story_presenter.rb +3 -0
- data/app/presenters/resources/user/form_presenter.rb +16 -0
- data/app/presenters/shared/collection/table_presenter.rb +33 -0
- data/app/views/areas/_form.html.erb +11 -0
- data/app/views/areas/edit.html.erb +3 -0
- data/app/views/areas/index.html.erb +5 -0
- data/app/views/areas/new.html.erb +3 -0
- data/app/views/areas/show.html.erb +6 -0
- data/app/views/candidatures/_form.html.erb +13 -0
- data/app/views/candidatures/edit.html.erb +3 -0
- data/app/views/candidatures/index.html.erb +11 -0
- data/app/views/candidatures/new.html.erb +3 -0
- data/app/views/candidatures/show.html.erb +18 -0
- data/app/views/comments/_form.html.erb +16 -0
- data/app/views/comments/_resource.html.erb +16 -0
- data/app/views/comments/edit.html.erb +3 -0
- data/app/views/comments/new.html.erb +3 -0
- data/app/views/devise/mailer/confirmation_instructions.html.erb +10 -0
- data/app/views/devise/registrations/new.html.erb +5 -0
- data/app/views/general/wizard.html.erb +16 -0
- data/app/views/kaminari/_first_page.html.erb +13 -0
- data/app/views/kaminari/_gap.html.erb +8 -0
- data/app/views/kaminari/_last_page.html.erb +13 -0
- data/app/views/kaminari/_next_page.html.erb +13 -0
- data/app/views/kaminari/_page.html.erb +12 -0
- data/app/views/kaminari/_paginator.html.erb +25 -0
- data/app/views/kaminari/_prev_page.html.erb +13 -0
- data/app/views/layouts/application.html.erb +48 -0
- data/app/views/layouts/shared/_flash_messages.html.erb +7 -0
- data/app/views/layouts/shared/_navigation.html.erb +7 -0
- data/app/views/organizations/_form.html.erb +11 -0
- data/app/views/organizations/edit.html.erb +3 -0
- data/app/views/organizations/index.html.erb +5 -0
- data/app/views/organizations/new.html.erb +3 -0
- data/app/views/organizations/show.html.erb +6 -0
- data/app/views/pages/_form.html.erb +12 -0
- data/app/views/pages/edit.html.erb +3 -0
- data/app/views/pages/index.html.erb +5 -0
- data/app/views/pages/new.html.erb +3 -0
- data/app/views/pages/show.html.erb +10 -0
- data/app/views/products/_form.html.erb +28 -0
- data/app/views/products/edit.html.erb +3 -0
- data/app/views/products/index.html.erb +5 -0
- data/app/views/products/mixins/_keywords.html.erb +4 -0
- data/app/views/products/new.html.erb +3 -0
- data/app/views/products/show.html.erb +11 -0
- data/app/views/products/types/text_creation/stories/_form.html.erb +19 -0
- data/app/views/products/types/text_creation/stories/_task_fields.html.erb +7 -0
- data/app/views/projects/_form.html.erb +16 -0
- data/app/views/projects/edit.html.erb +3 -0
- data/app/views/projects/index.html.erb +5 -0
- data/app/views/projects/new.html.erb +3 -0
- data/app/views/projects/show.html.erb +13 -0
- data/app/views/shared/_comments.html.erb +7 -0
- data/app/views/shared/collection/_list.html.erb +37 -0
- data/app/views/shared/collection/_table.html.erb +36 -0
- data/app/views/shared/form/_error_messages.html.erb +10 -0
- data/app/views/shared/resource/_actions.html.erb +26 -0
- data/app/views/shared/resource/_event_elements.html.erb +7 -0
- data/app/views/stories/_collection.html.erb +8 -0
- data/app/views/stories/_form.html.erb +19 -0
- data/app/views/stories/_task_fields.html.erb +11 -0
- data/app/views/stories/index.html.erb +1 -0
- data/app/views/stories/show.html.erb +13 -0
- data/app/views/stories/steps/_activate.html.erb +17 -0
- data/app/views/stories/steps/_setup_tasks.html.erb +35 -0
- data/app/views/stories/tasks.html.erb +0 -0
- data/app/views/tasks/_collection.html.erb +12 -0
- data/app/views/users/_form.html.erb +43 -0
- data/app/views/users/edit.html.erb +3 -0
- data/app/views/users/index.html.erb +6 -0
- data/app/views/users/new.html.erb +3 -0
- data/app/views/users/preferences.html.erb +11 -0
- data/app/views/users/show.html.erb +6 -0
- data/app/views/vacancies/_form.html.erb +15 -0
- data/app/views/vacancies/edit.html.erb +3 -0
- data/app/views/vacancies/index.html.erb +7 -0
- data/app/views/vacancies/new.html.erb +3 -0
- data/app/views/vacancies/show.html.erb +17 -0
- data/app/views/workflow/index.html.erb +0 -0
- data/app/views/workflow/products/show.html.erb +34 -0
- data/app/views/workflow/project_owner/_candidatures.html.erb +31 -0
- data/app/views/workflow/project_owner/_stories.html.erb +29 -0
- data/app/views/workflow/project_owner/_tasks.html.erb +34 -0
- data/app/views/workflow/project_owner/_vacancies.html.erb +27 -0
- data/app/views/workflow/project_owner/index.html.erb +24 -0
- data/app/views/workflow/tasks/_work_form.html.erb +8 -0
- data/app/views/workflow/tasks/_work_head.html.erb +15 -0
- data/app/views/workflow/tasks/edit.html.erb +3 -0
- data/app/views/workflow/tasks/index.html.erb +31 -0
- data/app/views/workflow/tasks/next.html.erb +0 -0
- data/app/views/workflow/tasks/steps/_complete.html.erb +11 -0
- data/app/views/workflow/tasks/steps/_review.html.erb +13 -0
- data/app/views/workflow/tasks/steps/_work.html.erb +17 -0
- data/app/views/workflow/user/_tasks.html.erb +30 -0
- data/app/views/workflow/user/index.html.erb +14 -0
- data/config/initializers/1_initialize_app_config.rb +5 -0
- data/config/initializers/devise.rb +193 -0
- data/config/initializers/locale_settings.rb +42 -0
- data/config/initializers/mongoid-history.rb +2 -0
- data/config/initializers/recaptcha.rb +7 -0
- data/config/initializers/simple_form.rb +178 -0
- data/config/initializers/simple_navigation.rb +2 -0
- data/config/locales/devise.en.yml +59 -0
- data/config/locales/en.yml +26 -0
- data/config/locales/general/en.yml +71 -0
- data/config/locales/resources/area/en.yml +12 -0
- data/config/locales/resources/candidature/en.yml +19 -0
- data/config/locales/resources/comment/en.yml +11 -0
- data/config/locales/resources/organization/en.yml +11 -0
- data/config/locales/resources/page/en.yml +11 -0
- data/config/locales/resources/product/en.yml +23 -0
- data/config/locales/resources/project/en.yml +9 -0
- data/config/locales/resources/result/en.yml +9 -0
- data/config/locales/resources/story/en.yml +34 -0
- data/config/locales/resources/task/en.yml +36 -0
- data/config/locales/resources/user/en.yml +14 -0
- data/config/locales/resources/vacancy/en.yml +29 -0
- data/config/locales/simple_form.en.yml +26 -0
- data/config/locales/workflow/en.yml +37 -0
- data/config/routes.rb +188 -0
- data/db/migrate/20120907144853_create_schema.rb +217 -0
- data/db/migrate/20120911093743_remove_timestamps_from_habtm_tables.rb +21 -0
- data/db/migrate/20120919161831_add_unique_index_for_one_user_candidature_per_vacancy.rb +9 -0
- data/db/migrate/20120922201955_create_mongo_db_documents.rb +13 -0
- data/db/migrate/20120923140109_add_product_to_project.rb +6 -0
- data/db/migrate/20121004061413_add_extra_user_attributes.rb +9 -0
- data/db/migrate/20121004132105_create_professions.rb +13 -0
- data/db/migrate/20121006162913_add_public_attribute_to_roles.rb +6 -0
- data/db/migrate/20121006170407_add_type_attribute_to_roles.rb +5 -0
- data/db/migrate/20121007071543_add_foreign_languages_to_user.rb +6 -0
- data/db/migrate/20121028073712_create_organizations.rb +13 -0
- data/db/seeds.rb +14 -0
- data/lib/applicat/mvc/controller.rb +171 -0
- data/lib/applicat/mvc/controller/error_handling.rb +40 -0
- data/lib/applicat/mvc/controller/resource.rb +19 -0
- data/lib/applicat/mvc/controller/transition_actions.rb +43 -0
- data/lib/applicat/mvc/model/resource/base.rb +56 -0
- data/lib/applicat/mvc/model/tokenable.rb +24 -0
- data/lib/applicat/mvc/model/tree.rb +82 -0
- data/lib/db_seed.rb +150 -0
- data/lib/environment_configuration.rb +54 -0
- data/lib/generators/voluntary/install/install_generator.rb +118 -0
- data/lib/generators/voluntary/install/templates/app/controllers/application_controller.rb +3 -0
- data/lib/generators/voluntary/install/templates/app/models/ability.rb +49 -0
- data/lib/generators/voluntary/install/templates/app/models/app_config.rb +32 -0
- data/lib/generators/voluntary/install/templates/app/views/layouts/application.html.erb +50 -0
- data/lib/generators/voluntary/install/templates/config/application.yml +147 -0
- data/lib/generators/voluntary/install/templates/config/cucumber.yml +8 -0
- data/lib/generators/voluntary/install/templates/config/database.example.yml +28 -0
- data/lib/generators/voluntary/install/templates/config/deploy.rb +59 -0
- data/lib/generators/voluntary/install/templates/config/email.example.yml +9 -0
- data/lib/generators/voluntary/install/templates/config/initializers/recaptcha_example +4 -0
- data/lib/generators/voluntary/install/templates/config/locale_settings.yml +121 -0
- data/lib/generators/voluntary/install/templates/config/main_navigation.rb +262 -0
- data/lib/generators/voluntary/install/templates/config/mongoid.yml +78 -0
- data/lib/generators/voluntary/install/templates/config/nginx.conf +27 -0
- data/lib/generators/voluntary/install/templates/config/unicorn.rb +9 -0
- data/lib/generators/voluntary/install/templates/config/unicorn_init.sh +84 -0
- data/lib/generators/voluntary/install/templates/db/seeds.rb +14 -0
- data/lib/generators/voluntary/install/templates/features/step_definitions/email_steps.rb +89 -0
- data/lib/generators/voluntary/install/templates/features/step_definitions/factory_steps.rb +120 -0
- data/lib/generators/voluntary/install/templates/features/step_definitions/javascript_steps.rb +15 -0
- data/lib/generators/voluntary/install/templates/features/step_definitions/navigation_steps.rb +3 -0
- data/lib/generators/voluntary/install/templates/features/step_definitions/resources_steps.rb +8 -0
- data/lib/generators/voluntary/install/templates/features/step_definitions/session_steps.rb +35 -0
- data/lib/generators/voluntary/install/templates/features/step_definitions/web_steps.rb +271 -0
- data/lib/generators/voluntary/install/templates/features/support/database_cleaner_patches.rb +24 -0
- data/lib/generators/voluntary/install/templates/features/support/env.rb +83 -0
- data/lib/generators/voluntary/install/templates/features/support/integration_sessions_controller.rb +32 -0
- data/lib/generators/voluntary/install/templates/features/support/integration_sessions_form.html.erb +1 -0
- data/lib/generators/voluntary/install/templates/features/support/paths.rb +98 -0
- data/lib/generators/voluntary/install/templates/features/support/selectors.rb +44 -0
- data/lib/generators/voluntary/install/templates/features/support/spork_env +72 -0
- data/lib/generators/voluntary/install/templates/features/support/user_cuke_helpers.rb +78 -0
- data/lib/generators/voluntary/install/templates/lib/volontariat_seed.rb +36 -0
- data/lib/generators/voluntary/install/templates/spec/spec_helper.rb +72 -0
- data/lib/generators/voluntary/install/templates/spec/support/deferred_garbage_collector.rb +45 -0
- data/lib/generators/voluntary/install/templates/spec/support/devise.rb +3 -0
- data/lib/generators/voluntary/install/templates/spec/support/mongo_database_cleaner.rb +19 -0
- data/lib/generators/voluntary/install/templates/vendor/assets/javascripts/jquery.tokeninput.js +915 -0
- data/lib/generators/voluntary/install/templates/vendor/assets/stylesheets/token-input-facebook.css +122 -0
- data/lib/generators/voluntary/install/templates/vendor/assets/stylesheets/token-input-mac.css +204 -0
- data/lib/generators/voluntary/install/templates/vendor/assets/stylesheets/token-input.css +127 -0
- data/lib/i18n_interpolation_fallbacks.rb +21 -0
- data/lib/model/mongo_db/commentable.rb +17 -0
- data/lib/model/mongo_db/core_extensions.rb +10 -0
- data/lib/model/mongo_db/customizable.rb +23 -0
- data/lib/model/mongo_db/product/keywords.rb +31 -0
- data/lib/model/mongo_db/state_version_attributes.rb +15 -0
- data/lib/tasks/cucumber.rake +65 -0
- data/lib/tasks/voluntary_tasks.rake +4 -0
- data/lib/vendors/active_model/naming.rb +14 -0
- data/lib/vendors/simple_navigation/renderer/breadcrumbs_without_method_links.rb +30 -0
- data/lib/vendors/simple_navigation/renderer/twitter_sidenav.rb +34 -0
- data/lib/voluntary.rb +87 -0
- data/lib/voluntary/engine.rb +11 -0
- data/lib/voluntary/helpers/application.rb +69 -0
- data/lib/voluntary/helpers/collection.rb +35 -0
- data/lib/voluntary/helpers/comments.rb +15 -0
- data/lib/voluntary/helpers/form.rb +43 -0
- data/lib/voluntary/helpers/language.rb +19 -0
- data/lib/voluntary/helpers/layout.rb +28 -0
- data/lib/voluntary/helpers/product.rb +36 -0
- data/lib/voluntary/helpers/show.rb +69 -0
- data/lib/voluntary/helpers/wizard.rb +31 -0
- data/lib/voluntary/version.rb +3 -0
- data/lib/wizard.rb +58 -0
- data/lib/wizard/controller/concerns/paths.rb +31 -0
- data/lib/wizard/controller/concerns/steps.rb +142 -0
- metadata +1217 -0
@@ -0,0 +1,217 @@
|
|
1
|
+
class CreateSchema < ActiveRecord::Migration
|
2
|
+
def up
|
3
|
+
create_table :users do |t|
|
4
|
+
t.string :name
|
5
|
+
t.string :slug
|
6
|
+
t.string :rpx_identifier
|
7
|
+
t.string :password
|
8
|
+
t.text :text
|
9
|
+
t.text :serialized_private_key
|
10
|
+
|
11
|
+
# profile
|
12
|
+
t.string :language
|
13
|
+
t.string :first_name
|
14
|
+
t.string :last_name
|
15
|
+
t.string :salutation
|
16
|
+
t.string :marital_status
|
17
|
+
t.string :family_status
|
18
|
+
t.date :date_of_birth
|
19
|
+
t.string :place_of_birth
|
20
|
+
t.string :citizenship
|
21
|
+
|
22
|
+
# devise authentication data
|
23
|
+
|
24
|
+
## Database authenticatable
|
25
|
+
t.string :email, :null => false, :default => ""
|
26
|
+
t.string :encrypted_password, :null => false, :default => ""
|
27
|
+
|
28
|
+
## Recoverable
|
29
|
+
t.string :reset_password_token
|
30
|
+
t.datetime :reset_password_sent_at
|
31
|
+
|
32
|
+
## Rememberable
|
33
|
+
t.datetime :remember_created_at
|
34
|
+
|
35
|
+
## Trackable
|
36
|
+
t.integer :sign_in_count, :default => 0
|
37
|
+
t.datetime :current_sign_in_at
|
38
|
+
t.datetime :last_sign_in_at
|
39
|
+
t.string :current_sign_in_ip
|
40
|
+
t.string :last_sign_in_ip
|
41
|
+
|
42
|
+
## Confirmable
|
43
|
+
t.string :confirmation_token
|
44
|
+
t.datetime :confirmed_at
|
45
|
+
t.datetime :confirmation_sent_at
|
46
|
+
t.string :unconfirmed_email # Only if using reconfirmable
|
47
|
+
|
48
|
+
## Lockable
|
49
|
+
t.integer :failed_attempts, :default => 0 # Only if lock strategy is :failed_attempts
|
50
|
+
t.string :unlock_token # Only if unlock strategy is :email or :both
|
51
|
+
t.datetime :locked_at
|
52
|
+
|
53
|
+
## Token authenticatable
|
54
|
+
t.string :authentication_token
|
55
|
+
|
56
|
+
t.string :password_salt # Encryptable
|
57
|
+
|
58
|
+
t.string :state
|
59
|
+
t.timestamps
|
60
|
+
end
|
61
|
+
|
62
|
+
add_index :users, :slug, unique: true
|
63
|
+
add_index :users, :name, unique: true
|
64
|
+
add_index :users, :email, unique: true
|
65
|
+
add_index :users, :reset_password_token, unique: true
|
66
|
+
|
67
|
+
create_table :roles do |t|
|
68
|
+
t.string :name
|
69
|
+
t.string :state
|
70
|
+
t.timestamps
|
71
|
+
end
|
72
|
+
|
73
|
+
create_table :users_roles do |t|
|
74
|
+
t.integer :role_id
|
75
|
+
t.integer :user_id
|
76
|
+
t.string :state
|
77
|
+
t.timestamps
|
78
|
+
end
|
79
|
+
|
80
|
+
add_index :users_roles, [:user_id, :role_id], unique: true
|
81
|
+
|
82
|
+
create_table :projects do |t|
|
83
|
+
t.integer :user_id
|
84
|
+
t.string :name
|
85
|
+
t.string :slug
|
86
|
+
t.text :text
|
87
|
+
t.string :url
|
88
|
+
t.string :state
|
89
|
+
t.timestamps
|
90
|
+
end
|
91
|
+
|
92
|
+
add_index :projects, :slug, unique: true
|
93
|
+
add_index :projects, :user_id
|
94
|
+
|
95
|
+
create_table :vacancies do |t|
|
96
|
+
t.string :type # job, location, money
|
97
|
+
t.integer :project_id
|
98
|
+
t.integer :offeror_id
|
99
|
+
t.integer :author_id
|
100
|
+
t.integer :user_id
|
101
|
+
t.integer :project_user_id
|
102
|
+
t.string :name
|
103
|
+
t.string :slug
|
104
|
+
t.text :text
|
105
|
+
t.integer :limit, default: 1
|
106
|
+
t.string :state
|
107
|
+
t.timestamps
|
108
|
+
end
|
109
|
+
|
110
|
+
add_index :vacancies, :slug, unique: true
|
111
|
+
add_index :vacancies, [:project_id, :name], unique: true
|
112
|
+
add_index :vacancies, :project_id
|
113
|
+
add_index :vacancies, :offeror_id
|
114
|
+
add_index :vacancies, :user_id
|
115
|
+
add_index :vacancies, :project_user_id
|
116
|
+
|
117
|
+
create_table :candidatures do |t|
|
118
|
+
t.integer :vacancy_id
|
119
|
+
t.integer :offeror_id
|
120
|
+
t.integer :user_id
|
121
|
+
t.string :name
|
122
|
+
t.string :slug
|
123
|
+
t.text :text
|
124
|
+
t.string :state
|
125
|
+
t.timestamps
|
126
|
+
end
|
127
|
+
|
128
|
+
add_index :candidatures, :slug, unique: true
|
129
|
+
add_index :candidatures, [:vacancy_id, :name], unique: true
|
130
|
+
add_index :candidatures, :vacancy_id
|
131
|
+
add_index :candidatures, :user_id
|
132
|
+
|
133
|
+
# project stellen ausschreibung
|
134
|
+
# bewerbung (project, project stelle)
|
135
|
+
|
136
|
+
create_table :projects_users do |t|
|
137
|
+
t.integer :project_id
|
138
|
+
t.integer :vacancy_id
|
139
|
+
t.integer :role_id
|
140
|
+
t.integer :user_id
|
141
|
+
t.string :state
|
142
|
+
t.timestamps
|
143
|
+
end
|
144
|
+
|
145
|
+
add_index :projects_users, [:project_id, :user_id, :vacancy_id], unique: true
|
146
|
+
add_index :projects_users, :project_id
|
147
|
+
add_index :projects_users, :vacancy_id
|
148
|
+
add_index :projects_users, :role_id
|
149
|
+
add_index :projects_users, :user_id
|
150
|
+
|
151
|
+
create_table :areas do |t|
|
152
|
+
t.string :ancestry
|
153
|
+
t.integer :ancestry_depth, default: 0
|
154
|
+
t.integer :position
|
155
|
+
t.string :name
|
156
|
+
t.string :slug
|
157
|
+
t.integer :users_count, default: 0
|
158
|
+
t.timestamps
|
159
|
+
end
|
160
|
+
|
161
|
+
add_index :areas, :slug, unique: true
|
162
|
+
add_index :areas, :ancestry
|
163
|
+
add_index :areas, :name, unique: true
|
164
|
+
|
165
|
+
create_table :areas_users do |t|
|
166
|
+
t.integer :area_id
|
167
|
+
t.integer :user_id
|
168
|
+
t.timestamps
|
169
|
+
end
|
170
|
+
|
171
|
+
add_index :areas_users, [:area_id, :user_id], unique: true
|
172
|
+
add_index :areas_users, :area_id
|
173
|
+
add_index :areas_users, :user_id
|
174
|
+
|
175
|
+
create_table :areas_projects do |t|
|
176
|
+
t.integer :area_id
|
177
|
+
t.integer :project_id
|
178
|
+
t.timestamps
|
179
|
+
end
|
180
|
+
|
181
|
+
add_index :areas_projects, [:area_id, :project_id], unique: true
|
182
|
+
add_index :areas_projects, :area_id
|
183
|
+
add_index :areas_projects, :project_id
|
184
|
+
|
185
|
+
create_table :comments do |t|
|
186
|
+
t.string :commentable_type
|
187
|
+
t.integer :commentable_id
|
188
|
+
t.integer :user_id
|
189
|
+
t.string :ancestry
|
190
|
+
t.integer :ancestry_depth, default: 0
|
191
|
+
t.integer :position
|
192
|
+
t.string :name
|
193
|
+
t.text :text
|
194
|
+
t.string :state
|
195
|
+
t.timestamps
|
196
|
+
end
|
197
|
+
|
198
|
+
add_index :comments, [:commentable_id, :commentable_type]
|
199
|
+
add_index :comments, :ancestry
|
200
|
+
|
201
|
+
# 3rd party
|
202
|
+
create_table :friendly_id_slugs do |t|
|
203
|
+
t.string :slug, :null => false
|
204
|
+
t.integer :sluggable_id, :null => false
|
205
|
+
t.string :sluggable_type, :limit => 40
|
206
|
+
t.datetime :created_at
|
207
|
+
end
|
208
|
+
|
209
|
+
add_index :friendly_id_slugs, :sluggable_id
|
210
|
+
add_index :friendly_id_slugs, [:slug, :sluggable_type], :unique => true
|
211
|
+
add_index :friendly_id_slugs, :sluggable_type
|
212
|
+
end
|
213
|
+
|
214
|
+
def down
|
215
|
+
raise 'irreversable migration!'
|
216
|
+
end
|
217
|
+
end
|
@@ -0,0 +1,21 @@
|
|
1
|
+
class RemoveTimestampsFromHabtmTables < ActiveRecord::Migration
|
2
|
+
TABLES = [
|
3
|
+
:areas_projects, :areas_users, :projects_users, :users_roles
|
4
|
+
]
|
5
|
+
|
6
|
+
def up
|
7
|
+
# Have to remove timestamps from cause of:
|
8
|
+
# PG::Error: ERROR: null value in column "created_at" violates not-null constraint
|
9
|
+
TABLES.each do |table|
|
10
|
+
remove_column table, :created_at
|
11
|
+
remove_column table, :updated_at
|
12
|
+
end
|
13
|
+
end
|
14
|
+
|
15
|
+
def down
|
16
|
+
TABLES.each do |table|
|
17
|
+
add_column table, :created_at, :datetime, null: false
|
18
|
+
add_column table, :updated_at, :datetime, null: false
|
19
|
+
end
|
20
|
+
end
|
21
|
+
end
|
@@ -0,0 +1,13 @@
|
|
1
|
+
class CreateMongoDbDocuments < ActiveRecord::Migration
|
2
|
+
def change
|
3
|
+
create_table :mongo_db_documents do |t|
|
4
|
+
t.integer :mongo_db_object_id
|
5
|
+
t.string :klass_name
|
6
|
+
t.string :name
|
7
|
+
t.string :slug
|
8
|
+
t.timestamps
|
9
|
+
end
|
10
|
+
|
11
|
+
add_index :mongo_db_documents, [:mongo_db_object_id, :klass_name], unique: true
|
12
|
+
end
|
13
|
+
end
|
@@ -0,0 +1,9 @@
|
|
1
|
+
class AddExtraUserAttributes < ActiveRecord::Migration
|
2
|
+
def change
|
3
|
+
add_column :users, :country, :string
|
4
|
+
add_column :users, :foreign_language, :string
|
5
|
+
add_column :users, :interface_language, :string
|
6
|
+
add_column :users, :profession, :string
|
7
|
+
add_column :users, :employment_relationship, :string
|
8
|
+
end
|
9
|
+
end
|
@@ -0,0 +1,13 @@
|
|
1
|
+
class CreateProfessions < ActiveRecord::Migration
|
2
|
+
def change
|
3
|
+
create_table :professions do |t|
|
4
|
+
t.string :name
|
5
|
+
t.string :slug
|
6
|
+
t.timestamps
|
7
|
+
end
|
8
|
+
|
9
|
+
remove_column :users, :profession
|
10
|
+
add_column :users, :profession_id, :integer
|
11
|
+
add_index :users, :profession_id
|
12
|
+
end
|
13
|
+
end
|
@@ -0,0 +1,13 @@
|
|
1
|
+
class CreateOrganizations < ActiveRecord::Migration
|
2
|
+
def change
|
3
|
+
create_table :organizations do |t|
|
4
|
+
t.string :name
|
5
|
+
t.string :slug
|
6
|
+
t.timestamps
|
7
|
+
end
|
8
|
+
|
9
|
+
add_index :organizations, :slug
|
10
|
+
add_column :projects, :organization_id, :integer
|
11
|
+
add_index :projects, :organization_id
|
12
|
+
end
|
13
|
+
end
|
data/db/seeds.rb
ADDED
@@ -0,0 +1,14 @@
|
|
1
|
+
# This file should contain all the record creation needed to seed the database with its default values.
|
2
|
+
# The data can then be loaded with the rake db:seed (or created alongside the db with db:setup).
|
3
|
+
#
|
4
|
+
# Examples:
|
5
|
+
#
|
6
|
+
# cities = City.create([{ name: 'Chicago' }, { name: 'Copenhagen' }])
|
7
|
+
# Mayor.create(name: 'Emanuel', city: cities.first)
|
8
|
+
delivery_method_was = ActionMailer::Base.delivery_method
|
9
|
+
ActionMailer::Base.delivery_method = :test
|
10
|
+
|
11
|
+
db_seed = VolontariatSeed.new
|
12
|
+
db_seed.create_fixtures
|
13
|
+
|
14
|
+
ActionMailer::Base.delivery_method = delivery_method_was
|
@@ -0,0 +1,171 @@
|
|
1
|
+
#module Applicat::Mvc::Controller
|
2
|
+
module Applicat
|
3
|
+
module Mvc
|
4
|
+
module Controller
|
5
|
+
def self.included(base)
|
6
|
+
base.class_eval do
|
7
|
+
include RailsInfo::Controller::ExceptionDiagnostics
|
8
|
+
|
9
|
+
include ErrorHandling
|
10
|
+
include TransitionActions
|
11
|
+
|
12
|
+
protect_from_forgery
|
13
|
+
|
14
|
+
layout proc { |controller| controller.request.xhr? || !controller.params[:is_ajax_request].nil? ? false : 'application' }
|
15
|
+
|
16
|
+
helper :all
|
17
|
+
helper_method :controller_action?, :resource_exists?, :layout_presenter
|
18
|
+
|
19
|
+
def controller_action?(input_controller, input_action)
|
20
|
+
if "#{input_controller}/#{input_action}" == "#{controller_name}/#{action_name}"
|
21
|
+
return true
|
22
|
+
else
|
23
|
+
return false
|
24
|
+
end
|
25
|
+
end
|
26
|
+
|
27
|
+
def resource_exists?(name)
|
28
|
+
if eval("@#{name}.nil?") || (eval("@#{name}.class.name") != name.classify && eval("@#{name}.class.superclass.name") != name.classify) || eval("@#{name}.id.nil?")
|
29
|
+
return false
|
30
|
+
else
|
31
|
+
return true
|
32
|
+
end
|
33
|
+
end
|
34
|
+
|
35
|
+
def help
|
36
|
+
helper = Helper.instance
|
37
|
+
helper.controller = self
|
38
|
+
return helper
|
39
|
+
end
|
40
|
+
|
41
|
+
def layout_presenter
|
42
|
+
layout_name = _layout
|
43
|
+
|
44
|
+
if layout_name.inspect.match('.')
|
45
|
+
# app/views/layouts/application.html.erb
|
46
|
+
layout_name = layout_name.inspect.gsub('"', '').split('/').last.split('.').first
|
47
|
+
end
|
48
|
+
|
49
|
+
@layout_presenter ||= "Layout::#{layout_name.classify}Presenter".constantize.new(
|
50
|
+
self.view_context, resource: self.respond_to?(:resource) ? resource : nil
|
51
|
+
)
|
52
|
+
end
|
53
|
+
|
54
|
+
protected
|
55
|
+
|
56
|
+
def eager_load_polymorphs(list, includes)
|
57
|
+
polymorphs = {}
|
58
|
+
|
59
|
+
logger.debug "eager_load_polymorphs for list length: #{list.length}"
|
60
|
+
|
61
|
+
list.each do |record|
|
62
|
+
includes.each do |include|
|
63
|
+
include = include.first if include.is_a?(Array)
|
64
|
+
|
65
|
+
polymorphs[eval("record.#{include}_type")] ||= []
|
66
|
+
polymorphs[eval("record.#{include}_type")] << eval("record.#{include}_id")
|
67
|
+
end
|
68
|
+
end
|
69
|
+
|
70
|
+
logger.debug "Load polymorphs: #{polymorphs.keys.join(', ')}"
|
71
|
+
|
72
|
+
polymorphs.each do |type,ids|
|
73
|
+
polymorphs[type] = type.constantize.find(ids)
|
74
|
+
end
|
75
|
+
|
76
|
+
list_index = 0
|
77
|
+
|
78
|
+
list.each do |record|
|
79
|
+
includes.each do |include|
|
80
|
+
polymorphs[eval("record.#{include}_type")].each do |polymorph|
|
81
|
+
next unless polymorph.id == eval("record.#{include}_id")
|
82
|
+
|
83
|
+
eval("list[list_index].#{include} = polymorph")
|
84
|
+
|
85
|
+
break
|
86
|
+
end
|
87
|
+
end
|
88
|
+
|
89
|
+
list_index += 1
|
90
|
+
end
|
91
|
+
|
92
|
+
# free memory
|
93
|
+
polymorphs.each do |type,ids|
|
94
|
+
polymorphs.delete(type)
|
95
|
+
end
|
96
|
+
|
97
|
+
return list
|
98
|
+
end
|
99
|
+
|
100
|
+
def model_name
|
101
|
+
self.class.name.gsub('Controller', '').classify
|
102
|
+
end
|
103
|
+
|
104
|
+
def set_i18n_locale_from_params
|
105
|
+
if params[:locale]
|
106
|
+
if I18n.available_locales.include?(params[:locale].to_sym)
|
107
|
+
I18n.locale = params[:locale]
|
108
|
+
else
|
109
|
+
flash.now[:notice] = "#{params[:locale]} translation not available"
|
110
|
+
logger.error flash.now[:notice]
|
111
|
+
end
|
112
|
+
end
|
113
|
+
end
|
114
|
+
|
115
|
+
def js_help
|
116
|
+
js_helper = JavaScriptHelper.instance
|
117
|
+
js_helper.controller = self
|
118
|
+
return js_helper
|
119
|
+
end
|
120
|
+
|
121
|
+
def store_location
|
122
|
+
session[:"user.return_to"] = request.fullpath
|
123
|
+
end
|
124
|
+
|
125
|
+
private
|
126
|
+
|
127
|
+
def exception_action(exception)
|
128
|
+
@exception_catched = true
|
129
|
+
|
130
|
+
if Rails.env == 'production'
|
131
|
+
notify_airbrake(exception)
|
132
|
+
logger.error "INTERNAL SERVER ERROR FOR REQUEST: " + exception.message
|
133
|
+
logger.error exception.backtrace.join("\n")
|
134
|
+
else
|
135
|
+
raise exception
|
136
|
+
end
|
137
|
+
|
138
|
+
if !request.env['REQUEST_URI'].match(/\/assets\//).nil?
|
139
|
+
render :text => '', :layout => false
|
140
|
+
elsif exception.is_a?(ActiveRecord::RecordNotFound)
|
141
|
+
render 'pages/exception_404', :layout => 'application'
|
142
|
+
else
|
143
|
+
render 'pages/exception_500', :layout => 'application'
|
144
|
+
end
|
145
|
+
end
|
146
|
+
end
|
147
|
+
end
|
148
|
+
|
149
|
+
class Helper
|
150
|
+
include Singleton
|
151
|
+
#include ActionView::Helpers::TextHelper
|
152
|
+
include ActionView::Helpers
|
153
|
+
include ActionView::Helpers::CaptureHelper
|
154
|
+
include ActionView::Helpers::UrlHelper
|
155
|
+
|
156
|
+
attr_accessor :controller
|
157
|
+
|
158
|
+
# Proxy Pattern use here cause of NoMethodError at help.link_to('destroy', send("#{@resource_class.name.downcase}_path", @resource_instance), :confirm => 'Are you sure?', :method => :delete) in presenters
|
159
|
+
# undefined method `protect_against_forgery?' for #<ApplicationController::Helper:0x804da10>
|
160
|
+
def method_missing(name, *args)
|
161
|
+
@controller.send(name, *args) unless @controller.nil?
|
162
|
+
end
|
163
|
+
end
|
164
|
+
|
165
|
+
class JavaScriptHelper
|
166
|
+
include Singleton
|
167
|
+
include ActionView::Helpers::JavaScriptHelper
|
168
|
+
end
|
169
|
+
end
|
170
|
+
end
|
171
|
+
end
|