Skip to content

Commit

Permalink
Merge branch 'master' of github.com:voltrb/volt
Browse files Browse the repository at this point in the history
  • Loading branch information
ryanstout committed Sep 4, 2015
2 parents ea2d0c4 + b79dfd9 commit 47fcfc9
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions lib/volt/server/component_templates.rb
Original file line number Diff line number Diff line change
Expand Up @@ -66,15 +66,16 @@ def generate_view_code
# handle things.
code << "\nrequire '#{require_path}'\n"
else
valid_exts_re = exts.join('|')
# On the sever side, we eval the compiled code
path_parts = view_path.scan(/([^\/]+)\/([^\/]+)\/[^\/]+\/([^\/]+)[.](html|email)$/)
path_parts = view_path.scan(/([^\/]+)\/([^\/]+)\/[^\/]+\/([^\/]+)[.](#{valid_exts_re})$/)
component_name, controller_name, view, _ = path_parts[0]

# file extension
format = File.extname(view_path).downcase.delete('.').to_sym

# Get the path for the template, supports templates in folders
template_path = view_path[views_path.size..-1].gsub(/[.](#{exts.join('|')})$/, '')
template_path = view_path[views_path.size..-1].gsub(/[.](#{valid_exts_re})$/, '')
template_path = "#{@component_name}/#{template_path}"

html = File.read(view_path)
Expand Down Expand Up @@ -189,4 +190,4 @@ def localize_path(path)


end
end
end

0 comments on commit 47fcfc9

Please sign in to comment.