Skip to content

Commit

Permalink
Add support for Sprockets 3.x
Browse files Browse the repository at this point in the history
  • Loading branch information
spohlenz committed May 4, 2015
1 parent b8e7811 commit 0f69122
Showing 1 changed file with 14 additions and 4 deletions.
18 changes: 14 additions & 4 deletions lib/tinymce/rails/configuration.rb
Expand Up @@ -98,10 +98,20 @@ def self.default_language
# Searches asset paths for TinyMCE language files.
def self.available_languages
assets.paths.map { |path|
files = assets.entries(File.join(path, "tinymce/langs"))
files.select { |file| file.to_s =~ /\.js/ }.map { |file|
asset = assets.attributes_for(File.join(path, file))
asset.logical_path.sub(/\.js$/, "")
# Find all assets within tinymce/langs
entries = assets.entries(File.join(path, "tinymce/langs"))
entries.map { |entry|
if assets.respond_to?(:attributes_for)
assets.attributes_for(File.join(path, entry))
else
assets.find_asset(File.join("tinymce/langs", entry))
end
}.select { |asset|
# Select only JavaScript files
asset.logical_path =~ /\.js$/
}.map { |asset|
# Strip path and extension
asset.logical_path.sub(/^tinymce\/langs\//, "").sub(/\.js$/, "")
}
}.flatten.uniq
end
Expand Down

0 comments on commit 0f69122

Please sign in to comment.