voluntary 0.3.0 → 0.4.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (62) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +9 -0
  3. data/README.md +1 -1
  4. data/app/assets/javascripts/voluntary/lib/jquery-competitive_list.js +533 -0
  5. data/app/controllers/comments_controller.rb +1 -3
  6. data/app/controllers/concerns/voluntary/v1/base_controller.rb +1 -5
  7. data/app/controllers/home_controller.rb +0 -1
  8. data/app/controllers/workflow/project_owner_controller.rb +17 -15
  9. data/app/controllers/workflow/tasks_controller.rb +1 -1
  10. data/app/models/ability.rb +3 -7
  11. data/app/models/comment.rb +1 -1
  12. data/app/models/product/music_metadata_enrichment.rb +2 -0
  13. data/app/models/product.rb +0 -27
  14. data/app/models/project.rb +0 -1
  15. data/app/models/project_user.rb +2 -3
  16. data/app/models/user.rb +4 -3
  17. data/app/views/layouts/application.html.erb +0 -4
  18. data/app/views/layouts/shared/_flash_messages.html.erb +2 -2
  19. data/app/views/workflow/project_owner/index.html.erb +7 -7
  20. data/config/locales/en.yml +1 -2
  21. data/config/locales/general/en.yml +2 -8
  22. data/config/locales/workflow/en.yml +1 -5
  23. data/config/routes/workflow.rb +0 -25
  24. data/config/routes.rb +0 -35
  25. data/db/migrate/20131018143613_replace_user_by_polymorphic_resource_in_candidatures.rb +4 -4
  26. data/db/migrate/20150802141840_drop_recruiting_unless_recruiting_plugin_present.rb +59 -0
  27. data/lib/generators/voluntary/install/templates/features/support/paths.rb +0 -14
  28. data/lib/generators/voluntary/product_dummy/templates/config/main_navigation.rb +1 -260
  29. data/lib/generators/voluntary/product_dummy/templates/features/step_definitions/comment_steps.rb +1 -1
  30. data/lib/generators/voluntary/product_dummy/templates/features/step_definitions/custom_web_steps.rb +5 -0
  31. data/lib/generators/voluntary/product_dummy/templates/features/support/integration_sessions_controller.rb +1 -1
  32. data/lib/generators/voluntary/product_dummy/templates/features/support/paths.rb +0 -14
  33. data/lib/voluntary/navigation.rb +34 -74
  34. data/lib/voluntary/test/rspec_helpers/factories.rb +10 -17
  35. data/lib/voluntary/version.rb +1 -1
  36. data/lib/voluntary.rb +1 -2
  37. metadata +37 -44
  38. data/app/assets/javascripts/voluntary/lib/competitive_list.js +0 -484
  39. data/app/controllers/candidatures_controller.rb +0 -84
  40. data/app/controllers/vacancies_controller.rb +0 -88
  41. data/app/controllers/workflow/candidatures_controller.rb +0 -20
  42. data/app/controllers/workflow/vacancies_controller.rb +0 -17
  43. data/app/models/candidature.rb +0 -38
  44. data/app/models/state_machines/candidature.rb +0 -64
  45. data/app/models/state_machines/vacancy.rb +0 -49
  46. data/app/models/vacancy.rb +0 -43
  47. data/app/views/candidatures/_form.html.erb +0 -13
  48. data/app/views/candidatures/edit.html.erb +0 -3
  49. data/app/views/candidatures/index.html.erb +0 -11
  50. data/app/views/candidatures/new.html.erb +0 -3
  51. data/app/views/candidatures/show.html.erb +0 -18
  52. data/app/views/vacancies/_form.html.erb +0 -15
  53. data/app/views/vacancies/edit.html.erb +0 -3
  54. data/app/views/vacancies/index.html.erb +0 -7
  55. data/app/views/vacancies/new.html.erb +0 -3
  56. data/app/views/vacancies/show.html.erb +0 -15
  57. data/app/views/workflow/project_owner/_candidatures.html.erb +0 -32
  58. data/app/views/workflow/project_owner/_vacancies.html.erb +0 -27
  59. data/config/locales/resources/candidature/en.yml +0 -19
  60. data/config/locales/resources/vacancy/en.yml +0 -29
  61. data/lib/generators/voluntary/product_dummy/templates/features/step_definitions/candidature_steps.rb +0 -34
  62. data/lib/generators/voluntary/product_dummy/templates/features/step_definitions/vacancy_steps.rb +0 -32
