ACK, one really tiny nit:
maybe instead of view code:
- if controller.respond_to?(:section_id)
- section_id = controller.section_id
- else
- section_id = "generic"
it could be nicer to define:
def section_id
'generic'
end
in ApplicationController.
But it doesn't matter, this way works too.
On 09/29/2010 03:25 PM, [email protected] wrote:
> From: Tomas Sedovic<[email protected]>
>
> We have four main sections: operation, administration, build and runtime.
> Each has a different colour for the second-level navigation stripe.
>
> Unfortunately, the current navigation system doesn't give us a way to find out
> which section each view belongs to.
>
> This makes the controllers to tell the views the current section. The views
> can then set appropriate classes to the rendered objects.
> ---
> src/app/controllers/image_controller.rb | 4 ++++
> src/app/controllers/instance_controller.rb | 4 ++++
> src/app/controllers/pools_controller.rb | 4 ++++
> src/app/controllers/provider_controller.rb | 4 ++++
> src/app/controllers/templates_controller.rb | 4 ++++
> 5 files changed, 20 insertions(+), 0 deletions(-)
>
> diff --git a/src/app/controllers/image_controller.rb
> b/src/app/controllers/image_controller.rb
> index e399225..6e3f932 100644
> --- a/src/app/controllers/image_controller.rb
> +++ b/src/app/controllers/image_controller.rb
> @@ -22,6 +22,10 @@
> class ImageController< ApplicationController
> before_filter :require_user
>
> + def section_id
> + 'build'
> + end
> +
> def index
> end
>
> diff --git a/src/app/controllers/instance_controller.rb
> b/src/app/controllers/instance_controller.rb
> index c82d378..68d5e22 100644
> --- a/src/app/controllers/instance_controller.rb
> +++ b/src/app/controllers/instance_controller.rb
> @@ -25,6 +25,10 @@ class InstanceController< ApplicationController
> before_filter :require_user, :get_nav_items
> layout :layout
>
> + def section_id
> + 'runtime'
> + end
> +
> def layout
> return "aggregator" unless request.xhr?
> end
> diff --git a/src/app/controllers/pools_controller.rb
> b/src/app/controllers/pools_controller.rb
> index 84523d7..ee95643 100644
> --- a/src/app/controllers/pools_controller.rb
> +++ b/src/app/controllers/pools_controller.rb
> @@ -24,6 +24,10 @@ require 'util/condormatic'
> class PoolsController< ApplicationController
> before_filter :require_user, :get_nav_items
>
> + def section_id
> + 'administration'
> + end
> +
> def index
> @header = [
> { :name => "Pool name", :sort_attr => :name },
> diff --git a/src/app/controllers/provider_controller.rb
> b/src/app/controllers/provider_controller.rb
> index 1bdbf86..61bdfdf 100644
> --- a/src/app/controllers/provider_controller.rb
> +++ b/src/app/controllers/provider_controller.rb
> @@ -23,6 +23,10 @@ class ProviderController< ApplicationController
> before_filter :require_user
> before_filter :load_providers, :only => [:index, :show, :accounts, :list]
>
> + def section_id
> + 'administration'
> + end
> +
> def index
> end
>
> diff --git a/src/app/controllers/templates_controller.rb
> b/src/app/controllers/templates_controller.rb
> index 78113bf..364bab5 100644
> --- a/src/app/controllers/templates_controller.rb
> +++ b/src/app/controllers/templates_controller.rb
> @@ -4,6 +4,10 @@ class TemplatesController< ApplicationController
> before_filter :require_user
> before_filter :check_permission, :except => [:index, :builds]
>
> + def section_id
> + 'build'
> + end
> +
> def index
> # TODO: add template permission check
> require_privilege(Privilege::IMAGE_VIEW)
_______________________________________________
deltacloud-devel mailing list
[email protected]
https://fedorahosted.org/mailman/listinfo/deltacloud-devel