Sha256: 02f0121ba4f07ae2fd08d0d910e77ef92ec5bba18644137d7cafc2a001f2122f

Contents?: true

Size: 876 Bytes

Versions: 1

Compression:

Stored size: 876 Bytes

Contents

module ShipitHelper
  def stacks
    @stacks ||= Stack.all
  end

  def stacks_by_owner
    @stacks_by_owner ||= stacks.group_by(&:repo_owner)
  end

  def can_login?
    Shipit.github && !current_user.logged_in?
  end

  def emoji_tag(emoji)
    image_tag("emoji/#{emoji}.png", height: 20, width: 20, alt: ":#{emoji}:")
  end

  def include_plugins
    tags = []
    Rails.application.config.assets.paths.each do |path|
      Dir[File.join(path, 'plugins/*')].each do |plugin_path|
        tags << include_plugin_asset_tag(File.basename(plugin_path)) if File.file?(plugin_path)
      end
    end
    tags.join.html_safe
  end

  def include_plugin_asset_tag(plugin)
    if plugin =~ /\A([\-\w]+)(\.js)?(\.coffee)?\Z/
      javascript_include_tag "plugins/#{$1}"
    elsif plugin =~ /\A([\-\w]+)(\.css)?(\.scss)?\Z/
      stylesheet_link_tag "plugins/#{$1}"
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
shipit-engine-0.0.1.pre app/helpers/shipit_helper.rb