Created
June 12, 2009 23:32
-
-
Save ctdk/129004 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# the part of the story controller that does the saving and such | |
def edit | |
@story = Story.get(params[:id]) | |
@poll = @story.poll[0] | |
#@blogs = @story.user.blogadmins.map { |b| b.blog } | |
@blogs = @story.user.allowed_blogs | |
@taglist = params[:tags] || @story.tags.map { |t| t.tag }.join(", ") | |
if request.post? | |
if (params[:commit] == "Preview") | |
@story.preview_story(params) | |
elsif (params[:commit] == "Save") | |
@story.save_story(params) | |
elsif (params[:commit] == "Publish") | |
@story.publish_story(params) | |
# ?? | |
@story.title = @story.storydraft.title | |
@story.displaystatus = 'published' | |
@story.draft = false | |
@story.time = DateTime.now | |
@story.save | |
elsif (params[:commit] == "Delete") | |
if(params[:delconf]) | |
@story.delete_story | |
else | |
raise DK4Exceptions::StoryError, "Deletion not confirmed, story not deleted." | |
end | |
else | |
raise DK4Exceptions::StoryError, "Invalid action attempted." | |
end | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment