Skip to content
This repository has been archived by the owner on Jun 27, 2019. It is now read-only.

Commit

Permalink
Hide ACCESS_KEY, move shotgun in dev-group, change DELETE request
Browse files Browse the repository at this point in the history
  • Loading branch information
SashaShostyr committed Jul 27, 2018
1 parent 8c86e5a commit fc6d893
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 4 deletions.
2 changes: 1 addition & 1 deletion 2331/3/Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,10 @@ gem 'json'
gem 'mechanize'
gem 'ohm'
gem 'rake'
gem 'shotgun'
gem 'sinatra'
gem 'thin'

group :development do
gem 'pry'
gem 'shotgun'
end
1 change: 1 addition & 0 deletions 2331/3/controllers/application_controller.rb
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
class ApplicationController < Sinatra::Base
set :views, File.expand_path(File.join(__FILE__, '../../views'))
set :method_override, true

not_found do
erb :not_found
Expand Down
2 changes: 1 addition & 1 deletion 2331/3/controllers/articles_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ class ArticlesController < ApplicationController
erb :'articles/edit'
end

get '/:id/delete' do
delete '/:id' do
Article[params[:id]].delete
redirect to '/'
end
Expand Down
7 changes: 5 additions & 2 deletions 2331/3/views/articles/show.erb
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,11 @@
<h2><%= @article.title %></h2>
</div>

<a href="/articles/<%= @article.id %>/edit" class="btn btn-info">Edit article</a> |
<a href="/articles/<%= @article.id %>/delete" class="btn btn-danger">Delete article</a>
<a href="/articles/<%= @article.id %>/edit" class="btn btn-info">Edit Article</a> |
<form action="/articles/<%= @article.id %>" method="post" style="display: inline">
<input type="hidden" name="_method" value="DELETE">
<input type="submit" value="Delete Article" class="btn btn-danger">
</form>


<h3>Comments</h3>
Expand Down

0 comments on commit fc6d893

Please sign in to comment.