-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Mohab
authored and
Mohab
committed
May 17, 2014
1 parent
272287c
commit 5f684ab
Showing
4 changed files
with
203 additions
and
120 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
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,2 +1,15 @@ | ||
module CoursesHelper | ||
|
||
def crop (string, length) | ||
s = string | ||
i = length | ||
if s.length > i | ||
while s[i] != ' ' | ||
i -= 1 | ||
end | ||
else | ||
return s | ||
end | ||
return s.slice(0, i) + '...' | ||
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 |
---|---|---|
@@ -1,146 +1,174 @@ | ||
<div class = "course_info panel-body" > | ||
<div class= "row course_title"> | ||
<div class="course_code"><%= @course.code %></div> | ||
<div class="course_name"><%= @course.name %></div> | ||
<% if current_lecturer %> | ||
<div class="course_manage"> | ||
<%= link_to "Manage", { :controller => 'courses', :action => 'edit', | ||
:method => :get, :id => params[:id] }, class: "" %> | ||
<div class= "left-box" > | ||
<div class="xob"> | ||
<div class = "course_info panel-body" > | ||
<div class= "row course_title"> | ||
<div class="course_code"><%= @course.code %></div> | ||
<div class="course_name"><%= @course.name %></div> | ||
<% if current_lecturer %> | ||
<div class="course_manage"> | ||
<%= link_to "Manage", { :controller => 'courses', :action => 'edit', | ||
:method => :get, :id => params[:id] }, class: "" %> | ||
</div> | ||
<% end %> | ||
</div> | ||
<% end %> | ||
</div> | ||
<div class="row"> | ||
<div class="course_sem"> | ||
Semester <%= @course.semester %> | ||
Class <%= @course.year %> | ||
<div class="row"> | ||
<div class="course_sem"> | ||
Semester <%= @course.semester %> | ||
Class <%= @course.year %> | ||
</div> | ||
</div> | ||
</div> | ||
<div class="row course_description"> | ||
<p>About the Course</p> | ||
<div class="description-body" ><%= @course.description %> Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod | ||
tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, | ||
quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo | ||
consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse | ||
cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non | ||
proident, sunt in culpa qui officia deserunt mollit anim id est laborum.</div> | ||
</div> | ||
<div class="view_discussion"> | ||
<%= link_to "View Discussion Board", { :controller => 'discussion_boards', :action => 'show', :id => params[:id] }, method: :get %> | ||
</div> | ||
</div> | ||
</div> | ||
<div class="row course_description"> | ||
<p>About the Course</p> | ||
<div class="description-body" ><%= @course.description %> Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod | ||
tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, | ||
quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo | ||
consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse | ||
cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non | ||
proident, sunt in culpa qui officia deserunt mollit anim id est laborum.</div> | ||
</div> | ||
<div class="view_discussion"> | ||
<%= link_to "View Discussion Board", { :controller => 'discussion_boards', :action => 'show', :id => params[:id] }, method: :get %> | ||
</div> | ||
|
||
<div class="well"> | ||
<% topics = @course.topics %> | ||
<% if topics.any? %> | ||
<% topics.each_slice(2) do |topic| %> | ||
<% if topic.count == 1 %> | ||
<div class="row"> | ||
<div class="container col-sm-6 box-bag topic-box"> | ||
<div class="well" style="background-color: #d7dde2 !important;"> | ||
<h3><b><%= link_to topic[0].title, topic[0]%></b><hr></h3> | ||
<label><%= topic[0].description %></label><br><br> | ||
<% if lecturer_signed_in? || teaching_assistant_signed_in? %> | ||
<%= link_to "Delete Topic", {controller: "topics", | ||
action: "destroy", :id => topic[0].id}, | ||
class: "btn btn-danger btn-xs", method: :delete %> | ||
<% end %> | ||
</div> | ||
</div> | ||
</div> | ||
<% else %> | ||
<div class="row"> | ||
<% topics.each do |topic| %> | ||
<div class="container col-sm-6 topic-box"> | ||
<div class="well" style="background-color: #d7dde2 !important;"> | ||
<h3><b><%= link_to topic.title, topic %></b><hr></h3> | ||
<label><%= topic.description %></label><br><br> | ||
<% if lecturer_signed_in? || teaching_assistant_signed_in? %> | ||
<%= link_to "Delete Topic", {controller: "topics", | ||
action: "destroy", :id => topic.id}, | ||
class: "btn btn-danger btn-xs", method: :delete %> | ||
<% end %> | ||
</div> | ||
</div> | ||
<%end%> | ||
</div> | ||
<% end %> | ||
<% end %> | ||
<% end %> | ||
</div> | ||
|
||
|
||
<div class="well"> | ||
<% assignments = @course.assignments %> | ||
<% if assignments.any? %> | ||
<% if @can_edit %> | ||
<% assignments.each_slice(2) do |assignment| %> | ||
<% if assignment.count == 1 %> | ||
<div class="xox"> | ||
<div class="well bell"> | ||
<div class="box-title"> Topics | ||
<% if lecturer_signed_in? || teaching_assistant_signed_in? %> | ||
<%= link_to "Add Topic", {:controller => 'topics', :action => 'new', | ||
:course_id => @course.id}, class: "btn btn-default", method: :post %> | ||
<% end %> | ||
</div> | ||
<% topics = @course.topics %> | ||
<% if topics.any? %> | ||
<% topics.each_slice(2) do |topic| %> | ||
<% if topic.count == 1 %> | ||
<div class="row"> | ||
<div class="container col-sm-6 box-bag topic-box"> | ||
<div class="well" style="background-color: #d7dde2 !important;"> | ||
<h3><b><%= link_to assignment[0].title, assignment[0]%></b><hr></h3> | ||
<label><%= assignment[0].description %></label><br><br> | ||
<% if @can_edit %> | ||
<% if !assignment[0] .publish %> | ||
<span class="badge">unpublished</span> | ||
<% end %> | ||
<h3><b><%= link_to topic[0].title, topic[0]%></b><hr></h3> | ||
<% if topic[0].description %> | ||
<label><%= crop(topic[0].description, 150) %></label><br><br> | ||
<% end %> | ||
<% if lecturer_signed_in? || teaching_assistant_signed_in? %> | ||
<%= link_to "Delete Topic", {controller: "topics", | ||
action: "destroy", :id => topic[0].id}, | ||
class: "btn btn-danger btn-xs", method: :delete %> | ||
<% end %> | ||
</div> | ||
</div> | ||
</div> | ||
<% else %> | ||
<div class="row"> | ||
<% assignment.each do |assignment| %> | ||
<% topics.each do |topic| %> | ||
<div class="container col-sm-6 topic-box"> | ||
<div class="well" style="background-color: #d7dde2 !important;"> | ||
<h3><b><%= link_to assignment.title, assignment %></b><hr></h3> | ||
<label><%= assignment.description %></label><br><br> | ||
<% if @can_edit %> | ||
<% if !assignment.publish %> | ||
<span class="badge">unpublished</span> | ||
<% end %> | ||
<h3><b><%= link_to topic.title, topic %></b><hr></h3> | ||
<% if topic.description %> | ||
<label><%= crop(topic.description,150) %></label><br><br> | ||
<% end %> | ||
|
||
<% if lecturer_signed_in? || teaching_assistant_signed_in? %> | ||
<%= link_to "Delete Topic", {controller: "topics", | ||
action: "destroy", :id => topic.id}, | ||
class: "btn btn-danger btn-xs", method: :delete %> | ||
<% end %> | ||
</div> | ||
</div> | ||
<%end%> | ||
</div> | ||
<% end %> | ||
<% end %> | ||
<% else %> | ||
<% assignments.each_slice(2) do |assignment| %> | ||
<% if assignment.count == 1 %> | ||
<div class="row"> | ||
<div class="container col-sm-6 box-bag topic-box"> | ||
<div class="well" style="background-color: #d7dde2 !important;"> | ||
<h3><b><%= link_to assignment[0].title, assignment[0]%></b><hr></h3> | ||
<label><%= assignment[0].description %></label><br><br> | ||
<% if @can_edit %> | ||
<% if !assignment[0].publish %> | ||
<span class="badge">unpublished</span> | ||
<% end %> | ||
<% end %> | ||
</div> | ||
</div> | ||
</div> | ||
<% else %> | ||
<div class="row"> | ||
<% assignment.each do |assignment| %> | ||
<div class="container col-sm-6 topic-box"> | ||
<div class="well" style="background-color: #d7dde2 !important;"> | ||
<h3><b><%= link_to assignment.title, assignment %></b><hr></h3> | ||
<% if assignment.publish %> | ||
<%= link_to assignment.title, assignment %> | ||
<% if assignment.due_date > DateTime.now.to_date %> | ||
<span class="badge">Due</span> | ||
<% end %> | ||
</div> | ||
</div> | ||
|
||
<div class="xox"> | ||
<div class="well bell"> | ||
<div class="box-title"> Assignments | ||
<% if lecturer_signed_in? || teaching_assistant_signed_in? %> | ||
<div class="btn btn-default"> Create Assignment</div> | ||
<% end %> | ||
</div> | ||
<% assignments = @course.assignments %> | ||
<% if assignments.any? %> | ||
<% if @can_edit %> | ||
<% assignments.each_slice(2) do |assignment| %> | ||
<% if assignment.count == 1 %> | ||
<div class="row"> | ||
<div class="container col-sm-6 box-bag topic-box"> | ||
<div class="well" style="background-color: #d7dde2 !important;"> | ||
<h3><b><%= link_to assignment[0].title, assignment[0]%></b><hr></h3> | ||
<% if assignment[0].description %> | ||
<label><%= crop(assignment[0].description,150) %></label><br><br> | ||
<% end %> | ||
<% if @can_edit %> | ||
<% if !assignment[0].publish %> | ||
<span class="badge">unpublished</span> | ||
<% end %> | ||
<% end %> | ||
</div> | ||
</div> | ||
</div> | ||
<% else %> | ||
<div class="row"> | ||
<% assignment.each do |assignment| %> | ||
<div class="container col-sm-6 topic-box"> | ||
<div class="well" style="background-color: #d7dde2 !important;"> | ||
<h3><b><%= link_to assignment.title, assignment %></b><hr></h3> | ||
<% if assignment.description %> | ||
<label><%= assignment.description %></label><br><br> | ||
<% end %> | ||
<% if @can_edit %> | ||
<% if !assignment.publish %> | ||
<span class="badge">unpublished</span> | ||
<% end %> | ||
<% end %> | ||
|
||
</div> | ||
</div> | ||
<%end%> | ||
</div> | ||
<% end %> | ||
<% end %> | ||
<% else %> | ||
<% assignments.each_slice(2) do |assignment| %> | ||
<% if assignment.count == 1 %> | ||
<div class="row"> | ||
<div class="container col-sm-6 box-bag topic-box"> | ||
<div class="well" style="background-color: #d7dde2 !important;"> | ||
<h3><b><%= link_to assignment[0].title, assignment[0]%></b><hr></h3> | ||
<% if assignment[0].description %> | ||
<label><%= assignment[0].description %></label><br><br> | ||
<% end %> | ||
<% end %> | ||
<% if @can_edit %> | ||
<% if !assignment[0].publish %> | ||
<span class="badge">unpublished</span> | ||
<% end %> | ||
<% end %> | ||
</div> | ||
</div> | ||
</div> | ||
<%end%> | ||
</div> | ||
<% else %> | ||
<div class="row"> | ||
<% assignment.each do |assignment| %> | ||
<div class="container col-sm-6 topic-box"> | ||
<div class="well" style="background-color: #d7dde2 !important;"> | ||
<h3><b><%= link_to assignment.title, assignment %></b><hr></h3> | ||
<% if assignment.publish %> | ||
<%= link_to assignment.title, assignment %> | ||
<% if assignment.due_date > DateTime.now.to_date %> | ||
<span class="badge">Due</span> | ||
<% end %> | ||
<% end %> | ||
</div> | ||
</div> | ||
<%end%> | ||
</div> | ||
<% end %> | ||
<% end %> | ||
<% end %> | ||
<% end %> | ||
<% end %> | ||
<% end %> | ||
</div> | ||
</div> | ||
</div> |
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