diff --git a/src/app/views/templates/new.haml b/src/app/views/templates/new.haml index cb236c6..669babb 100644 --- a/src/app/views/templates/new.haml +++ b/src/app/views/templates/new.haml @@ -72,8 +72,10 @@ } }); Aggregator.hook_selected_packages = function() { - $('#do_add_software').click(function(e) { + $('#do_add_software').live('click', function(e) { e.preventDefault(); + var $button = $(this).clone(); + var label = "<span id='do_add_software' class='loading fl'>Adding Packages</span>"; var url = '#{url_for :action => 'managed_content'}'; var new_pkgs = $("input:checked[name='packages[]']").map(function() {return $(this).val()}).get(); var old_pkgs = $("input:hidden[name='packages[]']").map(function() {return $(this).val()}).get() @@ -85,11 +87,13 @@ 'collections': $("input:hidden[name=collections]").val(), 'template_id' : '#{@id.nil? ? nil : @id}' }; + $(this).replaceWith(label); $('#managed_content').load(url, data, function(){ $("input:checked[name='groups[]']").attr('disabled', 'disabled'); $("input:checked[name='packages[]']").attr('disabled', 'disabled'); $('#add_software_button').show(); $('.dropdown').hide(); + $('#do_add_software').replaceWith($button); }); }); $('#cancel_add_software').click(function(e) {
The inputbuttons still have some issues: - Cannot do dynamic width. Three digit pages won't fit quite, single digit are too wide. In future I will probably replace these with links for JS version. - previous and next buttons might be nice with an arrow icon in future. - :active state suffers from some jumping on FF --- src/app/helpers/templates_helper.rb | 2 +- src/app/stylesheets/aggregator.scss | 40 +++++++++++++++++++++++ src/app/views/templates/_searched_packages.haml | 4 ++- 3 files changed, 44 insertions(+), 2 deletions(-)
diff --git a/src/app/helpers/templates_helper.rb b/src/app/helpers/templates_helper.rb index 6323233..1ffcd2f 100644 --- a/src/app/helpers/templates_helper.rb +++ b/src/app/helpers/templates_helper.rb @@ -2,7 +2,7 @@ module TemplatesHelper class ButtonPaginationRenderer < WillPaginate::LinkRenderer def page_link(page, text, attributes = {}) #submit_tag text, :name => 'page' - "<input type=submit value='#{text}' name='page'/>" + "<input type=submit value='#{text}' name='page' class='#{attributes[:class]}' />" end end end diff --git a/src/app/stylesheets/aggregator.scss b/src/app/stylesheets/aggregator.scss index 7f1d6e3..2a4711b 100644 --- a/src/app/stylesheets/aggregator.scss +++ b/src/app/stylesheets/aggregator.scss @@ -865,6 +865,46 @@ fieldset.gap { color: $errorcl; } } + +.pagination { + font-size: 90%; + text-align: right; + .disabled { + display: none; + } + input { + display: inline-block; + text-align: center; + background: none; + border: 1px solid $strokecl; + width: 18px; padding: 3px; margin-right: 4px; + @include border-radius(0); + &.prev_page, &.next_page { + width: 54px; + &:active, &:hover, &:focus { /* behave like links, not buttons */ + width: 54px; + } + } + &:active, &:hover, &:focus { /* behave like links, not buttons */ + text-align: center; + background: none; + @include no-box-shadow(); + width: 18px; padding: 3px; margin-right: 4px; + } + } + .current { + text-align: center; + display: inline-block; + width: 22px; + border: none; + font-weight: bold; + } +} + +.pageinfo { + float: left; +} + /* simple two column label + input pairs */ .dcloud_form { fieldset { diff --git a/src/app/views/templates/_searched_packages.haml b/src/app/views/templates/_searched_packages.haml index fdc8ad1..7122ea5 100644 --- a/src/app/views/templates/_searched_packages.haml +++ b/src/app/views/templates/_searched_packages.haml @@ -35,7 +35,9 @@ - disabled = params[:selected_packages].to_a.include?(pkg) = check_box_tag 'packages[]', pkg, selected, {:disabled => disabled, :id => "pkg_#{pkg}"} = label_tag "pkg_#{pkg}", pkg +.pageinfo + = page_entries_info @searched_packages, :entry_name => 'package' = will_paginate @searched_packages, :params => {:package_search => params[:package_search]}, :renderer => TemplatesHelper::ButtonPaginationRenderer.new, :previous_label => 'Previous', :next_label => 'Next' -= page_entries_info @searched_packages, :entry_name => 'package' +
= render :partial => 'addbuttons'
deltacloud-devel@lists.fedorahosted.org