Module: Decidim::Verifications::ApplicationHelper
- Defined in:
- app/helpers/decidim/verifications/application_helper.rb
Instance Method Summary collapse
- #announcement_title(authorization) ⇒ Object
- #authorization_display_data(authorization) ⇒ Object
- #granted_authorization_button_text(authorization) ⇒ Object
- #granted_authorization_display_data(authorization, redirect_url = nil) ⇒ Object
- #granted_authorization_explanation(authorization) ⇒ Object
- #granted_authorization_remote_url(authorization) ⇒ Object
- #granted_authorization_url(authorization, redirect_url = nil) ⇒ Object
- #pending_authorization_display_data(authorization, redirect_url = nil) ⇒ Object
- #unauthorized_method_display_data(method, redirect_url = nil) ⇒ Object
Instance Method Details
#announcement_title(authorization) ⇒ Object
6 7 8 9 10 11 12 13 14 15 16 17 18 19 |
# File 'app/helpers/decidim/verifications/application_helper.rb', line 6 def announcement_title() return t("decidim.verifications.id_documents.authorizations.edit.being_reviewed") unless .rejected? body = content_tag :ul do items = content_tag(:li, t("decidim.verifications.id_documents.authorizations.edit.rejection_correctness")) items += content_tag(:li, t("decidim.verifications.id_documents.authorizations.edit.rejection_clarity")).html_safe items end { title: t("decidim.verifications.id_documents.authorizations.edit.rejection_notice"), body: } end |
#authorization_display_data(authorization) ⇒ Object
21 22 23 |
# File 'app/helpers/decidim/verifications/application_helper.rb', line 21 def () { title: t("#{.name}.name", scope: "decidim.authorization_handlers") } end |
#granted_authorization_button_text(authorization) ⇒ Object
60 61 62 63 64 65 |
# File 'app/helpers/decidim/verifications/application_helper.rb', line 60 def () return t("authorizations.index.show_renew_info", scope: "decidim.verifications") if .renewable? return unless .expired? t("authorizations.index.expired_verification", scope: "decidim.verifications") end |
#granted_authorization_display_data(authorization, redirect_url = nil) ⇒ Object
25 26 27 28 29 30 31 32 33 34 |
# File 'app/helpers/decidim/verifications/application_helper.rb', line 25 def (, redirect_url = nil) ().merge( url: (, redirect_url), remote_url: (), auth_icon: "checkbox-circle-line", is_granted: true, explanation: (), button_text: () ) end |
#granted_authorization_explanation(authorization) ⇒ Object
50 51 52 53 54 55 56 57 58 |
# File 'app/helpers/decidim/verifications/application_helper.rb', line 50 def () = .expires_at.presence && l(.expires_at, format: :long_with_particles) if .expired? t("expired_at", scope: "decidim.authorization_handlers", timestamp: ) else "#{t("granted_at", scope: "decidim.authorization_handlers", timestamp: l(.granted_at, format: :long_with_particles))}\ #{t("expires_at", scope: "decidim.authorization_handlers", timestamp: ) if .present?}" end end |
#granted_authorization_remote_url(authorization) ⇒ Object
44 45 46 47 48 |
# File 'app/helpers/decidim/verifications/application_helper.rb', line 44 def () return unless .renewable? (handler: .name) end |
#granted_authorization_url(authorization, redirect_url = nil) ⇒ Object
36 37 38 39 40 41 42 |
# File 'app/helpers/decidim/verifications/application_helper.rb', line 36 def (, redirect_url = nil) return if .renewable? return unless .expired? url_params = { redirect_url: }.compact ().root_path(**url_params) end |
#pending_authorization_display_data(authorization, redirect_url = nil) ⇒ Object
67 68 69 70 71 72 73 74 75 76 |
# File 'app/helpers/decidim/verifications/application_helper.rb', line 67 def (, redirect_url = nil) url_params = { redirect_url: }.compact ().merge( url: ().(**url_params), auth_icon: "time-line", explanation: t("started_at", scope: "decidim.authorization_handlers", timestamp: l(.updated_at, format: :long_with_particles)), button_text: t("authorizations.index.introduce_code", scope: "decidim.verifications") ) end |
#unauthorized_method_display_data(method, redirect_url = nil) ⇒ Object
78 79 80 81 82 83 84 85 86 87 88 |
# File 'app/helpers/decidim/verifications/application_helper.rb', line 78 def (method, redirect_url = nil) url_params = { redirect_url: }.compact { url: method.root_path(**url_params), auth_icon: method.icon, title: t("#{method.key}.name", scope: "decidim.authorization_handlers"), explanation: t("#{method.key}.explanation", scope: "decidim.authorization_handlers"), button_text: t("authorizations.index.subscribe", scope: "decidim.verifications") } end |