Permalink
Browse files

Merge pull request #923 from WaYdotNET/v1

Padrino Admin Twitter Boostrap version
  • Loading branch information...
2 parents 1c384a0 + 9c84e11 commit eed09dc4fcbdcb04524f79feac08c75057ee6c7f @DAddYE DAddYE committed Oct 19, 2012
Showing with 10,814 additions and 5,539 deletions.
  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 ...ino-admin/lib/padrino-admin/generators/templates/assets/javascripts/bootstrap/bootstrap-button.js
  23. +176 −0 ...o-admin/lib/padrino-admin/generators/templates/assets/javascripts/bootstrap/bootstrap-carousel.js
  24. +158 −0 ...o-admin/lib/padrino-admin/generators/templates/assets/javascripts/bootstrap/bootstrap-collapse.js
  25. +150 −0 ...o-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 ...no-admin/lib/padrino-admin/generators/templates/assets/javascripts/bootstrap/bootstrap-popover.js
  28. +151 −0 ...-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 ...no-admin/lib/padrino-admin/generators/templates/assets/javascripts/bootstrap/bootstrap-tooltip.js
  31. +60 −0 ...admin/lib/padrino-admin/generators/templates/assets/javascripts/bootstrap/bootstrap-transition.js
  32. +300 −0 ...-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 ...min/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 ...o-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 ...in/lib/padrino-admin/generators/templates/assets/stylesheets/bootstrap/responsive-1200px-min.less
  66. +174 −0 ...min/lib/padrino-admin/generators/templates/assets/stylesheets/bootstrap/responsive-767px-max.less
  67. +19 −0 ...n/lib/padrino-admin/generators/templates/assets/stylesheets/bootstrap/responsive-768px-979px.less
  68. +177 −0 ...-admin/lib/padrino-admin/generators/templates/assets/stylesheets/bootstrap/responsive-navbar.less
  69. +43 −0 ...min/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 ...o-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 ...o-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
