Skip to content

Commit

Permalink
Merge branch 'master' of git://github.com/pilu/web-app-theme
Browse files Browse the repository at this point in the history
  • Loading branch information
Giovanni Intini committed Feb 28, 2009
2 parents c183aa3 + ef33ca8 commit cf448b5
Show file tree
Hide file tree
Showing 21 changed files with 1,408 additions and 245 deletions.
103 changes: 60 additions & 43 deletions index.html
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@
<body>
<div id="container">
<div id="header">
<h1><a href="index.html">Wep App Theme</a></h1>
<h1><a href="index.html">Web App Theme</a></h1>
<div id="user-navigation">
<ul>
<li><a href="#">Profile</a></li>
Expand Down Expand Up @@ -118,28 +118,29 @@ <h2 class="title">Tables</h2>
<th>ID</th>
<th>Login</th>
<th>Name</th>
<th class="last">Surname</th>
<th>Surname</th>
<th class="last">&nbsp;</th>
</tr>
<tr>
<td><input type="checkbox" class="checkbox" name="id" value="1" /></td><td>1</td><td>hulk</td><td>Hulk</td><td>Hogan</td>
<tr class="odd">
<td><input type="checkbox" class="checkbox" name="id" value="1" /></td><td>1</td><td>hulk</td><td>Hulk</td><td>Hogan</td><td class="last"><a href="#">show</a> | <a href="#">edit</a> | <a href="#">destroy</a></td>
</tr>
<tr>
<td><input type="checkbox" class="checkbox" name="id" value="1" /></td><td>2</td><td>ultimate</td><td>Ultimate</td><td>Warrior</td>
<tr class="even">
<td><input type="checkbox" class="checkbox" name="id" value="1" /></td><td>2</td><td>ultimate</td><td>Ultimate</td><td>Warrior</td><td class="last"><a href="#">show</a> | <a href="#">edit</a> | <a href="#">destroy</a></td>
</tr>
<tr>
<td><input type="checkbox" class="checkbox" name="id" value="1" /></td><td>3</td><td>andre</td><td>Andre</td><td>The Giant</td>
<tr class="odd">
<td><input type="checkbox" class="checkbox" name="id" value="1" /></td><td>3</td><td>andre</td><td>Andre</td><td>The Giant</td><td class="last"><a href="#">show</a> | <a href="#">edit</a> | <a href="#">destroy</a></td>
</tr>
<tr>
<td><input type="checkbox" class="checkbox" name="id" value="1" /></td><td>4</td><td>machoman</td><td>Macho Man</td><td>Randy Savage</td>
<tr class="even">
<td><input type="checkbox" class="checkbox" name="id" value="1" /></td><td>4</td><td>machoman</td><td>Macho Man</td><td>Randy Savage</td><td class="last"><a href="#">show</a> | <a href="#">edit</a> | <a href="#">destroy</a></td>
</tr>
</table>
<div class="actions-bar">
<div class="actions">
<input type="submit" class="button" value="Delete" />
</div>
<div class="pagination">
<span class="current">1</span><a href="#">2</a><a href="#">3</a><a href="#">4</a><a href="#">5</a><a href="#">6</a><a href="#">7</a><a href="#">8</a><a href="#">9</a><a href="#">10</a><a href="#">Next »</a>
</div>
<span class="disabled prev_page">« Previous</span><span class="current">1</span><a rel="next" href="#">2</a><a href="#">3</a><a href="#">4</a><a href="#">5</a><a href="#">6</a><a href="#">7</a><a href="#">8</a><a href="#">9</a><a href="#">10</a><a href="#">11</a><a rel="next" class="next_page" href="#">Next »</a>
</div>
<div class="clear"></div>
</div>
</form>
Expand All @@ -165,12 +166,20 @@ <h2 class="title">Forms</h2>
<form action="#" method="get" class="form">
<div class="group">
<label class="label">Text field</label>
<input type="text" class="text" />
<input type="text" class="text_field" />
<span class="description">Ex: a simple text</span>
</div>
<div class="group">
<div class="fieldWithErrors">
<label class="label" for="post_title">Title</label>
<span class="error">can't be blank</span>
</div>
<input type="text" class="text_field" />
<span class="description">Ex: a simple text</span>
</div>
<div class="group">
<label class="label">Text area</label>
<textarea class="textarea" rows="10" cols="80"></textarea>
<textarea class="text_area" rows="10" cols="80"></textarea>
<span class="description">Write here a long text</span>
</div>
<div class="group navform">
Expand All @@ -196,14 +205,16 @@ <h2 class="title">Forms</h2>
<div class="content">
<h2 class="title">Messages</h2>
<div class="inner">
<div class="flash-messages error">
<p>Error message</p>
</div>
<div class="flash-messages warning">
<p>Warning message</p>
</div>
<div class="flash-messages notice">
<p>Notice message</p>
<div class="flash">
<div class="message error">
<p>Error message</p>
</div>
<div class="message warning">
<p>Warning message</p>
</div>
<div class="message notice">
<p>Notice message</p>
</div>
</div>
</div>
</div>
Expand All @@ -229,11 +240,11 @@ <h2 class="title">2 columns forms</h2>
<div class="column left">
<div class="group">
<label class="label">Text field</label>
<input type="text" class="text" />
<input type="text" class="text_field" />
</div>
<div class="group">
<label class="label">Text area</label>
<textarea class="textarea" rows="10" cols="80"></textarea>
<textarea class="text_area" rows="10" cols="80"></textarea>
</div>
</div>
<div class="column right">
Expand Down Expand Up @@ -314,7 +325,11 @@ <h2 class="title">Lists</h2>
</div>
</div>
</div>

<div id="footer">
<div class="block">
<p>Copyright &copy; 2009 Your Site.</p>
</div>
</div>
</div>
<div id="sidebar">
<div class="block">
Expand All @@ -328,7 +343,9 @@ <h3>Switch Theme</h3>
<ul class="navigation">
<li><a href="#" onclick="Theme.activate('default'); return false;">Default</a></li>
<li class="last"><a href="#" onclick="Theme.activate('bec'); return false;">Bec</a></li>
<li><a href="#" onclick="Theme.activate('black-grey'); return false;">Black &amp; Grey</a></li>
<li class="last"><a href="#" onclick="Theme.activate('bec-green'); return false;">Bec-Green</a></li>
<li><a href="#" onclick="Theme.activate('orange'); return false;">Orange</a></li>
<li><a href="#" onclick="Theme.activate('reidb-greenish'); return false;">Greenish</a></li>
</ul>
</div>
<div class="block">
Expand All @@ -354,24 +371,24 @@ <h4>Sidebar Inner block Title</h4>
</div>
</div>
<div class="clear"></div>
</div>
<div id="footer">
<div class="block">
<p>Copyright &copy; 2009 Your Site.</p>
</div>
</div>
</div>
<div id="box">
<h1>Wen App Theme</h1>
<h1>Web App Theme</h1>
<div class="block" id="block-login">
<h2>Login Box</h2>
<div class="content login">
<div class="flash">
<div class="message notice">
<p>Logged in successfully</p>
</div>
</div>
<form action="#" class="form login">
<div class="group">
<div class="left">
<label class="label right">Login</label>
</div>
<div class="right">
<input type="text" class="text" />
<input type="text" class="text_field" />
</div>
<div class="clear"></div>
</div>
Expand All @@ -380,7 +397,7 @@ <h2>Login Box</h2>
<label class="label right">Password</label>
</div>
<div class="right">
<input type="password" class="text" />
<input type="password" class="text_field" />
</div>
<div class="clear"></div>
</div>
Expand All @@ -395,15 +412,15 @@ <h2>Login Box</h2>
</div>

<div class="block" id="block-signup">
<h2>Sign up</h2>
<div class="content">
<h2>Sign up</h2>
<div class="content">
<form action="#" class="form">
<div class="group">
<div class="left">
<label class="label">Login</label>
</div>
<div class="right">
<input type="text" class="text" />
<input type="text" class="text_field" />
<span class="description">Ex: web-app-theme</span>
</div>
<div class="clear"></div>
Expand All @@ -413,7 +430,7 @@ <h2>Sign up</h2>
<label class="label">Email</label>
</div>
<div class="right">
<input type="text" class="text" />
<input type="text" class="text_field" />
<span class="description">Ex: test@example.com</span>
</div>
<div class="clear"></div>
Expand All @@ -423,20 +440,20 @@ <h2>Sign up</h2>
<label class="label">Password</label>
</div>
<div class="right">
<input type="password" class="text" />
<input type="password" class="text_field" />
<span class="description">Must contains the word 'yeah'</span>
</div>
<div class="clear"></div>
</div>

<div class="group">
<label class="label">Text field</label>
<input type="text" class="text" />
<input type="text" class="text_field" />
<span class="description">Ex: a simple text</span>
</div>
<div class="group">
<label class="label">Text field</label>
<input type="text" class="text" />
<input type="text" class="text_field" />
<span class="description">Ex: a simple text</span>
</div>
<div class="group navform">
Expand All @@ -448,4 +465,4 @@ <h2>Sign up</h2>
</div>
</div>
</body>
</html>
</html>
4 changes: 4 additions & 0 deletions rails_generators/theme/USAGE
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
./script/generate theme
./script/generate theme LayoutName
./script/generate theme --theme=ThemeName
./script/generate theme --no-layout
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<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="/"><%= options[:app_name] %></a></h1>
<div id="user-navigation">
<ul>
<li><a href="#">Profile</a></li>
<li><a href="#">Settings</a></li>
<li><a href="/logout">Logout</a></li>
</ul>
<div class="clear"></div>
</div>
<div id="main-navigation">
<ul></ul>
<div class="clear"></div>
</div>
</div>
<div id="wrapper">
<div id="main">
<%%= yield %>
<div id="footer">
<div class="block">
<p>Copyright &copy; 2009 Your Site.</p>
</div>
</div>
</div>
<div id="sidebar">
<%%= yield :sidebar %>
</div>
<div class="clear"></div>
</div>
</div>
</body>
</html>
15 changes: 15 additions & 0 deletions rails_generators/theme/templates/view_layout_sign.html.erb
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title><%= options[:app_name] %></title>
<%%= stylesheet_link_tag 'web_app_theme', "themes/<%= options[:theme] %>/style" %>
</head>
<body>
<div id="container">
<div id="box">
<%%= yield %>
</div>
</div>
</body>
</html>
38 changes: 38 additions & 0 deletions rails_generators/theme/theme_generator.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
class ThemeGenerator < Rails::Generator::Base

default_options :app_name => 'Web App',
:layout_type => :administration,
:theme => :default,
:no_layout => false

def initialize(runtime_args, runtime_options = {})
super
@name = @args.first || 'application'
end

def manifest
record do |m|
m.directory("app/views/layouts")
m.directory("public/stylesheets/themes/#{options[:theme]}/")
m.template("view_layout_#{options[:layout_type]}.html.erb", File.join("app/views/layouts", "#{@name}.html.erb")) unless options[:no_layout]
m.template("../../../stylesheets/base.css", File.join("public/stylesheets", "web_app_theme.css"))
m.template("../../../stylesheets/themes/#{options[:theme]}/style.css", File.join("public/stylesheets/themes/#{options[:theme]}", "style.css"))
end
end

def banner
"Usage: #{$0} theme [layout_name] [options]"
end

protected

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 }
end

end
4 changes: 4 additions & 0 deletions rails_generators/themed/USAGE
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
./script/generate themed ControllerPath
./script/generate themed ControllerPath ModelName
./script/generate themed ControllerPath ModelName --layout=application
./script/generate themed ControllerPath ModelName --with_will_paginate
29 changes: 29 additions & 0 deletions rails_generators/themed/templates/view_edit.html.erb
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
<div class="block">
<div class="secondary-navigation">
<ul>
<li class="first"><%%= link_to 'List', <%= controller_routing_path %>_path %></li>
<li><%%= link_to 'New', new_<%= singular_controller_routing_path %>_path %></li>
<li class="active"><%%= link_to 'Edit', edit_<%= singular_controller_routing_path %>_path %></li>
</ul>
<div class="clear"></div>
</div>
<div class="content">
<h2 class="title">Edit <%= model_name %></h2>
<div class="inner">
<%% form_for @<%= model_name.downcase %>, :url => <%= singular_controller_routing_path %>_path(@<%= resource_name %>), :html => { :class => :form } do |f| -%>
<% columns.each do |column| %>
<div class="group">
<%%= f.label :<%= column.name %>, "<%= column.name %>", :class => :label %>
<%%= f.<%= column.field_type %> :<%= column.name %>, :class => '<%= column.field_type %>' %>
<span class="description">Ex: a simple text</span>
</div>
<%- end -%>
<div class="group navform">
<input type="submit" class="button" value="Save &rarr;" /> or <%%= link_to 'Cancel', <%= controller_routing_path %>_path %>
</div>
<%% end -%>
</div>
</div>
</div>

<%% content_for :sidebar, render(:partial => 'sidebar') -%>
Loading

0 comments on commit cf448b5

Please sign in to comment.