mirror of
https://github.com/openfoodfoundation/openfoodnetwork
synced 2026-01-24 20:36:49 +00:00
Merge pull request #8523 from seballot/progress-for-ajax-request
Improve loading spinner display
This commit is contained in:
@@ -1,7 +1,11 @@
|
||||
$(document).ready ->
|
||||
progressTimer = null
|
||||
$(document).ajaxStart ->
|
||||
$("#progress").fadeIn()
|
||||
progressTimer = setTimeout ->
|
||||
$("#progress").fadeIn()
|
||||
, 500
|
||||
|
||||
$(document).ajaxStop ->
|
||||
$("#progress").fadeOut()
|
||||
clearTimeout(progressTimer) if progressTimer?
|
||||
$("#progress").stop().hide()
|
||||
|
||||
|
||||
@@ -6,6 +6,6 @@
|
||||
|
||||
.sixteen.columns.alpha#loading{ 'ng-show' => 'productsLoading()' }
|
||||
%br
|
||||
%img.spinner{ src: image_path("/spinning-circles.svg")}
|
||||
%i.spinner.fa.fa-spin.fa-circle-o-notch
|
||||
%h1
|
||||
{{ 'js.admin.panels.exchange_products.loading_variants' | t }}
|
||||
|
||||
@@ -35,9 +35,9 @@
|
||||
|
||||
.row{ 'ng-if' => 'shop_id && RequestMonitor.loading' }
|
||||
.sixteen.columns.alpha#loading
|
||||
= render partial: "components/spinner"
|
||||
= render partial: "components/admin_spinner"
|
||||
%h1
|
||||
=t :loading_customers
|
||||
= t :loading_customers
|
||||
|
||||
.row{ :class => "sixteen columns alpha", 'ng-show' => '!RequestMonitor.loading && filteredCustomers.length == 0'}
|
||||
%h1#no_results
|
||||
|
||||
@@ -9,8 +9,9 @@
|
||||
%columns-dropdown{ action: "#{controller_name}_#{action_name}" }
|
||||
.row{ 'ng-if' => '!loaded' }
|
||||
.sixteen.columns.alpha#loading
|
||||
= render partial: "components/spinner"
|
||||
%h1= t('.loading_enterprises')
|
||||
= render partial: "components/admin_spinner"
|
||||
%h1
|
||||
= t('.loading_enterprises')
|
||||
.row{ :class => "sixteen columns alpha", 'ng-show' => 'loaded && filteredEnterprises.length == 0'}
|
||||
%h1#no_results= t('.no_enterprises_found')
|
||||
|
||||
|
||||
@@ -57,7 +57,7 @@
|
||||
= f.text_field :permalink, { 'ng-model' => "Enterprise.permalink", placeholder: "eg. your-shop-name", 'ng-model-options' => "{ updateOn: 'default blur', debounce: {'default': 300, 'blur': 0} }" }
|
||||
.two.columns.omega
|
||||
%div{ng: {show: "checking", cloak: true}, style: "width: 30px; height: 30px;"}
|
||||
= render partial: "components/spinner"
|
||||
= render partial: "components/admin_spinner"
|
||||
%span{ ng: { class: 'availability.toLowerCase()', hide: "checking" } }
|
||||
{{ availability }}
|
||||
%i{ ng: { class: "{'icon-ok-sign': availability == 'Available', 'icon-remove-sign': availability == 'Unavailable'}" } }
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
%div.sixteen.columns.alpha.omega#loading{ ng: { cloak: true, if: 'RequestMonitor.loading' } }
|
||||
= render partial: "components/spinner"
|
||||
= render partial: "components/admin_spinner"
|
||||
%h1{ ng: { hide: 'orderCycles.length > 0' } }
|
||||
=t('.loading_order_cycles')
|
||||
= t('.loading_order_cycles')
|
||||
%h1{ ng: { show: 'orderCycles.length > 0' } }
|
||||
=t('.loading')
|
||||
= t('.loading')
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
%div.sixteen.columns.alpha.omega#loading{ ng: { cloak: true, if: 'shop_id && RequestMonitor.loading' } }
|
||||
= render partial: "components/spinner"
|
||||
%h1= t('.loading')
|
||||
= render partial: "components/admin_spinner"
|
||||
%h1
|
||||
= t('.loading')
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
%div.sixteen.columns.alpha.omega#loading{ ng: { cloak: true, if: 'hub_id && products.length == 0 && RequestMonitor.loading' } }
|
||||
= render partial: "components/spinner"
|
||||
%h1= t('.loading_inventory')
|
||||
= render partial: "components/admin_spinner"
|
||||
%h1
|
||||
= t('.loading_inventory')
|
||||
|
||||
1
app/views/components/_admin_spinner.haml
Normal file
1
app/views/components/_admin_spinner.haml
Normal file
@@ -0,0 +1 @@
|
||||
%i.spinner.fa.fa-spin.fa-circle-o-notch
|
||||
@@ -103,7 +103,7 @@
|
||||
%columns-dropdown{ action: "#{controller_name}_#{action_name}" }
|
||||
|
||||
%div.sixteen.columns.alpha#loading{ 'ng-if' => 'RequestMonitor.loading' }
|
||||
= render partial: "components/spinner"
|
||||
= render partial: "components/admin_spinner"
|
||||
%h1
|
||||
= t("admin.orders.bulk_management.loading")
|
||||
|
||||
|
||||
@@ -92,13 +92,10 @@
|
||||
%div{'ng-if' => 'order.ready_to_capture'}
|
||||
%button.icon-capture.icon_link.no-text{'ng-click' => 'capturePayment(order)', rel: 'nofollow', 'ofn-with-tip' => t('.capture')}
|
||||
|
||||
.orders-loading{'ng-show' => 'RequestMonitor.loading'}
|
||||
.row
|
||||
.small-12.columns.fullwidth.text-center
|
||||
= render partial: "components/spinner"
|
||||
.row
|
||||
.small-12.columns.fullwidth.text-center
|
||||
%span= t('.loading')
|
||||
.sixteen.columns.alpha#loading{ 'ng-show' => 'RequestMonitor.loading' }
|
||||
= render partial: "components/admin_spinner"
|
||||
%h1
|
||||
= t('.loading')
|
||||
|
||||
%div{'ng-show' => "!RequestMonitor.loading && orders.length > 0" }
|
||||
= render partial: 'admin/shared/angular_pagination'
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
%div.sixteen.columns.alpha#loading{ 'ng-if' => 'RequestMonitor.loading' }
|
||||
%br
|
||||
= render partial: "components/spinner"
|
||||
%h1= t('.title')
|
||||
= render partial: "components/admin_spinner"
|
||||
%h1
|
||||
= t('.title')
|
||||
|
||||
%div.sixteen.columns.alpha{ 'ng-show' => '!RequestMonitor.loading && products.length == 0 && q.query.length == 0' }
|
||||
%h1#no_results= t('.no_products')
|
||||
|
||||
@@ -20,10 +20,6 @@
|
||||
Spree.routes.taxonomy_taxons = "#{main_app.api_v0_taxonomy_taxons_url(@taxonomy)}";
|
||||
Spree.routes.admin_taxonomy_taxons = "#{spree.admin_taxonomy_taxons_url(@taxonomy)}";
|
||||
#taxonomy_tree.tree
|
||||
#progress{style: "display:none;"}
|
||||
= image_pack_tag 'select2-spinner.gif', title: 'Spinner', style: "vertical-align:bottom;"
|
||||
= t("spree.updating")
|
||||
\..
|
||||
.info= t("spree.taxonomy_tree_instruction")
|
||||
%br/
|
||||
.filter-actions.actions
|
||||
|
||||
@@ -1,24 +1,4 @@
|
||||
#progress
|
||||
/ By Sam Herbert (@sherb), for everyone. More @ http://goo.gl/7AJzbL
|
||||
%svg{:class => "spinner", :viewbox => "0 0 58 58", :xmlns => "http://www.w3.org/2000/svg"}
|
||||
%g{:fill => "none", "fill-rule" => "evenodd"}
|
||||
%g{:stroke => "currentColor", "stroke-width" => "1.5", :transform => "translate(2 1)"}
|
||||
%circle{:cx => "42.601", :cy => "11.462", :fill => "currentColor", "fill-opacity" => "1", :r => "5"}
|
||||
%animate{:attributename => "fill-opacity", :begin => "0s", :calcmode => "linear", :dur => "1.3s", :repeatcount => "indefinite", :values => "1;0;0;0;0;0;0;0"}
|
||||
%circle{:cx => "49.063", :cy => "27.063", :fill => "currentColor", "fill-opacity" => "0", :r => "5"}
|
||||
%animate{:attributename => "fill-opacity", :begin => "0s", :calcmode => "linear", :dur => "1.3s", :repeatcount => "indefinite", :values => "0;1;0;0;0;0;0;0"}
|
||||
%circle{:cx => "42.601", :cy => "42.663", :fill => "currentColor", "fill-opacity" => "0", :r => "5"}
|
||||
%animate{:attributename => "fill-opacity", :begin => "0s", :calcmode => "linear", :dur => "1.3s", :repeatcount => "indefinite", :values => "0;0;1;0;0;0;0;0"}
|
||||
%circle{:cx => "27", :cy => "49.125", :fill => "currentColor", "fill-opacity" => "0", :r => "5"}
|
||||
%animate{:attributename => "fill-opacity", :begin => "0s", :calcmode => "linear", :dur => "1.3s", :repeatcount => "indefinite", :values => "0;0;0;1;0;0;0;0"}
|
||||
%circle{:cx => "11.399", :cy => "42.663", :fill => "currentColor", "fill-opacity" => "0", :r => "5"}
|
||||
%animate{:attributename => "fill-opacity", :begin => "0s", :calcmode => "linear", :dur => "1.3s", :repeatcount => "indefinite", :values => "0;0;0;0;1;0;0;0"}
|
||||
%circle{:cx => "4.938", :cy => "27.063", :fill => "currentColor", "fill-opacity" => "0", :r => "5"}
|
||||
%animate{:attributename => "fill-opacity", :begin => "0s", :calcmode => "linear", :dur => "1.3s", :repeatcount => "indefinite", :values => "0;0;0;0;0;1;0;0"}
|
||||
%circle{:cx => "11.399", :cy => "11.462", :fill => "currentColor", "fill-opacity" => "0", :r => "5"}
|
||||
%animate{:attributename => "fill-opacity", :begin => "0s", :calcmode => "linear", :dur => "1.3s", :repeatcount => "indefinite", :values => "0;0;0;0;0;0;1;0"}
|
||||
%circle{:cx => "27", :cy => "5", :fill => "currentColor", "fill-opacity" => "0", :r => "5"}
|
||||
%animate{:attributename => "fill-opacity", :begin => "0s", :calcmode => "linear", :dur => "1.3s", :repeatcount => "indefinite", :values => "0;0;0;0;0;0;0;1"}
|
||||
|
||||
= render partial: "components/admin_spinner"
|
||||
= Spree.t(:loading)
|
||||
\...
|
||||
|
||||
@@ -1,28 +1,42 @@
|
||||
// Loading throbber displayed when ajax request takes too long to complete
|
||||
#progress {
|
||||
@include border-radius(10px);
|
||||
position: fixed;
|
||||
top: -10px;
|
||||
left: 50%;
|
||||
z-index: 1000;
|
||||
opacity: 0.8;
|
||||
width: 200px;
|
||||
background-color: $spree-blue;
|
||||
color: $color-1;
|
||||
display: none;
|
||||
font-size: 120%;
|
||||
@include border-radius(0 0 4px 4px);
|
||||
position: fixed;
|
||||
top: 0;
|
||||
left: 50%;
|
||||
transform: translateX(-50%);
|
||||
z-index: 1000;
|
||||
background-color: $spree-blue;
|
||||
color: #FFFFFF;
|
||||
opacity: .8;
|
||||
font-size: 1rem;
|
||||
padding: .5rem 1rem;
|
||||
font-weight: bold;
|
||||
line-height: 40px;
|
||||
margin-left: -100px;
|
||||
padding-top: 15px;
|
||||
text-align: center;
|
||||
text-transform: uppercase;
|
||||
|
||||
.spinner {
|
||||
position: absolute;
|
||||
left: 50%;
|
||||
width: 30px;
|
||||
height: 30px;
|
||||
top: -5px;
|
||||
margin-left: -15px;
|
||||
margin-right: 5px;
|
||||
}
|
||||
}
|
||||
|
||||
// Loading message replacing a table when it's loading for example
|
||||
#loading {
|
||||
text-align: center;
|
||||
padding: 2rem 0;
|
||||
color: $color-4;
|
||||
|
||||
i {
|
||||
font-size: 2rem;
|
||||
}
|
||||
img.spinner {
|
||||
border: 0px;
|
||||
width: 100px;
|
||||
height: 100px;
|
||||
}
|
||||
h1 {
|
||||
margin-top: 20px;
|
||||
color: inherit;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -203,19 +203,6 @@ table#listing_enterprise_groups {
|
||||
}
|
||||
}
|
||||
|
||||
#loading {
|
||||
text-align: center;
|
||||
img.spinner {
|
||||
border: 0px;
|
||||
width: 100px;
|
||||
height: 100px;
|
||||
}
|
||||
h1 {
|
||||
margin-top: 20px;
|
||||
color: gray;
|
||||
}
|
||||
}
|
||||
|
||||
.field_with_errors > input {
|
||||
border-color: red;
|
||||
}
|
||||
|
||||
@@ -90,18 +90,6 @@ table.index td.actions {
|
||||
text-align: left;
|
||||
}
|
||||
|
||||
.orders-loading {
|
||||
margin-top: 1em;
|
||||
|
||||
img {
|
||||
width: 85px;
|
||||
}
|
||||
|
||||
span {
|
||||
font-size: 1.2em;
|
||||
}
|
||||
}
|
||||
|
||||
.index-controls {
|
||||
|
||||
button {
|
||||
|
||||
@@ -418,7 +418,7 @@ describe '
|
||||
expect(page).to have_select2 'order_cycle_filter',
|
||||
with_options: OrderCycle.pluck(:name).unshift("All")
|
||||
select2_select oc1.name, from: "order_cycle_filter"
|
||||
expect(page).to have_no_selector "#loading img.spinner"
|
||||
expect(page).to have_no_selector "#loading i"
|
||||
expect(page).to have_selector "tr#li_#{li1.id}"
|
||||
expect(page).to have_no_selector "tr#li_#{li2.id}"
|
||||
end
|
||||
|
||||
@@ -852,10 +852,10 @@ describe '
|
||||
attach_file 'image-upload', Rails.root.join("public/500.jpg"), visible: false
|
||||
|
||||
# Shows spinner whilst loading
|
||||
expect(page).to have_css "img.spinner", visible: true
|
||||
expect(page).to have_css ".spinner", visible: true
|
||||
end
|
||||
|
||||
expect(page).to have_no_css "img.spinner", visible: true
|
||||
expect(page).to have_no_css ".spinner", visible: true
|
||||
expect(page).to have_no_selector "div.reveal-modal"
|
||||
|
||||
within "table#listing_products tr#p_#{product.id}" do
|
||||
|
||||
Reference in New Issue
Block a user