Skip to content

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also .

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also .
...
  • 3 commits
  • 15 files changed
  • 0 commit comments
  • 1 contributor
View
2 app/assets/javascripts/surveys.js.coffee
@@ -1,2 +0,0 @@
-jQuery ->
- $("input#available_at").datepicker( { minDate: '-1y', maxDate: '+2y', dateFormat: 'd M yy'} );
View
3 app/assets/stylesheets/application.css.scss
@@ -206,11 +206,10 @@ section {
}
&#result {
border: 1px solid $border_color_standard;
- border-top: none;
padding: 0.5em;
margin: 0;
position: absolute;
- top: 2.1em;
+ top: 5em;
right: 0.1em;
width: 67%;
z-index: 1;
View
13 app/assets/stylesheets/pages.css.scss
@@ -1,3 +1,16 @@
// Place all the styles related to the Pages controller here.
// They will automatically be included in application.css.
// You can use Sass (SCSS) here: http://sass-lang.com/
+@import "sass_custom.css.scss";
+section {
+ &#surveys_list {
+ border: 1px solid $border_color_standard;
+ border-top: none;
+ position: absolute;
+ top: 2.1em;
+ right: 0.1em;
+ width: 67%;
+ padding: 0.5em;
+ z-index: 99;
+ }
+}
View
6 app/controllers/responses_controller.rb
@@ -1,12 +1,12 @@
class ResponsesController < ApplicationController
load_and_authorize_resource
def index
- @responses = current_user.responses
- authorize! :index, Response
+ @student = User.find(params[:user_id])
+ authorize! :read, @student, :id => @student.id
+ authorize! :index, Response, :user_id => current_user.id
end
def show
- @response = current_user.responses.find(params[:id])
end
def new
View
2 app/controllers/sessions_controller.rb
@@ -6,7 +6,7 @@ def new
#SPEC: 1.1.4: Goes to the appropriate screen
def create
- user = User.find_by_email(params[:email])
+ user = User.find_by_email(params[:email].downcase)
if user && user.authenticate(params[:password])
if params[:remember_me]
cookies.permanent[:auth_token] = user.auth_token
View
9 app/controllers/surveys_controller.rb
@@ -50,19 +50,20 @@ def report
@survey = Survey.find(params[:id])
respond_to do |format|
format.html
+ format.js
format.csv do
csv_string = CSV.generate do |csv|
@survey.questions.each do |question|
# header row
- csv << ["question", "question_id"]
+ csv << ["question"]
# data rows
- csv << [question.content, question.id]
+ csv << [question.content]
question.answers.each do |answer|
# header row
- csv << ["answer", "answer_id", "responses_total"]
+ csv << ["answer", "responses_total"]
# data rows
- csv << [answer.content, answer.id, Response.answers_total_count(answer.id)]
+ csv << [answer.content, Response.answers_total_count(answer.id)]
end
end
end
View
3 app/models/ability.rb
@@ -10,10 +10,11 @@ def initialize(user)
can :update_my_details, User, :id => user.id
can :edit_password, User, :id => user.id
can :update_password, User, :id => user.id
- can :index, Response, :user_id => user.id
can :take, :survey
can :create, :survey
can :show, :survey
+ can :index, Response, :user_id => user.id
+ can :show, Response, :user_id => user.id
cannot :assign_roles, User
cannot :destroy, User
cannot :list, :students
View
2 app/models/user.rb
@@ -42,7 +42,7 @@ class User < ActiveRecord::Base
scope :advisors, lambda { with_role("advisor") }
scope :professors, lambda { with_role("professor") }
scope :gods, lambda { with_role("god") }
- scope :with_name, lambda { |term| where("users.name LIKE ?", "%#{term}%") }
+ scope :with_name, lambda { |term| where("users.name LIKE LOWER(?)", "%#{term}%") }
#default_scope order('users.name ASC')
View
1 app/views/layouts/gods/_god.html.erb
@@ -1 +1,2 @@
<%= render "shared/user_search/listing" %>
+<%= render "shared/survey_list" %>
View
1 app/views/layouts/professors/_professor.html.erb
@@ -1 +1,2 @@
<%= render "shared/user_search/listing" %>
+<%= render "shared/survey_list" %>
View
1 app/views/responses/_response.html.erb
@@ -1,4 +1,5 @@
<%= div_for response do %>
+ Response ID: <%= label_tag :response_id, response.id %><br />
Answer ID: <%= label_tag :answer_id, response.answer_id %><br />
User ID: <%= label_tag :user_id, response.user_id %><br />
Question ID: <%= label_tag :question_id, response.question_id %><br />
View
1 app/views/responses/show.html.erb
@@ -0,0 +1 @@
+show
View
5 app/views/shared/_survey_list.html.erb
@@ -0,0 +1,5 @@
+<section id="surveys_list">
+ <% @surveys.each do |survey| %>
+ <%= link_to survey.name, survey_path(survey.id) %> |
+ <% end %>
+</section>
View
12 app/views/surveys/index.html.erb
@@ -6,9 +6,6 @@
<table>
<tr>
<th>Name <em>(Click to Show)</em></th>
- <% if can? :take, :survey %>
- <th>Take</th>
- <% end %>
<% if can? :show, :survey %>
<th>Show Results</th>
<% end %>
@@ -23,15 +20,6 @@
<%= link_to survey.name, survey %>
</td>
<% end %>
- <% if can? :take, :survey %>
- <td>
- <% unless survey_completed?(current_user, survey) %>
- <%= link_to "Take", new_take_surveys_path(survey.id) %>
- <% else %>
- Completed
- <% end %>
- </td>
- <% end %>
<% if can? :show, :survey %>
<td>
<%= link_to "Show Results", take_survey_path(survey) %>
View
2 app/views/users/_show_student.html.erb
@@ -1,6 +1,6 @@
<div id="show-student-individual">
<% @student.each do |student| %>
<%= student.name.inspect %><br />
- <%= student.email.inspect %>
+ <%= student.email.inspect %><br />
<% end %>
</div>

No commit comments for this range

Something went wrong with that request. Please try again.