* Re-implemented autosave feature (ie. automatic backup / restore) for stories and comments
* Removed obsolete rescue methods * Moved contents of many individual skin files as subskins in the corresponding prototype skin file * Moved commentform_macro of Story prototype into compatibility module
This commit is contained in:
parent
ec700a655f
commit
75644bde63
18 changed files with 132 additions and 146 deletions
|
@ -66,13 +66,10 @@ Comment.prototype.main_action = function() {
|
|||
};
|
||||
|
||||
Comment.prototype.edit_action = function() {
|
||||
if (session.data.rescuedText) {
|
||||
restoreRescuedText();
|
||||
}
|
||||
|
||||
if (req.postParams.save) {
|
||||
try {
|
||||
this.update(req.postParams);
|
||||
delete session.data.backup;
|
||||
res.message = gettext("The comment was successfully updated.");;
|
||||
res.redirect(this.story.href() + "#" + this._id);
|
||||
} catch (ex) {
|
||||
|
@ -121,29 +118,3 @@ Comment.remove = function() {
|
|||
this.remove();
|
||||
return;
|
||||
};
|
||||
|
||||
Comment.prototype.___comment_action = function() {
|
||||
if (session.data.rescuedText) {
|
||||
restoreRescuedText();
|
||||
}
|
||||
|
||||
var comment = new Comment;
|
||||
if (req.postParams.save) {
|
||||
try {
|
||||
comment.update(req.postParams);
|
||||
this.add(comment);
|
||||
res.message;
|
||||
res.redirect(comment.href());
|
||||
} catch (err) {
|
||||
res.message = err.toString();
|
||||
}
|
||||
}
|
||||
|
||||
res.data.action = this.href(req.action);
|
||||
res.data.title = gettext("Reply to comment of story {0}",
|
||||
res.handlers.story.getTitle());
|
||||
res.data.body = this.renderSkinAsString("Comment#replay");
|
||||
res.data.body += comment.renderSkinAsString("Comment#edit");
|
||||
this.site.renderSkin("page");
|
||||
return;
|
||||
};
|
||||
|
|
|
@ -37,16 +37,17 @@
|
|||
</div>
|
||||
|
||||
<% #edit %>
|
||||
<% comment.skin Story#restore %>
|
||||
<% parent.skin <% parent.type suffix="#comment" %> %>
|
||||
<a name="form" id="form"></a>
|
||||
<br />
|
||||
<a name="form" id="form"></a>
|
||||
<form method="post" action="<% response.action %>">
|
||||
<p>
|
||||
<p class="backup">
|
||||
<span class="small">Title:</span><br />
|
||||
<% comment.input title class="formTitle" %>
|
||||
</p>
|
||||
<p>
|
||||
<p class="backup">
|
||||
<span class="small">Text:</span><br />
|
||||
<% comment.textarea text cols="31" rows="10" class="formText" %>
|
||||
</p>
|
||||
|
@ -59,5 +60,6 @@
|
|||
<p>
|
||||
<button type="submit" name="save" value="1">save</button>
|
||||
<button type="submit" name="cancel" value="1">cancel</button>
|
||||
<button type="button" id="restore" value="1">restore</button>
|
||||
</p>
|
||||
</form>
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue