voluntary 0.1.0 → 0.2.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (136) hide show
  1. data/app/assets/javascripts/voluntary/application.js +1 -1
  2. data/app/assets/javascripts/voluntary/base.js.coffee +30 -1
  3. data/app/assets/stylesheets/voluntary/application.css +1 -0
  4. data/app/assets/stylesheets/voluntary/base.css.sass +1 -1
  5. data/app/controllers/areas_controller.rb +6 -5
  6. data/app/controllers/candidatures_controller.rb +15 -10
  7. data/app/controllers/concerns/voluntary/v1/base_controller.rb +95 -0
  8. data/app/controllers/devise_extensions/registrations_controller.rb +2 -2
  9. data/app/controllers/organizations_controller.rb +7 -6
  10. data/app/controllers/professions_controller.rb +6 -5
  11. data/app/controllers/projects_controller.rb +11 -6
  12. data/app/controllers/users_controller.rb +2 -2
  13. data/app/controllers/vacancies_controller.rb +14 -5
  14. data/app/controllers/voluntary/api/v1/api_controller.rb +9 -0
  15. data/app/controllers/voluntary/application_controller.rb +2 -66
  16. data/app/controllers/workflow/candidatures_controller.rb +1 -1
  17. data/app/controllers/workflow/products_controller.rb +7 -7
  18. data/app/controllers/workflow/stories_controller.rb +1 -1
  19. data/app/controllers/workflow/tasks_controller.rb +2 -2
  20. data/app/controllers/workflow/user/product/areas_controller.rb +2 -2
  21. data/app/controllers/workflow/user/projects_controller.rb +10 -2
  22. data/app/helpers/voluntary/application_helper.rb +79 -0
  23. data/app/helpers/voluntary/collection_helper.rb +45 -0
  24. data/app/helpers/voluntary/comments_helper.rb +13 -0
  25. data/app/helpers/voluntary/form_helper.rb +46 -0
  26. data/app/helpers/voluntary/language_helper.rb +17 -0
  27. data/app/helpers/voluntary/layout_helper.rb +42 -0
  28. data/app/helpers/voluntary/product_helper.rb +36 -0
  29. data/app/helpers/voluntary/show_helper.rb +67 -0
  30. data/app/helpers/voluntary/wizard_helper.rb +29 -0
  31. data/app/models/ability.rb +20 -4
  32. data/app/models/candidature.rb +10 -7
  33. data/app/models/column.rb +1 -0
  34. data/app/models/concerns/user/extensions.rb +5 -0
  35. data/app/models/concerns/user/listable.rb +10 -0
  36. data/app/models/list.rb +30 -0
  37. data/app/models/list_item.rb +22 -0
  38. data/app/models/organization.rb +1 -0
  39. data/app/models/page.rb +2 -1
  40. data/app/models/product.rb +3 -2
  41. data/app/models/project.rb +2 -2
  42. data/app/models/result.rb +1 -0
  43. data/app/models/role.rb +1 -1
  44. data/app/models/state_machines/candidature.rb +17 -1
  45. data/app/models/state_machines/story.rb +15 -2
  46. data/app/models/state_machines/task.rb +33 -0
  47. data/app/models/story.rb +3 -2
  48. data/app/models/task.rb +44 -6
  49. data/app/models/thing.rb +3 -0
  50. data/app/models/user.rb +15 -4
  51. data/app/models/vacancy.rb +7 -5
  52. data/app/presenters/resources/general/wizards/story/steps/setup_tasks_presenter.rb +1 -1
  53. data/app/presenters/shared/collection/table_presenter.rb +1 -1
  54. data/app/views/candidatures/index.html.erb +1 -1
  55. data/app/views/candidatures/show.html.erb +1 -1
  56. data/app/views/columns/_collection.html.erb +0 -0
  57. data/app/views/comments/_resource.html.erb +1 -1
  58. data/app/views/layouts/application.html.erb +12 -0
  59. data/app/views/layouts/shared/_navigation.html.erb +3 -3
  60. data/app/views/organizations/show.html.erb +0 -1
  61. data/app/views/products/index.html.erb +53 -4
  62. data/app/views/projects/_form.html.erb +1 -0
  63. data/app/views/projects/show.html.erb +2 -1
  64. data/app/views/shared/collection/_list.html.erb +1 -1
  65. data/app/views/shared/resource/_actions.html.erb +2 -2
  66. data/app/views/stories/_column_fields.html.erb +0 -0
  67. data/app/views/stories/_form.html.erb +1 -1
  68. data/app/views/stories/steps/_activate.html.erb +1 -1
  69. data/app/views/workflow/products/show.html.erb +1 -1
  70. data/app/views/workflow/project_owner/_candidatures.html.erb +2 -1
  71. data/app/views/workflow/tasks/_work_head.html.erb +1 -1
  72. data/app/views/workflow/tasks/steps/_complete.html.erb +6 -2
  73. data/app/views/workflow/tasks/steps/_review.html.erb +6 -2
  74. data/app/views/workflow/tasks/steps/_work.html.erb +4 -2
  75. data/app/views/workflow/user/product/areas/show.html.erb +0 -0
  76. data/app/views/workflow/user/projects/show.html.erb +0 -0
  77. data/config/initializers/devise.rb +2 -5
  78. data/config/initializers/filter_parameters_logging.rb +1 -0
  79. data/config/initializers/friendly_id.rb +88 -0
  80. data/config/initializers/wrap_parameters.rb +15 -0
  81. data/config/locales/general/en.yml +15 -9
  82. data/config/locales/resources/story/en.yml +1 -0
  83. data/config/routes.rb +9 -0
  84. data/config/routes/workflow.rb +15 -15
  85. data/db/migrate/20120907144853_create_schema.rb +1 -1
  86. data/db/migrate/20120922201955_create_mongo_db_documents.rb +1 -1
  87. data/db/migrate/20121004132105_create_professions.rb +1 -1
  88. data/db/migrate/20121006162913_add_public_attribute_to_roles.rb +20 -1
  89. data/db/migrate/20130817090734_create_lists.rb +33 -0
  90. data/db/migrate/20131018143613_replace_user_by_polymorphic_resource_in_candidatures.rb +46 -0
  91. data/db/migrate/20140307113214_add_user_id_to_organizations.rb +5 -0
  92. data/lib/api_constraints.rb +10 -0
  93. data/lib/applicat/mvc/model/tree.rb +1 -1
  94. data/lib/concerns/model/base_list_item.rb +30 -0
  95. data/lib/concerns/model/base_thing.rb +50 -0
  96. data/lib/db_seed.rb +15 -4
  97. data/lib/generators/voluntary/install/install_generator.rb +17 -16
  98. data/lib/generators/voluntary/install/templates/app/views/layouts/application.html.erb +17 -1
  99. data/lib/generators/voluntary/install/templates/config/main_navigation.rb +1 -260
  100. data/lib/generators/voluntary/install/templates/features/support/integration_sessions_controller.rb +1 -2
  101. data/lib/generators/voluntary/install/templates/spec/factories.rb +19 -0
  102. data/lib/generators/voluntary/install/templates/spec/support/mongo_database_cleaner.rb +14 -4
  103. data/lib/generators/voluntary/product_dummy/product_dummy_generator.rb +23 -17
  104. data/lib/generators/voluntary/product_dummy/templates/config/database.example.yml +1 -1
  105. data/lib/generators/voluntary/product_dummy/templates/dummy/spec/factories.rb +19 -0
  106. data/lib/generators/voluntary/product_dummy/templates/dummy/spec/spec_helper.rb +75 -0
  107. data/lib/generators/voluntary/product_dummy/templates/features/support/integration_sessions_controller.rb +1 -2
  108. data/lib/generators/voluntary/product_dummy/templates/spec/factories.rb +19 -0
  109. data/lib/voluntary.rb +10 -22
  110. data/lib/voluntary/engine.rb +27 -3
  111. data/lib/voluntary/navigation.rb +358 -0
  112. data/lib/voluntary/test/rspec_helpers/factories.rb +123 -0
  113. data/lib/voluntary/version.rb +1 -1
  114. data/vendor_extensions/active_model/naming.rb +1 -1
  115. metadata +526 -308
  116. data/app/helpers/application_helper.rb +0 -65
  117. data/app/helpers/collection_helper.rb +0 -35
  118. data/app/helpers/comments_helper.rb +0 -11
  119. data/app/helpers/form_helper.rb +0 -43
  120. data/app/helpers/language_helper.rb +0 -15
  121. data/app/helpers/layout_helper.rb +0 -39
  122. data/app/helpers/product_helper.rb +0 -34
  123. data/app/helpers/show_helper.rb +0 -65
  124. data/app/helpers/wizard_helper.rb +0 -27
  125. data/app/observers/candidature_observer.rb +0 -29
  126. data/app/observers/story_observer.rb +0 -6
  127. data/app/observers/task_observer.rb +0 -34
  128. data/lib/voluntary/helpers/application.rb +0 -69
  129. data/lib/voluntary/helpers/collection.rb +0 -35
  130. data/lib/voluntary/helpers/comments.rb +0 -15
  131. data/lib/voluntary/helpers/form.rb +0 -43
  132. data/lib/voluntary/helpers/language.rb +0 -19
  133. data/lib/voluntary/helpers/layout.rb +0 -28
  134. data/lib/voluntary/helpers/product.rb +0 -36
  135. data/lib/voluntary/helpers/show.rb +0 -69
  136. data/lib/voluntary/helpers/wizard.rb +0 -31
@@ -2,6 +2,7 @@
2
2
  <%= render partial: 'shared/form/error_messages', locals: { resource: @project } %>
3
3
 
4
4
  <div class="form-inputs">
5
+ <%= f.input :organization_id, collection: current_user.organizations %>
5
6
  <%= f.input :product_id, collection: Product.all %>
6
7
  <%= f.input :name %>
7
8
  <%= f.input :text, input_html: {style: 'width: 500px; height:300px;'} %>
@@ -4,7 +4,8 @@
4
4
  </h3>
5
5
 
6
6
  <dl class="dl-horizontal">
7
- <%= show_associations :product, :user, :areas %>
7
+ <%= show_attribute(:product, title: t("attributes.product"), value: link_to(resource.product.name, product_path(resource.product))) if resource.product.present? %>
8
+ <%= show_associations :user, :organization, :areas %>
8
9
  <%= show_actions %>
9
10
  </dl>
10
11
 
@@ -10,7 +10,7 @@
10
10
  <th>
11
11
  <% (columns.is_a?(Hash) ? columns.keys : columns).each do |column| %>
12
12
  <strong><%= t(
13
- "activerecord.attributes.general.#{column}",
13
+ "attributes.#{column}",
14
14
  default: t("activerecord.attributes.#{type.singularize}.#{column}")
15
15
  ) %>:</strong>
