Skip to content

Commit

Permalink
add rake task for new quote
Browse files Browse the repository at this point in the history
  • Loading branch information
jess committed Feb 9, 2012
1 parent 49d7563 commit 89928a1
Show file tree
Hide file tree
Showing 6 changed files with 58 additions and 2 deletions.
2 changes: 2 additions & 0 deletions .gitignore
Expand Up @@ -23,3 +23,5 @@ pkg
*.gem
.rvmrc
.bundle

views/quotes/*
10 changes: 10 additions & 0 deletions Rakefile
@@ -0,0 +1,10 @@
desc "Create a new quote page"
task :new_quote, :name do |t, args|
client = args[:name]
dir_name = client.gsub(' ', '-')
dest = File.join("views/quotes/#{dir_name}")
puts "Create quote for #{args[:name]}..."
FileUtils.mkdir(dest)
FileUtils.cp("template/index.html.haml", dest)
puts "Ok, start quoting in #{dest}"
end
18 changes: 18 additions & 0 deletions config/setup_load_paths.rb
@@ -0,0 +1,18 @@
# RVM support in Rails 3 app for multiple gemsets with Passenger
# config/setup_load_paths.rb

if ENV['MY_RUBY_HOME'] && ENV['MY_RUBY_HOME'].include?('rvm')
begin
rvm_path = File.dirname(File.dirname(ENV['MY_RUBY_HOME']))
rvm_lib_path = File.join(rvm_path, 'lib')
$LOAD_PATH.unshift rvm_lib_path
require 'rvm'
RVM.use_from_path! File.dirname(File.dirname(__FILE__))
rescue LoadError
# RVM is unavailable at this point.
raise "RVM ruby lib is currently unavailable."
end
end

ENV['BUNDLE_GEMFILE'] = File.expand_path('../Gemfile', File.dirname(__FILE__))
require 'bundler/setup'
26 changes: 26 additions & 0 deletions template/index.html.haml
@@ -0,0 +1,26 @@
- @page_title = ""
=render "/partials/calculator", :locals => {:default_unit_price => 75}
.quote
=render "/partials/quote_header"
.spacer
%p Some Description here if we want
=line_item("Web Design", "Place Description here...", 5)
=line_item("Web Design", "Place Description here...", "5 hrs.")
=line_item("Web Design", "Place Description here...", "5h", :spacer => true, :subtotal => true)
.row
%h3 Option Number One
%p Some Description
.row
.item Web Design
.description
%ul
%li Item 1
%li Item 2
%li Item 3
.units 5hrs
.unit_price
.total total
.spacer
=render "/partials/total"


2 changes: 1 addition & 1 deletion views/_layout.html.haml
Expand Up @@ -25,5 +25,5 @@
#container
.inner
%header
=image_tag "images/logo.jpg", :width => 200
=image_tag "/images/logo.jpg", :width => 200
=yield
2 changes: 1 addition & 1 deletion views/view_helpers.rb
@@ -1,5 +1,5 @@
module ViewHelpers
def line_item(item, descr, units, options={})
render "partials/line_item", :locals => {:item => item, :descr => descr, :units => units, :unit_price => options[:unit_price], :spacer => options[:spacer], :subtotal => options[:subtotal]}
render "/partials/line_item", :locals => {:item => item, :descr => descr, :units => units, :unit_price => options[:unit_price], :spacer => options[:spacer], :subtotal => options[:subtotal]}
end
end

0 comments on commit 89928a1

Please sign in to comment.