* Added Story.add() method as counterpart to Story.remove() and to establish kind of internal API
* Rewrote external API (Api prototype) reducing redundant code by calling Story.add() method
This commit is contained in:
parent
fe159c3112
commit
2ca26e4f28
7 changed files with 70 additions and 53 deletions
|
@ -19,8 +19,8 @@
|
|||
// limitations under the License.
|
||||
//
|
||||
// $Revision$
|
||||
// $LastChangedBy$
|
||||
// $LastChangedDate$
|
||||
// $Author$
|
||||
// $Date$
|
||||
// $URL$
|
||||
|
||||
/**
|
||||
|
@ -85,11 +85,9 @@ Stories.prototype.main_action = function() {
|
|||
}
|
||||
|
||||
Stories.prototype.create_action = function() {
|
||||
var story = new Story;
|
||||
if (req.postParams.save) {
|
||||
try {
|
||||
story.update(req.postParams);
|
||||
this.add(story);
|
||||
story = Story.add(this, req.postParams);
|
||||
story.notify(req.action);
|
||||
delete session.data.backup;
|
||||
res.message = gettext("The story was successfully created.");
|
||||
|
@ -102,7 +100,7 @@ Stories.prototype.create_action = function() {
|
|||
|
||||
res.data.title = gettext("Add Story");
|
||||
res.data.action = this.href(req.action);
|
||||
res.data.body = story.renderSkinAsString("Story#edit");
|
||||
res.data.body = (new Story).renderSkinAsString("Story#edit");
|
||||
this._parent.renderSkin("Site#page");
|
||||
return;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue