diff --git a/padrino-admin/lib/padrino-admin/generators/templates/assets/javascripts/model-selector.js b/padrino-admin/lib/padrino-admin/generators/templates/assets/javascripts/model-selector.js new file mode 100644 index 000000000..a6ab0cedc --- /dev/null +++ b/padrino-admin/lib/padrino-admin/generators/templates/assets/javascripts/model-selector.js @@ -0,0 +1,13 @@ +!function($) { + 'use strict'; + + $(function() { + var selector = $("#model-selector"); + selector.change(function(){ + var path = $(this).children(':selected').val(); + if(path !== ""){ + location.href = path; + } + }); + }); +}(window.jQuery); diff --git a/padrino-admin/lib/padrino-admin/generators/templates/erb/app/layouts/application.erb.tt b/padrino-admin/lib/padrino-admin/generators/templates/erb/app/layouts/application.erb.tt index fd6a8dd20..ccf7f2235 100644 --- a/padrino-admin/lib/padrino-admin/generators/templates/erb/app/layouts/application.erb.tt +++ b/padrino-admin/lib/padrino-admin/generators/templates/erb/app/layouts/application.erb.tt @@ -24,16 +24,22 @@ -
@@ -59,6 +65,6 @@ - <%%= javascript_include_tag 'jquery-1.11.0.min', (Padrino.env == :production ? 'bootstrap/bootstrap.min' : %w[bootstrap/affix bootstrap/alert bootstrap/button bootstrap/carousel bootstrap/collapse bootstrap/dropdown bootstrap/tooltip bootstrap/transition bootstrap/modal bootstrap/popover bootstrap/scrollspy bootstrap/tab]), :application %> + <%%= javascript_include_tag 'jquery-1.11.0.min', (Padrino.env == :production ? 'bootstrap/bootstrap.min' : %w[bootstrap/affix bootstrap/alert bootstrap/button bootstrap/carousel bootstrap/collapse bootstrap/dropdown bootstrap/tooltip bootstrap/transition bootstrap/modal bootstrap/popover bootstrap/scrollspy bootstrap/tab]), :application, 'model-selector'%>