padrino-admin 0.16.0.pre3 → 0.16.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/Rakefile +5 -5
- data/lib/padrino-admin/access_control.rb +10 -9
- data/lib/padrino-admin/generators/actions.rb +8 -8
- data/lib/padrino-admin/generators/admin_app.rb +62 -62
- data/lib/padrino-admin/generators/admin_page.rb +16 -17
- data/lib/padrino-admin/generators/orm.rb +56 -65
- data/lib/padrino-admin/generators/templates/account/activerecord.rb.tt +11 -11
- data/lib/padrino-admin/generators/templates/account/couchrest.rb.tt +10 -10
- data/lib/padrino-admin/generators/templates/account/datamapper.rb.tt +11 -11
- data/lib/padrino-admin/generators/templates/account/dynamoid.rb.tt +9 -9
- data/lib/padrino-admin/generators/templates/account/minirecord.rb.tt +11 -11
- data/lib/padrino-admin/generators/templates/account/mongoid.rb.tt +16 -16
- data/lib/padrino-admin/generators/templates/account/mongomapper.rb.tt +11 -11
- data/lib/padrino-admin/generators/templates/account/ohm.rb.tt +2 -2
- data/lib/padrino-admin/generators/templates/account/seeds.rb.tt +2 -2
- data/lib/padrino-admin/generators/templates/app/controllers/base.rb.tt +2 -2
- data/lib/padrino-admin/generators/templates/app/controllers/sessions.rb.tt +2 -2
- data/lib/padrino-admin/generators/templates/app.rb.tt +7 -7
- data/lib/padrino-admin/generators/templates/erb/app/layouts/application.erb.tt +10 -9
- data/lib/padrino-admin/generators/templates/erb/app/layouts/error.erb.tt +3 -2
- data/lib/padrino-admin/generators/templates/erb/app/sessions/new.erb.tt +8 -7
- data/lib/padrino-admin/generators/templates/erb/page/_form.erb.tt +7 -7
- data/lib/padrino-admin/generators/templates/erb/page/edit.erb.tt +3 -3
- data/lib/padrino-admin/generators/templates/erb/page/index.erb.tt +12 -12
- data/lib/padrino-admin/generators/templates/erb/page/new.erb.tt +2 -2
- data/lib/padrino-admin/generators/templates/haml/app/base/index.haml.tt +10 -5
- data/lib/padrino-admin/generators/templates/haml/app/layouts/application.haml.tt +14 -14
- data/lib/padrino-admin/generators/templates/haml/app/layouts/error.haml.tt +6 -5
- data/lib/padrino-admin/generators/templates/haml/app/sessions/new.haml.tt +12 -11
- data/lib/padrino-admin/generators/templates/haml/page/_form.haml.tt +7 -7
- data/lib/padrino-admin/generators/templates/haml/page/edit.haml.tt +3 -3
- data/lib/padrino-admin/generators/templates/haml/page/index.haml.tt +14 -14
- data/lib/padrino-admin/generators/templates/haml/page/new.haml.tt +2 -2
- data/lib/padrino-admin/generators/templates/page/controller.rb.tt +25 -25
- data/lib/padrino-admin/generators/templates/slim/app/layouts/application.slim.tt +9 -9
- data/lib/padrino-admin/generators/templates/slim/app/layouts/error.slim.tt +1 -1
- data/lib/padrino-admin/generators/templates/slim/app/sessions/new.slim.tt +6 -6
- data/lib/padrino-admin/generators/templates/slim/page/_form.slim.tt +6 -6
- data/lib/padrino-admin/generators/templates/slim/page/edit.slim.tt +3 -3
- data/lib/padrino-admin/generators/templates/slim/page/index.slim.tt +12 -12
- data/lib/padrino-admin/generators/templates/slim/page/new.slim.tt +2 -2
- data/lib/padrino-admin/helpers/authentication_helpers.rb +7 -7
- data/lib/padrino-admin/helpers/view_helpers.rb +11 -11
- data/lib/padrino-admin.rb +4 -3
- data/padrino-admin.gemspec +18 -18
- data/test/fixtures/sequel.rb +14 -14
- data/test/generators/test_account_model_generator.rb +4 -4
- data/test/generators/test_admin_app_generator.rb +22 -22
- data/test/generators/test_admin_page_generator.rb +30 -30
- data/test/helper.rb +6 -6
- data/test/test_admin_application.rb +114 -116
- data/test/test_locale.rb +3 -3
- metadata +8 -8
|
@@ -12,12 +12,13 @@
|
|
|
12
12
|
<link href='http://fonts.googleapis.com/css?family=Varela' rel=stylesheet />
|
|
13
13
|
<%%= stylesheet_link_tag 'bootstrap', 'application' %>
|
|
14
14
|
</head>
|
|
15
|
+
|
|
15
16
|
<body>
|
|
16
17
|
<div class="custom-error text-center">
|
|
17
18
|
<div class="custom-error-body muted"><%%= yield %></div>
|
|
18
19
|
<div class="custom-error-footer">
|
|
19
|
-
<%%= link_to tag_icon('arrow-left'),
|
|
20
|
+
<%%= link_to tag_icon('arrow-left'), '#', onclick: 'history.go(-1); return false;', class: 'custom-error-go-back btn btn-default pull-left', title: 'Go back' %>
|
|
20
21
|
</div>
|
|
21
22
|
</div>
|
|
22
23
|
</body>
|
|
23
|
-
</html>
|
|
24
|
+
</html>
|
|
@@ -11,23 +11,24 @@
|
|
|
11
11
|
<%%= favicon_tag "favicon.ico" %>
|
|
12
12
|
<%%= stylesheet_link_tag "bootstrap", "application" %>
|
|
13
13
|
</head>
|
|
14
|
+
|
|
14
15
|
<body>
|
|
15
|
-
<%% form_tag url(:sessions, :create), :
|
|
16
|
+
<%% form_tag url(:sessions, :create), class: "login form-horizontal" do %>
|
|
16
17
|
<div class="login-header modal-header">
|
|
17
|
-
<div class="login-logo"> <%%= image_tag(
|
|
18
|
+
<div class="login-logo"> <%%= image_tag('logo.png', alt: "Padrino's logo", height: 250, width: 193) %> </div>
|
|
18
19
|
</div>
|
|
19
20
|
<div class="login-body modal-body">
|
|
20
21
|
|
|
21
|
-
<%%= {:
|
|
22
|
+
<%%= { error: 'danger', warning: 'warning', success: 'success', notice: 'info' }.map { |type, class_name| flash_tag(type, class: "alert alert-#{class_name} fade in", bootstrap: true) }.join.html_safe %>
|
|
22
23
|
|
|
23
24
|
<div class="form-group">
|
|
24
25
|
<label for="email" class="col-lg-2 control-label"><%%= pat('login.email') %></label>
|
|
25
|
-
<div class="col-lg-10"><%%= email_field_tag :email, :
|
|
26
|
+
<div class="col-lg-10"><%%= email_field_tag :email, id: :email, value: params[:email], autofocus: true, class: 'form-control' %></div>
|
|
26
27
|
</div>
|
|
27
28
|
|
|
28
29
|
<div class="form-group">
|
|
29
30
|
<label for="password" class="col-lg-2 control-label"><%%= pat('login.password') %></label>
|
|
30
|
-
<div class="col-lg-10"><%%= password_field_tag :password, :
|
|
31
|
+
<div class="col-lg-10"><%%= password_field_tag :password, id: :password, class: 'form-control' %></div>
|
|
31
32
|
</div>
|
|
32
33
|
|
|
33
34
|
<fieldset class="login-control-group-last control-group">
|
|
@@ -37,8 +38,8 @@
|
|
|
37
38
|
</fieldset>
|
|
38
39
|
|
|
39
40
|
</div>
|
|
40
|
-
<div class="login-footer modal-footer"><%%= submit_tag(pat('login.sign_in'), :
|
|
41
|
+
<div class="login-footer modal-footer"><%%= submit_tag(pat('login.sign_in'), class: 'btn btn-primary pull-right') %></div>
|
|
41
42
|
<%% end %>
|
|
42
|
-
<%%= javascript_include_tag 'jquery-1.11.0.min', (Padrino.env == :production ? 'bootstrap/bootstrap.min' : %w[bootstrap/affix bootstrap/alert bootstrap/button bootstrap/carousel bootstrap/collapse bootstrap/dropdown
|
|
43
|
+
<%%= javascript_include_tag 'jquery-1.11.0.min', (Padrino.env == :production ? 'bootstrap/bootstrap.min' : %w[bootstrap/affix bootstrap/alert bootstrap/button bootstrap/carousel bootstrap/collapse bootstrap/dropdown bootstrap/tooltip bootstrap/transition bootstrap/modal bootstrap/popover bootstrap/scrollspy bootstrap/tab]), :application %>
|
|
43
44
|
</body>
|
|
44
45
|
</html>
|
|
@@ -1,18 +1,18 @@
|
|
|
1
1
|
<% @orm.column_fields.each_with_index do |column, index| -%>
|
|
2
2
|
<%% error = <%= @orm.has_error(column[:name]) %> %>
|
|
3
3
|
<fieldset class='control-group <%%= error ? 'has-error' : ''%>'>
|
|
4
|
-
<%%= f.label :<%= column[:name] %>, :
|
|
4
|
+
<%%= f.label :<%= column[:name] %>, class: 'control-label' %>
|
|
5
5
|
<div class='controls'>
|
|
6
|
-
<%%= f.<%= column[:field_type] %> :<%= column[:name] %>, :
|
|
7
|
-
<span class='help-inline'><%%= error ? f.error_message_on(:<%= column[:name] %>) :
|
|
6
|
+
<%%= f.<%= column[:field_type] %> :<%= column[:name] %>, class: 'form-control input-xlarge input-with-feedback'<%- if (index == 0) -%>, autofocus: true<%- end -%> %>
|
|
7
|
+
<span class='help-inline'><%%= error ? f.error_message_on(:<%= column[:name] %>) : 'Ex: a simple text' %></span>
|
|
8
8
|
</div>
|
|
9
9
|
</fieldset>
|
|
10
10
|
<% end %>
|
|
11
11
|
|
|
12
12
|
<div class="form-actions">
|
|
13
|
-
<%%= f.submit pat(:save), :
|
|
13
|
+
<%%= f.submit pat(:save), class: 'btn btn-primary' %>
|
|
14
14
|
|
|
15
|
-
<%%= f.submit pat(:save_and_continue), :
|
|
15
|
+
<%%= f.submit pat(:save_and_continue), class: 'btn btn-info', name: 'save_and_continue' %>
|
|
16
16
|
|
|
17
|
-
<%%= link_to pat(:cancel), url(:<%= @orm.name_plural %>, :index), :
|
|
18
|
-
</div>
|
|
17
|
+
<%%= link_to pat(:cancel), url(:<%= @orm.name_plural %>, :index), class: 'btn btn-default' %>
|
|
18
|
+
</div>
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
<ul class="nav nav-tabs">
|
|
2
2
|
<li> <%%= link_to tag_icon(:list, pat(:list)), url(:<%= @orm.name_plural %>, :index) %></li>
|
|
3
3
|
<li> <%%= link_to tag_icon(:plus, pat(:new)), url(:<%= @orm.name_plural %>, :new) %></li>
|
|
4
|
-
<li class="active"> <%%= link_to tag_icon(:edit, pat(:edit)), url(:<%= @orm.name_plural %>, :edit, :
|
|
4
|
+
<li class="active"> <%%= link_to tag_icon(:edit, pat(:edit)), url(:<%= @orm.name_plural %>, :edit, id: @<%= @orm.name_singular %>.id) %></li>
|
|
5
5
|
</ul>
|
|
6
6
|
<div class="tabs-content">
|
|
7
|
-
<%% form_for :<%= @orm.name_singular %>, url(:<%= @orm.name_plural %>, :update, :
|
|
8
|
-
<%%= partial '<%= @orm.name_plural %>/form', :
|
|
7
|
+
<%% form_for :<%= @orm.name_singular %>, url(:<%= @orm.name_plural %>, :update, id: @<%= @orm.name_singular %>.id), method: :put, class: 'form-horizontal' do |f| %>
|
|
8
|
+
<%%= partial '<%= @orm.name_plural %>/form', locals: { f: f } %>
|
|
9
9
|
<%% end %>
|
|
10
10
|
</div>
|
|
@@ -13,21 +13,21 @@
|
|
|
13
13
|
</a>
|
|
14
14
|
<ul class="list-menu dropdown-menu" role=menu>
|
|
15
15
|
<li class=list-menu-wrapper>
|
|
16
|
-
<%%= link_to tag_icon('check-square-o', pat(:select_all)), '#', :
|
|
16
|
+
<%%= link_to tag_icon('check-square-o', pat(:select_all)), '#', id: 'select-all', class: 'list-menu-link' %>
|
|
17
17
|
</li>
|
|
18
18
|
<li class=list-menu-wrapper.list-menu-wrapper-disabled>
|
|
19
|
-
<%%= link_to tag_icon('square-o', pat(:deselect_all)), '#', :
|
|
19
|
+
<%%= link_to tag_icon('square-o', pat(:deselect_all)), '#', id: 'deselect-all', class: 'list-menu-link list-menu-link-disabled' %>
|
|
20
20
|
</li>
|
|
21
21
|
<li class="list-menu-divider divider"></li>
|
|
22
22
|
<li class=list-menu-wrapper.list-menu-wrapper-disabled>
|
|
23
|
-
<%%=link_to tag_icon('trash-o', pat(:delete_selected)), '#', :
|
|
23
|
+
<%%=link_to tag_icon('trash-o', pat(:delete_selected)), '#', id: 'delete-selected', class: 'list-menu-link list-menu-link-disabled' %>
|
|
24
24
|
<div class='list-menu-popover-delete-selected popover right'>
|
|
25
25
|
<div class=arrow></div>
|
|
26
26
|
<h3 class=popover-title><%%= pat(:delete_selected_title) %></h3>
|
|
27
27
|
<div class=popover-content>
|
|
28
|
-
<%% form_tag url(:<%= @orm.name_plural %>, :destroy_many), :
|
|
29
|
-
<%%=hidden_field_tag :<%= @orm.name_singular %>_ids,
|
|
30
|
-
<%%=submit_tag pat(:delete), :
|
|
28
|
+
<%% form_tag url(:<%= @orm.name_plural %>, :destroy_many), method: :delete do %>
|
|
29
|
+
<%%=hidden_field_tag :<%= @orm.name_singular %>_ids, 'data-delete-many-ids' => true %>
|
|
30
|
+
<%%=submit_tag pat(:delete), class: 'list-menu-popover-delete-selected-btn btn btn-danger btn-small' %>
|
|
31
31
|
<div class='btn btn-default btn-small cancel'><%%= pat(:cancel) %></div>
|
|
32
32
|
<%% end %>
|
|
33
33
|
</div>
|
|
@@ -47,7 +47,7 @@
|
|
|
47
47
|
<%% @<%= @orm.name_plural %>.each do |<%= @orm.name_singular %>| %>
|
|
48
48
|
<tr class=list-row>
|
|
49
49
|
<td class="list-column list-selectable">
|
|
50
|
-
<%%= check_box_tag '<%= @orm.name_singular %>_ids[]', :
|
|
50
|
+
<%%= check_box_tag '<%= @orm.name_singular %>_ids[]', value: <%= @orm.name_singular %>.id, class: 'list-selectable-checkbox' %>
|
|
51
51
|
</td>
|
|
52
52
|
<%- @orm.columns.each_with_index do |column, i| -%>
|
|
53
53
|
<%- if column.name == "created_at" || column.name == "updated_at" -%>
|
|
@@ -60,14 +60,14 @@
|
|
|
60
60
|
<%- end -%>
|
|
61
61
|
<td class="list-column list-row-action">
|
|
62
62
|
<div class='list-row-action-wrapper'>
|
|
63
|
-
<%%= link_to tag_icon(:edit),
|
|
64
|
-
<%%= link_to tag_icon('trash-o'), :
|
|
63
|
+
<%%= link_to tag_icon(:edit), url(:<%= @orm.name_plural %>, :edit, id: <%= @orm.name_singular %>.id), rel: :tooltip, title: "#{pat(:edit)} <%= @orm.name_singular %>", class: 'list-row-action-wrapper-link' %>
|
|
64
|
+
<%%= link_to tag_icon('trash-o'), rel: :tooltip, title: "#{pat(:delete)} <%= @orm.name_singular %>", class: 'list-row-action-delete-one list-row-action-wrapper-link' %>
|
|
65
65
|
<div class="popover list-row-action-popover-delete-one left">
|
|
66
66
|
<div class=arrow> </div>
|
|
67
|
-
<h3 class=popover-title><%%= pat(:delete, :
|
|
67
|
+
<h3 class=popover-title><%%= pat(:delete, model: '<%= @orm.name_singular %>') %></h3>
|
|
68
68
|
<div class=popover-content>
|
|
69
|
-
<%% form_tag url(:<%= @orm.name_plural %>, :destroy, :
|
|
70
|
-
<%%= submit_tag pat(:delete), :
|
|
69
|
+
<%% form_tag url(:<%= @orm.name_plural %>, :destroy, id: <%= @orm.name_singular %>.id), method: :delete do %>
|
|
70
|
+
<%%= submit_tag pat(:delete), class: 'list-row-action-popover-delete-one-btn btn btn-danger btn-small' %>
|
|
71
71
|
<div class="btn btn-default btn-small cancel"><%%= pat(:cancel) %></div>
|
|
72
72
|
<%% end %>
|
|
73
73
|
</div>
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
<li class="active"> <%%= link_to tag_icon(:plus, pat(:new)), url(:<%= @orm.name_plural %>, :new) %></li>
|
|
4
4
|
</ul>
|
|
5
5
|
<div class="tabs-content">
|
|
6
|
-
<%% form_for :<%= @orm.name_singular %>, url(:<%= @orm.name_plural %>, :create), :
|
|
7
|
-
<%%= partial '<%= @orm.name_plural %>/form', :
|
|
6
|
+
<%% form_for :<%= @orm.name_singular %>, url(:<%= @orm.name_plural %>, :create), class: 'form-horizontal' do |f| %>
|
|
7
|
+
<%%= partial '<%= @orm.name_plural %>/form', locals: { f: f } %>
|
|
8
8
|
<%% end %>
|
|
9
9
|
</div>
|
|
@@ -5,8 +5,13 @@
|
|
|
5
5
|
|
|
6
6
|
.base-icons
|
|
7
7
|
.btn-group
|
|
8
|
-
.btn.btn-primary{:
|
|
9
|
-
|
|
10
|
-
.btn.btn-
|
|
11
|
-
|
|
12
|
-
.btn.btn-
|
|
8
|
+
.btn.btn-primary{title: 'Adapters for datamapper, sequel, activerecord, minirecord, mongomapper, mongoid, couchrest'}
|
|
9
|
+
= tag_icon('cogs fa-2x', 'Orm Agnostic')
|
|
10
|
+
.btn.btn-success{title: 'User Authentication Support, User Authorization Management'}
|
|
11
|
+
= tag_icon('group fa-2x', 'Authentication')
|
|
12
|
+
.btn.btn-info{title: 'Erb, Haml, Slim Rendering Support'}
|
|
13
|
+
= tag_icon('tasks fa-2x', 'Template Agnostic')
|
|
14
|
+
.btn.btn-warning{title: 'English, German, Russian, Danish, French, Brazilian and Italian localizations and many more!..'}
|
|
15
|
+
= tag_icon('flag fa-2x', 'Multi Language')
|
|
16
|
+
.btn.btn-danger{title: "You can create a new 'admin interface' by providing a single Model"}
|
|
17
|
+
= tag_icon('magic fa-2x', 'Scaffold')
|
|
@@ -1,36 +1,36 @@
|
|
|
1
1
|
!!! 5
|
|
2
|
-
%html{:
|
|
2
|
+
%html{lang: 'en'}
|
|
3
3
|
%head
|
|
4
4
|
<!-- Le HTML5 shim, for IE6-8 support of HTML elements -->
|
|
5
5
|
<!--[if lt IE 9]>
|
|
6
6
|
<script src="http://html5shim.googlecode.com/svn/trunk/html5.js"></script>
|
|
7
7
|
<![endif]-->
|
|
8
|
-
%meta{:
|
|
9
|
-
%meta{:
|
|
10
|
-
%title= @title.present? ? "#{@title} | Padrino Admin" :
|
|
8
|
+
%meta{content: 'text/html; charset=utf-8', 'http-equiv' => 'Content-Type'}
|
|
9
|
+
%meta{name: :viewport, content: 'width=device-width,initial-scale=1'}
|
|
10
|
+
%title= @title.present? ? "#{@title} | Padrino Admin" : 'Padrino Admin'
|
|
11
11
|
=favicon_tag 'favicon.ico'
|
|
12
|
-
%link{:
|
|
12
|
+
%link{href: 'http://fonts.googleapis.com/css?family=Varela', rel: :stylesheet}
|
|
13
13
|
=stylesheet_link_tag 'bootstrap', 'application'
|
|
14
14
|
|
|
15
15
|
%body
|
|
16
16
|
.navbar.navbar-fixed-top
|
|
17
17
|
.navbar-inner
|
|
18
18
|
.container
|
|
19
|
-
=link_to 'Padrino', url(:base, :index), :
|
|
19
|
+
=link_to 'Padrino', url(:base, :index), class: 'navbar-brand', title: 'Padrino Admin'
|
|
20
20
|
%ul.nav.navbar-nav.pull-right
|
|
21
|
-
%li.navbar-edit-account=link_to tag_icon(:user), url(:<%= @model_plural %>, :edit, :
|
|
21
|
+
%li.navbar-edit-account=link_to tag_icon(:user), url(:<%= @model_plural %>, :edit, id: current_account.id), title: pat(:profile), class: 'navbar-nav-link'
|
|
22
22
|
%li.navbar-logout
|
|
23
|
-
= button_to :logout, url(:sessions, :destroy), :
|
|
23
|
+
= button_to :logout, url(:sessions, :destroy), method: :delete, class: 'navbar-nav-form', submit_options: { type: :submit, title: pat(:logout), class: 'navbar-nav-form-link' } do
|
|
24
24
|
= tag_icon('power-off')
|
|
25
25
|
|
|
26
26
|
%ul.nav.navbar-nav.pull-left
|
|
27
27
|
- project_modules.each do |project_module|
|
|
28
|
-
%li{:
|
|
28
|
+
%li{class: "navbar-module #{('active' if request.path_info =~ /^#{project_module.path}/)}"}
|
|
29
29
|
=link_to project_module.human_name, url(project_module.path)
|
|
30
30
|
|
|
31
31
|
.container.main
|
|
32
32
|
.main-wrapper
|
|
33
|
-
={:
|
|
33
|
+
= { error: 'danger', warning: 'warning', success: 'success', notice: 'info' }.map { |type, class_name| flash_tag(type, class: "alert alert-#{class_name} fade in", bootstrap: true) }.join.html_safe
|
|
34
34
|
.row=yield
|
|
35
35
|
.main-wrapper-push
|
|
36
36
|
|
|
@@ -41,9 +41,9 @@
|
|
|
41
41
|
=Time.now.year
|
|
42
42
|
Your Site - Powered by Padrino v.#{Padrino.version}
|
|
43
43
|
%ul.pull-right.footer-links
|
|
44
|
-
%li= link_to tag_icon(:home, 'web'), 'http://www.padrinorb.com', :
|
|
45
|
-
%li= link_to tag_icon(:heart, 'blog'), 'http://www.padrinorb.com/blog', :
|
|
46
|
-
%li= link_to tag_icon(:github, 'code'), 'https://github.com/padrino/padrino-framework', :
|
|
47
|
-
%li= link_to tag_icon(:twitter, 'twitter'), 'http://twitter.com/padrinorb', :
|
|
44
|
+
%li= link_to tag_icon(:home, 'web'), 'http://www.padrinorb.com', target: :_blank, class: 'footer-links-link'
|
|
45
|
+
%li= link_to tag_icon(:heart, 'blog'), 'http://www.padrinorb.com/blog', target: :_blank, class: 'footer-links-link'
|
|
46
|
+
%li= link_to tag_icon(:github, 'code'), 'https://github.com/padrino/padrino-framework', target: :_blank, class: 'footer-links-link'
|
|
47
|
+
%li= link_to tag_icon(:twitter, 'twitter'), 'http://twitter.com/padrinorb', target: :_blank, class: 'footer-links-link'
|
|
48
48
|
|
|
49
49
|
=javascript_include_tag 'jquery-1.11.0.min', (Padrino.env == :production ? 'bootstrap/bootstrap.min' : %w[bootstrap/affix bootstrap/alert bootstrap/button bootstrap/carousel bootstrap/collapse bootstrap/dropdown bootstrap/tooltip bootstrap/transition bootstrap/modal bootstrap/popover bootstrap/scrollspy bootstrap/tab]), :application
|
|
@@ -1,18 +1,19 @@
|
|
|
1
1
|
!!! 5
|
|
2
|
-
%html{:
|
|
2
|
+
%html{lang: 'en'}
|
|
3
3
|
%head
|
|
4
4
|
<!-- Le HTML5 shim, for IE6-8 support of HTML elements -->
|
|
5
5
|
<!--[if lt IE 9]>
|
|
6
6
|
<script src="http://html5shim.googlecode.com/svn/trunk/html5.js"></script>
|
|
7
7
|
<![endif]-->
|
|
8
|
-
%meta{:
|
|
9
|
-
%meta{:
|
|
8
|
+
%meta{content: 'text/html; charset=utf-8', 'http-equiv' => 'Content-Type'}
|
|
9
|
+
%meta{name: :viewport, content: 'width=device-width,initial-scale=1'}
|
|
10
10
|
%title= @title.present? ? "#{@title} | Padrino Admin" : "#{pat(:custom_errors.title)} | Padrino Admin"
|
|
11
11
|
=favicon_tag 'favicon.ico'
|
|
12
|
-
%link{:
|
|
12
|
+
%link{href: 'http://fonts.googleapis.com/css?family=Varela', rel: :stylesheet}
|
|
13
13
|
=stylesheet_link_tag 'bootstrap', 'application'
|
|
14
|
+
|
|
14
15
|
%body
|
|
15
16
|
.custom-error.text-center
|
|
16
17
|
.custom-error-body.muted= yield
|
|
17
18
|
.custom-error-footer
|
|
18
|
-
=link_to tag_icon('arrow-left'),
|
|
19
|
+
=link_to tag_icon('arrow-left'), '#', onclick: 'history.go(-1); return false;', class: 'custom-error-go-back btn btn-default pull-left', title: 'Go back'
|
|
@@ -1,29 +1,30 @@
|
|
|
1
1
|
!!! 5
|
|
2
|
-
%html{:
|
|
2
|
+
%html{lang: 'en'}
|
|
3
3
|
%head
|
|
4
4
|
<!-- Le HTML5 shim, for IE6-8 support of HTML elements -->
|
|
5
5
|
<!--[if lt IE 9]>
|
|
6
6
|
<script src="http://html5shim.googlecode.com/svn/trunk/html5.js"></script>
|
|
7
7
|
<![endif]-->
|
|
8
|
-
%meta{:
|
|
9
|
-
%meta{:
|
|
8
|
+
%meta{content: 'text/html; charset=utf-8', 'http-equiv' => 'Content-Type'}
|
|
9
|
+
%meta{name: :viewport, content: 'width=device-width,initial-scale=1'}
|
|
10
10
|
%title= @title.present? ? "#{@title} | Padrino Admin" : "#{pat('login.title')} | Padrino Admin"
|
|
11
11
|
= favicon_tag 'favicon.ico'
|
|
12
12
|
= stylesheet_link_tag 'bootstrap', 'application'
|
|
13
|
+
|
|
13
14
|
%body
|
|
14
|
-
= form_tag url(:sessions, :create), :
|
|
15
|
+
= form_tag url(:sessions, :create), class: 'login form-horizontal' do
|
|
15
16
|
.login-header.modal-header
|
|
16
|
-
.login-logo=image_tag('logo.png', :
|
|
17
|
+
.login-logo=image_tag('logo.png', alt: "Padrino's logo", height: 250, width: 193)
|
|
17
18
|
.login-body.modal-body
|
|
18
|
-
= {:
|
|
19
|
+
= { error: 'danger', warning: 'warning', success: 'success', notice: 'info' }.map { |type, class_name| flash_tag(type, class: "alert alert-#{class_name} fade in", bootstrap: true) }.join.html_safe
|
|
19
20
|
|
|
20
21
|
.form-group
|
|
21
|
-
%label.col-lg-2.control-label{:
|
|
22
|
-
.col-lg-10= email_field_tag :email, :
|
|
22
|
+
%label.col-lg-2.control-label{for: :email}= pat('login.email')
|
|
23
|
+
.col-lg-10= email_field_tag :email, id: :email, value: params[:email], autofocus: true, class: 'form-control'
|
|
23
24
|
|
|
24
25
|
.form-group
|
|
25
|
-
%label.col-lg-2.control-label{:
|
|
26
|
-
.col-lg-10= password_field_tag :password, :
|
|
26
|
+
%label.col-lg-2.control-label{for: :password}= pat('login.password')
|
|
27
|
+
.col-lg-10= password_field_tag :password, id: :password, class:'form-control'
|
|
27
28
|
|
|
28
29
|
%fieldset.login-control-group-last.control-group
|
|
29
30
|
.login-controls.controls
|
|
@@ -32,7 +33,7 @@
|
|
|
32
33
|
= pat('login.bypass')
|
|
33
34
|
|
|
34
35
|
.login-footer.modal-footer
|
|
35
|
-
= submit_tag(pat('login.sign_in'), :
|
|
36
|
+
= submit_tag(pat('login.sign_in'), class: 'btn btn-primary pull-right')
|
|
36
37
|
|
|
37
38
|
=javascript_include_tag 'jquery-1.11.0.min', (Padrino.env == :production ? 'bootstrap/bootstrap.min' : %w[bootstrap/affix bootstrap/alert bootstrap/button bootstrap/carousel bootstrap/collapse bootstrap/dropdown bootstrap/tooltip bootstrap/transition bootstrap/modal bootstrap/popover bootstrap/scrollspy bootstrap/tab]), :application
|
|
38
39
|
|
|
@@ -1,16 +1,16 @@
|
|
|
1
1
|
<%- @orm.column_fields.each_with_index do |column, index| -%>
|
|
2
2
|
- error = <%= @orm.has_error(column[:name]) %>
|
|
3
|
-
%fieldset.control-group{:
|
|
4
|
-
=f.label :<%= column[:name] %>, :
|
|
3
|
+
%fieldset.control-group{class: error ? 'has-error' : ''}
|
|
4
|
+
=f.label :<%= column[:name] %>, class: 'control-label'
|
|
5
5
|
.controls
|
|
6
|
-
<% if column[:field_type] == :text_area %>~<% else %>=<% end %>f.<%= column[:field_type] %> :<%= column[:name] %>, :
|
|
6
|
+
<% if column[:field_type] == :text_area %>~<% else %>=<% end %>f.<%= column[:field_type] %> :<%= column[:name] %>, class: 'form-control input-large input-with-feedback'<%- if (index == 0) -%>, autofocus: true<%- end -%>
|
|
7
7
|
|
|
8
|
-
%span.help-inline=error ? f.error_message_on(:<%= column[:name] %>, :
|
|
8
|
+
%span.help-inline=error ? f.error_message_on(:<%= column[:name] %>, class: 'text-error') : pat(:example)
|
|
9
9
|
<%- end -%>
|
|
10
10
|
|
|
11
11
|
.form-actions
|
|
12
|
-
=f.submit pat(:save), :
|
|
12
|
+
=f.submit pat(:save), class: 'btn btn-primary'
|
|
13
13
|
|
|
14
|
-
=f.submit pat(:save_and_continue), :
|
|
14
|
+
=f.submit pat(:save_and_continue), class: 'btn btn-info', name: 'save_and_continue'
|
|
15
15
|
|
|
16
|
-
=link_to pat(:cancel), url(:<%= @orm.name_plural %>, :index), :
|
|
16
|
+
=link_to pat(:cancel), url(:<%= @orm.name_plural %>, :index), class: 'btn btn-default'
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
%ul.nav.nav-tabs
|
|
2
2
|
%li=link_to tag_icon(:list, pat(:list)), url(:<%= @orm.name_plural %>, :index)
|
|
3
3
|
%li=link_to tag_icon(:plus, pat(:new)), url(:<%= @orm.name_plural %>, :new)
|
|
4
|
-
%li.active=link_to tag_icon(:edit, pat(:edit)), url(:<%= @orm.name_plural %>, :edit, :
|
|
4
|
+
%li.active=link_to tag_icon(:edit, pat(:edit)), url(:<%= @orm.name_plural %>, :edit, id: @<%= @orm.name_singular %>.id)
|
|
5
5
|
|
|
6
6
|
.tabs-content
|
|
7
|
-
= form_for :<%= @orm.name_singular %>, url(:<%= @orm.name_plural %>, :update, :
|
|
8
|
-
=partial '<%= @orm.name_plural %>/form', :
|
|
7
|
+
= form_for :<%= @orm.name_singular %>, url(:<%= @orm.name_plural %>, :update, id: @<%= @orm.name_singular %>.id), method: :put, class: 'form-horizontal' do |f|
|
|
8
|
+
= partial '<%= @orm.name_plural %>/form', locals: { f: f }
|
|
@@ -8,23 +8,23 @@
|
|
|
8
8
|
%tr
|
|
9
9
|
%th.header.list-menu
|
|
10
10
|
.dropdown
|
|
11
|
-
%a.list-menu-toggle.dropdown-toggle{:
|
|
11
|
+
%a.list-menu-toggle.dropdown-toggle{href: '#', 'data-toggle' => :dropdown}
|
|
12
12
|
=tag_icon :magic
|
|
13
13
|
%span.caret
|
|
14
|
-
%ul.list-menu.dropdown-menu{:
|
|
15
|
-
%li.list-menu-wrapper=link_to tag_icon('check-square-o', pat(:select_all)), '#', :
|
|
14
|
+
%ul.list-menu.dropdown-menu{role: :menu}
|
|
15
|
+
%li.list-menu-wrapper=link_to tag_icon('check-square-o', pat(:select_all)), '#', id: 'select-all', class: 'list-menu-link'
|
|
16
16
|
%li.list-menu-wrapper.list-menu-wrapper-disabled
|
|
17
|
-
=link_to tag_icon('square-o', pat(:deselect_all)), '#', :
|
|
17
|
+
=link_to tag_icon('square-o', pat(:deselect_all)), '#', id: 'deselect-all', class: 'list-menu-link list-menu-link-disabled'
|
|
18
18
|
%li.list-menu-divider.divider
|
|
19
19
|
%li.list-menu-wrapper.list-menu-wrapper-disabled
|
|
20
|
-
=link_to tag_icon('trash-o', pat(:delete_selected)), '#', :
|
|
20
|
+
=link_to tag_icon('trash-o', pat(:delete_selected)), '#', id: 'delete-selected', class: 'list-menu-link list-menu-link-disabled'
|
|
21
21
|
.list-menu-popover-delete-selected.popover.right
|
|
22
22
|
.arrow
|
|
23
23
|
%h3.popover-title=pat(:delete_selected_title)
|
|
24
24
|
.popover-content
|
|
25
|
-
= form_tag url(:<%= @orm.name_plural %>, :destroy_many), :
|
|
26
|
-
=hidden_field_tag :<%= @orm.name_singular %>_ids,
|
|
27
|
-
=submit_tag pat(:delete), :
|
|
25
|
+
= form_tag url(:<%= @orm.name_plural %>, :destroy_many), method: :delete do
|
|
26
|
+
=hidden_field_tag :<%= @orm.name_singular %>_ids, 'data-delete-many-ids' => true
|
|
27
|
+
=submit_tag pat(:delete), class: 'list-menu-popover-delete-selected-btn btn btn-danger btn-small'
|
|
28
28
|
.btn.btn-default.btn-small.cancel=pat(:cancel)
|
|
29
29
|
<%- @orm.columns.each_with_index do |column, i| -%>
|
|
30
30
|
%th.header= mat(:<%= @orm.name_singular %>, :<%= column.name %>)
|
|
@@ -35,7 +35,7 @@
|
|
|
35
35
|
-@<%= @orm.name_plural %>.each do |<%= @orm.name_singular %>|
|
|
36
36
|
%tr.list-row
|
|
37
37
|
%td.list-column.list-selectable
|
|
38
|
-
=check_box_tag '<%= @orm.name_singular %>_ids[]', :
|
|
38
|
+
=check_box_tag '<%= @orm.name_singular %>_ids[]', value: <%= @orm.name_singular %>.id, class: 'list-selectable-checkbox'
|
|
39
39
|
<%- @orm.columns.each_with_index do |column, i| -%>
|
|
40
40
|
<%- if column.name == "created_at" || column.name == "updated_at" -%>
|
|
41
41
|
%td.list-column=time_ago_in_words <%= @orm.name_singular %>.<%= column.name %>
|
|
@@ -47,12 +47,12 @@
|
|
|
47
47
|
<%- end -%>
|
|
48
48
|
%td.list-column.list-row-action
|
|
49
49
|
.list-row-action-wrapper
|
|
50
|
-
=link_to tag_icon(:edit), :
|
|
51
|
-
=link_to tag_icon('trash-o'), :
|
|
50
|
+
=link_to tag_icon(:edit), href: url(:<%= @orm.name_plural %>, :edit, id: <%= @orm.name_singular %>.id), rel: :tooltip, title: "#{pat(:edit)} <%= @orm.name_singular %>", class: 'list-row-action-wrapper-link'
|
|
51
|
+
=link_to tag_icon('trash-o'), rel: :tooltip, title: "#{pat(:delete)} <%= @orm.name_singular %>", class: 'list-row-action-delete-one list-row-action-wrapper-link'
|
|
52
52
|
.popover.list-row-action-popover-delete-one.left
|
|
53
53
|
.arrow
|
|
54
|
-
%h3.popover-title=pat(:delete, :
|
|
54
|
+
%h3.popover-title=pat(:delete, model: '<%= @orm.name_singular %>')
|
|
55
55
|
.popover-content
|
|
56
|
-
= form_tag url(:<%= @orm.name_plural %>, :destroy, :
|
|
57
|
-
=submit_tag pat(:delete), :
|
|
56
|
+
= form_tag url(:<%= @orm.name_plural %>, :destroy, id: <%= @orm.name_singular %>.id), method: :delete do
|
|
57
|
+
=submit_tag pat(:delete), class: 'list-row-action-popover-delete-one-btn btn btn-danger btn-small'
|
|
58
58
|
.btn.btn-default.btn-small.cancel=pat(:cancel)
|
|
@@ -3,5 +3,5 @@
|
|
|
3
3
|
%li.active=link_to tag_icon(:plus, pat(:new)), url(:<%= @orm.name_plural %>, :new)
|
|
4
4
|
|
|
5
5
|
.tabs-content
|
|
6
|
-
= form_for :<%= @orm.name_singular %>, url(:<%= @orm.name_plural %>, :create), :
|
|
7
|
-
=partial '<%= @orm.name_plural %>/form', :
|
|
6
|
+
= form_for :<%= @orm.name_singular %>, url(:<%= @orm.name_plural %>, :create), class: 'form-horizontal' do |f|
|
|
7
|
+
= partial '<%= @orm.name_plural %>/form', locals: { f: f }
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
<%= @app_name %>::<%= @admin_name %>.controllers :<%= @orm.name_plural %> do
|
|
2
2
|
get :index do
|
|
3
|
-
@title =
|
|
3
|
+
@title = '<%= @orm.name_plural.capitalize %>'
|
|
4
4
|
@<%= @orm.name_plural %> = <%= @orm.all %>
|
|
5
5
|
render '<%= @orm.name_plural %>/index'
|
|
6
6
|
end
|
|
7
7
|
|
|
8
8
|
get :new do
|
|
9
|
-
@title = pat(:new_title, :
|
|
9
|
+
@title = pat(:new_title, model: '<%= @orm.name_singular %>')
|
|
10
10
|
@<%= @orm.name_singular %> = <%= @orm.build %>
|
|
11
11
|
render '<%= @orm.name_plural %>/new'
|
|
12
12
|
end
|
|
@@ -14,78 +14,78 @@
|
|
|
14
14
|
post :create do
|
|
15
15
|
@<%= @orm.name_singular %> = <%= @orm.build("params[:#{@orm.name_param}]") %>
|
|
16
16
|
if <%= @orm.save %>
|
|
17
|
-
@title = pat(:create_title, :
|
|
18
|
-
flash[:success] = pat(:create_success, :
|
|
19
|
-
params[:save_and_continue] ? redirect(url(:<%= @orm.name_plural %>, :index)) : redirect(url(:<%= @orm.name_plural %>, :edit, :
|
|
17
|
+
@title = pat(:create_title, model: "<%= @orm.name_singular %> #{@<%= @orm.name_singular %>.id}")
|
|
18
|
+
flash[:success] = pat(:create_success, model: '<%= @orm.klass_name %>')
|
|
19
|
+
params[:save_and_continue] ? redirect(url(:<%= @orm.name_plural %>, :index)) : redirect(url(:<%= @orm.name_plural %>, :edit, id: @<%= @orm.name_singular %>.id))
|
|
20
20
|
else
|
|
21
|
-
@title = pat(:create_title, :
|
|
22
|
-
flash.now[:error] = pat(:create_error, :
|
|
21
|
+
@title = pat(:create_title, model: '<%= @orm.name_singular %>')
|
|
22
|
+
flash.now[:error] = pat(:create_error, model: '<%= @orm.name_singular %>')
|
|
23
23
|
render '<%= @orm.name_plural %>/new'
|
|
24
24
|
end
|
|
25
25
|
end
|
|
26
26
|
|
|
27
|
-
get :edit, :
|
|
28
|
-
@title = pat(:edit_title, :
|
|
27
|
+
get :edit, with: :id do
|
|
28
|
+
@title = pat(:edit_title, model: "<%= @orm.name_singular %> #{params[:id]}")
|
|
29
29
|
@<%= @orm.name_singular %> = <%= @orm.find("params[:id]") %>
|
|
30
30
|
if @<%= @orm.name_singular %>
|
|
31
31
|
render '<%= @orm.name_plural %>/edit'
|
|
32
32
|
else
|
|
33
|
-
flash[:warning] = pat(:create_error, :
|
|
33
|
+
flash[:warning] = pat(:create_error, model: '<%= @orm.name_singular %>', id: params[:id])
|
|
34
34
|
halt 404
|
|
35
35
|
end
|
|
36
36
|
end
|
|
37
37
|
|
|
38
|
-
put :update, :
|
|
39
|
-
@title = pat(:update_title, :
|
|
38
|
+
put :update, with: :id do
|
|
39
|
+
@title = pat(:update_title, model: "<%= @orm.name_singular %> #{params[:id]}")
|
|
40
40
|
@<%= @orm.name_singular %> = <%= @orm.find("params[:id]") %>
|
|
41
41
|
if @<%= @orm.name_singular %>
|
|
42
42
|
if <%= @orm.update_attributes("params[:#{@orm.name_param}]") %>
|
|
43
|
-
flash[:success] = pat(:update_success, :
|
|
43
|
+
flash[:success] = pat(:update_success, model: '<%= @orm.name_singular.capitalize %>', id: params[:id])
|
|
44
44
|
params[:save_and_continue] ?
|
|
45
45
|
redirect(url(:<%= @orm.name_plural %>, :index)) :
|
|
46
|
-
redirect(url(:<%= @orm.name_plural %>, :edit, :
|
|
46
|
+
redirect(url(:<%= @orm.name_plural %>, :edit, id: @<%= @orm.name_singular %>.id))
|
|
47
47
|
else
|
|
48
|
-
flash.now[:error] = pat(:update_error, :
|
|
48
|
+
flash.now[:error] = pat(:update_error, model: '<%= @orm.name_singular %>')
|
|
49
49
|
render '<%= @orm.name_plural %>/edit'
|
|
50
50
|
end
|
|
51
51
|
else
|
|
52
|
-
flash[:warning] = pat(:update_warning, :
|
|
52
|
+
flash[:warning] = pat(:update_warning, model: '<%= @orm.name_singular %>', id: params[:id])
|
|
53
53
|
halt 404
|
|
54
54
|
end
|
|
55
55
|
end
|
|
56
56
|
|
|
57
|
-
delete :destroy, :
|
|
58
|
-
@title =
|
|
57
|
+
delete :destroy, with: :id do
|
|
58
|
+
@title = '<%= @orm.name_plural.capitalize %>'
|
|
59
59
|
<%= @orm.name_singular %> = <%= @orm.find("params[:id]") %>
|
|
60
60
|
if <%= @orm.name_singular %>
|
|
61
61
|
if <%= @orm.destroy %>
|
|
62
|
-
flash[:success] = pat(:delete_success, :
|
|
62
|
+
flash[:success] = pat(:delete_success, model: '<%= @orm.name_singular.capitalize %>', id: params[:id])
|
|
63
63
|
else
|
|
64
|
-
flash[:error] = pat(:delete_error, :
|
|
64
|
+
flash[:error] = pat(:delete_error, model: '<%= @orm.name_singular %>')
|
|
65
65
|
end
|
|
66
66
|
redirect url(:<%= @orm.name_plural %>, :index)
|
|
67
67
|
else
|
|
68
|
-
flash[:warning] = pat(:delete_warning, :
|
|
68
|
+
flash[:warning] = pat(:delete_warning, model: '<%= @orm.name_singular %>', id: params[:id])
|
|
69
69
|
halt 404
|
|
70
70
|
end
|
|
71
71
|
end
|
|
72
72
|
|
|
73
73
|
delete :destroy_many do
|
|
74
|
-
@title =
|
|
74
|
+
@title = '<%= @orm.name_plural.capitalize %>'
|
|
75
75
|
unless params[:<%= @orm.name_singular %>_ids]
|
|
76
|
-
flash[:error] = pat(:destroy_many_error, :
|
|
76
|
+
flash[:error] = pat(:destroy_many_error, model: '<%= @orm.name_singular %>')
|
|
77
77
|
redirect(url(:<%= @orm.name_plural %>, :index))
|
|
78
78
|
end
|
|
79
79
|
ids = params[:<%= @orm.name_param %>_ids].split(',').map(&:strip)
|
|
80
80
|
<%= @orm.name_plural %> = <%= @orm.find_by_ids("ids") %>
|
|
81
81
|
<% if @orm.name_singular == @admin_model %>
|
|
82
82
|
if <%= @orm.name_plural %>.include? current_account
|
|
83
|
-
flash[:error] = pat(:delete_error, :
|
|
83
|
+
flash[:error] = pat(:delete_error, model: '<%= @orm.name_singular %>')
|
|
84
84
|
elsif <%= @orm.multiple_destroy(@orm.name_plural) %>
|
|
85
85
|
<% else %>
|
|
86
86
|
if <%= @orm.multiple_destroy(@orm.name_plural) %>
|
|
87
87
|
<% end %>
|
|
88
|
-
flash[:success] = pat(:destroy_many_success, :
|
|
88
|
+
flash[:success] = pat(:destroy_many_success, model: '<%= @orm.name_plural.capitalize %>', ids: ids.join(', '))
|
|
89
89
|
end
|
|
90
90
|
redirect url(:<%= @orm.name_plural %>, :index)
|
|
91
91
|
end
|