metaprogram template addition
This commit is contained in:
parent
dec3006b50
commit
9b8afba9cf
6 changed files with 9 additions and 23 deletions
5
app/views/layouts/_templates.haml
Normal file
5
app/views/layouts/_templates.haml
Normal file
|
|
@ -0,0 +1,5 @@
|
|||
- templates_dir = Rails.root.join("app", "views", "templates")
|
||||
= Dir[templates_dir.to_s + "/*.jst"].each do |template|
|
||||
- template_name = File.basename(template, ".jst").gsub("_","-")
|
||||
%script{:id => "#{template_name}-template", :type => 'text/template'}
|
||||
!= File.read(templates_dir.join(template))
|
||||
|
|
@ -113,7 +113,7 @@
|
|||
%header
|
||||
= render 'layouts/header'
|
||||
|
||||
= render 'templates/templates'
|
||||
= render 'layouts/templates'
|
||||
|
||||
.container{:style=> "#{yield(:break_the_mold)}"}
|
||||
- if @aspsect == :getting_started || @page == :logged_out
|
||||
|
|
|
|||
|
|
@ -1,18 +0,0 @@
|
|||
-# Copyright (c) 2010-2011, Diaspora Inc. This file is
|
||||
-# licensed under the Affero General Public License version 3 or later. See
|
||||
-# the COPYRIGHT file.
|
||||
|
||||
- ["header",
|
||||
"feedback",
|
||||
"static_text",
|
||||
"stream_element",
|
||||
"comment_stream",
|
||||
"comment",
|
||||
"status_message",
|
||||
"activity_streams_photo",
|
||||
"reshare",
|
||||
"likes_info",
|
||||
"stream_faces"].each do |template_name|
|
||||
|
||||
%script{:id => "#{template_name.gsub("_","-")}-template", :type => 'text/template'}
|
||||
!= File.read("#{Rails.root}/app/views/templates/#{template_name}.jst")
|
||||
0
app/views/templates/reshare_feedback.jst
Normal file
0
app/views/templates/reshare_feedback.jst
Normal file
|
|
@ -1,4 +1,3 @@
|
|||
app.views.ReshareFeedback = Backbone.View.extend({
|
||||
|
||||
|
||||
app.views.ReshareFeedback = app.views.Base.extend({
|
||||
template_name: "#reshare-feedback-template",
|
||||
});
|
||||
|
|
|
|||
|
|
@ -3,7 +3,7 @@ require "spec_helper"
|
|||
describe "template generation" do
|
||||
it "generates templates", :fixture => true do
|
||||
extend JasmineFixtureGeneration
|
||||
templates = Haml::Engine.new(Rails.root.join("app", "views", "templates", "_templates.haml").read).render
|
||||
templates = Haml::Engine.new(Rails.root.join("app", "views", "layouts", "_templates.haml").read).render
|
||||
save_fixture(templates, "underscore_templates")
|
||||
end
|
||||
end
|
||||
|
|
|
|||
Loading…
Reference in a new issue