From: Tomas Sedovic tsedovic@redhat.com
To ease the transition towards the new UI, we need to keep the old UI in place and add a way to switch to the new one.
This adds an empty new layout and a link to the top of every page that switches between them. --- src/app/controllers/application_controller.rb | 6 ++++- src/app/views/layouts/aggregator.haml | 2 + src/app/views/layouts/dashboard.haml | 18 ---------------- src/app/views/layouts/newui.haml | 28 +++++++++++++++++++++++++ 4 files changed, 35 insertions(+), 19 deletions(-) delete mode 100644 src/app/views/layouts/dashboard.haml create mode 100644 src/app/views/layouts/newui.haml
diff --git a/src/app/controllers/application_controller.rb b/src/app/controllers/application_controller.rb index 0b8a015..7d0e931 100644 --- a/src/app/controllers/application_controller.rb +++ b/src/app/controllers/application_controller.rb @@ -41,7 +41,11 @@ class ApplicationController < ActionController::Base if(params[:component_layout]) return (ENV["RAILS_ENV"] != "production")?'components/' << params[:component_layout]:'aggregator' end - @layout = 'aggregator' + if cookies[:layout] + @layout = cookies[:layout] + else + @layout = 'aggregator' + end return @layout end
diff --git a/src/app/views/layouts/aggregator.haml b/src/app/views/layouts/aggregator.haml index 925e9a8..711f87e 100644 --- a/src/app/views/layouts/aggregator.haml +++ b/src/app/views/layouts/aggregator.haml @@ -22,6 +22,8 @@ /= javascript_include_tag "jquery.html5form" = yield :scripts %body{:id => controller.section_id} + %a{ :href => '', :onClick => "document.cookie = 'layout=newui'"} + Switch to the New UI %div#head %header.container_16 = render :partial => '/layouts/header' diff --git a/src/app/views/layouts/dashboard.haml b/src/app/views/layouts/dashboard.haml deleted file mode 100644 index 3b4e7c3..0000000 --- a/src/app/views/layouts/dashboard.haml +++ /dev/null @@ -1,18 +0,0 @@ -- content_for :scripts do - :javascript - $(document).ready(function() { - $("#dashboard-tabs > ul > li > a").each(function(index) { - var link = $(this).attr("href") + "?ajax=true"; - $(this).attr("href", link); - }); - $("#dashboard-tabs").tabs(); - - // when JS is enabled, hide the Dashboard content -- it'll be loaded - // by jquery UI tab using ajax - $("#dashboard-content").hide(); - }); -- content_for :content do - = render :partial => 'dashboard_nav' - #dashboard-content - = yield -= render :file => 'layouts/aggregator' diff --git a/src/app/views/layouts/newui.haml b/src/app/views/layouts/newui.haml new file mode 100644 index 0000000..c50d9a8 --- /dev/null +++ b/src/app/views/layouts/newui.haml @@ -0,0 +1,28 @@ +!!! +%html + %head + %meta(http-equiv="Content-Type" content="text/html; charset=UTF-8") + %title + Red Hat Cloud Engine + = yield :title + + = stylesheet_link_tag 'facebox' + = stylesheet_link_tag 'jquery.ui-1.8.1/jquery-ui-1.8.1.custom.css' + = stylesheet_link_tag 'jquery.loadmask' + = stylesheet_link_tag 'compiled/aggregator' + + / [if lt IE 9] + = javascript_include_tag "http://html5shiv.googlecode.com/svn/trunk/html5.js" + = javascript_include_tag "jquery-1.4.2.min.js" + = javascript_include_tag "application.js" + = javascript_include_tag "facebox.js" + = javascript_include_tag "jquery.ui-1.8.1/jquery-ui-1.8.1.custom.min.js" + = javascript_include_tag "jquery.loadmask.min" + = javascript_include_tag "modernizr-1.5" + /= javascript_include_tag "jquery.html5form" + = yield :scripts + %body{:id => controller.section_id} + %a{ :href => '', :onClick => "document.cookie = 'layout=aggregator'"} + Switch to the old UI + %h1 New UI + = yield