New upload form

This commit is contained in:
Fergal Moran
2013-08-19 20:39:02 +01:00
parent dfee17045d
commit 33d1aab99a
10 changed files with 307 additions and 298 deletions

1
.gitignore vendored
View File

@@ -22,3 +22,4 @@ plays.txt
dss_ah
fixtures.json
dss_test.db
dsskeys

10
dss/test_settings.py Normal file
View File

@@ -0,0 +1,10 @@
DATABASES = {
'default': {
'ENGINE': 'django.db.backends.sqlite3',
'NAME': 'dss_test.db',
'USER': '',
'PASSWORD': '',
'HOST': '',
'PORT': '',
}
}

1
spa/fixtures/full.json Normal file

File diff suppressed because one or more lines are too long

View File

@@ -5,7 +5,7 @@ import timeside
class Command(NoArgsCommand):
def handle_noargs(self, **options):
try:
audio_file = 'spring.mp3'
audio_file = '/home/fergalm/Dropbox/Private/deepsouthsounds.com/working/sample.mp3'
decoder = timeside.decoder.FileDecoder(audio_file)
grapher = timeside.grapher.Spectrogram(width=1920, height=1080)
(decoder | grapher).run()

BIN
spa/tests/data/test.mp3 Normal file

Binary file not shown.

View File

@@ -24,7 +24,8 @@ define ['app.lib/editableView', 'moment', 'utils', 'libs/backbone/backbone.sypho
url: "/_upload/"
start: ->
$("#mix-details", @el).show()
done: ->
done: =>
@state++;
$("#div-upload-mix", @el).hide()
onRender: ->
@@ -86,7 +87,7 @@ define ['app.lib/editableView', 'moment', 'utils', 'libs/backbone/backbone.sypho
saveChanges: =>
console.log("MixEditView: saveChanges")
data = Syphon.serialize(this)
data = Syphon.serialize($("#mix-details-form", @el)[0])
@model.set data
@model.set "upload-hash", @guid
@model.set "upload-extension", $("#upload-extension", @el).val()

View File

@@ -1,18 +1,18 @@
// Generated by CoffeeScript 1.6.2
// Generated by CoffeeScript 1.3.3
(function() {
var __bind = function(fn, me){ return function(){ return fn.apply(me, arguments); }; },
__hasProp = {}.hasOwnProperty,
__extends = function(child, parent) { for (var key in parent) { if (__hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; };
define(['app.lib/editableView', 'moment', 'utils', 'libs/backbone/backbone.syphon', 'text!/tpl/MixEditView', 'jquery.fileupload', 'jquery.fileupload-process', 'jquery.fileupload-audio', 'jquery.iframe-transport', 'jquery.ui.widget', 'jquery.fileupload-ui', 'libs/ajaxfileupload', 'libs/jasny/bootstrap-fileupload'], function(EditableView, moment, utils, Syphon, Template) {
var MixEditView, _ref;
var MixEditView;
return MixEditView = (function(_super) {
__extends(MixEditView, _super);
function MixEditView() {
this.saveChanges = __bind(this.saveChanges, this); _ref = MixEditView.__super__.constructor.apply(this, arguments);
return _ref;
this.saveChanges = __bind(this.saveChanges, this);
return MixEditView.__super__.constructor.apply(this, arguments);
}
MixEditView.prototype.template = _.template(Template);
@@ -36,6 +36,7 @@
};
MixEditView.prototype.onDomRefresh = function() {
var _this = this;
if (!this.model.id) {
return $("#fileupload", this.el).fileupload({
downloadTemplateId: void 0,
@@ -44,7 +45,8 @@
return $("#mix-details", this.el).show();
},
done: function() {
return $("#div-upload-mix", this.el).hide();
_this.state++;
return $("#div-upload-mix", _this.el).hide();
}
});
}
@@ -52,7 +54,6 @@
MixEditView.prototype.onRender = function() {
var parent;
console.log("MixEditView: onRender");
this.sendImage = false;
parent = this;
@@ -72,7 +73,6 @@
},
success: function(data) {
var $out;
$out = $("#results");
$out.html("Your results:");
return $out.append("<div><pre>" + data + "</pre></div>");
@@ -98,7 +98,6 @@
},
initSelection: function(element, callback) {
var genres, result;
result = [];
genres = parent.model.get("genre-list");
if (genres !== undefined) {
@@ -128,9 +127,8 @@
MixEditView.prototype.saveChanges = function() {
var data,
_this = this;
console.log("MixEditView: saveChanges");
data = Syphon.serialize(this);
data = Syphon.serialize($("#mix-details-form", this.el)[0]);
this.model.set(data);
this.model.set("upload-hash", this.guid);
this.model.set("upload-extension", $("#upload-extension", this.el).val());
@@ -183,6 +181,7 @@
MixEditView;
return MixEditView;
})(EditableView);

View File

@@ -1,17 +1,16 @@
// Generated by CoffeeScript 1.6.2
// Generated by CoffeeScript 1.3.3
(function() {
var __hasProp = {}.hasOwnProperty,
__extends = function(child, parent) { for (var key in parent) { if (__hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; };
define(['jquery', 'underscore', 'marionette', 'vent', 'text!/tpl/SearchView', 'text!/tpl/SearchResultView', 'typeahead'], function($, _, Marionette, vent, Template, SearchResultView) {
var SearchView, _ref;
var SearchView;
SearchView = (function(_super) {
__extends(SearchView, _super);
function SearchView() {
_ref = SearchView.__super__.constructor.apply(this, arguments);
return _ref;
return SearchView.__super__.constructor.apply(this, arguments);
}
SearchView.prototype.template = _.template(Template);
@@ -23,7 +22,6 @@
SearchView.prototype.engine = {
compile: function(template) {
var compiled;
compiled = _.template(template);
return {
render: function(context) {
@@ -35,7 +33,6 @@
SearchView.prototype.onShow = function() {
var t;
if (typeof typeahead !== "undefined" && typeahead !== null) {
t = $('#search-text', this.el).typeahead({
name: "search",

View File

@@ -103,7 +103,7 @@
</div>
</div>
<div class="well" id="mix-details">
<form class="form-horizontal">
<form id="mix-details-form" class="form-horizontal">
{% csrf_token %}
<input type="hidden" class="upload-hash" id="upload-hash-details">
<input type="hidden" id="upload-extension">
@@ -137,7 +137,7 @@
<span class="btn btn-file">
<span class="fileupload-new">Select image</span>
<span class="fileupload-exists">Change</span>
<input type="file" />
<input id="mix_image" name="mix_image" type="file" />
</span>
<a href="#" class="btn fileupload-exists" data-dismiss="fileupload">Remove</a>
</div>