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,21 @@
|
|
1
|
+
module I18n
|
2
|
+
module Backend
|
3
|
+
module InterpolationFallbacks
|
4
|
+
def translate(locale, key, options = {})
|
5
|
+
default = extract_non_symbol_default!(options) if options[:default]
|
6
|
+
options.merge!(:default => default) if default
|
7
|
+
|
8
|
+
I18n.fallbacks[locale].each do |fallback|
|
9
|
+
begin
|
10
|
+
result = super(fallback, key, options)
|
11
|
+
return result unless result.nil?
|
12
|
+
rescue I18n::MissingInterpolationArgument
|
13
|
+
end
|
14
|
+
end
|
15
|
+
|
16
|
+
return super(locale, nil, options) if default
|
17
|
+
raise(I18n::MissingInterpolationArgument.new(options, "key: #{key} in locale: #{locale}"))
|
18
|
+
end
|
19
|
+
end
|
20
|
+
end
|
21
|
+
end
|
@@ -0,0 +1,17 @@
|
|
1
|
+
module Model
|
2
|
+
module MongoDb
|
3
|
+
module Commentable
|
4
|
+
def comments
|
5
|
+
mongo_db_document = MongoDbDocument.where(
|
6
|
+
mongo_db_object_id: self.id.to_s, klass_name: self.class.name
|
7
|
+
).first
|
8
|
+
|
9
|
+
if mongo_db_document
|
10
|
+
Comment.where(commentable_type: 'MongoDbDocument', commentable_id: mongo_db_document.id)
|
11
|
+
else
|
12
|
+
[]
|
13
|
+
end
|
14
|
+
end
|
15
|
+
end
|
16
|
+
end
|
17
|
+
end
|
@@ -0,0 +1,23 @@
|
|
1
|
+
module Model
|
2
|
+
module MongoDb
|
3
|
+
module Customizable
|
4
|
+
extend ActiveSupport::Concern
|
5
|
+
|
6
|
+
included do
|
7
|
+
# cache association as a shortcut
|
8
|
+
belongs_to :product
|
9
|
+
|
10
|
+
# for cases like f.object.send(association).klass.new in link_to_add_fields(name, f, association, options = {})
|
11
|
+
after_initialize :cache_product_association
|
12
|
+
|
13
|
+
before_validation :cache_product_association
|
14
|
+
|
15
|
+
private
|
16
|
+
|
17
|
+
def cache_product_association
|
18
|
+
raise NotImplementedError
|
19
|
+
end
|
20
|
+
end
|
21
|
+
end
|
22
|
+
end
|
23
|
+
end
|
@@ -0,0 +1,31 @@
|
|
1
|
+
module Model
|
2
|
+
module MongoDb
|
3
|
+
module Product
|
4
|
+
module Keywords
|
5
|
+
extend ActiveSupport::Concern
|
6
|
+
|
7
|
+
included do
|
8
|
+
field :with_keywords, type: Boolean
|
9
|
+
field :min_number_of_keywords, type: Integer
|
10
|
+
field :max_number_of_keywords, type: Integer
|
11
|
+
|
12
|
+
attr_accessible :with_keywords, :min_number_of_keywords, :max_number_of_keywords
|
13
|
+
|
14
|
+
validate :keyword_settings_present
|
15
|
+
|
16
|
+
private
|
17
|
+
|
18
|
+
def keyword_settings_present
|
19
|
+
return unless self.with_keywords.present?
|
20
|
+
|
21
|
+
[:min_number_of_keywords, :max_number_of_keywords].each do |attribute|
|
22
|
+
if self.send(attribute).blank?
|
23
|
+
errors[attribute] << I18n.t('activerecord.errors.messages.blank')
|
24
|
+
end
|
25
|
+
end
|
26
|
+
end
|
27
|
+
end
|
28
|
+
end
|
29
|
+
end
|
30
|
+
end
|
31
|
+
end
|
@@ -0,0 +1,15 @@
|
|
1
|
+
module Model
|
2
|
+
module MongoDb
|
3
|
+
module StateVersionAttributes
|
4
|
+
extend ActiveSupport::Concern
|
5
|
+
|
6
|
+
included do
|
7
|
+
field :state_before, type: String
|
8
|
+
field :event, type: String
|
9
|
+
field :trigger, type: String
|
10
|
+
field :trigger_object_type, type: String
|
11
|
+
field :trigger_object_id, type: Integer
|
12
|
+
end
|
13
|
+
end
|
14
|
+
end
|
15
|
+
end
|
@@ -0,0 +1,65 @@
|
|
1
|
+
# IMPORTANT: This file is generated by cucumber-rails - edit at your own peril.
|
2
|
+
# It is recommended to regenerate this file in the future when you upgrade to a
|
3
|
+
# newer version of cucumber-rails. Consider adding your own code to a new file
|
4
|
+
# instead of editing this one. Cucumber will automatically load all features/**/*.rb
|
5
|
+
# files.
|
6
|
+
|
7
|
+
|
8
|
+
unless ARGV.any? {|a| a =~ /^gems/} # Don't load anything when running the gems:* tasks
|
9
|
+
|
10
|
+
vendored_cucumber_bin = Dir["#{Rails.root}/vendor/{gems,plugins}/cucumber*/bin/cucumber"].first
|
11
|
+
$LOAD_PATH.unshift(File.dirname(vendored_cucumber_bin) + '/../lib') unless vendored_cucumber_bin.nil?
|
12
|
+
|
13
|
+
begin
|
14
|
+
require 'cucumber/rake/task'
|
15
|
+
|
16
|
+
namespace :cucumber do
|
17
|
+
Cucumber::Rake::Task.new({:ok => 'db:test:prepare'}, 'Run features that should pass') do |t|
|
18
|
+
t.binary = vendored_cucumber_bin # If nil, the gem's binary is used.
|
19
|
+
t.fork = true # You may get faster startup if you set this to false
|
20
|
+
t.profile = 'default'
|
21
|
+
end
|
22
|
+
|
23
|
+
Cucumber::Rake::Task.new({:wip => 'db:test:prepare'}, 'Run features that are being worked on') do |t|
|
24
|
+
t.binary = vendored_cucumber_bin
|
25
|
+
t.fork = true # You may get faster startup if you set this to false
|
26
|
+
t.profile = 'wip'
|
27
|
+
end
|
28
|
+
|
29
|
+
Cucumber::Rake::Task.new({:rerun => 'db:test:prepare'}, 'Record failing features and run only them if any exist') do |t|
|
30
|
+
t.binary = vendored_cucumber_bin
|
31
|
+
t.fork = true # You may get faster startup if you set this to false
|
32
|
+
t.profile = 'rerun'
|
33
|
+
end
|
34
|
+
|
35
|
+
desc 'Run all features'
|
36
|
+
task :all => [:ok, :wip]
|
37
|
+
|
38
|
+
task :statsetup do
|
39
|
+
require 'rails/code_statistics'
|
40
|
+
::STATS_DIRECTORIES << %w(Cucumber\ features features) if File.exist?('features')
|
41
|
+
::CodeStatistics::TEST_TYPES << "Cucumber features" if File.exist?('features')
|
42
|
+
end
|
43
|
+
end
|
44
|
+
desc 'Alias for cucumber:ok'
|
45
|
+
task :cucumber => 'cucumber:ok'
|
46
|
+
|
47
|
+
task :default => :cucumber
|
48
|
+
|
49
|
+
task :features => :cucumber do
|
50
|
+
STDERR.puts "*** The 'features' task is deprecated. See rake -T cucumber ***"
|
51
|
+
end
|
52
|
+
|
53
|
+
# In case we don't have ActiveRecord, append a no-op task that we can depend upon.
|
54
|
+
task 'db:test:prepare' do
|
55
|
+
end
|
56
|
+
|
57
|
+
task :stats => 'cucumber:statsetup'
|
58
|
+
rescue LoadError
|
59
|
+
desc 'cucumber rake task not available (cucumber not installed)'
|
60
|
+
task :cucumber do
|
61
|
+
abort 'Cucumber rake task is not available. Be sure to install cucumber as a gem or plugin'
|
62
|
+
end
|
63
|
+
end
|
64
|
+
|
65
|
+
end
|
@@ -0,0 +1,14 @@
|
|
1
|
+
module ActiveModel
|
2
|
+
module Naming
|
3
|
+
private
|
4
|
+
|
5
|
+
def self.model_name_from_record_or_class(record_or_class)
|
6
|
+
return record_class if record_or_class.is_a?(Class)
|
7
|
+
|
8
|
+
model_name = convert_to_model(record_or_class).class.model_name
|
9
|
+
new_record_or_class = Voluntary::Helpers::Application.root_model_class_name_helper(model_name.constantize.new).constantize.new
|
10
|
+
|
11
|
+
convert_to_model(new_record_or_class).class.model_name
|
12
|
+
end
|
13
|
+
end
|
14
|
+
end
|
@@ -0,0 +1,30 @@
|
|
1
|
+
# Renders an ItemContainer as a <div> element and its containing items as <a> elements.
|
2
|
+
# It only renders 'selected' elements.
|
3
|
+
#
|
4
|
+
# By default, the renderer sets the item's key as dom_id for the rendered <a> element unless the config option <tt>autogenerate_item_ids</tt> is set to false.
|
5
|
+
# The id can also be explicitely specified by setting the id in the html-options of the 'item' method in the config/navigation.rb file.
|
6
|
+
# The ItemContainer's dom_class and dom_id are applied to the surrounding <div> element.
|
7
|
+
#
|
8
|
+
module Vendors
|
9
|
+
module SimpleNavigation
|
10
|
+
module Renderer
|
11
|
+
class BreadcrumbsWithoutMethodLinks < ::SimpleNavigation::Renderer::Breadcrumbs
|
12
|
+
protected
|
13
|
+
|
14
|
+
def a_tags(item_container, parent_list = [])
|
15
|
+
item_container.items.inject([]) do |list, item|
|
16
|
+
if item.method.blank? && item.selected?
|
17
|
+
list << tag_for(item) unless parent_list.join('').match(item.url.split('#').first)
|
18
|
+
|
19
|
+
if include_sub_navigation?(item)
|
20
|
+
list.concat a_tags(item.sub_navigation, list.clone)
|
21
|
+
end
|
22
|
+
end
|
23
|
+
|
24
|
+
list
|
25
|
+
end
|
26
|
+
end
|
27
|
+
end
|
28
|
+
end
|
29
|
+
end
|
30
|
+
end
|
@@ -0,0 +1,34 @@
|
|
1
|
+
module Vendors
|
2
|
+
module SimpleNavigation
|
3
|
+
module Renderer
|
4
|
+
class TwitterSidenav < ::SimpleNavigation::Renderer::Base
|
5
|
+
def render(item_container)
|
6
|
+
content, first_item_selected = '', false
|
7
|
+
|
8
|
+
item_container.items.each do |item|
|
9
|
+
next if [
|
10
|
+
I18n.t('general.edit'), I18n.t('general.destroy'), I18n.t('general.steps')
|
11
|
+
].include?(item.name)
|
12
|
+
|
13
|
+
selected = item.selected? && item.method.blank?
|
14
|
+
klass = selected && !first_item_selected ? 'active' : ''
|
15
|
+
options = {}
|
16
|
+
|
17
|
+
# only highlight on item
|
18
|
+
first_item_selected = true if selected
|
19
|
+
|
20
|
+
if item.method.present?
|
21
|
+
options.merge!(method: item.method, confirm: I18n.t('general.questions.are_you_sure'))
|
22
|
+
end
|
23
|
+
|
24
|
+
content += content_tag :li, link_to(item.name, item.url, options), class: klass
|
25
|
+
end
|
26
|
+
|
27
|
+
ul = content_tag :ul, content, class: 'nav nav-list'
|
28
|
+
|
29
|
+
content_tag :div, ul, class: 'well sidebar-nav'
|
30
|
+
end
|
31
|
+
end
|
32
|
+
end
|
33
|
+
end
|
34
|
+
end
|
data/lib/voluntary.rb
ADDED
@@ -0,0 +1,87 @@
|
|
1
|
+
require 'pg'
|
2
|
+
require 'mongoid'
|
3
|
+
require 'foreman'
|
4
|
+
require 'rails_autolink'
|
5
|
+
require 'rails_info'
|
6
|
+
require 'remotipart'
|
7
|
+
require 'messagebus_ruby_api'
|
8
|
+
require 'devise'
|
9
|
+
require 'omniauth'
|
10
|
+
require 'omniauth-facebook'
|
11
|
+
require 'omniauth-tumblr'
|
12
|
+
require 'omniauth-twitter'
|
13
|
+
require 'cancan'
|
14
|
+
require 'foreigner'
|
15
|
+
require 'ancestry'
|
16
|
+
require 'state_machine'
|
17
|
+
require 'acts_as_list'
|
18
|
+
require 'activerecord-import'
|
19
|
+
require 'koala'
|
20
|
+
require 'ransack'
|
21
|
+
require 'faker'
|
22
|
+
require 'paper_trail'
|
23
|
+
require 'mongoid-history'
|
24
|
+
require 'mongoid_slug'
|
25
|
+
require 'has_scope'
|
26
|
+
require 'friendly_id'
|
27
|
+
require 'wicked'
|
28
|
+
require 'simple-navigation'
|
29
|
+
require 'facebox-rails'
|
30
|
+
require 'simple_form'
|
31
|
+
require 'country_select'
|
32
|
+
require 'diffy'
|
33
|
+
require 'will_paginate'
|
34
|
+
require 'client_side_validations'
|
35
|
+
require 'gon'
|
36
|
+
require 'carrierwave'
|
37
|
+
require 'fog'
|
38
|
+
require 'mini_magick'
|
39
|
+
require 'json'
|
40
|
+
require 'acts_as_api'
|
41
|
+
require 'i18n-inflector-rails'
|
42
|
+
require 'rails-i18n'
|
43
|
+
require 'sidekiq'
|
44
|
+
require 'slim'
|
45
|
+
require 'http_accept_language'
|
46
|
+
require 'typhoeus'
|
47
|
+
require 'capistrano'
|
48
|
+
require 'jquery-rails'
|
49
|
+
require 'jquery-ui-rails'
|
50
|
+
require 'auto_html'
|
51
|
+
require 'twitter-bootstrap-rails'
|
52
|
+
require 'simple-navigation-bootstrap'
|
53
|
+
require 'faraday'
|
54
|
+
require 'faraday_middleware'
|
55
|
+
require 'twitter'
|
56
|
+
require 'sass-rails'
|
57
|
+
require 'coffee-rails'
|
58
|
+
require 'handlebars_assets'
|
59
|
+
require 'uglifier'
|
60
|
+
require 'coffee-script'
|
61
|
+
|
62
|
+
require 'voluntary/helpers/application'
|
63
|
+
require 'voluntary/helpers/collection'
|
64
|
+
require 'voluntary/helpers/comments'
|
65
|
+
require 'voluntary/helpers/form'
|
66
|
+
require 'voluntary/helpers/language'
|
67
|
+
require 'voluntary/helpers/layout'
|
68
|
+
require 'voluntary/helpers/product'
|
69
|
+
require 'voluntary/helpers/show'
|
70
|
+
require 'voluntary/helpers/wizard'
|
71
|
+
|
72
|
+
require 'voluntary/engine'
|
73
|
+
|
74
|
+
module Voluntary
|
75
|
+
end
|
76
|
+
|
77
|
+
if defined?(ActionView::Base)
|
78
|
+
ActionView::Base.send :include, Voluntary::Helpers::Application
|
79
|
+
ActionView::Base.send :include, Voluntary::Helpers::Collection
|
80
|
+
ActionView::Base.send :include, Voluntary::Helpers::Comments
|
81
|
+
ActionView::Base.send :include, Voluntary::Helpers::Form
|
82
|
+
ActionView::Base.send :include, Voluntary::Helpers::Language
|
83
|
+
ActionView::Base.send :include, Voluntary::Helpers::Layout
|
84
|
+
ActionView::Base.send :include, Voluntary::Helpers::Product
|
85
|
+
ActionView::Base.send :include, Voluntary::Helpers::Show
|
86
|
+
ActionView::Base.send :include, Voluntary::Helpers::Wizard
|
87
|
+
end
|
@@ -0,0 +1,11 @@
|
|
1
|
+
module Voluntary
|
2
|
+
class Engine < ::Rails::Engine
|
3
|
+
config.autoload_paths << File.expand_path("../..", __FILE__)
|
4
|
+
config.i18n.load_path += Dir[File.expand_path("../../../config/locales/**/*.{rb,yml}", __FILE__)]
|
5
|
+
config.active_record.observers ||= []
|
6
|
+
|
7
|
+
[:candidature_observer, :story_observer, :task_observer].each do |observer|
|
8
|
+
config.active_record.observers << observer
|
9
|
+
end
|
10
|
+
end
|
11
|
+
end
|
@@ -0,0 +1,69 @@
|
|
1
|
+
module Voluntary
|
2
|
+
module Helpers
|
3
|
+
module Application
|
4
|
+
include AutoHtml
|
5
|
+
|
6
|
+
def self.root_model_class_name_helper(resource)
|
7
|
+
if resource.class.superclass.name == 'ActiveRecord::Base'
|
8
|
+
resource.class.name
|
9
|
+
elsif resource.class.superclass.name == 'Object'
|
10
|
+
# classes like mongo db models without a specific superclass
|
11
|
+
resource.class.name
|
12
|
+
else
|
13
|
+
resource.class.superclass.name
|
14
|
+
end
|
15
|
+
end
|
16
|
+
|
17
|
+
def markdown(text)
|
18
|
+
text = Redcarpet::Markdown.new(Redcarpet::Render::XHTML.new(filter_html: true)).render(text)
|
19
|
+
|
20
|
+
auto_html(text) do
|
21
|
+
youtube(width: 515, height: 300)
|
22
|
+
dailymotion(width: 515, height: 300)
|
23
|
+
vimeo(width: 515, height: 300)
|
24
|
+
google_video(width: 515, height: 300)
|
25
|
+
image
|
26
|
+
|
27
|
+
redcarpet(
|
28
|
+
renderer: Redcarpet::Render::XHTML.new(
|
29
|
+
no_images: true, no_styles: true, hard_wrap: true, with_toc_data: true
|
30
|
+
),
|
31
|
+
markdown_options: { no_intra_emphasis: true, autolink: true, fenced_code_blocks: true }
|
32
|
+
)
|
33
|
+
link :target => "_blank", :rel => "nofollow"
|
34
|
+
end.gsub(/(>https?:\/\/[^\<\\]+)/) do |match|
|
35
|
+
truncate(match)
|
36
|
+
end.html_safe
|
37
|
+
end
|
38
|
+
|
39
|
+
def root_model_class_name(resource)
|
40
|
+
::Voluntary::Helpers::Application.root_model_class_name_helper(resource)
|
41
|
+
end
|
42
|
+
|
43
|
+
def directory_for_resource(resource)
|
44
|
+
resource.class.name.split('::').last.underscore
|
45
|
+
end
|
46
|
+
|
47
|
+
def link_list(collection)
|
48
|
+
raw collection.map{|a| link_to a.name, a}.join(', ')
|
49
|
+
end
|
50
|
+
|
51
|
+
def general_attribute?(attribute)
|
52
|
+
begin
|
53
|
+
t("activerecord.attributes.general.#{attribute}", raise: true)
|
54
|
+
true
|
55
|
+
rescue
|
56
|
+
false
|
57
|
+
end
|
58
|
+
end
|
59
|
+
|
60
|
+
def attribute_translation(attribute, current_resource = nil)
|
61
|
+
current_resource = current_resource || resource
|
62
|
+
|
63
|
+
t("activerecord.attributes.#{root_model_class_name(current_resource).underscore}.#{attribute}",
|
64
|
+
default: t("activerecord.attributes.general.#{attribute}")
|
65
|
+
)
|
66
|
+
end
|
67
|
+
end
|
68
|
+
end
|
69
|
+
end
|