[PATCH conductor] new catalog entry from image, catalog select javascript
Jirka Tomasek
jtomasek at redhat.com
Tue Dec 20 12:07:34 UTC 2011
On 12/19/2011 03:41 PM, jtomasek at redhat.com wrote:
> From: Jiri Tomasek<jtomasek at redhat.com>
>
> ---
> .../views/deployables/_new_from_image.html.haml | 21 +++++++++++++++++++-
> src/config/locales/en.yml | 2 +
> 2 files changed, 22 insertions(+), 1 deletions(-)
>
> diff --git a/src/app/views/deployables/_new_from_image.html.haml b/src/app/views/deployables/_new_from_image.html.haml
> index 9e00e75..d11ff29 100644
> --- a/src/app/views/deployables/_new_from_image.html.haml
> +++ b/src/app/views/deployables/_new_from_image.html.haml
> @@ -14,13 +14,14 @@
> %div
> = form.label :name, t('catalog_entries.new.name')
> = form.text_field :name
> + .clear
> %div
> = form.label :hardware_profile, t('catalog_entries.new.hw_profile')
> = select_tag :hardware_profile, options_from_collection_for_select(@hw_profiles, :id, :name, params[:hardware_profile])
> .clear
> %div
> = form.label :catalog_id, t('deployables.form.catalog')
> - %span.text_instead_input= @selected_catalogs.empty? ? t('deployables.form.none') : @selected_catalogs.count> 1 ? t('deployables.form.multiple') : @selected_catalogs.first.name
> + %span.text_instead_input#checked_catalogs_list= @selected_catalogs.empty? ? t('deployables.form.none') : @selected_catalogs.count> 1 ? t('deployables.form.multiple') : @selected_catalogs.first.name
> %span.catalog_link
>  
> %div.catalog_list
> @@ -36,3 +37,21 @@
> %fieldset.align-center
> = link_to t('deployables.form.cancel'), catalogs_path, :class => 'button danger'
> = submit_tag "#{t'deployables.form.save'}", :name => 'save', :class => 'button primary', :id => 'save_button'
> +:javascript
> + function listChecked() {
> + $("#checked_catalogs_list").text(function(){
> + var str = [];
> + $(".catalog_list input:checked").each(function(){
> + str.push($(this).parent().text());
> + });
> + if (str.length> 1){
> + return "Multiple";
> + }else if (str.length == 0){
> + return "None";
> + }else{
> + return str.join(', ');
> + }
> + });
> + }
> + listChecked();
> + $(".catalog_list :checkbox").click(listChecked);
> diff --git a/src/config/locales/en.yml b/src/config/locales/en.yml
> index 9f4742f..61d6b29 100644
> --- a/src/config/locales/en.yml
> +++ b/src/config/locales/en.yml
> @@ -817,6 +817,8 @@ en:
> deployable_xml: "Deployable XML:"
> edit_xml_after_save: "Edit XML file after save"
> deployable_xml_url: "URL of Deployable XML:"
> + none: None
> + multiple: None
> flash:
> error:
> attribute_not_exist: "Some attribute(s) is missing in XML, please check the file!"
Self ACK & Pushed
More information about the aeolus-devel
mailing list