Module: ApplicationHelper
- Defined in:
- app/helpers/application_helper.rb
Instance Method Summary collapse
- #footer_copyright ⇒ Object
- #include_meta_tags ⇒ Object
- #sidebar_image_tag ⇒ Object
- #sidebar_tagline ⇒ Object
- #social_links ⇒ Object
Instance Method Details
#footer_copyright ⇒ Object
94 95 96 97 98 99 100 101 |
# File 'app/helpers/application_helper.rb', line 94 def title = @settings[:general][:website_title] year = Date.today.year html = "#{title} © #{year}" """<div class='footer-copyright'> #{html} </div>""".html_safe end |
#include_meta_tags ⇒ Object
2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 |
# File 'app/helpers/application_helper.rb', line 2 def name = @settings[:general][:website_title] title = @settings[:general][:website_tagline] description = @settings[:general][:website_description] description = ActionController::Base.helpers.(description). gsub("\n", ""). gsub("\r", "") url = @settings[:general][:website_url] image_url = @settings[:general][:website_logo_url] if Rails.env.production? unless image_url.include?('//') host = ENV.fetch("HOST") protocole = Rails.application.config.force_ssl ? "https://" : "http://" image_url = "#{protocole}#{host}#{image_url}" end end ({ site: name, title: title, description: description, canonical: url, og: { site_name: name, url: url, title: title, description: description, image: image_url, type: "website" }, twitter: { url: url, title: title, description: description, image: image_url, card: "summary" } }) end |
#sidebar_image_tag ⇒ Object
43 44 45 46 47 48 49 50 51 |
# File 'app/helpers/application_helper.rb', line 43 def tagline = @settings[:general][:website_tagline].presence image_url = @settings[:general][:website_logo_url].presence if image_url image_tag(image_url, alt: tagline) else "" end end |
#sidebar_tagline ⇒ Object
53 54 55 56 |
# File 'app/helpers/application_helper.rb', line 53 def tagline = @settings[:general][:website_description].presence (tagline || "").html_safe end |
#social_links ⇒ Object
58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 |
# File 'app/helpers/application_helper.rb', line 58 def links = @settings[:general][:social_links] || [] links.reject! { |l| l.empty? } = { "facebook.com" => "facebook", "vk.com" => "vk", "twitter.com" => "twitter", "behance.net" => "behance", "github.com" => "github", "pinterest.com" => "pinterest", "instagram.com" => "instagram", "youtube.com" => "youtube-play", "linkedin.com" => "linkedin", "medium.com" => "medium", "vimeo.com" => "vimeo", "slack.com" => "slack", "dribbble.com" => "dribbble", "soundcloud.com" => "soundcloud", "mailto:" => "envelope" } = .keys html = links.collect do |l| key = .select { |domain| l.include?(domain) }.first icon = [key] link_to l, target: "_blank" do fa_stacked_icon("#{icon} inverse", base: "circle", class: "fa-1x") end end .join("") html.html_safe end |