16
16
 
@@ -9,8 +9,8 @@
9
9
  <% if can? :destroy, resource %>
10
10
  <li>
11
11
  <%= link_to(
12
- t('general.destroy'), resource, id: "#{resource.class.name.tableize.singularize}_#{resource.id}", method: :delete,
13
- confirm: t('general.questions.are_you_sure'),
12
+ t('general.destroy'), polymorphic_or_resource_path(resource), id: "#{resource.class.name.tableize.singularize}_#{resource.id}", method: :delete,
13
+ data: { confirm: t('general.questions.are_you_sure') },
14
14
  onclick: "delete_link('#{resource.class.name.tableize.singularize}_#{resource.id}'); return false;"
15
15
  )
16
16
  %>
File without changes
@@ -1,4 +1,4 @@
1
- <%= simple_form_for(@story, html: {class: 'form-vertical'}) do |f| %>
1
+ <%= simple_form_for(@story, url: @story.new_record? ? stories_path : story_path(@story), as: :story, html: {class: 'form-vertical'}) do |f| %>
2
2
  <%= render partial: 'shared/form/error_messages', locals: { resource: @story } %>
3
3
 
4
4
  <% unless @story.new_record? %>
@@ -1,4 +1,4 @@
1
- <%= simple_form_for(@story, html: {class: 'floating_form form-vertical'}) do |f| %>
1
+ <%= simple_form_for(@story, url: story_path(@story), as: :story, html: {class: 'floating_form form-vertical'}) do |f| %>
2
2
  <%= render partial: 'shared/form/error_messages', locals: { resource: @story } %>
3
3
  <% if step == :activate %>
4
4
  <input type="hidden" name="next_step" value="1"/>
@@ -5,6 +5,6 @@
5
5
  'name' => ->(resource) do
6
6
  link_to resource.name, product_area_workflow_user_index_path(params[:id], resource)
7
7
  end, 'users_count' => nil
8
- }
8
+ }, options: { append_new_link: false }
9
9
  %>
10
10
 
@@ -18,7 +18,8 @@
18
18
  <%= render partial: 'shared/collection/table', locals: {
19
19
  type: 'candidatures', collection: @candidatures[state],
20
20
  columns: {
21
- 'project_id' => 'vacancy.project', 'vacancy_id' => '', 'name' => 'user.name', 'user_id' => ''
21
+ 'project_id' => 'vacancy.project', 'vacancy_id' => '', 'name' => 'user.name',
22
+ 'resource_id' => ''
22
23
  },
23
24
  options: {show_title: false, append_new_link: false }
24
25
  } %>
@@ -1,6 +1,6 @@
1
1
  <h3><%= resource.name %></h3>
2
2
 
3
- <strong><%= t('activerecord.attributes.general.state') %>:</strong> <%= resource.state %>
3
+ <strong><%= t('attributes.state') %>:</strong> <%= resource.state %>
4
4
 
5
5
  <h4><%= t('tasks.show.story_text') %></h4>
6
6
 
@@ -1,7 +1,11 @@
1
- <%= render 'workflow/tasks/work_head', resource: resource %>
1
+ <%= render_product_specific_partial_if_available(
2
+ resource, 'workflow/tasks/work_head'
3
+ ) %>
2
4
 
3
5
  <%= simple_form_for(resource, url: update_task_workflow_user_index_path(resource), html: {class: 'form-horizontal'}) do |f| %>
4
- <%= render 'workflow/tasks/work_form', f: f, resource: resource %>
6
+ <%= render_product_specific_partial_if_available(
7
+ resource, 'workflow/tasks/work_form', f: f, resource: resource
8
+ ) %>
5
9
 
6
10
  <div class="form-actions">
7
11
  <%= f.button :submit %>
@@ -1,7 +1,11 @@
1
- <%= render 'workflow/tasks/work_head', resource: resource %>
1
+ <%= render_product_specific_partial_if_available(
2
+ resource, 'workflow/tasks/work_head'
3
+ ) %>
2
4
 
3
5
  <%= simple_form_for(resource, url: update_task_workflow_user_index_path(resource), html: {class: 'form-horizontal'}) do |f| %>
4
- <%= render 'workflow/tasks/work_form', f: f, resource: resource %>
6
+ <%= render_product_specific_partial_if_available(
7
+ resource, 'workflow/tasks/work_form', f: f, resource: resource
8
+ ) %>
5
9
 
6
10
  <div class="form-actions">
7
11
  <%= f.button :submit %>
@@ -2,8 +2,10 @@
2
2
  resource, 'workflow/tasks/work_head'
3
3
  ) %>
4
4
 
5
- <%= simple_form_for(resource, url: update_task_workflow_user_index_path(resource), html: {class: 'form-horizontal'}) do |f| %>
6
- <%= render 'workflow/tasks/work_form', f: f, resource: resource %>
5
+ <%= simple_form_for(resource, as: :task, url: update_task_workflow_user_index_path(resource), html: {class: 'form-horizontal'}) do |f| %>
6
+ <%= render_product_specific_partial_if_available(
7
+ resource, 'workflow/tasks/work_form', f: f, resource: resource
8
+ ) %>
7
9
 
8
10
  <div class="form-actions">
9
11
  <%= f.button :submit %>
File without changes
File without changes
@@ -71,7 +71,7 @@ Devise.setup do |config|
71
71
  # from others authentication tools as :clearance_sha1, :authlogic_sha512 (then
72
72
  # you should set stretches above to 20 for default behavior) and :restful_authentication_sha1
73
73
  # (then you should set stretches to 10, and copy REST_AUTH_SITE_KEY to pepper)
74
- config.encryptor = :bcrypt
74
+ #config.encryptor = :bcrypt
75
75
 
76
76
  # Setup a pepper to generate the encrypted password.
77
77
  config.pepper = "065eb8798b181ff0ea2c5c16aee0ff8b70e04e2ee6bd6e08b49da46924223e39127d5335e466207d42bf2a045c12be5f90e92012a4f05f7fc6d9f3c875f4c95b"
