rackmap hates me
This commit is contained in:
parent
f4fa1acd3e
commit
c82a40dde5
27 changed files with 265 additions and 262 deletions
|
@ -1,11 +1,6 @@
|
|||
require "padrino-helpers"
|
||||
|
||||
module Middleman::CoreExtensions::DefaultHelpers
|
||||
class << self
|
||||
def registered(app)
|
||||
# Use Padrino Helpers
|
||||
app.register Padrino::Helpers
|
||||
|
||||
# Middleman Helpers
|
||||
app.helpers Helpers
|
||||
end
|
||||
|
@ -13,6 +8,11 @@ module Middleman::CoreExtensions::DefaultHelpers
|
|||
end
|
||||
|
||||
module Helpers
|
||||
|
||||
# TODO: Implement
|
||||
def javascript_include_tag(path)
|
||||
end
|
||||
|
||||
def auto_stylesheet_link_tag(separator="/")
|
||||
auto_tag(:css, separator) do |path|
|
||||
stylesheet_link_tag path
|
||||
|
@ -28,25 +28,25 @@ module Middleman::CoreExtensions::DefaultHelpers
|
|||
def auto_tag(asset_ext, separator="/", asset_dir=nil)
|
||||
if asset_dir.nil?
|
||||
asset_dir = case asset_ext
|
||||
when :js then self.class.js_dir
|
||||
when :css then self.class.css_dir
|
||||
when :js then self.js_dir
|
||||
when :css then self.css_dir
|
||||
end
|
||||
end
|
||||
path = request.path_info.dup
|
||||
path = current_path.dup
|
||||
# If the basename of the request as no extension, assume we are serving a
|
||||
# directory and join index_file to the path.
|
||||
path = File.join(path, self.class.index_file) if File.extname(path).empty?
|
||||
path = File.join(path, self.index_file) if File.extname(path).empty?
|
||||
path = path.gsub(%r{^/}, '')
|
||||
path = path.gsub(File.extname(path), ".#{asset_ext}")
|
||||
path = path.gsub("/", separator)
|
||||
|
||||
view = File.join(self.class.views, asset_dir, path)
|
||||
view = File.join(self.views, asset_dir, path)
|
||||
yield path if File.exists?(view) or Dir["#{view}.*"].any?
|
||||
end
|
||||
|
||||
def page_classes
|
||||
path = request.path_info.dup
|
||||
path << settings.index_file if path.match(%r{/$})
|
||||
path = current_path.dup
|
||||
path << self.index_file if path.match(%r{/$})
|
||||
path = path.gsub(%r{^/}, '')
|
||||
|
||||
classes = []
|
||||
|
@ -60,9 +60,9 @@ module Middleman::CoreExtensions::DefaultHelpers
|
|||
def asset_path(kind, source)
|
||||
return source if source =~ /^http/
|
||||
asset_folder = case kind
|
||||
when :css then settings.css_dir
|
||||
when :js then settings.js_dir
|
||||
when :images then settings.images_dir
|
||||
when :css then self.css_dir
|
||||
when :js then self.js_dir
|
||||
when :images then self.images_dir
|
||||
else kind.to_s
|
||||
end
|
||||
source = source.to_s.gsub(/\s/, '')
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue