-
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
Changes from 16 commits
92a4b6c
c4d2623
0ebaa4e
73a743a
4c4cde6
1e61e13
88cdf8f
e00036a
67571d7
a423e4a
ee2d0e5
ebaee3a
f877acb
f81fb89
41cb87c
0cecad7
22cad5c
c210134
db83e1e
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 |
---|---|---|
@@ -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/ |
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/ |
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; | ||
} |
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; | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,78 @@ | ||
class HintsController < ApplicationController | ||
|
||
@@answer_id = nil | ||
|
||
# [View hints and tips-Story 4.22] | ||
# It fetches from database all the previous hints. | ||
# Parameters: | ||
# @hints: All the previous hints that had been entered before. | ||
# @hints_check: All the previous hints that had been entered before to check if it is a hint or a tip. | ||
# Return : table with all previous hints | ||
# Author: Nadine Adel | ||
def index | ||
|
||
@hints = Hint.all | ||
@hints_check=Hint.all | ||
end | ||
def new | ||
@answer = ModelAnswer.find(params[:model_answer_id]) | ||
@@answer_id = params[:model_answer_id] | ||
end | ||
|
||
# [Adding Helping Hints - 4.12] | ||
# Creates a new record to Hint Table | ||
# Parameters: | ||
# owner_id: ID of the hint owner | ||
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 Please use just one tab, not a space and a tab. Apply this to the rest of the file. |
||
# 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 | ||
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 Place this: "Redirects to edit page on success, refreshes on failure" in a new line preceded by a tab. Apply this to the rest of the file. |
||
# Author: Mohamed Fadel | ||
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 | ||
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 Use a tabs, not spaces. Apply this to the rest of the file. |
||
# 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 |
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 |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
module HintsHelper | ||
end |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
module TipsHelper | ||
end |
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> |
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> |
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> |
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> |
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 %> |
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 %> |
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> | ||
|
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 %> |
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){ | ||
|
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> |
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> |
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> |
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 You can't make a pull request of other peoples' methods. Apply this to the rest of the file.