-
Notifications
You must be signed in to change notification settings - Fork 0
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
DRY up PostsController with before_action #24
base: master
Are you sure you want to change the base?
Changes from 8 commits
7abe4d7
e15466e
77796c8
02417df
de07723
08023dc
b83d217
565aa65
0c484c0
69d947d
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -92,4 +92,9 @@ | |
.confirmation-text { | ||
text-align: center; | ||
} | ||
|
||
.delete-button input { | ||
background-color: red; | ||
margin: 0.5em; | ||
} | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +0,0 @@ | ||
<p class="confirmation-text"> | ||
Are you sure you want to delete your post? | ||
</p> | ||
<%= button_to 'Delete', post_path(id: params[:id], validation: params[:validation]), method: :delete %> | ||
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,13 +3,21 @@ | |
ActiveAdmin.routes(self) | ||
root "posts#index" | ||
|
||
get "posts/delete", to: "posts#delete" | ||
get "posts/confirm", to: "posts#confirm" | ||
# Can we remove these in favor of using the flash, and redirecting? | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Probably. I think I tried once and there was an issue that made it more pain that it was worth at the time. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I'll save that for future work then :) |
||
get "posts/success", to: "posts#success" | ||
resources :posts | ||
|
||
get "validation_error", to: "posts#validation_error" | ||
|
||
resources :posts, except: [:edit] do | ||
member do | ||
constraints validation: /.{32}/ do | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This can probably be limited to There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Cool, decided to go with |
||
get "edit/:validation", to: "posts#edit", as: :edit | ||
get "confirm/:validation", to: "posts#confirm", as: :confirm | ||
end | ||
|
||
get "confirm/:validation", to: "posts#validation_error" # if ^^^^ fails | ||
end | ||
end | ||
|
||
get "about", controller: "about" | ||
|
||
get "contact", to: "contacts#new" | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
is this really the indentation rubocop likes?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
¯ \ _ (ツ) _ / ¯