application/js/views/page_view.js in spontaneous-0.2.0.beta1 vs application/js/views/page_view.js in spontaneous-0.2.0.beta2
- old
+ new
@@ -27,11 +27,11 @@
path_wrap.append(path_text);
if (!self.page.is_root()) {
var resync = dom.a({ "title":"Sync the path to the page title"}).click(function() {
- Spontaneous.Ajax.post(['/slug', self.page.id(), "titlesync"].join("/"), {}, self.save_complete.bind(self));
+ Spontaneous.Ajax.put(['/page', self.page.id(), "slug/sync"].join("/"), {}, self.save_complete.bind(self));
});
path_wrap.append( dom.h3('.titlesync').append(resync));
}
@@ -52,15 +52,26 @@
this.panel.append(path_wrap);
this.path_wrap = path_wrap
return this.panel;
},
set_title: function(title) {
+ var self = this;
title = title || this.page.title();
this.title.html(title);
if (this.page.content.hidden) {
- this.title.append(dom.span().text(' (hidden)'));
+ self.title.append(dom.span().text(' (hidden)'));
}
+ var maxHeight = 36;
+ window.setTimeout(function() {
+ var t = self.title
+ , height = function() { return t.height(); }
+ , fs = window.parseInt(t.css('font-size'), 10);
+ ;
+ while (height() > maxHeight && fs > 10) {
+ t.css('font-size', --fs);
+ }
+ }, 0);
},
unavailable_loaded: function(response) {
var u = {};
for (var i = 0, ii = response.length; i < ii; i++) {
u[response[i]] = true;
@@ -105,11 +116,11 @@
}.bind(this));
edit.fadeIn(200);
}.bind(this));
},
save_uid: function(uid) {
- Spontaneous.Ajax.post('/uid/'+this.page.id(), {'uid':uid}, this.uid_save_complete.bind(this));
+ Spontaneous.Ajax.put(['/page',this.page.id(), "uid"].join("/"), {'uid':uid}, this.uid_save_complete.bind(this));
},
uid_save_complete: function(response, status, xhr) {
if (status === 'success') {
var view = $('h3.uid', this.panel), edit = $('.edit', this.panel), uid = (response.uid == "" ? "----" : response.uid);
// nasty but the value is only used for display
@@ -119,11 +130,11 @@
}
},
open_url_editor: function() {
this.unavailable = false;
this.url_editor_open = true;
- Spontaneous.Ajax.get(['/slug', this.page.id(), 'unavailable'].join('/'), this.unavailable_loaded.bind(this));
+ Spontaneous.Ajax.get(['/page', this.page.id(), 'slug/unavailable'].join('/'), this.unavailable_loaded.bind(this));
this.panel.animate({'height': '+=14'}, 200, function() {
var view = $('h3', this.panel), edit = $('.edit', this.panel);
view.hide();
edit.hide().empty();
var path = [""], parts = this.page.get('path').split('/'), slug = parts.pop();
@@ -209,10 +220,10 @@
if (this.error) { this.error.fadeOut(100); }
if (this.input && this.input.hasClass('error')) { this.input.removeClass('error'); }
},
save: function(slug) {
- Spontaneous.Ajax.post('/slug/'+this.page.id(), {'slug':slug}, this.save_complete.bind(this));
+ Spontaneous.Ajax.put(['/page',this.page.id(), "slug"].join("/"), {'slug':slug}, this.save_complete.bind(this));
},
save_complete: function(response, status, xhr) {
if (status === 'success') {
if (this.url_editor_open) {