From 5f684ab23e2a7ed24d3b1d21ea241d476e477ae8 Mon Sep 17 00:00:00 2001 From: Mohab Date: Sat, 17 May 2014 02:21:50 +0200 Subject: [PATCH] Issue #466 editing assignments view --- tutor/app/assets/stylesheets/style.css | 44 +++- tutor/app/helpers/courses_helper.rb | 13 + tutor/app/views/courses/show.html.erb | 264 ++++++++++--------- tutor/app/views/layouts/application.html.erb | 2 +- 4 files changed, 203 insertions(+), 120 deletions(-) diff --git a/tutor/app/assets/stylesheets/style.css b/tutor/app/assets/stylesheets/style.css index 1b74280b..2bcf60fb 100644 --- a/tutor/app/assets/stylesheets/style.css +++ b/tutor/app/assets/stylesheets/style.css @@ -19,7 +19,7 @@ padding-top: 20px; } .content_container{ - background-color: #FAFAFA; + } .profile_picture { width:200px; @@ -165,4 +165,46 @@ .sign_in_button { margin-right: 20px; +} + +.left-box{ + margin: -30px -15px -15px; +} + +.xob { + padding: 0px 20px 20px; + margin-top: 20px; + margin-bottom: 20px; + border-radius: 5px; + background-color: #FAFAFA; + +} + +.xox { + background-color: #FAFAFA; + border-radius: 5px; +} + +.topic-box .well { + max-width: 400px; + max-height: 260px; + min-width: 400px; + min-height: 260px; + overflow-y: auto; +} + +.box-title { + font-size: 2em; + color: #808080; + margin-bottom: 30px; + margin-top: 15px; + font-weight: lighter; + border-bottom: solid 0.5px #D2D3D4; + padding-bottom: 10px; +} + +.box-title .btn { + float: right; + height: 40px; + text-align: center; } \ No newline at end of file diff --git a/tutor/app/helpers/courses_helper.rb b/tutor/app/helpers/courses_helper.rb index c159f1e1..40eb65f4 100644 --- a/tutor/app/helpers/courses_helper.rb +++ b/tutor/app/helpers/courses_helper.rb @@ -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 diff --git a/tutor/app/views/courses/show.html.erb b/tutor/app/views/courses/show.html.erb index fecc6f86..68b40cc7 100644 --- a/tutor/app/views/courses/show.html.erb +++ b/tutor/app/views/courses/show.html.erb @@ -1,146 +1,174 @@ -
-
-
<%= @course.code %>
-
<%= @course.name %>
- <% if current_lecturer %> -
- <%= link_to "Manage", { :controller => 'courses', :action => 'edit', - :method => :get, :id => params[:id] }, class: "" %> +
+
+
+
+
<%= @course.code %>
+
<%= @course.name %>
+ <% if current_lecturer %> +
+ <%= link_to "Manage", { :controller => 'courses', :action => 'edit', + :method => :get, :id => params[:id] }, class: "" %> +
+ <% end %>
- <% end %> -
-
-
- Semester <%= @course.semester %> - Class <%= @course.year %> +
+
+ Semester <%= @course.semester %> + Class <%= @course.year %> +
+
+
+
+

About the Course

+
<%= @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.
+
+
+ <%= link_to "View Discussion Board", { :controller => 'discussion_boards', :action => 'show', :id => params[:id] }, method: :get %>
-
-
-

About the Course

-
<%= @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.
-
-
- <%= link_to "View Discussion Board", { :controller => 'discussion_boards', :action => 'show', :id => params[:id] }, method: :get %> -
- -
- <% topics = @course.topics %> - <% if topics.any? %> - <% topics.each_slice(2) do |topic| %> - <% if topic.count == 1 %> -
-
-
-

<%= link_to topic[0].title, topic[0]%>

-

- <% 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 %> -
-
-
- <% else %> -
- <% topics.each do |topic| %> -
-
-

<%= link_to topic.title, topic %>

-

- <% 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 %> -
-
- <%end%> -
- <% end %> - <% end %> - <% end %> -
- -
- <% assignments = @course.assignments %> - <% if assignments.any? %> - <% if @can_edit %> - <% assignments.each_slice(2) do |assignment| %> - <% if assignment.count == 1 %> +
+
+
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 %> +
+ <% topics = @course.topics %> + <% if topics.any? %> + <% topics.each_slice(2) do |topic| %> + <% if topic.count == 1 %>
-

<%= link_to assignment[0].title, assignment[0]%>

-

- <% if @can_edit %> - <% if !assignment[0] .publish %> - unpublished - <% end %> +

<%= link_to topic[0].title, topic[0]%>

+ <% if topic[0].description %> +

<% 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 %>
<% else %>
- <% assignment.each do |assignment| %> + <% topics.each do |topic| %>
-

<%= link_to assignment.title, assignment %>

-

- <% if @can_edit %> - <% if !assignment.publish %> - unpublished - <% end %> +

<%= link_to topic.title, topic %>

+ <% if topic.description %> +

<% 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 %>
<%end%>
<% end %> <% end %> - <% else %> - <% assignments.each_slice(2) do |assignment| %> - <% if assignment.count == 1 %> -
-
-
-

<%= link_to assignment[0].title, assignment[0]%>

-

- <% if @can_edit %> - <% if !assignment[0].publish %> - unpublished - <% end %> - <% end %> -
-
-
- <% else %> -
- <% assignment.each do |assignment| %> -
-
-

<%= link_to assignment.title, assignment %>

- <% if assignment.publish %> - <%= link_to assignment.title, assignment %> - <% if assignment.due_date > DateTime.now.to_date %> - Due + <% end %> +
+
+ +
+
+
Assignments + <% if lecturer_signed_in? || teaching_assistant_signed_in? %> +
Create Assignment
+ <% end %> +
+ <% assignments = @course.assignments %> + <% if assignments.any? %> + <% if @can_edit %> + <% assignments.each_slice(2) do |assignment| %> + <% if assignment.count == 1 %> +
+
+
+

<%= link_to assignment[0].title, assignment[0]%>

+ <% if assignment[0].description %> +

+ <% end %> + <% if @can_edit %> + <% if !assignment[0].publish %> + unpublished + <% end %> + <% end %> +
+
+
+ <% else %> +
+ <% assignment.each do |assignment| %> +
+
+

<%= link_to assignment.title, assignment %>

+ <% if assignment.description %> +

+ <% end %> + <% if @can_edit %> + <% if !assignment.publish %> + unpublished + <% end %> + <% end %> + +
+
+ <%end%> +
+ <% end %> + <% end %> + <% else %> + <% assignments.each_slice(2) do |assignment| %> + <% if assignment.count == 1 %> +
+
+
+

<%= link_to assignment[0].title, assignment[0]%>

+ <% if assignment[0].description %> +

<% end %> - <% end %> + <% if @can_edit %> + <% if !assignment[0].publish %> + unpublished + <% end %> + <% end %> +
- <%end%> -
+ <% else %> +
+ <% assignment.each do |assignment| %> +
+
+

<%= link_to assignment.title, assignment %>

+ <% if assignment.publish %> + <%= link_to assignment.title, assignment %> + <% if assignment.due_date > DateTime.now.to_date %> + Due + <% end %> + <% end %> +
+
+ <%end%> +
+ <% end %> + <% end %> <% end %> <% end %> - <% end %> - <% end %> +
+
\ No newline at end of file diff --git a/tutor/app/views/layouts/application.html.erb b/tutor/app/views/layouts/application.html.erb index d638e3eb..8ddf415e 100644 --- a/tutor/app/views/layouts/application.html.erb +++ b/tutor/app/views/layouts/application.html.erb @@ -59,7 +59,7 @@
<% if signed_in? %>
-
+
<%= yield %>