merb-haml-1.1.3/0000755000175000017500000000000011765176217012701 5ustar tfheentfheenmerb-haml-1.1.3/spec/0000755000175000017500000000000011765176217013633 5ustar tfheentfheenmerb-haml-1.1.3/spec/spec.opts0000644000175000017500000000003211765176217015467 0ustar tfheentfheen--format specdoc --colour merb-haml-1.1.3/spec/haml_spec.rb0000644000175000017500000000203711765176217016115 0ustar tfheentfheenrequire 'spec_helper' describe "HAML" do it "should be able to render HAML templates" do c = dispatch_to(HamlController, :index) c.body.should == ::Haml::Engine.new("#foo\n %p Hello").render end it "should be able to render HAML templates with locals" do c = dispatch_to(PartialHaml, :index) c.body.should == ::Haml::Engine.new("#foo\n %p Partial").render end it "should use the haml configuration in Merb::Plugins.config" do c = dispatch_to(HamlConfig, :index) c.body.should == ::Haml::Engine.new("#foo\n %foo", :autoclose => ["foo"]).render end it "should be able to have ivars defined in both the controller and the parent template" do c = dispatch_to(PartialIvars, :index) c.body.should == ::Haml::Engine.new("#foo\n %p Partial HAML").render end it "should support capture" do c = dispatch_to(CaptureHaml, :index) c.body.should == "

Hello

\n" end it "should support concat" do c = dispatch_to(ConcatHaml, :index) c.body.should == "

Concat

" end end merb-haml-1.1.3/spec/controllers/0000755000175000017500000000000011765176217016201 5ustar tfheentfheenmerb-haml-1.1.3/spec/controllers/haml.rb0000644000175000017500000000074311765176217017453 0ustar tfheentfheenclass HamlController < Merb::Controller self._template_root = File.dirname(__FILE__) / "views" def index render end end class PartialHaml < HamlController end class HamlConfig < HamlController end class PartialIvars < HamlController def index @var1 = "Partial" render end end class CaptureHaml < HamlController end module Merb::ConcatHamlHelper def concatter(&blk) concat("

Concat

", blk.binding) end end class ConcatHaml < HamlController endmerb-haml-1.1.3/spec/controllers/views/0000755000175000017500000000000011765176217017336 5ustar tfheentfheenmerb-haml-1.1.3/spec/controllers/views/partial_ivars/0000755000175000017500000000000011765176217022176 5ustar tfheentfheenmerb-haml-1.1.3/spec/controllers/views/partial_ivars/index.html.haml0000644000175000017500000000006111765176217025110 0ustar tfheentfheen#foo - @var2 = "HAML" = partial :partial_hamlmerb-haml-1.1.3/spec/controllers/views/partial_ivars/_partial_haml.html.haml0000644000175000017500000000002611765176217026576 0ustar tfheentfheen%p== #{@var1} #{@var2}merb-haml-1.1.3/spec/controllers/views/haml_config/0000755000175000017500000000000011765176217021604 5ustar tfheentfheenmerb-haml-1.1.3/spec/controllers/views/haml_config/index.html.haml0000644000175000017500000000001411765176217024514 0ustar tfheentfheen#foo %foo merb-haml-1.1.3/spec/controllers/views/partial_haml/0000755000175000017500000000000011765176217021773 5ustar tfheentfheenmerb-haml-1.1.3/spec/controllers/views/partial_haml/index.html.haml0000644000175000017500000000006211765176217024706 0ustar tfheentfheen#foo = partial :partial_haml, :text => "Partial"merb-haml-1.1.3/spec/controllers/views/partial_haml/_partial_haml.html.haml0000644000175000017500000000001011765176217026364 0ustar tfheentfheen%p= textmerb-haml-1.1.3/spec/controllers/views/concat_haml/0000755000175000017500000000000011765176217021606 5ustar tfheentfheenmerb-haml-1.1.3/spec/controllers/views/concat_haml/index.html.haml0000644000175000017500000000002611765176217024521 0ustar tfheentfheen- concatter do Hellomerb-haml-1.1.3/spec/controllers/views/capture_haml/0000755000175000017500000000000011765176217022002 5ustar tfheentfheenmerb-haml-1.1.3/spec/controllers/views/capture_haml/index.html.haml0000644000175000017500000000003711765176217024717 0ustar tfheentfheen- x = capture do %p Hello = xmerb-haml-1.1.3/spec/controllers/views/haml_controller/0000755000175000017500000000000011765176217022522 5ustar tfheentfheenmerb-haml-1.1.3/spec/controllers/views/haml_controller/index.html.haml0000644000175000017500000000002011765176217025427 0ustar tfheentfheen#foo %p Hello merb-haml-1.1.3/spec/spec_helper.rb0000644000175000017500000000106511765176217016453 0ustar tfheentfheenrequire "rubygems" # Use current merb-core sources if running from a typical dev checkout. lib = File.expand_path('../../../merb-core/lib', __FILE__) $LOAD_PATH.unshift(lib) if File.directory?(lib) require 'merb-core' # The lib under test require "merb-haml" # Satisfies Autotest and anyone else not using the Rake tasks require 'spec' # Shared spec files require "controllers/haml" Merb::Plugins.config[:haml] = { "autoclose" => ["foo"] } Merb.start :environment => 'test' Spec::Runner.configure do |config| config.include Merb::Test::RequestHelper end merb-haml-1.1.3/README0000644000175000017500000000010611765176217013556 0ustar tfheentfheenmerb-haml ========= A plugin for the Merb framework that provides ...merb-haml-1.1.3/metadata.yml0000644000175000017500000001104011765176217015200 0ustar tfheentfheen--- !ruby/object:Gem::Specification name: merb-haml version: !ruby/object:Gem::Version hash: 21 prerelease: false segments: - 1 - 1 - 3 version: 1.1.3 platform: ruby authors: - Yehuda Katz autorequire: bindir: bin cert_chain: [] date: 2010-07-11 00:00:00 +01:00 default_executable: dependencies: - !ruby/object:Gem::Dependency name: merb-core prerelease: false requirement: &id001 !ruby/object:Gem::Requirement none: false requirements: - - ~> - !ruby/object:Gem::Version hash: 21 segments: - 1 - 1 - 3 version: 1.1.3 type: :runtime version_requirements: *id001 - !ruby/object:Gem::Dependency name: haml prerelease: false requirement: &id002 !ruby/object:Gem::Requirement none: false requirements: - - ">=" - !ruby/object:Gem::Version hash: 9 segments: - 2 - 0 - 3 version: 2.0.3 type: :runtime version_requirements: *id002 - !ruby/object:Gem::Dependency name: rspec prerelease: false requirement: &id003 !ruby/object:Gem::Requirement none: false requirements: - - ">=" - !ruby/object:Gem::Version hash: 13 segments: - 1 - 2 - 9 version: 1.2.9 type: :development version_requirements: *id003 description: Merb plugin for HAML support email: ykatz@engineyard.com executables: [] extensions: [] extra_rdoc_files: - README - LICENSE - TODO files: - Generators - Rakefile - lib/merb-haml/merbtasks.rb - lib/merb-haml/version.rb - lib/merb-haml/template.rb - lib/generators/controller.rb - lib/generators/templates/controller/app/views/%file_name%/index.html.haml - lib/generators/templates/resource_controller/datamapper/app/views/%file_name%/index.html.haml - lib/generators/templates/resource_controller/datamapper/app/views/%file_name%/edit.html.haml - lib/generators/templates/resource_controller/datamapper/app/views/%file_name%/new.html.haml - lib/generators/templates/resource_controller/datamapper/app/views/%file_name%/show.html.haml - lib/generators/templates/resource_controller/none/app/views/%file_name%/index.html.haml - lib/generators/templates/resource_controller/none/app/views/%file_name%/edit.html.haml - lib/generators/templates/resource_controller/none/app/views/%file_name%/new.html.haml - lib/generators/templates/resource_controller/none/app/views/%file_name%/show.html.haml - lib/generators/templates/resource_controller/sequel/app/views/%file_name%/index.html.haml - lib/generators/templates/resource_controller/sequel/app/views/%file_name%/edit.html.haml - lib/generators/templates/resource_controller/sequel/app/views/%file_name%/new.html.haml - lib/generators/templates/resource_controller/sequel/app/views/%file_name%/show.html.haml - lib/generators/templates/resource_controller/activerecord/app/views/%file_name%/index.html.haml - lib/generators/templates/resource_controller/activerecord/app/views/%file_name%/edit.html.haml - lib/generators/templates/resource_controller/activerecord/app/views/%file_name%/new.html.haml - lib/generators/templates/resource_controller/activerecord/app/views/%file_name%/show.html.haml - lib/generators/templates/layout/app/views/layout/%file_name%.html.haml - lib/generators/resource_controller.rb - lib/generators/layout.rb - lib/merb-haml.rb - spec/spec.opts - spec/spec_helper.rb - spec/controllers/haml.rb - spec/controllers/views/capture_haml/index.html.haml - spec/controllers/views/concat_haml/index.html.haml - spec/controllers/views/haml_controller/index.html.haml - spec/controllers/views/partial_ivars/index.html.haml - spec/controllers/views/partial_ivars/_partial_haml.html.haml - spec/controllers/views/haml_config/index.html.haml - spec/controllers/views/partial_haml/index.html.haml - spec/controllers/views/partial_haml/_partial_haml.html.haml - spec/haml_spec.rb - README - LICENSE - TODO has_rdoc: true homepage: http://merbivore.com/ licenses: [] post_install_message: rdoc_options: [] require_paths: - lib required_ruby_version: !ruby/object:Gem::Requirement none: false requirements: - - ">=" - !ruby/object:Gem::Version hash: 3 segments: - 0 version: "0" required_rubygems_version: !ruby/object:Gem::Requirement none: false requirements: - - ">=" - !ruby/object:Gem::Version hash: 3 segments: - 0 version: "0" requirements: [] rubyforge_project: rubygems_version: 1.3.7 signing_key: specification_version: 3 summary: Merb plugin that provides support for writing view template with HAML test_files: [] merb-haml-1.1.3/LICENSE0000644000175000017500000000203611765176217013707 0ustar tfheentfheenCopyright (c) 2008 Yehuda Katz Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.merb-haml-1.1.3/Rakefile0000644000175000017500000000135711765176217014354 0ustar tfheentfheenrequire 'rubygems' require 'rake' # Load this library's version information require File.expand_path('../lib/merb-haml/version', __FILE__) require 'spec/rake/spectask' Spec::Rake::SpecTask.new(:spec) do |spec| spec.spec_opts << '--options' << 'spec/spec.opts' if File.exists?('spec/spec.opts') spec.libs << 'lib' << 'spec' spec.spec_files = FileList['spec/**/*_spec.rb'] end Spec::Rake::SpecTask.new(:rcov) do |spec| spec.libs << 'lib' << 'spec' spec.pattern = 'spec/**/*_spec.rb' spec.rcov = true end task :default => :spec require 'rake/rdoctask' Rake::RDocTask.new do |rdoc| rdoc.rdoc_dir = 'rdoc' rdoc.title = "test_gem #{Merb::Haml::VERSION}" rdoc.rdoc_files.include('README*') rdoc.rdoc_files.include('lib/**/*.rb') end merb-haml-1.1.3/TODO0000644000175000017500000000024611765176217013373 0ustar tfheentfheenTODO: Fix LICENSE with your name Fix Rakefile with your name and contact info Add your code to lib/merb-haml.rb Add your Merb rake tasks to lib/merb-haml/merbtasks.rbmerb-haml-1.1.3/Generators0000644000175000017500000000025511765176217014737 0ustar tfheentfheenscope 'merb-gen' do dir = File.join(File.dirname(__FILE__), 'lib', 'generators/') Merb.add_generators dir + 'controller', dir + 'layout', dir + 'resource_controller' endmerb-haml-1.1.3/lib/0000755000175000017500000000000011765176217013447 5ustar tfheentfheenmerb-haml-1.1.3/lib/generators/0000755000175000017500000000000011765176217015620 5ustar tfheentfheenmerb-haml-1.1.3/lib/generators/layout.rb0000644000175000017500000000040411765176217017460 0ustar tfheentfheenMerb::Generators::LayoutGenerator.template :layout_haml, :template_engine => :haml do |t| t.source = File.join(File.dirname(__FILE__), 'templates/layout/app/views/layout/%file_name%.html.haml') t.destination = "app/views/layout/#{file_name}.html.haml" end merb-haml-1.1.3/lib/generators/controller.rb0000644000175000017500000000044111765176217020327 0ustar tfheentfheenMerb::Generators::ControllerGenerator.template :index_haml, :template_engine => :haml do |t| t.source = File.join(File.dirname(__FILE__), 'templates/controller/app/views/%file_name%/index.html.haml') t.destination = File.join("app/views", base_path, "#{file_name}/index.html.haml") endmerb-haml-1.1.3/lib/generators/resource_controller.rb0000644000175000017500000000073611765176217022245 0ustar tfheentfheen[:activerecord, :datamapper, :sequel, :none].each do |orm| [:show, :index, :edit, :new].each do |view| Merb::Generators::ResourceControllerGenerator.template "view_#{view}_haml", :orm => orm, :template_engine => :haml do |t| t.source = File.join(File.dirname(__FILE__), "templates/resource_controller/#{orm}/app/views/%file_name%/#{view}.html.haml") t.destination = File.join("app/views", base_path, "#{file_name}/#{view}.html.haml") end end end merb-haml-1.1.3/lib/generators/templates/0000755000175000017500000000000011765176217017616 5ustar tfheentfheenmerb-haml-1.1.3/lib/generators/templates/layout/0000755000175000017500000000000011765176217021133 5ustar tfheentfheenmerb-haml-1.1.3/lib/generators/templates/layout/app/0000755000175000017500000000000011765176217021713 5ustar tfheentfheenmerb-haml-1.1.3/lib/generators/templates/layout/app/views/0000755000175000017500000000000011765176217023050 5ustar tfheentfheenmerb-haml-1.1.3/lib/generators/templates/layout/app/views/layout/0000755000175000017500000000000011765176217024365 5ustar tfheentfheenmerb-haml-1.1.3/lib/generators/templates/layout/app/views/layout/%file_name%.html.haml0000644000175000017500000000052111765176217030222 0ustar tfheentfheen!!! Strict %html{ html_attrs("en_us") } %head %title Fresh Merb App %meta{ :content => "text/html; charset=utf-8", "http-equiv" => "content-type" }/ %link{ :href => "/stylesheets/master.css", :rel => "stylesheet", :media => "screen", :type => "text/css", :charset => "utf-8" }/ %body = catch_content :for_layoutmerb-haml-1.1.3/lib/generators/templates/controller/0000755000175000017500000000000011765176217022001 5ustar tfheentfheenmerb-haml-1.1.3/lib/generators/templates/controller/app/0000755000175000017500000000000011765176217022561 5ustar tfheentfheenmerb-haml-1.1.3/lib/generators/templates/controller/app/views/0000755000175000017500000000000011765176217023716 5ustar tfheentfheenmerb-haml-1.1.3/lib/generators/templates/controller/app/views/%file_name%/0000755000175000017500000000000011765176217025747 5ustar tfheentfheenmerb-haml-1.1.3/lib/generators/templates/controller/app/views/%file_name%/index.html.haml0000644000175000017500000000006411765176217030664 0ustar tfheentfheenYou're in index of the <%= class_name %> controller.merb-haml-1.1.3/lib/generators/templates/resource_controller/0000755000175000017500000000000011765176217023710 5ustar tfheentfheenmerb-haml-1.1.3/lib/generators/templates/resource_controller/sequel/0000755000175000017500000000000011765176217025206 5ustar tfheentfheenmerb-haml-1.1.3/lib/generators/templates/resource_controller/sequel/app/0000755000175000017500000000000011765176217025766 5ustar tfheentfheenmerb-haml-1.1.3/lib/generators/templates/resource_controller/sequel/app/views/0000755000175000017500000000000011765176217027123 5ustar tfheentfheenmerb-haml-1.1.3/lib/generators/templates/resource_controller/sequel/app/views/%file_name%/0000755000175000017500000000000011765176217031154 5ustar tfheentfheen././@LongLink0000000000000000000000000000015200000000000011563 Lustar rootrootmerb-haml-1.1.3/lib/generators/templates/resource_controller/sequel/app/views/%file_name%/index.html.hamlmerb-haml-1.1.3/lib/generators/templates/resource_controller/sequel/app/views/%file_name%/index.html0000644000175000017500000000016711765176217033155 0ustar tfheentfheen%h1 <%= class_name %> controller, index action %p Edit this file in %tt app/views/<%= file_name %>/index.html.haml././@LongLink0000000000000000000000000000015100000000000011562 Lustar rootrootmerb-haml-1.1.3/lib/generators/templates/resource_controller/sequel/app/views/%file_name%/edit.html.hamlmerb-haml-1.1.3/lib/generators/templates/resource_controller/sequel/app/views/%file_name%/edit.html.0000644000175000017500000000016511765176217033047 0ustar tfheentfheen%h1 <%= class_name %> controller, edit action %p Edit this file in %tt app/views/<%= file_name %>/edit.html.haml././@LongLink0000000000000000000000000000015100000000000011562 Lustar rootrootmerb-haml-1.1.3/lib/generators/templates/resource_controller/sequel/app/views/%file_name%/show.html.hamlmerb-haml-1.1.3/lib/generators/templates/resource_controller/sequel/app/views/%file_name%/show.html.0000644000175000017500000000016511765176217033102 0ustar tfheentfheen%h1 <%= class_name %> controller, show action %p Edit this file in %tt app/views/<%= file_name %>/show.html.haml././@LongLink0000000000000000000000000000015000000000000011561 Lustar rootrootmerb-haml-1.1.3/lib/generators/templates/resource_controller/sequel/app/views/%file_name%/new.html.hamlmerb-haml-1.1.3/lib/generators/templates/resource_controller/sequel/app/views/%file_name%/new.html.h0000644000175000017500000000016311765176217033061 0ustar tfheentfheen%h1 <%= class_name %> controller, new action %p Edit this file in %tt app/views/<%= file_name %>/new.html.hamlmerb-haml-1.1.3/lib/generators/templates/resource_controller/none/0000755000175000017500000000000011765176217024647 5ustar tfheentfheenmerb-haml-1.1.3/lib/generators/templates/resource_controller/none/app/0000755000175000017500000000000011765176217025427 5ustar tfheentfheenmerb-haml-1.1.3/lib/generators/templates/resource_controller/none/app/views/0000755000175000017500000000000011765176217026564 5ustar tfheentfheenmerb-haml-1.1.3/lib/generators/templates/resource_controller/none/app/views/%file_name%/0000755000175000017500000000000011765176217030615 5ustar tfheentfheen././@LongLink0000000000000000000000000000015000000000000011561 Lustar rootrootmerb-haml-1.1.3/lib/generators/templates/resource_controller/none/app/views/%file_name%/index.html.hamlmerb-haml-1.1.3/lib/generators/templates/resource_controller/none/app/views/%file_name%/index.html.h0000644000175000017500000000016711765176217033044 0ustar tfheentfheen%h1 <%= class_name %> controller, index action %p Edit this file in %tt app/views/<%= file_name %>/index.html.haml././@LongLink0000000000000000000000000000014700000000000011567 Lustar rootrootmerb-haml-1.1.3/lib/generators/templates/resource_controller/none/app/views/%file_name%/edit.html.hamlmerb-haml-1.1.3/lib/generators/templates/resource_controller/none/app/views/%file_name%/edit.html.ha0000644000175000017500000000016511765176217033021 0ustar tfheentfheen%h1 <%= class_name %> controller, edit action %p Edit this file in %tt app/views/<%= file_name %>/edit.html.haml././@LongLink0000000000000000000000000000014700000000000011567 Lustar rootrootmerb-haml-1.1.3/lib/generators/templates/resource_controller/none/app/views/%file_name%/show.html.hamlmerb-haml-1.1.3/lib/generators/templates/resource_controller/none/app/views/%file_name%/show.html.ha0000644000175000017500000000016511765176217033054 0ustar tfheentfheen%h1 <%= class_name %> controller, show action %p Edit this file in %tt app/views/<%= file_name %>/show.html.haml././@LongLink0000000000000000000000000000014600000000000011566 Lustar rootrootmerb-haml-1.1.3/lib/generators/templates/resource_controller/none/app/views/%file_name%/new.html.hamlmerb-haml-1.1.3/lib/generators/templates/resource_controller/none/app/views/%file_name%/new.html.ham0000644000175000017500000000016311765176217033040 0ustar tfheentfheen%h1 <%= class_name %> controller, new action %p Edit this file in %tt app/views/<%= file_name %>/new.html.hamlmerb-haml-1.1.3/lib/generators/templates/resource_controller/datamapper/0000755000175000017500000000000011765176217026026 5ustar tfheentfheenmerb-haml-1.1.3/lib/generators/templates/resource_controller/datamapper/app/0000755000175000017500000000000011765176217026606 5ustar tfheentfheenmerb-haml-1.1.3/lib/generators/templates/resource_controller/datamapper/app/views/0000755000175000017500000000000011765176217027743 5ustar tfheentfheenmerb-haml-1.1.3/lib/generators/templates/resource_controller/datamapper/app/views/%file_name%/0000755000175000017500000000000011765176217031774 5ustar tfheentfheen././@LongLink0000000000000000000000000000015600000000000011567 Lustar rootrootmerb-haml-1.1.3/lib/generators/templates/resource_controller/datamapper/app/views/%file_name%/index.html.hamlmerb-haml-1.1.3/lib/generators/templates/resource_controller/datamapper/app/views/%file_name%/index.0000644000175000017500000000122611765176217033105 0ustar tfheentfheen%h1 <%= class_name %> controller, index action %p Edit this file in %tt app/views/<%= file_name %>/index.html.haml %table %tr <% for property in properties.reject{|p| p.lazy?} -%> %th <%= DataMapper::Inflection.humanize(property.field) %> <% end -%> - for <%= singular_model %> in @<%= plural_model %> %tr <% for property in properties.reject{|p| p.lazy?} -%> %td =h <%= singular_model %>.<%= property.getter %> <% end -%> %td = link_to 'Show', resource(<%= singular_model %>) %td = link_to 'Edit', resource(<%= singular_model %>, :edit) = link_to 'New', resource(:<%= plural_model %>, :new)././@LongLink0000000000000000000000000000015500000000000011566 Lustar rootrootmerb-haml-1.1.3/lib/generators/templates/resource_controller/datamapper/app/views/%file_name%/edit.html.hamlmerb-haml-1.1.3/lib/generators/templates/resource_controller/datamapper/app/views/%file_name%/edit.h0000644000175000017500000000112311765176217033067 0ustar tfheentfheen%h1 <%= class_name %> controller, edit action %p Edit this file in %tt app/views/<%= file_name %>/edit.html.haml = error_messages_for @<%= singular_model %> = form_for(@<%= singular_model %>, :action => resource(@<%= singular_model %>)) do <% for property in properties.select{|p| !p.key?} -%> %p %b <%= DataMapper::Inflection.humanize(property.field) %> %br/ = <%= field_from_type(property.type) %> :<%= property.getter %> <% end -%> %p = submit "Update" = link_to 'Show', resource(@<%= singular_model %>) | = link_to 'Back', resource(:<%= plural_model %>)././@LongLink0000000000000000000000000000015500000000000011566 Lustar rootrootmerb-haml-1.1.3/lib/generators/templates/resource_controller/datamapper/app/views/%file_name%/show.html.hamlmerb-haml-1.1.3/lib/generators/templates/resource_controller/datamapper/app/views/%file_name%/show.h0000644000175000017500000000061511765176217033127 0ustar tfheentfheen%h1 <%= class_name %> controller, show action %p Edit this file in %tt app/views/<%= file_name %>/show.html.haml <% for property in properties -%> %p %b <%= DataMapper::Inflection.humanize(property.field) %>: =h @<%= singular_model %>.<%= property.getter %> <% end -%> = link_to 'Edit', resource(@<%= singular_model %>, :edit) | = link_to 'Back', resource(:<%= plural_model %>)././@LongLink0000000000000000000000000000015400000000000011565 Lustar rootrootmerb-haml-1.1.3/lib/generators/templates/resource_controller/datamapper/app/views/%file_name%/new.html.hamlmerb-haml-1.1.3/lib/generators/templates/resource_controller/datamapper/app/views/%file_name%/new.ht0000644000175000017500000000102511765176217033120 0ustar tfheentfheen%h1 <%= class_name %> controller, new action %p Edit this file in %tt app/views/<%= file_name %>/new.html.haml = error_messages_for @<%= singular_model %> = form_for(@<%= singular_model %>, :action => resource(:<%= plural_model %>) ) do <% for property in properties.select{|p| !p.key?} -%> %p %b <%= DataMapper::Inflection.humanize(property.field) %> = <%= field_from_type(property.type) %> :<%= property.getter %> <% end -%> %p = submit "Create" = link_to 'Back', resource(:<%= plural_model %>)merb-haml-1.1.3/lib/generators/templates/resource_controller/activerecord/0000755000175000017500000000000011765176217026362 5ustar tfheentfheenmerb-haml-1.1.3/lib/generators/templates/resource_controller/activerecord/app/0000755000175000017500000000000011765176217027142 5ustar tfheentfheenmerb-haml-1.1.3/lib/generators/templates/resource_controller/activerecord/app/views/0000755000175000017500000000000011765176217030277 5ustar tfheentfheenmerb-haml-1.1.3/lib/generators/templates/resource_controller/activerecord/app/views/%file_name%/0000755000175000017500000000000011765176217032330 5ustar tfheentfheen././@LongLink0000000000000000000000000000016000000000000011562 Lustar rootrootmerb-haml-1.1.3/lib/generators/templates/resource_controller/activerecord/app/views/%file_name%/index.html.hamlmerb-haml-1.1.3/lib/generators/templates/resource_controller/activerecord/app/views/%file_name%/inde0000644000175000017500000000016711765176217033176 0ustar tfheentfheen%h1 <%= class_name %> controller, index action %p Edit this file in %tt app/views/<%= file_name %>/index.html.haml././@LongLink0000000000000000000000000000015700000000000011570 Lustar rootrootmerb-haml-1.1.3/lib/generators/templates/resource_controller/activerecord/app/views/%file_name%/edit.html.hamlmerb-haml-1.1.3/lib/generators/templates/resource_controller/activerecord/app/views/%file_name%/edit0000644000175000017500000000016511765176217033202 0ustar tfheentfheen%h1 <%= class_name %> controller, edit action %p Edit this file in %tt app/views/<%= file_name %>/edit.html.haml././@LongLink0000000000000000000000000000015700000000000011570 Lustar rootrootmerb-haml-1.1.3/lib/generators/templates/resource_controller/activerecord/app/views/%file_name%/show.html.hamlmerb-haml-1.1.3/lib/generators/templates/resource_controller/activerecord/app/views/%file_name%/show0000644000175000017500000000016511765176217033235 0ustar tfheentfheen%h1 <%= class_name %> controller, show action %p Edit this file in %tt app/views/<%= file_name %>/show.html.haml././@LongLink0000000000000000000000000000015600000000000011567 Lustar rootrootmerb-haml-1.1.3/lib/generators/templates/resource_controller/activerecord/app/views/%file_name%/new.html.hamlmerb-haml-1.1.3/lib/generators/templates/resource_controller/activerecord/app/views/%file_name%/new.0000644000175000017500000000016311765176217033122 0ustar tfheentfheen%h1 <%= class_name %> controller, new action %p Edit this file in %tt app/views/<%= file_name %>/new.html.hamlmerb-haml-1.1.3/lib/merb-haml.rb0000644000175000017500000000225511765176217015644 0ustar tfheentfheenrequire "merb-core" require "haml" require "merb-haml/template" Merb::Plugins.add_rakefiles(File.join(File.dirname(__FILE__) / "merb-haml" / "merbtasks")) Merb::Plugins.config[:sass] ||= {} Merb::BootLoader.after_app_loads do template_locations = [] template_locations << Merb.dir_for(:stylesheet) / "sass" # extract template locations list from sass config config_location = Merb::Plugins.config[:sass][:template_location] if config_location.is_a? Hash template_locations += config_location.keys elsif config_location template_locations << config_location.to_s end # setup sass if any template paths match if template_locations.any?{|location| File.directory?(location) } require "sass" if Merb::Config[:sass] Merb.logger.info("Please define your sass settings in Merb::Plugins.config[:sass] not Merb::Config") Sass::Plugin.options = Merb::Config[:sass] else Sass::Plugin.options = Merb::Plugins.config[:sass] end end end generators = File.join(File.dirname(__FILE__), 'generators') Merb.add_generators generators / "resource_controller" Merb.add_generators generators / "controller" Merb.add_generators generators / "layout" merb-haml-1.1.3/lib/merb-haml/0000755000175000017500000000000011765176217015313 5ustar tfheentfheenmerb-haml-1.1.3/lib/merb-haml/merbtasks.rb0000644000175000017500000000043111765176217017631 0ustar tfheentfheennamespace :haml do desc "Compiles all sass files into CSS" task :compile_sass do require 'sass' puts "*** Updating stylesheets" Sass::Plugin.options = Merb::Config[:sass] if Merb::Config[:sass] Sass::Plugin.update_stylesheets puts "*** Done" end endmerb-haml-1.1.3/lib/merb-haml/version.rb0000644000175000017500000000010111765176217017315 0ustar tfheentfheenmodule Merb module Haml VERSION = '1.1.3'.freeze end end merb-haml-1.1.3/lib/merb-haml/template.rb0000644000175000017500000000335411765176217017460 0ustar tfheentfheenmodule Merb::Template class Haml # Defines a method for calling a specific HAML template. # # ==== Parameters # path:: Path to the template file. # name<~to_s>:: The name of the template method. # locals:: A list of locals to assign from the args passed into the compiled template. # mod:: # The class or module wherein this method should be defined. def self.compile_template(io, name, locals, mod) path = File.expand_path(io.path) config = (Merb::Plugins.config[:haml] || {}).inject({}) do |c, (k, v)| c[k.to_sym] = v c end.merge :filename => path template = ::Haml::Engine.new(io.read, config) template.def_method(mod, name, *locals) name end module Mixin # ==== Parameters # string:: The string to add to the HAML buffer. # binding:: # Not used by HAML, but is necessary to conform to the concat_* # interface. def concat_haml(string, binding) haml_buffer.buffer << string end end Merb::Template.register_extensions(self, %w[haml]) end end module Haml class Engine # ==== Parameters # object:: # The class or module wherein this method should be defined. # name<~to_s>:: The name of the template method. # *local_names:: Local names to define in the HAML template. def def_method(object, name, *local_names) method = object.is_a?(Module) ? :module_eval : :instance_eval setup = "@_engine = 'haml'" object.send(method, "def #{name}(_haml_locals = {}); #{setup}; #{precompiled_with_ambles(local_names)}; end", @options[:filename], 0) end end end