Permalink
Browse files

BUGFIX "Insert media" loading indicator (fixes #7542)

No "working" indicator in insert media from web button.
Returning the $.ajax object to allow for deferred callbacks
on events other than 'success'
  • Loading branch information...
1 parent 5713a37 commit 682a6a0d1b5966cf29b4b33fddf1fab6e842a028 @chillu chillu committed Jun 22, 2012
Showing with 15 additions and 6 deletions.
  1. +1 −0 admin/css/screen.css
  2. +7 −1 admin/scss/_style.scss
  3. +7 −5 javascript/HtmlEditorField.js
View

Some generated files are not rendered by default. Learn more.

Oops, something went wrong.
View
@@ -1452,7 +1452,7 @@ body.cms-dialog {
float:left;
position: relative;
- label {
+ label {
position: absolute;
left: 8px;
top: 13px;
@@ -1491,6 +1491,12 @@ body.cms-dialog {
}
}
}
+
+ .loading button.add-url .ui-icon {
+ background-image: url(../images/throbber.gif);
+ background-position: 50% 50%;
+ background-repeat: no-repeat;
+ }
}
.cms-content-header{
@@ -762,7 +762,7 @@ ss.editorWrappers['default'] = ss.editorWrappers.tinyMCE;
// TODO Depends on managed mime type
if(node.is('img')) {
- this.showFileView(node.data('url') || node.attr('src'), function() {
+ this.showFileView(node.data('url') || node.attr('src')).complete(function() {
$(this).updateFromNode(node);
self.toggleCloseButton();
self.redraw();
@@ -811,7 +811,7 @@ ss.editorWrappers['default'] = ss.editorWrappers.tinyMCE;
item.addClass('loading');
this.find('.content-edit').append(item);
- $.ajax({
+ return $.ajax({
// url: this.data('urlViewfile') + '?ID=' + id,
url: $.path.addSearchParams(this.attr('action').replace(/MediaForm/, 'viewfile'), params),
success: function(html, status, xhr) {
@@ -908,11 +908,13 @@ ss.editorWrappers['default'] = ss.editorWrappers.tinyMCE;
},
onclick: function(e) {
- var urlField = this.getURLField();
+ var urlField = this.getURLField(), container = this.closest('.CompositeField'), form = this.closest('form');
if (urlField.validate()) {
- var form = this.closest('form');
- form.showFileView('http://' + urlField.val());
+ container.addClass('loading');
+ form.showFileView('http://' + urlField.val()).complete(function() {
+ container.removeClass('loading');
+ });
form.redraw();
}

0 comments on commit 682a6a0

Please sign in to comment.