Skip to content

Commit

Permalink
Fixes georgia blog post creation
Browse files Browse the repository at this point in the history
  • Loading branch information
Mathieu Gagné committed Dec 12, 2014
1 parent 2c7ef40 commit ee447df
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 12 deletions.
4 changes: 2 additions & 2 deletions app/controllers/georgia/pages_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ class PagesController < ApplicationController
def show
if @page
authorize @page
redirect_to [:edit, @page, @page.current_revision]
redirect_to edit_page_revision_path(@page, @page.current_revision)
else
authorize Georgia::Page
redirect_to [:search, model], alert: "This #{instance_name} has been deleted."
Expand All @@ -20,7 +20,7 @@ def show
def edit
if @page and @page.current_revision
authorize @page
redirect_to [:edit, @page, @page.current_revision]
redirect_to edit_page_revision_path(@page, @page.current_revision)
else
authorize Georgia::Page
redirect_to [:search, model], alert: "This #{instance_name} has been deleted."
Expand Down
20 changes: 10 additions & 10 deletions app/controllers/georgia/revisions_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ def index

def show
authorize @revision
redirect_to [:edit, @page, @revision]
redirect_to edit_page_revision_path(@page, @revision)
end

def edit
Expand All @@ -33,9 +33,9 @@ def update
service_object = service.new(current_user, @page, @revision, sanitized_attributes)
if service_object.call
CreateActivity.new(@revision, :update, owner: current_user).call
redirect_to [:edit, @page, service_object.revision], notice: "#{service_object.revision.title} was successfully updated."
redirect_to edit_page_revision_path(@page, service_object.revision), notice: "#{service_object.revision.title} was successfully updated."
else
redirect_to [:edit, @page, @revision], alert: service_object.revision.errors.full_messages.join('. ')
redirect_to edit_page_revision_path(@page, @revision), alert: service_object.revision.errors.full_messages.join('. ')
end
end
end
Expand All @@ -62,9 +62,9 @@ def draft
ensure_remove_previous_drafts_of_the_same_page
if @draft = Georgia::CloneRevision.create(@revision, status: 'draft', revised_by_id: current_user.id)
CreateActivity.new(@draft, :draft, owner: current_user).call
redirect_to [:edit, @page, @draft], notice: "You successfully created a new draft."
redirect_to edit_page_revision_path(@page, @draft), notice: "You successfully created a new draft."
else
redirect_to [:edit, @page, @revision], alert: "Oups! Something went wrong."
redirect_to edit_page_revision_path(@page, @revision), alert: "Oups! Something went wrong."
end
end

Expand All @@ -73,9 +73,9 @@ def request_review
if @revision.update(status: :review)
CreateActivity.new(@revision, :review, owner: current_user).call
notify("#{current_user.name} is asking you to review #{@revision.title}.", edit_page_revision_path(@page, @revision, only_path: false))
redirect_to [:edit, @page, @revision], notice: "You successfully submited #{@revision.title} for review."
redirect_to edit_page_revision_path(@page, @revision), notice: "You successfully submited #{@revision.title} for review."
else
redirect_to [:edit, @page, @revision], alert: "Oups! Something went wrong."
redirect_to edit_page_revision_path(@page, @revision), alert: "Oups! Something went wrong."
end
end

Expand All @@ -85,9 +85,9 @@ def approve
@page.current_revision.update(status: :revision)
@page.update(revision_id: @revision.id)
CreateActivity.new(@revision, :approve, owner: current_user).call
redirect_to [:edit, @page, @revision], notice: "You have successfully approved and published #{@revision.title}."
redirect_to edit_page_revision_path(@page, @revision), notice: "You have successfully approved and published #{@revision.title}."
else
redirect_to [:edit, @page, @revision], alert: "Oups! Something went wrong."
redirect_to edit_page_revision_path(@page, @revision), alert: "Oups! Something went wrong."
end
end

Expand All @@ -99,7 +99,7 @@ def decline
@revision.destroy
redirect_to [:edit, @page], notice: message
else
redirect_to [:edit, @page, @revision], alert: "Oups! Something went wrong."
redirect_to edit_page_revision_path(@page, @revision), alert: "Oups! Something went wrong."
end
end

Expand Down

0 comments on commit ee447df

Please sign in to comment.