mirror of
https://github.com/edcommonwealth/sqm-dashboards.git
synced 2026-03-07 21:48:16 -08:00
working on authentication
This commit is contained in:
parent
a018c42e0f
commit
24280f7a68
7 changed files with 64 additions and 34 deletions
|
|
@ -14,4 +14,8 @@ class User < ApplicationRecord
|
|||
def admin?(school)
|
||||
schools.index(school).present?
|
||||
end
|
||||
|
||||
def super_admin?
|
||||
[1].index(id).present?
|
||||
end
|
||||
end
|
||||
|
|
|
|||
|
|
@ -1,10 +1,15 @@
|
|||
%h2 Forgot your password?
|
||||
= form_for(resource, as: resource_name, url: password_path(resource_name), html: { method: :post }) do |f|
|
||||
= devise_error_messages!
|
||||
.field
|
||||
= f.label :email
|
||||
%br/
|
||||
= f.email_field :email, autofocus: true
|
||||
.actions
|
||||
= f.submit "Send me reset password instructions"
|
||||
= render "devise/shared/links"
|
||||
.row
|
||||
.offset-sm-2.col-sm-8
|
||||
%h3 Forgot Your Password
|
||||
= form_for(resource, as: resource_name, url: password_path(resource_name), html: { method: :post }) do |f|
|
||||
= devise_error_messages!
|
||||
|
||||
.form-group
|
||||
= f.label :email
|
||||
%br/
|
||||
= f.email_field :email, autofocus: true, class: 'form-control'
|
||||
|
||||
.form-group
|
||||
= f.submit "Send Me Reset Password Instructions", class: 'btn btn-primary'
|
||||
|
||||
= render "devise/shared/links"
|
||||
|
|
|
|||
|
|
@ -5,14 +5,16 @@
|
|||
|
||||
- if controller_name != 'sessions'
|
||||
Already have an account?
|
||||
|
||||
= link_to "Log In", new_session_path(resource_name)
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
- if devise_mapping.registerable? && controller_name != 'registrations'
|
||||
Don't have an account?
|
||||
-# if devise_mapping.registerable? && controller_name != 'registrations'
|
||||
Don't have an account?
|
||||
|
||||
= link_to "Sign Up", new_registration_path(resource_name)
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -7,4 +7,4 @@
|
|||
= link_to 'Sign Out', destroy_user_session_path, rel: "nofollow", method: :delete, class: 'btn btn-small grey waves-effect waves-light '
|
||||
- else
|
||||
= link_to 'Login', new_user_session_path, class: 'btn btn-small grey waves-effect waves-light '
|
||||
= link_to 'Register', new_user_registration_path, class: 'btn btn-small grey waves-effect waves-light '
|
||||
=# link_to 'Register', new_user_registration_path, class: 'btn btn-small grey waves-effect waves-light '
|
||||
|
|
|
|||
|
|
@ -13,7 +13,7 @@
|
|||
%thead{style: 'font-weight: bold;'}
|
||||
%th Name
|
||||
%th{colspan: 2}
|
||||
- current_user.schools.each do |school|
|
||||
%tr.school
|
||||
%td= link_to school.name, school
|
||||
%td= link_to('Admin', school_admin_path(school))
|
||||
- current_user.schools.each do |school|
|
||||
%tr.school
|
||||
%td= link_to school.name, school
|
||||
%td= link_to('Admin', school_admin_path(school))
|
||||
|
|
|
|||
|
|
@ -1,17 +1,27 @@
|
|||
.row
|
||||
.col-12
|
||||
%p= link_to "Create A New District", new_district_path
|
||||
- if user_signed_in? && current_user.super_admin?
|
||||
.row.super-admin
|
||||
.col-12
|
||||
%p= link_to "Create A New District", new_district_path
|
||||
|
||||
%p= link_to "Create A New School", new_school_path
|
||||
%p= link_to "Create A New School", new_school_path
|
||||
|
||||
|
||||
.row.mt-3
|
||||
.col-6
|
||||
%h4 Districts
|
||||
- @districts.each do |district|
|
||||
%p= link_to district.name, district
|
||||
- if user_signed_in?
|
||||
.row.mt-3
|
||||
-# .col-6
|
||||
-# %h4 Districts
|
||||
-# - @districts.each do |district|
|
||||
-# %p= link_to district.name, district
|
||||
|
||||
.col-6
|
||||
%h4 Schools
|
||||
- @schools.each do |school|
|
||||
%p= link_to school.name, school
|
||||
.col-6
|
||||
%h4 Schools
|
||||
- current_user.schools.each do |school|
|
||||
%p= link_to school.name, school
|
||||
|
||||
- else
|
||||
|
||||
.text-center.my-3.py-3
|
||||
%h3.my-3.py-3
|
||||
EdContext is currently in beta testing.
|
||||
%p.py-3
|
||||
If you have an account, please sign in.
|
||||
|
|
|
|||
17
db/seeds.rb
17
db/seeds.rb
|
|
@ -10,11 +10,20 @@
|
|||
questions = Category.find_by_name('Family Subcategory').child_categories.map(&:questions).flatten
|
||||
QuestionList.create(name: 'Family Questions', question_id_array: questions.map(&:id))
|
||||
|
||||
user = User.create(email: 'jared@edcontext.org', password: '123456')
|
||||
|
||||
cambridge = District.create(name: 'Cambridge Public Schools')
|
||||
school = School.create(name: 'Graham & Parks', district: cambridge, description: 'A description of G&P')
|
||||
recipient = school.recipients.create(name: 'Jared Cosulich', phone: '650-269-3205')
|
||||
recipient_list = school.recipient_lists.create(name: 'Pilot Parent Test', recipient_id_array: [recipient.id])
|
||||
district = District.create(name: 'EdContext Test District')
|
||||
school = School.create(name: 'EdContext Test School', district: district, description: 'A school used to test the EdContext System')
|
||||
recipients = [
|
||||
school.recipients.create(name: 'Jared Cosulich', phone: '650-269-3205'),
|
||||
school.recipients.create(name: 'Lauren Cosulich', phone: '6173522365'),
|
||||
school.recipients.create(name: 'Jack Schneider', phone: '+1 267-968-2293'),
|
||||
school.recipients.create(name: 'Lynisse Patin', phone: '19176566892'),
|
||||
school.recipients.create(name: 'Khemenec Patin', phone: '(347) 534-6437'),
|
||||
]
|
||||
recipient_list = school.recipient_lists.create(name: 'Pilot Parent Test', recipient_id_array: recipients.map(&:id))
|
||||
|
||||
user.user_schools.create(school: school)
|
||||
|
||||
# somerville = District.create(name: 'Somerville Public Schools')
|
||||
#
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue