forked from decidim/decidim
-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add recipient selection and preview for Newsletters (decidim#13680)
Co-authored-by: Ivan Vergés <ivan@pokecode.net>
- Loading branch information
1 parent
28afd3a
commit 3834c44
Showing
23 changed files
with
1,196 additions
and
303 deletions.
There are no files selected for viewing
10 changes: 10 additions & 0 deletions
10
decidim-admin/app/cells/decidim/admin/multi_select_picker/show.erb
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,10 @@ | ||
<%= select_tag field_name, | ||
options_for_select( | ||
cell_options_for_select.map { |option| [option[0], option[1]] }, | ||
selected_values | ||
), | ||
id: select_id, | ||
class: css_classes, | ||
placeholder:, | ||
multiple: true, | ||
data: { multiselect: true } %> |
38 changes: 38 additions & 0 deletions
38
decidim-admin/app/cells/decidim/admin/multi_select_picker_cell.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,38 @@ | ||
# frozen_string_literal: true | ||
|
||
module Decidim | ||
module Admin | ||
# Universal cell for rendering multi-select pickers | ||
class MultiSelectPickerCell < Decidim::ViewModel | ||
include ActionView::Helpers::FormOptionsHelper | ||
|
||
def show | ||
render :show | ||
end | ||
|
||
def cell_options_for_select | ||
context[:options_for_select] || [] | ||
end | ||
|
||
def selected_values | ||
context[:selected_values] || [] | ||
end | ||
|
||
def select_id | ||
context[:select_id] | ||
end | ||
|
||
def field_name | ||
context[:field_name] | ||
end | ||
|
||
def placeholder | ||
context[:placeholder] || "" | ||
end | ||
|
||
def css_classes | ||
context[:class] || "" | ||
end | ||
end | ||
end | ||
end |
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
Oops, something went wrong.