Skip to content

Commit

Permalink
Allow basic review of applicants
Browse files Browse the repository at this point in the history
  • Loading branch information
Jordan Byron committed Mar 18, 2011
1 parent 217c31a commit f82d3ee
Show file tree
Hide file tree
Showing 6 changed files with 43 additions and 9 deletions.
Binary file added admissions/submissions/9.zip
Binary file not shown.
8 changes: 0 additions & 8 deletions app/controllers/admin/base.rb
Expand Up @@ -4,13 +4,5 @@ class Base < ApplicationController
before_filter { @selected = :administration }
layout "admin"

private

def admin_required
unless current_access_level.allows?(:manage_users)
flash[:error] = "Your account does not have access to this area"
redirect_to dashboard_path
end
end
end
end
20 changes: 19 additions & 1 deletion app/controllers/admissions/submissions_controller.rb
Expand Up @@ -2,10 +2,22 @@ class Admissions::SubmissionsController < ApplicationController
skip_before_filter :authenticate_user!, :only => [:new, :create]
skip_before_filter :change_password_if_needed, :only => [:new, :create]

before_filter :find_submission, :only => [:show, :attachment]
before_filter :admin_required, :except => [:new, :create]

def index
@submissions = Admissions::Submission.order("created_at")
end

def show
respond_to do |format|
format.html
format.zip { send_data(File.binread(@submission.attachment)) }
end
end

def attachment

render :text => "todo"
end

def new
Expand All @@ -32,4 +44,10 @@ def create
render :action => :new
end
end

private

def find_submission
@submission = Admissions::Submission.find(params[:id])
end
end
7 changes: 7 additions & 0 deletions app/controllers/application_controller.rb
Expand Up @@ -51,4 +51,11 @@ def redirect_back(*params)
def link_return
session[:original_uri] = params[:return_uri] if params[:return_uri]
end

def admin_required
unless current_access_level.allows?(:manage_users)
flash[:error] = "Your account does not have access to this area"
redirect_to dashboard_path
end
end
end
14 changes: 14 additions & 0 deletions app/views/admissions/submissions/index.html.haml
@@ -0,0 +1,14 @@
%h1 Admissions

%table.admin
%tr
%th Applicant
%th Email
%th Github
%th Attachment
- @submissions.each do |submission|
%tr
%td= submission.user.name
%td= submission.user.email
%td= github_account_link submission.user.github_account_name
%td= link_to "Download", admissions_submission_path(submission, :format => "zip")
3 changes: 3 additions & 0 deletions config/initializers/mime_types.rb
Expand Up @@ -3,3 +3,6 @@
# Add new mime types for use in respond_to blocks:
# Mime::Type.register "text/richtext", :rtf
# Mime::Type.register_alias "text/html", :iphone


Mime::Type.register "application/zip", :zip

0 comments on commit f82d3ee

Please sign in to comment.