@@ -1,262 +1,3 @@
1
1
  SimpleNavigation::Configuration.run do |navigation|
2
- navigation.items do |primary|
3
- primary.dom_class = 'nav'
4
- primary.item :root, t('general.index.title'), root_path
5
-
6
- primary.item :areas, t('areas.index.title'), areas_path do |areas|
7
- areas.item :new, t('general.new'), new_area_path
8
-
9
- unless (@area.new_record? rescue true)
10
- areas.item :show, @area.name, area_path(@area) do |area|
11
- if can? :destroy, @area
12
- area.item :destroy, t('general.destroy'), area_path(@area), method: :delete, confirm: t('general.questions.are_you_sure')
13
- end
14
-
15
- area.item :show, t('general.details'), "#{area_path(@area)}#top"
16
- area.item :edit, t('general.edit'), edit_area_path(@area) if can? :edit, @area
17
- area.item :users, t('users.index.title'), area_users_path(@area)
18
- area.item :projects, t('projects.index.title'), area_projects_path(@area)
19
- end
20
- end
21
- end
22
-
23
- primary.item :products, t('products.index.title'), products_path do |products|
24
- products.item :new, t('general.new'), new_product_path
25
-
26
- unless (@product.new_record? rescue true)
27
- products.item :show, @product.name, product_path(@product) do |product|
28
- if can? :edit, @product
29
- product.item :destroy, t('general.destroy'), product_path(@product), method: :delete, confirm: t('general.questions.are_you_sure')
30
- end
31
-
32
- product.item :show, t('general.details'), "#{product_path(@product)}#top"
33
- product.item :edit, t('general.edit'), edit_product_path(@product) if can? :edit, @product
34
-
35
- product.item :projects, t('projects.index.title'), product_projects_path(@product)
36
- end
37
- end
38
- end
39
-
40
- primary.item :projects, t('projects.index.title'), projects_path do |projects|
41
- projects.item :new, t('general.new'), new_project_path
42
-
43
- unless (@project.new_record? rescue true)
44
- projects.item :show, @project.name, project_path(@project) do |project|
45
- if can? :destroy, @project
46
- project.item :destroy, t('general.destroy'), project_path(@project), method: :delete, confirm: t('general.questions.are_you_sure')
47
- end
48
-
49
- project.item :show, t('general.details'), "#{project_path(@project)}#top"
50
- project.item :edit, t('general.edit'), edit_project_path(@project) if can? :edit, @project
51
-
52
- project.item :users, t('users.index.title'), project_users_path(@project)
53
-
54
- project.item :vacancies, t('vacancies.index.title'), project_vacancies_path(@project) do |vacancy|
55
- vacancy.item :new, t('general.new'), new_project_vacancy_path(@project)
56
- end
57
-
58
- project.item :stories, t('stories.index.title'), project_stories_path(@project) do |stories|
59
- stories.item :new, t('general.new'), new_project_story_path(@project)
60
-
61
- unless (@story.new_record? rescue true)
62
- stories.item(:show, @story.name, story_path(@story)) do |story|
63
- if can? :destroy, @story
64
- story.item :destroy, t('general.destroy'), story_path(@story), method: :delete, confirm: t('general.questions.are_you_sure')
65
- end
66
-
67
- story.item :show, t('general.details'), "#{story_path(@story)}#top"
68
- story.item :edit, t('general.edit'), edit_story_path(@story) if can? :edit, @story
69
-
70
- story.item :steps, t('general.steps'), setup_tasks_story_path(@story) do |steps|
71
- steps.item :setup_tasks, t('stories.steps.setup_tasks.title'), setup_tasks_story_path(@story)
72
- steps.item :activate, t('general.events.activate'), activate_story_path(@story)
73
- end
74
-
75
- story.item :tasks, t('tasks.index.title'), story_tasks_path(@story) do |tasks|
76
- tasks.item :new, t('general.new'), new_story_task_path(@story)
77
-
78
- unless (@task.new_record? rescue true)
79
- tasks.item(:show, @task.name, task_path(@task)) do |task|
80
- if can? :destroy, @task
81
- task.item :destroy, t('general.destroy'), task_path(@task), method: :delete, confirm: t('general.questions.are_you_sure')
82
- end
83
-
84
- task.item :show, t('general.details'), "#{task_path(@task)}#top"
85
- task.item :edit, t('general.edit'), edit_task_path(@task) if can? :edit, @task
86
-
87
- task.item :results, t('results.index.title'), task_results_path(@task) do |results|
88
- results.item :new, t('general.new'), new_task_result_path(@task)
89
-
90
- unless (@result.new_record? rescue true)
91
- results.item(:show, @result.name, result_path(@result)) do |result|
92
- if can? :destroy, @result
93
- result.item :destroy, t('general.destroy'), result_path(@result), method: :delete, confirm: t('general.questions.are_you_sure')
94
- end
95
-
96
- result.item :show, t('general.details'), "#{result_path(@result)}#top"
97
- result.item :edit, t('general.edit'), edit_result_path(@result) if can? :edit, @result
98
-
99
- result.item :comments, t('comments.index.title'), "#{story_path(@story)}#comments" do |comments|
100
- comments.item(:new, t('general.new'), new_story_comment_path(@story)) if @comment
101
-
102
- if can? :edit, @comment
103
- comments.item(:edit, t('general.edit'), edit_comment_path(@comment)) if @comment.try(:id)
104
- end
105
- end
106
- end
107
- end
108
- end
109
-
110
- task.item :comments, t('comments.index.title'), "#{story_path(@story)}#comments" do |comments|
111
- comments.item(:new, t('general.new'), new_story_comment_path(@story)) if @comment
112
-
113
- if @comment.try(:id) && can?(:edit, @comment)
114
- comments.item(:edit, t('general.edit'), edit_comment_path(@comment))
115
- end
116
- end
117
- end
118
- end
119
- end
120
-
121
- story.item :comments, t('comments.index.title'), "#{story_path(@story)}#comments" do |comments|
122
- comments.item(:new, t('general.new'), new_story_comment_path(@story)) if @comment
123
-
124
- if @comment.try(:id) && can?(:edit, @comment)
125
- comments.item(:edit, t('general.edit'), edit_comment_path(@comment))
126
- end
127
- end
128
- end
129
- end
130
- end
131
-
132
- project.item :comments, t('comments.index.title'), "#{project_path(@project)}#comments" do |comments|
133
- comments.item(:new, t('general.new'), new_project_comment_path(@project)) if @comment
134
-
135
- if @comment.try(:id) && can?(:edit, @comment)
136
- comments.item(:edit, t('general.edit'), edit_comment_path(@comment))
137
- end
138
- end
139
- end
140
- end
141
- end
142
-
143
- primary.item :vacancies, t('vacancies.index.title'), vacancies_path do |vacancies|
144
- vacancies.item :new, t('general.new'), new_vacancy_path
145
-
146
- unless (@vacancy.new_record? rescue true)
147
- vacancies.item :show, "#{@vacancy.name} @ #{@vacancy.project.name}", vacancy_path(@vacancy) do |vacancy|
148
-
149
- if can? :destroy, @vacancy
150
- vacancy.item :destroy, t('general.destroy'), vacancy_path(@vacancy), method: :delete, confirm: t('general.questions.are_you_sure')
151
- end
152
-
153
- vacancy.item :show, t('general.details'), "#{vacancy_path(@vacancy)}#top"
154
- vacancy.item :edit, t('general.edit'), edit_vacancy_path(@vacancy) if can? :edit, @vacancy
155
-
156
- vacancy.item :candidatures, t('candidatures.index.title'), vacancy_candidatures_path(@vacancy) do |candidatures|
157
- candidatures.item :new, t('general.new'), new_vacancy_candidature_path(@vacancy)
158
-
159
- unless (@candidature.new_record? rescue true)
160
- candidatures.item(
161
- :show, t('activerecord.models.candidature') + " of #{@candidature.user.name} @ #{@candidature.vacancy.project.name}",
162
- candidature_path(@candidature)
163
- ) do |candidature|
164
- if can? :destroy, @candidature
165
- candidature.item :destroy, t('general.destroy'), candidature_path(@candidature), method: :delete, confirm: t('general.questions.are_you_sure')
166
- end
167
-
168
- candidature.item :show, t('general.details'), "#{candidature_path(@candidature)}#top"
169
- candidature.item :edit, t('general.edit'), edit_candidature_path(@candidature) if can? :edit, @candidature
170
-
171
- candidature.item :comments, t('comments.index.title'), "#{candidature_path(@candidature)}#comments" do |comments|
172
- comments.item(:new, t('general.new'), new_candidature_comment_path(@candidature)) if @comment
173
-
174
- if @comment.try(:id) && can?(:edit, @comment)
175
- comments.item(:edit, t('general.edit'), edit_comment_path(@comment))
176
- end
177
- end
178
- end
179
- end
180
- end
181
-
182
- vacancy.item :comments, t('comments.index.title'), "#{vacancy_path(@vacancy)}#comments" do |comments|
183
- comments.item(:new, t('general.new'), new_vacancy_comment_path(@vacancy)) if @comment && !@candidature
184
-
185
- if @comment.try(:id) && can?(:edit, @comment)
186
- comments.item(:edit, t('general.edit'), edit_comment_path(@comment))
187
- end
188
- end
189
- end
190
- end
191
- end
192
-
193
- primary.item :users, t('users.index.title'), users_path do |users|
194
- unless (@user.new_record? rescue true) || current_user.try(:id) == @user.id
195
- users.item :show, t('general.details'), "#{user_path(@user)}#top"
196
-
197
- users.item :projects, t('projects.index.title'), user_projects_path(@user)
198
- users.item :candidatures, t('candidatures.index.title'), user_candidatures_path(@user)
199
- end
200
- end
201
-
202
- if user_signed_in?
203
- primary.item :workflow, t('workflow.index.title'), workflow_path do |workflow|
204
- workflow.item :project_owner, t('workflow.project_owner.index.title'), workflow_project_owner_index_path do |project_owner|
205
- project_owner.item :vacancies, t('vacancies.index.title'), open_workflow_vacancies_path do |vacancies|
206
- Vacancy::STATES.each do |state|
207
- vacancies.item state, t("vacancies.show.states.#{state}"), eval("#{state}_workflow_vacancies_path")
208
- end
209
- end
210
-
211
- project_owner.item :candidatures, t('candidatures.index.title'), new_workflow_candidatures_path do |candidatures|
212
- Candidature::STATES.each do |state|
213
- candidatures.item state, t("candidatures.show.states.#{state}"), eval("#{state}_workflow_candidatures_path")
214
- end
215
- end
216
- end
217
-
218
- workflow.item :user, t('workflow.user.index.title'), workflow_user_index_path do |user|
219
- {
220
- 'no-name' => t('workflow.user.products.no_name.title')
221
- }.each do |slug, text|
222
- user.item slug.gsub('-', '_').to_sym, text, product_workflow_user_index_path(slug) do |product|
223
- product_slug = @story ? (@story.product.try(:to_param) || 'no-name') : 'no-name'
224
-
225
- unless (@story.new_record? rescue true) || product_slug != slug
226
- product.item(:show, @story.name, story_path(@story)) do |story|
227
- story.item :show, t('general.details'), "#{story_path(@story)}#top"
228
-
229
- story.item :tasks, t('tasks.index.title'), tasks_workflow_user_index_path(@story) do |tasks|
230
- unless (@task.new_record? rescue true)
231
- tasks.item(:edit, @task.name, edit_task_workflow_user_index_path(@task))
232
- end
233
- end
234
- end
235
- end
236
-
237
- product.item :next_task, t('workflow.user.tasks.next.title'), next_task_workflow_user_index_path('text-creation')
238
- end
239
- end
240
- end
241
- end
242
-
243
- primary.item :profile, t('users.show.title'), user_path(current_user) do |profile|
244
- profile.item :show, t('users.show.title'), user_path(current_user) do |user|
245
- user.item :show, t('users.show.title'), "#{user_path(current_user)}#top"
246
- user.item :settings, t('users.edit.title'), edit_user_path(current_user)
247
- user.item :preferences, t('users.preferences.title'), preferences_user_path(current_user)
248
- user.item :projects, t('projects.index.title'), user_projects_path(current_user)
249
- user.item :candidatures, t('candidatures.index.title'), user_candidatures_path(current_user)
250
- end
251
- end
252
-
253
- primary.item :sign_out, t('authentication.sign_out'), destroy_user_session_path, method: :delete
254
- else
255
- primary.item :authentication, t('authentication.title'), new_user_session_path do |authentication|
256
- authentication.item :sign_in, t('authentication.sign_in'), new_user_session_path
257
- #authentication.item :rpx_sign_in, t('authentication.rpx_sign_in'), 'a' # link_to_rpx
258
- authentication.item :sign_up, t('authentication.sign_up'), new_user_registration_path
259
- end
260
- end
261
- end
2
+ instance_exec navigation, &Voluntary::Navigation.code
262
3
  end
@@ -1,5 +1,5 @@
1
1
  Given /^a comment$/ do
2
- attributes = { commentable: @project || @vacancy || @candidature }
2
+ attributes = { commentable: @project }
3
3
  attributes[:user_id] ||= @me.id if @me
4
4
  @comment = Factory(:comment, attributes)
5
5
  @comment.reload
@@ -0,0 +1,5 @@
1
+ Then /^I should see the following table:$/ do |expected_table|
2
+ rows = find('table').all('tr')
3
+ table = rows.map { |r| r.all('th,td').map { |c| c.text.strip } }
4
+ expected_table.diff!(table)
5
+ end
@@ -1,7 +1,7 @@
1
1
  class IntegrationSessionsController < ActionController::Base
2
2
  def new
3
3
  @user_id = params[:user_id]
4
- render 'features/support/integration_sessions_form', layout: false
4
+ render file: File.expand_path('./../integration_sessions_form.html.erb', __FILE__), layout: false
5
5
  end
6
6
 
7
7
  def create
@@ -43,20 +43,6 @@ module NavigationHelpers
43
43
 
44
44
  when /the edit project page/
45
45
  edit_project_path(@project)
46
-
47
- # vacancies
48
- when /the vacancy page/
49
- vacancy_path(@vacancy)
50
-
51
- when /the edit vacancy page/
52
- edit_vacancy_path(@vacancy)
53
-
54
- # candidatures
55
- when /the candidature page/
56
- candidature_path(@candidature)
57
-
58
- when /the edit candidature page/
59
- edit_candidature_path(@candidature)
60
46
 
61
47
  # stories
62
48
  when /the new project story page/
@@ -2,6 +2,8 @@ module Voluntary
2
2
  module Navigation
3
3
  class Base
4
4
  @@products = {}
5
+ @@core_menus = [:areas, :products, :organizations, :projects, :users, :workflow, :authentication]
6
+ @@core_menu_codes = {}
5
7
  @@menu_options = {}
6
8
 
7
9
  def self.add_product(slug, text)
@@ -12,6 +14,22 @@ module Voluntary
12
14
  @@products
13
15
  end
14
16
 
17
+ def self.core_menus
18
+ @@core_menus.uniq
19
+ end
20
+
21
+ def self.core_menu_codes
22
+ @@core_menu_codes
23
+ end
24
+
25
+ def self.insert_before_core_menu_item(menu, other_menu)
26
+ @@core_menus.insert(@@core_menus.index(other_menu), menu)
27
+ end
28
+
29
+ def self.add_core_menu_code(resource, code)
30
+ @@core_menu_codes[resource] = code
31
+ end
32
+
15
33
  def self.add_menu_option(resource, option, value)
16
34
  @@menu_options[resource] ||= {}
17
35
  @@menu_options[resource][option] = value
@@ -29,7 +47,7 @@ module Voluntary
29
47
  primary.dom_class = 'nav'
30
48
  primary.item :root, I18n.t('general.index.title'), root_path
31
49
 
32
- [:areas, :products, :organizations, :projects, :vacancies, :users, :workflow, :authentication].each do |resource|
50
+ ::Voluntary::Navigation::Base.core_menus.each do |resource|
33
51
  instance_exec primary, ::Voluntary::Navigation::Base.menu_options(resource), &::Voluntary::Navigation.menu_code(resource)
34
52
  end
35
53
  end
@@ -122,10 +140,6 @@ module Voluntary
122
140
 
123
141
  project.item :users, I18n.t('users.index.title'), project_users_path(@project)
124
142
 
125
- project.item :vacancies, I18n.t('vacancies.index.title'), project_vacancies_path(@project) do |vacancy|
126
- vacancy.item :new, I18n.t('general.new'), new_project_vacancy_path(@project)
127
- end
128
-
129
143
  project.item :stories, I18n.t('stories.index.title'), project_stories_path(@project) do |stories|
130
144
  stories.item :new, I18n.t('general.new'), new_project_story_path(@project)
131
145
 
@@ -214,63 +228,7 @@ module Voluntary
214
228
  end
215
229
  end
216
230
  end
217
- end
218
- when :vacancies
219
- Proc.new do |primary, options|
220
- primary.item :vacancies, I18n.t('vacancies.index.title'), vacancies_path do |vacancies|
221
- vacancies.item :new, I18n.t('general.new'), new_vacancy_path
222
-
223
- unless (@vacancy.new_record? rescue true)
224
- vacancies.item :show, "#{@vacancy.name} @ #{@vacancy.project.name}", vacancy_path(@vacancy) do |vacancy|
225
-
226
- if can? :destroy, @vacancy
227
- vacancy.item :destroy, I18n.t('general.destroy'), vacancy_path(@vacancy), method: :delete, confirm: I18n.t('general.questions.are_you_sure')
228
- end
229
-
230
- vacancy.item :show, I18n.t('general.details'), "#{vacancy_path(@vacancy)}#top"
231
- vacancy.item :edit, I18n.t('general.edit'), edit_vacancy_path(@vacancy) if can? :edit, @vacancy
232
-
233
- vacancy.item :candidatures, I18n.t('candidatures.index.title'), vacancy_candidatures_path(@vacancy) do |candidatures|
234
- candidatures.item :new, I18n.t('general.new'), new_vacancy_candidature_path(@vacancy)
235
-
236
- unless (@candidature.new_record? rescue true)
237
- candidatures.item(
238
- :show, I18n.t('activerecord.models.candidature') + " of #{@candidature.resource.name} @ #{@candidature.vacancy.project.name}",
239
- candidature_path(@candidature)
240
- ) do |candidature|
241
- if can? :destroy, @candidature
242
- candidature.item :destroy, I18n.t('general.destroy'), candidature_path(@candidature), method: :delete, confirm: I18n.t('general.questions.are_you_sure')
243
- end
244
-
245
- candidature.item :show, I18n.t('general.details'), "#{candidature_path(@candidature)}#top"
246
- candidature.item :edit, I18n.t('general.edit'), edit_candidature_path(@candidature) if can? :edit, @candidature
247
-
248
- candidature.item :comments, I18n.t('comments.index.title'), "#{candidature_path(@candidature)}#comments" do |comments|
249
- comments.item(:new, I18n.t('general.new'), new_candidature_comment_path(@candidature)) if @comment
250
-
251
- if @comment.try(:id) && can?(:edit, @comment)
252
- comments.item(:edit, I18n.t('general.edit'), edit_comment_path(@comment))
253
- end
254
- end
255
- end
256
- end
257
- end
258
-
259
- vacancy.item :comments, I18n.t('comments.index.title'), "#{vacancy_path(@vacancy)}#comments" do |comments|
260
- comments.item(:new, I18n.t('general.new'), new_vacancy_comment_path(@vacancy)) if @comment && !@candidature
261
-
262
- if @comment.try(:id) && can?(:edit, @comment)
263
- comments.item(:edit, I18n.t('general.edit'), edit_comment_path(@comment))
264
- end
265
- end
266
-
267
- if options[:after_resource_has_many]
268
- instance_exec vacancy, {}, &options[:after_resource_has_many]
269
- end
270
- end
271
- end
272
- end
273
- end
231
+ end
274
232
  when :users
275
233
  Proc.new do |primary, options|
276
234
  primary.item :users, I18n.t('users.index.title'), users_path do |users|
@@ -278,7 +236,6 @@ module Voluntary
278
236
  users.item :show, I18n.t('general.details'), "#{user_path(@user)}#top"
279
237
 
280
238
  users.item :projects, I18n.t('projects.index.title'), user_projects_path(@user)
281
- users.item :candidatures, I18n.t('candidatures.index.title'), user_candidatures_path(@user)
282
239
 
283
240
  if options[:after_resource_has_many]
284
241
  instance_exec users, {}, &options[:after_resource_has_many]
@@ -291,16 +248,8 @@ module Voluntary
291
248
  if user_signed_in?
292
249
  primary.item :workflow, I18n.t('workflow.index.title'), workflow_path do |workflow|
293
250
  workflow.item :project_owner, I18n.t('workflow.project_owner.index.title'), workflow_project_owner_index_path do |project_owner|
294
- project_owner.item :vacancies, I18n.t('vacancies.index.title'), open_workflow_vacancies_path do |vacancies|
295
- Vacancy::STATES.each do |state|
296
- vacancies.item state, I18n.t("vacancies.show.states.#{state}"), eval("#{state}_workflow_vacancies_path")
297
- end
298
- end
299
-
300
- project_owner.item :candidatures, I18n.t('candidatures.index.title'), new_workflow_candidatures_path do |candidatures|
301
- Candidature::STATES.each do |state|
302
- candidatures.item state, I18n.t("candidatures.show.states.#{state}"), eval("#{state}_workflow_candidatures_path")
303
- end
251
+ if options[:project_owner_menu_items]
252
+ instance_exec project_owner, {}, &options[:project_owner_menu_items]
304
253
  end
