-
Notifications
You must be signed in to change notification settings - Fork 1.3k
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
Showing
31 changed files
with
1,298 additions
and
33 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -523,6 +523,3 @@ DEPENDENCIES | |
uglifier | ||
will_paginate | ||
zip-zip | ||
|
||
BUNDLED WITH | ||
1.11.2 |
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 |
---|---|---|
@@ -0,0 +1,2 @@ | ||
// Place all the behaviors and hooks related to the matching controller here. | ||
// All this logic will automatically be available in application.js. |
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 |
---|---|---|
@@ -0,0 +1,73 @@ | ||
body { | ||
background-color: #fff; | ||
color: #333; | ||
font-family: verdana, arial, helvetica, sans-serif; | ||
font-size: 13px; | ||
line-height: 18px; | ||
} | ||
|
||
p, ol, ul, td { | ||
font-family: verdana, arial, helvetica, sans-serif; | ||
font-size: 13px; | ||
line-height: 18px; | ||
} | ||
|
||
pre { | ||
background-color: #eee; | ||
padding: 10px; | ||
font-size: 11px; | ||
} | ||
|
||
a { | ||
color: #000; | ||
|
||
&:visited { | ||
color: #666; | ||
} | ||
|
||
&:hover { | ||
color: #fff; | ||
background-color: #000; | ||
} | ||
} | ||
|
||
div { | ||
&.field, &.actions { | ||
margin-bottom: 10px; | ||
} | ||
} | ||
|
||
#notice { | ||
color: green; | ||
} | ||
|
||
.field_with_errors { | ||
padding: 2px; | ||
background-color: red; | ||
display: table; | ||
} | ||
|
||
#error_explanation { | ||
width: 450px; | ||
border: 2px solid red; | ||
padding: 7px; | ||
padding-bottom: 0; | ||
margin-bottom: 20px; | ||
background-color: #f0f0f0; | ||
|
||
h2 { | ||
text-align: left; | ||
font-weight: bold; | ||
padding: 5px 5px 5px 15px; | ||
font-size: 12px; | ||
margin: -7px; | ||
margin-bottom: 0px; | ||
background-color: #c00; | ||
color: #fff; | ||
} | ||
|
||
ul li { | ||
font-size: 12px; | ||
list-style: square; | ||
} | ||
} |
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 |
---|---|---|
@@ -0,0 +1,3 @@ | ||
// Place all the styles related to the submission_viewing_events controller here. | ||
// They will automatically be included in application.css. | ||
// You can use Sass (SCSS) here: http://sass-lang.com/ |
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 |
---|---|---|
@@ -0,0 +1,64 @@ | ||
class SubmissionViewingEventsController < ApplicationController | ||
def action_allowed? | ||
true | ||
end | ||
|
||
# record time when link or file is opened in new window | ||
def record_start_time | ||
map_id = params[:submission_viewing_event][:map_id] | ||
round = params[:submission_viewing_event][:round] | ||
link = params[:submission_viewing_event][:link] | ||
start_at = params[:submission_viewing_event][:start_at] | ||
# check if this link is already opened and timed | ||
@submission_viewing_event_records = SubmissionViewingEvent.where(map_id: map_id, round: round, link: link) | ||
# if opened, end these records with current time | ||
if @submission_viewing_event_records | ||
@submission_viewing_event_records.each do |time_record| | ||
if time_record.end_at.nil? | ||
time_record.update_attribute('end_at', start_at) | ||
end | ||
end | ||
end | ||
# create new response time record for current link | ||
@submission_viewing_event = SubmissionViewingEvent.new(submission_viewing_event_params) | ||
@submission_viewing_event.save | ||
render :nothing => true | ||
end | ||
|
||
# record time when link or file window is closed | ||
def record_end_time | ||
@data = params.require(:submission_viewing_event) | ||
@submission_viewing_event_records = SubmissionViewingEvent.where(map_id: @data[:map_id], round: @data[:round], link: @data[:link]) | ||
@submission_viewing_event_records.each do |time_record| | ||
if time_record.end_at.nil? | ||
time_record.update_attribute('end_at', @data[:end_at]) | ||
break | ||
end | ||
end | ||
respond_to do |format| | ||
format.json {head :no_content} | ||
end | ||
end | ||
|
||
# mark end_at review time for all uncommited links/files | ||
def mark_end_time | ||
@data= params.require(:submission_viewing_event) | ||
@linkArray=Array.new | ||
@submissionviewingevent_matches = SubmissionViewingEvent.where(map_id: @data[:map_id], round: @data[:round]) | ||
@submissionviewingevent_matches.each do |submissionviewingevent_entry| | ||
if submissionviewingevent_entry.end_at.nil? | ||
@linkArray.push(submissionviewingevent_entry.link) | ||
submissionviewingevent_entry.update_attribute('end_at', @data[:end_at]) | ||
end | ||
end | ||
respond_to do|format| | ||
format.json {render json: @linkArray} | ||
end | ||
end | ||
|
||
private | ||
# Only allow a trusted parameter "white list" through. | ||
def submission_viewing_event_params | ||
params.require(:submission_viewing_event).permit(:map_id, :round, :link, :start_at, :end_at) | ||
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
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 |
---|---|---|
@@ -0,0 +1,2 @@ | ||
module SubmissionViewingEventsHelper | ||
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
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 |
---|---|---|
@@ -0,0 +1,2 @@ | ||
class SubmissionViewingEvent < ActiveRecord::Base | ||
end |
Oops, something went wrong.