@@ -136,10 +136,6 @@ Devise.setup do |config|
136
136
  # change their passwords.
137
137
  config.reset_password_within = 6.hours
138
138
 
139
- # ==> Configuration for :token_authenticatable
140
- # Defines name of the authentication token params key
141
- config.token_authentication_key = :auth_token
142
-
143
139
  # TODO: works at least for diaspora repository
144
140
  #config.stateless_token = true
145
141
 
@@ -189,5 +185,6 @@ Devise.setup do |config|
189
185
  # end
190
186
  # manager.default_strategies(:scope => :user).unshift :twitter_oauth
191
187
  # end
188
+ config.secret_key = '3c4cb1dfba4a47b762c39100e0aeaf377be5dc503304a13e94825eb07d922c493d268daabffed67826c1041269ee3168d2156862ab2d9691445d79ab051fc8be'
192
189
  end
193
190
 
@@ -0,0 +1 @@
1
+ Rails.application.config.filter_parameters += [:password]
@@ -0,0 +1,88 @@
1
+ # FriendlyId Global Configuration
2
+ #
3
+ # Use this to set up shared configuration options for your entire application.
4
+ # Any of the configuration options shown here can also be applied to single
5
+ # models by passing arguments to the `friendly_id` class method or defining
6
+ # methods in your model.
7
+ #
8
+ # To learn more, check out the guide:
9
+ #
10
+ # http://norman.github.io/friendly_id/file.Guide.html
11
+
12
+ FriendlyId.defaults do |config|
13
+ # ## Reserved Words
14
+ #
15
+ # Some words could conflict with Rails's routes when used as slugs, or are
16
+ # undesirable to allow as slugs. Edit this list as needed for your app.
17
+ config.use :reserved
18
+
19
+ config.reserved_words = %w(new edit index session login logout users admin
20
+ stylesheets assets javascripts images)
21
+
22
+ # ## Friendly Finders
23
+ #
24
+ # Uncomment this to use friendly finders in all models. By default, if
25
+ # you wish to find a record by its friendly id, you must do:
26
+ #
27
+ # MyModel.friendly.find('foo')
28
+ #
29
+ # If you uncomment this, you can do:
30
+ #
31
+ # MyModel.find('foo')
32
+ #
33
+ # This is significantly more convenient but may not be appropriate for
34
+ # all applications, so you must explicity opt-in to this behavior. You can
35
+ # always also configure it on a per-model basis if you prefer.
36
+ #
37
+ # Something else to consider is that using the :finders addon boosts
38
+ # performance because it will avoid Rails-internal code that makes runtime
39
+ # calls to `Module.extend`.
40
+ #
41
+ # config.use :finders
42
+ #
43
+ # ## Slugs
44
+ #
45
+ # Most applications will use the :slugged module everywhere. If you wish
46
+ # to do so, uncomment the following line.
47
+ #
48
+ # config.use :slugged
49
+ #
50
+ # By default, FriendlyId's :slugged addon expects the slug column to be named
51
+ # 'slug', but you can change it if you wish.
52
+ #
53
+ # config.slug_column = 'slug'
54
+ #
55
+ # When FriendlyId can not generate a unique ID from your base method, it appends
56
+ # a UUID, separated by a single dash. You can configure the character used as the
57
+ # separator. If you're upgrading from FriendlyId 4, you may wish to replace this
58
+ # with two dashes.
59
+ #
60
+ # config.sequence_separator = '-'
61
+ #
62
+ # ## Tips and Tricks
63
+ #
64
+ # ### Controlling when slugs are generated
65
+ #
66
+ # As of FriendlyId 5.0, new slugs are generated only when the slug field is
67
+ # nil, but you if you're using a column as your base method can change this
68
+ # behavior by overriding the `should_generate_new_friendly_id` method that
69
+ # FriendlyId adds to your model. The change below makes FriendlyId 5.0 behave
70
+ # more like 4.0.
71
+ #
72
+ # config.use Module.new {
73
+ # def should_generate_new_friendly_id?
74
+ # slug.blank? || <your_column_name_here>_changed?
75
+ # end
76
+ # }
77
+ #
78
+ # FriendlyId uses Rails's `parameterize` method to generate slugs, but for
79
+ # languages that don't use the Roman alphabet, that's not usually suffient. Here
80
+ # we use the Babosa library to transliterate Russian Cyrillic slugs to ASCII. If
81
+ # you use this, don't forget to add "babosa" to your Gemfile.
82
+ #
83
+ # config.use Module.new {
84
+ # def normalize_friendly_id(text)
85
+ # text.to_slug.normalize! :transliterations => [:russian, :latin]
86
+ # end
87
+ # }
88
+ end
@@ -0,0 +1,15 @@
1
+ # Be sure to restart your server when you modify this file.
2
+ #
3
+ # This file contains settings for ActionController::ParamsWrapper which
4
+ # is enabled by default.
5
+
6
+ # Enable parameter wrapping for JSON. You can disable this by setting :format to an empty array.
7
+ ActiveSupport.on_load(:action_controller) do
8
+ include ActionController::ParamsWrapper
9
+ wrap_parameters format: [:json] if respond_to?(:wrap_parameters)
10
+ end
11
+
12
+ # Disable root element in JSON by default.
13
+ ActiveSupport.on_load(:active_record) do
14
+ self.include_root_in_json = false
15
+ end
@@ -3,6 +3,8 @@ en:
3
3
  index:
