Commit fb589815 authored by Ioannis Tsafaras's avatar Ioannis Tsafaras
Browse files

Add tooltip to upload application disabled submit button

parent 2705b40b
...@@ -4,6 +4,7 @@ var UploadController = Ember.Controller.extend({ ...@@ -4,6 +4,7 @@ var UploadController = Ember.Controller.extend({
session: Ember.inject.service('session'), session: Ember.inject.service('session'),
wrongExt: false, wrongExt: false,
userHasEnteredData: false, userHasEnteredData: false,
submitDisabled: false,
actions : { actions : {
upload: function() { upload: function() {
...@@ -53,6 +54,7 @@ var UploadController = Ember.Controller.extend({ ...@@ -53,6 +54,7 @@ var UploadController = Ember.Controller.extend({
var xhr = new window.XMLHttpRequest(); var xhr = new window.XMLHttpRequest();
_this.set("userHasEnteredData", true); _this.set("userHasEnteredData", true);
submit_button.setAttribute("disabled", "disabled"); submit_button.setAttribute("disabled", "disabled");
_this.set("submitDisabled", true);
//Upload progress //Upload progress
xhr.upload.addEventListener("progress", function(evt){ xhr.upload.addEventListener("progress", function(evt){
if (evt.lengthComputable) { if (evt.lengthComputable) {
...@@ -62,6 +64,7 @@ var UploadController = Ember.Controller.extend({ ...@@ -62,6 +64,7 @@ var UploadController = Ember.Controller.extend({
if (percentComplete === 1) if (percentComplete === 1)
{ {
submit_button.removeAttribute("disabled"); submit_button.removeAttribute("disabled");
_this.set("submitDisabled", false);
_this.set("userHasEnteredData", false); _this.set("userHasEnteredData", false);
} }
} }
......
...@@ -125,8 +125,16 @@ ...@@ -125,8 +125,16 @@
</div><!--col--> </div><!--col-->
</div><!--row--> </div><!--row-->
<button type="submit" class="btn btn-primary" id="submit-button">Submit</button> {{#unless submitDisabled}}
<button type="submit" class="btn btn-primary" id="submit-button">Submit</button>
</form> {{else}}
{{#tool-tip}}
<button type="submit" class="btn btn-primary has-tooltip"
data-tooltip-content="<center>An application is already uploading!</center>"
id="submit-button">Submit</button>
{{/tool-tip}}
{{/unless}}
</form>
</section><!-- /.content --> </section><!-- /.content -->
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment