Module: LinksHelper
- Defined in:
- app/helpers/links_helper.rb
Instance Method Summary collapse
- #faqs_enabled_here? ⇒ Boolean
- #link_to_bibliotheca_exercise(exercise) ⇒ Object
- #link_to_bibliotheca_guide(guide) ⇒ Object
- #link_to_error_404 ⇒ Object
- #link_to_faqs ⇒ Object
- #link_to_forum_terms ⇒ Object
- #link_to_issues(translation) ⇒ Object
- #link_to_path_element(element, options = {}) ⇒ Object
- #link_to_profile_terms ⇒ Object
- #link_to_status_codes(code) ⇒ Object
- #mail_to_administrator ⇒ Object
- #profile_enabled_here? ⇒ Boolean
- #teacher_info_button(item) ⇒ Object
- #turbolinks_enable_for(exercise) ⇒ Object
- #url_for_application(app_name) ⇒ Object
Instance Method Details
#faqs_enabled_here? ⇒ Boolean
73 74 75 |
# File 'app/helpers/links_helper.rb', line 73 def faqs_enabled_here? current_access_mode.faqs_here? end |
#link_to_bibliotheca_exercise(exercise) ⇒ Object
46 47 48 |
# File 'app/helpers/links_helper.rb', line 46 def link_to_bibliotheca_exercise(exercise) edit_link_to_bibliotheca { "#{url_for_bibliotheca_guide(exercise.guide)}/exercises/#{exercise.bibliotheca_id}" } end |
#link_to_bibliotheca_guide(guide) ⇒ Object
42 43 44 |
# File 'app/helpers/links_helper.rb', line 42 def link_to_bibliotheca_guide(guide) edit_link_to_bibliotheca { url_for_bibliotheca_guide(guide) } end |
#link_to_error_404 ⇒ Object
8 9 10 |
# File 'app/helpers/links_helper.rb', line 8 def link_to_error_404 "<a href='https://es.wikipedia.org/wiki/Error_404'> #{I18n.t(:error_404)} </a>" end |
#link_to_faqs ⇒ Object
65 66 67 |
# File 'app/helpers/links_helper.rb', line 65 def link_to_faqs link_to t(:faqs), faqs_path, target: '_blank' if faqs_enabled_here? end |
#link_to_forum_terms ⇒ Object
61 62 63 |
# File 'app/helpers/links_helper.rb', line 61 def link_to_forum_terms link_to t(:forum_terms), discussions_terms_path, target: '_blank' end |
#link_to_issues(translation) ⇒ Object
12 13 14 |
# File 'app/helpers/links_helper.rb', line 12 def link_to_issues(translation) "<a href='https://github.com/mumuki/mumuki-laboratory/issues/new'> #{I18n.t(translation)} </a>" end |
#link_to_path_element(element, options = {}) ⇒ Object
3 4 5 6 |
# File 'app/helpers/links_helper.rb', line 3 def link_to_path_element(element, ={}) name = extract_name element, link_to name, element, end |
#link_to_profile_terms ⇒ Object
57 58 59 |
# File 'app/helpers/links_helper.rb', line 57 def link_to_profile_terms link_to t(:terms_and_conditions), terms_user_path, target: '_blank' end |
#link_to_status_codes(code) ⇒ Object
16 17 18 |
# File 'app/helpers/links_helper.rb', line 16 def link_to_status_codes(code) "<a href='https://es.wikipedia.org/wiki/Anexo:C%C3%B3digos_de_estado_HTTP' target='_blank'> #{I18n.t("error_#{code}")} </a>" end |
#mail_to_administrator ⇒ Object
50 51 52 53 54 55 |
# File 'app/helpers/links_helper.rb', line 50 def mail_to_administrator mail_to Organization.current.contact_email, Organization.current.contact_email, subject: I18n.t(:permissions), body: (current_user, Organization.current) end |
#profile_enabled_here? ⇒ Boolean
77 78 79 |
# File 'app/helpers/links_helper.rb', line 77 def profile_enabled_here? current_access_mode.profile_here? end |
#teacher_info_button(item) ⇒ Object
25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 |
# File 'app/helpers/links_helper.rb', line 25 def (item) if current_user&.teacher_here? && item.teacher_info.present? %Q{ <div data-bs-toggle="tooltip" title="#{t :teacher_info}"> <a class="mu-popover" data-bs-toggle="popover" data-bs-html="true" title="#{t :teacher_info}" data-bs-placement="bottom" data-bs-content="#{html_rescape item.teacher_info_html}">#{fixed_fa_icon('info-circle')} </a> </div> }.html_safe end end |
#turbolinks_enable_for(exercise) ⇒ Object
69 70 71 |
# File 'app/helpers/links_helper.rb', line 69 def turbolinks_enable_for(exercise) %Q{data-turbolinks="#{!exercise.input_kids?}"}.html_safe end |
#url_for_application(app_name) ⇒ Object
20 21 22 23 |
# File 'app/helpers/links_helper.rb', line 20 def url_for_application(app_name) app = Mumukit::Platform.application_for(app_name) app.organic_url(Organization.current.name) end |