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'
BaseController = require './base_controller'
{Duration} = require '../constants'
MarkdownImage = require '../models/markdown_image'
########################################################################################################################
@@ -61,6 +62,10 @@ module.exports = class MarkdownImageController extends BaseController
@$fileName = @$('.fileName p')
@$button = @$('button')
@$input = @$('input')
@$errorContainer = @$('.error')
@$errorMessage = @$('.error p')
@$loaded = @$('.loaded')
@$loading = @$('.loading')
super
@@ -77,6 +82,13 @@ module.exports = class MarkdownImageController extends BaseController
else
@$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
# Backbone.View Overrides ######################################################################
+3
View File
@@ -6,7 +6,10 @@
//-
.view__markdown_image
.loaded
.thumbnail: img
.fileName: p
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;
margin: 1em 2em 0 0;
overflow: hidden;
vertical-align: top;
.thumbnail {
@@ -29,7 +30,7 @@ All rights reserved.
.fileName {
height: 3em;
margin: 1em 0 6em 11em;
margin: 1em 0 7em 11em;
p {
font-weight: bold;
@@ -41,8 +42,17 @@ All rights reserved.
}
input {
position: absolute;
visibility: none;
z-index: -1;
position: absolute; top: -5em;
}
.loading {
height: 10em; width: 33em;
p {
position: absolute; top: 50%; left: 50%;
@include transform(translate(-50%, -50%));
color: $color-gray-light;
}
}
}