Skip to content

Commit

Permalink
use extends instead of override and refactor helper
Browse files Browse the repository at this point in the history
add overloads
  • Loading branch information
eliegaboriau committed Jan 20, 2023
1 parent 7d9f016 commit c33e07d
Show file tree
Hide file tree
Showing 6 changed files with 40 additions and 78 deletions.
8 changes: 8 additions & 0 deletions OVERLOADS.md
Original file line number Diff line number Diff line change
Expand Up @@ -166,3 +166,11 @@ end
* `spec/mailers/decidim/budgets/vote_reminder_mailer_spec.rb`
* `spec/services/decidim/budgets/order_reminder_generator_spec.rb`
* `spec/system/admin_reminds_users_with_pending_orders_spec.rb`
## Fix survey validation
* `app/cells/decidim/forms/step_navigation/show.erb`
* `app/packs/src/decidim/decidim_application.js`
* `app/views/decidim/forms/questionnaires/show.html.erb`
* `config/initializers/decidim_verifications.rb`
* `spec/shared/has_questionnaire.rb`
* `spec/system/survey_spec.rb`
50 changes: 0 additions & 50 deletions app/cells/decidim/forms/step_navigation_cell.rb

This file was deleted.

28 changes: 0 additions & 28 deletions app/helpers/decidim/forms/application_helper.rb

This file was deleted.

2 changes: 2 additions & 0 deletions config/initializers/extends.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,5 @@

require "extends/controllers/decidim/devise/account_controller_extends"
require "extends/controllers/decidim/meetings/meetings_controller_extends"
require "extends/cells/decidim/forms/step_navigation_cell_extends"
require "extends/helpers/decidim/forms/application_helper_extends"
15 changes: 15 additions & 0 deletions lib/extends/cells/decidim/forms/step_navigation_cell_extends.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
# frozen_string_literal: true

module Decidim
module Forms
module StepNavigationCellExtends
def errors
options[:errors]
end
end
end
end

Decidim::Forms::StepNavigationCell.class_eval do
prepend(Decidim::Forms::StepNavigationCellExtends)
end
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
# frozen_string_literal: true

module Decidim
module Forms
class ApplicationHelperExtends
def invalid?(responses)
responses.map { |response| response.errors.any? }.any?
end
end
end
end

Decidim::Forms::ApplicationHelper.class_eval do
prepend(Decidim::Forms::ApplicationHelperExtends)
end

0 comments on commit c33e07d

Please sign in to comment.