View
1 .travis.yml
@@ -19,3 +19,4 @@ notifications:
branches:
only:
- master
+services: mongodb
View
35 README.rdoc
@@ -1,3 +1,27 @@
+== (Padrino Admin TwitterBootstrap 2.1.1)
+
+* Slim, Haml, Erb engine
+* Remove all locale, now only English
+* Remove all unused helper
+* Padrino-Modal: rack-flash and delete function into modal :D
+* highlights error field
+* Automatic replace true or false with relative image (list.slim, list.haml, list.erb)
+* Breadcrumbs
+* Automatic time_ago_in_words when column model is created_at or updated_at
+* Migrate function for MiniRecord
+* tag_icon helper
+* In Production now use compiled file (coffee & less)
+* Batch destroy
+
+
+=== Retro compatibility (0.10.x)
+
+With this version of Padrino admin, we remove some helper... but if you use old generate page, you need this plugin:
+
+```ruby
+padrino g plugin https://raw.github.com/WaYdotNET/padrino-recipes/master/plugins/old_admin_plugin.rb
+```
+
= Padrino
Padrino is the godfather of Sinatra. Follow us on
@@ -7,7 +31,6 @@ Padrino is the godfather of Sinatra. Follow us on
{<img src="http://travis-ci.org/padrino/padrino-framework.png" alt="Testing Status" />}[http://travis-ci.org/padrino/padrino-framework]
{<img src="https://gemnasium.com/padrino/padrino-framework.png" alt="Dependency Status" />}[https://gemnasium.com/padrino/padrino-framework]
-
== Preface
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
* {Padrino API}[http://www.padrinorb.com/api/index.html] - YARD documentation for the Padrino framework.
* {Quick Overview}[http://www.padrinorb.com/guides/basic-projects] - Outlines basic generation commands.
+=== In Production
+
+If you modify .less and .coffee files into the admin section, you MUST recompile those files into .css and .js
+
+ $ lessc admin.less > compiled/admin.css -x
+
+ $ coffee --compile application.coffee
+
The individual Padrino sub-gems also contain README's which outlines their functionality.
== Copyright
-Copyright (c) 2011 Padrino. See LICENSE for details.
+Copyright (c) 2012 Padrino. See LICENSE for details.
View
5 padrino-admin/lib/padrino-admin.rb
@@ -22,11 +22,6 @@ module Admin; end
String.send(:include, Padrino::Admin::Utils::Crypt)
##
-# Load our Padrino::Admin locales
-#
-I18n.load_path += Dir["#{File.dirname(__FILE__)}/padrino-admin/locale/**/*.yml"]
-
-##
# Now we need to add admin generators to padrino-gen
#
begin
View
4 padrino-admin/lib/padrino-admin/access_control.rb
@@ -164,10 +164,10 @@ def initialize(name, path, options={}) # @private
end
##
- # Returns the name of the project module. If a symbol it translate/humanize them for you.
+ # Returns the name of the project module humanize them for you.
#
def human_name
- @name.is_a?(Symbol) ? I18n.t("padrino.admin.menu.#{@name}", :default => @name.to_s.humanize) : @name
+ @name.to_s.humanize
end
##
View
2 padrino-admin/lib/padrino-admin/generators/actions.rb
@@ -34,7 +34,7 @@ def supported_orm
# Tell us for now wich rendering engine we support
#
def supported_ext
- [:haml, :erb, :slim]
+ [:haml, :slim, :erb]
end
##
View
12 padrino-admin/lib/padrino-admin/generators/admin_app.rb
@@ -8,12 +8,12 @@ class AdminApp < Thor::Group
# Add this generator to our padrino-gen
Padrino::Generators.add_generator(:admin, self)
- # Define the source template root and themes.
+ # Define the source template root
def self.source_root; File.expand_path(File.dirname(__FILE__)); end
# Defines the "banner" text for the CLI.
def self.banner; "padrino-gen admin"; end
# Defines the theme names for admin based on available.
- def self.themes; Dir[File.dirname(__FILE__) + "/templates/assets/stylesheets/themes/*"].map { |t| File.basename(t) }.sort; end
+ # def self.themes; Dir[File.dirname(__FILE__) + "/templates/assets/stylesheets/themes/*"].map { |t| File.basename(t) }.sort; end
# Include related modules
include Thor::Actions
@@ -26,7 +26,7 @@ def self.themes; Dir[File.dirname(__FILE__) + "/templates/assets/stylesheets/the
class_option :app, :aliases => "-a", :desc => "The model destination path", :default => '.', :type => :string
class_option :root, :desc => "The root destination", :aliases => '-r', :default => ".", :type => :string
class_option :destroy, :aliases => '-d', :default => false, :type => :boolean
- class_option :theme, :desc => "Your admin theme: (#{self.themes.join(", ")})", :default => "default", :type => :string
+ # class_option :theme, :desc => "Your admin theme: (#{self.themes.join(", ")})", :default => "default", :type => :string
class_option :renderer, :aliases => '-e', :desc => "Rendering engine (erb, haml)", :type => :string
class_option :admin_model, :aliases => '-m', :desc => "The name of model for access controlling", :default => 'Account', :type => :string
@@ -39,11 +39,6 @@ def create_admin
raise SystemExit
end
- unless self.class.themes.include?(options[:theme])
- say "<= You need to choose a theme from: #{self.class.themes.join(", ")}", :yellow
- raise SystemExit
- end
-
tmp_ext = options[:renderer] || fetch_component_choice(:renderer)
unless supported_ext.include?(tmp_ext.to_sym)
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
empty_directory destination_root("admin/views/layouts")
empty_directory destination_root("admin/views/sessions")
- template "templates/#{ext}/app/base/_sidebar.#{ext}.tt", destination_root("admin/views/base/_sidebar.#{ext}")
template "templates/#{ext}/app/base/index.#{ext}.tt", destination_root("admin/views/base/index.#{ext}")
template "templates/#{ext}/app/layouts/application.#{ext}.tt", destination_root("admin/views/layouts/application.#{ext}")
template "templates/#{ext}/app/sessions/new.#{ext}.tt", destination_root("admin/views/sessions/new.#{ext}")
View
19 padrino-admin/lib/padrino-admin/generators/orm.rb
@@ -131,6 +131,25 @@ def destroy
else "#{name_singular}.destroy"
end
end
+
+ def find_by_ids(params=nil)
+ case orm
+ when :datamapper, :couchrest then "#{klass_name}.all(:id => #{params})"
+ when :mongoid then "#{klass_name}.find(#{params})"
+ else find(params)
+ end
+ end
+
+ def multiple_destroy(params=nil)
+ case orm
+ when :ohm then "#{params}.delete"
+ when :sequel then "#{klass_name}.destroy"
+ when :datamapper then "#{params}.destroy"
+ when :couchrest, :mongoid, :mongomapper then "#{params}.each(&:destroy)"
+ else "#{klass_name}.destroy #{params}"
+ end
+ end
+
end # Orm
end # Generators
end # Admin
View
9 padrino-admin/lib/padrino-admin/generators/templates/app.rb.tt
@@ -27,10 +27,15 @@ class Admin < Padrino::Application
disable :store_location
access_control.roles_for :any do |role|
- role.protect "/"
- role.allow "/sessions"
+ role.protect '/'
+ role.allow '/sessions'
end
access_control.roles_for :admin do |role|
end
+
+ breadcrumbs = Padrino::Helpers::Breadcrumb.new
+ breadcrumbs.set_home '/admin', 'Admin'
+ set :breadcrumbs, breadcrumbs
+
end
View
4 padrino-admin/lib/padrino-admin/generators/templates/app/controllers/base.rb
@@ -1,5 +1,9 @@
Admin.controllers :base do
+ before do
+ settings.breadcrumbs.reset
+ end
+
get :index, :map => "/" do
render "base/index"
end
View
2 padrino-admin/lib/padrino-admin/generators/templates/app/controllers/sessions.rb.tt
@@ -14,7 +14,7 @@ Admin.controllers :sessions do
redirect url(:base, :index)
else
params[:email], params[:password] = h(params[:email]), h(params[:password])
- flash[:warning] = "Login or password wrong."
+ flash[:error] = "Login or password wrong."
redirect url(:sessions, :new)
end
end
View
BIN ...o-admin/lib/padrino-admin/generators/templates/assets/images/font/fontawesome-webfont.eot
Binary file not shown.
View
255 ...o-admin/lib/padrino-admin/generators/templates/assets/images/font/fontawesome-webfont.svg
255 additions, 0 deletions not shown because the diff is too large. Please use a local Git client to view these changes.
View
BIN ...o-admin/lib/padrino-admin/generators/templates/assets/images/font/fontawesome-webfont.ttf
Binary file not shown.
View
BIN ...-admin/lib/padrino-admin/generators/templates/assets/images/font/fontawesome-webfont.woff
Binary file not shown.
View
BIN ...admin/lib/padrino-admin/generators/templates/assets/images/glyphicons-halflings-white.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View
BIN padrino-admin/lib/padrino-admin/generators/templates/assets/images/glyphicons-halflings.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View
BIN padrino-admin/lib/padrino-admin/generators/templates/assets/images/logo.jpg
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View
74 padrino-admin/lib/padrino-admin/generators/templates/assets/javascripts/application.coffee
@@ -0,0 +1,74 @@
+jQuery ->
+ # local variables
+ pModal = $ '#padrino-modal'
+ pHeader = $ '#padrino-modal-header'
+ pTitle = $ '#padrino-modal-title'
+ pBody = $ '#padrino-modal-body'
+ pClose = $ '#padrino-modal-close'
+ pFooter = $ '#padrino-modal-footer'
+
+ # openModal function
+ openModal = (source, title_tag = 'h4', type = 'warning', closed = 'Close', objects_move = [], title_remove = false, hide_remove = true, html = false, center = false) ->
+ pModal.addClass "flash-#{type}"
+ pHeader.addClass "alert-#{type}"
+ $(source).find('.hide').removeClass 'hide' if hide_remove
+ pTitle.append "#{type}"
+ $(source).find(title_tag).remove() if title_remove
+ pModal.addClass "flash-#{type}"
+ if html? then pBody.append($(source).html()) else pBody.append $(source)
+ pBody.addClass 'pagination-centered' if center
+ for obj in objects_move
+ $('#padrino-modal-footer').append $("#padrino-modal-body #{obj}")
+ pClose.html closed
+ pModal.modal 'show'
+
+ # Form validation color
+ $('.invalid').parent().each -> $(this).parent().addClass 'error'
+
+ # Form error
+ openModal('#field-errors','h4',"error",'Close') if $('#field-errors').length
+
+ # Flash result
+ openModal('#flash-result','h4',$('#flash-result').attr('class'),'Close') if $('#flash-result').length
+
+ # Clear padrino-modal
+ $('#padrino-modal').on 'hide', ->
+ types = ['success','notice','danger','error','info','warning']
+
+ pModal.unwrap()
+ pTitle.empty()
+ pHeader.removeClass "alert"
+ for type in types
+ pHeader.removeClass "alert-#{type}"
+ pModal.removeClass "flash-#{type}"
+ pBody.empty().removeClass 'pagination-centered'
+ btn = pClose.clone().removeClass 'hide'
+ pFooter.empty().append btn
+ pClose.empty()
+
+ # Initialize Modal form to delete
+ prepareModalForm = (data) ->
+ form = $(data.form).clone()
+ pModal.wrap "<form id='padrino-modal-form' />"
+ pForm = $ '#padrino-modal-form'
+ pForm.attr 'action', form.attr('action')
+ pForm.attr 'method', form.attr('method') if form.attr 'method'
+ form.prepend "<h4>#{data.title}</h4>"
+ openModal form, 'h4', data.type, null, [':input:submit', 'a'] , false, false, true, true
+
+ # button delete
+ $(".btn_delete").click -> prepareModalForm($(this).data())
+
+ # button bulk delete
+ $('#btn_multiple_delete').click ->
+ $('#multiple_delete_form :checkbox').remove()
+ $('#multiple_delete_form').append($('#multiple_list :checkbox:checked').clone())
+ $('#multiple_delete_form :checkbox').attr 'checked','checked'
+ $('#multiple_delete_form :checkbox').addClass 'hide'
+ prepareModalForm($(this).data()) if $('#multiple_delete_form :checkbox:checked').length > 0
+
+
+ # general submit method
+ $('.to_submit').click -> $(this).parent('form:first').submit()
+ $('#check_all').click -> $('#multiple_list :checkbox').attr 'checked','checked'
+ $('#uncheck_all').click -> $('#multiple_list :checkbox').removeAttr 'checked'
View
120 padrino-admin/lib/padrino-admin/generators/templates/assets/javascripts/application.js
@@ -0,0 +1,120 @@
+// Generated by CoffeeScript 1.3.3
+
+jQuery(function() {
+ var openModal, pBody, pClose, pFooter, pHeader, pModal, pTitle, prepareModalForm;
+ pModal = $('#padrino-modal');
+ pHeader = $('#padrino-modal-header');
+ pTitle = $('#padrino-modal-title');
+ pBody = $('#padrino-modal-body');
+ pClose = $('#padrino-modal-close');
+ pFooter = $('#padrino-modal-footer');
+ openModal = function(source, title_tag, type, closed, objects_move, title_remove, hide_remove, html, center) {
+ var obj, _i, _len;
+ if (title_tag == null) {
+ title_tag = 'h4';
+ }
+ if (type == null) {
+ type = 'warning';
+ }
+ if (closed == null) {
+ closed = 'Close';
+ }
+ if (objects_move == null) {
+ objects_move = [];
+ }
+ if (title_remove == null) {
+ title_remove = false;
+ }
+ if (hide_remove == null) {
+ hide_remove = true;
+ }
+ if (html == null) {
+ html = false;
+ }
+ if (center == null) {
+ center = false;
+ }
+ pModal.addClass("flash-" + type);
+ pHeader.addClass("alert-" + type);
+ if (hide_remove) {
+ $(source).find('.hide').removeClass('hide');
+ }
+ pTitle.append("" + type);
+ if (title_remove) {
+ $(source).find(title_tag).remove();
+ }
+ pModal.addClass("flash-" + type);
+ if (html != null) {
+ pBody.append($(source).html());
+ } else {
+ pBody.append($(source));
+ }
+ if (center) {
+ pBody.addClass('pagination-centered');
+ }
+ for (_i = 0, _len = objects_move.length; _i < _len; _i++) {
+ obj = objects_move[_i];
+ $('#padrino-modal-footer').append($("#padrino-modal-body " + obj));
+ }
+ pClose.html(closed);
+ return pModal.modal('show');
+ };
+ $('.invalid').parent().each(function() {
+ return $(this).parent().addClass('error');
+ });
+ if ($('#field-errors').length) {
+ openModal('#field-errors', 'h4', "error", 'Close');
+ }
+ if ($('#flash-result').length) {
+ openModal('#flash-result', 'h4', $('#flash-result').attr('class'), 'Close');
+ }
+ $('#padrino-modal').on('hide', function() {
+ var btn, type, types, _i, _len;
+ types = ['success', 'notice', 'danger', 'error', 'info', 'warning'];
+ pModal.unwrap();
+ pTitle.empty();
+ pHeader.removeClass("alert");
+ for (_i = 0, _len = types.length; _i < _len; _i++) {
+ type = types[_i];
+ pHeader.removeClass("alert-" + type);
+ pModal.removeClass("flash-" + type);
+ }
+ pBody.empty().removeClass('pagination-centered');
+ btn = pClose.clone().removeClass('hide');
+ pFooter.empty().append(btn);
+ return pClose.empty();
+ });
+ prepareModalForm = function(data) {
+ var form, pForm;
+ form = $(data.form).clone();
+ pModal.wrap("<form id='padrino-modal-form' />");
+ pForm = $('#padrino-modal-form');
+ pForm.attr('action', form.attr('action'));
+ if (form.attr('method')) {
+ pForm.attr('method', form.attr('method'));
+ }
+ form.prepend("<h4>" + data.title + "</h4>");
+ return openModal(form, 'h4', data.type, null, [':input:submit', 'a'], false, false, true, true);
+ };
+ $(".btn_delete").click(function() {
+ return prepareModalForm($(this).data());
+ });
+ $('#btn_multiple_delete').click(function() {
+ $('#multiple_delete_form :checkbox').remove();
+ $('#multiple_delete_form').append($('#multiple_list :checkbox:checked').clone());
+ $('#multiple_delete_form :checkbox').attr('checked', 'checked');
+ $('#multiple_delete_form :checkbox').addClass('hide');
+ if ($('#multiple_delete_form :checkbox:checked').length > 0) {
+ return prepareModalForm($(this).data());
+ }
+ });
+ $('.to_submit').click(function() {
+ return $(this).parent('form:first').submit();
+ });
+ $('#check_all').click(function() {
+ return $('#multiple_list :checkbox').attr('checked', 'checked');
+ });
+ return $('#uncheck_all').click(function() {
+ return $('#multiple_list :checkbox').removeAttr('checked');
+ });
+});
View
104 ...in/lib/padrino-admin/generators/templates/assets/javascripts/bootstrap/bootstrap-affix.js
@@ -0,0 +1,104 @@
+/* ==========================================================
+ * bootstrap-affix.js v2.1.1
+ * http://twitter.github.com/bootstrap/javascript.html#affix
+ * ==========================================================
+ * Copyright 2012 Twitter, Inc.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ========================================================== */
+
+
+!function ($) {
+
+ "use strict"; // jshint ;_;
+
+
+ /* AFFIX CLASS DEFINITION
+ * ====================== */
+
+ var Affix = function (element, options) {
+ this.options = $.extend({}, $.fn.affix.defaults, options)
+ this.$window = $(window).on('scroll.affix.data-api', $.proxy(this.checkPosition, this))
+ this.$element = $(element)
+ this.checkPosition()
+ }
+
+ Affix.prototype.checkPosition = function () {
+ if (!this.$element.is(':visible')) return
+
+ var scrollHeight = $(document).height()
+ , scrollTop = this.$window.scrollTop()
+ , position = this.$element.offset()
+ , offset = this.options.offset
+ , offsetBottom = offset.bottom
+ , offsetTop = offset.top
+ , reset = 'affix affix-top affix-bottom'
+ , affix
+
+ if (typeof offset != 'object') offsetBottom = offsetTop = offset
+ if (typeof offsetTop == 'function') offsetTop = offset.top()
+ if (typeof offsetBottom == 'function') offsetBottom = offset.bottom()
+
+ affix = this.unpin != null && (scrollTop + this.unpin <= position.top) ?
+ false : offsetBottom != null && (position.top + this.$element.height() >= scrollHeight - offsetBottom) ?
+ 'bottom' : offsetTop != null && scrollTop <= offsetTop ?
+ 'top' : false
+
+ if (this.affixed === affix) return
+
+ this.affixed = affix
+ this.unpin = affix == 'bottom' ? position.top - scrollTop : null
+
+ this.$element.removeClass(reset).addClass('affix' + (affix ? '-' + affix : ''))
+ }
+
+
+ /* AFFIX PLUGIN DEFINITION
+ * ======================= */
+
+ $.fn.affix = function (option) {
+ return this.each(function () {
+ var $this = $(this)
+ , data = $this.data('affix')
+ , options = typeof option == 'object' && option
+ if (!data) $this.data('affix', (data = new Affix(this, options)))
+ if (typeof option == 'string') data[option]()
+ })
+ }
+
+ $.fn.affix.Constructor = Affix
+
+ $.fn.affix.defaults = {
+ offset: 0
+ }
+
+
+ /* AFFIX DATA-API
+ * ============== */
+
+ $(window).on('load', function () {
+ $('[data-spy="affix"]').each(function () {
+ var $spy = $(this)
+ , data = $spy.data()
+
+ data.offset = data.offset || {}
+
+ data.offsetBottom && (data.offset.bottom = data.offsetBottom)
+ data.offsetTop && (data.offset.top = data.offsetTop)
+
+ $spy.affix(data)
+ })
+ })
+
+
+}(window.jQuery);
View
90 ...in/lib/padrino-admin/generators/templates/assets/javascripts/bootstrap/bootstrap-alert.js
@@ -0,0 +1,90 @@
+/* ==========================================================
+ * bootstrap-alert.js v2.1.1
+ * http://twitter.github.com/bootstrap/javascript.html#alerts
+ * ==========================================================
+ * Copyright 2012 Twitter, Inc.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ========================================================== */
+
+
+!function ($) {
+
+ "use strict"; // jshint ;_;
+
+
+ /* ALERT CLASS DEFINITION
+ * ====================== */
+
+ var dismiss = '[data-dismiss="alert"]'
+ , Alert = function (el) {
+ $(el).on('click', dismiss, this.close)
+ }
+
+ Alert.prototype.close = function (e) {
+ var $this = $(this)
+ , selector = $this.attr('data-target')
+ , $parent
+
+ if (!selector) {
+ selector = $this.attr('href')
+ selector = selector && selector.replace(/.*(?=#[^\s]*$)/, '') //strip for ie7
+ }
+
+ $parent = $(selector)
+
+ e && e.preventDefault()
+
+ $parent.length || ($parent = $this.hasClass('alert') ? $this : $this.parent())
+
+ $parent.trigger(e = $.Event('close'))
+
+ if (e.isDefaultPrevented()) return
+
+ $parent.removeClass('in')
+
+ function removeElement() {
+ $parent
+ .trigger('closed')
+ .remove()
+ }
+
+ $.support.transition && $parent.hasClass('fade') ?
+ $parent.on($.support.transition.end, removeElement) :
+ removeElement()
+ }
+
+
+ /* ALERT PLUGIN DEFINITION
+ * ======================= */
+
+ $.fn.alert = function (option) {
+ return this.each(function () {
+ var $this = $(this)
+ , data = $this.data('alert')
+ if (!data) $this.data('alert', (data = new Alert(this)))
+ if (typeof option == 'string') data[option].call($this)
+ })
+ }
+
+ $.fn.alert.Constructor = Alert
+
+
+ /* ALERT DATA-API
+ * ============== */
+
+ $(function () {
+ $('body').on('click.alert.data-api', dismiss, Alert.prototype.close)
+ })
+
+}(window.jQuery);
View
96 ...n/lib/padrino-admin/generators/templates/assets/javascripts/bootstrap/bootstrap-button.js
@@ -0,0 +1,96 @@
+/* ============================================================
+ * bootstrap-button.js v2.1.1
+ * http://twitter.github.com/bootstrap/javascript.html#buttons
+ * ============================================================
+ * Copyright 2012 Twitter, Inc.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============================================================ */
+
+
+!function ($) {
+
+ "use strict"; // jshint ;_;
+
+
+ /* BUTTON PUBLIC CLASS DEFINITION
+ * ============================== */
+
+ var Button = function (element, options) {
+ this.$element = $(element)
+ this.options = $.extend({}, $.fn.button.defaults, options)
+ }
+
+ Button.prototype.setState = function (state) {
+ var d = 'disabled'
+ , $el = this.$element
+ , data = $el.data()
+ , val = $el.is('input') ? 'val' : 'html'
+
+ state = state + 'Text'
+ data.resetText || $el.data('resetText', $el[val]())
+
+ $el[val](data[state] || this.options[state])
+
+ // push to event loop to allow forms to submit
+ setTimeout(function () {
+ state == 'loadingText' ?
+ $el.addClass(d).attr(d, d) :
+ $el.removeClass(d).removeAttr(d)
+ }, 0)
+ }
+
+ Button.prototype.toggle = function () {
+ var $parent = this.$element.closest('[data-toggle="buttons-radio"]')
+
+ $parent && $parent
+ .find('.active')
+ .removeClass('active')
+
+ this.$element.toggleClass('active')
+ }
+
+
+ /* BUTTON PLUGIN DEFINITION
+ * ======================== */
+
+ $.fn.button = function (option) {
+ return this.each(function () {
+ var $this = $(this)
+ , data = $this.data('button')
+ , options = typeof option == 'object' && option
+ if (!data) $this.data('button', (data = new Button(this, options)))
+ if (option == 'toggle') data.toggle()
+ else if (option) data.setState(option)
+ })
+ }
+
+ $.fn.button.defaults = {
+ loadingText: 'loading...'
+ }
+
+ $.fn.button.Constructor = Button
+
+
+ /* BUTTON DATA-API
+ * =============== */
+
+ $(function () {
+ $('body').on('click.button.data-api', '[data-toggle^=button]', function ( e ) {
+ var $btn = $(e.target)
+ if (!$btn.hasClass('btn')) $btn = $btn.closest('.btn')
+ $btn.button('toggle')
+ })
+ })
+
+}(window.jQuery);
View
176 ...lib/padrino-admin/generators/templates/assets/javascripts/bootstrap/bootstrap-carousel.js
@@ -0,0 +1,176 @@
+/* ==========================================================
+ * bootstrap-carousel.js v2.1.1
+ * http://twitter.github.com/bootstrap/javascript.html#carousel
+ * ==========================================================
+ * Copyright 2012 Twitter, Inc.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ========================================================== */
+
+
+!function ($) {
+
+ "use strict"; // jshint ;_;
+
+
+ /* CAROUSEL CLASS DEFINITION
+ * ========================= */
+
+ var Carousel = function (element, options) {
+ this.$element = $(element)
+ this.options = options
+ this.options.slide && this.slide(this.options.slide)
+ this.options.pause == 'hover' && this.$element
+ .on('mouseenter', $.proxy(this.pause, this))
+ .on('mouseleave', $.proxy(this.cycle, this))
+ }
+
+ Carousel.prototype = {
+
+ cycle: function (e) {
+ if (!e) this.paused = false
+ this.options.interval
+ && !this.paused
+ && (this.interval = setInterval($.proxy(this.next, this), this.options.interval))
+ return this
+ }
+
+ , to: function (pos) {
+ var $active = this.$element.find('.item.active')
+ , children = $active.parent().children()
+ , activePos = children.index($active)
+ , that = this
+
+ if (pos > (children.length - 1) || pos < 0) return
+
+ if (this.sliding) {
+ return this.$element.one('slid', function () {
+ that.to(pos)
+ })
+ }
+
+ if (activePos == pos) {
+ return this.pause().cycle()
+ }
+
+ return this.slide(pos > activePos ? 'next' : 'prev', $(children[pos]))
+ }
+
+ , pause: function (e) {
+ if (!e) this.paused = true
+ if (this.$element.find('.next, .prev').length && $.support.transition.end) {
+ this.$element.trigger($.support.transition.end)
+ this.cycle()
+ }
+ clearInterval(this.interval)
+ this.interval = null
+ return this
+ }
+
+ , next: function () {
+ if (this.sliding) return
+ return this.slide('next')
+ }
+
+ , prev: function () {
+ if (this.sliding) return
+ return this.slide('prev')
+ }
+
+ , slide: function (type, next) {
+ var $active = this.$element.find('.item.active')
+ , $next = next || $active[type]()
+ , isCycling = this.interval
+ , direction = type == 'next' ? 'left' : 'right'
+ , fallback = type == 'next' ? 'first' : 'last'
+ , that = this
+ , e = $.Event('slide', {
+ relatedTarget: $next[0]
+ })
+
+ this.sliding = true
+
+ isCycling && this.pause()
+
+ $next = $next.length ? $next : this.$element.find('.item')[fallback]()
+
+ if ($next.hasClass('active')) return
+
+ if ($.support.transition && this.$element.hasClass('slide')) {
+ this.$element.trigger(e)
+ if (e.isDefaultPrevented()) return
+ $next.addClass(type)
+ $next[0].offsetWidth // force reflow
+ $active.addClass(direction)
+ $next.addClass(direction)
+ this.$element.one($.support.transition.end, function () {
+ $next.removeClass([type, direction].join(' ')).addClass('active')
+ $active.removeClass(['active', direction].join(' '))
+ that.sliding = false
+ setTimeout(function () { that.$element.trigger('slid') }, 0)
+ })
+ } else {
+ this.$element.trigger(e)
+ if (e.isDefaultPrevented()) return
+ $active.removeClass('active')
+ $next.addClass('active')
+ this.sliding = false
+ this.$element.trigger('slid')
+ }
+
+ isCycling && this.cycle()
+
+ return this
+ }
+
+ }
+
+
+ /* CAROUSEL PLUGIN DEFINITION
+ * ========================== */
+
+ $.fn.carousel = function (option) {
+ return this.each(function () {
+ var $this = $(this)
+ , data = $this.data('carousel')
+ , options = $.extend({}, $.fn.carousel.defaults, typeof option == 'object' && option)
+ , action = typeof option == 'string' ? option : options.slide
+ if (!data) $this.data('carousel', (data = new Carousel(this, options)))
+ if (typeof option == 'number') data.to(option)
+ else if (action) data[action]()
+ else if (options.interval) data.cycle()
+ })
+ }
+
+ $.fn.carousel.defaults = {
+ interval: 5000
+ , pause: 'hover'
+ }
+
+ $.fn.carousel.Constructor = Carousel
+
+
+ /* CAROUSEL DATA-API
+ * ================= */
+
+ $(function () {
+ $('body').on('click.carousel.data-api', '[data-slide]', function ( e ) {
+ var $this = $(this), href
+ , $target = $($this.attr('data-target') || (href = $this.attr('href')) && href.replace(/.*(?=#[^\s]+$)/, '')) //strip for ie7
+ , options = !$target.data('modal') && $.extend({}, $target.data(), $this.data())
+ $target.carousel(options)
+ e.preventDefault()
+ })
+ })
+
+}(window.jQuery);
View
158 ...lib/padrino-admin/generators/templates/assets/javascripts/bootstrap/bootstrap-collapse.js
@@ -0,0 +1,158 @@
+/* =============================================================
+ * bootstrap-collapse.js v2.1.1
+ * http://twitter.github.com/bootstrap/javascript.html#collapse
+ * =============================================================
+ * Copyright 2012 Twitter, Inc.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============================================================ */
+
+
+!function ($) {
+
+ "use strict"; // jshint ;_;
+
+
+ /* COLLAPSE PUBLIC CLASS DEFINITION
+ * ================================ */
+
+ var Collapse = function (element, options) {
+ this.$element = $(element)
+ this.options = $.extend({}, $.fn.collapse.defaults, options)
+
+ if (this.options.parent) {
+ this.$parent = $(this.options.parent)
+ }
+
+ this.options.toggle && this.toggle()
+ }
+
+ Collapse.prototype = {
+
+ constructor: Collapse
+
+ , dimension: function () {
+ var hasWidth = this.$element.hasClass('width')
+ return hasWidth ? 'width' : 'height'
+ }
+
+ , show: function () {
+ var dimension
+ , scroll
+ , actives
+ , hasData
+
+ if (this.transitioning) return
+
+ dimension = this.dimension()
+ scroll = $.camelCase(['scroll', dimension].join('-'))
+ actives = this.$parent && this.$parent.find('> .accordion-group > .in')
+
+ if (actives && actives.length) {
+ hasData = actives.data('collapse')
+ if (hasData && hasData.transitioning) return
+ actives.collapse('hide')
+ hasData || actives.data('collapse', null)
+ }
+
+ this.$element[dimension](0)
+ this.transition('addClass', $.Event('show'), 'shown')
+ $.support.transition && this.$element[dimension](this.$element[0][scroll])
+ }
+
+ , hide: function () {
+ var dimension
+ if (this.transitioning) return
+ dimension = this.dimension()
+ this.reset(this.$element[dimension]())
+ this.transition('removeClass', $.Event('hide'), 'hidden')
+ this.$element[dimension](0)
+ }
+
+ , reset: function (size) {
+ var dimension = this.dimension()
+
+ this.$element
+ .removeClass('collapse')
+ [dimension](size || 'auto')
+ [0].offsetWidth
+
+ this.$element[size !== null ? 'addClass' : 'removeClass']('collapse')
+
+ return this
+ }
+
+ , transition: function (method, startEvent, completeEvent) {
+ var that = this
+ , complete = function () {
+ if (startEvent.type == 'show') that.reset()
+ that.transitioning = 0
+ that.$element.trigger(completeEvent)
+ }
+
+ this.$element.trigger(startEvent)
+
+ if (startEvent.isDefaultPrevented()) return
+
+ this.transitioning = 1
+
+ this.$element[method]('in')
+
+ $.support.transition && this.$element.hasClass('collapse') ?
+ this.$element.one($.support.transition.end, complete) :
+ complete()
+ }
+
+ , toggle: function () {
+ this[this.$element.hasClass('in') ? 'hide' : 'show']()
+ }
+
+ }
+
+
+ /* COLLAPSIBLE PLUGIN DEFINITION
+ * ============================== */
+
+ $.fn.collapse = function (option) {
+ return this.each(function () {
+ var $this = $(this)
+ , data = $this.data('collapse')
+ , options = typeof option == 'object' && option
+ if (!data) $this.data('collapse', (data = new Collapse(this, options)))
+ if (typeof option == 'string') data[option]()
+ })
+ }
+
+ $.fn.collapse.defaults = {
+ toggle: true
+ }
+
+ $.fn.collapse.Constructor = Collapse
+
+
+ /* COLLAPSIBLE DATA-API
+ * ==================== */
+
+ $(function () {
+ $('body').on('click.collapse.data-api', '[data-toggle=collapse]', function (e) {
+ var $this = $(this), href
+ , target = $this.attr('data-target')
+ || e.preventDefault()
+ || (href = $this.attr('href')) && href.replace(/.*(?=#[^\s]+$)/, '') //strip for ie7
+ , option = $(target).data('collapse') ? 'toggle' : $this.data()
+ $this[$(target).hasClass('in') ? 'addClass' : 'removeClass']('collapsed')
+ $(target).collapse(option)
+ })
+ })
+
+}(window.jQuery);
View
150 ...lib/padrino-admin/generators/templates/assets/javascripts/bootstrap/bootstrap-dropdown.js
@@ -0,0 +1,150 @@
+/* ============================================================
+ * bootstrap-dropdown.js v2.1.1
+ * http://twitter.github.com/bootstrap/javascript.html#dropdowns
+ * ============================================================
+ * Copyright 2012 Twitter, Inc.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============================================================ */
+
+
+!function ($) {
+
+ "use strict"; // jshint ;_;
+
+
+ /* DROPDOWN CLASS DEFINITION
+ * ========================= */
+
+ var toggle = '[data-toggle=dropdown]'
+ , Dropdown = function (element) {
+ var $el = $(element).on('click.dropdown.data-api', this.toggle)
+ $('html').on('click.dropdown.data-api', function () {
+ $el.parent().removeClass('open')
+ })
+ }
+
+ Dropdown.prototype = {
+
+ constructor: Dropdown
+
+ , toggle: function (e) {
+ var $this = $(this)
+ , $parent
+ , isActive
+
+ if ($this.is('.disabled, :disabled')) return
+
+ $parent = getParent($this)
+
+ isActive = $parent.hasClass('open')
+
+ clearMenus()
+
+ if (!isActive) {
+ $parent.toggleClass('open')
+ $this.focus()
+ }
+
+ return false
+ }
+
+ , keydown: function (e) {
+ var $this
+ , $items
+ , $active
+ , $parent
+ , isActive
+ , index
+
+ if (!/(38|40|27)/.test(e.keyCode)) return
+
+ $this = $(this)
+
+ e.preventDefault()
+ e.stopPropagation()
+
+ if ($this.is('.disabled, :disabled')) return
+
+ $parent = getParent($this)
+
+ isActive = $parent.hasClass('open')
+
+ if (!isActive || (isActive && e.keyCode == 27)) return $this.click()
+
+ $items = $('[role=menu] li:not(.divider) a', $parent)
+
+ if (!$items.length) return
+
+ index = $items.index($items.filter(':focus'))
+
+ if (e.keyCode == 38 && index > 0) index-- // up
+ if (e.keyCode == 40 && index < $items.length - 1) index++ // down
+ if (!~index) index = 0
+
+ $items
+ .eq(index)
+ .focus()
+ }
+
+ }
+
+ function clearMenus() {
+ getParent($(toggle))
+ .removeClass('open')
+ }
+
+ function getParent($this) {
+ var selector = $this.attr('data-target')
+ , $parent
+
+ if (!selector) {
+ selector = $this.attr('href')
+ selector = selector && /#/.test(selector) && selector.replace(/.*(?=#[^\s]*$)/, '') //strip for ie7
+ }
+
+ $parent = $(selector)
+ $parent.length || ($parent = $this.parent())
+
+ return $parent
+ }
+
+
+ /* DROPDOWN PLUGIN DEFINITION
+ * ========================== */
+
+ $.fn.dropdown = function (option) {
+ return this.each(function () {
+ var $this = $(this)
+ , data = $this.data('dropdown')
+ if (!data) $this.data('dropdown', (data = new Dropdown(this)))
+ if (typeof option == 'string') data[option].call($this)
+ })
+ }
+
+ $.fn.dropdown.Constructor = Dropdown
+
+
+ /* APPLY TO STANDARD DROPDOWN ELEMENTS
+ * =================================== */
+
+ $(function () {
+ $('html')
+ .on('click.dropdown.data-api touchstart.dropdown.data-api', clearMenus)
+ $('body')
+ .on('click.dropdown touchstart.dropdown.data-api', '.dropdown form', function (e) { e.stopPropagation() })
+ .on('click.dropdown.data-api touchstart.dropdown.data-api' , toggle, Dropdown.prototype.toggle)
+ .on('keydown.dropdown.data-api touchstart.dropdown.data-api', toggle + ', [role=menu]' , Dropdown.prototype.keydown)
+ })
+
+}(window.jQuery);
View
239 ...in/lib/padrino-admin/generators/templates/assets/javascripts/bootstrap/bootstrap-modal.js
@@ -0,0 +1,239 @@
+/* =========================================================
+ * bootstrap-modal.js v2.1.1
+ * http://twitter.github.com/bootstrap/javascript.html#modals
+ * =========================================================
+ * Copyright 2012 Twitter, Inc.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ========================================================= */
+
+
+!function ($) {
+
+ "use strict"; // jshint ;_;
+
+
+ /* MODAL CLASS DEFINITION
+ * ====================== */
+
+ var Modal = function (element, options) {
+ this.options = options
+ this.$element = $(element)
+ .delegate('[data-dismiss="modal"]', 'click.dismiss.modal', $.proxy(this.hide, this))
+ this.options.remote && this.$element.find('.modal-body').load(this.options.remote)
+ }
+
+ Modal.prototype = {
+
+ constructor: Modal
+
+ , toggle: function () {
+ return this[!this.isShown ? 'show' : 'hide']()
+ }
+
+ , show: function () {
+ var that = this
+ , e = $.Event('show')
+
+ this.$element.trigger(e)
+
+ if (this.isShown || e.isDefaultPrevented()) return
+
+ $('body').addClass('modal-open')
+
+ this.isShown = true
+
+ this.escape()
+
+ this.backdrop(function () {
+ var transition = $.support.transition && that.$element.hasClass('fade')
+
+ if (!that.$element.parent().length) {
+ that.$element.appendTo(document.body) //don't move modals dom position
+ }
+
+ that.$element
+ .show()
+
+ if (transition) {
+ that.$element[0].offsetWidth // force reflow
+ }
+
+ that.$element
+ .addClass('in')
+ .attr('aria-hidden', false)
+ .focus()
+
+ that.enforceFocus()
+
+ transition ?
+ that.$element.one($.support.transition.end, function () { that.$element.trigger('shown') }) :
+ that.$element.trigger('shown')
+
+ })
+ }
+
+ , hide: function (e) {
+ e && e.preventDefault()
+
+ var that = this
+
+ e = $.Event('hide')
+
+ this.$element.trigger(e)
+
+ if (!this.isShown || e.isDefaultPrevented()) return
+
+ this.isShown = false
+
+ $('body').removeClass('modal-open')
+
+ this.escape()
+
+ $(document).off('focusin.modal')
+
+ this.$element
+ .removeClass('in')
+ .attr('aria-hidden', true)
+
+ $.support.transition && this.$element.hasClass('fade') ?
+ this.hideWithTransition() :
+ this.hideModal()
+ }
+
+ , enforceFocus: function () {
+ var that = this
+ $(document).on('focusin.modal', function (e) {
+ if (that.$element[0] !== e.target && !that.$element.has(e.target).length) {
+ that.$element.focus()
+ }
+ })
+ }
+
+ , escape: function () {
+ var that = this
+ if (this.isShown && this.options.keyboard) {
+ this.$element.on('keyup.dismiss.modal', function ( e ) {
+ e.which == 27 && that.hide()
+ })
+ } else if (!this.isShown) {
+ this.$element.off('keyup.dismiss.modal')
+ }
+ }
+
+ , hideWithTransition: function () {
+ var that = this
+ , timeout = setTimeout(function () {
+ that.$element.off($.support.transition.end)
+ that.hideModal()
+ }, 500)
+
+ this.$element.one($.support.transition.end, function () {
+ clearTimeout(timeout)
+ that.hideModal()
+ })
+ }
+
+ , hideModal: function (that) {
+ this.$element
+ .hide()
+ .trigger('hidden')
+
+ this.backdrop()
+ }
+
+ , removeBackdrop: function () {
+ this.$backdrop.remove()
+ this.$backdrop = null
+ }
+
+ , backdrop: function (callback) {
+ var that = this
+ , animate = this.$element.hasClass('fade') ? 'fade' : ''
+
+ if (this.isShown && this.options.backdrop) {
+ var doAnimate = $.support.transition && animate
+
+ this.$backdrop = $('<div class="modal-backdrop ' + animate + '" />')
+ .appendTo(document.body)
+
+ if (this.options.backdrop != 'static') {
+ this.$backdrop.click($.proxy(this.hide, this))
+ }
+
+ if (doAnimate) this.$backdrop[0].offsetWidth // force reflow
+
+ this.$backdrop.addClass('in')
+
+ doAnimate ?
+ this.$backdrop.one($.support.transition.end, callback) :
+ callback()
+
+ } else if (!this.isShown && this.$backdrop) {
+ this.$backdrop.removeClass('in')
+
+ $.support.transition && this.$element.hasClass('fade')?
+ this.$backdrop.one($.support.transition.end, $.proxy(this.removeBackdrop, this)) :
+ this.removeBackdrop()
+
+ } else if (callback) {
+ callback()
+ }
+ }
+ }
+
+
+ /* MODAL PLUGIN DEFINITION
+ * ======================= */
+
+ $.fn.modal = function (option) {
+ return this.each(function () {
+ var $this = $(this)
+ , data = $this.data('modal')
+ , options = $.extend({}, $.fn.modal.defaults, $this.data(), typeof option == 'object' && option)
+ if (!data) $this.data('modal', (data = new Modal(this, options)))
+ if (typeof option == 'string') data[option]()
+ else if (options.show) data.show()
+ })
+ }
+
+ $.fn.modal.defaults = {
+ backdrop: true
+ , keyboard: true
+ , show: true
+ }
+
+ $.fn.modal.Constructor = Modal
+
+
+ /* MODAL DATA-API
+ * ============== */
+
+ $(function () {
+ $('body').on('click.modal.data-api', '[data-toggle="modal"]', function ( e ) {
+ var $this = $(this)
+ , href = $this.attr('href')
+ , $target = $($this.attr('data-target') || (href && href.replace(/.*(?=#[^\s]+$)/, ''))) //strip for ie7
+ , option = $target.data('modal') ? 'toggle' : $.extend({ remote: !/#/.test(href) && href }, $target.data(), $this.data())
+
+ e.preventDefault()
+
+ $target
+ .modal(option)
+ .one('hide', function () {
+ $this.focus()
+ })
+ })
+ })
+
+}(window.jQuery);
View
103 .../lib/padrino-admin/generators/templates/assets/javascripts/bootstrap/bootstrap-popover.js
@@ -0,0 +1,103 @@
+/* ===========================================================
+ * bootstrap-popover.js v2.1.1
+ * http://twitter.github.com/bootstrap/javascript.html#popovers
+ * ===========================================================
+ * Copyright 2012 Twitter, Inc.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * =========================================================== */
+
+
+!function ($) {
+
+ "use strict"; // jshint ;_;
+
+
+ /* POPOVER PUBLIC CLASS DEFINITION
+ * =============================== */
+
+ var Popover = function (element, options) {
+ this.init('popover', element, options)
+ }
+
+
+ /* NOTE: POPOVER EXTENDS BOOTSTRAP-TOOLTIP.js
+ ========================================== */
+
+ Popover.prototype = $.extend({}, $.fn.tooltip.Constructor.prototype, {
+
+ constructor: Popover
+
+ , setContent: function () {
+ var $tip = this.tip()
+ , title = this.getTitle()
+ , content = this.getContent()
+
+ $tip.find('.popover-title')[this.options.html ? 'html' : 'text'](title)
+ $tip.find('.popover-content > *')[this.options.html ? 'html' : 'text'](content)
+
+ $tip.removeClass('fade top bottom left right in')
+ }
+
+ , hasContent: function () {
+ return this.getTitle() || this.getContent()
+ }
+
+ , getContent: function () {
+ var content
+ , $e = this.$element
+ , o = this.options
+
+ content = $e.attr('data-content')
+ || (typeof o.content == 'function' ? o.content.call($e[0]) : o.content)
+
+ return content
+ }
+
+ , tip: function () {
+ if (!this.$tip) {
+ this.$tip = $(this.options.template)
+ }
+ return this.$tip
+ }
+
+ , destroy: function () {
+ this.hide().$element.off('.' + this.type).removeData(this.type)
+ }
+
+ })
+
+
+ /* POPOVER PLUGIN DEFINITION
+ * ======================= */
+
+ $.fn.popover = function (option) {
+ return this.each(function () {
+ var $this = $(this)
+ , data = $this.data('popover')
+ , options = typeof option == 'object' && option
+ if (!data) $this.data('popover', (data = new Popover(this, options)))
+ if (typeof option == 'string') data[option]()
+ })
+ }
+
+ $.fn.popover.Constructor = Popover
+
+ $.fn.popover.defaults = $.extend({} , $.fn.tooltip.defaults, {
+ placement: 'right'
+ , trigger: 'click'
+ , content: ''
+ , template: '<div class="popover"><div class="arrow"></div><div class="popover-inner"><h3 class="popover-title"></h3><div class="popover-content"><p></p></div></div></div>'
+ })
+
+}(window.jQuery);
View
151 ...ib/padrino-admin/generators/templates/assets/javascripts/bootstrap/bootstrap-scrollspy.js
@@ -0,0 +1,151 @@
+/* =============================================================
+ * bootstrap-scrollspy.js v2.1.1
+ * http://twitter.github.com/bootstrap/javascript.html#scrollspy
+ * =============================================================
+ * Copyright 2012 Twitter, Inc.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============================================================== */
+
+
+!function ($) {
+
+ "use strict"; // jshint ;_;
+
+
+ /* SCROLLSPY CLASS DEFINITION
+ * ========================== */
+
+ function ScrollSpy(element, options) {
+ var process = $.proxy(this.process, this)
+ , $element = $(element).is('body') ? $(window) : $(element)
+ , href
+ this.options = $.extend({}, $.fn.scrollspy.defaults, options)
+ this.$scrollElement = $element.on('scroll.scroll-spy.data-api', process)
+ this.selector = (this.options.target
+ || ((href = $(element).attr('href')) && href.replace(/.*(?=#[^\s]+$)/, '')) //strip for ie7
+ || '') + ' .nav li > a'
+ this.$body = $('body')
+ this.refresh()
+ this.process()
+ }
+
+ ScrollSpy.prototype = {
+
+ constructor: ScrollSpy
+
+ , refresh: function () {
+ var self = this
+ , $targets
+
+ this.offsets = $([])
+ this.targets = $([])
+
+ $targets = this.$body
+ .find(this.selector)
+ .map(function () {
+ var $el = $(this)
+ , href = $el.data('target') || $el.attr('href')
+ , $href = /^#\w/.test(href) && $(href)
+ return ( $href
+ && $href.length
+ && [[ $href.position().top, href ]] ) || null
+ })
+ .sort(function (a, b) { return a[0] - b[0] })
+ .each(function () {
+ self.offsets.push(this[0])
+ self.targets.push(this[1])
+ })
+ }
+
+ , process: function () {
+ var scrollTop = this.$scrollElement.scrollTop() + this.options.offset
+ , scrollHeight = this.$scrollElement[0].scrollHeight || this.$body[0].scrollHeight
+ , maxScroll = scrollHeight - this.$scrollElement.height()
+ , offsets = this.offsets
+ , targets = this.targets
+ , activeTarget = this.activeTarget
+ , i
+
+ if (scrollTop >= maxScroll) {
+ return activeTarget != (i = targets.last()[0])
+ && this.activate ( i )
+ }
+
+ for (i = offsets.length; i--;) {
+ activeTarget != targets[i]
+ && scrollTop >= offsets[i]
+ && (!offsets[i + 1] || scrollTop <= offsets[i + 1])
+ && this.activate( targets[i] )
+ }
+ }
+
+ , activate: function (target) {
+ var active
+ , selector
+
+ this.activeTarget = target
+
+ $(this.selector)
+ .parent('.active')
+ .removeClass('active')
+
+ selector = this.selector
+ + '[data-target="' + target + '"],'
+ + this.selector + '[href="' + target + '"]'
+
+ active = $(selector)
+ .parent('li')
+ .addClass('active')
+
+ if (active.parent('.dropdown-menu').length) {
+ active = active.closest('li.dropdown').addClass('active')
+ }
+
+ active.trigger('activate')
+ }
+
+ }
+
+
+ /* SCROLLSPY PLUGIN DEFINITION
+ * =========================== */
+
+ $.fn.scrollspy = function (option) {
+ return this.each(function () {
+ var $this = $(this)
+ , data = $this.data('scrollspy')
+ , options = typeof option == 'object' && option
+ if (!data) $this.data('scrollspy', (data = new ScrollSpy(this, options)))
+ if (typeof option == 'string') data[option]()
+ })
+ }
+
+ $.fn.scrollspy.Constructor = ScrollSpy
+
+ $.fn.scrollspy.defaults = {
+ offset: 10
+ }
+
+
+ /* SCROLLSPY DATA-API
+ * ================== */
+
+ $(window).on('load', function () {
+ $('[data-spy="scroll"]').each(function () {
+ var $spy = $(this)
+ $spy.scrollspy($spy.data())
+ })
+ })
+
+}(window.jQuery);
View
135 ...dmin/lib/padrino-admin/generators/templates/assets/javascripts/bootstrap/bootstrap-tab.js
@@ -0,0 +1,135 @@
+/* ========================================================
+ * bootstrap-tab.js v2.1.1
+ * http://twitter.github.com/bootstrap/javascript.html#tabs
+ * ========================================================
+ * Copyright 2012 Twitter, Inc.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ======================================================== */
+
+
+!function ($) {
+
+ "use strict"; // jshint ;_;
+
+
+ /* TAB CLASS DEFINITION
+ * ==================== */
+
+ var Tab = function (element) {
+ this.element = $(element)
+ }
+
+ Tab.prototype = {
+
+ constructor: Tab
+
+ , show: function () {
+ var $this = this.element
+ , $ul = $this.closest('ul:not(.dropdown-menu)')
+ , selector = $this.attr('data-target')
+ , previous
+ , $target
+ , e
+