Skip to content

Commit

Permalink
Issue #206 Modified Courses Tab, edited controllers accordingly
Browse files Browse the repository at this point in the history
  • Loading branch information
serag committed Apr 22, 2014
1 parent 6e71e35 commit 455ddaf
Show file tree
Hide file tree
Showing 6 changed files with 72 additions and 3 deletions.
1 change: 1 addition & 0 deletions tutor/app/controllers/lecturers_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ class LecturersController < ApplicationController
# Author: Serag
def show
@lecturer = Lecturer.find(params[:id])
@courses = @lecturer.courses.order("created_at desc")
end
def index
end
Expand Down
1 change: 1 addition & 0 deletions tutor/app/controllers/students_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ class StudentsController < ApplicationController
# Author: Serag
def show
@student = Student.find(params[:id])
@courses = @student.courses.order("created_at desc")
end
def index
end
Expand Down
1 change: 1 addition & 0 deletions tutor/app/controllers/teaching_assistants_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ class TeachingAssistantsController < ApplicationController
# Author: Serag
def show
@teaching_assistant = TeachingAssistant.find(params[:id])
@courses = @teaching_assistant.courses.order("created_at desc")
end
def index
end
Expand Down
24 changes: 23 additions & 1 deletion tutor/app/views/lecturers/show.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,29 @@
<p> @lecturer.getStat() "to be reviewed" </p>
</div>
<div id="tab3" class="tab">
<p> "courses here" </p>
<table class = "table table-striped", style = "width:80%">
<tr>
<th>Name</th>
<th>Code</th>
<th>Options</th>
<th></th>
</tr>
<% @courses.each do |c| %>
<tr>
<td><%= link_to c.name, :controller => 'courses', :action => 'show', :id => c.id,
:method => :get, class: "btn btn-success" %></td>
<td><%= c.code %></td>
<% if current_lecturer %>
<td>
<%= link_to "Manage Course", {:controller => 'courses', :action => 'edit', :method => :get, :id => c.id}, class: "btn btn-success", style: "text-decoration:none" %>
</td>
<% end %>
<td>
<%= link_to "Discussion Board", {:controller => 'discussion_boards', :action => 'show', :id => c.id }, class: "btn btn-success", method: :get, style: "text-decoration:none" %>
</td>
</tr>
<% end %>
</table>
</div>
</div>
</div>
Expand Down
24 changes: 23 additions & 1 deletion tutor/app/views/students/show.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,29 @@
<p> @student.getStat() "to be reviewed" </p>
</div>
<div id="tab3" class="tab">
<p> "courses here" </p>
<table class = "table table-striped", style = "width:80%">
<tr>
<th>Name</th>
<th>Code</th>
<th>Options</th>
<th></th>
</tr>
<% @courses.each do |c| %>
<tr>
<td><%= link_to c.name, :controller => 'courses', :action => 'show', :id => c.id,
:method => :get, class: "btn btn-success" %></td>
<td><%= c.code %></td>
<% if current_lecturer %>
<td>
<%= link_to "Manage Course", {:controller => 'courses', :action => 'edit', :method => :get, :id => c.id}, class: "btn btn-success", style: "text-decoration:none" %>
</td>
<% end %>
<td>
<%= link_to "Discussion Board", {:controller => 'discussion_boards', :action => 'show', :id => c.id }, class: "btn btn-success", method: :get, style: "text-decoration:none" %>
</td>
</tr>
<% end %>
</table>
</div>
</div>
</div>
Expand Down
24 changes: 23 additions & 1 deletion tutor/app/views/teaching_assistants/show.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,29 @@
<p> @teaching_assistant.getStat() "to be reviewed" </p>
</div>
<div id="tab3" class="tab">
<p> "courses here" </p>
<table class = "table table-striped", style = "width:80%">
<tr>
<th>Name</th>
<th>Code</th>
<th>Options</th>
<th></th>
</tr>
<% @courses.each do |c| %>
<tr>
<td><%= link_to c.name, :controller => 'courses', :action => 'show', :id => c.id,
:method => :get, class: "btn btn-success" %></td>
<td><%= c.code %></td>
<% if current_lecturer %>
<td>
<%= link_to "Manage Course", {:controller => 'courses', :action => 'edit', :method => :get, :id => c.id}, class: "btn btn-success", style: "text-decoration:none" %>
</td>
<% end %>
<td>
<%= link_to "Discussion Board", {:controller => 'discussion_boards', :action => 'show', :id => c.id }, class: "btn btn-success", method: :get, style: "text-decoration:none" %>
</td>
</tr>
<% end %>
</table>
</div>
</div>
</div>
Expand Down

0 comments on commit 455ddaf

Please sign in to comment.