[PATCH conductor 05/15] Add ProviderSelectionController

ifarkas at redhat.com ifarkas at redhat.com
Sun Jul 22 10:16:25 UTC 2012


From: Imre Farkas <ifarkas at redhat.com>

---
 .../controllers/provider_selections_controller.rb  |   41 ++++++++++++++++++++
 .../provider_selections/edit_strategy.html.haml    |   14 +++++++
 src/app/views/provider_selections/show.html.haml   |   22 +++++++++++
 3 files changed, 77 insertions(+)
 create mode 100644 src/app/controllers/provider_selections_controller.rb
 create mode 100644 src/app/views/provider_selections/edit_strategy.html.haml
 create mode 100644 src/app/views/provider_selections/show.html.haml

diff --git a/src/app/controllers/provider_selections_controller.rb b/src/app/controllers/provider_selections_controller.rb
new file mode 100644
index 0000000..7ae67e2
--- /dev/null
+++ b/src/app/controllers/provider_selections_controller.rb
@@ -0,0 +1,41 @@
+#
+#   Copyright 2012 Red Hat, Inc.
+#
+#   Licensed under the Apache License, Version 2.0 (the "License");
+#   you may not use this file except in compliance with the License.
+#   You may obtain a copy of the License at
+#
+#       http://www.apache.org/licenses/LICENSE-2.0
+#
+#   Unless required by applicable law or agreed to in writing, software
+#   distributed under the License is distributed on an "AS IS" BASIS,
+#   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+#   See the License for the specific language governing permissions and
+#   limitations under the License.
+#
+
+class ProviderSelectionsController < ApplicationController
+
+  before_filter :require_user
+  before_filter :set_view_path
+
+  def show
+    @pool = Pool.find(params[:pool_id])
+    @environment = @pool.pool_family
+  end
+
+  def edit_strategy
+    @pool = Pool.find(params[:pool_id])
+    @strategy = ProviderSelection::Base.find_strategy_by_name(params[:name])
+    @priority_groups = @pool.provider_priority_groups
+  end
+
+  private
+
+  def set_view_path
+    ProviderSelection::Base.view_paths.each do |view_path|
+      append_view_path(view_path)
+    end
+  end
+
+end
\ No newline at end of file
diff --git a/src/app/views/provider_selections/edit_strategy.html.haml b/src/app/views/provider_selections/edit_strategy.html.haml
new file mode 100644
index 0000000..ae51a43
--- /dev/null
+++ b/src/app/views/provider_selections/edit_strategy.html.haml
@@ -0,0 +1,14 @@
+= render :partial => 'layouts/admin_nav'
+
+%header.page-header
+  .obj_actions
+    .return_to
+      = t(:return_to)
+      = link_to t('provider_selection.edit_stategy.strategies', :pool => @pool.name), pool_provider_selection_path(@pool)
+  %h1.no-icon= t('provider_selection.show.provider_selection')
+
+%section.content-section
+  %header
+    %h2=t t('provider_selection.show.edit_strategy', :name => @strategy.translated_name)
+  .content
+    = render :partial => "#{@strategy.name}/form"
diff --git a/src/app/views/provider_selections/show.html.haml b/src/app/views/provider_selections/show.html.haml
new file mode 100644
index 0000000..c10014c
--- /dev/null
+++ b/src/app/views/provider_selections/show.html.haml
@@ -0,0 +1,22 @@
+= render :partial => 'layouts/admin_nav'
+
+%header.page-header
+  .obj_actions
+    .return_to
+      = t(:return_to)
+      = link_to t('provider_selection.show.environment', :environment => @environment.name), pool_family_path(@environment)
+  %h1.no-icon= t('provider_selection.show.provider_selection')
+
+%section.content-section
+  %header
+    %h2=t 'Available Strategies'
+  .content
+    %table.flat
+      %thead
+      %tbody
+        %tr
+          %td= link_to(t('provider_selection.show.strategies.strict_order'), pool_provider_selection_provider_priority_groups_path(@pool))
+        - ProviderSelection::Base.strategies.each do |strategy|
+          - if strategy.include_in_listings
+            %tr
+              %td= link_to(strategy.translated_name, edit_strategy_pool_provider_selection_path(:name => strategy.name))
-- 
1.7.10.4




More information about the aeolus-devel mailing list