-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
cf638e7
commit ff0c4b5
Showing
14 changed files
with
71 additions
and
42 deletions.
There are no files selected for viewing
13 changes: 0 additions & 13 deletions
13
decidim-process-extended/app/decorators/decidim/participatory_process_decorator.rb
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
13 changes: 13 additions & 0 deletions
13
decidim-regulations/app/decorators/decidim/decidim_form_helper_decorator.rb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
# frozen_string_literal: true | ||
|
||
module Decidim::DecidimFormHelperDecorator | ||
def self.decorate | ||
Decidim::DecidimFormHelper.class_eval do | ||
def types_for_select | ||
Decidim::ParticipatoryProcessType.all | ||
end | ||
end | ||
end | ||
end | ||
|
||
::Decidim::DecidimFormHelperDecorator.decorate |
15 changes: 15 additions & 0 deletions
15
decidim-regulations/app/decorators/lib/decidim/filter_form_builder_decorator.rb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
# frozen_string_literal: true | ||
|
||
module Decidim::FilterFormBuilderDecorator | ||
def self.decorate | ||
Decidim::FilterFormBuilder.class_eval do | ||
def types_select(method, collection, options = {}) | ||
fieldset_wrapper(options[:legend_title], "#{method}_types_select_filter") do | ||
super(method, collection, options) | ||
end | ||
end | ||
end | ||
end | ||
end | ||
|
||
::Decidim::FilterFormBuilderDecorator.decorate |
33 changes: 33 additions & 0 deletions
33
decidim-regulations/app/decorators/lib/decidim/form_builder_decorator.rb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
# frozen_string_literal: true | ||
|
||
module Decidim::FormBuilderDecorate | ||
def self.decorate | ||
Decidim::FormBuilder.class_eval do | ||
def types_select(name, collection, options = {}) | ||
selectables = if collection.first.is_a?(Decidim::ParticipatoryProcessType) | ||
collection_transformed = collection | ||
.map { |a| [a.title[I18n.locale.to_s], a.id] } | ||
.sort_by { |arr| arr[0] } | ||
|
||
@template.options_for_select( | ||
collection_transformed, | ||
selected: options[:selected] | ||
) | ||
else | ||
@template.option_groups_from_collection_for_select( | ||
collection, | ||
:types, | ||
:translated_name, | ||
:id, | ||
:translated_name, | ||
selected: options[:selected] | ||
) | ||
end | ||
|
||
select(name, selectables, options) | ||
end | ||
end | ||
end | ||
end | ||
|
||
::Decidim::FormBuilderDecorate.decorate |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters