[PATCH conductor 2/2] Added support to DeployablesController to handle deployables without catalog

Tomas Hrcka thrcka at redhat.com
Thu Dec 22 14:31:32 UTC 2011


On 12/21/2011 01:49 PM, ifarkas at redhat.com wrote:
> From: Imre Farkas<ifarkas at redhat.com>
>
> ---
>   src/app/controllers/deployables_controller.rb      |   70 +++++++++++++-------
>   src/app/helpers/deployables_helper.rb              |   10 ++-
>   src/app/views/deployables/_form.html.haml          |   10 ++-
>   src/app/views/deployables/_from_url.html.haml      |   13 +++-
>   src/app/views/deployables/_list.html.haml          |   12 ++--
>   src/app/views/deployables/_new.html.haml           |    8 +-
>   .../views/deployables/_section_header.html.haml    |    2 +-
>   src/app/views/deployables/_upload.html.haml        |   13 +++-
>   src/app/views/deployables/edit.html.haml           |    6 +-
>   src/app/views/deployables/show.html.haml           |   11 ++--
>   src/app/views/deployments/_overview.html.haml      |    2 +-
>   src/config/locales/en.yml                          |    2 +
>   src/config/routes.rb                               |   23 +++++--
>   13 files changed, 121 insertions(+), 61 deletions(-)
>
> diff --git a/src/app/controllers/deployables_controller.rb b/src/app/controllers/deployables_controller.rb
> index 9ed1aac..66d157e 100644
> --- a/src/app/controllers/deployables_controller.rb
> +++ b/src/app/controllers/deployables_controller.rb
> @@ -20,11 +20,16 @@ class DeployablesController<  ApplicationController
>
>     def index
>       clear_breadcrumbs
> -    save_breadcrumb(catalog_deployables_path(:viewstate =>  @viewstate ? @viewstate.id : nil))
> -    @catalog = Catalog.find(params[:catalog_id])
> -    @deployables = @catalog.deployables
> -    @catalog_entries = @deployables.collect { |d| d.catalog_entries.first }
> -    #@catalog_entries = CatalogEntry.list_for_user(current_user, Privilege::VIEW).apply_filters(:preset_filter_id =>  params[:catalog_entries_preset_filter], :search_filter =>  params[:catalog_entries_search])
> +    if params[:catalog_id].present?
> +      save_breadcrumb(catalog_deployables_path(:viewstate =>  @viewstate ? @viewstate.id : nil))
> +      @catalog = Catalog.find(params[:catalog_id])
> +      @deployables = @catalog.deployables
> +      @catalog_entries = @deployables.collect { |d| d.catalog_entries.first }
> +    else
> +      save_breadcrumb(deployables_path)
> +      deployable_ids_in_association = CatalogEntry.select(:deployable_id).map(&:deployable_id)
> +      @deployables = Deployable.where('id NOT IN (?)', deployable_ids_in_association).list_for_user(current_user, Privilege::VIEW)
I think this is place to use :scope for deployables so we don't have 
bloat in our controllers.
> +    end
>       set_header
>     end
>
> @@ -37,7 +42,7 @@ class DeployablesController<  ApplicationController
>         @deployable.name = @image.name
>         @selected_catalogs = params[:catalog_id].to_a
>         load_catalogs
> -    else
> +    elsif params[:catalog_id].present?
>         @catalog = Catalog.find(params[:catalog_id])
>         require_privilege(Privilege::MODIFY, @catalog)
>       end
> @@ -50,12 +55,18 @@ class DeployablesController<  ApplicationController
>
>     def show
>       @deployable = Deployable.find(params[:id])
> -    @catalog = Catalog.find(params[:catalog_id])
> +    @catalog = Catalog.find(params[:catalog_id]) if params[:catalog_id].present?
>       require_privilege(Privilege::VIEW, @deployable)
> -    save_breadcrumb(catalog_deployable_path(@catalog, @deployable), @deployable.name)
> +    save_breadcrumb(polymorphic_path([@catalog, @deployable]), @deployable.name)
>       @providers = Provider.all
>       @catalogs_options = Catalog.list_for_user(current_user, Privilege::VIEW).select {|c| !@deployable.catalogs.include?(c)}
> -    add_permissions_inline(@deployable, '', {:catalog_id =>  @catalog.id})
> +
> +    if @catalog.present?
> +      add_permissions_inline(@deployable, '', {:catalog_id =>  @catalog.id})
> +    else
> +      add_permissions_inline(@deployable)
> +    end
> +
>       @images_details = @deployable.get_image_details
>       images = @deployable.fetch_images
>       uuids = @deployable.fetch_image_uuids
> @@ -87,14 +98,14 @@ class DeployablesController<  ApplicationController
>     end
>
>     def definition
> -    @deployable = Deployable.find(params[:deployable_id])
> +    @deployable = Deployable.find(params[:id])
>       require_privilege(Privilege::VIEW, @deployable)
>       render :xml =>  @deployable.xml
>     end
>
>     def create
>       if params[:cancel]
> -      redirect_to catalog_deployables_path
> +      redirect_to polymorphic_path([params[:catalog_id], Deployable])
>         return
>       end
>
> @@ -117,7 +128,7 @@ class DeployablesController<  ApplicationController
>       end
>
>       begin
> -      raise t("deployables.flash.error.no_catalog") if @selected_catalogs.empty?
> +      #raise t("deployables.flash.error.no_catalog") if @selected_catalogs.empty?
>         @deployable.transaction do
>           @deployable.save!
>           @selected_catalogs.each do |catalog|
> @@ -126,9 +137,9 @@ class DeployablesController<  ApplicationController
>           end
>           flash[:notice] = t "catalog_entries.flash.notice.added"
>           if params[:edit_xml]
> -          redirect_to edit_catalog_deployable_path @selected_catalogs.first, @deployable.id, :edit_xml =>true
> +          redirect_to edit_polymorphic_path([@selected_catalogs.first, @deployable], :edit_xml =>true)
>           else
> -          redirect_to catalog_deployables_path(@selected_catalogs.first)
> +          redirect_to polymorphic_path([@selected_catalogs.first, Deployable])
>           end
>         end
>       rescue =>  e
> @@ -150,18 +161,18 @@ class DeployablesController<  ApplicationController
>     def edit
>       @deployable = Deployable.find(params[:id])
>       require_privilege(Privilege::MODIFY, @deployable)
> -    @catalog = Catalog.find(params[:catalog_id])
> +    @catalog = Catalog.find(params[:catalog_id]) if params[:catalog_id].present?
>     end
>
>     def update
>       @deployable = Deployable.find(params[:id])
> -    @catalog = Catalog.find(params[:catalog_id])
> +    @catalog = Catalog.find(params[:catalog_id]) if params[:catalog_id].present?
>       require_privilege(Privilege::MODIFY, @deployable)
>       params[:deployable].delete(:owner_id) if params[:deployable]
>
>       if @deployable.update_attributes(params[:deployable])
>         flash[:notice] = t"catalog_entries.flash.notice.updated"
> -      redirect_to catalog_deployable_path(params[:catalog_id], @deployable)
> +      redirect_to polymorphic_path([@catalog, @deployable])
>       else
>         render :action =>  'edit', :edit_xml =>  params[:edit_xml]
>       end
> @@ -176,18 +187,31 @@ class DeployablesController<  ApplicationController
>         #@catalog = d.catalog
>         d.destroy
>       end
> -    redirect_to catalog_path(params[:catalog_id])
> +
> +    @catalog = Catalog.find(params[:catalog_id]) if params[:catalog_id].present?
> +    if @catalog.present?
> +      redirect_to catalog_path(@catalog)
> +    else
> +      redirect_to deployables_path
> +    end
>     end
>
>     def destroy
>       deployable = Deployable.find(params[:id])
> +    @catalog = Catalog.find(params[:catalog_id]) if params[:catalog_id].present?
>       # TODO: delete only in catalogs where I have permission to
>       #require_privilege(Privilege::MODIFY, catalog_entry.catalog)
>       require_privilege(Privilege::MODIFY, deployable)
>       deployable.destroy
>
>       respond_to do |format|
> -      format.html { redirect_to catalog_path(params[:catalog_id]) }
> +      format.html do
> +        if @catalog.present?
> +          redirect_to catalog_path(@catalog)
> +        else
> +          redirect_to deployables_path
> +        end
> +      end
>       end
>     end
>
> @@ -196,9 +220,9 @@ class DeployablesController<  ApplicationController
>     end
>
>     def build
> -    catalog = Catalog.find(params[:catalog_id])
> -    deployable = Deployable.find(params[:deployable_id])
> -    require_privilege(Privilege::MODIFY, catalog)
> +    catalog = Catalog.find(params[:catalog_id]) if params[:catalog_id].present?
> +    deployable = Deployable.find(params[:id])
> +    require_privilege(Privilege::MODIFY, catalog) if catalog.present?
>       require_privilege(Privilege::MODIFY, deployable)
>
>       images = deployable.fetch_images
> @@ -210,7 +234,7 @@ class DeployablesController<  ApplicationController
>       when :push_missing
>         deployable.push_missing(images, accounts)
>       end
> -    redirect_to catalog_deployable_path(catalog, deployable)
> +    redirect_to polymorphic_path([catalog, deployable])
>     end
>
>     private
> diff --git a/src/app/helpers/deployables_helper.rb b/src/app/helpers/deployables_helper.rb
> index 1677197..4edf2d2 100644
> --- a/src/app/helpers/deployables_helper.rb
> +++ b/src/app/helpers/deployables_helper.rb
> @@ -1,13 +1,15 @@
>   module DeployablesHelper
>     def image_ready?(assembly)
> +    edit_xml_path = edit_polymorphic_path([@catalog, @deployable], :edit_xml =>  true)
> +
>       if @missing_images.empty?&&  assembly[:hwp_name].present?
> -      link_to t('.images_ready'), edit_catalog_deployable_path(@catalog, @deployable, :edit_xml =>  true), :class =>  'images_ready', :id =>  'edit_xml_button'
> +      link_to t('.images_ready'), edit_xml_path, :class =>  'images_ready', :id =>  'edit_xml_button'
>       elsif assembly[:hwp_name].nil?
> -      link_to t('.repair_images'), edit_catalog_deployable_path(@catalog, @deployable, :edit_xml =>  true), :class =>  'repair_images', :id =>  'edit_xml_button'
> +      link_to t('.repair_images'), edit_xml_path, :class =>  'repair_images', :id =>  'edit_xml_button'
>       elsif @missing_images.include?(assembly[:image_uuid])
> -      link_to t('.repair_images'), edit_catalog_deployable_path(@catalog, @deployable, :edit_xml =>  true), :class =>  'repair_images', :id =>  'edit_xml_button'
> +      link_to t('.repair_images'), edit_xml_path, :class =>  'repair_images', :id =>  'edit_xml_button'
>       else
> -      link_to t('.images_ready'), edit_catalog_deployable_path(@catalog, @deployable, :edit_xml =>  true), :class =>  'images_ready', :id =>  'edit_xml_button'
> +      link_to t('.images_ready'), edit_xml_path, :class =>  'images_ready', :id =>  'edit_xml_button'
>       end
>     end
>
> diff --git a/src/app/views/deployables/_form.html.haml b/src/app/views/deployables/_form.html.haml
> index c58529d..1a097d3 100644
> --- a/src/app/views/deployables/_form.html.haml
> +++ b/src/app/views/deployables/_form.html.haml
> @@ -9,7 +9,11 @@
>     - else
>       %p
>         = label_tag :catalog_id, t('.catalog')
> -      %span.text_instead_input= @catalog.name
> +      %span.text_instead_input
> +        - if @catalog.present?
> +          =@catalog.name
> +        - else
> +          %em=t('deployables.new.no_catalog_selected')
>       %p
>         = form.label :name, t('deployables.index.name')
>         = form.text_field :name, :class =>  'long'
> @@ -18,8 +22,8 @@
>         = form.text_area :description, :class =>  'long'
>       %p
>         = form.label :xml, t('.deployable_xml')
> -      %span.text_instead_input= link_to t("deployables.properties.edit_deployable_xml"), edit_catalog_deployable_path(@catalog.id, @deployable.id, :edit_xml=>true)
> +      %span.text_instead_input= link_to t("deployables.properties.edit_deployable_xml"), edit_polymorphic_path([@catalog, @deployable], :edit_xml=>true)
>
>   %fieldset.align-center
> -  = link_to t('cancel'), catalog_path(@catalog), :class =>  'button danger'
> +  = link_to t('cancel'), polymorphic_path([@catalog, @deployable]), :class =>  'button danger'
>     = submit_tag t('save'), :name =>  'save', :class =>  'button', :id =>  'save_button'
> diff --git a/src/app/views/deployables/_from_url.html.haml b/src/app/views/deployables/_from_url.html.haml
> index 7c6da31..de7d253 100644
> --- a/src/app/views/deployables/_from_url.html.haml
> +++ b/src/app/views/deployables/_from_url.html.haml
> @@ -1,10 +1,14 @@
> -= form_for @deployable, :url =>  catalog_deployables_path(@catalog), :html =>  {:class =>  'generic', :multipart =>  true } do |form|
> += form_for @deployable, :url =>  polymorphic_path([@catalog, Deployable]), :html =>  {:class =>  'generic', :multipart =>  true } do |form|
>     - if @deployable.errors.any?
>       = render 'layouts/error_messages', :object =>  @deployable
>     %fieldset
>       %p
>         = form.label :catalog_id, t('deployables.form.catalog')
> -      %span.text_instead_input= @catalog.name
> +      %span.text_instead_input
> +        - if @catalog.present?
> +          =@catalog.name
> +        - else
> +          %em=t('deployables.new.no_catalog_selected')
>       %p
>         = form.label :name, t('deployables.index.name')
>         = form.text_field :name, :class =>  'em long'
> @@ -19,5 +23,8 @@
>         = label_tag :edit_xml, t('deployables.form.edit_xml_after_save')
>
>     %fieldset.align-center
> -    = link_to t('cancel'), catalog_path(@catalog), :class =>  'button danger'
> +    -if @catalog.present?
> +      = link_to t('cancel'), catalog_path(@catalog), :class =>  'button danger'
> +    -else
> +      = link_to t('cancel'), deployables_path, :class =>  'button danger'
>       = submit_tag t('save'), :name =>  'save', :class =>  'button primary', :id =>  'save_button'
> diff --git a/src/app/views/deployables/_list.html.haml b/src/app/views/deployables/_list.html.haml
> index 55bf664..b5336ee 100644
> --- a/src/app/views/deployables/_list.html.haml
> +++ b/src/app/views/deployables/_list.html.haml
> @@ -4,18 +4,18 @@
>
>     .content
>       - content_for :form_header do
> -      %li= restful_submit_tag t("catalog_entries.show.delete"), "destroy", multi_destroy_catalog_deployables_path(@catalog), 'DELETE', :id =>  'delete_button', :class =>  'button danger'
> +      %li= restful_submit_tag t("catalog_entries.show.delete"), "destroy", polymorphic_path([@catalog, Deployable], :action =>  'multi_destroy'), 'DELETE', :id =>  'delete_button', :class =>  'button danger'
>
>       - content_for :filter_controls do
>         %li
>           = label_tag :catalog_entries_preset_filter, t('filter_table.viewing')
>           = hidden_field_tag :current_path, request.fullpath
>           = select_tag(:catalog_entries_preset_filter, preset_filters_options_for_select(Deployable::PRESET_FILTERS_OPTIONS, params[:catalog_entries_preset_filter]), :include_blank =>  t("catalog_entries.preset_filters.all_catalog_entries"), :disabled =>  true)
> -        = restful_submit_tag t("filter_table.apply_filters"), "filter", filter_catalog_deployables_path(@catalog), 'POST', :class =>  'button', :id =>  'apply_catalog_entries_preset_filter'
> +        = restful_submit_tag t("filter_table.apply_filters"), "filter", polymorphic_path([@catalog, Deployable], :action =>  'filter'), 'POST', :class =>  'button', :id =>  'apply_catalog_entries_preset_filter'
>           %span.label.badge.dark= @deployables.count
>         %li.table-search-filter
>           = text_field_tag :catalog_entries_search, params[:catalog_entries_search], :placeholder =>  t("filter_table.search")
> -        = restful_submit_tag "", "search", filter_catalog_deployables_path(@catalog), 'POST', :class =>  'button', :id =>  'apply_catalog_entries_search'
> +        = restful_submit_tag "", "search", polymorphic_path([@catalog, Deployable], :action =>  'filter'), 'POST', :class =>  'button', :id =>  'apply_catalog_entries_search'
>
>         :javascript
>           $(document).ready(function(){
> @@ -31,8 +31,8 @@
>             - selected = params[:select] == 'all'
>             = check_box_tag "deployables_selected[]", deployable.id, selected, :id =>  "deployable_checkbox_#{deployable.id}"
>           %td
> -          = link_to deployable.name, catalog_deployable_path(@catalog, deployable.id)
> +          = link_to deployable.name, polymorphic_path([@catalog, deployable])
>           %td
> -          = link_to @catalog.name, @catalog
> +          = link_to(@catalog.name, @catalog) if @catalog.present?
>           %td
> -          = link_to deployable.xml_filename, catalog_deployable_path(@catalog, deployable.id)
> +          = link_to deployable.xml_filename, polymorphic_path([@catalog, deployable])
> diff --git a/src/app/views/deployables/_new.html.haml b/src/app/views/deployables/_new.html.haml
> index bdef9a0..c503fd8 100644
> --- a/src/app/views/deployables/_new.html.haml
> +++ b/src/app/views/deployables/_new.html.haml
> @@ -8,9 +8,9 @@
>     %nav#image-upload-tabs.faceted
>       %ul.tabs
>         %li
> -        = link_to t('catalog_entries.new.upload'), new_catalog_deployable_path(@catalog), :id =>  "upload", :class =>  "#{'active' if @form_option == 'upload'}"
> +        = link_to t('catalog_entries.new.upload'), new_polymorphic_path([@catalog, Deployable]), :id =>  "upload", :class =>  "#{'active' if @form_option == 'upload'}"
>         %li
> -        = link_to t('catalog_entries.new.from_url'), new_catalog_deployable_path(@catalog, :from_url =>  true), :id =>  "from_url", :class =>  "#{'active' if @form_option == 'from_url'}"
> +        = link_to t('catalog_entries.new.from_url'), new_polymorphic_path([@catalog, Deployable], :from_url =>  true), :id =>  "from_url", :class =>  "#{'active' if @form_option == 'from_url'}"
>
>     .form_option
>       = render :partial =>  @form_option
> @@ -22,7 +22,7 @@
>         var entry_description = read_description_field();
>         var $clicked_element = $(this)
>         ev.preventDefault();
> -      $.get('#{new_catalog_deployable_url(@catalog)}', function(data){
> +      $.get('#{new_polymorphic_url([@catalog, Deployable])}', function(data){
>           change_selected($clicked_element, $('a#from_url'));
>           $('.form_option').empty();
>           $('.form_option').html(data).show();
> @@ -35,7 +35,7 @@
>         var entry_description = read_description_field();
>         var $clicked_element = $(this)
>         ev.preventDefault();
> -      $.get('#{new_catalog_deployable_url(@catalog, :from_url =>  true)}', function(data){
> +      $.get('#{new_polymorphic_url([@catalog, Deployable], :from_url =>  true)}', function(data){
>           change_selected($clicked_element, $("a#upload"));
>           $('.form_option').empty();
>           $('.form_option').html(data).show();
> diff --git a/src/app/views/deployables/_section_header.html.haml b/src/app/views/deployables/_section_header.html.haml
> index ed41a09..b879777 100644
> --- a/src/app/views/deployables/_section_header.html.haml
> +++ b/src/app/views/deployables/_section_header.html.haml
> @@ -1,4 +1,4 @@
>   %header.admin-page-header
>     %h1{:class =>  controller.controller_name}=t'catalog_entries.index.catalog_entries'
>     #obj_actions.button-group
> -    = link_to "#{t'catalog_entries.new_catalog_entry'}", new_catalog_deployable_url(@catalog), :class =>  'button primary', :id =>  'new_catalog_entry_button'
> +    = link_to "#{t'catalog_entries.new_catalog_entry'}", new_polymorphic_path([@catalog, Deployable]), :class =>  'button primary', :id =>  'new_catalog_entry_button'
> diff --git a/src/app/views/deployables/_upload.html.haml b/src/app/views/deployables/_upload.html.haml
> index 054ecab..103ccf6 100644
> --- a/src/app/views/deployables/_upload.html.haml
> +++ b/src/app/views/deployables/_upload.html.haml
> @@ -1,10 +1,14 @@
> -= form_for @deployable, :url =>  catalog_deployables_path(@catalog), :html =>  {:class =>  'generic', :multipart =>  true } do |form|
> += form_for @deployable, :url =>  polymorphic_path([@catalog, Deployable]), :html =>  {:class =>  'generic', :multipart =>  true } do |form|
>     - if @deployable.errors.any?
>       = render 'layouts/error_messages', :object =>  @deployable
>     %fieldset
>       %p
>         = label_tag :catalog_id, t('deployables.form.catalog')
> -      %span.text_instead_input= @catalog.name
> +      %span.text_instead_input
> +        -if @catalog.present?
> +          =@catalog.name
> +        - else
> +          %em=t('deployables.new.no_catalog_selected')
>       %p
>         = form.label :name, t('deployables.index.name')
>         = form.text_field :name, :class =>  'em long'
> @@ -19,5 +23,8 @@
>         = label_tag :edit_xml, t('deployables.form.edit_xml_after_save')
>
>     %fieldset.align-center
> -    = link_to t('cancel'), catalog_path(@catalog), :class =>  'button danger'
> +    -if @catalog.present?
> +      = link_to t('cancel'), catalog_path(@catalog), :class =>  'button danger'
> +    -else
> +      = link_to t('cancel'), deployables_path, :class =>  'button danger'
>       = submit_tag t('save'), :name =>  'save', :class =>  'button primary', :id =>  'save_button'
> diff --git a/src/app/views/deployables/edit.html.haml b/src/app/views/deployables/edit.html.haml
> index 942f422..783e910 100644
> --- a/src/app/views/deployables/edit.html.haml
> +++ b/src/app/views/deployables/edit.html.haml
> @@ -2,14 +2,14 @@
>   %header.admin-page-header
>     %h1{:class =>  controller.controller_name}= @deployable.name
>     #obj_actions.button-container
> -    = link_to 'New Deployable', new_catalog_deployable_path(@catalog, @deployable), :class =>  'button primary', :id =>  'new_deployable_button'
> +    = link_to 'New Deployable', new_polymorphic_path([@catalog, @deployable]), :class =>  'button primary', :id =>  'new_deployable_button'
>       .button-group
> -      = link_to 'Cancel Editing', catalog_deployables_path(@catalog), :class =>  'button pill danger', :id =>  'new_deployable_button'
> +      = link_to 'Cancel Editing', polymorphic_path([@catalog, Deployable]), :class =>  'button pill danger', :id =>  'new_deployable_button'
>
>   %section.admin-content-section.user
>     %header
>       %h2=t'catalog_entries.edit.editing_catalog_entry'
>
>     .content
> -    = form_for @deployable, :url =>  catalog_deployable_path(@catalog, @deployable), :html =>  { :method =>  :put, :class =>  'generic' } do |f|
> +    = form_for @deployable, :url =>  polymorphic_path([@catalog, @deployable]), :html =>  { :method =>  :put, :class =>  'generic' } do |f|
>         = render :partial =>  "form", :locals =>  { :form =>  f }
> diff --git a/src/app/views/deployables/show.html.haml b/src/app/views/deployables/show.html.haml
> index 95e00cf..b968857 100644
> --- a/src/app/views/deployables/show.html.haml
> +++ b/src/app/views/deployables/show.html.haml
> @@ -3,11 +3,11 @@
>     %h1{:class =>  controller.controller_name}= @deployable.name
>     #obj_actions.button-container
>       .button-group
> -      = button_to t('.delete'), catalog_deployable_path(@catalog, @deployable), :method =>  'delete', :confirm =>  "#{t'catalog_entries.show.confirm_delete'}", :class =>  'button danger', :id =>  'delete'
> -      = link_to t('.edit'), edit_catalog_deployable_path(@catalog, @deployable), :class =>  'button', :id =>  'edit_button'
> -      = link_to t('.edit_xml'), edit_catalog_deployable_path(@catalog, @deployable, :edit_xml =>  true), :class =>  'button', :id =>  'edit_xml_button'
> +      = button_to t('.delete'), polymorphic_path([@catalog, @deployable]), :method =>  'delete', :confirm =>  "#{t'catalog_entries.show.confirm_delete'}", :class =>  'button danger', :id =>  'delete'
> +      = link_to t('.edit'), edit_polymorphic_path([@catalog, @deployable]), :class =>  'button', :id =>  'edit_button'
> +      = link_to t('.edit_xml'), edit_polymorphic_path([@catalog, @deployable], :edit_xml =>  true), :class =>  'button', :id =>  'edit_xml_button'
>
> -    - if @deployable_errors.empty?
> +    - if @catalog.present?&&  @deployable_errors.empty?
>         = link_to t('.launch'), launch_new_deployments_path(:deployable_id =>  @deployable.id, :pool_id =>  @catalog.pool), :id =>  :launch_deployment_button
>       -else
>         %a{:id =>  :launch_deployment_button, :class =>  'disabled'}= t('.launch')
> @@ -46,9 +46,10 @@
>       %header
>         %h2.build= t('.build')
>         .section-controls
> -        = form_tag(catalog_deployable_build_path(@catalog, @deployable)) do
> +        = form_tag(polymorphic_path([@catalog, @deployable], :action =>  'build')) do
>             = select_tag :build_options, options_for_select([[t(".build_missing"), :build_missing], [t(".push_missing"), :push_missing]])
>             = submit_tag t('.start'), :id =>  :start_build, :class =>  'button pill'
> +
>       .content
>         %p.description.align-center= t('.build_description')
>
> diff --git a/src/app/views/deployments/_overview.html.haml b/src/app/views/deployments/_overview.html.haml
> index 6a6ba3c..6c7bf2c 100644
> --- a/src/app/views/deployments/_overview.html.haml
> +++ b/src/app/views/deployments/_overview.html.haml
> @@ -23,7 +23,7 @@
>           %p= @deployment.deployable_xml.description
>
>         %h3= t('.deployable_xml')
> -      = link_to @deployable.xml_filename, catalog_deployable_definition_path(@deployable.catalogs.first, @deployable)
> +      = link_to @deployable.xml_filename, definition_catalog_deployable_path(@deployable.catalogs.first, @deployable)
>         &rArr;
>
>         %h3= t('.image_ids')
> diff --git a/src/config/locales/en.yml b/src/config/locales/en.yml
> index c1526a0..dfe3f59 100644
> --- a/src/config/locales/en.yml
> +++ b/src/config/locales/en.yml
> @@ -772,6 +772,8 @@ en:
>         not_deleted:
>           one: "Deployable %{list} was not deleted. There are deployments associated with it."
>           other: "Deployables %{list} were not deleted. They have deployments associated with them."
> +    new:
> +      no_catalog_selected: 'no catalog selected'
>       new_from_image:
>         catalog_entry_name: "%{name}"
>         title: Create Deployable
> diff --git a/src/config/routes.rb b/src/config/routes.rb
> index 2011d03..66fb665 100644
> --- a/src/config/routes.rb
> +++ b/src/config/routes.rb
> @@ -201,16 +201,29 @@ Conductor::Application.routes.draw do
>       post 'create'
>       post :filter, :on =>  :collection
>       resources :deployables do
> -      delete 'multi_destroy', :on =>  :collection
> -      post :filter, :on =>  :collection
> -      post :build
> -      get :definition
> +      collection do
> +        delete 'multi_destroy'
> +        post :filter
> +      end
> +      member do
> +        post :build
> +        get :definition
> +      end
>       end
>     end
>
>     resources :catalog_entries
>
> -  resources :deployables
> +  resources :deployables do
> +    collection do
> +      delete 'multi_destroy'
> +      post :filter
> +    end
> +    member do
> +      post :build
> +      get :definition
> +    end
> +  end
>
>     resources :images do
>       member do
ACK to the patch set just one nit inline.



More information about the aeolus-devel mailing list