-
Notifications
You must be signed in to change notification settings - Fork 3
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
C3 fadel 211 remove helping hints 4.21 #307
Closed
Closed
Changes from 17 commits
Commits
Show all changes
19 commits
Select commit
Hold shift + click to select a range
92a4b6c
created a view
c4d2623
modification in 'new'view in hints and tips
0ebaa4e
indentation and documentation
73a743a
editing view
4c4cde6
adding views
1e61e13
modifications in view
88cdf8f
failure scenario
e00036a
failure scenario
67571d7
Merge branch 'C4_Nadine_265_view_hints_tips_4.22' of https://github.c…
a423e4a
Issue #210 Adding helping hints
ee2d0e5
Modifying the adding helping hints Issue #210
ebaee3a
Modifying the documentation Issue #210
f877acb
Modifying hints controller Issue #210
f81fb89
Modifying hints controller Issue #210
41cb87c
Issue #210 Adding problem hints
0cecad7
Remove helping hints Issue #211
22cad5c
Fixing indentation issue #211
c210134
Fixing documentation and code issue #211
db83e1e
Fixing indentation issues #211
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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,3 @@ | ||
# Place all the behaviors and hooks related to the matching controller here. | ||
# All this logic will automatically be available in application.js. | ||
# You can use CoffeeScript in this file: http://coffeescript.org/ |
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,3 @@ | ||
# Place all the behaviors and hooks related to the matching controller here. | ||
# All this logic will automatically be available in application.js. | ||
# You can use CoffeeScript in this file: http://coffeescript.org/ |
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,27 @@ | ||
// Place all the styles related to the Hints controller here. | ||
// They will automatically be included in application.css. | ||
// You can use Sass (SCSS) here: http://sass-lang.com/ | ||
thk,tdj{ | ||
overflow: hidden; | ||
width: 500px; | ||
height: 50px; | ||
display: block; | ||
|
||
} | ||
td{ | ||
//height: 70px; | ||
width: 20px; | ||
} | ||
.achievements-wrapper { table-layout:fixed; } | ||
.the-table { | ||
table-layout: fixed; | ||
word-wrap: break-word; | ||
} | ||
.myWidth { max-width: 20px; } | ||
.concat div { overflow: hidden; -ms-text-overflow: ellipsis; -o-text-overflow: ellipsis; text-overflow: ellipsis; white-space: nowrap; width: inherit; } | ||
//overflow: auto; | ||
//"table table-condensed table-striped" | ||
.the-table { | ||
table-layout: fixed; | ||
word-wrap: break-word; | ||
} |
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 @@ | ||
// Place all the styles related to the Tips controller here. | ||
// They will automatically be included in application.css. | ||
// You can use Sass (SCSS) here: http://sass-lang.com/ | ||
td{ | ||
//height: 70px; | ||
width: 20px; | ||
} |
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,62 @@ | ||
class HintsController < ApplicationController | ||
|
||
@@answer_id = nil | ||
|
||
# [Adding Helping Hints - 4.12] | ||
# Creates a new record to Hint Table | ||
# Parameters: | ||
# owner_id: ID of the hint owner | ||
# owner type: type of hint owner | ||
# category: states whether it is a hint or tip | ||
# Returns: | ||
# Redirects to edit page on success, refreshes on failure | ||
# Author: Mohamed Fadel | ||
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.
@fadel1493 It should be like that. Please apply this to the rest of the file. |
||
def create | ||
p = Hint.new(permitCreate) | ||
if lecturer_signed_in? | ||
p.owner_id = current_lecturer.id | ||
p.owner_type = "lecturer" | ||
p.category = false | ||
p.model_answer_id = @@answer_id | ||
else | ||
p.owner_id = current_teaching_assistant.id | ||
p.owner_type = "teaching_assistant" | ||
p.category = false | ||
p.model_answer_id = @@answer_id | ||
end | ||
|
||
if p.save | ||
redirect_to :controller => 'model_answers', :action => 'edit', :id => @@answer_id | ||
else | ||
flash.keep[:notice] = "Hint is missing paramaters" | ||
redirect_to :back | ||
end | ||
end | ||
|
||
# [Adding Helping Hints - 4.12] | ||
# Passes the input of the form as paramaters for create action to use it | ||
# Parameters: | ||
# submission_counter: hint's submission counter | ||
# message: hint's message | ||
# Returns: params to create action | ||
# Author: Mohamed Fadel | ||
def permitCreate | ||
params.require(:Hint).permit(:submission_counter, :message) | ||
end | ||
|
||
# [Delete a Hint - Story 4.21] | ||
# This action takes the hint id, remove 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,13 @@ | ||
class TipsController < ApplicationController | ||
# [View hints and tips] | ||
# It fetches from database all the previous tips. | ||
# Parameters: | ||
# @tips: All the previous tips that had been entered before. | ||
# @tips_check:All the previous tips that had been entered before to check if it is a tip or hint. | ||
# Return : none | ||
# Author: Nadine Adel | ||
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. @fadel1493 You cannot merge other peoples' code. |
||
def new | ||
@tips= Hint.all | ||
@tips_check =Hint.all | ||
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,2 @@ | ||
module HintsHelper | ||
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,2 @@ | ||
module TipsHelper | ||
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> |
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,2 @@ | ||
<h1>Hints#create</h1> | ||
<p>Find me in app/views/hints/create.html.erb</p> |
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,2 @@ | ||
<h1>Hints#destroy</h1> | ||
<p>Find me in app/views/hints/destroy.html.erb</p> |
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,2 @@ | ||
<h1>Hints#edit</h1> | ||
<p>Find me in app/views/hints/edit.html.erb</p> |
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,21 @@ | ||
<h1 align ="center">Add a Hint</h1> | ||
<br> | ||
<!--A form that takes the input for the model Problem and calls the action create | ||
through two text fields :title and description --> | ||
<%= form_for :Hint, url: {action: "create"} do |p| %> | ||
<p> | ||
<%= p.label :submission_counter %><br> | ||
<%= p.text_field :submission_counter %> | ||
</p> | ||
<p> | ||
<%= p.label :message %><br> | ||
<%= p.text_area :message , :cols => "50", :rows => "10" %> | ||
</p> | ||
<p> | ||
<%= p.submit %> | ||
</p> | ||
<% end %> | ||
<!-- A division for the flash message output to view the action's output --> | ||
<% if flash[:notice] %> | ||
<div class="notice"><%= flash[:notice] %></div> | ||
<% 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,25 @@ | ||
<h1 align ="center">Add a Hint</h1> | ||
<br> | ||
<!--A form that takes the input for the model Problem and calls the action create | ||
through two text fields :title and description --> | ||
<%= form_for :Hint, url: {action: "create"} do |p| %> | ||
<p> | ||
<%= p.label :category %><br> | ||
<%= p.text_field :category %> | ||
</p> | ||
<p> | ||
<%= p.label :submission_counter %><br> | ||
<%= p.text_field :submission_counter %> | ||
</p> | ||
<p> | ||
<%= p.label :message %><br> | ||
<%= p.text_area :message , :cols => "50", :rows => "10" %> | ||
</p> | ||
<p> | ||
<%= p.submit %> | ||
</p> | ||
<% end %> | ||
<!-- A division for the flash message output to view the action's output --> | ||
<% if flash[:notice] %> | ||
<div class="notice"><%= flash[:notice] %></div> | ||
<% 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 |
---|---|---|
@@ -1,15 +1,15 @@ | ||
<h1>Previous Answers</h1> | ||
<!--<h1>Previous Answers</h1> | ||
<!--Nadine:a view in which there is a loop to fetch fom database all previous answers.--> | ||
<table> | ||
<tr> | ||
<th>Title</th> | ||
<th>Text</th> | ||
</tr> | ||
<% @answers.each do |answer1| %> | ||
<tr> | ||
<td><%= answer1.answer %></td> | ||
<td><%= answer1.answer %></td> | ||
</tr> | ||
<% end %> | ||
</table> | ||
<!--<table> | ||
<tr> | ||
<th>Title</th> | ||
<th>Text</th> | ||
</tr> | ||
<% @answers.each do |answer1| %> | ||
<tr> | ||
<td><%= answer1.answer %></td> | ||
<td><%= answer1.answer %></td> | ||
</tr> | ||
<% end %> | ||
</table> | ||
|
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,73 @@ | ||
<%= form_for :model_answer, url: model_answers_path do |f| %> | ||
<!--Nadine:form to display textarea where the answer should be written and show the previous answers in a table.--> | ||
|
||
<%= flash[:notice]%> | ||
<!--kkdk--> | ||
|
||
<!--Nadine:a view in which there is a loop to fetch fom database all previous answers.--> | ||
<p> | ||
|
||
<h2>Please Insert your model answer</h2> | ||
<%= f.text_area :answer %> | ||
|
||
</p> | ||
|
||
|
||
<p> | ||
|
||
<%= f.submit class: "btn btn-primary" %> | ||
|
||
</p> | ||
<body> | ||
<script type="text/javascript"> | ||
|
||
function toggle_visibility(id) { | ||
var e = document.getElementById(id); | ||
if(e.style.display == 'block') | ||
e.style.display = 'none'; | ||
else | ||
e.style.display = 'block'; | ||
} | ||
|
||
</script> | ||
</body> | ||
|
||
<a href="#" onclick="toggle_visibility('foo');"><h2><li>Previous Answers</li></h2></a> | ||
<div id="foo" style="display:none;"> | ||
|
||
|
||
<table class="table table-striped"> | ||
|
||
<thead> | ||
<tr> | ||
<th style="width: 30%">Title</th> | ||
<th style="width: 20%">View or Edit</th> | ||
</tr> | ||
</thead> | ||
<tbody> | ||
|
||
<tr> | ||
<% @answers.each do |answer1| %> | ||
<td><%= answer1.answer %></td> | ||
<td><%= button_to "View or Edit" , {:action => 'new', :controller => 'tips',:method => :post} , { | ||
class: 'btn btn-primary btn-xs' } %></td> | ||
</tr> | ||
|
||
</tbody> | ||
<% end %> | ||
</table> | ||
|
||
|
||
|
||
</div> | ||
|
||
|
||
|
||
|
||
|
||
<!--dd--> | ||
|
||
|
||
|
||
|
||
<% 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
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 |
---|---|---|
|
@@ -5,6 +5,7 @@ var time; | |
var timer_is_on=0; | ||
|
||
function timer(){ | ||
@time = min +":" + digit; | ||
digit++; | ||
|
||
if(digit>59){ | ||
|
Empty file.
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,2 @@ | ||
<h1>Tips#create</h1> | ||
<p>Find me in app/views/tips/create.html.erb</p> |
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,2 @@ | ||
<h1>Tips#destroy</h1> | ||
<p>Find me in app/views/tips/destroy.html.erb</p> |
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,2 @@ | ||
<h1>Tips#edit</h1> | ||
<p>Find me in app/views/tips/edit.html.erb</p> |
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,57 @@ | ||
<body> | ||
<script type="text/javascript"> | ||
function toggle_visibility(id) { | ||
var e = document.getElementById(id); | ||
if(e.style.display == 'block') | ||
e.style.display = 'none'; | ||
else | ||
e.style.display = 'block'; | ||
} | ||
</script> | ||
</body> | ||
|
||
<% @tips1=Array.new %> | ||
<% @tips_check.each do |tip2| %> | ||
<% if tip2.category == true %> | ||
<% @tips1.push(tip2) %> | ||
<%end%> | ||
<%end%> | ||
|
||
<a href="#" return:false; class="Lst" onclick="toggle_visibility('foo'); return false;" style="font:120px"> Previous Tips</a> | ||
<div id="foo" style="display:none;"> | ||
<% if [email protected]? %> | ||
<p>No previous Tips</p> | ||
<% end %> | ||
<%if [email protected]?%> | ||
<table class="table table-striped", style = "width:60%"> | ||
<thead> | ||
<tr> | ||
<th style = "width:30%" >Tips</th> | ||
<th style = "width:10%" >Time of showing in seconds</th> | ||
<th style = "width:20%">Edit</th> | ||
</tr> | ||
</thead> | ||
<tbody> | ||
<tr> | ||
<% @tips.each do |tip1| %> | ||
<% if tip1.category == true %> | ||
<td style = "max-width: 300px; word-wrap:break-word;"><%= tip1.message %> </td> | ||
<td style ="width:20%"><%= tip1.time %></td> | ||
<td><%= button_to "Edit" , {:action => 'new', :controller => 'tips',:method => :post},{class: 'btn btn-primary btn-xs' } %></td> | ||
</tr> | ||
</tbody> | ||
<% end %> | ||
<% end %> | ||
|
||
</table> | ||
<%end%> | ||
</div> | ||
|
||
<style type="text/css" /> | ||
a.Lst { | ||
font-size: 30px; | ||
line-height: 0px; | ||
padding-left: 0px; | ||
font-weight: normal; | ||
} | ||
</style> |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
@fadel1493 Remove this tab.