4
4
  title: Home
5
5
  new: New
6
+ denied: Denied
7
+ accepted: Accepted
6
8
  edit: Edit
7
9
  destroy: Destroy
8
10
  remove: Remove
@@ -12,7 +14,7 @@ en:
12
14
  list_action: Back to the overview
13
15
  details: Details
14
16
  form:
15
- errors_count: '%{count} prohibited this product from being saved:'
17
+ errors_count: '%{count} prohibited this object from being saved:'
16
18
  successfully_created: Creation successful
17
19
  successfully_updated: Update successful
18
20
  destroyed: Resource destroyed successfully.
@@ -27,13 +29,24 @@ en:
27
29
  not_found: Resource not found.
28
30
  notifications:
29
31
  event_successful: "%{event} successful."
30
-
32
+
33
+ attributes:
34
+ name: Name
35
+ text: Text
36
+ parent: Parent
37
+ project_id: Project
38
+ state: State
39
+ user_id: User
40
+ vacancy_id: Vacancy
41
+ roles: Roles
42
+
31
43
  activerecord:
32
44
  models:
33
45
  area: Area
34
46
  candidature: Candidature
35
47
  comment: Comment
36
48
  product: Product
49
+ organization: Organization
37
50
  project: Project
38
51
  result: Result
39
52
  story: Story
@@ -42,13 +55,6 @@ en:
42
55
  vacancy: Vacancy
43
56
 
44
57
  attributes:
45
- general:
46
- name: Name
47
- parent: Parent
48
- project_id: Project
49
- state: State
50
- user_id: User
51
- vacancy_id: Vacancy
52
58
  comment:
53
59
  name: Subject
54
60
  vacancy:
@@ -11,6 +11,7 @@ en:
11
11
  show:
12
12
  states:
13
13
  completed: Completed
14
+ active: Active
14
15
 
15
16
  edit:
16
17
  title: Edit Story
data/config/routes.rb CHANGED
@@ -37,6 +37,15 @@ Rails.application.routes.draw do
37
37
  end
38
38
  end
39
39
 
40
+ resources :organizations do
41
+ resources :projects
42
+
43
+ collection do
44
+ put :update_multiple
45
+ get :autocomplete
46
+ end
47
+ end
48
+
40
49
  resources :projects do
41
50
  resources :users, only: :index
42
51
  resources :vacancies, only: [:index, :new]
@@ -1,34 +1,34 @@
1
- match 'workflow' => 'workflow#index', as: :workflow
1
+ get 'workflow' => 'workflow#index', as: :workflow
2
2
 
3
3
  namespace 'workflow' do
4
4
  resources :project_owner, only: :index do
5
5
  collection do
6
- match 'tasks/:id/edit' => 'tasks#edit', as: :edit_task
6
+ get 'tasks/:id/edit' => 'tasks#edit', as: :edit_task
7
7
  end
8
8
  end
9
9
 
10
10
  resources :user, only: :index do
11
11
  collection do
