Class: Decidim::VersionCell

Inherits:
ViewModel
  • Object
show all
Includes:
SanitizeHelper, TraceabilityHelper
Defined in:
decidim-core/app/cells/decidim/version_cell.rb

Instance Method Summary collapse

Methods included from SanitizeHelper

#decidim_html_escape, #decidim_sanitize, #decidim_sanitize_newsletter, #decidim_url_escape, included

Methods included from TraceabilityHelper

#render_resource_editor, #render_resource_last_editor

Methods inherited from ViewModel

#call, #current_user

Methods included from FilterParamsHelper

#filter_link_params

Methods included from MarkupHelper

#element_id

Methods included from ReplaceButtonsHelper

#button_to, #submit_tag

Methods included from ActionAuthorizationHelper

#action_authorized_button_to, #action_authorized_link_to, #logged_button_to, #logged_link_to

Methods included from ScopesHelper

#has_visible_scopes?, #scope_name_for_picker, #scopes_picker_field, #scopes_picker_filter, #scopes_picker_tag

Methods included from TranslatableAttributes

#default_locale?

Methods included from DecidimFormHelper

#areas_for_select, #base_error_messages, #decidim_form_for, #decidim_form_slug_url, #editor_field_tag, #form_field_has_error?, #form_required_explanation, #name_with_locale, #scopes_picker_field_tag, #tab_element_class_for, #translated_field_tag

Methods included from ResourceHelper

#linked_classes_filter_values_for, #linked_classes_for, #linked_resources_for, #resource_locator

Instance Method Details

#current_versionObject


12
13
14
# File 'decidim-core/app/cells/decidim/version_cell.rb', line 12

def current_version
  model
end

#default_i18n_scopeObject


71
72
73
# File 'decidim-core/app/cells/decidim/version_cell.rb', line 71

def default_i18n_scope
  "decidim.version.show"
end

#i18n(string, params = {}) ⇒ Object


52
53
54
55
56
57
58
59
60
61
62
63
64
65
# File 'decidim-core/app/cells/decidim/version_cell.rb', line 52

def i18n(string, params = {})
  t(
    string,
    params.merge(
      scope: i18n_scope,
      default: t(
        string,
        params.merge(
          scope: default_i18n_scope
        )
      )
    )
  )
end

#i18n_back_to_resourceObject


32
33
34
# File 'decidim-core/app/cells/decidim/version_cell.rb', line 32

def i18n_back_to_resource
  i18n("back_to_resource")
end

#i18n_changes_titleObject


24
25
26
# File 'decidim-core/app/cells/decidim/version_cell.rb', line 24

def i18n_changes_title
  i18n("changes_at_title", title: resource_title)
end

#i18n_scopeObject


67
68
69
# File 'decidim-core/app/cells/decidim/version_cell.rb', line 67

def i18n_scope
  options[:i18n_scope]
end

#i18n_show_all_versionsObject


40
41
42
# File 'decidim-core/app/cells/decidim/version_cell.rb', line 40

def i18n_show_all_versions
  i18n("show_all_versions")
end

#i18n_version_authorObject


44
45
46
# File 'decidim-core/app/cells/decidim/version_cell.rb', line 44

def i18n_version_author
  i18n("version_author")
end

#i18n_version_created_atObject


48
49
50
# File 'decidim-core/app/cells/decidim/version_cell.rb', line 48

def i18n_version_created_at
  i18n("version_created_at")
end

#i18n_version_numberObject


28
29
30
# File 'decidim-core/app/cells/decidim/version_cell.rb', line 28

def i18n_version_number
  i18n("version_number")
end

#i18n_version_number_out_of_totalObject


36
37
38
# File 'decidim-core/app/cells/decidim/version_cell.rb', line 36

def i18n_version_number_out_of_total
  i18n("version_number_out_of_total", current_version: index, total_count: versioned_resource.versions.count)
end

#indexObject


75
76
77
# File 'decidim-core/app/cells/decidim/version_cell.rb', line 75

def index
  options[:index]
end

#resource_pathObject


79
80
81
# File 'decidim-core/app/cells/decidim/version_cell.rb', line 79

def resource_path
  resource_locator(versioned_resource).path(filter_link_params)
end

#resource_titleObject


8
9
10
# File 'decidim-core/app/cells/decidim/version_cell.rb', line 8

def resource_title
  decidim_html_escape(translated_attribute(versioned_resource.title))
end

#versioned_resourceObject


16
17
18
# File 'decidim-core/app/cells/decidim/version_cell.rb', line 16

def versioned_resource
  options[:versioned_resource]
end

#versions_pathObject


20
21
22
# File 'decidim-core/app/cells/decidim/version_cell.rb', line 20

def versions_path
  options[:versions_path].call
end