---
src/app/controllers/pools_controller.rb | 6 +++---
src/app/views/deployments/_filter_view.haml | 6 ++++++
src/app/views/deployments/_pretty_view.haml | 8 +++++++-
src/app/views/pools/_history_filter.haml | 6 ++++++
src/app/views/pools/_history_pretty.haml | 6 ++++++
src/app/views/pools/_permissions.haml | 6 ++++++
src/app/views/pools/_properties.haml | 6 ++++++
src/public/javascripts/application.js | 17 +++--------------
8 files changed, 43 insertions(+), 18 deletions(-)
diff --git a/src/app/controllers/pools_controller.rb
b/src/app/controllers/pools_controller.rb
index 8830ab6..95a245b 100644
--- a/src/app/controllers/pools_controller.rb
+++ b/src/app/controllers/pools_controller.rb
@@ -70,9 +70,9 @@ class PoolsController < ApplicationController
end
#TODO add links to real data for history,properties,permissions
@tabs = [{:name => 'Deployments', :view => @view, :id =>
'deployments', :count => @pool.deployments.count},
- {:name => 'History', :view => @view, :id =>
'history'},
- {:name => 'Properties', :view => 'properties', :id
=> 'properties'},
- {:name => 'Permissions', :view => 'permissions', :id
=> 'permissions'}
+ #{:name => 'History', :view => @view, :id =>
'history'},
+ {:name => 'Properties', :view => 'properties', :id
=> 'properties'}
+ #{:name => 'Permissions', :view => 'permissions', :id
=> 'permissions'}
]
details_tab_name = params[:details_tab].blank? ? 'deployments' :
params[:details_tab]
@details_tab = @tabs.find {|t| t[:id] == details_tab_name} ||
@tabs.first[:name].downcase
diff --git a/src/app/views/deployments/_filter_view.haml
b/src/app/views/deployments/_filter_view.haml
index efa9da7..182ad42 100644
--- a/src/app/views/deployments/_filter_view.haml
+++ b/src/app/views/deployments/_filter_view.haml
@@ -12,3 +12,9 @@
= deployment.instances.count
%td
= link_to(deployment.provider.provider_type.name, deployment.provider) if
deployment.provider
+
+- filter_url = url_for(:action => :show, :details_tab =>
'deployments/filter_view', :view => 'filter' )
+- pretty_url = url_for(:action => :show, :details_tab =>
'deployments/pretty_view', :view => 'pretty' )
+
+:javascript
+ Conductor.setupPrettyFilterURL('#{filter_url}','#{pretty_url}')
\ No newline at end of file
diff --git a/src/app/views/deployments/_pretty_view.haml
b/src/app/views/deployments/_pretty_view.haml
index b62f0f8..3977092 100644
--- a/src/app/views/deployments/_pretty_view.haml
+++ b/src/app/views/deployments/_pretty_view.haml
@@ -1 +1,7 @@
-= render :partial => @deployments
\ No newline at end of file
+= render :partial => @deployments
+
+- filter_url = url_for(:action => :show, :details_tab =>
'deployments/filter_view', :view => 'filter' )
+- pretty_url = url_for(:action => :show, :details_tab =>
'deployments/pretty_view', :view => 'pretty' )
+
+:javascript
+ Conductor.setupPrettyFilterURL('#{filter_url}','#{pretty_url}')
\ No newline at end of file
diff --git a/src/app/views/pools/_history_filter.haml
b/src/app/views/pools/_history_filter.haml
index 709dabe..7fc187c 100644
--- a/src/app/views/pools/_history_filter.haml
+++ b/src/app/views/pools/_history_filter.haml
@@ -1,2 +1,8 @@
%h3
History(filter view) has not been implemented yet.
+
+- filter_url = url_for(:action => :show, :details_tab => 'history', :view
=> 'filter' )
+- pretty_url = url_for(:action => :show, :details_tab => 'history', :view
=> 'pretty' )
+
+:javascript
+ Conductor.setupPrettyFilterURL('#{filter_url}','#{pretty_url}')
diff --git a/src/app/views/pools/_history_pretty.haml
b/src/app/views/pools/_history_pretty.haml
index f3aa855..616a049 100644
--- a/src/app/views/pools/_history_pretty.haml
+++ b/src/app/views/pools/_history_pretty.haml
@@ -1,2 +1,8 @@
%h3
History(pretty view) has not been implemented yet.
+
+- filter_url = url_for(:action => :show, :details_tab => 'history', :view
=> 'filter' )
+- pretty_url = url_for(:action => :show, :details_tab => 'history', :view
=> 'pretty' )
+
+:javascript
+ Conductor.setupPrettyFilterURL('#{filter_url}','#{pretty_url}')
\ No newline at end of file
diff --git a/src/app/views/pools/_permissions.haml
b/src/app/views/pools/_permissions.haml
index 43e570f..237bbf7 100644
--- a/src/app/views/pools/_permissions.haml
+++ b/src/app/views/pools/_permissions.haml
@@ -1,2 +1,8 @@
%h3
Permissions have not been implemented yet.
+
+- filter_url = url_for(:action => :show, :details_tab => 'permissions',
:view => 'filter' )
+- pretty_url = url_for(:action => :show, :details_tab => 'permissions',
:view => 'pretty' )
+
+:javascript
+ Conductor.setupPrettyFilterURL('#{filter_url}','#{pretty_url}')
\ No newline at end of file
diff --git a/src/app/views/pools/_properties.haml b/src/app/views/pools/_properties.haml
index 3e757f2..0939d08 100644
--- a/src/app/views/pools/_properties.haml
+++ b/src/app/views/pools/_properties.haml
@@ -2,3 +2,9 @@
Properties for
= @pool.name
= link_to "Edit", edit_pool_path(@pool), { :class => 'button' }
+
+- filter_url = url_for(:action => :show, :details_tab => 'properties',
:view => 'filter' )
+- pretty_url = url_for(:action => :show, :details_tab => 'properties',
:view => 'pretty' )
+
+:javascript
+ Conductor.setupPrettyFilterURL('#{filter_url}','#{pretty_url}')
\ No newline at end of file
diff --git a/src/public/javascripts/application.js
b/src/public/javascripts/application.js
index 38741af..f0dd78d 100644
--- a/src/public/javascripts/application.js
+++ b/src/public/javascripts/application.js
@@ -70,25 +70,14 @@ var Conductor = {
.show();
});
- if ($(this).hasClass("show"))
- $.get('/pools/show/viewstate', function(data){
- var data = JSON.parse(data);
- Conductor.setupToogleTypeViewUrl(data.details_tab);
- });
-
Conductor.tabRemoveActiveClass();
$(this).addClass('active');
});
},
- setupToogleTypeViewUrl: function (tab) {
- var oldPrettyUrl = $("span.view-toggle
a#pretty_view").attr('href');
- var oldFilterUrl = $("span.view-toggle
a#filter_view").attr('href');
- var prettyUrl = oldPrettyUrl.replace(/tab=.*&/, "tab=" + tab +
"&");
- var filterUrl = oldFilterUrl.replace(/tab=.*&/, "tab=" + tab +
"&");
- $("span.view-toggle a#pretty_view").attr('href', prettyUrl);
- $("span.view-toggle a#filter_view").attr('href', filterUrl);
-
+ setupPrettyFilterURL: function (filter_url,pretty_url) {
+ $("span.view-toggle a#pretty_view").attr('href', pretty_url);
+ $("span.view-toggle a#filter_view").attr('href', filter_url);
},
tabRemoveActiveClass: function () {
--
1.7.4.4