Skip to content

Commit 298b3bb

Browse files
committed
added theme generator for rails 3
1 parent 67f7e5e commit 298b3bb

File tree

2 files changed

+59
-0
lines changed

2 files changed

+59
-0
lines changed
Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
<!DOCTYPE html>
2+
<html>
3+
<head>
4+
<title><%= options.app_name %></title>
5+
<%%= stylesheet_link_tag "web_app_theme", "web_app_theme_override", "themes/<%= options.theme %>/style", :cache => true %>
6+
<%%= csrf_meta_tag %>
7+
</head>
8+
<body>
9+
<div id="container">
10+
<div id="header">
11+
<h1><a href="/"><%= options.app_name %></a></h1>
12+
<div id="user-navigation">
13+
<ul class="wat-cf">
14+
<li><a href="#"><%%= t("web-app-theme.profile", :default => "Profile") %></a></li>
15+
<li><a href="#"><%%= t("web-app-theme.settings", :default => "Settings") %></a></li>
16+
<li><a href="/logout" class="logout"><%%= t("web-app-theme.logout", :default => "Logout") %></a></li>
17+
</ul>
18+
</div>
19+
<div id="main-navigation">
20+
<ul class="wat-cf"></ul>
21+
</div>
22+
</div>
23+
<div id="wrapper" class="wat-cf">
24+
<div class="flash">
25+
<%% flash.each do |type, message| -%>
26+
<div class="message <%%= type %>">
27+
<p><%%= message %></p>
28+
</div>
29+
<%% end -%>
30+
</div>
31+
<div id="main">
32+
<%%= yield %>
33+
<div id="footer">
34+
<div class="block">
35+
<p>Copyright &copy; <%%= Time.now.year %> <%= options.app_name %>.</p>
36+
</div>
37+
</div>
38+
</div>
39+
<div id="sidebar">
40+
<%%= yield :sidebar %>
41+
</div>
42+
</div>
43+
</div>
44+
</body>
45+
</html>
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
module WebAppTheme
2+
class ThemeGenerator < Rails::Generators::Base
3+
source_root File.expand_path('../../templates', __FILE__)
4+
5+
argument :layout_name, :type => :string, :default => 'application'
6+
7+
class_option :theme, :type => :string, :default => :default, :desc => 'Specify the layout theme'
8+
class_option :app_name, :type => :string, :default => 'Web App', :desc => 'Specify the application name'
9+
10+
def copy_layout
11+
template("layout_admin.html.erb", "app/views/layouts/#{layout_name.underscore}.html.erb")
12+
end
13+
end
14+
end

0 commit comments

Comments
 (0)