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.
Files changed (32) hide show
  1. data/lib/padrino-admin/generators/admin_app.rb +4 -2
  2. data/lib/padrino-admin/generators/templates/account/datamapper.rb.tt +3 -0
  3. data/lib/padrino-admin/generators/templates/erb/app/layouts/application.erb.tt +1 -1
  4. data/lib/padrino-admin/generators/templates/erb/app/sessions/new.erb.tt +10 -10
  5. data/lib/padrino-admin/generators/templates/erubis/app/base/_sidebar.erubis.tt +13 -0
  6. data/lib/padrino-admin/generators/templates/erubis/app/base/index.erubis.tt +17 -0
  7. data/lib/padrino-admin/generators/templates/erubis/app/layouts/application.erubis.tt +44 -0
  8. data/lib/padrino-admin/generators/templates/erubis/app/sessions/new.erubis.tt +56 -0
  9. data/lib/padrino-admin/generators/templates/erubis/page/_form.erubis.tt +11 -0
  10. data/lib/padrino-admin/generators/templates/erubis/page/edit.erubis.tt +18 -0
  11. data/lib/padrino-admin/generators/templates/erubis/page/index.erubis.tt +36 -0
  12. data/lib/padrino-admin/generators/templates/erubis/page/new.erubis.tt +17 -0
  13. data/lib/padrino-admin/generators/templates/haml/app/sessions/new.haml.tt +0 -1
  14. data/lib/padrino-admin/locale/admin/cz.yml +1 -1
  15. data/lib/padrino-admin/locale/admin/da.yml +1 -1
  16. data/lib/padrino-admin/locale/admin/no.yml +4 -5
  17. data/lib/padrino-admin/locale/admin/pl.yml +1 -1
  18. data/lib/padrino-admin/locale/admin/ru.yml +1 -1
  19. data/lib/padrino-admin/locale/admin/tr.yml +1 -1
  20. data/lib/padrino-admin/locale/admin/uk.yml +1 -1
  21. data/lib/padrino-admin/locale/orm/cz.yml +1 -1
  22. data/lib/padrino-admin/locale/orm/da.yml +1 -1
  23. data/lib/padrino-admin/locale/orm/en.yml +1 -1
  24. data/lib/padrino-admin/locale/orm/no.yml +1 -2
  25. data/lib/padrino-admin/locale/orm/pl.yml +1 -1
  26. data/lib/padrino-admin/locale/orm/ru.yml +1 -1
  27. data/lib/padrino-admin/locale/orm/tr.yml +1 -1
  28. data/lib/padrino-admin/locale/orm/uk.yml +1 -1
  29. data/padrino-admin.gemspec +1 -1
  30. data/test/generators/test_admin_app_generator.rb +39 -7
  31. data/test/helper.rb +1 -1
  32. 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("app", "models", "account.rb"), :force => true
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") }
@@ -22,6 +22,9 @@ class Account
22
22
  validates_format_of :email, :with => :email_address
23
23
  validates_format_of :role, :with => /[A-Za-z]/
24
24
 
25
+ # Callbacks
26
+ before :save, :encrypt_password
27
+
25
28
  ##
26
29
  # This method is for authentication purpose
27
30
  #
@@ -41,4 +41,4 @@
41
41
  </div>
42
42
  </div>
43
43
  </body>
44
- </html>
44
+ </html>
@@ -32,16 +32,16 @@
32
32
  <%%= password_field_tag :password, :value => params[:password], :class => 'text_field' %>
33
33
  </div>
34
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 %>
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 &copy; <%%= 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">&nbsp;</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") %>
@@ -26,6 +26,5 @@
26
26
  .left
27
27
  %label.label.right Bypass login?
28
28
  .right=check_box_tag :bypass
29
-
30
29
  .group.navform.wat-cf
31
30
  .right=submit_tag('Sign In', :class => :button)
@@ -13,4 +13,4 @@ cz:
13
13
  all: Všichni
14
14
  profile: Profil
15
15
  settings: Nastavení
16
- logout: Odhlásit
16
+ logout: Odhlásit
@@ -13,4 +13,4 @@ da:
13
13
  all: Alle
14
14
  profile: Profil
15
15
  settings: Indstillinger
16
- logout: Log ud
16
+ logout: Log ud
@@ -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
@@ -13,4 +13,4 @@ pl:
13
13
  all: Wszystkie
14
14
  profile: Profil
15
15
  settings: Ustawienia
16
- logout: Wyloguj
16
+ logout: Wyloguj
@@ -13,4 +13,4 @@ ru:
13
13
  all: Все
14
14
  profile: Профиль
15
15
  settings: Настройки
16
- logout: Выход
16
+ logout: Выход
@@ -13,4 +13,4 @@ tr:
13
13
  all: Hepsi
14
14
  profile: Profil
15
15
  settings: Ayarlar
16
- logout: Çıkış
16
+ logout: Çıkış
@@ -13,4 +13,4 @@ uk:
13
13
  all: Всі
14
14
  profile: Профіль
15
15
  settings: Налаштування
16
- logout: Вихід
16
+ logout: Вихід
@@ -23,4 +23,4 @@ cz:
23
23
  even: "musí být sudé číslo"
24
24
  record_invalid: "Následující pole obsahují chybně vyplněné údaje: %{errors}"
25
25
  content_type: "nepodporovaný formát souboru"
26
- activerecord: *activemodel
26
+ activerecord: *activemodel
@@ -23,4 +23,4 @@ da:
23
23
  even: "skal være lige"
24
24
  record_invalid: "Valideringsfejl: %{errors}"
25
25
  content_type: "fileformatet er ikke understøttet"
26
- activerecord: *activemodel
26
+ activerecord: *activemodel
@@ -23,4 +23,4 @@ en:
23
23
  even: "must be even"
24
24
  record_invalid: "Validation failed: %{errors}"
25
25
  content_type: "file format not supported"
26
- activerecord: *activemodel
26
+ activerecord: *activemodel
@@ -23,5 +23,4 @@
23
23
  even: "skal være lik"
24
24
  record_invalid: "Valideringsfeil: %{errors}"
25
25
  content_type: "fileformatet er ikke støttet"
26
- activerecord: *activemodel
27
-
26
+ activerecord: *activemodel
@@ -24,4 +24,4 @@ pl:
24
24
  even: "musi być parzyste"
25
25
  record_invalid: "Negatywne sprawdzenie poprawności: %{errors}"
26
26
  content_type: "nieodozwolony format pliku"
27
- activerecord: *activemodel
27
+ activerecord: *activemodel
@@ -23,4 +23,4 @@ ru:
23
23
  even: "должно быть четным"
24
24
  record_invalid: "Проверка не удалась: %{errors}"
25
25
  content_type: "формат файла не поддерживается"
26
- activerecord: *activemodel
26
+ activerecord: *activemodel
@@ -23,4 +23,4 @@ tr:
23
23
  even: "çift olmalı"
24
24
  record_invalid: "Doğrulama gerçekleşmedi: %{errors}"
25
25
  content_type: "Dosya biçimi desteklenmiyor"
26
- activerecord: *activemodel
26
+ activerecord: *activemodel
@@ -23,4 +23,4 @@ uk:
23
23
  even: "повинно бути парним"
24
24
  record_invalid: "Перевірка не вдалася: %{errors}"
25
25
  content_type: "формат файлу не підтримується"
26
- activerecord: *activemodel
26
+ activerecord: *activemodel
@@ -17,4 +17,4 @@ Gem::Specification.new do |s|
17
17
  s.require_path = "lib"
18
18
  s.add_dependency("padrino-core", Padrino.version)
19
19
  s.add_dependency("padrino-helpers", Padrino.version)
20
- end
20
+ end
@@ -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/app/models/account.rb")
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/app/models/account.rb")
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
@@ -89,4 +89,4 @@ class Test::Unit::TestCase
89
89
  end
90
90
 
91
91
  alias :response :last_response
92
- end
92
+ end
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: 29
4
+ hash: 19
5
5
  prerelease: false
6
6
  segments:
7
7
  - 0
8
8
  - 9
9
- - 19
10
- version: 0.9.19
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: 2010-11-17 00:00:00 +01:00
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: 29
32
+ hash: 19
33
33
  segments:
34
34
  - 0
35
35
  - 9
36
- - 19
37
- version: 0.9.19
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: 29
48
+ hash: 19
49
49
  segments:
50
50
  - 0
51
51
  - 9
52
- - 19
53
- version: 0.9.19
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