Sha256: dcc4d240507ffea660ac46691a300314caa538cf756085b7442060a1ce49ee6d
Contents?: true
Size: 1.85 KB
Versions: 1
Compression:
Stored size: 1.85 KB
Contents
# frozen_string_literal: true module Account module ReferralsHelper def social_share(url, options = {}) options.reverse_merge!( description: '', image: '', links: [:facebook, :twitter, :linkedin] ) options[:twitter] ||= options[:description] links = options.delete(:links) || TranslationCms::SOCIAL_LINKS.keys # analytics = { utm_medium: 'share', utm_campaign: 'Info' } links.each do |name| break unless TranslationCms::SOCIAL_LINKS.key?(name) submit_url = TranslationCms::SOCIAL_LINKS[name].dup options[:url] = url.to_s options.each do |key, value| submit_url.gsub!("{{#{key}}}", Rack::Utils.escape(value)) end yield submit_url.html_safe, name end end def social_provider_class(name) case name.to_s when 'facebook' then 'fb' when 'twitter' then 'twit' when 'google' then 'gplus' else name end end def invite_link return unless @member&.registered? @invite_link ||= new_order_url(discount: @member.referral_code) end def essay_page_entries_info(collection, options = {}) entry_name = options[:entry_name] || collection.entry_name entry_name = entry_name.pluralize unless collection.total_count == 1 if collection.total_pages < 2 t('helpers.page_entries_info.one_page.display_entries', entry_name: entry_name, count: collection.total_count) else client_offset = (collection.current_page.to_i - 1) * options[:per_page].to_i first = client_offset + 1 last = collection.last_page? ? collection.total_count : client_offset + collection.limit_value t('helpers.page_entries_info.more_pages.display_entries', entry_name: entry_name, first: first, last: last, total: collection.total_count) end.html_safe end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
translation_cms-0.1.5 | app/helpers/account/referrals_helper.rb |