Permalink
Browse files

Started trying to fix up the attachment upload.

  • Loading branch information...
1 parent 83cdc7a commit 8a9d9567fec4be4efdcdb54948516a6404b7f4bf @Jellyfishboy committed Jul 26, 2015
Showing with 36 additions and 1 deletion.
  1. +34 −0 app/assets/javascripts/trado.admin.js
  2. +2 −1 bower.json
@@ -246,6 +246,40 @@ trado.admin =
amendAttachments: function()
{
+ $('#amend_attachment').ajaxSubmit(
+ {
+ beforeSubmit: function(a,f,o)
+ {
+ o.dataType = 'json';
+ },
+ complete: function(XMLHttpRequest, textStatus)
+ {
+ var json = $.parseJSON(XMLHttpRequest.responseText)
+ $('#attachment-form').modal('hide');
+ if (data.first_record)
+ {
+ $('#attachments').html(data.image);
+ }
+ else
+ {
+ if (method === 'POST')
+ {
+ $('#attachments').append(data.image);
+ }
+ else
+ {
+ $('#attachment-' + data.attachment_id).html(data.image);
+ }
+ }
+ soca.animation.alert(
+ '.widget-header',
+ 'success',
+ 'amend-attachment-alert',
+ '<i class="icon-checkmark-circle"></i>Successfully ' + message + ' an attachment.',
+ 5000
+ )
+ },
+ });
var files;
$('body').on('change', '#attachment_file', function()
{
View
@@ -14,7 +14,8 @@
"modernizr": "~2.7.2",
"jquery.scrollTo": "~1.4.11",
"typeahead.js": "~0.10.2",
- "theia-sticky-sidebar": "~1.2.0"
+ "theia-sticky-sidebar": "~1.2.0",
+ "jquery-form": "~3.46.0"
},
"resolutions": {
"jquery": "1.7.2"

0 comments on commit 8a9d956

Please sign in to comment.