module BitsnoteAssets::ActionViewExtensions

Constants

ANGULAR_VERSION
BOOTSTRAP_CDN
BOOTSTRAP_VERSION
CDNJS
CDNS
CODEMIRROR_VERSION
FONTAWESOME_VERSION
FULLCALENDAR_VERSION
GOOGLE_CDN
JQUERY_UI_VERSION
JQUERY_VERSION
MASONRY_VERSION
MOMENT_VERSION
OFFLINE
PICKADATE_VERSION
SPIN_VERSION

Public Instance Methods

angular_js_include_tag(name, options = {}) click to toggle source
# File lib/bitsnote-assets.rb, line 149
def angular_js_include_tag(name, options = {})
  js_include_tag(name, 'angular/angular', :angular_js_url, options) do |asset|
    "window.angular"
  end
end
bootstrap_css_include_tag(name, options = {}) click to toggle source
# File lib/bitsnote-assets.rb, line 137
def bootstrap_css_include_tag(name, options = {})
  css_include_tag(name, 'bootstrap/bootstrap', :bootstrap_css_url, options)
end
bootstrap_js_include_tag(name, options = {}) click to toggle source
# File lib/bitsnote-assets.rb, line 131
def bootstrap_js_include_tag(name, options = {})
  js_include_tag(name, 'bootstrap/bootstrap', :bootstrap_js_url, options) do |asset|
    "typeof $().carousel == 'function'"
  end
end
bootstrap_theme_css_include_tag(name, options = {}) click to toggle source
# File lib/bitsnote-assets.rb, line 141
def bootstrap_theme_css_include_tag(name, options = {})
  css_include_tag(name, 'bootstrap/bootstrap-theme', :bootstrap_theme_css_url, options)
end
codemirror_css_include_tag(name, options = {}) click to toggle source
# File lib/bitsnote-assets.rb, line 193
def codemirror_css_include_tag(name, options = {})
  css_include_tag(name, 'codemirror', :codemirror_css_url, options)
end
codemirror_js_include_tag(name, options = {}) click to toggle source
# File lib/bitsnote-assets.rb, line 181
def codemirror_js_include_tag(name, options = {})
  js_include_tag(name, 'codemirror', :codemirror_js_url, options) do |asset|
    "window.CodeMirror"
  end
end
codemirror_markdown_js_include_tag(name, options = {}) click to toggle source
# File lib/bitsnote-assets.rb, line 187
def codemirror_markdown_js_include_tag(name, options = {})
  js_include_tag(name, 'codemirror/modes/markdown', :codemirror_markdown_js_url, options) do
    "window.CodeMirror.modes.markdown"
  end
end
css_include_tag(cdn, asset, url, options = {}) click to toggle source
# File lib/bitsnote-assets.rb, line 107
def css_include_tag(cdn, asset, url, options = {})
  asset = asset + '.min' if options.delete(:compressed)

  if OFFLINE and !options.delete(:force)
    return stylesheet_link_tag(asset, options)
  else
    # CSS do not offer way to check existing
    [ stylesheet_link_tag(self.send(url, cdn.to_sym), options),
    ].join("\n").html_safe
  end
end
fontawesome_css_include_tag(name, options = {}) click to toggle source
# File lib/bitsnote-assets.rb, line 145
def fontawesome_css_include_tag(name, options = {})
  css_include_tag(name, 'font-awesome', :fontawesome_css_url, options)
end
fullcalendar_css_include_tag(name, options = {}) click to toggle source
# File lib/bitsnote-assets.rb, line 171
def fullcalendar_css_include_tag(name, options = {})
  css_include_tag(name, 'fullcalendar/fullcalendar', :fullcalendar_css_url, options)
end
fullcalendar_js_include_tag(name, options = {}) click to toggle source
# File lib/bitsnote-assets.rb, line 167
def fullcalendar_js_include_tag(name, options = {})
  js_include_tag(name, 'fullcalendar/fullcalendar', :fullcalendar_js_url, options)
end
jquery_include_tag(name, options = {}) click to toggle source
# File lib/bitsnote-assets.rb, line 119
def jquery_include_tag(name, options = {})
  js_include_tag(name, 'jquery', :jquery_js_url, options) do |asset|
    "window.jQuery"
  end
end
jquery_ui_include_tag(name, options = {}) click to toggle source
# File lib/bitsnote-assets.rb, line 125
def jquery_ui_include_tag(name, options = {})
  js_include_tag(name, 'jquery-ui/jquery-ui', :jquery_ui_js_url, options) do |asset|
    "window.jQuery.ui"
  end
end
js_include_tag(cdn, asset, url, options = {}) { |asset| ... } click to toggle source
# File lib/bitsnote-assets.rb, line 88
def js_include_tag(cdn, asset, url, options = {})
  options.reverse_merge! :local_copy => false

  asset = asset + '.min' if options.delete(:compressed)

  if OFFLINE and !options.delete(:force)
    options.delete(:local_copy) # not used in OFFLINE mode
    return javascript_include_tag(asset, options)
  else
    local_copy = options.delete(:local_copy)
    j = [ javascript_include_tag(self.send(url, cdn.to_sym), options) ]
    if local_copy && block_given?
      v = yield(asset)
      j << javascript_tag("#{v} || document.write(unescape('#{javascript_include_tag(asset, options).gsub('<','%3C')}'))")
    end
    j.join("\n").html_safe
  end
end
masonry_js_include_tag(name, options = {}) click to toggle source
# File lib/bitsnote-assets.rb, line 197
def masonry_js_include_tag(name, options = {})
  js_include_tag(name, 'masonry/masonry.pkgd', :masonry_js_url, options) do |asset|
    "window.Masonry"
  end
end
moment_js_include_tag(name, options = {}) click to toggle source
# File lib/bitsnote-assets.rb, line 155
def moment_js_include_tag(name, options = {})
  js_include_tag(name, 'moment/moment', :moment_js_url, options) do |asset|
    "window.moment"
  end
end
moment_locales_js_include_tag(name, options = {}) click to toggle source
# File lib/bitsnote-assets.rb, line 161
def moment_locales_js_include_tag(name, options = {})
  js_include_tag(name, 'moment/moment-with-locales', :moment_locales_js_url, options) do |asset|
    "window.moment"
  end
end
spin_js_include_tag(name, options = {}) click to toggle source
# File lib/bitsnote-assets.rb, line 175
def spin_js_include_tag(name, options = {})
  js_include_tag(name, 'spin/spin', :spin_js_url, options) do |asset|
    "window.Spinner"
  end
end