12
- match 'products/:id' => 'products#show', as: :product
13
- match 'products/:product_id/areas/:id' => 'user/product/areas#show', as: :product_area
12
+ get 'products/:id' => 'products#show', as: :product
13
+ get 'products/:product_id/areas/:id' => 'user/product/areas#show', as: :product_area
14
14
 
15
- match 'projects/:id' => 'user/projects#show', as: :user_project
15
+ get 'projects/:id' => 'user/projects#show', as: :user_project
16
16
 
17
- match 'stories/:story_id/tasks' => 'tasks#index', as: :tasks
18
- match 'stories/:story_id/tasks/next' => 'tasks#next', as: :next_task
19
- put 'tasks/:id' => 'tasks#update', as: :update_task
20
- match 'tasks/:id/edit' => 'tasks#edit', as: :edit_task
17
+ get 'stories/:story_id/tasks' => 'tasks#index', as: :tasks
18
+ get 'stories/:story_id/tasks/next' => 'tasks#next', as: :next_task
19
+ patch 'tasks/:id' => 'tasks#update', as: :update_task
20
+ get 'tasks/:id/edit' => 'tasks#edit', as: :edit_task
21
21
 
22
- match 'tasks/:id/assign' => 'tasks#assign', as: :assign_task
23
- match 'tasks/:id/review' => 'tasks#review', as: :review_task
24
- match 'tasks/:id/unassign' => 'tasks#unassign', as: :unassign_task
25
- match 'tasks/:id/complete' => 'tasks#complete', as: :complete_task
22
+ get 'tasks/:id/assign' => 'tasks#assign', as: :assign_task
23
+ get 'tasks/:id/review' => 'tasks#review', as: :review_task
24
+ get 'tasks/:id/unassign' => 'tasks#unassign', as: :unassign_task
25
+ get 'tasks/:id/complete' => 'tasks#complete', as: :complete_task
26
26
  end
27
27
  end
28
28
 
29
29
  resources :vacancies, controller: 'vacancies', only: :index do
30
30
  collection do
31
- match '/' => 'vacancies#open', as: :open
31
+ get '/' => 'vacancies#open', as: :open
32
32
 
33
33
  get :autocomplete
34
34
 
@@ -41,7 +41,7 @@ namespace 'workflow' do
41
41
 
42
42
  resources :candidatures, controller: 'candidatures', only: :index do
43
43
  collection do
44
- match '/' => 'candidatures#new', as: :new
44
+ get '/' => 'candidatures#new', as: :new
45
45
 
46
46
  get :autocomplete
47
47
 
@@ -220,4 +220,4 @@ class CreateSchema < ActiveRecord::Migration
220
220
  def down
221
221
  raise 'irreversable migration!'
222
222
  end
223
- end
223
+ end
@@ -1,7 +1,7 @@
1
1
  class CreateMongoDbDocuments < ActiveRecord::Migration
2
2
  def change
3
3
  create_table :mongo_db_documents do |t|
4
- t.integer :mongo_db_object_id
4
+ t.string :mongo_db_object_id
5
5
  t.string :klass_name
6
6
  t.string :name
7
7
  t.string :slug
@@ -6,7 +6,7 @@ class CreateProfessions < ActiveRecord::Migration
6
6
  t.timestamps
7
7
  end
8
8
 
9
- remove_column :users, :profession
9
+ remove_column :users, :profession, :string
10
10
  add_column :users, :profession_id, :integer
11
11
  add_index :users, :profession_id
12
12
  end
@@ -1,6 +1,25 @@
1
1
  class AddPublicAttributeToRoles < ActiveRecord::Migration
2
- def change
2
+ def up
3
3
  add_column :roles, :public, :boolean, default: false
4
+
5
+ roles = []
6
+
7
+ Role.all.each do |role|
8
+ roles << [role.id, ['Project_owner', 'User'].include?(role.name)]
9
+ end
10
+
11
+ roles.each do |role|
12
+ Role.find(role.first).update_attribute(:public, role.second)
13
+ end
14
+
4
15
  add_column :users, :main_role_id, :integer
16
+
17
+ user_role_id = Role.find_or_create_by(name: 'User').id
18
+ User.update_all main_role_id: user_role_id
19
+ end
20
+
21
+ def down
22
+ remove_column :roles, :public, :boolean
23
+ remove_column :users, :main_role_id, :integer
5
24
  end
6
25
  end