examples/config.rb in rack-jquery_ui-2.2.0 vs examples/config.rb in rack-jquery_ui-3.0.0

- old
+ new

@@ -7,113 +7,144 @@ enable :inline_templates use Rack::JQuery use Rack::JQueryUI + %w{google media_temple microsoft cloudflare unspecified}.each do |name| + + get "/#{name}-cdn" do + haml :accordion, :layout => name.to_sym + end + end + get "/" do haml :index, :layout => :unspecified end - get "/google-cdn" do - haml :accordion, :layout => :google + get "/fallback-only" do + haml :accordion, :layout => :fallback end - get "/media-temple-cdn" do - haml :accordion, :layout => :mediatemple + get "/ui/:plugin" do |plugin| + haml plugin.to_sym, :layout => :ui end +end - get "/microsoft-cdn" do - haml :accordion, :layout => :microsoft +class AppWithDefaults < Sinatra::Base + + enable :inline_templates + use Rack::JQuery + use Rack::JQueryUI, :organisation => :cloudflare + + %w{google media_temple microsoft cloudflare unspecified}.each do |name| + + get "/#{name}-cdn" do + haml :accordion, :layout => name.to_sym + end end - get "/cloudflare-cdn" do - haml :accordion, :layout => :cloudflare + get "/" do + haml :index, :layout => :unspecified end - get "/unspecified-cdn" do - haml :accordion, :layout => :unspecified + get "/fallback-only" do + haml :accordion, :layout => :fallback end get "/ui/:plugin" do |plugin| haml plugin.to_sym, :layout => :ui end + end __END__ @@google %html %head - = Rack::JQuery.cdn( :google ) - = Rack::JQueryUI.cdn( :google ) - %link{ href: "http://code.jquery.com/ui/#{Rack::JQueryUI::JQUERY_UI_VERSION}/themes/base/jquery-ui.css", rel: "stylesheet"} + = Rack::JQuery.cdn( env, :organisation => :google ) + = Rack::JQueryUI.cdn( env, :organisation => :google ) + %link{ href: "http://code.jquery.com/ui/#{Rack::JQueryUI::JQUERY_UI_VERSION}/themes/smoothness/jquery-ui.css", rel: "stylesheet"} :css body { font-family: "Trebuchet MS", "Helvetica", "Arial", "Verdana", "sans-serif"; font-size: 62.5%; } = yield @@microsoft %html %head - = Rack::JQuery.cdn( :microsoft ) - = Rack::JQueryUI.cdn( :microsoft ) - %link{ href: "http://code.jquery.com/ui/#{Rack::JQueryUI::JQUERY_UI_VERSION}/themes/base/jquery-ui.css", rel: "stylesheet"} + = Rack::JQuery.cdn( env, :organisation => :microsoft ) + = Rack::JQueryUI.cdn( env, :organisation => :microsoft ) + %link{ href: "http://code.jquery.com/ui/#{Rack::JQueryUI::JQUERY_UI_VERSION}/themes/smoothness/jquery-ui.css", rel: "stylesheet"} :css body { font-family: "Trebuchet MS", "Helvetica", "Arial", "Verdana", "sans-serif"; font-size: 62.5%; } = yield @@cloudflare %html %head - = Rack::JQuery.cdn( :cloudflare ) - = Rack::JQueryUI.cdn( :cloudflare ) - %link{ href: "http://code.jquery.com/ui/#{Rack::JQueryUI::JQUERY_UI_VERSION}/themes/base/jquery-ui.css", rel: "stylesheet"} + = Rack::JQuery.cdn( env, :organisation => :cloudflare ) + = Rack::JQueryUI.cdn( env, :organisation => :cloudflare ) + %link{ href: "http://code.jquery.com/ui/#{Rack::JQueryUI::JQUERY_UI_VERSION}/themes/smoothness/jquery-ui.css", rel: "stylesheet"} :css body { font-family: "Trebuchet MS", "Helvetica", "Arial", "Verdana", "sans-serif"; font-size: 62.5%; } = yield -@@mediatemple +@@media_temple %html %head - = Rack::JQuery.cdn( :media_temple ) - = Rack::JQueryUI.cdn( :media_temple ) - %link{ href: "http://code.jquery.com/ui/#{Rack::JQueryUI::JQUERY_UI_VERSION}/themes/base/jquery-ui.css", rel: "stylesheet"} + = Rack::JQuery.cdn( env, :organisation => :media_temple ) + = Rack::JQueryUI.cdn( env, :organisation => :media_temple ) + %link{ href: "http://code.jquery.com/ui/#{Rack::JQueryUI::JQUERY_UI_VERSION}/themes/smoothness/jquery-ui.css", rel: "stylesheet"} :css body { font-family: "Trebuchet MS", "Helvetica", "Arial", "Verdana", "sans-serif"; font-size: 62.5%; } = yield @@unspecified %html %head - = Rack::JQuery.cdn() - = Rack::JQueryUI.cdn() - %link{ href: "http://code.jquery.com/ui/#{Rack::JQueryUI::JQUERY_UI_VERSION}/themes/base/jquery-ui.css", rel: "stylesheet"} + = Rack::JQuery.cdn(env) + = Rack::JQueryUI.cdn(env) + %link{ href: "http://code.jquery.com/ui/#{Rack::JQueryUI::JQUERY_UI_VERSION}/themes/smoothness/jquery-ui.css", rel: "stylesheet"} :css body { font-family: "Trebuchet MS", "Helvetica", "Arial", "Verdana", "sans-serif"; font-size: 62.5%; } %body = yield +@@fallback +%html + %head + = Rack::JQuery.cdn env + = Rack::JQueryUI.cdn( env, :organisation => false ) + %link{ href: "http://code.jquery.com/ui/#{Rack::JQueryUI::JQUERY_UI_VERSION}/themes/smoothness/jquery-ui.css", rel: "stylesheet"} + :css + body { + font-family: "Trebuchet MS", "Helvetica", "Arial", "Verdana", "sans-serif"; + font-size: 62.5%; + } + = yield + @@ui %html %head - = Rack::JQuery.cdn() - = Rack::JQueryUI.cdn() - %link{ href: "http://code.jquery.com/ui/#{Rack::JQueryUI::JQUERY_UI_VERSION}/themes/base/jquery-ui.css", rel: "stylesheet"} + = Rack::JQuery.cdn(env) + = Rack::JQueryUI.cdn(env) + %link{ href: "http://code.jquery.com/ui/#{Rack::JQueryUI::JQUERY_UI_VERSION}/themes/smoothness/jquery-ui.css", rel: "stylesheet"} :css body { font-family: "Trebuchet MS", "Helvetica", "Arial", "Verdana", "sans-serif"; font-size: 62.5%; } @@ -134,9 +165,12 @@ %a{ href: "/cloudflare-cdn" } cloudflare-cdn %p %a{ href: "/unspecified-cdn" } unspecified-cdn +%p + %a{ href: "/fallback-only" } + forced fallback %p %a{ href: "/ui/accordion" } accordion @@accordion \ No newline at end of file