Sha256: 73c2da4fbdc466b335ddcc73e6fb472c6f9def20bd7d510326a0e8e08707f2b0

Contents?: true

Size: 1.07 KB

Versions: 5

Compression:

Stored size: 1.07 KB

Contents

module Adminpanel
  module AnalyticsHelper

    def days_to_substract
      if params[:insight] == 'day'
        1
      elsif params[:insight] == 'week'
        7
      elsif params[:insight] == 'days_28'
        28
      else
        0
      end
    end

    def insight
      return 'day' if !params[:insight].present?
      return 'day' if params[:insight] == 'day'
      return 'week' if params[:insight] == 'week'
      return 'month' if params[:insight] == 'days_28'
    end

    def metric(metric)
      metric.first['name']
    end

    def tweet_link(tweet)
      "http://www.twitter.com/#{tweet.user.screen_name}/status/#{tweet.id}"
    end

    def fb_insights(fb_auth)
      if fb_auth
        "#{Koala::Facebook::API.new(fb_auth.value).get_object('me')['link']}insights"
      else
        '#'
      end
    end

    def exist_instagram_account?
      if @instagram_token.nil?
        false
      else
        true
      end
    end

    def exist_twitter_account?
      if @twitter_token.nil? || @twitter_secret.nil?
        false
      else
        true
      end
    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
adminpanel-3.3.0 app/helpers/adminpanel/analytics_helper.rb
adminpanel-3.2.1 app/helpers/adminpanel/analytics_helper.rb
adminpanel-3.2.0 app/helpers/adminpanel/analytics_helper.rb
adminpanel-3.1.0 app/helpers/adminpanel/analytics_helper.rb
adminpanel-3.0.0 app/helpers/adminpanel/analytics_helper.rb