Sha256: d7edec9e756316c5c87ed1d4ac0d30d4512591926cea6ed19a81ccb3a817264f
Contents?: true
Size: 926 Bytes
Versions: 1
Compression:
Stored size: 926 Bytes
Contents
# encoding: utf-8 require 'active_support/json/encoding' module UeditorRails module Util class << self def js_replace(dom_id, options = nil) js_options = (options && !options.keys.empty?)? ActiveSupport::JSON.encode(options) : '{}' js = <<-JS if(window.UEDITOR_FIELDS === undefined) { window.UEDITOR_FIELDS = []; } window.UEDITOR_FIELDS.push({id: '#{dom_id}', opt: #{js_options}}) JS js.html_safe end def select_assets assets = [] Dir[UeditorRails.root_path.join('vendor/assets/javascripts/**/**.*')].each do |path| ext = File.extname(path) path = path[0..-ext.length-1] if %w(.scss .sass .coffee .erb).include? ext assets << Pathname.new(path).relative_path_from(UeditorRails.root_path.join('vendor/assets/javascripts')) end assets end end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
ueditor_rails-0.0.1 | lib/ueditor_rails/util.rb |