305
254
  end
306
255
 
@@ -339,7 +288,10 @@ module Voluntary
339
288
  user.item :settings, I18n.t('users.edit.title'), edit_user_path(current_user)
340
289
  user.item :preferences, I18n.t('users.preferences.title'), preferences_user_path(current_user)
341
290
  user.item :projects, I18n.t('projects.index.title'), user_projects_path(current_user)
342
- user.item :candidatures, I18n.t('candidatures.index.title'), user_candidatures_path(current_user)
291
+
292
+ if options[:profile_menu_items]
293
+ instance_exec user, {}, &options[:profile_menu_items]
294
+ end
343
295
  end
344
296
  end
345
297
 
@@ -352,6 +304,14 @@ module Voluntary
352
304
  end
353
305
  end
354
306
  end
307
+ else
308
+ Proc.new do |primary, options|
309
+ ::Voluntary::Navigation::Base.core_menu_codes.each do |working_resource, code|
310
+ next unless working_resource == resource
311
+
312
+ instance_exec primary, ::Voluntary::Navigation::Base.menu_options(resource), &code
313
+ end
314
+ end
355
315
  end
356
316
  end
357
317
  end
@@ -57,21 +57,6 @@ module Voluntary
57
57
  end
58
58
  end
59
59
 
60
- factory_girl.factory :vacancy do
61
- association :project
62
- sequence(:name) { |n| "vacancy #{n}" }
63
- text Faker::Lorem.sentences(20).join(' ')
64
- limit 1
65
- state 'open'
66
- end
67
-
68
- factory_girl.factory :candidature do
69
- association :resource, factory: :user
70
- association :vacancy
71
- sequence(:name) { |n| "candidature #{n}" }
72
- text Faker::Lorem.sentences(20).join(' ')
73
- end
74
-
75
60
  factory_girl.factory :comment do
76
61
  association :user
77
62
  association :commentable, factory: :project
@@ -87,8 +72,16 @@ module Voluntary
87
72
  state_before 'initialized'
88
73
  state 'tasks_defined'
89
74
 
90
- after_build do |story|
91
- story.tasks << Factory.build(:task, offeror_id: FactoryGirl.create(:project).user_id)
75
+ ignore { task_factory :task }
76
+
77
+ after_build do |story, evaluator|
78
+ if evaluator.task_factory.blank?
79
+ story.event = 'initialization'
80
+ story.state_before = 'new'
81
+ story.state = 'initialized'
82
+ end
83
+
84
+ story.tasks << Factory.build(evaluator.task_factory, offeror_id: story.project.user_id) if evaluator.task_factory
92
85
  end
93
86
  end
94
87
 
@@ -1,3 +1,3 @@
1
1
  module Voluntary
2
- VERSION = '0.3.0'
2
+ VERSION = '0.4.0'
3
3
  end
data/lib/voluntary.rb CHANGED
@@ -32,7 +32,7 @@ require 'simple_form'
32
32
  require 'country_select'
33
33
  require 'diffy'
34
34
  require 'will_paginate'
35
- require 'will_paginate/mongoid'
35
+ require 'will_paginate_mongoid'
36
36
  require 'gon'
37
37
  require 'json'
38
38
  require 'acts_as_api'
@@ -41,7 +41,6 @@ require 'rails-i18n'
41
41
  require 'slim'
42
42
  require 'http_accept_language'
43
43
  require 'typhoeus'
44
- require 'capistrano'
45
44
  require 'jquery-rails'
46
45
  require 'bootstrap-sass-rails'
47
46
  require 'bootstrap-datetimepicker-rails'