Skip to content
This repository
Browse code

Merge pull request #923 from WaYdotNET/v1

Padrino Admin Twitter Boostrap version
  • Loading branch information...
commit eed09dc4fcbdcb04524f79feac08c75057ee6c7f 2 parents 1c384a0 + 9c84e11
Davide D'Agostino DAddYE authored

Showing 190 changed files with 10,814 additions and 5,539 deletions. Show diff stats Hide diff stats

  1. +1 0  .travis.yml
  2. +33 2 README.rdoc
  3. +0 5 padrino-admin/lib/padrino-admin.rb
  4. +2 2 padrino-admin/lib/padrino-admin/access_control.rb
  5. +1 1  padrino-admin/lib/padrino-admin/generators/actions.rb
  6. +3 9 padrino-admin/lib/padrino-admin/generators/admin_app.rb
  7. +19 0 padrino-admin/lib/padrino-admin/generators/orm.rb
  8. +7 2 padrino-admin/lib/padrino-admin/generators/templates/app.rb.tt
  9. +4 0 padrino-admin/lib/padrino-admin/generators/templates/app/controllers/base.rb
  10. +1 1  padrino-admin/lib/padrino-admin/generators/templates/app/controllers/sessions.rb.tt
  11. BIN  padrino-admin/lib/padrino-admin/generators/templates/assets/images/font/fontawesome-webfont.eot
  12. +255 0 padrino-admin/lib/padrino-admin/generators/templates/assets/images/font/fontawesome-webfont.svg
  13. BIN  padrino-admin/lib/padrino-admin/generators/templates/assets/images/font/fontawesome-webfont.ttf
  14. BIN  padrino-admin/lib/padrino-admin/generators/templates/assets/images/font/fontawesome-webfont.woff
  15. BIN  padrino-admin/lib/padrino-admin/generators/templates/assets/images/glyphicons-halflings-white.png
  16. BIN  padrino-admin/lib/padrino-admin/generators/templates/assets/images/glyphicons-halflings.png
  17. BIN  padrino-admin/lib/padrino-admin/generators/templates/assets/images/logo.jpg
  18. +74 0 padrino-admin/lib/padrino-admin/generators/templates/assets/javascripts/application.coffee
  19. +120 0 padrino-admin/lib/padrino-admin/generators/templates/assets/javascripts/application.js
  20. +104 0 padrino-admin/lib/padrino-admin/generators/templates/assets/javascripts/bootstrap/bootstrap-affix.js
  21. +90 0 padrino-admin/lib/padrino-admin/generators/templates/assets/javascripts/bootstrap/bootstrap-alert.js
  22. +96 0 padrino-admin/lib/padrino-admin/generators/templates/assets/javascripts/bootstrap/bootstrap-button.js
  23. +176 0 padrino-admin/lib/padrino-admin/generators/templates/assets/javascripts/bootstrap/bootstrap-carousel.js
  24. +158 0 padrino-admin/lib/padrino-admin/generators/templates/assets/javascripts/bootstrap/bootstrap-collapse.js
  25. +150 0 padrino-admin/lib/padrino-admin/generators/templates/assets/javascripts/bootstrap/bootstrap-dropdown.js
  26. +239 0 padrino-admin/lib/padrino-admin/generators/templates/assets/javascripts/bootstrap/bootstrap-modal.js
  27. +103 0 padrino-admin/lib/padrino-admin/generators/templates/assets/javascripts/bootstrap/bootstrap-popover.js
  28. +151 0 padrino-admin/lib/padrino-admin/generators/templates/assets/javascripts/bootstrap/bootstrap-scrollspy.js
  29. +135 0 padrino-admin/lib/padrino-admin/generators/templates/assets/javascripts/bootstrap/bootstrap-tab.js
  30. +275 0 padrino-admin/lib/padrino-admin/generators/templates/assets/javascripts/bootstrap/bootstrap-tooltip.js
  31. +60 0 padrino-admin/lib/padrino-admin/generators/templates/assets/javascripts/bootstrap/bootstrap-transition.js
  32. +300 0 padrino-admin/lib/padrino-admin/generators/templates/assets/javascripts/bootstrap/bootstrap-typeahead.js
  33. +7 0 padrino-admin/lib/padrino-admin/generators/templates/assets/javascripts/bootstrap/bootstrap.min.js
  34. +4 0 padrino-admin/lib/padrino-admin/generators/templates/assets/javascripts/jquery-1.7.1.min.js
  35. +9 0 padrino-admin/lib/padrino-admin/generators/templates/assets/javascripts/less-1.3.0.min.js
  36. +92 0 padrino-admin/lib/padrino-admin/generators/templates/assets/stylesheets/admin.less
  37. +0 95 padrino-admin/lib/padrino-admin/generators/templates/assets/stylesheets/base.css
  38. +34 0 padrino-admin/lib/padrino-admin/generators/templates/assets/stylesheets/bootstrap/accordion.less
  39. +65 0 padrino-admin/lib/padrino-admin/generators/templates/assets/stylesheets/bootstrap/alerts.less
  40. +63 0 padrino-admin/lib/padrino-admin/generators/templates/assets/stylesheets/bootstrap/bootstrap.less
  41. +24 0 padrino-admin/lib/padrino-admin/generators/templates/assets/stylesheets/bootstrap/breadcrumbs.less
  42. +245 0 padrino-admin/lib/padrino-admin/generators/templates/assets/stylesheets/bootstrap/button-groups.less
  43. +231 0 padrino-admin/lib/padrino-admin/generators/templates/assets/stylesheets/bootstrap/buttons.less
  44. +131 0 padrino-admin/lib/padrino-admin/generators/templates/assets/stylesheets/bootstrap/carousel.less
  45. +31 0 padrino-admin/lib/padrino-admin/generators/templates/assets/stylesheets/bootstrap/close.less
  46. +58 0 padrino-admin/lib/padrino-admin/generators/templates/assets/stylesheets/bootstrap/code.less
  47. +22 0 padrino-admin/lib/padrino-admin/generators/templates/assets/stylesheets/bootstrap/component-animations.less
  48. +210 0 padrino-admin/lib/padrino-admin/generators/templates/assets/stylesheets/bootstrap/dropdowns.less
  49. +245 0 padrino-admin/lib/padrino-admin/generators/templates/assets/stylesheets/bootstrap/font-awesome-ie7.less
  50. +329 0 padrino-admin/lib/padrino-admin/generators/templates/assets/stylesheets/bootstrap/font-awesome.less
  51. +650 0 padrino-admin/lib/padrino-admin/generators/templates/assets/stylesheets/bootstrap/forms.less
  52. +21 0 padrino-admin/lib/padrino-admin/generators/templates/assets/stylesheets/bootstrap/grid.less
  53. +24 0 padrino-admin/lib/padrino-admin/generators/templates/assets/stylesheets/bootstrap/hero-unit.less
  54. +72 0 padrino-admin/lib/padrino-admin/generators/templates/assets/stylesheets/bootstrap/labels-badges.less
  55. +16 0 padrino-admin/lib/padrino-admin/generators/templates/assets/stylesheets/bootstrap/layouts.less
  56. +681 0 padrino-admin/lib/padrino-admin/generators/templates/assets/stylesheets/bootstrap/mixins.less
  57. +98 0 padrino-admin/lib/padrino-admin/generators/templates/assets/stylesheets/bootstrap/modals.less
  58. +475 0 padrino-admin/lib/padrino-admin/generators/templates/assets/stylesheets/bootstrap/navbar.less
  59. +384 0 padrino-admin/lib/padrino-admin/generators/templates/assets/stylesheets/bootstrap/navs.less
  60. +40 0 padrino-admin/lib/padrino-admin/generators/templates/assets/stylesheets/bootstrap/pager.less
  61. +64 0 padrino-admin/lib/padrino-admin/generators/templates/assets/stylesheets/bootstrap/pagination.less
  62. +117 0 padrino-admin/lib/padrino-admin/generators/templates/assets/stylesheets/bootstrap/popovers.less
  63. +122 0 padrino-admin/lib/padrino-admin/generators/templates/assets/stylesheets/bootstrap/progress-bars.less
  64. +137 0 padrino-admin/lib/padrino-admin/generators/templates/assets/stylesheets/bootstrap/reset.less
  65. +28 0 padrino-admin/lib/padrino-admin/generators/templates/assets/stylesheets/bootstrap/responsive-1200px-min.less
  66. +174 0 padrino-admin/lib/padrino-admin/generators/templates/assets/stylesheets/bootstrap/responsive-767px-max.less
  67. +19 0 padrino-admin/lib/padrino-admin/generators/templates/assets/stylesheets/bootstrap/responsive-768px-979px.less
  68. +177 0 padrino-admin/lib/padrino-admin/generators/templates/assets/stylesheets/bootstrap/responsive-navbar.less
  69. +43 0 padrino-admin/lib/padrino-admin/generators/templates/assets/stylesheets/bootstrap/responsive-utilities.less
  70. +48 0 padrino-admin/lib/padrino-admin/generators/templates/assets/stylesheets/bootstrap/responsive.less
  71. +52 0 padrino-admin/lib/padrino-admin/generators/templates/assets/stylesheets/bootstrap/scaffolding.less
  72. +193 0 padrino-admin/lib/padrino-admin/generators/templates/assets/stylesheets/bootstrap/sprites.less
  73. +245 0 padrino-admin/lib/padrino-admin/generators/templates/assets/stylesheets/bootstrap/tables.less
  74. +52 0 padrino-admin/lib/padrino-admin/generators/templates/assets/stylesheets/bootstrap/thumbnails.less
  75. +70 0 padrino-admin/lib/padrino-admin/generators/templates/assets/stylesheets/bootstrap/tooltip.less
  76. +221 0 padrino-admin/lib/padrino-admin/generators/templates/assets/stylesheets/bootstrap/type.less
  77. +30 0 padrino-admin/lib/padrino-admin/generators/templates/assets/stylesheets/bootstrap/utilities.less
  78. +279 0 padrino-admin/lib/padrino-admin/generators/templates/assets/stylesheets/bootstrap/variables.less
  79. +29 0 padrino-admin/lib/padrino-admin/generators/templates/assets/stylesheets/bootstrap/wells.less
  80. +925 0 padrino-admin/lib/padrino-admin/generators/templates/assets/stylesheets/compiled/admin.css
  81. +0 364 padrino-admin/lib/padrino-admin/generators/templates/assets/stylesheets/themes/amro/style.css
  82. +0 290 padrino-admin/lib/padrino-admin/generators/templates/assets/stylesheets/themes/bec-green/style.css
  83. +0 301 padrino-admin/lib/padrino-admin/generators/templates/assets/stylesheets/themes/bec/style.css
  84. +0 287 padrino-admin/lib/padrino-admin/generators/templates/assets/stylesheets/themes/blue/style.css
  85. +0 373 padrino-admin/lib/padrino-admin/generators/templates/assets/stylesheets/themes/default/style.css
  86. +0 305 padrino-admin/lib/padrino-admin/generators/templates/assets/stylesheets/themes/djime-cerulean/style.css
  87. +0 279 padrino-admin/lib/padrino-admin/generators/templates/assets/stylesheets/themes/kathleene/style.css
  88. +0 345 padrino-admin/lib/padrino-admin/generators/templates/assets/stylesheets/themes/olive/style.css
  89. +0 269 padrino-admin/lib/padrino-admin/generators/templates/assets/stylesheets/themes/orange/style.css
  90. +0 302 padrino-admin/lib/padrino-admin/generators/templates/assets/stylesheets/themes/reidb-greenish/style.css
  91. +0 281 padrino-admin/lib/padrino-admin/generators/templates/assets/stylesheets/themes/ruby/style.css
  92. +0 391 padrino-admin/lib/padrino-admin/generators/templates/assets/stylesheets/themes/warehouse/style.css
  93. +0 13 padrino-admin/lib/padrino-admin/generators/templates/erb/app/base/_sidebar.erb.tt
  94. +27 17 padrino-admin/lib/padrino-admin/generators/templates/erb/app/base/index.erb.tt
  95. +92 40 padrino-admin/lib/padrino-admin/generators/templates/erb/app/layouts/application.erb.tt
  96. +44 51 padrino-admin/lib/padrino-admin/generators/templates/erb/app/sessions/new.erb.tt
  97. +16 8 padrino-admin/lib/padrino-admin/generators/templates/erb/page/_form.erb.tt
  98. +9 17 padrino-admin/lib/padrino-admin/generators/templates/erb/page/edit.erb.tt
  99. +48 31 padrino-admin/lib/padrino-admin/generators/templates/erb/page/index.erb.tt
  100. +8 16 padrino-admin/lib/padrino-admin/generators/templates/erb/page/new.erb.tt
  101. +0 11 padrino-admin/lib/padrino-admin/generators/templates/haml/app/base/_sidebar.haml.tt
  102. +21 25 padrino-admin/lib/padrino-admin/generators/templates/haml/app/base/index.haml.tt
  103. +72 27 padrino-admin/lib/padrino-admin/generators/templates/haml/app/layouts/application.haml.tt
  104. +35 27 padrino-admin/lib/padrino-admin/generators/templates/haml/app/sessions/new.haml.tt
  105. +13 9 padrino-admin/lib/padrino-admin/generators/templates/haml/page/_form.haml.tt
  106. +7 14 padrino-admin/lib/padrino-admin/generators/templates/haml/page/edit.haml.tt
  107. +41 26 padrino-admin/lib/padrino-admin/generators/templates/haml/page/index.haml.tt
  108. +6 13 padrino-admin/lib/padrino-admin/generators/templates/haml/page/new.haml.tt
  109. +21 2 padrino-admin/lib/padrino-admin/generators/templates/page/controller.rb.tt
  110. +0 11 padrino-admin/lib/padrino-admin/generators/templates/slim/app/base/_sidebar.slim.tt
  111. +21 25 padrino-admin/lib/padrino-admin/generators/templates/slim/app/base/index.slim.tt
  112. +63 22 padrino-admin/lib/padrino-admin/generators/templates/slim/app/layouts/application.slim.tt
  113. +30 27 padrino-admin/lib/padrino-admin/generators/templates/slim/app/sessions/new.slim.tt
  114. +13 11 padrino-admin/lib/padrino-admin/generators/templates/slim/page/_form.slim.tt
  115. +7 15 padrino-admin/lib/padrino-admin/generators/templates/slim/page/edit.slim.tt
  116. +42 27 padrino-admin/lib/padrino-admin/generators/templates/slim/page/index.slim.tt
  117. +6 14 padrino-admin/lib/padrino-admin/generators/templates/slim/page/new.slim.tt
  118. +11 51 padrino-admin/lib/padrino-admin/helpers/view_helpers.rb
  119. +0 16 padrino-admin/lib/padrino-admin/locale/admin/cs.yml
  120. +0 16 padrino-admin/lib/padrino-admin/locale/admin/da.yml
  121. +0 16 padrino-admin/lib/padrino-admin/locale/admin/de.yml
  122. +0 16 padrino-admin/lib/padrino-admin/locale/admin/en.yml
  123. +0 16 padrino-admin/lib/padrino-admin/locale/admin/es.yml
  124. +0 16 padrino-admin/lib/padrino-admin/locale/admin/fr.yml
  125. +0 16 padrino-admin/lib/padrino-admin/locale/admin/hu.yml
  126. +0 16 padrino-admin/lib/padrino-admin/locale/admin/it.yml
  127. +0 16 padrino-admin/lib/padrino-admin/locale/admin/ja.yml
  128. +0 16 padrino-admin/lib/padrino-admin/locale/admin/lv.yml
  129. +0 16 padrino-admin/lib/padrino-admin/locale/admin/nl.yml
  130. +0 16 padrino-admin/lib/padrino-admin/locale/admin/no.yml
  131. +0 16 padrino-admin/lib/padrino-admin/locale/admin/pl.yml
  132. +0 16 padrino-admin/lib/padrino-admin/locale/admin/pt_br.yml
  133. +0 16 padrino-admin/lib/padrino-admin/locale/admin/ro.yml
  134. +0 16 padrino-admin/lib/padrino-admin/locale/admin/ru.yml
  135. +0 16 padrino-admin/lib/padrino-admin/locale/admin/sv.yml
  136. +0 16 padrino-admin/lib/padrino-admin/locale/admin/tr.yml
  137. +0 16 padrino-admin/lib/padrino-admin/locale/admin/uk.yml
  138. +0 16 padrino-admin/lib/padrino-admin/locale/admin/zh_cn.yml
  139. +0 16 padrino-admin/lib/padrino-admin/locale/admin/zh_tw.yml
  140. +0 26 padrino-admin/lib/padrino-admin/locale/orm/cs.yml
  141. +0 26 padrino-admin/lib/padrino-admin/locale/orm/da.yml
  142. +0 26 padrino-admin/lib/padrino-admin/locale/orm/de.yml
  143. +0 26 padrino-admin/lib/padrino-admin/locale/orm/en.yml
  144. +0 26 padrino-admin/lib/padrino-admin/locale/orm/es.yml
  145. +0 26 padrino-admin/lib/padrino-admin/locale/orm/fr.yml
  146. +0 26 padrino-admin/lib/padrino-admin/locale/orm/hu.yml
  147. +0 26 padrino-admin/lib/padrino-admin/locale/orm/it.yml
  148. +0 26 padrino-admin/lib/padrino-admin/locale/orm/ja.yml
  149. +0 26 padrino-admin/lib/padrino-admin/locale/orm/lv.yml
  150. +0 26 padrino-admin/lib/padrino-admin/locale/orm/nl.yml
  151. +0 26 padrino-admin/lib/padrino-admin/locale/orm/no.yml
  152. +0 27 padrino-admin/lib/padrino-admin/locale/orm/pl.yml
  153. +0 26 padrino-admin/lib/padrino-admin/locale/orm/pt_br.yml
  154. +0 26 padrino-admin/lib/padrino-admin/locale/orm/ro.yml
  155. +0 26 padrino-admin/lib/padrino-admin/locale/orm/ru.yml
  156. +0 26 padrino-admin/lib/padrino-admin/locale/orm/sv.yml
  157. +0 26 padrino-admin/lib/padrino-admin/locale/orm/tr.yml
  158. +0 26 padrino-admin/lib/padrino-admin/locale/orm/uk.yml
  159. +0 26 padrino-admin/lib/padrino-admin/locale/orm/zh_cn.yml
  160. +0 26 padrino-admin/lib/padrino-admin/locale/orm/zh_tw.yml
  161. 0  padrino-admin/padrino-admin.gemspec
  162. +5 15 padrino-admin/test/generators/test_admin_app_generator.rb
  163. +0 58 padrino-admin/test/test_locale.rb
  164. 0  padrino-cache/padrino-cache.gemspec
  165. 0  padrino-core/padrino-core.gemspec
  166. +11 11 padrino-gen/lib/padrino-gen/generators/actions.rb
  167. +10 12 padrino-gen/lib/padrino-gen/generators/app.rb
  168. +3 3 padrino-gen/lib/padrino-gen/generators/app/app.rb.tt
  169. +3 3 padrino-gen/lib/padrino-gen/generators/cli.rb
  170. +10 10 padrino-gen/lib/padrino-gen/generators/controller.rb
  171. +7 7 padrino-gen/lib/padrino-gen/generators/mailer.rb
  172. +5 5 padrino-gen/lib/padrino-gen/generators/migration.rb
  173. +7 7 padrino-gen/lib/padrino-gen/generators/model.rb
  174. +23 23 padrino-gen/lib/padrino-gen/generators/project.rb
  175. 0  padrino-gen/lib/padrino-gen/generators/project/config.ru
  176. +8 8 padrino-gen/lib/padrino-gen/generators/project/config/apps.rb.tt
  177. +7 8 padrino-gen/lib/padrino-gen/generators/templates/controller.rb.tt
  178. +13 0 padrino-gen/lib/padrino-gen/padrino-tasks/minirecord.rb
  179. 0  padrino-gen/padrino-gen.gemspec
  180. +1 1  padrino-gen/test/test_app_generator.rb
  181. +24 25 padrino-gen/test/test_project_generator.rb
  182. +2 0  padrino-helpers/lib/padrino-helpers.rb
  183. +171 0 padrino-helpers/lib/padrino-helpers/breadcrumb_helpers.rb
  184. +2 1  padrino-helpers/lib/padrino-helpers/form_builder/abstract_form_builder.rb
  185. +3 3 padrino-helpers/lib/padrino-helpers/form_helpers.rb
  186. +1 0  padrino-helpers/lib/padrino-helpers/format_helpers.rb
  187. +2 2 padrino-helpers/lib/padrino-helpers/output_helpers/slim_handler.rb
  188. 0  padrino-helpers/padrino-helpers.gemspec
  189. 0  padrino-mailer/padrino-mailer.gemspec
  190. 0  padrino/padrino.gemspec
1  .travis.yml
@@ -19,3 +19,4 @@ notifications:
19 19 branches:
20 20 only:
21 21 - master
  22 +services: mongodb
35 README.rdoc
Source Rendered
... ... @@ -1,3 +1,27 @@
  1 +== (Padrino Admin TwitterBootstrap 2.1.1)
  2 +
  3 +* Slim, Haml, Erb engine
  4 +* Remove all locale, now only English
  5 +* Remove all unused helper
  6 +* Padrino-Modal: rack-flash and delete function into modal :D
  7 +* highlights error field
  8 +* Automatic replace true or false with relative image (list.slim, list.haml, list.erb)
  9 +* Breadcrumbs
  10 +* Automatic time_ago_in_words when column model is created_at or updated_at
  11 +* Migrate function for MiniRecord
  12 +* tag_icon helper
  13 +* In Production now use compiled file (coffee & less)
  14 +* Batch destroy
  15 +
  16 +
  17 +=== Retro compatibility (0.10.x)
  18 +
  19 +With this version of Padrino admin, we remove some helper... but if you use old generate page, you need this plugin:
  20 +
  21 +```ruby
  22 +padrino g plugin https://raw.github.com/WaYdotNET/padrino-recipes/master/plugins/old_admin_plugin.rb
  23 +```
  24 +
