voluntary_recruiting 0.0.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (41) hide show
  1. checksums.yaml +7 -0
  2. data/MIT-LICENSE +20 -0
  3. data/README.md +1 -0
  4. data/Rakefile +26 -0
  5. data/app/controllers/candidatures_controller.rb +84 -0
  6. data/app/controllers/vacancies_controller.rb +88 -0
  7. data/app/controllers/workflow/candidatures_controller.rb +20 -0
  8. data/app/controllers/workflow/vacancies_controller.rb +17 -0
  9. data/app/models/candidature.rb +38 -0
  10. data/app/models/product/recruiting.rb +2 -0
  11. data/app/models/state_machines/candidature.rb +64 -0
  12. data/app/models/state_machines/vacancy.rb +49 -0
  13. data/app/models/vacancy.rb +43 -0
  14. data/app/views/candidatures/_form.html.erb +13 -0
  15. data/app/views/candidatures/edit.html.erb +3 -0
  16. data/app/views/candidatures/index.html.erb +11 -0
  17. data/app/views/candidatures/new.html.erb +3 -0
  18. data/app/views/candidatures/show.html.erb +18 -0
  19. data/app/views/vacancies/_form.html.erb +15 -0
  20. data/app/views/vacancies/edit.html.erb +3 -0
  21. data/app/views/vacancies/index.html.erb +7 -0
  22. data/app/views/vacancies/new.html.erb +3 -0
  23. data/app/views/vacancies/show.html.erb +15 -0
  24. data/app/views/workflow/project_owner/_candidatures.html.erb +32 -0
  25. data/app/views/workflow/project_owner/_vacancies.html.erb +27 -0
  26. data/config/locales/general/en.yml +17 -0
  27. data/config/locales/resources/candidature/en.yml +18 -0
  28. data/config/locales/resources/vacancy/en.yml +33 -0
  29. data/config/routes.rb +67 -0
  30. data/db/migrate/20150711124651_add_recruiting.rb +60 -0
  31. data/lib/tasks/voluntary_recruiting_tasks.rake +4 -0
  32. data/lib/voluntary_recruiting.rb +13 -0
  33. data/lib/voluntary_recruiting/ability.rb +17 -0
  34. data/lib/voluntary_recruiting/concerns/model/project/recruitable.rb +15 -0
  35. data/lib/voluntary_recruiting/concerns/model/project_user/recruitable.rb +19 -0
  36. data/lib/voluntary_recruiting/concerns/model/user/recruitable.rb +17 -0
  37. data/lib/voluntary_recruiting/controller/project_owner_controller.rb +26 -0
  38. data/lib/voluntary_recruiting/engine.rb +22 -0
  39. data/lib/voluntary_recruiting/navigation.rb +106 -0
  40. data/lib/voluntary_recruiting/version.rb +3 -0
  41. metadata +336 -0
