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
@@ -1,6 +1,6 @@
1
1
  //= require jquery
2
2
  //= require jquery_ujs
3
- //= require twitter/bootstrap
4
3
  //= require jquery-ui-bootstrap
4
+ //= require twitter/bootstrap
5
5
  //= require jquery.tokeninput
6
6
  //= require_tree .
@@ -7,7 +7,36 @@ $(document).ready ->
7
7
  $(v).accordion({ autoHeight: false });
8
8
 
9
9
  $('.tabs').each (k, v) ->
10
- $(v).tabs({ autoHeight: false });
10
+ $(v).tabs
11
+ autoHeight: false
12
+
13
+ beforeLoad: (event, ui) ->
14
+ ui.jqXHR.error ->
15
+ json = null
16
+
17
+ try
18
+ json = jQuery.parseJSON(ui.jqXHR.responseText)
19
+ catch e
20
+
21
+ error = if json && json['error'] then json['error'] else 'Something went wrong'
22
+
23
+ ui.panel.html error
24
+
25
+ $(document).on "click", ".ui-tabs-panel .pagination a", (event) ->
26
+ event.preventDefault()
27
+
28
+ $.get($(this).attr('href'), (data) ->
29
+ $($('.ui-tabs-panel[style*="display: block"]')[0]).html(data)
30
+ ).fail (jqXHR, textStatus, errorThrown) ->
31
+ json = null
32
+
33
+ try
34
+ json = jQuery.parseJSON(jqXHR.responseText)
35
+ catch e
36
+
37
+ error = if json && json['error'] then json['error'] else 'Something went wrong'
38
+
39
+ $($('.ui-tabs-panel[style*="display: block"]')[0]).html(error)
11
40
 
12
41
  $('form').on 'click', '.remove_fields', (event) ->
13
42
  #$(this).prev('input[type=hidden]').val('1')
@@ -9,6 +9,7 @@
9
9
  * compiled file, but it's generally better to create a new file per style scope.
10
10
  *
11
11
  *= require_self
12
+ *= require font-awesome
12
13
  *= require token-input-facebook
13
14
  *= require twitter/bootstrap
14
15
  *= require jquery-ui-bootstrap
@@ -39,7 +39,7 @@ code
39
39
  font-family: Arial
40
40
  font-size: 10px
41
41
 
42
- html, body, div, span
42
+ html, body, div
43
43
  font-family: Arial
44
44
  font-size: 10px
45
45
 
@@ -1,6 +1,8 @@
1
1
  class AreasController < ApplicationController
2
2
  include Applicat::Mvc::Controller::Resource
3
3
 
4
+ before_filter :find_area
5
+
4
6
  load_and_authorize_resource
5
7
 
6
8
  rescue_from ActiveRecord::RecordNotFound, with: :not_found
@@ -17,7 +19,6 @@ class AreasController < ApplicationController
17
19
  end
18
20
 
19
21
  def show
20
- @area = Area.find(params[:id])
21
22
  @areas = @area.children
22
23
  @projects = @area.projects
23
24
  end
@@ -37,12 +38,9 @@ class AreasController < ApplicationController
37
38
  end
38
39
 
39
40
  def edit
40
- @area = Area.find(params[:id])
41
41
  end
42
42
 
43
43
  def update
44
- @area = Area.find(params[:id])
45
-
46
44
  if @area.update_attributes(params[:area])
47
45
  redirect_to @area, notice: t('general.form.successfully_updated')
48
46
  else
@@ -51,7 +49,6 @@ class AreasController < ApplicationController
51
49
  end
52
50
 
53
51
  def destroy
54
- @area = Area.find(params[:id])
55
52
  @area.destroy
56
53
  redirect_to areas_url, notice: t('general.form.destroyed')
57
54
  end
@@ -65,4 +62,8 @@ class AreasController < ApplicationController
65
62
  def not_found
66
63
  redirect_to areas_path, notice: t('areas.exceptions.not_found')
67
64
  end
65
+
66
+ def find_area
67
+ @area = Area.friendly.find(params[:id]) if params[:id].present?
68
+ end
68
69
  end
@@ -1,10 +1,11 @@
1
1
  class CandidaturesController < ApplicationController
2
2
  include Applicat::Mvc::Controller::Resource
3
3
 
4
- load_and_authorize_resource
5
-
4
+ before_filter :find_candidature, only: [:show, :edit, :update, :destroy]
6
5
  before_filter :find_vacancy, only: [:index, :new, :edit]
7
6
 
7
+ load_and_authorize_resource
8
+
8
9
  transition_actions Candidature::EVENTS
9
10
 
10
11
  helper_method :parent
@@ -12,11 +13,14 @@ class CandidaturesController < ApplicationController
12
13
  respond_to :html, :js, :json
13
14
 
14
15
  def index
15
- @candidatures = @vacancy ? @vacancy.candidatures.includes(:vacancy, :user) : Candidature.includes(:vacancy, :user).all
16
+ @candidatures = if @vacancy
17
+ @vacancy.candidatures.includes(:vacancy, :resource)
18
+ else
19
+ Candidature.includes(:vacancy, :resource).where(resource_type: 'User').all
20
+ end
16
21
  end
17
22
 
18
23
  def show
19
- @candidature = Candidature.includes(:vacancy, :user, :comments).find(params[:id])
20
24
  @vacancy = @candidature.vacancy
21
25
  @comments = @candidature.comments
22
26
  end
@@ -28,7 +32,8 @@ class CandidaturesController < ApplicationController
28
32
 
29
33
  def create
30
34
  @candidature = Candidature.new(params[:candidature])
31
- @candidature.user_id = current_user.id
35
+ @candidature.resource_type = 'User'
36
+ @candidature.resource_id = current_user.id
32
37
 
33
38
  if @candidature.save
34
39
  redirect_to @candidature, notice: t('general.form.successfully_created')
@@ -38,12 +43,9 @@ class CandidaturesController < ApplicationController
38
43
  end
39
44
 
40
45
  def edit
41
- @candidature = Candidature.find(params[:id])
42
46
  end
43
47
 
44
48
  def update
45
- @candidature = Candidature.find(params[:id])
46
-
47
49
  if @candidature.update_attributes(params[:candidature])
48
50
  redirect_to @candidature, notice: t('general.form.successfully_updated')
49
51
  else
@@ -52,7 +54,6 @@ class CandidaturesController < ApplicationController
52
54
  end
53
55
 
54
56
  def destroy
55
- @candidature = Candidature.find(params[:id])
56
57
  @candidature.destroy
57
58
  redirect_to candidatures_url, notice: t('general.form.destroyed')
58
59
  end
@@ -73,7 +74,11 @@ class CandidaturesController < ApplicationController
73
74
 
74
75
  private
75
76
 
77
+ def find_candidature
78
+ @candidature = Candidature.includes(:vacancy, :resource, :comments).friendly.find(params[:id])
79
+ end
80
+
76
81
  def find_vacancy
77
- @vacancy = params[:vacancy_id].present? ? Vacancy.find(params[:vacancy_id]) : nil
82
+ @vacancy = params[:vacancy_id].present? ? Vacancy.friendly.find(params[:vacancy_id]) : nil
78
83
  end
79
84
  end
@@ -0,0 +1,95 @@
1
+ module Voluntary
2
+ module V1
3
+ module BaseController
4
+ extend ActiveSupport::Concern
5
+
6
+ included do
7
+ rescue_from CanCan::AccessDenied, with: :access_denied
8
+ rescue_from ActiveRecord::RecordNotFound, with: :not_found
9
+ rescue_from Mongoid::Errors::DocumentNotFound, with: :not_found
10
+
11
+ helper_method :parent, :application_navigation, :navigation_product_path, :navigation_product_name
12
+ end
13
+
14
+ def parent
15
+ @parent
16
+ end
17
+
18
+ protected
19
+
20
+ def application_navigation
21
+ :main
22
+ end
23
+
24
+ def navigation_product_path
25
+ '/'
26
+ end
27
+
28
+ def navigation_product_name
29
+ 'Core'
30
+ end
31
+
32
+ def current_ability
33
+ Ability.new(current_user, controller_namespace: current_namespace)
34
+ end
35
+
36
+ def find_parent(types, parent_key = nil)
37
+ parent_type, id = nil, nil
38
+
39
+ if parent_type = types.select{|p| params.keys.include?("#{p}_id") }.first
40
+ id = params["#{parent_type}_id"]
41
+ elsif parent_type = types.select{|p| params[parent_key] && params[parent_key].keys.include?("#{p}_id") }.first
42
+ id = params[parent_key]["#{parent_type}_id"]
43
+ end
44
+
45
+ return if parent_type.blank?
46
+
47
+ parent = parent_type.classify.constantize
48
+ parent = parent.friendly if parent.respond_to? :friendly
49
+ parent = parent.find(id)
50
+
51
+ root_model_class_name = Voluntary::ApplicationHelper.root_model_class_name_helper(parent)
52
+ eval("@#{root_model_class_name.tableize.singularize} = parent")
53
+
54
+ parent
55
+ end
56
+
57
+ def response_with_standard(format = nil, error = nil)
58
+ render status: error ? 500 : 200, json: { success: error ? false : true, error: error} and return true
59
+ end
60
+
61
+ private
62
+
63
+ def current_namespace
64
+ controller_name_segments = params[:controller].split('/')
65
+ controller_name_segments.pop
66
+ controller_namespace = controller_name_segments.join('/').downcase
67
+ end
68
+
69
+ def access_denied
70
+ message = I18n.t('general.exceptions.access_denied')
71
+
72
+ if request.format.try('json?') || request.xhr?
73
+ render status: 403, json: { error: message } and return
74
+ else
75
+ flash[:alert] = message
76
+
77
+ if request.env["HTTP_REFERER"]
78
+ redirect_to :back
79
+ else
80
+ redirect_to root_path
81
+ end
82
+ end
83
+ end
84
+
85
+ def not_found(e)
86
+ if Rails.env.development?
87
+ raise e
88
+ else
89
+ logger.info "not found (#{e.inspect})"
90
+ redirect_to root_path, notice: t('general.exceptions.not_found')
91
+ end
92
+ end
93
+ end
94
+ end
95
+ end
@@ -10,14 +10,14 @@ class DeviseExtensions::RegistrationsController < Devise::RegistrationsControlle
10
10
 
11
11
  # POST /resource
12
12
  def create
13
- build_resource
13
+ build_resource(params[:user])
14
14
 
15
15
  captcha_verified = if Rails.env == 'production'
16
16
  verify_recaptcha(model: resource, message: I18n.t('general.exceptions.wrong_recaptcha'))
17
17
  else
18
18
  true
19
19
  end
20
-
20
+
21
21
  if captcha_verified && resource.save
22
22
  if resource.active_for_authentication?
23
23
  set_flash_message :notice, :signed_up if is_navigational_format?
@@ -1,6 +1,8 @@
1
1
  class OrganizationsController < ApplicationController
2
2
  include Applicat::Mvc::Controller::Resource
3
3
 
4
+ before_filter :find_organization
5
+
4
6
  load_and_authorize_resource
5
7
 
6
8
  rescue_from ActiveRecord::RecordNotFound, with: :not_found
@@ -18,7 +20,6 @@ class OrganizationsController < ApplicationController
18
20
  end
19
21
 
20
22
  def show
21
- @organization = Organization.find(params[:id])
22
23
  end
23
24
 
24
25
  def new
@@ -26,7 +27,7 @@ class OrganizationsController < ApplicationController
26
27
  end
27
28
 
28
29
  def create
29
- @organization = Organization.new(params[:organization])
30
+ @organization = current_user.organizations.new(params[:organization])
30
31
 
31
32
  if @organization.save
32
33
  redirect_to @organization, notice: t('general.form.successfully_created')
@@ -36,12 +37,9 @@ class OrganizationsController < ApplicationController
36
37
  end
37
38
 
38
39
  def edit
39
- @organization = Organization.find(params[:id])
40
40
  end
41
41
 
42
42
  def update
43
- @organization = Organization.find(params[:id])
44
-
45
43
  if @organization.update_attributes(params[:organization])
46
44
  redirect_to @organization, notice: t('general.form.successfully_updated')
47
45
  else
@@ -50,7 +48,6 @@ class OrganizationsController < ApplicationController
50
48
  end
51
49
 
