Permalink
Browse files

added --app_name option

  • Loading branch information...
1 parent 2a174a1 commit cd8856f087bc8b700d86ae3deb5d1f40cef05168 @pilu pilu committed Feb 14, 2009
@@ -2,13 +2,13 @@
<html xmlns="http://www.w3.org/1999/xhtml" lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
- <title>Web App Theme</title>
+ <title><%= options[:app_name] %></title>
<%%= stylesheet_link_tag 'web_app_theme', "themes/<%= options[:theme] %>/style" %>
</head>
<body>
<div id="container">
<div id="header">
- <h1><a href="#">Web App Theme</a></h1>
+ <h1><a href="/"><%= options[:app_name] %></a></h1>
<div id="user-navigation">
<ul>
<li><a href="#">Profile</a></li>
@@ -2,7 +2,7 @@
<html xmlns="http://www.w3.org/1999/xhtml" lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
- <title>Web App Theme</title>
+ <title><%= options[:app_name] %></title>
<%%= stylesheet_link_tag 'web_app_theme', "themes/<%= options[:theme] %>/style" %>
</head>
<body>
@@ -1,6 +1,7 @@
class ThemeGenerator < Rails::Generator::Base
- default_options :layout_type => :administration,
+ default_options :app_name => 'Web App',
+ :layout_type => :administration,
:theme => :default,
:no_layout => false
@@ -28,6 +29,7 @@ def banner
def add_options!(opt)
opt.separator ''
opt.separator 'Options:'
+ opt.on("--app_name=app_name", String, "") { |v| options[:app_name] = v }
opt.on("--type=layout_type", String, "Specify the layout type") { |v| options[:layout_type] = v }
opt.on("--theme=theme", String, "Specify the theme") { |v| options[:theme] = v }
opt.on("--no-layout", "Don't create layout") { |v| options[:no_layout] = true }
@@ -1,4 +1,4 @@
-<h1>Web App Theme</h1>
+<h1><%= options[:app_name] %></h1>
<div class="block" id="block-login">
<h2>Login Box</h2>
<div class="content login">
@@ -1,4 +1,4 @@
-<h1>Web App Theme</h1>
+<h1><%= options[:app_name] %></h1>
<div class="block" id="block-signup">
<h2>Sign up</h2>
<div class="content">
@@ -1,6 +1,7 @@
class ThemedGenerator < Rails::Generator::NamedBase
- default_options :themed_type => :crud,
+ default_options :app_name => 'Web App',
+ :themed_type => :crud,
:layout => false,
:will_paginate => false
@@ -32,7 +33,7 @@ def manifest
@resource_name = @model_name.downcase
# posts
@plural_resource_name = @resource_name.pluralize
-
+
manifest_method = "manifest_for_#{options[:themed_type]}"
record do |m|
send(manifest_method, m) if respond_to?(manifest_method)
@@ -78,6 +79,7 @@ def banner
def add_options!(opt)
opt.separator ''
opt.separator 'Options:'
+ opt.on("--app_name=app_name", String, "") { |v| options[:app_name] = v }
opt.on("--type=themed_type", String, "") { |v| options[:themed_type] = v }
opt.on("--layout=layout", String, "Add menu link") { |v| options[:layout] = v }
opt.on("--with_will_paginate", "Add pagination using will_paginate") { |v| options[:will_paginate] = true }

0 comments on commit cd8856f

Please sign in to comment.