@@ -0,0 +1,17 @@
1
+ module VoluntaryRecruiting
2
+ module Concerns
3
+ module Model
4
+ module User
5
+ module Recruitable
6
+ extend ActiveSupport::Concern
7
+
8
+ included do
9
+ has_many :offeror_vacancies, source: :offeror, class_name: 'Vacancy'
10
+ has_many :offeror_candidatures, source: :offeror, class_name: 'Candidature'
11
+ has_many :candidatures, as: :resource
12
+ end
13
+ end
14
+ end
15
+ end
16
+ end
17
+ end
@@ -0,0 +1,26 @@
1
+ module VoluntaryRecruiting
2
+ module Controller
3
+ class ProjectOwnerController
4
+ def self.code
5
+ Proc.new do
6
+ @vacancies = {}
7
+ @candidatures = {}
8
+
9
+ { vacancies: Vacancy::STATES, candidatures: Candidature::STATES }.each do |controller, states|
10
+ query = 'offeror_id = :user_id'
11
+ query += ' OR author_id = :user_id' if controller == :vacancies
12
+ query = "(#{query}) AND state = :state"
13
+
14
+ states.each do |state|
15
+ # eval("@#{controller}[state] = current_user.offeror_#{controller}.where(state: state).limit(5)")
16
+ collection = controller.to_s.classify.constantize.where(
17
+ query, user_id: current_user.id, state: state
18
+ ).order('created_at DESC').limit(5)
19
+ eval("@#{controller}[state] = collection")
20
+ end
21
+ end
22
+ end
23
+ end
24
+ end
25
+ end
26
+ end
@@ -0,0 +1,22 @@
1
+ module VoluntaryRecruiting
2
+ class Engine < ::Rails::Engine
3
+ config.autoload_paths << File.expand_path("../../../app/models/concerns", __FILE__)
4
+ config.autoload_paths << File.expand_path("../../../app/controllers/concerns", __FILE__)
5
+ config.i18n.load_path += Dir[File.expand_path("../../../config/locales/**/*.{rb,yml}", __FILE__)]
6
+
7
+ config.generators do |g|
8
+ g.orm :active_record
9
+ end
10
+
11
+ config.to_prepare do
12
+ User.send :include, ::VoluntaryRecruiting::Concerns::Model::User::Recruitable
13
+ ProjectUser.send :include, ::VoluntaryRecruiting::Concerns::Model::ProjectUser::Recruitable
14
+ Project.send :include, ::VoluntaryRecruiting::Concerns::Model::Project::Recruitable
15
+ Voluntary::Navigation::Base.insert_before_core_menu_item :vacancies, :users
16
+ Voluntary::Navigation::Base.add_core_menu_code :vacancies, VoluntaryRecruiting::Navigation.core_menu_codes(:vacancies)
17
+ VoluntaryRecruiting::Navigation.voluntary_menu_customization
18
+ Workflow::ProjectOwnerController.add_tabs_data ['vacancies', 'candidatures'], VoluntaryRecruiting::Controller::ProjectOwnerController.code
19
+ ::Ability.add_after_initialize_callback VoluntaryRecruiting::Ability.after_initialize
20
+ end
21
+ end
22
+ end
@@ -0,0 +1,106 @@
1
+ module VoluntaryRecruiting
2
+ module Navigation
3
+ def self.voluntary_menu_customization
4
+ {
5
+ organizations: {
6
+ after_resource_has_many: Proc.new do |users, options|
7
+ users.item :candidatures, I18n.t('candidatures.index.title'), user_candidatures_path(@user)
8
+ end
9
+ },
10
+ projects: {
11
+ after_resource_has_many: Proc.new do |project, options|
12
+ project.item :vacancies, I18n.t('vacancies.index.title'), project_vacancies_path(@project) do |vacancy|
13
+ vacancy.item :new, I18n.t('general.new'), new_project_vacancy_path(@project)
14
+ end
15
+ end
16
+ },
17
+ workflow: {
18
+ project_owner_menu_items: Proc.new do |project_owner, options|
19
+ project_owner.item :vacancies, I18n.t('vacancies.index.title'), open_workflow_vacancies_path do |vacancies|
20
+ Vacancy::STATES.each do |state|
21
+ vacancies.item state, I18n.t("vacancies.show.states.#{state}"), eval("#{state}_workflow_vacancies_path")
22
+ end
23
+ end
24
+
25
+ project_owner.item :candidatures, I18n.t('candidatures.index.title'), new_workflow_candidatures_path do |candidatures|
26
+ Candidature::STATES.each do |state|
27
+ candidatures.item state, I18n.t("candidatures.show.states.#{state}"), eval("#{state}_workflow_candidatures_path")
28
+ end
29
+ end
30
+ end
31
+ },
32
+ authentication: {
33
+ profile_menu_items: Proc.new do |user, options|
34
+ user.item :candidatures, I18n.t('candidatures.index.title'), user_candidatures_path(current_user)
35
+ end
36
+ }
37
+ }.each do |resource, options|
38
+ options.each do |option, value|
39
+ ::Voluntary::Navigation::Base.add_menu_option(resource, option, value)
40
+ end
41
+ end
42
+ end
43
+
44
+ def self.core_menu_codes(resource)
45
+ case resource
46
+ when :vacancies
47
+ Proc.new do |primary, options|
48
+ primary.item :vacancies, I18n.t('vacancies.index.title'), vacancies_path do |vacancies|
49
+ vacancies.item :new, I18n.t('general.new'), new_vacancy_path
50
+
51
+ unless (@vacancy.new_record? rescue true)
52
+ vacancies.item :show, "#{@vacancy.name} @ #{@vacancy.project.name}", vacancy_path(@vacancy) do |vacancy|
53
+
54
+ if can? :destroy, @vacancy
55
+ vacancy.item :destroy, I18n.t('general.destroy'), vacancy_path(@vacancy), method: :delete, confirm: I18n.t('general.questions.are_you_sure')
56
+ end
57
+
58
+ vacancy.item :show, I18n.t('general.details'), "#{vacancy_path(@vacancy)}#top"
59
+ vacancy.item :edit, I18n.t('general.edit'), edit_vacancy_path(@vacancy) if can? :edit, @vacancy
60
+
61
+ vacancy.item :candidatures, I18n.t('candidatures.index.title'), vacancy_candidatures_path(@vacancy) do |candidatures|
62
+ candidatures.item :new, I18n.t('general.new'), new_vacancy_candidature_path(@vacancy)
63
+
64
+ unless (@candidature.new_record? rescue true)
65
+ candidatures.item(
66
+ :show, I18n.t('activerecord.models.candidature') + " of #{@candidature.resource.name} @ #{@candidature.vacancy.project.name}",
67
+ candidature_path(@candidature)
68
+ ) do |candidature|
69
+ if can? :destroy, @candidature
70
+ candidature.item :destroy, I18n.t('general.destroy'), candidature_path(@candidature), method: :delete, confirm: I18n.t('general.questions.are_you_sure')
71
+ end
72
+
73
+ candidature.item :show, I18n.t('general.details'), "#{candidature_path(@candidature)}#top"
74
+ candidature.item :edit, I18n.t('general.edit'), edit_candidature_path(@candidature) if can? :edit, @candidature
75
+
76
+ candidature.item :comments, I18n.t('comments.index.title'), "#{candidature_path(@candidature)}#comments" do |comments|
77
+ comments.item(:new, I18n.t('general.new'), new_candidature_comment_path(@candidature)) if @comment
78
+
79
+ if @comment.try(:id) && can?(:edit, @comment)
80
+ comments.item(:edit, I18n.t('general.edit'), edit_comment_path(@comment))
81
+ end
82
+ end
83
+ end
84
+ end
85
+ end
86
+
87
+ vacancy.item :comments, I18n.t('comments.index.title'), "#{vacancy_path(@vacancy)}#comments" do |comments|
88
+ comments.item(:new, I18n.t('general.new'), new_vacancy_comment_path(@vacancy)) if @comment && !@candidature
89
+
90
+ if @comment.try(:id) && can?(:edit, @comment)
91
+ comments.item(:edit, I18n.t('general.edit'), edit_comment_path(@comment))
92
+ end
93
+ end
94
+
95
+ if options[:after_resource_has_many]
96
+ instance_exec vacancy, {}, &options[:after_resource_has_many]
97
+ end
98
+ end
99
+ end
100
+ end
101
+ end
102
+ end
103
+ end
104
+ end
105
+ end
106
+
@@ -0,0 +1,3 @@
1
+ module VoluntaryRecruiting
2
+ VERSION = "0.0.1"
3
+ end
metadata ADDED
@@ -0,0 +1,336 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: voluntary_recruiting
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.1
5
+ platform: ruby
6
+ authors:
7
+ - Mathias Gawlista
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2015-08-03 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: voluntary
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - "~>"
18
+ - !ruby/object:Gem::Version
19
+ version: 0.4.0
20
+ type: :runtime
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - "~>"
25
+ - !ruby/object:Gem::Version
26
+ version: 0.4.0
27
+ - !ruby/object:Gem::Dependency
28
+ name: letter_opener
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - "~>"
32
+ - !ruby/object:Gem::Version
33
+ version: 1.0.0
34
+ type: :development
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - "~>"
39
+ - !ruby/object:Gem::Version
40
+ version: 1.0.0
41
+ - !ruby/object:Gem::Dependency
42
+ name: oink
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - "~>"
46
+ - !ruby/object:Gem::Version
47
+ version: 0.10.1
48
+ type: :development
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - "~>"
53
+ - !ruby/object:Gem::Version
54
+ version: 0.10.1
55
+ - !ruby/object:Gem::Dependency
56
+ name: awesome_print
57
+ requirement: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - "~>"
60
+ - !ruby/object:Gem::Version
61
+ version: 1.1.0
62
+ type: :development
63
+ prerelease: false
64
+ version_requirements: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - "~>"
67
+ - !ruby/object:Gem::Version
68
+ version: 1.1.0
69
+ - !ruby/object:Gem::Dependency
70
+ name: rspec-rails
71
+ requirement: !ruby/object:Gem::Requirement
72
+ requirements:
73
+ - - "~>"
74
+ - !ruby/object:Gem::Version
75
+ version: '2.0'
76
+ type: :development
77
+ prerelease: false
78
+ version_requirements: !ruby/object:Gem::Requirement
79
+ requirements:
80
+ - - "~>"
81
+ - !ruby/object:Gem::Version
82
+ version: '2.0'
83
+ - !ruby/object:Gem::Dependency
84
+ name: capybara
85
+ requirement: !ruby/object:Gem::Requirement
86
+ requirements:
87
+ - - "~>"
88
+ - !ruby/object:Gem::Version
89
+ version: 1.1.2
90
+ type: :development
91
+ prerelease: false
92
+ version_requirements: !ruby/object:Gem::Requirement
93
+ requirements:
94
+ - - "~>"
95
+ - !ruby/object:Gem::Version
96
+ version: 1.1.2
97
+ - !ruby/object:Gem::Dependency
98
+ name: capybara-webkit
99
+ requirement: !ruby/object:Gem::Requirement
100
+ requirements:
101
+ - - "~>"
102
+ - !ruby/object:Gem::Version
103
+ version: 0.13.0
104
+ type: :development
105
+ prerelease: false
106
+ version_requirements: !ruby/object:Gem::Requirement
107
+ requirements:
108
+ - - "~>"
109
+ - !ruby/object:Gem::Version
110
+ version: 0.13.0
111
+ - !ruby/object:Gem::Dependency
112
+ name: cucumber-rails-training-wheels
113
+ requirement: !ruby/object:Gem::Requirement
114
+ requirements:
115
+ - - "~>"
116
+ - !ruby/object:Gem::Version
117
+ version: 1.0.0
118
+ type: :development
119
+ prerelease: false
120
+ version_requirements: !ruby/object:Gem::Requirement
121
+ requirements:
122
+ - - "~>"
123
+ - !ruby/object:Gem::Version
124
+ version: 1.0.0
125
+ - !ruby/object:Gem::Dependency
126
+ name: timecop
127
+ requirement: !ruby/object:Gem::Requirement
128
+ requirements:
129
+ - - "~>"
130
+ - !ruby/object:Gem::Version
131
+ version: 0.6.1
132
+ type: :development
133
+ prerelease: false
134
+ version_requirements: !ruby/object:Gem::Requirement
135
+ requirements:
136
+ - - "~>"
137
+ - !ruby/object:Gem::Version
138
+ version: 0.6.1
139
+ - !ruby/object:Gem::Dependency
140
+ name: factory_girl_rails
141
+ requirement: !ruby/object:Gem::Requirement
142
+ requirements:
143
+ - - "~>"
144
+ - !ruby/object:Gem::Version
145
+ version: 1.7.0
146
+ type: :development
147
+ prerelease: false
148
+ version_requirements: !ruby/object:Gem::Requirement
149
+ requirements:
150
+ - - "~>"
151
+ - !ruby/object:Gem::Version
152
+ version: 1.7.0
153
+ - !ruby/object:Gem::Dependency
154
+ name: fixture_builder
155
+ requirement: !ruby/object:Gem::Requirement
156
+ requirements:
157
+ - - "~>"
158
+ - !ruby/object:Gem::Version
159
+ version: 0.3.3
160
+ type: :development
161
+ prerelease: false
162
+ version_requirements: !ruby/object:Gem::Requirement
163
+ requirements:
164
+ - - "~>"
165
+ - !ruby/object:Gem::Version
166
+ version: 0.3.3
167
+ - !ruby/object:Gem::Dependency
168
+ name: selenium-webdriver
169
+ requirement: !ruby/object:Gem::Requirement
170
+ requirements:
171
+ - - "~>"
172
+ - !ruby/object:Gem::Version
173
+ version: 2.22.1
174
+ type: :development
175
+ prerelease: false
176
+ version_requirements: !ruby/object:Gem::Requirement
177
+ requirements:
178
+ - - "~>"
179
+ - !ruby/object:Gem::Version
180
+ version: 2.22.1
181
+ - !ruby/object:Gem::Dependency
182
+ name: spork
183
+ requirement: !ruby/object:Gem::Requirement
184
+ requirements:
185
+ - - "~>"
186
+ - !ruby/object:Gem::Version
187
+ version: 1.0rc2
188
+ type: :development
189
+ prerelease: false
190
+ version_requirements: !ruby/object:Gem::Requirement
191
+ requirements:
192
+ - - "~>"
193
+ - !ruby/object:Gem::Version
194
+ version: 1.0rc2
195
+ - !ruby/object:Gem::Dependency
196
+ name: guard-rspec
197
+ requirement: !ruby/object:Gem::Requirement
198
+ requirements:
199
+ - - "~>"
200
+ - !ruby/object:Gem::Version
201
+ version: 3.0.2
202
+ type: :development
203
+ prerelease: false
204
+ version_requirements: !ruby/object:Gem::Requirement
205
+ requirements:
206
+ - - "~>"
207
+ - !ruby/object:Gem::Version
208
+ version: 3.0.2
209
+ - !ruby/object:Gem::Dependency
210
+ name: guard-spork
211
+ requirement: !ruby/object:Gem::Requirement
212
+ requirements:
213
+ - - "~>"
214
+ - !ruby/object:Gem::Version
215
+ version: 1.5.1
216
+ type: :development
217
+ prerelease: false
218
+ version_requirements: !ruby/object:Gem::Requirement
219
+ requirements:
220
+ - - "~>"
221
+ - !ruby/object:Gem::Version
222
+ version: 1.5.1
223
+ - !ruby/object:Gem::Dependency
224
+ name: guard-cucumber
225
+ requirement: !ruby/object:Gem::Requirement
226
+ requirements:
227
+ - - "~>"
228
+ - !ruby/object:Gem::Version
229
+ version: 1.4.0
230
+ type: :development
231
+ prerelease: false
232
+ version_requirements: !ruby/object:Gem::Requirement
233
+ requirements:
234
+ - - "~>"
235
+ - !ruby/object:Gem::Version
236
+ version: 1.4.0
237
+ - !ruby/object:Gem::Dependency
238
+ name: launchy
239
+ requirement: !ruby/object:Gem::Requirement
240
+ requirements:
241
+ - - "~>"
242
+ - !ruby/object:Gem::Version
243
+ version: 2.1.2
244
+ type: :development
245
+ prerelease: false
246
+ version_requirements: !ruby/object:Gem::Requirement
247
+ requirements:
248
+ - - "~>"
249
+ - !ruby/object:Gem::Version
250
+ version: 2.1.2
251
+ - !ruby/object:Gem::Dependency
252
+ name: database_cleaner
253
+ requirement: !ruby/object:Gem::Requirement
254
+ requirements:
255
+ - - "~>"
256
+ - !ruby/object:Gem::Version
257
+ version: 0.7.1
258
+ type: :development
259
+ prerelease: false
260
+ version_requirements: !ruby/object:Gem::Requirement
261
+ requirements:
262
+ - - "~>"
263
+ - !ruby/object:Gem::Version
264
+ version: 0.7.1
265
+ description: Recruiting plugin for voluntary gem.
266
+ email:
267
+ - gawlista@gmail.com
268
+ executables: []
269
+ extensions: []
270
+ extra_rdoc_files: []
271
+ files:
272
+ - MIT-LICENSE
273
+ - README.md
274
+ - Rakefile
275
+ - app/controllers/candidatures_controller.rb
276
+ - app/controllers/vacancies_controller.rb
277
+ - app/controllers/workflow/candidatures_controller.rb
278
+ - app/controllers/workflow/vacancies_controller.rb
279
+ - app/models/candidature.rb
280
+ - app/models/product/recruiting.rb
281
+ - app/models/state_machines/candidature.rb
282
+ - app/models/state_machines/vacancy.rb
283
+ - app/models/vacancy.rb
284
+ - app/views/candidatures/_form.html.erb
285
+ - app/views/candidatures/edit.html.erb
286
+ - app/views/candidatures/index.html.erb
287
+ - app/views/candidatures/new.html.erb
288
+ - app/views/candidatures/show.html.erb
289
+ - app/views/vacancies/_form.html.erb
290
+ - app/views/vacancies/edit.html.erb
291
+ - app/views/vacancies/index.html.erb
292
+ - app/views/vacancies/new.html.erb
293
+ - app/views/vacancies/show.html.erb
294
+ - app/views/workflow/project_owner/_candidatures.html.erb
295
+ - app/views/workflow/project_owner/_vacancies.html.erb
296
+ - config/locales/general/en.yml
297
+ - config/locales/resources/candidature/en.yml
298
+ - config/locales/resources/vacancy/en.yml
299
+ - config/routes.rb
300
+ - db/migrate/20150711124651_add_recruiting.rb
301
+ - lib/tasks/voluntary_recruiting_tasks.rake
302
+ - lib/voluntary_recruiting.rb
303
+ - lib/voluntary_recruiting/ability.rb
304
+ - lib/voluntary_recruiting/concerns/model/project/recruitable.rb
305
+ - lib/voluntary_recruiting/concerns/model/project_user/recruitable.rb
306
+ - lib/voluntary_recruiting/concerns/model/user/recruitable.rb
307
+ - lib/voluntary_recruiting/controller/project_owner_controller.rb
308
+ - lib/voluntary_recruiting/engine.rb
309
+ - lib/voluntary_recruiting/navigation.rb
310
+ - lib/voluntary_recruiting/version.rb
311
+ homepage: http://Volontari.at
312
+ licenses:
313
+ - MIT
314
+ metadata: {}
315
+ post_install_message:
316
+ rdoc_options: []
317
+ require_paths:
318
+ - lib
319
+ required_ruby_version: !ruby/object:Gem::Requirement
320
+ requirements:
321
+ - - ">="
322
+ - !ruby/object:Gem::Version
323
+ version: '0'
324
+ required_rubygems_version: !ruby/object:Gem::Requirement
325
+ requirements:
326
+ - - ">="
327
+ - !ruby/object:Gem::Version
328
+ version: '0'
329
+ requirements: []
330
+ rubyforge_project:
331
+ rubygems_version: 2.4.5
332
+ signing_key:
333
+ specification_version: 4
334
+ summary: Recruiting plugin for crowdsourcing management system voluntary.
335
+ test_files: []
336
+ has_rdoc: