padrino-admin 0.10.7 → 0.11.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (164) hide show
  1. checksums.yaml +7 -0
  2. data/Rakefile +22 -1
  3. data/lib/padrino-admin.rb +8 -1
  4. data/lib/padrino-admin/access_control.rb +6 -4
  5. data/lib/padrino-admin/bootstrap-less/accordion.less +34 -0
  6. data/lib/padrino-admin/bootstrap-less/alerts.less +98 -0
  7. data/lib/padrino-admin/bootstrap-less/badges.less +58 -0
  8. data/lib/padrino-admin/bootstrap-less/bootstrap.less +62 -0
  9. data/lib/padrino-admin/bootstrap-less/breadcrumbs.less +25 -0
  10. data/lib/padrino-admin/bootstrap-less/button-groups.less +166 -0
  11. data/lib/padrino-admin/bootstrap-less/buttons.less +175 -0
  12. data/lib/padrino-admin/bootstrap-less/carousel.less +192 -0
  13. data/lib/padrino-admin/bootstrap-less/close.less +32 -0
  14. data/lib/padrino-admin/bootstrap-less/code.less +61 -0
  15. data/lib/padrino-admin/bootstrap-less/component-animations.less +32 -0
  16. data/lib/padrino-admin/bootstrap-less/dropdowns.less +223 -0
  17. data/lib/padrino-admin/bootstrap-less/font-awesome-ie7.less +350 -0
  18. data/lib/padrino-admin/bootstrap-less/font-awesome.less +537 -0
  19. data/lib/padrino-admin/bootstrap-less/forms.less +543 -0
  20. data/lib/padrino-admin/bootstrap-less/glyphicons.less +200 -0
  21. data/lib/padrino-admin/bootstrap-less/grid.less +49 -0
  22. data/lib/padrino-admin/bootstrap-less/jumbotron.less +32 -0
  23. data/lib/padrino-admin/bootstrap-less/labels.less +46 -0
  24. data/lib/padrino-admin/bootstrap-less/media.less +54 -0
  25. data/lib/padrino-admin/bootstrap-less/mixins.less +530 -0
  26. data/lib/padrino-admin/bootstrap-less/modals.less +136 -0
  27. data/lib/padrino-admin/bootstrap-less/navbar.less +379 -0
  28. data/lib/padrino-admin/bootstrap-less/navs.less +277 -0
  29. data/lib/padrino-admin/bootstrap-less/normalize.less +396 -0
  30. data/lib/padrino-admin/bootstrap-less/padrino-admin.less +16 -0
  31. data/lib/padrino-admin/bootstrap-less/pager.less +43 -0
  32. data/lib/padrino-admin/bootstrap-less/pagination.less +100 -0
  33. data/lib/padrino-admin/bootstrap-less/popovers.less +133 -0
  34. data/lib/padrino-admin/bootstrap-less/print.less +74 -0
  35. data/lib/padrino-admin/bootstrap-less/progress-bars.less +118 -0
  36. data/lib/padrino-admin/bootstrap-less/responsive-utilities.less +59 -0
  37. data/lib/padrino-admin/bootstrap-less/scaffolding.less +90 -0
  38. data/lib/padrino-admin/bootstrap-less/tables.less +231 -0
  39. data/lib/padrino-admin/bootstrap-less/thumbnails.less +42 -0
  40. data/lib/padrino-admin/bootstrap-less/tooltip.less +71 -0
  41. data/lib/padrino-admin/bootstrap-less/type.less +252 -0
  42. data/lib/padrino-admin/bootstrap-less/utilities.less +42 -0
  43. data/lib/padrino-admin/bootstrap-less/variables.less +316 -0
  44. data/lib/padrino-admin/bootstrap-less/wells.less +29 -0
  45. data/lib/padrino-admin/generators/actions.rb +18 -2
  46. data/lib/padrino-admin/generators/admin_app.rb +38 -26
  47. data/lib/padrino-admin/generators/admin_page.rb +8 -1
  48. data/lib/padrino-admin/generators/orm.rb +58 -11
  49. data/lib/padrino-admin/generators/templates/account/couchrest.rb.tt +1 -1
  50. data/lib/padrino-admin/generators/templates/account/{mini_record.rb.tt → minirecord.rb.tt} +0 -0
  51. data/lib/padrino-admin/generators/templates/account/mongoid.rb.tt +1 -1
  52. data/lib/padrino-admin/generators/templates/account/ohm.rb.tt +61 -0
  53. data/lib/padrino-admin/generators/templates/account/sequel.rb.tt +1 -1
  54. data/lib/padrino-admin/generators/templates/app.rb.tt +36 -29
  55. data/lib/padrino-admin/generators/templates/app/controllers/{base.rb → base.rb.tt} +1 -2
  56. data/lib/padrino-admin/generators/templates/app/controllers/sessions.rb.tt +6 -3
  57. data/lib/padrino-admin/generators/templates/assets/images/favicon.ico +0 -0
  58. data/lib/padrino-admin/generators/templates/assets/images/font/FontAwesome.otf +0 -0
  59. data/lib/padrino-admin/generators/templates/assets/images/font/fontawesome-webfont.eot +0 -0
  60. data/lib/padrino-admin/generators/templates/assets/images/font/fontawesome-webfont.svg +284 -0
  61. data/lib/padrino-admin/generators/templates/assets/images/font/fontawesome-webfont.ttf +0 -0
  62. data/lib/padrino-admin/generators/templates/assets/images/font/fontawesome-webfont.woff +0 -0
  63. data/lib/padrino-admin/generators/templates/assets/images/logo.png +0 -0
  64. data/lib/padrino-admin/generators/templates/assets/javascripts/application.js +117 -0
  65. data/lib/padrino-admin/generators/templates/assets/javascripts/bootstrap/bootstrap-affix.js +117 -0
  66. data/lib/padrino-admin/generators/templates/assets/javascripts/bootstrap/bootstrap-alert.js +99 -0
  67. data/lib/padrino-admin/generators/templates/assets/javascripts/bootstrap/bootstrap-button.js +105 -0
  68. data/lib/padrino-admin/generators/templates/assets/javascripts/bootstrap/bootstrap-carousel.js +207 -0
  69. data/lib/padrino-admin/generators/templates/assets/javascripts/bootstrap/bootstrap-collapse.js +167 -0
  70. data/lib/padrino-admin/generators/templates/assets/javascripts/bootstrap/bootstrap-dropdown.js +165 -0
  71. data/lib/padrino-admin/generators/templates/assets/javascripts/bootstrap/bootstrap-modal.js +251 -0
  72. data/lib/padrino-admin/generators/templates/assets/javascripts/bootstrap/bootstrap-popover.js +114 -0
  73. data/lib/padrino-admin/generators/templates/assets/javascripts/bootstrap/bootstrap-scrollspy.js +162 -0
  74. data/lib/padrino-admin/generators/templates/assets/javascripts/bootstrap/bootstrap-tab.js +144 -0
  75. data/lib/padrino-admin/generators/templates/assets/javascripts/bootstrap/bootstrap-tooltip.js +361 -0
  76. data/lib/padrino-admin/generators/templates/assets/javascripts/bootstrap/bootstrap-transition.js +60 -0
  77. data/lib/padrino-admin/generators/templates/assets/javascripts/bootstrap/bootstrap-typeahead.js +335 -0
  78. data/lib/padrino-admin/generators/templates/assets/javascripts/bootstrap/bootstrap.min.js +6 -0
  79. data/lib/padrino-admin/generators/templates/assets/javascripts/jquery-1.9.0.min.js +4 -0
  80. data/lib/padrino-admin/generators/templates/assets/stylesheets/application.css +346 -0
  81. data/lib/padrino-admin/generators/templates/assets/stylesheets/bootstrap.css +952 -0
  82. data/lib/padrino-admin/generators/templates/erb/app/base/index.erb.tt +13 -15
  83. data/lib/padrino-admin/generators/templates/erb/app/errors/403.erb.tt +3 -0
  84. data/lib/padrino-admin/generators/templates/erb/app/errors/404.erb.tt +3 -0
  85. data/lib/padrino-admin/generators/templates/erb/app/errors/500.erb.tt +3 -0
  86. data/lib/padrino-admin/generators/templates/erb/app/layouts/application.erb.tt +59 -39
  87. data/lib/padrino-admin/generators/templates/erb/app/layouts/error.erb.tt +23 -0
  88. data/lib/padrino-admin/generators/templates/erb/app/sessions/new.erb.tt +41 -53
  89. data/lib/padrino-admin/generators/templates/erb/page/_form.erb.tt +16 -9
  90. data/lib/padrino-admin/generators/templates/erb/page/edit.erb.tt +9 -17
  91. data/lib/padrino-admin/generators/templates/erb/page/index.erb.tt +73 -31
  92. data/lib/padrino-admin/generators/templates/erb/page/new.erb.tt +8 -16
  93. data/lib/padrino-admin/generators/templates/haml/app/base/index.haml.tt +11 -24
  94. data/lib/padrino-admin/generators/templates/haml/app/errors/403.haml.tt +3 -0
  95. data/lib/padrino-admin/generators/templates/haml/app/errors/404.haml.tt +3 -0
  96. data/lib/padrino-admin/generators/templates/haml/app/errors/500.haml.tt +3 -0
  97. data/lib/padrino-admin/generators/templates/haml/app/layouts/application.haml.tt +47 -29
  98. data/lib/padrino-admin/generators/templates/haml/app/layouts/error.haml.tt +18 -0
  99. data/lib/padrino-admin/generators/templates/haml/app/sessions/new.haml.tt +33 -28
  100. data/lib/padrino-admin/generators/templates/haml/page/_form.haml.tt +13 -9
  101. data/lib/padrino-admin/generators/templates/haml/page/edit.haml.tt +7 -14
  102. data/lib/padrino-admin/generators/templates/haml/page/index.haml.tt +56 -27
  103. data/lib/padrino-admin/generators/templates/haml/page/new.haml.tt +6 -13
  104. data/lib/padrino-admin/generators/templates/page/controller.rb.tt +57 -12
  105. data/lib/padrino-admin/generators/templates/slim/app/base/index.slim.tt +11 -24
  106. data/lib/padrino-admin/generators/templates/slim/app/errors/403.slim.tt +3 -0
  107. data/lib/padrino-admin/generators/templates/slim/app/errors/404.slim.tt +3 -0
  108. data/lib/padrino-admin/generators/templates/slim/app/errors/500.slim.tt +3 -0
  109. data/lib/padrino-admin/generators/templates/slim/app/layouts/application.slim.tt +43 -26
  110. data/lib/padrino-admin/generators/templates/slim/app/layouts/error.slim.tt +19 -0
  111. data/lib/padrino-admin/generators/templates/slim/app/sessions/new.slim.tt +31 -27
  112. data/lib/padrino-admin/generators/templates/slim/page/_form.slim.tt +13 -11
  113. data/lib/padrino-admin/generators/templates/slim/page/edit.slim.tt +7 -15
  114. data/lib/padrino-admin/generators/templates/slim/page/index.slim.tt +54 -28
  115. data/lib/padrino-admin/generators/templates/slim/page/new.slim.tt +6 -14
  116. data/lib/padrino-admin/helpers/authentication_helpers.rb +6 -4
  117. data/lib/padrino-admin/helpers/view_helpers.rb +27 -5
  118. data/lib/padrino-admin/locale/admin/cs.yml +53 -13
  119. data/lib/padrino-admin/locale/admin/da.yml +53 -13
  120. data/lib/padrino-admin/locale/admin/de.yml +53 -13
  121. data/lib/padrino-admin/locale/admin/en.yml +53 -13
  122. data/lib/padrino-admin/locale/admin/es.yml +53 -13
  123. data/lib/padrino-admin/locale/admin/fr.yml +53 -13
  124. data/lib/padrino-admin/locale/admin/hu.yml +53 -13
  125. data/lib/padrino-admin/locale/admin/it.yml +53 -13
  126. data/lib/padrino-admin/locale/admin/ja.yml +54 -13
  127. data/lib/padrino-admin/locale/admin/lv.yml +53 -13
  128. data/lib/padrino-admin/locale/admin/nl.yml +53 -13
  129. data/lib/padrino-admin/locale/admin/no.yml +53 -13
  130. data/lib/padrino-admin/locale/admin/pl.yml +53 -13
  131. data/lib/padrino-admin/locale/admin/pt_br.yml +53 -13
  132. data/lib/padrino-admin/locale/admin/ro.yml +53 -13
  133. data/lib/padrino-admin/locale/admin/ru.yml +54 -13
  134. data/lib/padrino-admin/locale/admin/sv.yml +53 -13
  135. data/lib/padrino-admin/locale/admin/tr.yml +53 -13
  136. data/lib/padrino-admin/locale/admin/uk.yml +53 -13
  137. data/lib/padrino-admin/locale/admin/zh_cn.yml +53 -13
  138. data/lib/padrino-admin/locale/admin/zh_tw.yml +53 -13
  139. data/lib/padrino-admin/locale/orm/fr.yml +8 -8
  140. data/padrino-admin.gemspec +2 -0
  141. data/test/fixtures/data_mapper.rb +0 -4
  142. data/test/generators/test_account_model_generator.rb +88 -18
  143. data/test/generators/test_admin_app_generator.rb +120 -165
  144. data/test/generators/test_admin_page_generator.rb +53 -56
  145. data/test/helper.rb +4 -0
  146. data/test/test_admin_application.rb +5 -5
  147. data/test/test_locale.rb +3 -3
  148. metadata +119 -35
  149. data/lib/padrino-admin/generators/templates/assets/stylesheets/base.css +0 -95
  150. data/lib/padrino-admin/generators/templates/assets/stylesheets/themes/amro/style.css +0 -364
  151. data/lib/padrino-admin/generators/templates/assets/stylesheets/themes/bec-green/style.css +0 -290
  152. data/lib/padrino-admin/generators/templates/assets/stylesheets/themes/bec/style.css +0 -301
  153. data/lib/padrino-admin/generators/templates/assets/stylesheets/themes/blue/style.css +0 -287
  154. data/lib/padrino-admin/generators/templates/assets/stylesheets/themes/default/style.css +0 -373
  155. data/lib/padrino-admin/generators/templates/assets/stylesheets/themes/djime-cerulean/style.css +0 -305
  156. data/lib/padrino-admin/generators/templates/assets/stylesheets/themes/kathleene/style.css +0 -279
  157. data/lib/padrino-admin/generators/templates/assets/stylesheets/themes/olive/style.css +0 -345
  158. data/lib/padrino-admin/generators/templates/assets/stylesheets/themes/orange/style.css +0 -269
  159. data/lib/padrino-admin/generators/templates/assets/stylesheets/themes/reidb-greenish/style.css +0 -302
  160. data/lib/padrino-admin/generators/templates/assets/stylesheets/themes/ruby/style.css +0 -281
  161. data/lib/padrino-admin/generators/templates/assets/stylesheets/themes/warehouse/style.css +0 -391
  162. data/lib/padrino-admin/generators/templates/erb/app/base/_sidebar.erb.tt +0 -13
  163. data/lib/padrino-admin/generators/templates/haml/app/base/_sidebar.haml.tt +0 -11
  164. data/lib/padrino-admin/generators/templates/slim/app/base/_sidebar.slim.tt +0 -11
@@ -1,25 +1,12 @@
1
- #block-text.block
2
- .content
3
- h2.title Dashboard
4
- .inner
5
- p.first
6
- ' Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.
7
- ' Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat.
8
- ' Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur.
9
- span.hightlight
10
- | Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.
11
- p
12
- span.small
13
- | Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore
14
- p
15
- span.gray
16
- | Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore
17
- hr
18
- p
19
- ' Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.
20
- ' Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat.
21
- ' Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur.
22
- span.hightlight
23
- | Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.
1
+ div class="base-text"
2
+ p Padrino is a ruby framework built upon the Sinatra web library
3
+ p It was created to make it fun and easy to code more advanced web applications while still adhering to the spirit that makes Sinatra great!
4
+ p Padrino comes shipped with a slick and beautiful Admin Interface, with the following features:
24
5
 
25
- - content_for :sidebar, partial("base/sidebar")
6
+ div class="base-icons"
7
+ div class="btn-group"
8
+ div class="btn btn-primary" title="Adapters for datamapper, sequel, activerecord, mongomapper, mongoid, couchrest" = tag_icon("cogs icon-2x", "Orm Agnostic")
9
+ div class="btn btn-success" title="User Authentication Support, User Authorization Management" = tag_icon("group icon-2x", "Authentication")
10
+ div class="btn btn-info" title="Erb, Haml, Slim Rendering Support" = tag_icon("tasks icon-2x", "Template Agnostic")
11
+ div class="btn btn-warning" title="English, German, Russian, Danish, French, Brazilian and Italian localizations" = tag_icon("flag icon-2x", "Multi Language")
12
+ div class="btn btn-danger" title="You can create a new 'admin interface' by providing a single Model" = tag_icon("magic icon-2x", "Scaffold")
@@ -0,0 +1,3 @@
1
+ p = tag_icon 'minus-sign icon-3x'
2
+ h1 = pat('custom_errors.403.title')
3
+ p = pat('custom_errors.403.description')
@@ -0,0 +1,3 @@
1
+ p= tag_icon 'warning-sign icon-3x'
2
+ h1= pat('custom_errors.404.title')
3
+ p= pat('custom_errors.404.description')
@@ -0,0 +1,3 @@
1
+ p = tag_icon 'beaker icon-3x'
2
+ h1 = pat('custom_errors.500.title')
3
+ p = pat('custom_errors.500.description')
@@ -1,31 +1,48 @@
1
- doctype html
2
- html lang='en' xmlns='http://www.w3.org/1999/xhtml'
1
+ doctype 5
2
+ html lang='en'
3
3
  head
4
+ <!-- Le HTML5 shim, for IE6-8 support of HTML elements -->
5
+ <!--[if lt IE 9]>
6
+ <script src="http://html5shim.googlecode.com/svn/trunk/html5.js"></script>
7
+ <![endif]-->
4
8
  meta content='text/html; charset=utf-8' http-equiv='Content-Type'
5
- title Padrino Admin
6
- == stylesheet_link_tag 'base', 'themes/<%= options[:theme] %>/style'
9
+ meta name='viewport' content='width=device-width,initial-scale=1'
10
+ title = @title.present? ? "#{@title} | Padrino Admin" : "Padrino Admin"
11
+ = favicon_tag 'favicon.ico'
12
+ link href='http://fonts.googleapis.com/css?family=Varela' rel='stylesheet'
13
+ = stylesheet_link_tag 'bootstrap', 'application'
7
14
 
8
15
  body
9
- #container
10
- #header
11
- h1 == link_to 'Padrino Admin', url(:base_index)
12
- #user-navigation
13
- ul.wat-cf
14
- li == link_to pat(:profile), url(:<%= @model_plural %>, :edit, :id => current_account.id)
15
- li == button_to pat(:logout), url(:sessions, :destroy), :method => :delete, :class => :button_to
16
- #main-navigation
17
- ul.wat-cf
16
+ div class='navbar navbar-fixed-top'
17
+ div class='navbar-inner'
18
+ div class='container'
19
+ = link_to 'Padrino', url(:base_index), :class => 'navbar-brand', :title => 'Padrino Admin'
20
+
21
+ ul class='nav pull-right'
22
+ li class='navbar-edit-account' = link_to tag_icon(:user), url(:<%= @model_plural %>, :edit, :id => current_account.id), :title => pat(:profile), :class => 'navbar-nav-link'
23
+ li class='navbar-logout' = button_to(pat(:logout), url(:sessions, :destroy), :method => :delete, :class => 'navbar-nav-form') do
24
+ = content_tag :button, tag_icon(:off), :type => :submit, :title => pat(:logout), :class => 'navbar-nav-form-link'
25
+
26
+ ul class='nav pull-left'
18
27
  - project_modules.each do |project_module|
19
- li class=(:active if request.path_info =~ /^#{project_module.path}/)
20
- == link_to project_module.human_name, project_module.path('/admin')
21
- #wrapper.wat-cf
22
- .flash == [:error, :warning, :notice].map { |type| flash_tag(type, :class => "message #{type}") }.join
23
- #main
24
- == yield
25
- #footer
26
- .block
27
- p
28
- ' Copyright &copy; #{Time.now.year} Your Site - Powered by
29
- == link_to "Padrino v.#{Padrino.version}", 'http://www.padrinorb.com', :target => :_blank
30
- #sidebar
31
- == yield_content :sidebar
28
+ li class={"navbar-module #{'active' if request.path_info =~ /^#{project_module.path}/}"}
29
+ = link_to project_module.human_name, project_module.path('/admin')
30
+
31
+ div class='container main'
32
+ div class='main-wrapper'
33
+ = [:error, :warning, :success, :notice].map { |type| flash_tag(type, :class => "alert alert-#{type} fade in", :bootstrap => true) }.join.html_safe
34
+ div class='row' = yield
35
+ div class='main-wrapper-push'
36
+
37
+ footer
38
+ div class='footer-wrapper container'
39
+ p class='pull-left'
40
+ ' Copyright &copy; #{Time.now.year} Your Site -
41
+ b Powered by Padrino v.#{Padrino.version}
42
+ ul class='pull-right footer-links'
43
+ li = link_to tag_icon(:home, 'web'), 'http://www.padrinorb.com', :target => :_blank, :class => 'footer-links-link'
44
+ li = link_to tag_icon(:heart, 'blog'), 'http://www.padrinorb.com/blog', :target => :_blank, :class => 'footer-links-link'
45
+ li = link_to tag_icon(:github, 'code'), 'https://github.com/padrino/padrino-framework', :target => :_blank, :class => 'footer-links-link'
46
+ li = link_to tag_icon(:twitter, 'twitter'), 'http://twitter.com/padrinorb', :target => :_blank, :class => 'footer-links-link'
47
+
48
+ =javascript_include_tag 'jquery-1.9.0.min', (Padrino.env == :production ? 'bootstrap.min' : %w[bootstrap/bootstrap-affix bootstrap/bootstrap-alert bootstrap/bootstrap-button bootstrap/bootstrap-carousel bootstrap/bootstrap-collapse bootstrap/bootstrap-dropdown bootstrap/bootstrap-tooltip bootstrap/bootstrap-transition bootstrap/bootstrap-typeahead bootstrap/bootstrap-modal bootstrap/bootstrap-popover bootstrap/bootstrap-scrollspy bootstrap/bootstrap-tab]), :application
@@ -0,0 +1,19 @@
1
+ doctype 5
2
+ html lang="en" xmlns="http://www.w3.org/1999/xhtml"
3
+ head
4
+ <!-- Le HTML5 shim, for IE6-8 support of HTML elements -->
5
+ <!--[if lt IE 9]>
6
+ <script src="http://html5shim.googlecode.com/svn/trunk/html5.js"></script>
7
+ <![endif]-->
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" : "#{pat(:custom_errors.title)} | Padrino Admin"
11
+ = favicon_tag 'favicon.ico'
12
+ link href='http://fonts.googleapis.com/css?family=Varela' rel='stylesheet'
13
+ = stylesheet_link_tag 'bootstrap', 'application'
14
+
15
+ body
16
+ div class="custom-error text-center"
17
+ div class="custom-error-body muted" = yield
18
+ div class="custom-error-footer"
19
+ = link_to tag_icon('arrow-left'),"#", :onclick => "history.go(-1);return false;", :class =>"custom-error-go-back btn pull-left", :title => "Go Back"
@@ -1,31 +1,35 @@
1
- doctype html
2
- html lang='en' xmlns='http://www.w3.org/1999/xhtml'
1
+ doctype 5
2
+ html lang="en" xmlns="http://www.w3.org/1999/xhtml"
3
3
  head
4
+ <!-- Le HTML5 shim, for IE6-8 support of HTML elements -->
5
+ <!--[if lt IE 9]>
6
+ <script src="http://html5shim.googlecode.com/svn/trunk/html5.js"></script>
7
+ <![endif]-->
4
8
  meta content='text/html; charset=utf-8' http-equiv='Content-Type'
5
- title Padrino Admin
6
- == stylesheet_link_tag 'base', 'themes/<%= options[:theme] %>/style'
9
+ meta name='viewport' content='width=device-width,initial-scale=1'
10
+ title = @title.present? ? "#{@title} | Padrino Admin" : "#{pat('login.title')} | Padrino Admin"
11
+ = favicon_tag 'favicon.ico'
12
+ = stylesheet_link_tag 'bootstrap', 'application'
7
13
 
8
14
  body
9
- #container
10
- #box
11
- h1 Padrino Admin
12
- #block-login.block
13
- h2 Login Box
14
- .content.login
15
- .flash == [:error, :warning, :notice].map { |type| flash_tag(type, :class => "message #{type}") }.join
16
- - form_tag url(:sessions, :create), :class => 'form login' do
17
- .group.wat-cf
18
- .left
19
- label.label.right Login
20
- .right == text_field_tag :email, :value => params[:email], :class => :text_field
21
- .group.wat-cf
22
- .left
23
- label.label.right Password
24
- .right == password_field_tag :password, :value => params[:password], :class => :text_field
25
- - if Padrino.env == :development
26
- .group.wat-cf
27
- .left
28
- label.label.right Bypass login?
29
- .right == check_box_tag :bypass
30
- .group.navform.wat-cf
31
- .right == submit_tag 'Sign In', :class => :button
15
+ - form_tag url(:sessions, :create), :class=>'login form-horizontal' do
16
+ div class="login-header modal-header"
17
+ div class="login-logo" = image_tag('logo.png', :alt => "Padrino's logo", :height => 250, :width => 193)
18
+ div class="login-body modal-body"
19
+ = [:error, :warning, :notice].map { |type| flash_tag(type, :class => "alert alert-#{type} fade in", :bootstrap => true) }.join.html_safe
20
+
21
+ fieldset class='control-group'
22
+ label for="email" class='login-input-label control-label' = pat('login.email')
23
+ div class='login-controls controls' = email_field_tag :email, :value => params[:email], :autofocus => true
24
+ fieldset class='control-group'
25
+ label for='password' class='login-input-label control-label' = pat('login.password')
26
+ div class='login-controls controls' = password_field_tag :password, :value => params[:password]
27
+ fieldset class='login-control-group-last control-group'
28
+ div class='login-controls controls'
29
+ label class="login-bypass-label checkbox"
30
+ = check_box_tag :bypass
31
+ | #{pat('login.bypass')}
32
+
33
+ div class="login-footer modal-footer"
34
+ = submit_tag(pat('login.sign_in'), :class => 'btn btn-primary pull-right')
35
+ = javascript_include_tag 'jquery-1.9.0.min', (Padrino.env == :production ? 'bootstrap.min' : %w[bootstrap/bootstrap-affix bootstrap/bootstrap-alert bootstrap/bootstrap-button bootstrap/bootstrap-carousel bootstrap/bootstrap-collapse bootstrap/bootstrap-dropdown bootstrap/bootstrap-tooltip bootstrap/bootstrap-transition bootstrap/bootstrap-typeahead bootstrap/bootstrap-modal bootstrap/bootstrap-popover bootstrap/bootstrap-scrollspy bootstrap/bootstrap-tab]), :application
@@ -1,14 +1,16 @@
1
- <%- @orm.column_fields.each do |column| -%>
2
- .group
3
- == f.label :<%= column[:name] %>
4
- == f.error_message_on :<%= column[:name] %>
5
- == f.<%= column[:field_type] %> :<%= column[:name] %>, :class => :<%= column[:field_type] %>
6
- br
7
- span.description Ex: a simple text
1
+ <%- @orm.column_fields.each_with_index do |column, index| -%>
2
+ - error = <%= @orm.has_error(column[:name]) %>
3
+ fieldset class='control-group#{error ? ' has-error' : ''}'
4
+ = f.label :<%= column[:name] %>, :class => 'control-label'
5
+ div class='controls'
6
+ = f.<%= column[:field_type] %> :<%= column[:name] %>, :class => 'input-xlarge input-with-feedback'<%- if (index == 0) -%>, :autofocus => true<%- end -%>
8
7
 
8
+ span class='help-inline' = error ? f.error_message_on(:<%= column[:name] %>, :class => 'text-error') : pat(:example)
9
9
  <%- end -%>
10
10
 
11
- .group.navform.wat-cf
12
- == f.submit pat(:save), :class => :button
13
- == "&nbsp;"
14
- == f.submit pat(:cancel), :onclick => "window.location='#{url(:<%= @orm.name_plural %>, :index)}';return false", :class => :button
11
+ div class="form-actions"
12
+ = f.submit pat(:save), :class => 'btn btn-primary'
13
+ |&nbsp;
14
+ = f.submit pat(:save_and_continue), :class => 'btn btn-info', :name => 'save_and_continue'
15
+ |&nbsp;
16
+ = link_to pat(:cancel), url(:<%= @orm.name_plural %>, :index), :class => 'btn'
@@ -1,16 +1,8 @@
1
- .block
2
- .secondary-navigation
3
- ul.wat-cf
4
- li.first == link_to pat(:list), url(:<%= @orm.name_plural %>, :index)
5
- li == link_to pat(:new), url(:<%= @orm.name_plural %>, :new)
6
- li.active == link_to pat(:edit), url(:<%= @orm.name_plural %>, :edit, :id => @<%= @orm.name_singular %>.id)
7
- .content
8
- h2.title
9
- = pat(:edit)
10
- == "&nbsp;"
11
- = mt(:<%= @orm.name_singular %>)
12
- .inner
13
- == form_for :<%= @orm.name_singular %>, url(:<%= @orm.name_plural %>, :update, :id => @<%= @orm.name_singular %>.id), :method => :put, :class => :form do |f|
14
- == partial '<%= @orm.name_plural %>/form', :locals => { :f => f }
1
+ ul class="nav nav-tabs"
2
+ li = link_to tag_icon(:list, pat(:list)), url(:<%= @orm.name_plural %>, :index)
3
+ li = link_to tag_icon(:plus, pat(:new)), url(:<%= @orm.name_plural %>, :new)
4
+ li class="active" = link_to tag_icon(:edit, pat(:edit)), url(:<%= @orm.name_plural %>, :edit, :id => @<%= @orm.name_singular %>.id)
15
5
 
16
- - content_for :sidebar, partial("base/sidebar")
6
+ div class="tabs-content"
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 }
@@ -1,30 +1,56 @@
1
- .block
2
- .secondary-navigation
3
- ul.wat-cf
4
- li.first.active == link_to pat(:list), url(:<%= @orm.name_plural %>, :index)
5
- li == link_to pat(:new), url(:<%= @orm.name_plural %>, :new)
6
- .content
7
- h2.title
8
- == pat(:all)
9
- == '&nbsp;'
10
- == mt(:<%= @orm.name_plural %>)
11
- .inner
12
- table.table
13
- tr
1
+ ul class="nav nav-tabs"
2
+ li class="active" = link_to tag_icon(:list, pat(:list)), url(:<%= @orm.name_plural %>, :index)
3
+ li = link_to tag_icon(:plus, pat(:new)), url(:<%= @orm.name_plural %>, :new)
4
+
5
+ div class="tabs-content"
6
+ table class="table table-striped table-hover table-condensed" id="list"
7
+ thead
8
+ tr
9
+ th class='header list-menu'
10
+ div class='dropdown'
11
+ a href='#' class='list-menu-toggle.dropdown-toggle dropdown-toggle' data-toggle='dropdown'
12
+ = tag_icon :magic
13
+ span class='caret'
14
+ ul class='list-menu dropdown-menu' role='dropdown'
15
+ li class='list-menu-wrapper' = link_to tag_icon(:check, pat(:select_all)), '#', :id => 'select-all', :class => 'list-menu-link'
16
+ li class='list-menu-wrapper list-menu-wrapper-disabled' = link_to tag_icon('check-empty', pat(:deselect_all)), '#', :id => 'deselect-all', :class => 'list-menu-link list-menu-link-disabled'
17
+ li class='list-menu-divider divider'
18
+ li class='list-menu-wrapper list-menu-wrapper-disabled'
19
+ = link_to tag_icon(:trash, pat(:delete_selected)), '#', :id => 'delete-selected', :class => 'list-menu-link list-menu-link-disabled'
20
+ div class='list-menu-popover-delete-selected popover right'
21
+ div class='arrow'
22
+ h3 class='popover-title' = pat(:delete_selected_title)
23
+ div class='popover-content'
24
+ - form_tag url(:<%= @orm.name_plural %>, :destroy_many), :method => :delete do
25
+ = hidden_field_tag :<%= @orm.name_singular %>_ids, :'data-delete-many-ids' => true
26
+ = submit_tag pat(:delete), :class =>'list-menu-popover-delete-selected-btn btn btn-danger btn-small'
27
+ div class='btn btn-small cancel' = pat(:cancel)
28
+ <%- @orm.columns.each_with_index do |column, i| -%>
29
+ th class='header' = :<%= column.name %>
30
+ <%- end -%>
31
+ th class='header list-row-action-header'
32
+
33
+ tbody
34
+ -@<%= @orm.name_plural %>.each do |<%= @orm.name_singular %>|
35
+ tr class='list-row'
36
+ td class='list-column list-selectable' = check_box_tag '<%= @orm.name_singular %>_ids[]', :value => <%= @orm.name_singular %>.id, :class => 'list-selectable-checkbox'
14
37
  <%- @orm.columns.each_with_index do |column, i| -%>
15
- th<%= ".first" if i==0 %>=mat(:<%= @orm.name_singular %>, :<%= column.name %>)
38
+ <%- if column.name == 'created_at' || column.name == 'updated_at' -%>
39
+ td class='list-column' = time_ago_in_words <%= @orm.name_singular %>.<%= column.name %>
40
+ <%- elsif column.type == :boolean -%>
41
+ td class='list-column' = <%= @orm.name_singular %>.<%= column.name %> ? tag_icon(:ok) : tag_icon(:remove)
42
+ <%- else -%>
43
+ td class='list-column' = <%= @orm.name_singular %>.<%= column.name %>
16
44
  <%- end -%>
17
- th.last == '&nbsp;'
18
- - @<%= @orm.name_plural %>.each do |<%= @orm.name_singular %>|
19
- tr
20
- <%- @orm.columns.each_with_index do |column, i| -%>
21
- td<%= ".first" if i==0 %>=<%= @orm.name_singular %>.<%= column.name %>
22
- <%- end -%>
23
- td.last
24
- == button_to pat(:edit), url(:<%= @orm.name_plural %>, :edit, :id => <%= @orm.name_singular %>.id), :method => :get, :class => :button_to
25
- == ' | '
26
- == button_to pat(:delete), url(:<%= @orm.name_plural %>, :destroy, :id => <%= @orm.name_singular %>.id), :method => :delete, :class => :button_to, :onsubmit => "return confirm('#{pat(:confirm)}')"
27
- .actions-bar.wat-cf
28
- .actions == '&nbsp;'
29
-
30
- -content_for :sidebar, partial("base/sidebar")
45
+ <%- end -%>
46
+ td class='list-column list-row-action'
47
+ div class='list-row-action-wrapper'
48
+ = 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'
49
+ = link_to tag_icon(:trash), :rel => :tooltip, :title => "#{pat(:delete)} <%= @orm.name_singular %>", :class => 'list-row-action-delete-one list-row-action-wrapper-link'
50
+ div class='popover list-row-action-popover-delete-one left'
51
+ div class='arrow'
52
+ h3 class='popover-title' = pat(:delete, :model => "<%= @orm.name_singular %>")
53
+ div class='popover-content'
54
+ - form_tag url(:<%= @orm.name_plural %>, :destroy, :id => <%= @orm.name_singular %>.id), :method => :delete do
55
+ = submit_tag pat(:delete), :class =>'list-row-action-popover-delete-one-btn btn btn-danger btn-small'
56
+ div class='btn btn-small cancel' = pat(:cancel)
@@ -1,15 +1,7 @@
1
- .block
2
- .secondary-navigation
3
- ul.wat-cf
4
- li.first == link_to pat(:list), url(:<%= @orm.name_plural %>, :index)
5
- li.active == link_to pat(:new), url(:<%= @orm.name_plural %>, :new)
6
- .content
7
- h2.title
8
- = pat(:new)
9
- == '&nbsp;'
10
- = mt(:<%= @orm.name_singular %>)
11
- .inner
12
- - form_for :<%= @orm.name_singular %>, url(:<%= @orm.name_plural %>, :create), :class => :form do |f|
13
- == partial "<%= @orm.name_plural %>/form", :locals => { :f => f }
1
+ ul class="nav nav-tabs"
2
+ li = link_to tag_icon(:list, pat(:list)), url(:<%= @orm.name_plural %>, :index)
3
+ li class="active" = link_to tag_icon(:plus, pat(:new)), url(:<%= @orm.name_plural %>, :new)
14
4
 
15
- - content_for :sidebar, partial("base/sidebar")
5
+ div class="tabs-content"
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 }
@@ -53,15 +53,17 @@ module Padrino
53
53
  # By default this method is used in Admin Apps.
54
54
  #
55
55
  def login_required
56
- store_location! if store_location
57
- return access_denied unless allowed?
56
+ unless allowed?
57
+ store_location! if store_location
58
+ access_denied
59
+ end
58
60
  end
59
61
 
60
62
  ##
61
- # Store in session[:return_to] the env['HTTP_REFERER']
63
+ # Store in session[:return_to] the env['REQUEST_URI']
62
64
  #
63
65
  def store_location!
64
- session[:return_to] = env['HTTP_REFERER']
66
+ session[:return_to] = env['REQUEST_URI']
65
67
  end
66
68
 
67
69
  ##
@@ -5,9 +5,28 @@ module Padrino
5
5
  #
6
6
  module Helpers
7
7
  ##
8
- # i18n translation helpers for admin to retrieve words based on locale.
8
+ # Admin helpers
9
9
  #
10
10
  module ViewHelpers
11
+ ##
12
+ # Icon's Bootstrap helper
13
+ #
14
+ # @param [Symbol] icon
15
+ # The specified icon type
16
+ #
17
+ # @param [Symbol] tag
18
+ # The HTML tag.
19
+ #
20
+ # @return [String] html tag with prepend icon
21
+ #
22
+ # @example
23
+ # tag_icon(:edit, :list)
24
+ #
25
+ def tag_icon(icon, tag = nil)
26
+ content = content_tag(:i, '', :class=> "icon-#{icon.to_s}")
27
+ content << " #{tag.to_s}"
28
+ end
29
+
11
30
  ##
12
31
  # Translates a given word for padrino admin
13
32
  #
@@ -25,8 +44,10 @@ module Padrino
25
44
  # # => t("padrino.admin.profile", :default => "My Profile")
26
45
  # pat(:profile, "My Profile")
27
46
  #
28
- def padrino_admin_translate(word, default=nil)
29
- t("padrino.admin.#{word}", :default => (default || word.to_s.humanize))
47
+ def padrino_admin_translate(word,*args)
48
+ options = args.extract_options!
49
+ options[:default] ||= word.to_s.humanize
50
+ t("padrino.admin.#{word}", options)
30
51
  end
31
52
  alias :pat :padrino_admin_translate
32
53
 
@@ -45,9 +66,10 @@ module Padrino
45
66
  # mat(:account, :email)
46
67
  #
47
68
  def model_attribute_translate(model, attribute)
48
- t("models.#{model}.attributes.#{attribute}", :default => attribute.to_s.humanize)
69
+ t("models.\#{model}.attributes.\#{attribute}", :default => attribute.to_s.humanize)
49
70
  end
50
- alias :mat :model_attribute_translate
71
+ alias :t_attr :model_attribute_translate
72
+ alias :mat :t_attr
51
73
 
52
74
  ##
53
75
  # Translates model name