Skip to content

Commit

Permalink
remove unnecessary comments
Browse files Browse the repository at this point in the history
  • Loading branch information
tunde-anddigital committed Dec 15, 2021
1 parent 6146363 commit 3fcd8fa
Show file tree
Hide file tree
Showing 4 changed files with 1 addition and 22 deletions.
9 changes: 1 addition & 8 deletions app/controllers/admin/content_assets_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,30 +2,25 @@ module Admin
class ContentAssetsController < AdminController
before_action :set_content_asset, only: %i[show edit update destroy]

# GET /content_assets
def index
@content_assets = ContentAsset.all
end

# GET /content_assets/1
def show; end

# GET /content_assets/new
def new
@content_asset = ContentAsset.new
end

# GET /content_assets/1/edit
def edit
authorize @content_asset, :edit?
end

# POST /content_assets
def create
@content_asset = ContentAsset.new(content_asset_params)

authorize @content_asset, :create?
# Not sure about what to do here

if upload_rate_limit_exceeded?
redirect_to admin_content_assets_path, notice: "Only one upload is allowed in each 30 seconds, please wait..."
elsif @content_asset.save
Expand All @@ -35,7 +30,6 @@ def create
end
end

# PATCH/PUT /content_assets/1
def update
authorize @content_asset, :update?

Expand All @@ -46,7 +40,6 @@ def update
end
end

# DELETE /content_assets/1
def destroy
authorize @content_asset, :destroy?

Expand Down
5 changes: 0 additions & 5 deletions app/controllers/admin/content_blocks_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,21 +2,17 @@ module Admin
class ContentBlocksController < AdminController
before_action :set_content_block, only: %i[edit update]

# GET /content_blocks
def index
authorize User
@content_blocks = ContentBlock.all
end

# GET /content_blocks/new
def new
@content_block = ContentBlock.new
end

# GET /content_blocks/1/edit
def edit; end

# POST /content_blocks
def create
@content_block = ContentBlock.new(content_block_params)
begin
Expand All @@ -32,7 +28,6 @@ def create
end
end

# PATCH/PUT /content_blocks/1
def update
authorize @content_block, :update?
if @content_block.update(content_block_params)
Expand Down
1 change: 0 additions & 1 deletion app/controllers/admin/content_page_versions_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@ def destroy
redirect_to admin_content_pages_path, notice: "Content page version was successfully destroyed."
end

# GET /content_page_version/1/edit
def edit; end

def update
Expand Down
8 changes: 0 additions & 8 deletions app/controllers/admin/content_pages_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,27 +2,23 @@ module Admin
class ContentPagesController < AdminController
before_action :set_content_page, only: %i[show edit update destroy versions unpublish]

# GET /content_pages
def index
@content_pages = ContentPage.top_level.order_by_position
end

# GET /content_pages/1
def show
unless @content_page.is_published
redirect_to("/404")
end
end

# GET /content_pages/new
def new
# If the new page is a child, pass through its parent id
# Pages with a nil parent_id are top_level
next_position = ContentPage.maximum("position") ? (ContentPage.maximum("position") + 1) : 1
@content_page = ContentPage.new(parent_id: params[:parent_id], position: next_position)
end

# POST /content_pages
def create
@content_page = ContentPage.new(content_page_params)
@content_page.author = current_user.name
Expand All @@ -42,10 +38,8 @@ def create
end
end

# GET /content_pages/1/edit
def edit; end

# PATCH/PUT /content_pages/1
# ContentPage markdown is never directly updated. Changes happen to markdown
# as ContentPageVersions are created, edited and published
# Changes to position are applied directly to the published page, position has
Expand Down Expand Up @@ -85,11 +79,9 @@ def update
render :edit
end

# DELETE /content_pages/1
def destroy
authorize @content_page, :destroy?
@content_page.destroy!
# This was content_pages_url before change if needed
redirect_to admin_content_pages_path, notice: "Content page was successfully destroyed."
end

Expand Down

0 comments on commit 3fcd8fa

Please sign in to comment.