+
{{/ attachments }}
diff --git a/src/sa_web/static/css/default.css b/src/sa_web/static/css/default.css
index 07e2cf028..890077bc8 100644
--- a/src/sa_web/static/css/default.css
+++ b/src/sa_web/static/css/default.css
@@ -1152,6 +1152,17 @@ ul.recent-points {
margin: 0 1em 0.75em 0;
}
+.fixed-ratio {
+ position: relative;
+ background-color: #eee;
+}
+
+.fixed-ratio img {
+ position: absolute;
+ top: 0; bottom: 0; left: 0; right: 0;
+ min-width: 3em;
+}
+
.place-list .place-label,
.place-list .place-value {
}
diff --git a/src/sa_web/static/js/models.js b/src/sa_web/static/js/models.js
index 9f16b0531..42b2ffce0 100644
--- a/src/sa_web/static/js/models.js
+++ b/src/sa_web/static/js/models.js
@@ -300,17 +300,23 @@ var Shareabouts = Shareabouts || {};
var args = normalizeModelArguments(key, val, options),
attrs = _.extend(this.attributes, args.attrs);
- return this._attachBlob(attrs.blob, attrs.name, args.options);
+ return this._attachBlob(attrs.blob, attrs, args.options);
},
- _attachBlob: function(blob, name, options) {
+ _attachBlob: function(blob, attrs, options) {
var formData = new FormData(),
self = this,
progressHandler = S.Util.wrapHandler('progress', this, options.progress),
- myXhr = $.ajaxSettings.xhr();
+ myXhr = $.ajaxSettings.xhr(),
+ key;
formData.append('file', blob);
- formData.append('name', name);
+
+ for (key in attrs) {
+ if (!_(['file', 'blob', 'undefined']).contains(key)) {
+ formData.append(key, attrs[key]);
+ }
+ }
options = options || {};
diff --git a/src/sa_web/static/js/views/place-detail-view.js b/src/sa_web/static/js/views/place-detail-view.js
index a93eb89de..dc2e75a3c 100644
--- a/src/sa_web/static/js/views/place-detail-view.js
+++ b/src/sa_web/static/js/views/place-detail-view.js
@@ -60,6 +60,11 @@ var Shareabouts = Shareabouts || {};
// Augment the template data with the attachments list
data.attachments = this.model.attachmentCollection.toJSON();
+ var i, a;
+ for (i = 0; i < data.attachments.length; i++) {
+ a = data.attachments[i];
+ a.ratio = 100.0 * a.height / a.width;
+ }
this.$el.html(Handlebars.templates['place-detail'](data));
diff --git a/src/sa_web/static/js/views/place-form-view.js b/src/sa_web/static/js/views/place-form-view.js
index 27ee425d7..d2969bd1a 100644
--- a/src/sa_web/static/js/views/place-form-view.js
+++ b/src/sa_web/static/js/views/place-form-view.js
@@ -131,7 +131,9 @@ var Shareabouts = Shareabouts || {};
data = {
name: fieldName,
blob: blob,
- file: canvas.toDataURL('image/jpeg')
+ file: canvas.toDataURL('image/jpeg'),
+ width: canvas.width,
+ height: canvas.height
};
attachment = self.model.attachmentCollection.find(function(model) {