* Re-enabled setting of tags in Story and Image prototype

* Added custom Layout.href() method to prevent the URL from being corrupted with the layout ID (which strangely happens from time to time)
 * Uncommented $tags collection in Root.properties to prevent conflict with collection in Site having the same name
 * Fixed output of tags list in Story.getFormValue() method
This commit is contained in:
Tobi Schäfer 2008-01-09 21:34:21 +00:00
parent ece3bedc6d
commit da25a7bfdc
5 changed files with 19 additions and 6 deletions

View file

@ -161,7 +161,7 @@ Image.prototype.update = function(data) {
this.description = data.description; this.description = data.description;
this.touch(); this.touch();
// FIXME: Don't set the tags of the image via Story.prototype.setTags // FIXME: Don't set the tags of the image via Story.prototype.setTags
//Story.prototype.setTags.call(this, data.tags || data.tags_array); Story.prototype.setTags.call(this, data.tags || data.tags_array);
return; return;
}; };

View file

@ -56,6 +56,16 @@ Layout.prototype.getPermission = function(action) {
return false; return false;
}; };
// FIXME: For safety reasons the Layout.href method is overwritten.
// Otherwise it sometimes results in strange URLs containing the layout id.
Layout.prototype.href = function(action) {
res.push();
res.write(this._parent.href());
res.write("layout/");
action && res.write(action);
return res.pop();
}
Layout.prototype.main_action = function() { Layout.prototype.main_action = function() {
res.debug(this.skins.getSkin("Site", "values")); res.debug(this.skins.getSkin("Site", "values"));
if (req.postParams.save) { if (req.postParams.save) {

View file

@ -54,5 +54,7 @@ admins = collection(User)
admins.accessname = name admins.accessname = name
admins.filter = status = 'privileged' admins.filter = status = 'privileged'
$tags = collection(Tag) ## FIXME: This collection has to move (or to be renamed).
$tags.accessname = name ## Otherwise it conflicts with the collection in Site with the same name.
#$tags = collection(Tag)
#$tags.accessname = name

View file

@ -140,7 +140,9 @@ Story.prototype.getFormValue = function(name) {
case "status": case "status":
return this.status || Story.PUBLIC; return this.status || Story.PUBLIC;
case "tags": case "tags":
return this.tags.list(); return this.tags.list().map(function(item) {
return item.tag.name;
});
} }
return this[name]; return this[name];
}; };
@ -178,7 +180,7 @@ Story.prototype.update = function(data) {
this.title = data.title; this.title = data.title;
this.text = data.text; this.text = data.text;
this.setContent(data); this.setContent(data);
//this.setTags(data.tags || data.tag_array) this.setTags(data.tags || data.tag_array)
this.commentMode = data.commentMode; this.commentMode = data.commentMode;
this.mode = data.mode; this.mode = data.mode;
this.status = data.status; this.status = data.status;

View file

@ -228,7 +228,6 @@ $(function() {
</p> </p>
<p> <p>
<button type="submit" name="save" value="1">save</button> <button type="submit" name="save" value="1">save</button>
<!--button type="submit" name="save" value="2">publish</button-->
<button type="submit" name="cancel" value="1">cancel</button> <button type="submit" name="cancel" value="1">cancel</button>
<button type="button" id="restore" value="1">restore</button> <button type="button" id="restore" value="1">restore</button>
</p> </p>