Show loading state when checking for MD images

This commit is contained in:
Andrew Miner
2015-06-08 10:45:35 -07:00
parent 622f80d153
commit 3535c19db0
3 changed files with 37 additions and 12 deletions
@@ -7,6 +7,7 @@ All rights reserved.
_ = require 'underscore' _ = require 'underscore'
BaseController = require './base_controller' BaseController = require './base_controller'
{Duration} = require '../constants'
MarkdownImage = require '../models/markdown_image' MarkdownImage = require '../models/markdown_image'
######################################################################################################################## ########################################################################################################################
@@ -57,10 +58,14 @@ module.exports = class MarkdownImageController extends BaseController
# BaseController Overrides ##################################################################### # BaseController Overrides #####################################################################
onDidRender: -> onDidRender: ->
@$image = @$('img') @$image = @$('img')
@$fileName = @$('.fileName p') @$fileName = @$('.fileName p')
@$button = @$('button') @$button = @$('button')
@$input = @$('input') @$input = @$('input')
@$errorContainer = @$('.error')
@$errorMessage = @$('.error p')
@$loaded = @$('.loaded')
@$loading = @$('.loading')
super super
@@ -77,6 +82,13 @@ module.exports = class MarkdownImageController extends BaseController
else else
@$button.html 'Choose' @$button.html 'Choose'
if @model.status is MarkdownImage.Status.checking
@$loaded.hide duration:Duration.normal
@$loading.show duration:Duration.normal, queue:true
else
@$loading.hide duration:Duration.normal
@$loaded.show duration:Duration.normal, queue:true
super super
# Backbone.View Overrides ###################################################################### # Backbone.View Overrides ######################################################################
+7 -4
View File
@@ -6,7 +6,10 @@
//- //-
.view__markdown_image .view__markdown_image
.thumbnail: img .loaded
.fileName: p .thumbnail: img
button .fileName: p
input(type="file", accept="image/gif,image/jpeg,image/png" multiple="false") button
input(type="file", accept="image/gif,image/jpeg,image/png" multiple="false")
.error: p
.loading: p checking for image...
+14 -4
View File
@@ -10,6 +10,7 @@ All rights reserved.
display: inline-block; display: inline-block;
margin: 1em 2em 0 0; margin: 1em 2em 0 0;
overflow: hidden;
vertical-align: top; vertical-align: top;
.thumbnail { .thumbnail {
@@ -29,7 +30,7 @@ All rights reserved.
.fileName { .fileName {
height: 3em; height: 3em;
margin: 1em 0 6em 11em; margin: 1em 0 7em 11em;
p { p {
font-weight: bold; font-weight: bold;
@@ -41,8 +42,17 @@ All rights reserved.
} }
input { input {
position: absolute; position: absolute; top: -5em;
visibility: none; }
z-index: -1;
.loading {
height: 10em; width: 33em;
p {
position: absolute; top: 50%; left: 50%;
@include transform(translate(-50%, -50%));
color: $color-gray-light;
}
} }
} }