web-app-theme 0.5.2 → 0.5.3

Sign up to get free protection for your applications and to get access to all the features.
data/README.md CHANGED
@@ -33,6 +33,9 @@ If you want to use another theme, instead of the default, you can use the `--the
33
33
 
34
34
  script/generate theme --theme="drastic-dark"
35
35
 
36
+ You can specify the template engine with `--engine=name` option, where name can be erb (default) or haml:
37
+
38
+ script/generate theme --engine=haml
36
39
 
37
40
  If you want to generate the stylesheets of a specific theme without changing the previously generated layout you can pass the `--no-layout` option:
38
41
 
@@ -71,6 +74,10 @@ If you use `will_paginate` for pagination use the `--with_will_paginate`:
71
74
 
72
75
  script/generate themed items post --with_will_paginate
73
76
 
77
+ You can specify the template engine with `--engine=name` option, where name can be erb (default) or haml:
78
+
79
+ script/generate themed posts --engine=haml
80
+
74
81
  If you have something like `map.resource :dashboard` in your `routes.rb` file, you can use the `--type=text` to generate a view with just text:
75
82
 
76
83
  script/generate themed homes --type=text
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.5.2
1
+ 0.5.3
data/index.html CHANGED
@@ -1,8 +1,8 @@
1
1
  <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
2
2
  <html xmlns="http://www.w3.org/1999/xhtml" lang="en">
3
3
  <head>
4
- <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
5
- <title>Web App Theme</title>
4
+ <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
5
+ <title>Web App Theme</title>
6
6
  <link rel="stylesheet" href="stylesheets/base.css" type="text/css" media="screen" />
7
7
  <link rel="stylesheet" id="current-theme" href="stylesheets/themes/default/style.css" type="text/css" media="screen" />
8
8
  <script type="text/javascript" charset="utf-8" src="javascripts/jquery-1.3.min.js"></script>
@@ -344,16 +344,17 @@
344
344
  <h3>Switch Theme</h3>
345
345
  <ul class="navigation">
346
346
  <li><a href="#" onclick="Theme.activate('default'); return false;">Default</a></li>
347
- <li class="last"><a href="#" onclick="Theme.activate('bec'); return false;">Bec</a></li>
348
- <li class="last"><a href="#" onclick="Theme.activate('bec-green'); return false;">Bec-Green</a></li>
347
+ <li><a href="#" onclick="Theme.activate('amro'); return false;">Amro</a></li>
348
+ <li><a href="#" onclick="Theme.activate('bec'); return false;">Bec</a></li>
349
+ <li><a href="#" onclick="Theme.activate('bec-green'); return false;">Bec-Green</a></li>
349
350
  <li><a href="#" onclick="Theme.activate('blue'); return false;">Blue</a></li>
350
- <li><a href="#" onclick="Theme.activate('djime-cerulean'); return false;">Djime-Cerulean</a></li>
351
- <li><a href="#" onclick="Theme.activate('reidb-greenish'); return false;">Greenish</a></li>
351
+ <li><a href="#" onclick="Theme.activate('djime-cerulean'); return false;">Djime-Cerulean</a></li>
352
+ <li><a href="#" onclick="Theme.activate('drastic-dark'); return false;">Drastic Dark</a></li>
352
353
  <li><a href="#" onclick="Theme.activate('kathleene'); return false;">Kathleene</a></li>
354
+ <li><a href="#" onclick="Theme.activate('olive'); return false;">Olive</a></li>
353
355
  <li><a href="#" onclick="Theme.activate('orange'); return false;">Orange</a></li>
354
- <li><a href="#" onclick="Theme.activate('drastic-dark'); return false;">Drastic Dark</a></li>
356
+ <li><a href="#" onclick="Theme.activate('reidb-greenish'); return false;">Greenish</a></li>
355
357
  <li><a href="#" onclick="Theme.activate('warehouse'); return false;">Warehouse</a></li>
356
- <li><a href="#" onclick="Theme.activate('olive'); return false;">Olive</a></li>
357
358
  </ul>
358
359
  </div>
359
360
  <div class="block">
@@ -1,4 +1,5 @@
1
1
  ./script/generate theme
2
2
  ./script/generate theme LayoutName
3
3
  ./script/generate theme --theme=ThemeName
4
- ./script/generate theme --no-layout
4
+ ./script/generate theme --no-layout
5
+ ./script/generate theme --engine=haml
@@ -1,9 +1,9 @@
1
1
  <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
2
2
  <html xmlns="http://www.w3.org/1999/xhtml" lang="en">
3
3
  <head>
4
- <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
5
- <title><%= options[:app_name] %></title>
6
- <%%= stylesheet_link_tag "web_app_theme", "web_app_theme_override", "themes/<%= options[:theme] %>/style", :cache => true %>
4
+ <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
5
+ <title><%= options[:app_name] %></title>
6
+ <%%= stylesheet_link_tag "web_app_theme", "web_app_theme_override", "themes/<%= options[:theme] %>/style", :cache => true %>
7
7
  </head>
8
8
  <body>
9
9
  <div id="container">
@@ -32,7 +32,7 @@
32
32
  <%%= yield %>
33
33
  <div id="footer">
34
34
  <div class="block">
35
- <p>Copyright &copy; <%%= Time.now.year %> Your Site.</p>
35
+ <p>Copyright &copy; <%%= Time.now.year %> <%= options[:app_name] %>.</p>
36
36
  </div>
37
37
  </div>
38
38
  </div>
@@ -0,0 +1,30 @@
1
+ !!! Strict
2
+ %html
3
+ %head
4
+ %meta{'http-equiv' => 'Content-Type', :content => 'text/html; charset=utf-8'}
5
+ %title <%= options[:app_name] %>
6
+ = stylesheet_link_tag "web_app_theme", "web_app_theme_override", "themes/<%= options[:theme] %>/style", :cache => true
7
+ %body
8
+ #container
9
+ #header
10
+ %h1 <a href="/"><%= options[:app_name] %></a>
11
+ #user-navigation
12
+ %ul.wat-cf
13
+ <li><a href="#">#{ t("web-app-theme.profile", :default => "Profile") }</a></li>
14
+ <li><a href="#">#{ t("web-app-theme.settings", :default => "Settings") }</a></li>
15
+ <li><a href="/logout" class="logout">#{ t("web-app-theme.logout", :default => "Logout") }</a></li>
16
+ <div id="main-navigation">
17
+ <ul class="wat-cf"></ul>
18
+ </div>
19
+ #wrapper.wat-cf
20
+ .flash
21
+ - flash.each do |type, message|
22
+ .message{:class => type.to_s}
23
+ <p>#{ message }</p>
24
+ #main
25
+ = yield
26
+ #footer
27
+ .block
28
+ <p>Copyright &copy; #{ Time.now.year } Your Site.</p>
29
+ #sidebar
30
+ = yield :sidebar
@@ -1,9 +1,9 @@
1
1
  <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
2
2
  <html xmlns="http://www.w3.org/1999/xhtml" lang="en">
3
3
  <head>
4
- <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
5
- <title><%= options[:app_name] %></title>
6
- <%%= stylesheet_link_tag 'web_app_theme', "themes/<%= options[:theme] %>/style", :cache => true %>
4
+ <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
5
+ <title><%= options[:app_name] %></title>
6
+ <%%= stylesheet_link_tag 'web_app_theme', "themes/<%= options[:theme] %>/style", :cache => true %>
7
7
  </head>
8
8
  <body>
9
9
  <div id="container">
@@ -0,0 +1,10 @@
1
+ !!! Strict
2
+ %html
3
+ %head
4
+ %meta{'http-equiv' => 'Content-Type', :content => 'text/html; charset=utf-8'}
5
+ %title <%= options[:app_name] %>
6
+ = stylesheet_link_tag 'web_app_theme', "themes/<%= options[:theme] %>/style", :cache => true
7
+ %body
8
+ #container
9
+ #box
10
+ = yield
@@ -3,7 +3,8 @@ class ThemeGenerator < Rails::Generator::Base
3
3
  default_options :app_name => 'Web App',
4
4
  :layout_type => :administration,
5
5
  :theme => :default,
6
- :no_layout => false
6
+ :no_layout => false,
7
+ :engine => :erb
7
8
 
8
9
  def initialize(runtime_args, runtime_options = {})
9
10
  super
@@ -18,7 +19,7 @@ class ThemeGenerator < Rails::Generator::Base
18
19
  m.file("../../../images/icons/#{icon}.png", "public/images/web-app-theme/#{icon}.png")
19
20
  end
20
21
  m.directory("public/stylesheets/themes/#{options[:theme]}/")
21
- m.template("view_layout_#{options[:layout_type]}.html.erb", File.join("app/views/layouts", "#{@name}.html.erb")) unless options[:no_layout]
22
+ m.template("view_layout_#{options[:layout_type]}.html.#{options[:engine]}", File.join("app/views/layouts", "#{@name}.html.#{options[:engine]}")) unless options[:no_layout]
22
23
  m.template("../../../stylesheets/base.css", File.join("public/stylesheets", "web_app_theme.css"))
23
24
  m.template("web_app_theme_override.css", File.join("public/stylesheets", "web_app_theme_override.css"))
24
25
  m.template("../../../stylesheets/themes/#{options[:theme]}/style.css", File.join("public/stylesheets/themes/#{options[:theme]}", "style.css"))
@@ -38,6 +39,7 @@ protected
38
39
  opt.on("--type=layout_type", String, "Specify the layout type") { |v| options[:layout_type] = v }
39
40
  opt.on("--theme=theme", String, "Specify the theme") { |v| options[:theme] = v }
40
41
  opt.on("--no-layout", "Don't create layout") { |v| options[:no_layout] = true }
42
+ opt.on("--engine=haml", "Use HAML instead of ERB template engine") { |v| options[:engine] = v }
41
43
  end
42
44
 
43
45
  end
@@ -1,4 +1,5 @@
1
1
  ./script/generate themed ControllerPath
2
2
  ./script/generate themed ControllerPath ModelName
3
3
  ./script/generate themed ControllerPath ModelName --layout=application
4
- ./script/generate themed ControllerPath ModelName --with_will_paginate
4
+ ./script/generate themed ControllerPath ModelName --with_will_paginate
5
+ ./script/generate themed ControllerPath ModelName --engine=haml
@@ -0,0 +1,13 @@
1
+ .block
2
+ .secondary-navigation
3
+ %ul.wat-cf
4
+ %li.first= link_to t("web-app-theme.list", :default => "List"), <%= controller_routing_path %>_path
5
+ %li= link_to t("web-app-theme.new", :default => "New"), new_<%= singular_controller_routing_path %>_path
6
+ %li.active= link_to t("web-app-theme.edit", :default => "Edit"), edit_<%= singular_controller_routing_path %>_path
7
+ .content
8
+ %h2.title #{ t("web-app-theme.edit", :default => "Edit") } <%= model_name %>
9
+ .inner
10
+ - form_for @<%= model_name.underscore %>, :url => <%= singular_controller_routing_path %>_path(@<%= resource_name %>), :html => { :class => :form } do |f|
11
+ = render :partial => "form", :locals => {:f => f}
12
+
13
+ - content_for :sidebar, render(:partial => 'sidebar')
@@ -0,0 +1,11 @@
1
+ <% columns.each do |column| %>
2
+ .group
3
+ = f.label :<%= column.name %>, t("activerecord.attributes.<%= model_name.underscore %>.<%= column.name %>", :default => "<%= column.name.humanize %>"), :class => :label
4
+ = f.<%= column.field_type %> :<%= column.name %>, :class => '<%= column.field_type %>'
5
+ <span class="description">Ex: a simple text</span>
6
+ <%- end -%>
7
+ .group.navform.wat-cf
8
+ %button.button{:type => 'submit'}
9
+ = image_tag("web-app-theme/tick.png", :alt => "#{t("web-app-theme.save", :default => "Save")}")
10
+ = t("web-app-theme.save", :default => "Save")
11
+ = link_to "#{image_tag("web-app-theme/cross.png", :alt => "#{t("web-app-theme.cancel", :default => "Cancel")}")} #{t("web-app-theme.cancel", :default => "Cancel")}", <%= controller_routing_path %>_path, :class => "button"
@@ -0,0 +1,12 @@
1
+ .block
2
+ .secondary-navigation
3
+ %ul.wat-cf
4
+ %li.first= link_to t("web-app-theme.list", :default => "List"), <%= controller_routing_path %>_path
5
+ %li.active= link_to t("web-app-theme.new", :default => "New"), new_<%= singular_controller_routing_path %>_path
6
+ .content
7
+ %h2.title #{ t("web-app-theme.new", :default => "New")} <%= model_name %>
8
+ .inner
9
+ - form_for @<%= model_name.underscore %>, :url => <%= controller_routing_path %>_path, :html => { :class => :form } do |f|
10
+ = render :partial => "form", :locals => {:f => f}
11
+
12
+ - content_for :sidebar, render(:partial => 'sidebar')
@@ -0,0 +1,18 @@
1
+ .block
2
+ .secondary-navigation
3
+ %ul.wat-cf
4
+ %li.first= link_to t("web-app-theme.list", :default => "List"), <%= controller_routing_path %>_path
5
+ %li= link_to t("web-app-theme.new", :default => "New"), new_<%= singular_controller_routing_path %>_path
6
+ %li.active= link_to t("web-app-theme.show", :default => "Show"), <%= singular_controller_routing_path %>_path
7
+ .content
8
+ .inner
9
+ <% columns.each do |column| -%>
10
+ %p
11
+ <b>#{ t("activerecord.attributes.<%= singular_controller_routing_path %>.<%= column.name %>", :default => t("activerecord.labels.<%= column.name %>", :default => "<%= column.name.humanize %>")) }:</b>
12
+ = @<%= resource_name %>.<%= column.name %>
13
+ <% end -%>
14
+ .wat-cf
15
+ #{ link_to "#{image_tag("web-app-theme/application_edit.png", :alt => t("web-app-theme.edit", :default=> "Edit"))} #{t("web-app-theme.edit", :default=> "Edit")}", edit_<%= singular_controller_routing_path %>_path(@<%= resource_name %>), :class => "button" }
16
+ #{ link_to "#{image_tag("web-app-theme/cross.png", :alt => t("web-app-theme.delete", :default=> "Delete"))} #{t("web-app-theme.delete", :default => "Delete")}", <%= singular_controller_routing_path %>_path(@<%= resource_name %>), :method => "delete", :class => "button", :confirm => t("web-app-theme.confirm", :default => "Are you sure?") }
17
+
18
+ - content_for :sidebar, render(:partial => 'sidebar')
@@ -0,0 +1,10 @@
1
+ .block
2
+ %h3 Simple Block
3
+ .content
4
+ <p>Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat.</p>
5
+
6
+ .block
7
+ %h3 Links
8
+ %ul.navigation
9
+ <li><a href="#">Link 1</a></li>
10
+ <li><a href="#">Link 2</a></li>
@@ -0,0 +1,22 @@
1
+ <h1><%= options[:app_name] %></h1>
2
+ .block#block-login
3
+ <h2>Login Box</h2>
4
+ .content.login
5
+ .flash
6
+ = flash.each do |type, message|
7
+ .message{:class => type.to_s}
8
+ %p= message
9
+ - form_tag({:action => :create}, :class => 'form login') do
10
+ .group.wat-cf
11
+ .left
12
+ <label class="label right">Login</label>
13
+ .right
14
+ = text_field_tag :login, @login, :class => 'text_field'
15
+ .group.wat-cf
16
+ .left
17
+ <label class="label right">Password</label>
18
+ .right
19
+ = password_field_tag :password, nil, :class => 'text_field'
20
+ .group.navform.wat-cf
21
+ .right
22
+ <input type="submit" class="button" value="Sign in" />
@@ -0,0 +1,32 @@
1
+ <h1><%= options[:app_name] %></h1>
2
+ .block#block-signup
3
+ <h2>Sign up</h2>
4
+ .content
5
+ .flash
6
+ - flash.each do |type, message|
7
+ .message{:class => type.to_s}
8
+ %p= message
9
+ - form_for :<%= resource_name %>, :url => <%= controller_routing_path %>_path, :html => { :class => 'form' } do |f|
10
+ .group.wat-cf
11
+ .left
12
+ <label class="label">Login</label>
13
+ .right
14
+ = f.text_field :login, :class => 'text_field'
15
+ .group.wat-cf
16
+ .left
17
+ <label class="label">Email</label>
18
+ .right
19
+ = f.text_field :email, :class => 'text_field'
20
+ .group.wat-cf
21
+ .left
22
+ <label class="label">Password</label>
23
+ .right
24
+ = f.password_field :password, :class => 'text_field'
25
+ .group
26
+ .left.wat-cf
27
+ <label class="label">Password</label>
28
+ .right
29
+ = f.password_field :password_confirmation, :class => 'text_field'
30
+
31
+ .group.navform
32
+ <input type="submit" class="button" value="Sign up" />
@@ -1,8 +1,8 @@
1
1
  <div class="block">
2
2
  <div class="secondary-navigation">
3
3
  <ul class="wat-cf">
4
- <li class="first active"><%%= link_to "#{t("web-app-theme.list", :default => "List")}", <%= controller_routing_path %>_path %></li>
5
- <li><%%= link_to "#{t("web-app-theme.new", :default => "New")}", new_<%= singular_controller_routing_path %>_path %></li>
4
+ <li class="first active"><%%= link_to "#{t("web-app-theme.list", :default => "List")}", <%= controller_routing_path %>_path %></li>
5
+ <li><%%= link_to "#{t("web-app-theme.new", :default => "New")}", new_<%= singular_controller_routing_path %>_path %></li>
6
6
  </ul>
7
7
  </div>
8
8
  <div class="content">
@@ -11,11 +11,11 @@
11
11
  <table class="table">
12
12
  <tr>
13
13
  <th class="first">ID</th>
14
- <% unless columns.empty? -%>
15
- <th>
16
- <%%= t("activerecord.attributes.<%= singular_controller_routing_path %>.<%= columns.first.name %>", :default => t("activerecord.labels.<%= columns.first.name %>", :default => "<%= columns.first.name.capitalize %>")) %>
17
- </th>
18
- <% end -%>
14
+ <% unless columns.empty? -%>
15
+ <th>
16
+ <%%= t("activerecord.attributes.<%= singular_controller_routing_path %>.<%= columns.first.name %>", :default => t("activerecord.labels.<%= columns.first.name %>", :default => "<%= columns.first.name.capitalize %>")) %>
17
+ </th>
18
+ <% end -%>
19
19
  <th><%%= t("web-app-theme.created_at", :default => "Created at") %></th>
20
20
  <th class="last">&nbsp;</th>
21
21
  </tr>
@@ -24,12 +24,12 @@
24
24
  <td>
25
25
  <%%= <%= resource_name %>.id %>
26
26
  </td>
27
- <% unless columns.empty? -%>
28
- <td>
29
- <%%= link_to <%= resource_name %>.<%= columns.first.name %>, <%= singular_controller_routing_path %>_path(<%= resource_name %>) %>
30
- </td>
31
- <% end -%>
32
- <td>
27
+ <% unless columns.empty? -%>
28
+ <td>
29
+ <%%= link_to <%= resource_name %>.<%= columns.first.name %>, <%= singular_controller_routing_path %>_path(<%= resource_name %>) %>
30
+ </td>
31
+ <% end -%>
32
+ <td>
33
33
  <%%= <%= resource_name %>.created_at %>
34
34
  </td>
35
35
  <td class="last">
@@ -51,4 +51,4 @@
51
51
  </div>
52
52
  </div>
53
53
 
54
- <%% content_for :sidebar, render(:partial => 'sidebar') -%>
54
+ <%% content_for :sidebar, render(:partial => 'sidebar') -%>
@@ -0,0 +1,36 @@
1
+ .block
2
+ .secondary-navigation
3
+ %ul.wat-cf
4
+ %li.first.active= link_to "#{t("web-app-theme.list", :default => "List")}", <%= controller_routing_path %>_path
5
+ %li= link_to "#{t("web-app-theme.new", :default => "New")}", new_<%= singular_controller_routing_path %>_path
6
+ .content
7
+ %h2.title #{ t("web-app-theme.all", :default => "All") } <%= plural_model_name %>
8
+ .inner
9
+ %table.table
10
+ %tr
11
+ %th.first ID
12
+ <% unless columns.empty? -%>
13
+ %th= t("activerecord.attributes.<%= singular_controller_routing_path %>.<%= columns.first.name %>", :default => t("activerecord.labels.<%= columns.first.name %>", :default => "<%= columns.first.name.capitalize %>"))
14
+ <% end -%>
15
+ %th= t("web-app-theme.created_at", :default => "Created at")
16
+ %th.last &nbsp;
17
+ - @<%= plural_resource_name %>.each do |<%= resource_name %>|
18
+ %tr{:class => cycle("odd", "even")}
19
+ %td= <%= resource_name %>.id
20
+ <% unless columns.empty? -%>
21
+ %td= link_to <%= resource_name %>.<%= columns.first.name %>, <%= singular_controller_routing_path %>_path(<%= resource_name %>)
22
+ <% end -%>
23
+ %td= <%= resource_name %>.created_at
24
+ %td.last
25
+ = link_to t("web-app-theme.show", :default => "Show"), <%= singular_controller_routing_path %>_path(<%= resource_name %>)
26
+ |
27
+ = link_to t("web-app-theme.edit", :default => "Edit"), edit_<%= singular_controller_routing_path %>_path(<%= resource_name %>)
28
+ |
29
+ = link_to t("web-app-theme.delete", :default => "Delete"), <%= singular_controller_routing_path %>_path(<%= resource_name %>), :method => :delete, :confirm => "#{t("web-app-theme.confirm", :default => "Are you sure?")}"
30
+ .actions-bar.wat-cf
31
+ .actions
32
+ <% if options[:will_paginate] -%>
33
+ = will_paginate @<%= plural_resource_name %>
34
+ <% end -%>
35
+
36
+ - content_for :sidebar, render(:partial => 'sidebar')
@@ -0,0 +1,15 @@
1
+ .block#block-text
2
+ .content
3
+ <h2 class="title"><%= resource_name.capitalize %></h2>
4
+ .inner
5
+ <p class="first">
6
+ Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. <span class="hightlight">Excepteur sint occaecat cupidatat non proident</span>, sunt in culpa qui officia deserunt mollit anim id est laborum.
7
+ </p>
8
+ <p> <span class="small">Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore</span></p>
9
+ <p> <span class="gray">Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore</span></p>
10
+ <hr />
11
+ <p>
12
+ Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. <span class="hightlight">Excepteur sint occaecat cupidatat non proident</span>, sunt in culpa qui officia deserunt mollit anim id est laborum.
13
+ </p>
14
+
15
+ - content_for :sidebar, render(:partial => 'sidebar')
@@ -3,7 +3,8 @@ class ThemedGenerator < Rails::Generator::NamedBase
3
3
  default_options :app_name => 'Web App',
4
4
  :themed_type => :crud,
5
5
  :layout => false,
6
- :will_paginate => false
6
+ :will_paginate => false,
7
+ :engine => :erb
7
8
 
8
9
  attr_reader :controller_routing_path,
9
10
  :singular_controller_routing_path,
@@ -11,12 +12,14 @@ class ThemedGenerator < Rails::Generator::NamedBase
11
12
  :model_name,
12
13
  :plural_model_name,
13
14
  :resource_name,
14
- :plural_resource_name
15
+ :plural_resource_name,
16
+ :engine
15
17
 
16
18
  def initialize(runtime_args, runtime_options = {})
17
19
  super
18
20
  @controller_path = runtime_args.shift
19
- @model_name = runtime_args.shift
21
+ @model_name = runtime_args.shift
22
+ @engine = options[:engine]
20
23
  end
21
24
 
22
25
  def manifest
@@ -45,17 +48,25 @@ protected
45
48
  def manifest_for_crud(m)
46
49
  @columns = get_columns
47
50
  m.directory(File.join('app/views', @controller_file_path))
48
- m.template('view_tables.html.erb', File.join("app/views", @controller_file_path, "index.html.erb"))
49
- m.template('view_new.html.erb', File.join("app/views", @controller_file_path, "new.html.erb"))
50
- m.template('view_edit.html.erb', File.join("app/views", @controller_file_path, "edit.html.erb"))
51
- m.template('view_form.html.erb', File.join("app/views", @controller_file_path, "_form.html.erb"))
52
- m.template('view_show.html.erb', File.join("app/views", @controller_file_path, "show.html.erb"))
53
- m.template('view_sidebar.html.erb', File.join("app/views", @controller_file_path, "_sidebar.html.erb"))
51
+ m.template("view_tables.html.#{@engine}", File.join("app/views", @controller_file_path, "index.html.#{@engine}"))
52
+ m.template("view_new.html.#{@engine}", File.join("app/views", @controller_file_path, "new.html.#{@engine}"))
53
+ m.template("view_edit.html.#{@engine}", File.join("app/views", @controller_file_path, "edit.html.#{@engine}"))
54
+ m.template("view_form.html.#{@engine}", File.join("app/views", @controller_file_path, "_form.html.#{@engine}"))
55
+ m.template("view_show.html.#{@engine}", File.join("app/views", @controller_file_path, "show.html.#{@engine}"))
56
+ m.template("view_sidebar.html.#{@engine}", File.join("app/views", @controller_file_path, "_sidebar.html.#{@engine}"))
54
57
 
55
58
  if options[:layout]
56
- m.gsub_file(File.join("app/views/layouts", "#{options[:layout]}.html.erb"), /\<div\s+id=\"main-navigation\">.*\<\/ul\>/mi) do |match|
59
+ #TODO fix this for haml
60
+ m.gsub_file(File.join("app/views/layouts", "#{options[:layout]}.html.#{@engine}"), /\<div\s+id=\"main-navigation\">.*\<\/ul\>/mi) do |match|
57
61
  match.gsub!(/\<\/ul\>/, "")
58
- %|#{match} <li class="<%= controller.controller_path == '#{@controller_file_path}' ? 'active' : '' %>"><a href="<%= #{controller_routing_path}_path %>">#{plural_model_name}</a></li></ul>|
62
+ if @engine.to_s =~ /haml/
63
+ %|#{match}
64
+ %li{:class => controller.controller_path == '#{@controller_file_path}' ? 'active' : '' }
65
+ %a{:href => #{controller_routing_path}_path} #{plural_model_name}
66
+ </ul>|
67
+ else
68
+ %|#{match} <li class="<%= controller.controller_path == '#{@controller_file_path}' ? 'active' : '' %>"><a href="<%= #{controller_routing_path}_path %>">#{plural_model_name}</a></li></ul>|
69
+ end
59
70
  end
60
71
  end
61
72
  end
@@ -64,14 +75,14 @@ protected
64
75
  signup_controller_path = @controller_file_path
65
76
  signin_controller_path = @model_name.downcase # just here I use the second argument as a controller path
66
77
  @resource_name = @controller_path.singularize
67
- m.template('view_signup.html.erb', File.join("app/views", signup_controller_path, "new.html.erb"))
68
- m.template('view_signin.html.erb', File.join("app/views", signin_controller_path, "new.html.erb"))
78
+ m.template("view_signup.html.#{@engine}", File.join("app/views", signup_controller_path, "new.html.#{@engine}"))
79
+ m.template("view_signin.html.#{@engine}", File.join("app/views", signin_controller_path, "login.html.#{@engine}"))
69
80
  end
70
81
 
71
82
  def manifest_for_text(m)
72
83
  m.directory(File.join('app/views', @controller_file_path))
73
- m.template('view_text.html.erb', File.join("app/views", @controller_file_path, "show.html.erb"))
74
- m.template('view_sidebar.html.erb', File.join("app/views", @controller_file_path, "_sidebar.html.erb"))
84
+ m.template("view_text.html.#{@engine}", File.join("app/views", @controller_file_path, "show.html.#{@engine}"))
85
+ m.template("view_sidebar.html.#{@engine}", File.join("app/views", @controller_file_path, "_sidebar.html.#{@engine}"))
75
86
  end
76
87
 
77
88
  def get_columns
@@ -90,6 +101,7 @@ protected
90
101
  opt.on("--type=themed_type", String, "") { |v| options[:themed_type] = v }
91
102
  opt.on("--layout=layout", String, "Add menu link") { |v| options[:layout] = v }
92
103
  opt.on("--with_will_paginate", "Add pagination using will_paginate") { |v| options[:will_paginate] = true }
104
+ opt.on("--engine=haml", "Use HAML instead of ERB template engine") { |v| options[:engine] = v }
93
105
  end
94
106
 
95
107
  end
@@ -0,0 +1,357 @@
1
+ /*
2
+
3
+ Amro
4
+ by Sandro Duarte
5
+ sandro[at]gmail.com
6
+
7
+ dark green #008080
8
+ light yellow #F6F5CD
9
+ orange #E8C53B
10
+ light green #76BBA5
11
+ light #F3F4EC
12
+
13
+ */
14
+
15
+ .small {
16
+ font-size: 11px;
17
+ font-style: normal;
18
+ font-weight: normal;
19
+ text-transform: normal;
20
+ letter-spacing: normal;
21
+ line-height: 1.4em;
22
+ }
23
+
24
+ .gray {
25
+ color:#999999;
26
+ font-family: Georgia, serif;
27
+ font-size: 13px;
28
+ font-style: italic;
29
+ font-weight: normal;
30
+ text-transform: normal;
31
+ letter-spacing: normal;
32
+ line-height: 1.6em;
33
+ }
34
+
35
+ .hightlight {
36
+ background-color: #ffff88;
37
+ font-weight: bold;
38
+ color: #36393d;
39
+ }
40
+
41
+ a:link, a:visited, a:hover, a:active, h1, h2, h3 { color: #008080; }
42
+ a { -moz-outline: none; }
43
+
44
+ body {
45
+ color: #222;
46
+ background: #F6F5CD;
47
+ font-family: helvetica,Arial,sans-serif;
48
+ }
49
+
50
+ hr {
51
+ background: #f0f0ee;
52
+ color: #f0f0ee;
53
+ }
54
+
55
+ p {
56
+ margin: 10px 0;
57
+
58
+ }
59
+
60
+ #header {
61
+ background: #008080;
62
+ }
63
+
64
+ #header h1 {
65
+ padding: 15px 0;
66
+ font-size: 28px;
67
+ font-style: normal;
68
+ font-weight: bold;
69
+ text-transform: normal;
70
+ letter-spacing: -1px;
71
+ line-height: 1.2em;
72
+ }
73
+
74
+ #header h1 a:link, #header h1 a:active, #header h1 a:hover, #header h1 a:visited {
75
+ color: #FFF;
76
+ }
77
+
78
+ #user-navigation {
79
+ top: auto;
80
+ bottom: 5px;
81
+ right: 25px;
82
+ }
83
+
84
+ #main .block .content {
85
+ background: #FFF;
86
+ padding-top: 1px;
87
+ }
88
+
89
+ #main .block .content h2 {
90
+ margin-left: 15px;
91
+ }
92
+
93
+ #main .block .content p {
94
+ font-size:13px;
95
+ line-height:1.45em;
96
+ }
97
+
98
+ #main .block .content h2 {
99
+ font-size:22px;
100
+ font-style:normal;
101
+ font-weight:bold;
102
+ letter-spacing:-1px;
103
+ line-height:1.2em;
104
+ margin-left:15px;
105
+ }
106
+
107
+ #sidebar .block {
108
+ background: #FFF;
109
+ }
110
+
111
+ #sidebar .notice {
112
+ background: #76BBA5;
113
+ color: #fff;
114
+ }
115
+
116
+ #sidebar h3 {
117
+ background: #008080;
118
+ color: #FFF;
119
+ border-bottom: 6px solid #E8C53B;
120
+ }
121
+
122
+ #main-navigation ul li {
123
+ padding-left: 15px;
124
+ }
125
+
126
+ #main-navigation ul li a {
127
+ padding: 8px 0;
128
+ }
129
+
130
+ #main-navigation ul li.active {
131
+ padding: 0;
132
+ margin-left: 15px;
133
+ }
134
+
135
+ #main-navigation ul li.active {
136
+ margin-left: 15px;
137
+ }
138
+
139
+ #main-navigation ul li.active a {
140
+ padding: 8px 15px;
141
+ }
142
+
143
+ #sidebar ul li a:link, #sidebar ul li a:visited {
144
+ background: #FFF;
145
+ border-bottom: 1px solid #F0F0EE;
146
+ text-decoration: none;
147
+ }
148
+
149
+ #sidebar ul li a:hover, #sidebar ul li a:active {
150
+ background: #76BBA5;
151
+ color: #FFF;
152
+ }
153
+
154
+ #main-navigation {
155
+ background: #E8C53B;
156
+ }
157
+
158
+ #main-navigation ul li {
159
+ background: #E8C53B;
160
+ margin-right: 0;
161
+ }
162
+
163
+ #main-navigation ul li.active {
164
+ background: #F6F5CD;
165
+ }
166
+
167
+ #main-navigation ul li a:link, #main-navigation ul li a:visited, #main-navigation ul li a:hover, #main-navigation ul li a:active,
168
+ #user-navigation ul li a:link, #user-navigation ul li a:visited, #user-navigation ul li a:hover, #user-navigation ul li a:active {
169
+ text-decoration: none;
170
+ color: #fff;
171
+ }
172
+
173
+
174
+ .secondary-navigation ul li a:link, .secondary-navigation ul li a:visited, .secondary-navigation ul li a:hover, .secondary-navigation ul li a:active {
175
+ text-decoration: none;
176
+ color: #FFF;
177
+ }
178
+
179
+ #user-navigation a.logout {
180
+ background: #cc0000;
181
+ padding: 2px 6px;
182
+ -moz-border-radius: 4px;
183
+ -webkit-border-radius: 3px;
184
+ }
185
+
186
+ .secondary-navigation li a:hover {
187
+ background: #76BBA5;
188
+ }
189
+
190
+ #main-navigation ul li.active a:link, #main-navigation ul li.active a:visited, #main-navigation ul li.active a:hover, #main-navigation ul li.active a:active {
191
+ color: #008080;
192
+ }
193
+
194
+ .secondary-navigation {
195
+ background: #008080;
196
+ border-bottom: 6px solid #E8C53B;
197
+ }
198
+
199
+ .secondary-navigation ul li.active, .secondary-navigation ul li.active a {
200
+ background-color: #E8C53B;
201
+ }
202
+
203
+ .secondary-navigation ul li a {
204
+ padding:8px 12px;
205
+ }
206
+
207
+ #footer .block {
208
+ color: #FFF;
209
+ background: #E8C53B;
210
+ }
211
+
212
+ #footer .block p {
213
+ margin: 0;
214
+ padding: 10px;
215
+ }
216
+
217
+ /* pagination */
218
+
219
+ .pagination span.disabled {
220
+ color: #bbb;
221
+ border-color: #bbb;
222
+ }
223
+
224
+ .pagination span.current {
225
+ background: #008080;
226
+ color: #FFF;
227
+ border-color: #008080;
228
+ }
229
+
230
+ .pagination a, .pagination span {
231
+ color: #008080;
232
+ border-color: #008080;
233
+ }
234
+
235
+ .pagination a:hover {
236
+ color: #FFF;
237
+ background: #008080;
238
+ }
239
+
240
+ /* tables */
241
+
242
+ .table th {
243
+ background: #008080;
244
+ color: #FFF;
245
+ }
246
+
247
+ .table td {
248
+ border-bottom:1px solid #F0F0EE;
249
+ }
250
+
251
+ .table tr.even {
252
+ background: #EFF3E4;
253
+ }
254
+ /* forms */
255
+
256
+ .form input.text_field, .form textarea.text_area {
257
+ width: 100%;
258
+ border:1px solid #CFCFCF;
259
+ }
260
+
261
+ .form input.button {
262
+ background: #EEE;
263
+ color: #262626;
264
+ padding: 2px 5px;
265
+ border: 1px solid #262626;
266
+ cursor: pointer;
267
+ }
268
+
269
+ .form .description {
270
+ font-style: italic;
271
+ color: #8C8C8C;
272
+ font-size: .9em;
273
+ }
274
+
275
+ /* flash-messages */
276
+ .flash .message {
277
+ -moz-border-radius: 3px;
278
+ -webkit-border-radius: 3px;
279
+ text-align:center;
280
+ margin: 0 auto 15px;
281
+
282
+ }
283
+
284
+ .flash .message p {
285
+ margin:8px;
286
+ }
287
+ .flash .error {
288
+ border: 1px solid #fbb;
289
+ background-color: #fdd;
290
+ }
291
+ .flash .warning {
292
+ border: 1px solid #fffaaa;
293
+ background-color: #ffffcc;
294
+ }
295
+ .flash .notice {
296
+ border: 1px solid #1FDF00;
297
+ background-color: #BBFFB6;
298
+ }
299
+
300
+ /* lists */
301
+
302
+ ul.list li {
303
+ border-bottom-color: #F0F0EE;
304
+ border-bottom-width: 1px;
305
+ border-bottom-style: solid;
306
+ }
307
+
308
+ ul.list li .item .avatar {
309
+ border-color: #F0F0EE;
310
+ border-width: 1px;
311
+ border-style: solid;
312
+ padding: 2px;
313
+ }
314
+
315
+ /* box */
316
+
317
+ #box .block {
318
+ background: #FFF;
319
+ }
320
+
321
+ #box .block h2 {
322
+ background: #008080;
323
+ color: #FFF;
324
+ }
325
+
326
+
327
+ /* rounded borders */
328
+
329
+ #main, #main-navigation, #main-navigation li, .secondary-navigation, #main .block, #sidebar .block, #sidebar h3, ul.list li,
330
+ #footer .block, .form input.button, #box .block, #box .block h2 {
331
+ -moz-border-radius-topleft: 4px;
332
+ -webkit-border-top-left-radius: 4px;
333
+ -moz-border-radius-topright: 4px;
334
+ -webkit-border-top-right-radius: 4px;
335
+ }
336
+
337
+ .secondary-navigation li.first a, .secondary-navigation ul li.first, .table th.first, .table th.first {
338
+ -moz-border-radius-topleft: 4px;
339
+ -webkit-border-top-left-radius: 4px;
340
+ }
341
+
342
+ .table th.last {
343
+ -moz-border-radius-topright: 4px;
344
+ -webkit-border-top-right-radius: 4px;
345
+ }
346
+
347
+ .secondary-navigation ul li.first {
348
+ -moz-border-radius-topleft: 4px;
349
+ -webkit-border-top-left-radius: 4px;
350
+ }
351
+
352
+ #sidebar, #sidebar .block, #main .block, #sidebar ul.navigation, ul.list li, #footer .block, .form input.button, #box .block {
353
+ -moz-border-radius-bottomleft: 4px;
354
+ -webkit-border-bottom-left-radius: 4px;
355
+ -moz-border-radius-bottomright: 4px;
356
+ -webkit-border-bottom-right-radius: 4px;
357
+ }
@@ -5,11 +5,11 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = %q{web-app-theme}
8
- s.version = "0.5.2"
8
+ s.version = "0.5.3"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = ["Andrea Franz"]
12
- s.date = %q{2010-01-11}
12
+ s.date = %q{2010-07-30}
13
13
  s.description = %q{Web app theme generator for rails projects}
14
14
  s.email = %q{andrea@gravityblast.com}
15
15
  s.extra_rdoc_files = [
@@ -41,21 +41,33 @@ Gem::Specification.new do |s|
41
41
  "lib/web_app_theme.rb",
42
42
  "rails_generators/theme/USAGE",
43
43
  "rails_generators/theme/templates/view_layout_administration.html.erb",
44
+ "rails_generators/theme/templates/view_layout_administration.html.haml",
44
45
  "rails_generators/theme/templates/view_layout_sign.html.erb",
46
+ "rails_generators/theme/templates/view_layout_sign.html.haml",
45
47
  "rails_generators/theme/templates/web_app_theme_override.css",
46
48
  "rails_generators/theme/theme_generator.rb",
47
49
  "rails_generators/themed/USAGE",
48
50
  "rails_generators/themed/templates/view_edit.html.erb",
51
+ "rails_generators/themed/templates/view_edit.html.haml",
49
52
  "rails_generators/themed/templates/view_form.html.erb",
53
+ "rails_generators/themed/templates/view_form.html.haml",
50
54
  "rails_generators/themed/templates/view_new.html.erb",
55
+ "rails_generators/themed/templates/view_new.html.haml",
51
56
  "rails_generators/themed/templates/view_show.html.erb",
57
+ "rails_generators/themed/templates/view_show.html.haml",
52
58
  "rails_generators/themed/templates/view_sidebar.html.erb",
59
+ "rails_generators/themed/templates/view_sidebar.html.haml",
53
60
  "rails_generators/themed/templates/view_signin.html.erb",
61
+ "rails_generators/themed/templates/view_signin.html.haml",
54
62
  "rails_generators/themed/templates/view_signup.html.erb",
63
+ "rails_generators/themed/templates/view_signup.html.haml",
55
64
  "rails_generators/themed/templates/view_tables.html.erb",
65
+ "rails_generators/themed/templates/view_tables.html.haml",
56
66
  "rails_generators/themed/templates/view_text.html.erb",
67
+ "rails_generators/themed/templates/view_text.html.haml",
57
68
  "rails_generators/themed/themed_generator.rb",
58
69
  "stylesheets/base.css",
70
+ "stylesheets/themes/amro/style.css",
59
71
  "stylesheets/themes/bec-green/style.css",
60
72
  "stylesheets/themes/bec/style.css",
61
73
  "stylesheets/themes/blue/style.css",
@@ -74,7 +86,7 @@ Gem::Specification.new do |s|
74
86
  s.homepage = %q{http://github.com/pilu/web-app-theme}
75
87
  s.rdoc_options = ["--charset=UTF-8"]
76
88
  s.require_paths = ["lib"]
77
- s.rubygems_version = %q{1.3.5}
89
+ s.rubygems_version = %q{1.3.7}
78
90
  s.summary = %q{Web app theme generator}
79
91
  s.test_files = [
80
92
  "test/spec_helper.rb",
@@ -85,7 +97,7 @@ Gem::Specification.new do |s|
85
97
  current_version = Gem::Specification::CURRENT_SPECIFICATION_VERSION
86
98
  s.specification_version = 3
87
99
 
88
- if Gem::Version.new(Gem::RubyGemsVersion) >= Gem::Version.new('1.2.0') then
100
+ if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
89
101
  else
90
102
  end
91
103
  else
metadata CHANGED
@@ -1,7 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: web-app-theme
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.5.2
4
+ hash: 13
5
+ prerelease: false
6
+ segments:
7
+ - 0
8
+ - 5
9
+ - 3
10
+ version: 0.5.3
5
11
  platform: ruby
6
12
  authors:
7
13
  - Andrea Franz
@@ -9,7 +15,7 @@ autorequire:
9
15
  bindir: bin
10
16
  cert_chain: []
11
17
 
12
- date: 2010-01-11 00:00:00 +01:00
18
+ date: 2010-07-30 00:00:00 +02:00
13
19
  default_executable:
14
20
  dependencies: []
15
21
 
@@ -47,21 +53,33 @@ files:
47
53
  - lib/web_app_theme.rb
48
54
  - rails_generators/theme/USAGE
49
55
  - rails_generators/theme/templates/view_layout_administration.html.erb
56
+ - rails_generators/theme/templates/view_layout_administration.html.haml
50
57
  - rails_generators/theme/templates/view_layout_sign.html.erb
58
+ - rails_generators/theme/templates/view_layout_sign.html.haml
51
59
  - rails_generators/theme/templates/web_app_theme_override.css
52
60
  - rails_generators/theme/theme_generator.rb
53
61
  - rails_generators/themed/USAGE
54
62
  - rails_generators/themed/templates/view_edit.html.erb
63
+ - rails_generators/themed/templates/view_edit.html.haml
55
64
  - rails_generators/themed/templates/view_form.html.erb
65
+ - rails_generators/themed/templates/view_form.html.haml
56
66
  - rails_generators/themed/templates/view_new.html.erb
67
+ - rails_generators/themed/templates/view_new.html.haml
57
68
  - rails_generators/themed/templates/view_show.html.erb
69
+ - rails_generators/themed/templates/view_show.html.haml
58
70
  - rails_generators/themed/templates/view_sidebar.html.erb
71
+ - rails_generators/themed/templates/view_sidebar.html.haml
59
72
  - rails_generators/themed/templates/view_signin.html.erb
73
+ - rails_generators/themed/templates/view_signin.html.haml
60
74
  - rails_generators/themed/templates/view_signup.html.erb
75
+ - rails_generators/themed/templates/view_signup.html.haml
61
76
  - rails_generators/themed/templates/view_tables.html.erb
77
+ - rails_generators/themed/templates/view_tables.html.haml
62
78
  - rails_generators/themed/templates/view_text.html.erb
79
+ - rails_generators/themed/templates/view_text.html.haml
63
80
  - rails_generators/themed/themed_generator.rb
64
81
  - stylesheets/base.css
82
+ - stylesheets/themes/amro/style.css
65
83
  - stylesheets/themes/bec-green/style.css
66
84
  - stylesheets/themes/bec/style.css
67
85
  - stylesheets/themes/blue/style.css
@@ -86,21 +104,27 @@ rdoc_options:
86
104
  require_paths:
87
105
  - lib
88
106
  required_ruby_version: !ruby/object:Gem::Requirement
107
+ none: false
89
108
  requirements:
90
109
  - - ">="
91
110
  - !ruby/object:Gem::Version
111
+ hash: 3
112
+ segments:
113
+ - 0
92
114
  version: "0"
93
- version:
94
115
  required_rubygems_version: !ruby/object:Gem::Requirement
116
+ none: false
95
117
  requirements:
96
118
  - - ">="
97
119
  - !ruby/object:Gem::Version
120
+ hash: 3
121
+ segments:
122
+ - 0
98
123
  version: "0"
99
- version:
100
124
  requirements: []
101
125
 
102
126
  rubyforge_project:
103
- rubygems_version: 1.3.5
127
+ rubygems_version: 1.3.7
104
128
  signing_key:
105
129
  specification_version: 3
106
130
  summary: Web app theme generator