Skip to content

Instantly share code, notes, and snippets.

@EminenceHC
Created December 11, 2013 21:17
Show Gist options
  • Save EminenceHC/7918596 to your computer and use it in GitHub Desktop.
Save EminenceHC/7918596 to your computer and use it in GitHub Desktop.
Routing problem
<div class="span12" style="width:100%;margin:5px;">
<div>
<div class="well" style="float:left;">
<% if is_student %>
<%= button_to 'New Drug Assessment', new_drug_assessment_path, :class => 'btn btn-success', :style => 'float:right;', :method => :get %>
<% end %>
<% if is_counselor || is_admin %>
<%= simple_form_for(drug_assessments_filter_path , :method => 'post', :html => { :class => 'form-horizontal' }) do %>
<%= select_tag 'drug_assessment[student_id]', options_for_select(@users_array, @users_array), { :prompt => 'Select a student', class: 'chosen-select'} %>
<%= submit_tag 'Submit', :class => 'btn btn-primary' %>
<% end %>
<% end %>
</div>
<div class="well" style="float:right;padding:3px 5px 0px 5px;margin:0px 10px 0px 20px;">
<p><input type="checkbox" name="drugs" class="checkbox" onclick="saveToStorage()" /> Drugs</p>
<p><input type="checkbox" name="reason" class="checkbox" onclick="saveToStorage()" /> Reason</p>
</div>
</div>
<% if is_counselor && ( params[:student_id].present? == false || @sid == 0 ) %>
<% else %>
<div class="tableholder table-responsive">
<table class="table table-condensed table-bordered table-striped ">
<thead>
<tr>
<!--<th>SID</th>-->
<!--<th>AID</th>-->
<th>Week</th>
<th>Date Created</th>
<th>Usage</th>
<th class="drugs">Alcohol</th>
<th class="drugs">Marijuana</th>
<th class="drugs">Counter</th>
<th class="drugs">Inhalant</th>
<th class="drugs">Ecstacy</th>
<th class="drugs">Crack/Cocaine</th>
<th class="drugs">Heroin</th>
<th class="drugs">Meth</th>
<th class="drugs">Hallucinogen</th>
<th class="drugs">Prescription</th>
<th class="drugs">Methadone</th>
<th class="reason">Plan</th>
<th class="reason">Usage</th>
<th class="reason">Trigger</th>
<th>Action</th>
</tr>
</thead>
<% @da.each do |q| %>
<tbody>
<% if q.created_at != nil %>
<tr>
<!--<td><%= q.student_id %></td>-->
<!--<td><%= q.id %></td>-->
<td><%= Date.commercial(2013, q.cweek).strftime('%b %d, %Y') %></td>
<td><%= q.created_at.strftime('%b %d, %Y') %></td>
<td><%= q.did_you_use %></td>
<td class="drugs"><%= q.alcohol %></td>
<td class="drugs"><%= q.marijuana %></td>
<td class="drugs"><%= q.over_the_counter %></td>
<td class="drugs"><%= q.inhalant %></td>
<td class="drugs"><%= q.ecstacy %></td>
<td class="drugs"><%= q.crack_cocaine %></td>
<td class="drugs"><%= q.heroin %></td>
<td class="drugs"><%= q.methanphetamine %></td>
<td class="drugs"><%= q.pcp_lsd_hallucinogen %></td>
<td class="drugs"><%= q.prescription %></td>
<td class="drugs"><%= q.methadone %></td>
<td class="reason"><%= q.plan %></td>
<td class="reason"><%= q.usage %></td>
<td class="reason"><%= q.trigger %></td>
<td><% if is_student == false %><%= link_to " Edit", edit_drug_assessment_path(:id => q.id), class: 'btn glyphicon glyphicon-pencil right' %><% end %></td>
</tr>
<% else q.created_at == nil %>
<tr class="error" >
<!--<td><%= q.student_id %></td>-->
<!--<td><%= q.id %></td>-->
<td><%= Date.commercial(2013, q.cweek).strftime('%b %d, %Y') %></td>
<td><%= q.created_at %></td>
<td><%= q.did_you_use %></td>
<td class="drugs"><%= q.alcohol %></td>
<td class="drugs"><%= q.marijuana %></td>
<td class="drugs"><%= q.over_the_counter %></td>
<td class="drugs"><%= q.inhalant %></td>
<td class="drugs"><%= q.ecstacy %></td>
<td class="drugs"><%= q.crack_cocaine %></td>
<td class="drugs"><%= q.heroin %></td>
<td class="drugs"><%= q.methanphetamine %></td>
<td class="drugs"><%= q.pcp_lsd_hallucinogen %></td>
<td class="drugs"><%= q.prescription %></td>
<td class="drugs"><%= q.methadone %></td>
<td class="reason"><%= q.plan %></td>
<td class="reason"><%= q.usage %></td>
<td class="reason"><%= q.trigger %></td>
<td><%= link_to " Add", new_drug_assessment_path(:cweek => q.cweek, :sid => @sid), class: 'btn glyphicon glyphicon-plus right' %></td>
</tr>
<% end %>
</tbody>
<% end %>
</table>
</div>
<% end %>
</div>
new_user_session GET /users/sign_in(.:format) devise/sessions#new
user_session POST /users/sign_in(.:format) devise/sessions#create
destroy_user_session DELETE /users/sign_out(.:format) devise/sessions#destroy
user_password POST /users/password(.:format) devise/passwords#create
new_user_password GET /users/password/new(.:format) devise/passwords#new
edit_user_password GET /users/password/edit(.:format) devise/passwords#edit
PATCH /users/password(.:format) devise/passwords#update
PUT /users/password(.:format) devise/passwords#update
cancel_user_registration GET /users/cancel(.:format) registrations#cancel
user_registration POST /users(.:format) registrations#create
new_user_registration GET /users/sign_up(.:format) registrations#new
edit_user_registration GET /users/edit(.:format) registrations#edit
PATCH /users(.:format) registrations#update
PUT /users(.:format) registrations#update
DELETE /users(.:format) registrations#destroy
users GET /users(.:format) users#index
POST /users(.:format) users#create
new_user GET /users/new(.:format) users#new
edit_user GET /users/:id/edit(.:format) users#edit
user GET /users/:id(.:format) users#show
PATCH /users/:id(.:format) users#update
PUT /users/:id(.:format) users#update
DELETE /users/:id(.:format) users#destroy
toggle_active_on_student GET /students/:id/toggle_active_on(.:format) students#toggle_active_on
toggle_active_off_student GET /students/:id/toggle_active_off(.:format) students#toggle_active_off
students GET /students(.:format) students#index
POST /students(.:format) students#create
new_student GET /students/new(.:format) students#new
edit_student GET /students/:id/edit(.:format) students#edit
student GET /students/:id(.:format) students#show
PATCH /students/:id(.:format) students#update
PUT /students/:id(.:format) students#update
DELETE /students/:id(.:format) students#destroy
toggle_active_on_counselor GET /counselors/:id/toggle_active_on(.:format) counselors#toggle_active_on
toggle_active_off_counselor GET /counselors/:id/toggle_active_off(.:format) counselors#toggle_active_off
counselors GET /counselors(.:format) counselors#index
POST /counselors(.:format) counselors#create
new_counselor GET /counselors/new(.:format) counselors#new
edit_counselor GET /counselors/:id/edit(.:format) counselors#edit
counselor GET /counselors/:id(.:format) counselors#show
PATCH /counselors/:id(.:format) counselors#update
PUT /counselors/:id(.:format) counselors#update
DELETE /counselors/:id(.:format) counselors#destroy
drug_assessments GET /drug_assessments(.:format) drug_assessments#index
POST /drug_assessments(.:format) drug_assessments#create
new_drug_assessment GET /drug_assessments/new(.:format) drug_assessments#new
edit_drug_assessment GET /drug_assessments/:id/edit(.:format) drug_assessments#edit
drug_assessment GET /drug_assessments/:id(.:format) drug_assessments#show
PATCH /drug_assessments/:id(.:format) drug_assessments#update
PUT /drug_assessments/:id(.:format) drug_assessments#update
DELETE /drug_assessments/:id(.:format) drug_assessments#destroy
drug_assessments_filter POST /drug_assessments/filter(.:format) drug_assessments#filter
result_sets GET /result_sets(.:format) result_sets#index
POST /result_sets(.:format) result_sets#create
new_result_set GET /result_sets/new(.:format) result_sets#new
edit_result_set GET /result_sets/:id/edit(.:format) result_sets#edit
result_set GET /result_sets/:id(.:format) result_sets#show
PATCH /result_sets/:id(.:format) result_sets#update
PUT /result_sets/:id(.:format) result_sets#update
DELETE /result_sets/:id(.:format) result_sets#destroy
search POST /search(.:format) students#search
surveys GET /surveys(.:format) surveys#index
POST /surveys(.:format) surveys#create
new_survey GET /surveys/new(.:format) surveys#new
edit_survey GET /surveys/:id/edit(.:format) surveys#edit
survey GET /surveys/:id(.:format) surveys#show
PATCH /surveys/:id(.:format) surveys#update
PUT /surveys/:id(.:format) surveys#update
DELETE /surveys/:id(.:format) surveys#destroy
Eminence::Application.routes.draw do
root :to => "home#index"
#devise_scope :user do
# root to: "devise/sessions#new"
#end
devise_for :users, :controllers => {:registrations => "registrations"}
resources :users
resources :students do
member do
get 'toggle_active_on'
get 'toggle_active_off'
end
end
resources :counselors do
member do
get 'toggle_active_on'
get 'toggle_active_off'
end
end
resources :drug_assessments
post 'drug_assessments/filter' => 'drug_assessments#filter'
resources :result_sets
post 'search' => 'students#search'
resources :surveys
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment