web-app-theme 0.5.3 → 0.6.0
Sign up to get free protection for your applications and to get access to all the features.
- data/.gitignore +2 -1
- data/README.md +24 -23
- data/VERSION +1 -1
- data/index.html +1 -0
- data/{rails_generators/theme/templates/view_layout_administration.html.erb → lib/generators/web_app_theme/theme/templates/layout_admin.html.erb} +9 -8
- data/lib/generators/web_app_theme/theme/templates/layout_sign.html.erb +15 -0
- data/lib/generators/web_app_theme/theme/theme_generator.rb +61 -0
- data/{rails_generators → lib/generators/web_app_theme}/themed/templates/view_edit.html.erb +1 -1
- data/{rails_generators → lib/generators/web_app_theme}/themed/templates/view_form.html.erb +2 -2
- data/{rails_generators → lib/generators/web_app_theme}/themed/templates/view_new.html.erb +1 -1
- data/{rails_generators → lib/generators/web_app_theme}/themed/templates/view_show.html.erb +2 -2
- data/{rails_generators → lib/generators/web_app_theme}/themed/templates/view_sidebar.html.erb +0 -0
- data/{rails_generators → lib/generators/web_app_theme}/themed/templates/view_signin.html.erb +0 -0
- data/{rails_generators → lib/generators/web_app_theme}/themed/templates/view_signup.html.erb +0 -0
- data/{rails_generators → lib/generators/web_app_theme}/themed/templates/view_tables.html.erb +1 -1
- data/{rails_generators → lib/generators/web_app_theme}/themed/templates/view_text.html.erb +0 -0
- data/lib/generators/web_app_theme/themed/themed_generator.rb +126 -0
- data/stylesheets/base.css +2 -2
- data/stylesheets/override.css +1 -0
- data/stylesheets/themes/activo/style.css +466 -0
- data/stylesheets/themes/amro/style.css +1 -1
- data/stylesheets/themes/bec-green/style.css +1 -1
- data/stylesheets/themes/bec/style.css +1 -1
- data/stylesheets/themes/blue/style.css +1 -1
- data/stylesheets/themes/default/style.css +1 -1
- data/stylesheets/themes/djime-cerulean/style.css +1 -1
- data/stylesheets/themes/drastic-dark/style.css +1 -1
- data/stylesheets/themes/kathleene/style.css +1 -1
- data/stylesheets/themes/olive/style.css +1 -1
- data/stylesheets/themes/orange/style.css +1 -1
- data/stylesheets/themes/reidb-greenish/style.css +1 -1
- data/stylesheets/themes/warehouse/style.css +1 -1
- data/web-app-theme.gemspec +17 -29
- metadata +20 -32
- data/rails_generators/theme/USAGE +0 -5
- data/rails_generators/theme/templates/view_layout_administration.html.haml +0 -30
- data/rails_generators/theme/templates/view_layout_sign.html.erb +0 -15
- data/rails_generators/theme/templates/view_layout_sign.html.haml +0 -10
- data/rails_generators/theme/templates/web_app_theme_override.css +0 -1
- data/rails_generators/theme/theme_generator.rb +0 -45
- data/rails_generators/themed/USAGE +0 -5
- data/rails_generators/themed/templates/view_edit.html.haml +0 -13
- data/rails_generators/themed/templates/view_form.html.haml +0 -11
- data/rails_generators/themed/templates/view_new.html.haml +0 -12
- data/rails_generators/themed/templates/view_show.html.haml +0 -18
- data/rails_generators/themed/templates/view_sidebar.html.haml +0 -10
- data/rails_generators/themed/templates/view_signin.html.haml +0 -22
- data/rails_generators/themed/templates/view_signup.html.haml +0 -32
- data/rails_generators/themed/templates/view_tables.html.haml +0 -36
- data/rails_generators/themed/templates/view_text.html.haml +0 -15
- data/rails_generators/themed/themed_generator.rb +0 -107
@@ -1,10 +0,0 @@
|
|
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>
|
@@ -1,22 +0,0 @@
|
|
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" />
|
@@ -1,32 +0,0 @@
|
|
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,36 +0,0 @@
|
|
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
|
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')
|
@@ -1,15 +0,0 @@
|
|
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')
|
@@ -1,107 +0,0 @@
|
|
1
|
-
class ThemedGenerator < Rails::Generator::NamedBase
|
2
|
-
|
3
|
-
default_options :app_name => 'Web App',
|
4
|
-
:themed_type => :crud,
|
5
|
-
:layout => false,
|
6
|
-
:will_paginate => false,
|
7
|
-
:engine => :erb
|
8
|
-
|
9
|
-
attr_reader :controller_routing_path,
|
10
|
-
:singular_controller_routing_path,
|
11
|
-
:columns,
|
12
|
-
:model_name,
|
13
|
-
:plural_model_name,
|
14
|
-
:resource_name,
|
15
|
-
:plural_resource_name,
|
16
|
-
:engine
|
17
|
-
|
18
|
-
def initialize(runtime_args, runtime_options = {})
|
19
|
-
super
|
20
|
-
@controller_path = runtime_args.shift
|
21
|
-
@model_name = runtime_args.shift
|
22
|
-
@engine = options[:engine]
|
23
|
-
end
|
24
|
-
|
25
|
-
def manifest
|
26
|
-
@controller_routing_path = @table_name
|
27
|
-
@singular_controller_routing_path = @table_name.singularize
|
28
|
-
base_name, @controller_class_path, @controller_file_path, @controller_class_nesting, @controller_class_nesting_depth = extract_modules(@controller_path)
|
29
|
-
@model_name = base_name.singularize unless @model_name
|
30
|
-
|
31
|
-
# Post
|
32
|
-
@model_name = @model_name.camelize
|
33
|
-
# Posts
|
34
|
-
@plural_model_name = @model_name.pluralize
|
35
|
-
# post
|
36
|
-
@resource_name = @model_name.underscore
|
37
|
-
# posts
|
38
|
-
@plural_resource_name = @resource_name.pluralize
|
39
|
-
|
40
|
-
manifest_method = "manifest_for_#{options[:themed_type]}"
|
41
|
-
record do |m|
|
42
|
-
send(manifest_method, m) if respond_to?(manifest_method)
|
43
|
-
end
|
44
|
-
end
|
45
|
-
|
46
|
-
protected
|
47
|
-
|
48
|
-
def manifest_for_crud(m)
|
49
|
-
@columns = get_columns
|
50
|
-
m.directory(File.join('app/views', @controller_file_path))
|
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}"))
|
57
|
-
|
58
|
-
if options[:layout]
|
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|
|
61
|
-
match.gsub!(/\<\/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
|
70
|
-
end
|
71
|
-
end
|
72
|
-
end
|
73
|
-
|
74
|
-
def manifest_for_restful_authentication(m)
|
75
|
-
signup_controller_path = @controller_file_path
|
76
|
-
signin_controller_path = @model_name.downcase # just here I use the second argument as a controller path
|
77
|
-
@resource_name = @controller_path.singularize
|
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}"))
|
80
|
-
end
|
81
|
-
|
82
|
-
def manifest_for_text(m)
|
83
|
-
m.directory(File.join('app/views', @controller_file_path))
|
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}"))
|
86
|
-
end
|
87
|
-
|
88
|
-
def get_columns
|
89
|
-
excluded_column_names = %w[id created_at updated_at]
|
90
|
-
Kernel.const_get(@model_name).columns.reject{|c| excluded_column_names.include?(c.name) }.collect{|c| Rails::Generator::GeneratedAttribute.new(c.name, c.type)}
|
91
|
-
end
|
92
|
-
|
93
|
-
def banner
|
94
|
-
"Usage: #{$0} themed ControllerPath [ModelName] [options]"
|
95
|
-
end
|
96
|
-
|
97
|
-
def add_options!(opt)
|
98
|
-
opt.separator ''
|
99
|
-
opt.separator 'Options:'
|
100
|
-
opt.on("--app_name=app_name", String, "") { |v| options[:app_name] = v }
|
101
|
-
opt.on("--type=themed_type", String, "") { |v| options[:themed_type] = v }
|
102
|
-
opt.on("--layout=layout", String, "Add menu link") { |v| options[:layout] = v }
|
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 }
|
105
|
-
end
|
106
|
-
|
107
|
-
end
|