forked from alaashafaee/Coolsoft-14
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Adding updated and fixed files issue alaashafaee#211
- Loading branch information
Mohamed Fadel
authored and
Mohamed Fadel
committed
Apr 22, 2014
1 parent
408ff4f
commit b0444b2
Showing
2 changed files
with
27 additions
and
0 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
class HintsController < ApplicationController | ||
|
||
@@answer_id = nil | ||
|
||
# [Delete a Hint - Story 4.21] | ||
# This action takes the hint id, removes it from the database | ||
# and then redirects the user to the edit page accompanied | ||
# with a "Hint deleted" message. | ||
# Parameters: | ||
# params[:id]: The current hint's id | ||
# Returns: | ||
# none | ||
# Author: Mohamed Fadel | ||
def destroy | ||
hint = Hint.find_by_id(params[:id]) | ||
hint.destroy | ||
flash[:success_deletion] = "Hint deleted." | ||
redirect_to :controller => 'model_answers', :action => 'edit', :id => @@answer_id | ||
end | ||
end |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
<!--Add delete button to the edit view in model answers | ||
Author: Mohamed Fadel--> | ||
|
||
<th style = "width:20%">Delete</th> | ||
|
||
<td><%= button_to "Delete", {controller: :hints, action: :destroy, id: hint1.id}, | ||
:method => :delete, class: 'btn btn-primary btn-xs' %></td> |