Skip to content
This repository has been archived by the owner on May 20, 2019. It is now read-only.

Date #38

Open
wants to merge 7 commits into
base: master
Choose a base branch
from
Open

Date #38

Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 27 additions & 1 deletion app/assets/stylesheets/admins.css.scss
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,30 @@

.student-list {
margin-bottom:5px;
}
}

// CSS styling for the four buttons in Manage Students (Admin Section):
// (Add Course for Student, Drop Course for Student, Update User, Delete User)

#add-course, #drop-course, #update-user, #delete-user {
height:30px;
width:30px;
position:relative;
text-align:center;
line-height:1em;
padding-left:9px;
}

.table {
border-collapse: separate;
border-spacing: 20px 0;
}


.row {
padding-right: 20px;
}




22 changes: 16 additions & 6 deletions app/views/admins/index.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -17,26 +17,36 @@
<tr>
<th> Actions </th>
<th> Students </th>
<th> Email </th>
</tr>
</thead>
<tbody>
<% @students.each do |student| %>
<tr class="student-list">
<td class="col-md-2">
<div>
<a class="btn btn-success" data-toggle="collapse" href="#coursecollapse<%=student.id%>" href="#" role="button"><i class="fa fa-plus"></i></a> <a class="btn btn-warning" data-toggle="collapse" href="#editcollapse<%=student.id%>" role="button"><i class="fa fa-pencil-square-o"></i></a>
<div class="row">
<div class="border col-xs-3">
<a class="btn btn-success" id="add-course" data-toggle="collapse" data-tt="tooltip" title="Add Course" href="#coursecollapse<%=student.id%>" href="#" role="button"><i class="fa fa-plus"></i></a>
</div>
<div class="border col-xs-3">
<a class="btn btn-warning" id="drop-course" data-toggle="collapse" data_tt="tooltip" title="Drop Course" href="#editcollapse<%=student.id%>" role="button"><i class="fa fa-pencil-square"></i></a>
</div>

<div class="border col-xs-3">
<%= link_to '<span class="btn btn-info" id="update-user" data-toggle="tooltip" title="Update User" href="#" role="button"><i class="fa fa-user"></i></span>'.html_safe, admin_edit_student_path(student), method: :get %>
</div>
<div class="border col-xs-3">
<%= link_to '<span class="btn btn-danger" id="delete-user" data-toggle="tooltip" title="Delete User" href="#" role="button"><i class="fa fa-times"></i></span>'.html_safe, admin_destroy_user_path(student), method: :delete, data: { confirm: "Are you sure you want to delete #{student.name}?" } %>
</div>
<div style="margin-top:5px">

<%= link_to '<span class="btn btn-info" href="#" role="button"><i class="fa fa-user"></i></span>'.html_safe, admin_edit_student_path(student), method: :get %>
<%= link_to '<span style="padding-right:15px"class="btn btn-danger" href="#" role="button"><i class="fa fa-times"></i></span>'.html_safe, admin_destroy_user_path(student), method: :delete, data: { confirm: "Are you sure you want to delete #{student.name}?" } %>
</div>
</td>
<td>
<h4 style="">
<%= student.name %>
</h4>
</td>

<td>
<%= student.email %>

<%= form_tag admin_add_course_path(student) do %>
Expand Down
10 changes: 9 additions & 1 deletion app/views/attendances/mentor_show.html.erb
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
<h2>Attendance for <%= @section.name %></h2>
<% monthArray = ["January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December"] %>

<div class="panel panel-primary">
<div class="panel-heading">
Expand All @@ -19,8 +20,15 @@

<div class="list-group">
<% @current_week.downto(1) do |n| %>
<% start_hour = @section.start %>
<% end_hour = @section.end %>
<% current_day = (@section.start.day + 7 * (n - 1)) % 31 %>
<% month_increment = (@section.start.day + 7 * (n - 1)) / 31 %>
<% current_month = (@section.start.month - 1 + month_increment) % 12 %>


<div class="list-group-item">
<h3 class="list-group-item-heading">Week <%= n %></h3>
<h3 class="list-group-item-heading">Week <%= n %>: <%= monthArray[current_month] %> <%= current_day %> </h3>
<p class="list-group-item-text">
<div class="list-group">
<% @students.each do |student| %>
Expand Down
8 changes: 7 additions & 1 deletion app/views/attendances/show.html.erb
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
<% curr_section = @enroll.section %>
<% monthArray = ["January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December"] %>
<h2>Attendance for <%= curr_section.name %></h2>

<p>
Expand Down Expand Up @@ -46,8 +47,13 @@ Mentor: <%= curr_section.getMentorName %> (<%= curr_section.getMentorEmail %>)
<div class="list-group">
<% (current_week-1).downto(1) do |n|%>
<% attendance = Attendance.where(enroll_id: @enroll, week: n).take %>
<% start_hour = curr_section.start %>
<% end_hour = curr_section.end %>
<% current_day = (curr_section.start.day + 7 * (n - 1)) % 31 %>
<% month_increment = (curr_section.start.day + 7 * (n - 1)) / 31 %>
<% current_month = (curr_section.start.month - 1 + month_increment) % 12 %>
<div class="list-group-item <%= item_class attendance%>">
<h4 class="list-group-item-heading">Week <%= n %></h4>
<h4 class="list-group-item-heading">Week <%= n %>: <%= monthArray[current_month] %> <%= current_day %></h4>
<p class="list-group-item-text">


Expand Down
8 changes: 7 additions & 1 deletion db/seeds.rb
Original file line number Diff line number Diff line change
Expand Up @@ -26,13 +26,19 @@
:password_confirmation => ENV["USER_1_PASS"],
:confirmed_at => "2015-09-09 02:50:19"

user2 = User.create! :name => "Andrew Huang",
user2 = User.create! :name => "Andrew Huang",
:email => "ahuang@berkeley.edu",
:password => ENV["USER_2_PASS"],
:password_confirmation => ENV["USER_2_PASS"],
:confirmed_at => "2015-09-09 02:50:19",
:admin => "true"

user3 = User.create! :name => "Andrew Pong",
:email => "apong@berkeley.edu",
:password => ENV["USER_2_PASS"],
:password_confirmation => ENV["USER_2_PASS"],
:confirmed_at => "2015-09-09 02:50:19"

cs61a = Course.create! :course_name => "CS61A",
:semester => "Spring",
:year => 2016,
Expand Down