padrino-admin 0.9.19 → 0.9.20
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/padrino-admin/generators/admin_app.rb +4 -2
- data/lib/padrino-admin/generators/templates/account/datamapper.rb.tt +3 -0
- data/lib/padrino-admin/generators/templates/erb/app/layouts/application.erb.tt +1 -1
- data/lib/padrino-admin/generators/templates/erb/app/sessions/new.erb.tt +10 -10
- data/lib/padrino-admin/generators/templates/erubis/app/base/_sidebar.erubis.tt +13 -0
- data/lib/padrino-admin/generators/templates/erubis/app/base/index.erubis.tt +17 -0
- data/lib/padrino-admin/generators/templates/erubis/app/layouts/application.erubis.tt +44 -0
- data/lib/padrino-admin/generators/templates/erubis/app/sessions/new.erubis.tt +56 -0
- data/lib/padrino-admin/generators/templates/erubis/page/_form.erubis.tt +11 -0
- data/lib/padrino-admin/generators/templates/erubis/page/edit.erubis.tt +18 -0
- data/lib/padrino-admin/generators/templates/erubis/page/index.erubis.tt +36 -0
- data/lib/padrino-admin/generators/templates/erubis/page/new.erubis.tt +17 -0
- data/lib/padrino-admin/generators/templates/haml/app/sessions/new.haml.tt +0 -1
- data/lib/padrino-admin/locale/admin/cz.yml +1 -1
- data/lib/padrino-admin/locale/admin/da.yml +1 -1
- data/lib/padrino-admin/locale/admin/no.yml +4 -5
- data/lib/padrino-admin/locale/admin/pl.yml +1 -1
- data/lib/padrino-admin/locale/admin/ru.yml +1 -1
- data/lib/padrino-admin/locale/admin/tr.yml +1 -1
- data/lib/padrino-admin/locale/admin/uk.yml +1 -1
- data/lib/padrino-admin/locale/orm/cz.yml +1 -1
- data/lib/padrino-admin/locale/orm/da.yml +1 -1
- data/lib/padrino-admin/locale/orm/en.yml +1 -1
- data/lib/padrino-admin/locale/orm/no.yml +1 -2
- data/lib/padrino-admin/locale/orm/pl.yml +1 -1
- data/lib/padrino-admin/locale/orm/ru.yml +1 -1
- data/lib/padrino-admin/locale/orm/tr.yml +1 -1
- data/lib/padrino-admin/locale/orm/uk.yml +1 -1
- data/padrino-admin.gemspec +1 -1
- data/test/generators/test_admin_app_generator.rb +39 -7
- data/test/helper.rb +1 -1
- metadata +18 -10
@@ -56,7 +56,9 @@ module Padrino
|
|
56
56
|
account_params << "-d" if options[:destroy]
|
57
57
|
|
58
58
|
Padrino::Generators::Model.start(account_params)
|
59
|
-
|
59
|
+
# Can't add this through model generator as it does not have /admin loaded yet
|
60
|
+
# so run it and remove it and copy admin version over to admin path.
|
61
|
+
remove_file destination_root('app','models','account.rb')
|
60
62
|
column = Struct.new(:name, :type)
|
61
63
|
columns = [:id, :name, :surname, :email].map { |col| column.new(col) }
|
62
64
|
column_fields = [
|
@@ -72,7 +74,7 @@ module Padrino
|
|
72
74
|
admin_app.default_orm = Padrino::Admin::Generators::Orm.new(:account, orm, columns, column_fields)
|
73
75
|
admin_app.invoke_all
|
74
76
|
|
75
|
-
template "templates/account/#{orm}.rb.tt", destination_root("
|
77
|
+
template "templates/account/#{orm}.rb.tt", destination_root("admin", "models", "account.rb"), :force => true
|
76
78
|
|
77
79
|
if File.exist?(destination_root("db/seeds.rb"))
|
78
80
|
append_file(destination_root("db/seeds.rb")) { "\n\n" + File.read(self.class.source_root+"/templates/account/seeds.rb.tt") }
|
@@ -32,16 +32,16 @@
|
|
32
32
|
<%%= password_field_tag :password, :value => params[:password], :class => 'text_field' %>
|
33
33
|
</div>
|
34
34
|
</div>
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
35
|
+
<%% if Padrino.env == :development %>
|
36
|
+
<div class="group wat-cf">
|
37
|
+
<div class="left">
|
38
|
+
<label class="label right">Bypass login?</label>
|
39
|
+
</div>
|
40
|
+
<div class="right">
|
41
|
+
<%%= check_box_tag :bypass %>
|
42
|
+
</div>
|
43
|
+
</div>
|
44
|
+
<%% end %>
|
45
45
|
<div class="group navform wat-cf">
|
46
46
|
<div class="right">
|
47
47
|
<%%= submit_tag "Sign in", :class => :button %>
|
@@ -0,0 +1,13 @@
|
|
1
|
+
<div class="block">
|
2
|
+
<h3>Simple Block</h3>
|
3
|
+
<div class="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
|
+
</div>
|
6
|
+
</div>
|
7
|
+
<div class="block">
|
8
|
+
<h3>Links</h3>
|
9
|
+
<ul class="navigation">
|
10
|
+
<li><%%= link_to "Link 1" %></li>
|
11
|
+
<li><%%= link_to "Link 1" %></li>
|
12
|
+
</ul>
|
13
|
+
</div>
|
@@ -0,0 +1,17 @@
|
|
1
|
+
<div class="block" id="block-text">
|
2
|
+
<div class="content">
|
3
|
+
<h2 class="title">Dashboard</h2>
|
4
|
+
<div class="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
|
+
</div>
|
15
|
+
</div>
|
16
|
+
</div>
|
17
|
+
<%% content_for :sidebar, partial("base/sidebar") %>
|
@@ -0,0 +1,44 @@
|
|
1
|
+
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
|
2
|
+
<html xmlns="http://www.w3.org/1999/xhtml" lang="en">
|
3
|
+
<head>
|
4
|
+
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
|
5
|
+
<title><%= options[:name] %></title>
|
6
|
+
<%%= stylesheet_link_tag :base, "themes/<%= options[:theme] %>/style" %>
|
7
|
+
</head>
|
8
|
+
<body>
|
9
|
+
<div id="container">
|
10
|
+
<div id="header">
|
11
|
+
<h1><%%= link_to "<%= options[:name] %>", url(:base_index) %></h1>
|
12
|
+
<div id="user-navigation">
|
13
|
+
<ul class="wat-cf">
|
14
|
+
<li><%%= link_to pat(:profile), url(:accounts, :edit, :id => current_account.id) %></li>
|
15
|
+
<li><%%= link_to pat(:logout), url(:sessions, :destroy), :method => :delete %></li>
|
16
|
+
</ul>
|
17
|
+
</div>
|
18
|
+
<div id="main-navigation">
|
19
|
+
<ul class="wat-cf">
|
20
|
+
<%% project_modules.each do |project_module| %>
|
21
|
+
<li class="<%%= "active" if request.path_info =~ /^#{project_module.path}/ %>"><%%= link_to project_module.human_name, project_module.path("/admin") %></li>
|
22
|
+
<%% end %>
|
23
|
+
</ul>
|
24
|
+
</div>
|
25
|
+
</div>
|
26
|
+
<div id="wrapper" class="wat-cf">
|
27
|
+
<div class="flash">
|
28
|
+
<%%= [:error, :warning, :notice].map { |type| flash_tag(type, :class => "message #{type}") }.join %>
|
29
|
+
</div>
|
30
|
+
<div id="main">
|
31
|
+
<%%= yield %>
|
32
|
+
<div id="footer">
|
33
|
+
<div class="block">
|
34
|
+
<p>Copyright © <%%= Time.now.year %> Your Site - Powered by <a href="http://padrino.github.com" target="_blank">Padrino v.<%%= Padrino.version %>.</a></p>
|
35
|
+
</div>
|
36
|
+
</div>
|
37
|
+
</div>
|
38
|
+
<div id="sidebar">
|
39
|
+
<%%= yield_content :sidebar %>
|
40
|
+
</div>
|
41
|
+
</div>
|
42
|
+
</div>
|
43
|
+
</body>
|
44
|
+
</html>
|
@@ -0,0 +1,56 @@
|
|
1
|
+
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
|
2
|
+
<html xmlns="http://www.w3.org/1999/xhtml" lang="en">
|
3
|
+
<head>
|
4
|
+
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
|
5
|
+
<title><%= options[:name] %></title>
|
6
|
+
<%%= stylesheet_link_tag :base, "themes/<%= options[:theme] %>/style" %>
|
7
|
+
</head>
|
8
|
+
<body>
|
9
|
+
<div id="container">
|
10
|
+
<div id="box">
|
11
|
+
<h1><%= options[:name] %></h1>
|
12
|
+
<div class="block" id="block-login">
|
13
|
+
<h2>Login Box</h2>
|
14
|
+
<div class="content login">
|
15
|
+
<div class="flash">
|
16
|
+
<%%= [:error, :warning, :notice].map { |type| flash_tag(type, :class => "message #{type}") }.join %>
|
17
|
+
</div>
|
18
|
+
<%% form_tag(url(:sessions, :create), :class => 'form login') do %>
|
19
|
+
<div class="group wat-cf">
|
20
|
+
<div class="left">
|
21
|
+
<label class="label right">Login</label>
|
22
|
+
</div>
|
23
|
+
<div class="right">
|
24
|
+
<%%= text_field_tag :email, :value => params[:email], :class => 'text_field' %>
|
25
|
+
</div>
|
26
|
+
</div>
|
27
|
+
<div class="group wat-cf">
|
28
|
+
<div class="left">
|
29
|
+
<label class="label right">Password</label>
|
30
|
+
</div>
|
31
|
+
<div class="right">
|
32
|
+
<%%= password_field_tag :password, :value => params[:password], :class => 'text_field' %>
|
33
|
+
</div>
|
34
|
+
</div>
|
35
|
+
<%% if Padrino.env == :development %>
|
36
|
+
<div class="group wat-cf">
|
37
|
+
<div class="left">
|
38
|
+
<label class="label right">Bypass login?</label>
|
39
|
+
</div>
|
40
|
+
<div class="right">
|
41
|
+
<%%= check_box_tag :bypass %>
|
42
|
+
</div>
|
43
|
+
</div>
|
44
|
+
<%% end %>
|
45
|
+
<div class="group navform wat-cf">
|
46
|
+
<div class="right">
|
47
|
+
<%%= submit_tag "Sign in", :class => :button %>
|
48
|
+
</div>
|
49
|
+
</div>
|
50
|
+
<%% end %>
|
51
|
+
</div>
|
52
|
+
</div>
|
53
|
+
</div>
|
54
|
+
</div>
|
55
|
+
</body>
|
56
|
+
</html>
|
@@ -0,0 +1,11 @@
|
|
1
|
+
<% @orm.column_fields.each do |column| -%>
|
2
|
+
<div class="group">
|
3
|
+
<%%= f.label :<%= column[:name] %> %><%%= f.error_message_on :<%= column[:name] %> %>
|
4
|
+
<%%= f.<%= column[:field_type] %> :<%= column[:name] %>, :class => :<%= column[:field_type] %> %>
|
5
|
+
<span class="description">Ex: a simple text</span>
|
6
|
+
</div>
|
7
|
+
<% end %>
|
8
|
+
<div class="group navform wat-cf">
|
9
|
+
<%%= f.submit pat(:save), :class => :button %>
|
10
|
+
<%%= f.submit pat(:cancel), :onclick => "window.location='#{url(:<%= @orm.name_plural %>, :index)}';return false", :class => :button %>
|
11
|
+
</div>
|
@@ -0,0 +1,18 @@
|
|
1
|
+
<div class="block">
|
2
|
+
<div class="secondary-navigation">
|
3
|
+
<ul class="wat-cf">
|
4
|
+
<li class="first"><%%= link_to pat(:list), url(:<%= @orm.name_plural %>, :index) %></li>
|
5
|
+
<li><%%= link_to pat(:new), url(:<%= @orm.name_plural %>, :new) %></li>
|
6
|
+
<li class="active"><%%= link_to pat(:edit), url(:<%= @orm.name_plural %>, :edit, :id => @<%= @orm.name_singular %>.id) %></li>
|
7
|
+
</ul>
|
8
|
+
</div>
|
9
|
+
<div class="content">
|
10
|
+
<h2 class="title"><%%= pat(:edit) %> <%% mt(:<%= @orm.name_singular %>) %></h2>
|
11
|
+
<div class="inner">
|
12
|
+
<%% form_for :<%= @orm.name_singular %>, url(:<%= @orm.name_plural %>, :update, :id => @<%= @orm.name_singular %>.id), :method => :put, :class => :form do |f| %>
|
13
|
+
<%%= partial "<%= @orm.name_plural %>/form", :locals => { :f => f } %>
|
14
|
+
<%% end %>
|
15
|
+
</div>
|
16
|
+
</div>
|
17
|
+
</div>
|
18
|
+
<%% content_for :sidebar, partial("base/sidebar") %>
|
@@ -0,0 +1,36 @@
|
|
1
|
+
<div class="block">
|
2
|
+
<div class="secondary-navigation">
|
3
|
+
<ul class="wat-cf">
|
4
|
+
<li class="first active"><%%= link_to pat(:list), url(:<%= @orm.name_plural %>, :index) %></li>
|
5
|
+
<li><%%= link_to pat(:new), url(:<%= @orm.name_plural %>, :new) %></li>
|
6
|
+
</ul>
|
7
|
+
</div>
|
8
|
+
<div class="content">
|
9
|
+
<h2 class="title"><%%= pat(:all) %> <%% mt(:<%= @orm.name_plural %>) %></h2>
|
10
|
+
<div class="inner">
|
11
|
+
<table class="table">
|
12
|
+
<tr>
|
13
|
+
<%- @orm.columns.each_with_index do |column, i| -%>
|
14
|
+
<th<%= " class=\"first\"" if i==0 %>><%%= mat(:<%= @orm.name_singular %>, :<%= column.name %>) %></th>
|
15
|
+
<%- end -%>
|
16
|
+
<th class="last"> </th>
|
17
|
+
</tr>
|
18
|
+
<%% @<%= @orm.name_plural %>.each do |<%= @orm.name_singular %>| %>
|
19
|
+
<tr>
|
20
|
+
<%- @orm.columns.each_with_index do |column, i| -%>
|
21
|
+
<td<%= " class=\"first\"" if i==0 %>><%%= <%= @orm.name_singular %>.<%= column.name %> %></td>
|
22
|
+
<%- end -%>
|
23
|
+
<td class="last">
|
24
|
+
<%%= button_to pat(:edit), url(:<%= @orm.name_plural %>, :edit, :id => <%= @orm.name_singular %>.id), :method => :get, :class => :button_to %> |
|
25
|
+
<%%= button_to pat(:delete), url(:<%= @orm.name_plural %>, :destroy, :id => <%= @orm.name_singular %>.id), :method => :delete, :class => :button_to %>
|
26
|
+
</td>
|
27
|
+
</tr>
|
28
|
+
<%% end %>
|
29
|
+
</table>
|
30
|
+
<div class="actions-bar wat-cf">
|
31
|
+
<div class="actions"></div>
|
32
|
+
</div>
|
33
|
+
</div>
|
34
|
+
</div>
|
35
|
+
</div>
|
36
|
+
<%% content_for :sidebar, partial("base/sidebar") %>
|
@@ -0,0 +1,17 @@
|
|
1
|
+
<div class="block">
|
2
|
+
<div class="secondary-navigation">
|
3
|
+
<ul class="wat-cf">
|
4
|
+
<li class="first"><%%= link_to pat(:list), url(:<%= @orm.name_plural %>, :index) %></li>
|
5
|
+
<li class="active"><%%= link_to pat(:new), url(:<%= @orm.name_plural %>, :new) %></li>
|
6
|
+
</ul>
|
7
|
+
</div>
|
8
|
+
<div class="content">
|
9
|
+
<h2 class="title"><%%= pat(:new) %> <%% mt(:<%= @orm.name_singular %>) %></h2>
|
10
|
+
<div class="inner">
|
11
|
+
<%% form_for :<%= @orm.name_singular %>, url(:<%= @orm.name_plural %>, :create), :class => :form do |f| %>
|
12
|
+
<%%= partial "<%= @orm.name_plural %>/form", :locals => { :f => f } %>
|
13
|
+
<%% end %>
|
14
|
+
</div>
|
15
|
+
</div>
|
16
|
+
</div>
|
17
|
+
<%% content_for :sidebar, partial("base/sidebar") %>
|
@@ -1,11 +1,11 @@
|
|
1
1
|
"no":
|
2
2
|
padrino:
|
3
3
|
admin:
|
4
|
-
save: Lagre
|
5
|
-
cancel: Avbryt
|
4
|
+
save: Lagre
|
5
|
+
cancel: Avbryt
|
6
6
|
list: Liste
|
7
7
|
edit: Rediger
|
8
|
-
new: Ny
|
8
|
+
new: Ny
|
9
9
|
show: Vis
|
10
10
|
delete: Slett
|
11
11
|
confirm: Er du sikker?
|
@@ -13,5 +13,4 @@
|
|
13
13
|
all: Alle
|
14
14
|
profile: Profil
|
15
15
|
settings: Instillinger
|
16
|
-
logout: Logg ut
|
17
|
-
|
16
|
+
logout: Logg ut
|
data/padrino-admin.gemspec
CHANGED
@@ -52,7 +52,7 @@ class TestAdminAppGenerator < Test::Unit::TestCase
|
|
52
52
|
assert_file_exists("#{@apptmp}/sample_project/admin/views/sessions/new.haml")
|
53
53
|
assert_file_exists("#{@apptmp}/sample_project/public/admin")
|
54
54
|
assert_file_exists("#{@apptmp}/sample_project/public/admin/stylesheets")
|
55
|
-
assert_file_exists("#{@apptmp}/sample_project/
|
55
|
+
assert_file_exists("#{@apptmp}/sample_project/admin/models/account.rb")
|
56
56
|
assert_file_exists("#{@apptmp}/sample_project/db/seeds.rb")
|
57
57
|
assert_file_exists("#{@apptmp}/sample_project/db/migrate/001_create_accounts.rb")
|
58
58
|
assert_match_in_file 'Padrino.mount("Admin").to("/admin")', "#{@apptmp}/sample_project/config/apps.rb"
|
@@ -83,17 +83,49 @@ class TestAdminAppGenerator < Test::Unit::TestCase
|
|
83
83
|
assert_file_exists("#{@apptmp}/sample_project/admin/views/sessions/new.erb")
|
84
84
|
assert_file_exists("#{@apptmp}/sample_project/public/admin")
|
85
85
|
assert_file_exists("#{@apptmp}/sample_project/public/admin/stylesheets")
|
86
|
-
assert_file_exists("#{@apptmp}/sample_project/
|
86
|
+
assert_file_exists("#{@apptmp}/sample_project/admin/models/account.rb")
|
87
87
|
assert_file_exists("#{@apptmp}/sample_project/db/seeds.rb")
|
88
88
|
assert_file_exists("#{@apptmp}/sample_project/db/migrate/001_create_accounts.rb")
|
89
89
|
assert_match_in_file 'Padrino.mount("Admin").to("/admin")', "#{@apptmp}/sample_project/config/apps.rb"
|
90
90
|
assert_match_in_file 'class Admin < Padrino::Application', "#{@apptmp}/sample_project/admin/app.rb"
|
91
91
|
assert_match_in_file 'role.project_module :accounts, "/accounts"', "#{@apptmp}/sample_project/admin/app.rb"
|
92
92
|
end
|
93
|
-
|
93
|
+
|
94
|
+
should 'correctly generate a new padrino admin application with erubis renderer' do
|
95
|
+
assert_nothing_raised { silence_logger { generate(:project, 'sample_project', "--root=#{@apptmp}", '-d=activerecord', '-e=erubis') } }
|
96
|
+
assert_nothing_raised { silence_logger { generate(:admin_app, "--root=#{@apptmp}/sample_project") } }
|
97
|
+
assert_file_exists("#{@apptmp}/sample_project")
|
98
|
+
assert_file_exists("#{@apptmp}/sample_project/admin")
|
99
|
+
assert_file_exists("#{@apptmp}/sample_project/admin/app.rb")
|
100
|
+
assert_file_exists("#{@apptmp}/sample_project/admin/controllers")
|
101
|
+
assert_file_exists("#{@apptmp}/sample_project/admin/controllers/accounts.rb")
|
102
|
+
assert_file_exists("#{@apptmp}/sample_project/admin/controllers/base.rb")
|
103
|
+
assert_file_exists("#{@apptmp}/sample_project/admin/controllers/sessions.rb")
|
104
|
+
assert_file_exists("#{@apptmp}/sample_project/admin/views")
|
105
|
+
assert_file_exists("#{@apptmp}/sample_project/admin/views/accounts/_form.erubis")
|
106
|
+
assert_file_exists("#{@apptmp}/sample_project/admin/views/accounts/edit.erubis")
|
107
|
+
assert_file_exists("#{@apptmp}/sample_project/admin/views/accounts/index.erubis")
|
108
|
+
assert_file_exists("#{@apptmp}/sample_project/admin/views/accounts/new.erubis")
|
109
|
+
assert_file_exists("#{@apptmp}/sample_project/admin/views/base/index.erubis")
|
110
|
+
assert_file_exists("#{@apptmp}/sample_project/admin/views/sessions/new.erubis")
|
111
|
+
assert_file_exists("#{@apptmp}/sample_project/admin/views/base/_sidebar.erubis")
|
112
|
+
assert_file_exists("#{@apptmp}/sample_project/admin/views/base/index.erubis")
|
113
|
+
assert_file_exists("#{@apptmp}/sample_project/admin/views/layouts/application.erubis")
|
114
|
+
assert_file_exists("#{@apptmp}/sample_project/admin/views/sessions/new.erubis")
|
115
|
+
assert_file_exists("#{@apptmp}/sample_project/public/admin")
|
116
|
+
assert_file_exists("#{@apptmp}/sample_project/public/admin/stylesheets")
|
117
|
+
assert_file_exists("#{@apptmp}/sample_project/admin/models/account.rb")
|
118
|
+
assert_no_file_exists("#{@apptmp}/sample_project/app/models/account.rb")
|
119
|
+
assert_file_exists("#{@apptmp}/sample_project/db/seeds.rb")
|
120
|
+
assert_file_exists("#{@apptmp}/sample_project/db/migrate/001_create_accounts.rb")
|
121
|
+
assert_match_in_file 'Padrino.mount("Admin").to("/admin")', "#{@apptmp}/sample_project/config/apps.rb"
|
122
|
+
assert_match_in_file 'class Admin < Padrino::Application', "#{@apptmp}/sample_project/admin/app.rb"
|
123
|
+
assert_match_in_file 'role.project_module :accounts, "/accounts"', "#{@apptmp}/sample_project/admin/app.rb"
|
124
|
+
end
|
125
|
+
|
94
126
|
should 'not conflict with existing seeds file' do
|
95
127
|
assert_nothing_raised { silence_logger { generate(:project, 'sample_project', "--root=#{@apptmp}", '-d=activerecord', '-e=erb') } }
|
96
|
-
|
128
|
+
|
97
129
|
# Add seeds file
|
98
130
|
FileUtils.mkdir_p @apptmp + '/sample_project/db' unless File.exist?(@apptmp + '/sample_project/db')
|
99
131
|
File.open(@apptmp + '/sample_project/db/seeds.rb', 'w+') do |seeds_rb|
|
@@ -103,11 +135,11 @@ class TestAdminAppGenerator < Test::Unit::TestCase
|
|
103
135
|
silence_logger do
|
104
136
|
$stdout.expects(:print).with { |value| value =~ /Overwrite\s.*?\/db\/seeds.rb/ }.never
|
105
137
|
$stdin.stubs(:gets).returns('y')
|
106
|
-
generate(:admin_app, "--root=#{@apptmp}/sample_project")
|
138
|
+
generate(:admin_app, "--root=#{@apptmp}/sample_project")
|
107
139
|
end
|
108
|
-
|
140
|
+
|
109
141
|
assert_match_in_file '# Old Seeds Content', "#{@apptmp}/sample_project/db/seeds.rb"
|
110
142
|
assert_match_in_file 'Account.create(', "#{@apptmp}/sample_project/db/seeds.rb"
|
111
143
|
end
|
112
144
|
end
|
113
|
-
end
|
145
|
+
end
|
data/test/helper.rb
CHANGED
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: padrino-admin
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 19
|
5
5
|
prerelease: false
|
6
6
|
segments:
|
7
7
|
- 0
|
8
8
|
- 9
|
9
|
-
-
|
10
|
-
version: 0.9.
|
9
|
+
- 20
|
10
|
+
version: 0.9.20
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- Padrino Team
|
@@ -18,7 +18,7 @@ autorequire:
|
|
18
18
|
bindir: bin
|
19
19
|
cert_chain: []
|
20
20
|
|
21
|
-
date:
|
21
|
+
date: 2011-01-19 00:00:00 -08:00
|
22
22
|
default_executable:
|
23
23
|
dependencies:
|
24
24
|
- !ruby/object:Gem::Dependency
|
@@ -29,12 +29,12 @@ dependencies:
|
|
29
29
|
requirements:
|
30
30
|
- - "="
|
31
31
|
- !ruby/object:Gem::Version
|
32
|
-
hash:
|
32
|
+
hash: 19
|
33
33
|
segments:
|
34
34
|
- 0
|
35
35
|
- 9
|
36
|
-
-
|
37
|
-
version: 0.9.
|
36
|
+
- 20
|
37
|
+
version: 0.9.20
|
38
38
|
type: :runtime
|
39
39
|
version_requirements: *id001
|
40
40
|
- !ruby/object:Gem::Dependency
|
@@ -45,12 +45,12 @@ dependencies:
|
|
45
45
|
requirements:
|
46
46
|
- - "="
|
47
47
|
- !ruby/object:Gem::Version
|
48
|
-
hash:
|
48
|
+
hash: 19
|
49
49
|
segments:
|
50
50
|
- 0
|
51
51
|
- 9
|
52
|
-
-
|
53
|
-
version: 0.9.
|
52
|
+
- 20
|
53
|
+
version: 0.9.20
|
54
54
|
type: :runtime
|
55
55
|
version_requirements: *id002
|
56
56
|
description: Admin View for Padrino applications
|
@@ -104,6 +104,14 @@ files:
|
|
104
104
|
- lib/padrino-admin/generators/templates/erb/page/edit.erb.tt
|
105
105
|
- lib/padrino-admin/generators/templates/erb/page/index.erb.tt
|
106
106
|
- lib/padrino-admin/generators/templates/erb/page/new.erb.tt
|
107
|
+
- lib/padrino-admin/generators/templates/erubis/app/base/_sidebar.erubis.tt
|
108
|
+
- lib/padrino-admin/generators/templates/erubis/app/base/index.erubis.tt
|
109
|
+
- lib/padrino-admin/generators/templates/erubis/app/layouts/application.erubis.tt
|
110
|
+
- lib/padrino-admin/generators/templates/erubis/app/sessions/new.erubis.tt
|
111
|
+
- lib/padrino-admin/generators/templates/erubis/page/_form.erubis.tt
|
112
|
+
- lib/padrino-admin/generators/templates/erubis/page/edit.erubis.tt
|
113
|
+
- lib/padrino-admin/generators/templates/erubis/page/index.erubis.tt
|
114
|
+
- lib/padrino-admin/generators/templates/erubis/page/new.erubis.tt
|
107
115
|
- lib/padrino-admin/generators/templates/haml/app/base/_sidebar.haml.tt
|
108
116
|
- lib/padrino-admin/generators/templates/haml/app/base/index.haml.tt
|
109
117
|
- lib/padrino-admin/generators/templates/haml/app/layouts/application.haml.tt
|