Skip to content

Commit

Permalink
Merge cf16e0f into 95f2039
Browse files Browse the repository at this point in the history
  • Loading branch information
awead committed Mar 22, 2017
2 parents 95f2039 + cf16e0f commit d8635ee
Show file tree
Hide file tree
Showing 4 changed files with 38 additions and 15 deletions.
30 changes: 20 additions & 10 deletions app/assets/javascripts/browse_everything/behavior.js.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -118,8 +118,7 @@ $ ->
table.treetable("unloadBranch", node)
onNodeExpand: ->
node = this
$('body').css('cursor','wait')
$("html").addClass("wait")
startWait()
size = $(node.row).find('td.ev-file-size').text().trim()
start = 1
increment = 1
Expand Down Expand Up @@ -173,17 +172,28 @@ $ ->
selectAll(rows)
.always ->
clearInterval progressIntervalID
$('body').css('cursor','default')
$("html").removeClass("wait")
stopWait()

setProgress = (done)->
$('#loading_progress').css('width',done+'%')
$('#loading_progress').html(done+'% complete')
$('#loading_progress').attr('aria-valuenow', done)
$('.loading-text').text(done+'% complete')

refreshFiles = ->
$('.ev-providers select').change()

startWait = ->
$('.loading-progress').removeClass("hidden")
$('body').css('cursor','wait')
$("html").addClass("wait")
$(".ev-browser").addClass("loading")
$('.ev-submit').attr('disabled', true)

stopWait = ->
$('.loading-progress').addClass("hidden")
$('body').css('cursor','default')
$("html").removeClass("wait")
$(".ev-browser").removeClass("loading")
$('.ev-submit').attr('disabled', false)

$(window).on('resize', -> sizeColumns($('table#file-list')))

$.fn.browseEverything = (options) ->
Expand Down Expand Up @@ -224,7 +234,7 @@ $ ->
$(document).on 'click', 'button.ev-submit', (event) ->
event.preventDefault()
$(this).button('loading')
$('body').css('cursor','wait')
startWait()
main_form = $(this).closest('form')
resolver_url = main_form.data('resolver')
ctx = dialog.data('ev-state')
Expand Down Expand Up @@ -255,7 +265,7 @@ $ ->

$(document).on 'change', '.ev-providers select', (event) ->
event.preventDefault()
$('body').css('cursor','wait')
startWait()
$.ajax
url: $(this).val(),
data:
Expand All @@ -272,7 +282,7 @@ $ ->
else
$('.ev-files').html(xhr.responseText)
.always ->
$('body').css('cursor','default')
stopWait()

$(document).on 'click', '.ev-providers a', (event) ->
$('.ev-providers li').removeClass('ev-selected')
Expand Down
15 changes: 15 additions & 0 deletions app/assets/stylesheets/browse_everything/_browse_everything.scss
Original file line number Diff line number Diff line change
Expand Up @@ -98,4 +98,19 @@
select { width: 30% }
}

.loading {
pointer-events: none;
opacity: 0.2;
}

.loading-progress {
position: absolute;
top: 8em;
left: 4em;
}

// Massively large text instead of something more artistic
.loading-text {
font-size: 4em;
}
}
5 changes: 0 additions & 5 deletions app/views/browse_everything/_files.html.erb
Original file line number Diff line number Diff line change
@@ -1,8 +1,3 @@
<div class="progress" id="loading_progress" aria-live="polite">
<div class="progress-bar" role="progressbar" aria-valuenow="0" aria-valuemin="0" aria-valuemax="100" style="width: 100%;">
100% Complete
</div>
</div>
<table id="file-list" role="grid" tabindex="-1" title="Choose files to upload from the table below" aria-live="polite">
<thead>
<tr role="row" tabindex="-1">
Expand Down
3 changes: 3 additions & 0 deletions app/views/browse_everything/index.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,9 @@
</div>
</div>
<div class="modal-body ev-body" tabindex="-1">
<div class="loading-progress" aria-live="assertive">
<span class="loading-text">Loading...</span>
</div>
<div class="ev-browser row<%=bs2('-fluid')%>" aria-live="polite">
<div class="<%=fa3or4('fa3','fa4')%> <%=bs2or3('bs2 span','bs3 col-xs-')%>12 ev-files list">
<%= render :partial => 'files' if provider.present? %>
Expand Down

0 comments on commit d8635ee

Please sign in to comment.