1 25 = Padrino
2 26
3 27 Padrino is the godfather of Sinatra. Follow us on
@@ -7,7 +31,6 @@ Padrino is the godfather of Sinatra. Follow us on
7 31 {<img src="http://travis-ci.org/padrino/padrino-framework.png" alt="Testing Status" />}[http://travis-ci.org/padrino/padrino-framework]
8 32 {<img src="https://gemnasium.com/padrino/padrino-framework.png" alt="Dependency Status" />}[https://gemnasium.com/padrino/padrino-framework]
9 33
10   -
11 34 == Preface
12 35
13 36 Padrino is a ruby framework built upon the excellent {Sinatra Web Library}[http://www.sinatrarb.com].
@@ -84,8 +107,16 @@ Best way to learn more about building Padrino applications is to read following
84 107 * {Padrino API}[http://www.padrinorb.com/api/index.html] - YARD documentation for the Padrino framework.
85 108 * {Quick Overview}[http://www.padrinorb.com/guides/basic-projects] - Outlines basic generation commands.
86 109
  110 +=== In Production
  111 +
  112 +If you modify .less and .coffee files into the admin section, you MUST recompile those files into .css and .js
  113 +
  114 + $ lessc admin.less > compiled/admin.css -x
  115 +
  116 + $ coffee --compile application.coffee
  117 +
87 118 The individual Padrino sub-gems also contain README's which outlines their functionality.
88 119
89 120 == Copyright
90 121
91   -Copyright (c) 2011 Padrino. See LICENSE for details.
  122 +Copyright (c) 2012 Padrino. See LICENSE for details.
5 padrino-admin/lib/padrino-admin.rb
@@ -22,11 +22,6 @@ module Admin; end
22 22 String.send(:include, Padrino::Admin::Utils::Crypt)
23 23
24 24 ##
25   -# Load our Padrino::Admin locales
26   -#
27   -I18n.load_path += Dir["#{File.dirname(__FILE__)}/padrino-admin/locale/**/*.yml"]
28   -
29   -##
30 25 # Now we need to add admin generators to padrino-gen
31 26 #
32 27 begin
4 padrino-admin/lib/padrino-admin/access_control.rb
@@ -164,10 +164,10 @@ def initialize(name, path, options={}) # @private
164 164 end
165 165
166 166 ##
167   - # Returns the name of the project module. If a symbol it translate/humanize them for you.
  167 + # Returns the name of the project module humanize them for you.
168 168 #
169 169 def human_name
170   - @name.is_a?(Symbol) ? I18n.t("padrino.admin.menu.#{@name}", :default => @name.to_s.humanize) : @name
  170 + @name.to_s.humanize
171 171 end
172 172
173 173 ##
2  padrino-admin/lib/padrino-admin/generators/actions.rb
@@ -34,7 +34,7 @@ def supported_orm
34 34 # Tell us for now wich rendering engine we support
35 35 #
36 36 def supported_ext
37   - [:haml, :erb, :slim]
  37 + [:haml, :slim, :erb]
38 38 end
39 39
40 40 ##
12 padrino-admin/lib/padrino-admin/generators/admin_app.rb
@@ -8,12 +8,12 @@ class AdminApp < Thor::Group
8 8 # Add this generator to our padrino-gen
9 9 Padrino::Generators.add_generator(:admin, self)
10 10
11   - # Define the source template root and themes.
  11 + # Define the source template root
12 12 def self.source_root; File.expand_path(File.dirname(__FILE__)); end
13 13 # Defines the "banner" text for the CLI.
14 14 def self.banner; "padrino-gen admin"; end
15 15 # Defines the theme names for admin based on available.
16   - def self.themes; Dir[File.dirname(__FILE__) + "/templates/assets/stylesheets/themes/*"].map { |t| File.basename(t) }.sort; end
  16 + # def self.themes; Dir[File.dirname(__FILE__) + "/templates/assets/stylesheets/themes/*"].map { |t| File.basename(t) }.sort; end
17 17
18 18 # Include related modules
19 19 include Thor::Actions
@@ -26,7 +26,7 @@ def self.themes; Dir[File.dirname(__FILE__) + "/templates/assets/stylesheets/the
26 26 class_option :app, :aliases => "-a", :desc => "The model destination path", :default => '.', :type => :string
27 27 class_option :root, :desc => "The root destination", :aliases => '-r', :default => ".", :type => :string
28 28 class_option :destroy, :aliases => '-d', :default => false, :type => :boolean
29   - class_option :theme, :desc => "Your admin theme: (#{self.themes.join(", ")})", :default => "default", :type => :string
  29 + # class_option :theme, :desc => "Your admin theme: (#{self.themes.join(", ")})", :default => "default", :type => :string
30 30 class_option :renderer, :aliases => '-e', :desc => "Rendering engine (erb, haml)", :type => :string
31 31 class_option :admin_model, :aliases => '-m', :desc => "The name of model for access controlling", :default => 'Account', :type => :string
32 32
@@ -39,11 +39,6 @@ def create_admin
39 39 raise SystemExit
40 40 end
41 41
42   - unless self.class.themes.include?(options[:theme])
43   - say "<= You need to choose a theme from: #{self.class.themes.join(", ")}", :yellow
44   - raise SystemExit
45   - end
46   -
47 42 tmp_ext = options[:renderer] || fetch_component_choice(:renderer)
48 43 unless supported_ext.include?(tmp_ext.to_sym)
49 44 say "<= Your are using '#{tmp_ext}' and for admin we only support '#{supported_ext.join(', ')}'. Please use -e haml or -e erb or -e slim", :yellow
@@ -104,7 +99,6 @@ def create_admin
104 99 empty_directory destination_root("admin/views/layouts")
105 100 empty_directory destination_root("admin/views/sessions")
106 101
107   - template "templates/#{ext}/app/base/_sidebar.#{ext}.tt", destination_root("admin/views/base/_sidebar.#{ext}")
108 102 template "templates/#{ext}/app/base/index.#{ext}.tt", destination_root("admin/views/base/index.#{ext}")
109 103 template "templates/#{ext}/app/layouts/application.#{ext}.tt", destination_root("admin/views/layouts/application.#{ext}")
110 104 template "templates/#{ext}/app/sessions/new.#{ext}.tt", destination_root("admin/views/sessions/new.#{ext}")
19 padrino-admin/lib/padrino-admin/generators/orm.rb
@@ -131,6 +131,25 @@ def destroy
131 131 else "#{name_singular}.destroy"
132 132 end
133 133 end
  134 +
  135 + def find_by_ids(params=nil)
  136 + case orm
  137 + when :datamapper, :couchrest then "#{klass_name}.all(:id => #{params})"
  138 + when :mongoid then "#{klass_name}.find(#{params})"
  139 + else find(params)
  140 + end
  141 + end
  142 +
  143 + def multiple_destroy(params=nil)
  144 + case orm
  145 + when :ohm then "#{params}.delete"
  146 + when :sequel then "#{klass_name}.destroy"
  147 + when :datamapper then "#{params}.destroy"
  148 + when :couchrest, :mongoid, :mongomapper then "#{params}.each(&:destroy)"
  149 + else "#{klass_name}.destroy #{params}"
  150 + end
  151 + end
  152 +
134 153 end # Orm
135 154 end # Generators
136 155 end # Admin
9 padrino-admin/lib/padrino-admin/generators/templates/app.rb.tt
@@ -27,10 +27,15 @@ class Admin < Padrino::Application
27 27 disable :store_location
28 28
29 29 access_control.roles_for :any do |role|
30   - role.protect "/"
31   - role.allow "/sessions"
  30 + role.protect '/'
  31 + role.allow '/sessions'
32 32 end
33 33
34 34 access_control.roles_for :admin do |role|
35 35 end
  36 +
  37 + breadcrumbs = Padrino::Helpers::Breadcrumb.new
  38 + breadcrumbs.set_home '/admin', 'Admin'
  39 + set :breadcrumbs, breadcrumbs
  40 +
36 41 end
4 padrino-admin/lib/padrino-admin/generators/templates/app/controllers/base.rb
... ... @@ -1,5 +1,9 @@
1 1 Admin.controllers :base do
2 2
  3 + before do
  4 + settings.breadcrumbs.reset
  5 + end
  6 +
3 7 get :index, :map => "/" do
4 8 render "base/index"
5 9 end
2  padrino-admin/lib/padrino-admin/generators/templates/app/controllers/sessions.rb.tt
@@ -14,7 +14,7 @@ Admin.controllers :sessions do
14 14 redirect url(:base, :index)
15 15 else
16 16 params[:email], params[:password] = h(params[:email]), h(params[:password])
17   - flash[:warning] = "Login or password wrong."
  17 + flash[:error] = "Login or password wrong."
18 18 redirect url(:sessions, :new)
19 19 end
20 20 end
BIN  padrino-admin/lib/padrino-admin/generators/templates/assets/images/font/fontawesome-webfont.eot
Binary file not shown
255 padrino-admin/lib/padrino-admin/generators/templates/assets/images/font/fontawesome-webfont.svg
255 additions, 0 deletions not shown
BIN  padrino-admin/lib/padrino-admin/generators/templates/assets/images/font/fontawesome-webfont.ttf
Binary file not shown
BIN  padrino-admin/lib/padrino-admin/generators/templates/assets/images/font/fontawesome-webfont.woff
Binary file not shown
BIN  padrino-admin/lib/padrino-admin/generators/templates/assets/images/glyphicons-halflings-white.png
BIN  padrino-admin/lib/padrino-admin/generators/templates/assets/images/glyphicons-halflings.png
BIN  padrino-admin/lib/padrino-admin/generators/templates/assets/images/logo.jpg
74 padrino-admin/lib/padrino-admin/generators/templates/assets/javascripts/application.coffee
... ... @@ -0,0 +1,74 @@
  1 +jQuery ->
  2 + # local variables
  3 + pModal = $ '#padrino-modal'
  4 + pHeader = $ '#padrino-modal-header'
  5 + pTitle = $ '#padrino-modal-title'
  6 + pBody = $ '#padrino-modal-body'
  7 + pClose = $ '#padrino-modal-close'
  8 + pFooter = $ '#padrino-modal-footer'
  9 +
  10 + # openModal function
  11 + openModal = (source, title_tag = 'h4', type = 'warning', closed = 'Close', objects_move = [], title_remove = false, hide_remove = true, html = false, center = false) ->
  12 + pModal.addClass "flash-#{type}"
  13 + pHeader.addClass "alert-#{type}"
  14 + $(source).find('.hide').removeClass 'hide' if hide_remove
  15 + pTitle.append "#{type}"
  16 + $(source).find(title_tag).remove() if title_remove
  17 + pModal.addClass "flash-#{type}"
  18 + if html? then pBody.append($(source).html()) else pBody.append $(source)
  19 + pBody.addClass 'pagination-centered' if center
  20 + for obj in objects_move
  21 + $('#padrino-modal-footer').append $("#padrino-modal-body #{obj}")
  22 + pClose.html closed
  23 + pModal.modal 'show'
  24 +
  25 + # Form validation color
  26 + $('.invalid').parent().each -> $(this).parent().addClass 'error'
  27 +
  28 + # Form error
  29 + openModal('#field-errors','h4',"error",'Close') if $('#field-errors').length
  30 +
  31 + # Flash result
  32 + openModal('#flash-result','h4',$('#flash-result').attr('class'),'Close') if $('#flash-result').length
  33 +
  34 + # Clear padrino-modal
  35 + $('#padrino-modal').on 'hide', ->
  36 + types = ['success','notice','danger','error','info','warning']
  37 +
  38 + pModal.unwrap()
  39 + pTitle.empty()
  40 + pHeader.removeClass "alert"
  41 + for type in types
  42 + pHeader.removeClass "alert-#{type}"
  43 + pModal.removeClass "flash-#{type}"
  44 + pBody.empty().removeClass 'pagination-centered'
  45 + btn = pClose.clone().removeClass 'hide'
  46 + pFooter.empty().append btn
  47 + pClose.empty()
  48 +
  49 + # Initialize Modal form to delete
  50 + prepareModalForm = (data) ->
  51 + form = $(data.form).clone()
  52 + pModal.wrap "<form id='padrino-modal-form' />"
  53 + pForm = $ '#padrino-modal-form'
  54 + pForm.attr 'action', form.attr('action')
  55 + pForm.attr 'method', form.attr('method') if form.attr 'method'
  56 + form.prepend "<h4>#{data.title}</h4>"
  57 + openModal form, 'h4', data.type, null, [':input:submit', 'a'] , false, false, true, true
  58 +
  59 + # button delete
  60 + $(".btn_delete").click -> prepareModalForm($(this).data())
  61 +
  62 + # button bulk delete
  63 + $('#btn_multiple_delete').click ->
  64 + $('#multiple_delete_form :checkbox').remove()
  65 + $('#multiple_delete_form').append($('#multiple_list :checkbox:checked').clone())
  66 + $('#multiple_delete_form :checkbox').attr 'checked','checked'
  67 + $('#multiple_delete_form :checkbox').addClass 'hide'
  68 + prepareModalForm($(this).data()) if $('#multiple_delete_form :checkbox:checked').length > 0
  69 +
  70 +
  71 + # general submit method
  72 + $('.to_submit').click -> $(this).parent('form:first').submit()
  73 + $('#check_all').click -> $('#multiple_list :checkbox').attr 'checked','checked'
  74 + $('#uncheck_all').click -> $('#multiple_list :checkbox').removeAttr 'checked'
120 padrino-admin/lib/padrino-admin/generators/templates/assets/javascripts/application.js
... ... @@ -0,0 +1,120 @@
  1 +// Generated by CoffeeScript 1.3.3
  2 +
  3 +jQuery(function() {
  4 + var openModal, pBody, pClose, pFooter, pHeader, pModal, pTitle, prepareModalForm;
  5 + pModal = $('#padrino-modal');
  6 + pHeader = $('#padrino-modal-header');
  7 + pTitle = $('#padrino-modal-title');
  8 + pBody = $('#padrino-modal-body');
  9 + pClose = $('#padrino-modal-close');
  10 + pFooter = $('#padrino-modal-footer');
  11 + openModal = function(source, title_tag, type, closed, objects_move, title_remove, hide_remove, html, center) {
  12 + var obj, _i, _len;
  13 + if (title_tag == null) {
  14 + title_tag = 'h4';
  15 + }
  16 + if (type == null) {
  17 + type = 'warning';
  18 + }
  19 + if (closed == null) {
  20 + closed = 'Close';
  21 + }
  22 + if (objects_move == null) {
  23 + objects_move = [];
  24 + }
  25 + if (title_remove == null) {
  26 + title_remove = false;
  27 + }
  28 + if (hide_remove == null) {
  29 + hide_remove = true;
  30 + }
  31 + if (html == null) {
  32 + html = false;
  33 + }
  34 + if (center == null) {
  35 + center = false;
  36 + }
  37 + pModal.addClass("flash-" + type);
  38 + pHeader.addClass("alert-" + type);
  39 + if (hide_remove) {
  40 + $(source).find('.hide').removeClass('hide');
  41 + }
  42 + pTitle.append("" + type);
  43 + if (title_remove) {
  44 + $(source).find(title_tag).remove();
  45 + }
  46 + pModal.addClass("flash-" + type);
  47 + if (html != null) {
  48 + pBody.append($(source).html());
  49 + } else {
  50 + pBody.append($(source));
  51 + }
  52 + if (center) {
  53 + pBody.addClass('pagination-centered');
  54 + }
  55 + for (_i = 0, _len = objects_move.length; _i < _len; _i++) {
  56 + obj = objects_move[_i];
  57 + $('#padrino-modal-footer').append($("#padrino-modal-body " + obj));
  58 + }
  59 + pClose.html(closed);
  60 + return pModal.modal('show');
  61 + };
  62 + $('.invalid').parent().each(function() {
  63 + return $(this).parent().addClass('error');
  64 + });
  65 + if ($('#field-errors').length) {
  66 + openModal('#field-errors', 'h4', "error", 'Close');
  67 + }
  68 + if ($('#flash-result').length) {
  69 + openModal('#flash-result', 'h4', $('#flash-result').attr('class'), 'Close');
  70 + }
  71 + $('#padrino-modal').on('hide', function() {
  72 + var btn, type, types, _i, _len;
  73 + types = ['success', 'notice', 'danger', 'error', 'info', 'warning'];
  74 + pModal.unwrap();
  75 + pTitle.empty();
  76 + pHeader.removeClass("alert");
  77 + for (_i = 0, _len = types.length; _i < _len; _i++) {
  78 + type = types[_i];
  79 + pHeader.removeClass("alert-" + type);
  80 + pModal.removeClass("flash-" + type);
  81 + }
  82 + pBody.empty().removeClass('pagination-centered');
  83 + btn = pClose.clone().removeClass('hide');
  84 + pFooter.empty().append(btn);
  85 + return pClose.empty();
  86 + });
  87 + prepareModalForm = function(data) {
  88 + var form, pForm;
  89 + form = $(data.form).clone();
  90 + pModal.wrap("<form id='padrino-modal-form' />");
  91 + pForm = $('#padrino-modal-form');
  92 + pForm.attr('action', form.attr('action'));
  93 + if (form.attr('method')) {
  94 + pForm.attr('method', form.attr('method'));
  95 + }
  96 + form.prepend("<h4>" + data.title + "</h4>");
  97 + return openModal(form, 'h4', data.type, null, [':input:submit', 'a'], false, false, true, true);
  98 + };
  99 + $(".btn_delete").click(function() {
  100 + return prepareModalForm($(this).data());
  101 + });
  102 + $('#btn_multiple_delete').click(function() {
  103 + $('#multiple_delete_form :checkbox').remove();
  104 + $('#multiple_delete_form').append($('#multiple_list :checkbox:checked').clone());
  105 + $('#multiple_delete_form :checkbox').attr('checked', 'checked');
  106 + $('#multiple_delete_form :checkbox').addClass('hide');
  107 + if ($('#multiple_delete_form :checkbox:checked').length > 0) {
  108 + return prepareModalForm($(this).data());
  109 + }
  110 + });
  111 + $('.to_submit').click(function() {
  112 + return $(this).parent('form:first').submit();
  113 + });
  114 + $('#check_all').click(function() {
  115 + return $('#multiple_list :checkbox').attr('checked', 'checked');
  116 + });
  117 + return $('#uncheck_all').click(function() {
  118 + return $('#multiple_list :checkbox').removeAttr('checked');
  119 + });
  120 +});
104 padrino-admin/lib/padrino-admin/generators/templates/assets/javascripts/bootstrap/bootstrap-affix.js
... ... @@ -0,0 +1,104 @@
  1 +/* ==========================================================
  2 + * bootstrap-affix.js v2.1.1
  3 + * http://twitter.github.com/bootstrap/javascript.html#affix
  4 + * ==========================================================
  5 + * Copyright 2012 Twitter, Inc.
  6 + *
  7 + * Licensed under the Apache License, Version 2.0 (the "License");
  8 + * you may not use this file except in compliance with the License.
  9 + * You may obtain a copy of the License at
  10 + *
  11 + * http://www.apache.org/licenses/LICENSE-2.0
  12 + *
  13 + * Unless required by applicable law or agreed to in writing, software
  14 + * distributed under the License is distributed on an "AS IS" BASIS,
  15 + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  16 + * See the License for the specific language governing permissions and
  17 + * limitations under the License.
  18 + * ========================================================== */
  19 +
  20 +
  21 +!function ($) {
  22 +
  23 + "use strict"; // jshint ;_;
  24 +
  25 +
  26 + /* AFFIX CLASS DEFINITION
  27 + * ====================== */
  28 +
  29 + var Affix = function (element, options) {
  30 + this.options = $.extend({}, $.fn.affix.defaults, options)
  31 + this.$window = $(window).on('scroll.affix.data-api', $.proxy(this.checkPosition, this))
  32 + this.$element = $(element)
  33 + this.checkPosition()
  34 + }
  35 +
  36 + Affix.prototype.checkPosition = function () {
  37 + if (!this.$element.is(':visible')) return
  38 +
  39 + var scrollHeight = $(document).height()
  40 + , scrollTop = this.$window.scrollTop()
  41 + , position = this.$element.offset()
  42 + , offset = this.options.offset
  43 + , offsetBottom = offset.bottom
  44 + , offsetTop = offset.top
  45 + , reset = 'affix affix-top affix-bottom'
  46 + , affix
  47 +
  48 + if (typeof offset != 'object') offsetBottom = offsetTop = offset
  49 + if (typeof offsetTop == 'function') offsetTop = offset.top()
  50 + if (typeof offsetBottom == 'function') offsetBottom = offset.bottom()
  51 +
  52 + affix = this.unpin != null && (scrollTop + this.unpin <= position.top) ?
  53 + false : offsetBottom != null && (position.top + this.$element.height() >= scrollHeight - offsetBottom) ?
  54 + 'bottom' : offsetTop != null && scrollTop <= offsetTop ?
  55 + 'top' : false
  56 +
  57 + if (this.affixed === affix) return
  58 +
  59 + this.affixed = affix
  60 + this.unpin = affix == 'bottom' ? position.top - scrollTop : null
  61 +
  62 + this.$element.removeClass(reset).addClass('affix' + (affix ? '-' + affix : ''))
  63 + }
  64 +
  65 +
  66 + /* AFFIX PLUGIN DEFINITION
  67 + * ======================= */
  68 +
  69 + $.fn.affix = function (option) {
  70 + return this.each(function () {
  71 + var $this = $(this)
  72 + , data = $this.data('affix')
  73 + , options = typeof option == 'object' && option
  74 + if (!data) $this.data('affix', (data = new Affix(this, options)))
  75 + if (typeof option == 'string') data[option]()
  76 + })
  77 + }
  78 +
  79 + $.fn.affix.Constructor = Affix
  80 +
  81 + $.fn.affix.defaults = {
  82 + offset: 0
  83 + }
  84 +
  85 +
  86 + /* AFFIX DATA-API
  87 + * ============== */
  88 +
  89 + $(window).on('load', function () {
  90 + $('[data-spy="affix"]').each(function () {
  91 + var $spy = $(this)
  92 + , data = $spy.data()
  93 +
  94 + data.offset = data.offset || {}
  95 +
  96 + data.offsetBottom && (data.offset.bottom = data.offsetBottom)
  97 + data.offsetTop && (data.offset.top = data.offsetTop)
  98 +
  99 + $spy.affix(data)
  100 + })
  101 + })
  102 +
  103 +
  104 +}(window.jQuery);
90 padrino-admin/lib/padrino-admin/generators/templates/assets/javascripts/bootstrap/bootstrap-alert.js
... ... @@ -0,0 +1,90 @@
  1 +/* ==========================================================
  2 + * bootstrap-alert.js v2.1.1
  3 + * http://twitter.github.com/bootstrap/javascript.html#alerts
  4 + * ==========================================================
  5 + * Copyright 2012 Twitter, Inc.
  6 + *
  7 + * Licensed under the Apache License, Version 2.0 (the "License");
  8 + * you may not use this file except in compliance with the License.
  9 + * You may obtain a copy of the License at
  10 + *
  11 + * http://www.apache.org/licenses/LICENSE-2.0
  12 + *
  13 + * Unless required by applicable law or agreed to in writing, software
  14 + * distributed under the License is distributed on an "AS IS" BASIS,
  15 + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  16 + * See the License for the specific language governing permissions and
  17 + * limitations under the License.
  18 + * ========================================================== */
  19 +
  20 +
  21 +!function ($) {
  22 +
  23 + "use strict"; // jshint ;_;
  24 +
  25 +
  26 + /* ALERT CLASS DEFINITION
  27 + * ====================== */
  28 +
  29 + var dismiss = '[data-dismiss="alert"]'
  30 + , Alert = function (el) {
  31 + $(el).on('click', dismiss, this.close)
  32 + }
  33 +
  34 + Alert.prototype.close = function (e) {
  35 + var $this = $(this)
  36 + , selector = $this.attr('data-target')
  37 + , $parent
  38 +
  39 + if (!selector) {
  40 + selector = $this.attr('href')
  41 + selector = selector && selector.replace(/.*(?=#[^\s]*$)/, '') //strip for ie7
  42 + }
  43 +
  44 + $parent = $(selector)
  45 +
  46 + e && e.preventDefault()
  47 +
  48 + $parent.length || ($parent = $this.hasClass('alert') ? $this : $this.parent())
  49 +
  50 + $parent.trigger(e = $.Event('close'))
  51 +
  52 + if (e.isDefaultPrevented()) return
  53 +
  54 + $parent.removeClass('in')
  55 +
  56 + function removeElement() {
  57 + $parent
  58 + .trigger('closed')
  59 + .remove()
  60 + }
  61 +
  62 + $.support.transition && $parent.hasClass('fade') ?
  63 + $parent.on($.support.transition.end, removeElement) :
  64 + removeElement()
  65 + }
  66 +
  67 +
  68 + /* ALERT PLUGIN DEFINITION
  69 + * ======================= */
  70 +
  71 + $.fn.alert = function (option) {
  72 + return this.each(function () {
  73 + var $this = $(this)
  74 + , data = $this.data('alert')
  75 + if (!data) $this.data('alert', (data = new Alert(this)))
  76 + if (typeof option == 'string') data[option].call($this)
  77 + })
  78 + }
  79 +
  80 + $.fn.alert.Constructor = Alert
  81 +
  82 +
  83 + /* ALERT DATA-API
  84 + * ============== */
  85 +
  86 + $(function () {
  87 + $('body').on('click.alert.data-api', dismiss, Alert.prototype.close)
  88 + })
  89 +
  90 +}(window.jQuery);
96 padrino-admin/lib/padrino-admin/generators/templates/assets/javascripts/bootstrap/bootstrap-button.js
... ... @@ -0,0 +1,96 @@
  1 +/* ============================================================
  2 + * bootstrap-button.js v2.1.1
  3 + * http://twitter.github.com/bootstrap/javascript.html#buttons
  4 + * ============================================================
  5 + * Copyright 2012 Twitter, Inc.
  6 + *
  7 + * Licensed under the Apache License, Version 2.0 (the "License");
  8 + * you may not use this file except in compliance with the License.
  9 + * You may obtain a copy of the License at
  10 + *
  11 + * http://www.apache.org/licenses/LICENSE-2.0
  12 + *
  13 + * Unless required by applicable law or agreed to in writing, software
  14 + * distributed under the License is distributed on an "AS IS" BASIS,
  15 + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  16 + * See the License for the specific language governing permissions and
  17 + * limitations under the License.
  18 + * ============================================================ */
  19 +
  20 +
  21 +!function ($) {
  22 +
  23 + "use strict"; // jshint ;_;
  24 +
  25 +
  26 + /* BUTTON PUBLIC CLASS DEFINITION
  27 + * ============================== */
  28 +
  29 + var Button = function (element, options) {
  30 + this.$element = $(element)
  31 + this.options = $.extend({}, $.fn.button.defaults, options)
  32 + }
  33 +
  34 + Button.prototype.setState = function (state) {
  35 + var d = 'disabled'
  36 + , $el = this.$element
  37 + , data = $el.data()
  38 + , val = $el.is('input') ? 'val' : 'html'
  39 +
  40 + state = state + 'Text'
  41 + data.resetText || $el.data('resetText', $el[val]())
  42 +
  43 + $el[val](data[state] || this.options[state])
  44 +
  45 + // push to event loop to allow forms to submit
  46 + setTimeout(function () {
  47 + state == 'loadingText' ?
  48 + $el.addClass(d).attr(d, d) :
  49 + $el.removeClass(d).removeAttr(d)
  50 + }, 0)
  51 + }
  52 +
  53 + Button.prototype.toggle = function () {
  54 + var $parent = this.$element.closest('[data-toggle="buttons-radio"]')
  55 +
  56 + $parent && $parent
  57 + .find('.active')
  58 + .removeClass('active')
  59 +
  60 + this.$element.toggleClass('active')
  61 + }
  62 +
  63 +
  64 + /* BUTTON PLUGIN DEFINITION
  65 + * ======================== */
  66 +
  67 + $.fn.button = function (option) {
  68 + return this.each(function () {
  69 + var $this = $(this)
  70 + , data = $this.data('button')
  71 + , options = typeof option == 'object' && option
  72 + if (!data) $this.data('button', (data = new Button(this, options)))
  73 + if (option == 'toggle') data.toggle()
  74 + else if (option) data.setState(option)
  75 + })
  76 + }
  77 +
  78 + $.fn.button.defaults = {
  79 + loadingText: 'loading...'
  80 + }
  81 +
  82 + $.fn.button.Constructor = Button
  83 +
  84 +
  85 + /* BUTTON DATA-API
  86 + * =============== */
  87 +
  88 + $(function () {
  89 + $('body').on('click.button.data-api', '[data-toggle^=button]', function ( e ) {
  90 + var $btn = $(e.target)
  91 + if (!$btn.hasClass('btn')) $btn = $btn.closest('.btn')
  92 + $btn.button('toggle')
  93 + })
  94 + })
  95 +
  96 +}(window.jQuery);
176 padrino-admin/lib/padrino-admin/generators/templates/assets/javascripts/bootstrap/bootstrap-carousel.js
... ... @@ -0,0 +1,176 @@