Ignore this one too - will send again with better description.

On 10/22/2010 05:45 PM, [email protected] wrote:
> From: Jan Provaznik<[email protected]>
>
> loadmask, minor bug fixes
> ---
>   src/app/controllers/templates_controller.rb      |   22 
> +++++++++++++---------
>   src/app/stylesheets/aggregator.scss              |    9 +++++++++
>   src/app/views/templates/_collections.haml        |    4 +++-
>   src/app/views/templates/_metagroup_packages.haml |    2 +-
>   src/app/views/templates/_searched_packages.haml  |    2 ++
>   src/app/views/templates/content_selection.haml   |   12 +++++++++++-
>   src/app/views/templates/new.haml                 |    9 +++++++--
>   7 files changed, 46 insertions(+), 14 deletions(-)
>
> diff --git a/src/app/controllers/templates_controller.rb 
> b/src/app/controllers/templates_controller.rb
> index 4fe34bb..1573167 100644
> --- a/src/app/controllers/templates_controller.rb
> +++ b/src/app/controllers/templates_controller.rb
> @@ -132,6 +132,8 @@ class TemplatesController<  ApplicationController
>         else
>           @metagroup_packages = 
> @repository_manager.metagroup_packages_with_tagged_selected_packages(@metagroup,
>  @packages, params[:repository] || @tpl.platform)
>         end
> +    else
> +      @collections = 
> @repository_manager.all_groups_with_tagged_selected_packages(@packages, 
> params[:repository] || @tpl.platform)
>       end
>       if request.xhr?
>         if @metagroup_packages
> @@ -140,7 +142,7 @@ class TemplatesController<  ApplicationController
>         if @searched_packages
>           render :partial =>  'searched_packages' and return
>         end
> -      if @collections
> +      if @collections and @metagroup
>           render :partial =>  'collections' and return
>         end
>       end
> @@ -264,14 +266,16 @@ add account on<a href=\"#{url_for :controller =>  
> 'provider', \
>         @selected_packages = []
>       end
>
> -    [:selected_groups, :groups].each do |pg|
> -      if params[pg]
> -        params[pg].each { |grp|
> -          fg = @groups.find { |gk, gv| gk == grp }
> -          fg[1][:packages].each { |pk, pv|
> -            @selected_packages<<  pk
> -          } unless fg.nil?
> -        }
> +    if params[:collections].to_s == 'true' or not request.xhr?
> +      [:selected_groups, :groups].each do |pg|
> +        if params[pg]
> +          params[pg].each { |grp|
> +            fg = @groups.find { |gk, gv| gk == grp }
> +            fg[1][:packages].each { |pk, pv|
> +              @selected_packages<<  pk
> +            } unless fg.nil?
> +          }
> +        end
>         end
>       end
>
> diff --git a/src/app/stylesheets/aggregator.scss 
> b/src/app/stylesheets/aggregator.scss
> index 6d0a070..c2b95e7 100644
> --- a/src/app/stylesheets/aggregator.scss
> +++ b/src/app/stylesheets/aggregator.scss
> @@ -1167,6 +1167,15 @@ a.iconbutton {
>         margin: 0;
>       }
>     }
> +
> +  #metagrouppackages {
> +&.loading {
> +      display: block;
> +      height: 100px;
> +      background: url(../../images/spinner.gif) no-repeat center center;
> +    }
> +  }
> +
>     span.loading {
>       background: url(../../images/spinner.gif) no-repeat center left;
>       display: inline-block;
> diff --git a/src/app/views/templates/_collections.haml 
> b/src/app/views/templates/_collections.haml
> index 96ddcad..4623f6f 100644
> --- a/src/app/views/templates/_collections.haml
> +++ b/src/app/views/templates/_collections.haml
> @@ -1,7 +1,9 @@
> += hidden_field_tag :collections, true
> +
>   %ul.collections
>     - @collections.keys.sort.each do |id|
>       %li
>         - selected = @collections[id][:selected] ? true : false
> -      = check_box_tag 'groups[]', id, selected, {:disabled =>  selected, :id 
> =>  "group_#{id}"}
> +      = check_box_tag 'groups[]', id, selected, {:disabled =>  selected, :id 
> =>  "group_#{id}", :class =>  "#{selected ? 'selected' : ''}"}
>         = label_tag "group_#{id}", @collections[id][:name]
>   = render :partial =>  'addbuttons'
> diff --git a/src/app/views/templates/_metagroup_packages.haml 
> b/src/app/views/templates/_metagroup_packages.haml
> index 9c0e2d4..07642b1 100644
> --- a/src/app/views/templates/_metagroup_packages.haml
> +++ b/src/app/views/templates/_metagroup_packages.haml
> @@ -8,7 +8,7 @@
>         %li
>           - selected = !...@metagroup_packages[group][:selected].nil?
>           %h5
> -          = check_box_tag 'groups[]', group, selected, {:disabled =>  
> selected, :id =>  "group_#{group}", :class =>  'softwaregroups'}
> +          = check_box_tag 'groups[]', group, selected, {:disabled =>  
> selected, :id =>  "group_#{group}", :class =>  "softwaregroups #{selected ? 
> 'selected' : ''}"}
>             = label_tag "group_#{group}", group
>           %ul
>             - @metagroup_packages[group][:packages].each do |pkg|
> diff --git a/src/app/views/templates/_searched_packages.haml 
> b/src/app/views/templates/_searched_packages.haml
> index d0eb770..0894cb5 100644
> --- a/src/app/views/templates/_searched_packages.haml
> +++ b/src/app/views/templates/_searched_packages.haml
> @@ -15,7 +15,9 @@
>           'page': $(this).val(),
>           'repository': $("select[name='tpl[platform]']").val()
>         };
> +      $('#metagrouppackages').empty().addClass('loading');
>         $('#metagrouppackages').load(url, data, function() {
> +        $('#metagrouppackages').removeClass('loading');
>           Aggregator.hook_selected_packages();
>         })
>       });
> diff --git a/src/app/views/templates/content_selection.haml 
> b/src/app/views/templates/content_selection.haml
> index e5961fe..f1499ae 100644
> --- a/src/app/views/templates/content_selection.haml
> +++ b/src/app/views/templates/content_selection.haml
> @@ -9,8 +9,18 @@
>           'packages[]':  $("input:text[name='packages[]']").map(function() 
> {return $(this).val()}).get()
>         };
>         var url = '#{url_for :action =>  'dispatch', :id =>  @id}';
> -      $('#metagrouppackages, ').load(url, data, function() {
> +      $metagrouppackages.empty().addClass('loading');
> +      $metagrouppackages.load(url, data, function() {
> +        $metagrouppackages.removeClass('loading');
>           Aggregator.hook_selected_packages();
> +        //select all packages in collection
> +        $(".softwaregroups").click(function() {
> +          if ($(this).attr("checked") === true) {
> +            
> $(this).parent().siblings("ul").find("input[type='checkbox']").attr("checked","checked");
> +          } else {
> +            
> $(this).parent().siblings("ul").find("input[type='checkbox']").removeAttr("checked");
> +          }
> +        });
>         });
>       });
>       Aggregator.hook_selected_packages();
> diff --git a/src/app/views/templates/new.haml 
> b/src/app/views/templates/new.haml
> index 3d16f4f..eada010 100644
> --- a/src/app/views/templates/new.haml
> +++ b/src/app/views/templates/new.haml
> @@ -31,7 +31,11 @@
>               'repository': $("select[name='tpl[platform]']").val()
>             };
>             var url = '#{url_for :action =>  'dispatch', :id =>  @id}';
> -          $('#metagrouppackages').load(url, data);
> +          $('#metagrouppackages').empty().addClass('loading');
> +          $('#metagrouppackages').load(url, data, function() {
> +            $('#metagrouppackages').removeClass('loading');
> +            Aggregator.hook_selected_packages();
> +          });
>           });
>         });
>       });
> @@ -53,11 +57,12 @@
>             'selected_packages[]': 
> old_pkgs.concat(new_pkgs.concat(cached_pkgs)),
>             'selected_groups[]': 
> $("input:checked[name='groups[]']").map(function() {return 
> $(this).val()}).get(),
>             'cached_packages[]': 
> $("input:text[name='cached[]']").map(function() {return $(this).val()}).get(),
> +          'collections': $("input:hidden[name=collections]").val(),
>             'template_id'  : '#[email protected]? ? nil : @id}'
>           };
>           $('#managed_content').load(url, data, function(){
>             //$('#package_selection_list').empty().show();
> -          $('#add_software_button').show();
> +          //$('#add_software_button').show();
>             $('.remove_package').click(function() { 
> $(this).parent().parent().remove(); });
>           });
>         });

_______________________________________________
deltacloud-devel mailing list
[email protected]
https://fedorahosted.org/mailman/listinfo/deltacloud-devel

Reply via email to