--- src/app/controllers/providers_controller.rb | 5 +++-- src/app/controllers/realms_controller.rb | 4 ++-- src/app/views/realm_mappings/new.haml | 26 ++++++++++++++------------ src/app/views/realms/_form.haml | 2 +- src/app/views/realms/_list.haml | 4 ++-- src/app/views/realms/_section_header.haml | 3 +-- src/app/views/realms/edit.haml | 5 ++--- src/app/views/realms/new.haml | 15 ++++++++------- src/app/views/realms/show.haml | 15 ++++++--------- src/config/navigation.rb | 2 +- src/config/routes.rb | 2 -- 11 files changed, 40 insertions(+), 43 deletions(-)
diff --git a/src/app/controllers/providers_controller.rb b/src/app/controllers/providers_controller.rb index 8cbfd83..2b7b7fd 100644 --- a/src/app/controllers/providers_controller.rb +++ b/src/app/controllers/providers_controller.rb @@ -62,7 +62,7 @@ class ProvidersController < ApplicationController end #TODO add links to real data for history,properties,permissions @tabs = [{:name => 'Connectivity', :view => @view, :id => 'connectivity', :count => @provider.provider_accounts.count}, - {:name => 'Realms', :view => @view, :id => 'realms', :count => @provider.realms.count}, + {:name => 'Realms', :view => @view, :id => 'realms', :count => @provider.frontend_realms.count}, {:name => 'Hardware', :view => @view, :id => 'hardware_profiles', :count => @provider.hardware_profiles.count}, {:name => 'Roles & Permissions', :view => @view, :id => 'roles', :count => @provider.permissions.count}, ] @@ -70,7 +70,8 @@ class ProvidersController < ApplicationController @details_tab = @tabs.find {|t| t[:id] == details_tab_name} || @tabs.first[:name].downcase
@provider_accounts = @provider.provider_accounts if @details_tab[:id] == 'connectivity' - @realms = @provider.realms if @details_tab[:id] == 'realms' + #@realms = @provider.realms if @details_tab[:id] == 'realms' + @realms = @provider.frontend_realms if @details_tab[:id] == 'realms' @hardware_profiles = @provider.hardware_profiles if @details_tab[:id] == 'hardware_profiles' #@permissions = @provider.permissions if @details_tab[:id] == 'roles'
diff --git a/src/app/controllers/realms_controller.rb b/src/app/controllers/realms_controller.rb index e3f5de8..8e707b6 100644 --- a/src/app/controllers/realms_controller.rb +++ b/src/app/controllers/realms_controller.rb @@ -27,7 +27,7 @@ class RealmsController < ApplicationController
def new require_privilege(Privilege::CREATE, Realm) - @provider = Provider.find(params[:provider_id]) + #@provider = Provider.find(params[:provider_id]) @realm = FrontendRealm.new load_backend_realms end @@ -57,7 +57,7 @@ class RealmsController < ApplicationController
def create require_privilege(Privilege::CREATE, Realm) - @provider = Provider.find(params[:provider_id]) + #@provider = Provider.find(params[:provider_id]) @realm = FrontendRealm.new(params[:frontend_realm]) if @realm.save flash[:notice] = "Realm was added." diff --git a/src/app/views/realm_mappings/new.haml b/src/app/views/realm_mappings/new.haml index b8a6980..9138165 100644 --- a/src/app/views/realm_mappings/new.haml +++ b/src/app/views/realm_mappings/new.haml @@ -1,15 +1,17 @@ = render :partial => 'layouts/admin_nav' -%div#view +%header.admin-page-header +%section.admin-content-section + %header + %h2 Create a new Realm Mapping + .content + - if @realm_target.errors.any? + = render 'layouts/error_messages', :object => @realm_target
-- if @realm_target.errors.any? - = render 'layouts/error_messages', :object => @realm_target + = form_for @realm_target, :url => realm_mappings_path do |f| + = f.hidden_field :frontend_realm_id + = f.hidden_field :realm_or_provider_type
-%h2 Create a new Realm Mapping -= form_for @realm_target, :url => realm_mappings_path do |f| - = f.hidden_field :frontend_realm_id - = f.hidden_field :realm_or_provider_type - - - label_method = @realm_target.realm_or_provider_type == 'Realm' ? 'name_with_provider' : 'name' - = select_tag 'realm_backend_target[realm_or_provider_id]', options_from_collection_for_select(@backend_targets, 'id', label_method) - %fieldset - = f.submit "Save", :class => "submit button" + - label_method = @realm_target.realm_or_provider_type == 'Realm' ? 'name_with_provider' : 'name' + = select_tag 'realm_backend_target[realm_or_provider_id]', options_from_collection_for_select(@backend_targets, 'id', label_method) + %fieldset + = f.submit "Save", :class => "submit button" diff --git a/src/app/views/realms/_form.haml b/src/app/views/realms/_form.haml index 1a79296..dd4d75b 100644 --- a/src/app/views/realms/_form.haml +++ b/src/app/views/realms/_form.haml @@ -4,4 +4,4 @@ = form.label :name, 'Realm Name' = form.text_field :name, :title => 'realm_name', :value => @realm.name, :class => 'em long' %fieldset.options - = form.submit "Save", :class => "submit button" + = form.submit "Save", :class => "submit button pill" diff --git a/src/app/views/realms/_list.haml b/src/app/views/realms/_list.haml index 439db54..20ecdcd 100644 --- a/src/app/views/realms/_list.haml +++ b/src/app/views/realms/_list.haml @@ -1,11 +1,11 @@ .content - content_for :form_header do %li= restful_submit_tag "Delete Selected", "destroy", multi_destroy_realms_path, 'DELETE', :id => 'delete_button', :class => 'button pill danger' - %li= link_to "New Realm", new_provider_realm_path(@provider), :id => 'new_realm', :class => 'button pill' + %li= link_to "New Realm", new_realm_path, :id => 'new_realm', :class => 'button pill'
= filter_table(realms_header, @realms) do |realm| %tr{:class => cycle('nostripe','stripe')} %td - selected = params[:select] == 'all' = check_box_tag "realm_selected[]", realm.id, selected, :id => "realm_checkbox_#{realm.id}" - %td= link_to realm.name, provider_realm_path(@provider, realm) + %td= link_to realm.name, realm_path(realm) diff --git a/src/app/views/realms/_section_header.haml b/src/app/views/realms/_section_header.haml index 7230e81..58c358f 100644 --- a/src/app/views/realms/_section_header.haml +++ b/src/app/views/realms/_section_header.haml @@ -1,5 +1,4 @@ -%header.page-header +%header.admin-page-header %h1{:class => controller.controller_name} Realms #obj_actions.button-group = link_to 'New Realm', new_realm_url, :class => 'button primary', :id => 'new_realm_button' - .corner diff --git a/src/app/views/realms/edit.haml b/src/app/views/realms/edit.haml index 064164c..1faac5c 100644 --- a/src/app/views/realms/edit.haml +++ b/src/app/views/realms/edit.haml @@ -1,14 +1,13 @@ = render :partial => 'layouts/admin_nav'
-%header.page-header +%header.admin-page-header %h1{:class => controller.controller_name}= @realm.name #obj_actions.button-container = link_to 'New Realm', new_realm_url, :class => 'button primary', :id => 'new_user_button' %div.button-group = link_to 'Cancel Editing', realm_path(@realm), :class => 'button pill danger', :id => 'new_user_button' - .corner
-%section.content-section.realm +%section.admin-content-section.realm %header %h2 Properties
diff --git a/src/app/views/realms/new.haml b/src/app/views/realms/new.haml index 0de4a0c..a7dddaa 100644 --- a/src/app/views/realms/new.haml +++ b/src/app/views/realms/new.haml @@ -1,10 +1,11 @@ = render :partial => 'layouts/admin_nav' -= render :partial => 'section_header' - -%section.content-section.users - %header - %h2 Create a new Realm +%header.admin-page-header + %h1 Create New Realm + #obj_actions + Return to: + = link_to "Cloud Providers", edit_provider_path(Provider.all.first, :view => 'filter', :details_tab => 'realms'), :class => 'rounded-link'
+%section.admin-content-section.users .content - = form_for [@provider, @realm], :url => realms_path, :html => {:class => 'generic'} do |f| - = render :partial => "form", :locals => { :form => f, :cancel_path => realms_path } + = form_for @realm, :url => realms_path, :html => {:class => 'generic'} do |f| + = render :partial => "form", :locals => { :form => f } diff --git a/src/app/views/realms/show.haml b/src/app/views/realms/show.haml index c70cb5f..c9b933a 100644 --- a/src/app/views/realms/show.haml +++ b/src/app/views/realms/show.haml @@ -1,25 +1,22 @@ = render :partial => 'layouts/admin_nav' -%header.page-header +%header.admin-page-header %h1{:class => controller.controller_name}= @realm.name #obj_actions.button-container = link_to 'New Realm', new_realm_url, :class => 'button primary', :id => 'new_realm_button' .button-group = link_to 'Edit', edit_realm_path(@realm), :class => 'button pill', :id => 'edit_realm_button' - = button_to 'Delete', realm_path(@realm), :method => :delete, :confirm => "Are you sure you want to delete?", :class => 'button pill danger', :id => 'delete_realm_button' - .corner + = link_to 'Delete', realm_path(@realm), :method => :delete, :confirm => "Are you sure you want to delete?", :class => 'button pill danger', :id => 'delete_realm_button'
-%section.content-section.realm +%section.admin-content-section.realm %header %h2 Properties
.content - %div#view - = render :partial => 'properties' + = render :partial => 'properties'
-%section.content-section.realm_mapping +%section.admin-content-section.realm_mapping %header %h2 Realm Mapping
.content - %div#view - = render :partial => 'mapping' + = render :partial => 'mapping' diff --git a/src/config/navigation.rb b/src/config/navigation.rb index e0967a2..e9d2572 100644 --- a/src/config/navigation.rb +++ b/src/config/navigation.rb @@ -25,7 +25,7 @@ SimpleNavigation::Configuration.run do |navigation| second_level.item :users_and_groups, "Users & Groups", users_path, :link => { :class => 'users' }, :highlights_on => //users/ second_level.item :environments, "Environments", settings_path, :link => { :class => 'environments' }, :highlights_on => //settings/ second_level.item :content, "Content", catalogs_path, :link => { :class => 'content' }, :highlights_on => //catalogs|/catalog_entries/ - second_level.item :cloud_providers, "Cloud Providers", providers_path, :link => { :class => 'providers' }, :highlights_on => //providers/ + second_level.item :cloud_providers, "Cloud Providers", providers_path, :link => { :class => 'providers' }, :highlights_on => //providers|/realms|/realm_mappings/ end end end diff --git a/src/config/routes.rb b/src/config/routes.rb index cb9c304..d6e1a2f 100644 --- a/src/config/routes.rb +++ b/src/config/routes.rb @@ -135,8 +135,6 @@ Conductor::Application.routes.draw do get 'set_selected_provider' end end - resources :realms - resources :hardware_profiles end
resources :provider_types, :only => :index