Class: Decidim::DiffCell
- Inherits:
-
ViewModel
- Object
- ViewModel
- Decidim::DiffCell
- Includes:
- ActionView::Helpers::FormOptionsHelper, Cell::ViewModel::Partial
- Defined in:
- app/cells/decidim/diff_cell.rb
Overview
This cell renders the diff between :old_data and :new_data.
Instance Method Summary collapse
- #attribute(data) ⇒ Object
- #diff_split(data, direction, format) ⇒ Object
- #diff_split_full(data, format) ⇒ Object
- #diff_unified(data, format) ⇒ Object
- #dropdown_options_for_select(options, value) ⇒ Object
- #html_options ⇒ Object
- #mode_options ⇒ Object
- #path(extra_params) ⇒ Object
Instance Method Details
#attribute(data) ⇒ Object
11 12 13 |
# File 'app/cells/decidim/diff_cell.rb', line 11 def attribute(data) render locals: { data: } end |
#diff_split(data, direction, format) ⇒ Object
19 20 21 |
# File 'app/cells/decidim/diff_cell.rb', line 19 def diff_split(data, direction, format) render locals: { data:, direction:, format: } end |
#diff_split_full(data, format) ⇒ Object
23 24 25 |
# File 'app/cells/decidim/diff_cell.rb', line 23 def diff_split_full(data, format) render locals: { data:, format: } end |
#diff_unified(data, format) ⇒ Object
15 16 17 |
# File 'app/cells/decidim/diff_cell.rb', line 15 def diff_unified(data, format) render locals: { data:, format: } end |
#dropdown_options_for_select(options, value) ⇒ Object
33 34 35 |
# File 'app/cells/decidim/diff_cell.rb', line 33 def (, value) (.map { |opt| [t("versions.dropdown.option_#{opt}"), opt] }, value) end |
#html_options ⇒ Object
41 42 43 |
# File 'app/cells/decidim/diff_cell.rb', line 41 def (%w(unescaped escaped), params["diff-html"]) end |
#mode_options ⇒ Object
37 38 39 |
# File 'app/cells/decidim/diff_cell.rb', line 37 def (%w(unified split), params["diff-mode"]) end |
#path(extra_params) ⇒ Object
27 28 29 30 31 |
# File 'app/cells/decidim/diff_cell.rb', line 27 def path(extra_params) return if [:path].blank? [:path].call(extra_params) end |