Sha256: fd2b3585848a2ab0a9092a761658bb0f53d60b5c4056d912fa350573846c7776

Contents?: true

Size: 751 Bytes

Versions: 2

Compression:

Stored size: 751 Bytes

Contents

module BotMob
  module Rails
    module SlackHelper
      URL = 'https://slack.com/oauth/authorize'

      def slack_button(*scopes)
        params = URI.encode_www_form({
          client_id: ENV['SLACK_CLIENT_ID'],
          scope: scopes.join(' ')
        })

        content_tag(:a, button, href: "#{URL}?#{params}", class: 'slack_button').html_safe
      end

      private

      def button
        content_tag(:img, nil, {
          alt: 'Add to Slack',
          height: 40,
          width: 139,
          src: 'https://platform.slack-edge.com/img/add_to_slack.png',
          srcset: 'https://platform.slack-edge.com/img/add_to_slack.png 1x, https://platform.slack-edge.com/img/add_to_slack@2x.png 2x'
        })
      end
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
bot_mob_rails-0.0.2 app/helpers/bot_mob/rails/slack_helper.rb
bot_mob_rails-0.0.1 app/helpers/bot_mob/rails/slack_helper.rb