52
50
  def destroy
53
- @organization = Organization.find(params[:id])
54
51
  @organization.destroy
55
52
  redirect_to organizations_url, notice: t('general.form.destroyed')
56
53
  end
@@ -64,4 +61,8 @@ class OrganizationsController < ApplicationController
64
61
  def not_found
65
62
  redirect_to organizations_path, notice: t('organizations.exceptions.not_found')
66
63
  end
64
+
65
+ def find_organization
66
+ @organization = Organization.friendly.find(params[:id]) if params[:id].present?
67
+ end
67
68
  end
@@ -1,6 +1,8 @@
1
1
  class ProfessionsController < ApplicationController
2
2
  include Applicat::Mvc::Controller::Resource
3
3
 
4
+ before_filter :find_profession
5
+
4
6
  load_and_authorize_resource
5
7
 
6
8
  rescue_from ActiveRecord::RecordNotFound, with: :not_found
@@ -17,7 +19,6 @@ class ProfessionsController < ApplicationController
17
19
  end
18
20
 
19
21
  def show
20
- @profession = Profession.find(params[:id])
21
22
  end
22
23
 
23
24
  def new
@@ -35,12 +36,9 @@ class ProfessionsController < ApplicationController
35
36
  end
36
37
 
37
38
  def edit
38
- @profession = Profession.find(params[:id])
39
39
  end
40
40
 
41
41
  def update
42
- @profession = Profession.find(params[:id])
43
-
44
42
  if @profession.update_attributes(params[:profession])
45
43
  redirect_to @profession, notice: t('general.form.successfully_updated')
46
44
  else
@@ -49,7 +47,6 @@ class ProfessionsController < ApplicationController
49
47
  end
50
48
 
51
49
  def destroy
52
- @profession = Profession.find(params[:id])
53
50
  @profession.destroy
54
51
  redirect_to professions_url, notice: t('general.form.destroyed')
55
52
  end
@@ -63,4 +60,8 @@ class ProfessionsController < ApplicationController
63
60
  def not_found
64
61
  redirect_to professions_path, notice: t('professions.exceptions.not_found')
65
62
  end
63
+
64
+ def find_profession
65
+ @profession = Profession.friendly.find(params[:id]) if params[:id].present?
66
+ end
66
67
  end
@@ -1,6 +1,8 @@
1
1
  class ProjectsController < ApplicationController
2
2
  include Applicat::Mvc::Controller::Resource
3
3
 
4
+ before_filter :find_project
5
+
4
6
  load_and_authorize_resource
5
7
 
6
8
  respond_to :html, :js, :json
@@ -11,12 +13,13 @@ class ProjectsController < ApplicationController
11
13
  end
12
14
 
13
15
  def show
14
- @project = Project.includes(:areas, :comments).find(params[:id])
16
+ @project = Project.includes(:areas, :comments).friendly.find(params[:id])
15
17
  @comments = @project.comments
16
18
  end
17
19
 
18
20
  def new
19
- @project = Project.new
21
+ @parent = find_parent Project::PARENT_TYPES
22
+ @project = @parent ? @parent.projects.new : Project.new
20
23
  end
21
24
 
22
25
  def create
@@ -31,12 +34,9 @@ class ProjectsController < ApplicationController
31
34
  end
32
35
 
33
36
  def edit
34
- @project = Project.find(params[:id])
35
37
  end
36
38
 
37
39
  def update
38
- @project = Project.find(params[:id])
39
-
40
40
  if @project.update_attributes(params[:project])
41
41
  redirect_to @project, notice: t('general.form.successfully_updated')
42
42
  else
@@ -45,7 +45,6 @@ class ProjectsController < ApplicationController
45
45
  end
46
46
 
47
47
  def destroy
48
- @project = Project.find(params[:id])
49
48
  @project.destroy
50
49
  redirect_to projects_url, notice: t('general.form.destroyed')
51
50
  end
@@ -53,4 +52,10 @@ class ProjectsController < ApplicationController
53
52
  def resource
54
53
  @project
55
54
  end
55
+
56
+ private
57
+
58
+ def find_project
59
+ @project = Project.friendly.find(params[:id]) if params[:id].present?
60
+ end
56
61
  end