scidea-schools 1.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/MIT-LICENSE +7 -0
- data/README.md +1 -0
- data/Rakefile +2 -0
- data/app/assets/javascripts/backbone_apps/models/school.js +13 -0
- data/app/assets/javascripts/backbone_apps/school_selector.js +396 -0
- data/app/assets/stylesheets/scidea/admin/pages/schools/edit_user.css +57 -0
- data/app/assets/stylesheets/scidea/admin/pages/schools/user_migrate.css +3 -0
- data/app/assets/stylesheets/scidea/pages/schools/user_profile.css +53 -0
- data/app/controllers/admin/schools_controller.rb +125 -0
- data/app/controllers/application_controller.rb +5 -0
- data/app/controllers/schools_controller.rb +58 -0
- data/app/controllers/test/scidea_schools_qunit_tests_controller.rb +51 -0
- data/app/helpers/schools_helper.rb +22 -0
- data/app/models/school.rb +93 -0
- data/app/themes/global_sass/_mixins.scss +5 -0
- data/app/themes/scidea/sass/_config.scss +7 -0
- data/app/themes/scidea/sass/admin/pages/schools/edit_user.scss +14 -0
- data/app/themes/scidea/sass/admin/pages/schools/user_migrate.scss +21 -0
- data/app/themes/scidea/sass/components/_schools.scss +170 -0
- data/app/themes/scidea/sass/pages/schools/user_profile.scss +6 -0
- data/app/views/admin/schools/_form.html.erb +20 -0
- data/app/views/admin/schools/_school.html.erb +10 -0
- data/app/views/admin/schools/_search.html.erb +14 -0
- data/app/views/admin/schools/confirm_migration.html.erb +17 -0
- data/app/views/admin/schools/edit.html.erb +7 -0
- data/app/views/admin/schools/index.html.erb +60 -0
- data/app/views/admin/schools/new.html.erb +5 -0
- data/app/views/admin/schools/new_migration.html.erb +76 -0
- data/app/views/admin/schools/show.html.erb +46 -0
- data/app/views/admin/users/_profile_show_school.html.erb +4 -0
- data/app/views/admin/users/_school_edit.html.erb +5 -0
- data/app/views/layouts/application.html.erb +14 -0
- data/app/views/schools/_form.html.erb +19 -0
- data/app/views/schools/_profile_form.html.erb +43 -0
- data/app/views/schools/_script_form.html.erb +3 -0
- data/app/views/schools/_search.html.erb +6 -0
- data/app/views/users/_school_edit.html.erb +5 -0
- data/config/compass.rb +28 -0
- data/config/cucumber.yml +8 -0
- data/config/environment.rb +18 -0
- data/config/initializers/schools_assets.rb +6 -0
- data/config/locales/en.yml +8 -0
- data/config/requirejs.yml +2 -0
- data/config/routes.rb +25 -0
- data/db/seeds.rb +14 -0
- data/features/applying_for_seminars.feature +0 -0
- data/features/edit_seminar_application.feature +42 -0
- data/features/manage_users.feature +23 -0
- data/features/qunit/qunit.feature +7 -0
- data/features/schools/manage_schools.feature +87 -0
- data/features/schools/schools.feature +208 -0
- data/features/step_definitions/audience_steps.rb +10 -0
- data/features/step_definitions/authentication_steps.rb +34 -0
- data/features/step_definitions/custom_form_steps.rb +33 -0
- data/features/step_definitions/email_steps.rb +206 -0
- data/features/step_definitions/menu_steps.rb +4 -0
- data/features/step_definitions/misc_steps.rb +52 -0
- data/features/step_definitions/qunit_steps.rb +20 -0
- data/features/step_definitions/registration_steps.rb +17 -0
- data/features/step_definitions/school_steps.rb +35 -0
- data/features/step_definitions/seminar_application_steps.rb +16 -0
- data/features/step_definitions/seminar_steps.rb +5 -0
- data/features/step_definitions/steps.rb +0 -0
- data/features/step_definitions/user_steps.rb +16 -0
- data/features/step_definitions/web_steps.rb +211 -0
- data/features/support/env.rb +21 -0
- data/features/support/hooks.rb +16 -0
- data/features/support/paths.rb +39 -0
- data/features/support/seed_user_roles.rb +16 -0
- data/features/support/selectors.rb +66 -0
- data/lib/generators/scidea/schools/migrations_generator.rb +14 -0
- data/lib/generators/scidea/schools/removal_migrations_generator.rb +14 -0
- data/lib/generators/scidea/schools/templates/removal/scidea_schools_99_remove.rb +35 -0
- data/lib/generators/scidea/schools/templates/scidea_schools_01_install.rb +35 -0
- data/lib/scidea/schools/engine.rb +31 -0
- data/lib/scidea/schools/models/ability.rb +28 -0
- data/lib/scidea/schools/models/profile.rb +25 -0
- data/lib/scidea/schools/version.rb +5 -0
- data/lib/scidea/schools.rb +5 -0
- data/lib/scidea-schools.rb +1 -0
- data/lib/tasks/db/seed.rake +5 -0
- data/qunit/helpers/qunit.js +1598 -0
- data/qunit/html_fixtures/backbone_apps/_school_selector.html.erb +16 -0
- data/qunit/test_runner.html.erb +25 -0
- data/qunit/tests/backbone_apps/school_selector.js +50 -0
- data/spec/factories/schools.rb +10 -0
- data/spec/models/ability_spec.rb +27 -0
- data/spec/models/profile_spec.rb +38 -0
- data/spec/models/school_spec.rb +304 -0
- data/spec/routing/admin/admin_schools_routing_spec.rb +47 -0
- data/spec/routing/schools_routing_spec.rb +35 -0
- data/spec/spec_helper.rb +48 -0
- metadata +249 -0
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
class SchoolsController < ApplicationController
|
|
2
|
+
|
|
3
|
+
ssl_exceptions
|
|
4
|
+
authorize_resource
|
|
5
|
+
|
|
6
|
+
def index
|
|
7
|
+
@selected_school = params[:new_school_id] ? School.where("id = ?", params[:new_school_id]).first : nil
|
|
8
|
+
@schools = School.learner_form_search(params[:zipcode], @selected_school)
|
|
9
|
+
|
|
10
|
+
render_success
|
|
11
|
+
end
|
|
12
|
+
|
|
13
|
+
def create
|
|
14
|
+
@school = School.new params[:school]
|
|
15
|
+
|
|
16
|
+
if @school && @school.save
|
|
17
|
+
render :json => @school.to_client_model_json
|
|
18
|
+
else
|
|
19
|
+
render_error
|
|
20
|
+
end
|
|
21
|
+
end
|
|
22
|
+
|
|
23
|
+
def update
|
|
24
|
+
@school = School.where("id = ?", params[:id]).first
|
|
25
|
+
|
|
26
|
+
if @school && @school.update_attributes(params[:school])
|
|
27
|
+
# @schools = School.learner_form_search(@school.zipcode, @school)
|
|
28
|
+
# @selected_school = @school
|
|
29
|
+
render :json => @school.to_client_model_json
|
|
30
|
+
# render_success
|
|
31
|
+
else
|
|
32
|
+
render_error
|
|
33
|
+
end
|
|
34
|
+
end
|
|
35
|
+
|
|
36
|
+
def edit
|
|
37
|
+
@school = School.where("id = ?", params[:id]).first
|
|
38
|
+
|
|
39
|
+
render :partial => 'form', :layout => false
|
|
40
|
+
end
|
|
41
|
+
|
|
42
|
+
private
|
|
43
|
+
def render_success
|
|
44
|
+
render :json => {
|
|
45
|
+
:status => :ok,
|
|
46
|
+
:html => render_to_string(:partial => 'search')
|
|
47
|
+
}.to_json
|
|
48
|
+
end
|
|
49
|
+
|
|
50
|
+
def render_error
|
|
51
|
+
render :status => 400, :json => {
|
|
52
|
+
:status => :error,
|
|
53
|
+
:message => 'Your educational institution could not be saved. Please review the form and verify all required fields are completed',
|
|
54
|
+
:html => render_to_string(:partial => 'form.html')
|
|
55
|
+
}.to_json
|
|
56
|
+
end
|
|
57
|
+
|
|
58
|
+
end
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
module Test
|
|
2
|
+
class ScideaSchoolsQunitTestsController < ApplicationController
|
|
3
|
+
|
|
4
|
+
skip_authorization_check
|
|
5
|
+
|
|
6
|
+
def index
|
|
7
|
+
@html_fixtures = html_fixtures
|
|
8
|
+
@test_js = test_js
|
|
9
|
+
|
|
10
|
+
render File.join(qunit_path, 'test_runner')
|
|
11
|
+
end
|
|
12
|
+
|
|
13
|
+
private
|
|
14
|
+
|
|
15
|
+
# Get and array of test names either from params or inferred from existing test
|
|
16
|
+
# js files
|
|
17
|
+
def test_names
|
|
18
|
+
if(params[:test_names])
|
|
19
|
+
params[:test_names].split(',')
|
|
20
|
+
else
|
|
21
|
+
Dir["#{qunit_path}/tests/**/*.js"].map do |file|
|
|
22
|
+
file.sub(/.*\/tests\/(.+)?\.js/,'\1')
|
|
23
|
+
end
|
|
24
|
+
end
|
|
25
|
+
end
|
|
26
|
+
|
|
27
|
+
def html_fixtures
|
|
28
|
+
test_names.map { |name|
|
|
29
|
+
partial_file_name = name.sub(/(\/)?([^\/]+)$/, '\1_\2')
|
|
30
|
+
|
|
31
|
+
paths = ActionController::Base.view_paths.map { |view_path|
|
|
32
|
+
path = File.join(view_path, "../../qunit/html_fixtures/#{partial_file_name}.html.erb")
|
|
33
|
+
# Only load a fixture file if it exists
|
|
34
|
+
File.file?(path) ? "../../qunit/html_fixtures/#{name}" : nil
|
|
35
|
+
}.compact
|
|
36
|
+
paths.empty? ? nil : paths.first
|
|
37
|
+
}.compact # remove nil entry caused by a non-existent fixture file
|
|
38
|
+
end
|
|
39
|
+
|
|
40
|
+
# Concatenate a string of all test javascript files for the given test names
|
|
41
|
+
def test_js
|
|
42
|
+
test_names.map { |name|
|
|
43
|
+
render_to_string File.join(qunit_path, "tests/#{name}.js"), :layout => false
|
|
44
|
+
}.join
|
|
45
|
+
end
|
|
46
|
+
|
|
47
|
+
def qunit_path
|
|
48
|
+
File.expand_path('../../../../qunit', __FILE__)
|
|
49
|
+
end
|
|
50
|
+
end
|
|
51
|
+
end
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
module SchoolsHelper
|
|
2
|
+
|
|
3
|
+
def school_selected_id(school, params)
|
|
4
|
+
if school && !school.new_record?
|
|
5
|
+
school.id
|
|
6
|
+
elsif params[:user] and params[:user][:profile_attributes] and params[:user][:profile_attributes][:school_id]
|
|
7
|
+
params[:user][:profile_attributes][:school_id]
|
|
8
|
+
else
|
|
9
|
+
''
|
|
10
|
+
end
|
|
11
|
+
end
|
|
12
|
+
|
|
13
|
+
def school_select_zipcode(school, params)
|
|
14
|
+
if school && !school.new_record?
|
|
15
|
+
school.zipcode
|
|
16
|
+
else
|
|
17
|
+
params[:school_zipcode] || ''
|
|
18
|
+
end
|
|
19
|
+
end
|
|
20
|
+
|
|
21
|
+
end
|
|
22
|
+
|
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
class School < ActiveRecord::Base
|
|
2
|
+
|
|
3
|
+
has_many :profiles
|
|
4
|
+
|
|
5
|
+
# approved field deliberately excluded so public-facing users cannot maliciously approve bad schools
|
|
6
|
+
attr_accessible :address_1, :address_2, :city, :name, :state, :zipcode, :phone
|
|
7
|
+
|
|
8
|
+
validates_presence_of :address_1
|
|
9
|
+
validates_presence_of :city
|
|
10
|
+
validates_presence_of :name
|
|
11
|
+
validates_presence_of :state
|
|
12
|
+
validates_presence_of :zipcode
|
|
13
|
+
validates_presence_of :phone
|
|
14
|
+
|
|
15
|
+
validate :zipcode_formatting
|
|
16
|
+
validate :phone_formatting
|
|
17
|
+
|
|
18
|
+
ZIPCODE_PATTERN = /^[\d]{5}$/
|
|
19
|
+
|
|
20
|
+
# Class methods
|
|
21
|
+
|
|
22
|
+
def self.render_form?
|
|
23
|
+
count > 0 and Audience.count > 0
|
|
24
|
+
end
|
|
25
|
+
|
|
26
|
+
# handles zipcode searches from learner-side forms; will filter out schools
|
|
27
|
+
# that are not approved by the admin UNLESS that school is passed via the
|
|
28
|
+
# user_created_school parameter, which allows the unapproved school created
|
|
29
|
+
# by the current user to be returned as a part of the search query
|
|
30
|
+
def self.learner_form_search(zipcode, user_created_school = nil)
|
|
31
|
+
return [] unless zipcode && zipcode.match(ZIPCODE_PATTERN)
|
|
32
|
+
|
|
33
|
+
schools = where('zipcode = ?', zipcode).where('approved = true').order('name asc').all
|
|
34
|
+
|
|
35
|
+
# the school the user created should be included in the returned list only if these conditions are met
|
|
36
|
+
if user_created_school && user_created_school.zipcode == zipcode && !user_created_school.approved
|
|
37
|
+
schools << user_created_school
|
|
38
|
+
schools.sort! { |a,b| a.name <=> b.name } # sort the user_created_school into the right location
|
|
39
|
+
end
|
|
40
|
+
|
|
41
|
+
schools
|
|
42
|
+
end
|
|
43
|
+
|
|
44
|
+
def self.search(name_or_zipcode)
|
|
45
|
+
name_or_zipcode ? where('name LIKE ? OR zipcode LIKE ?', "%#{name_or_zipcode}%", "%#{name_or_zipcode}%") : scoped
|
|
46
|
+
end
|
|
47
|
+
|
|
48
|
+
def self.without_school(school)
|
|
49
|
+
where('schools.id != ?', school.id)
|
|
50
|
+
end
|
|
51
|
+
|
|
52
|
+
# Instance methods
|
|
53
|
+
|
|
54
|
+
# moves all users associated with this school to school parameter, returns
|
|
55
|
+
# an array of all users migrated from this school to the school parameter
|
|
56
|
+
def migrate_users_to(school)
|
|
57
|
+
raise ArgumentException unless school
|
|
58
|
+
|
|
59
|
+
profiles.map do |profile|
|
|
60
|
+
profile.school = school
|
|
61
|
+
profile.save
|
|
62
|
+
profile.user # returned through method call via an array (from map)
|
|
63
|
+
end
|
|
64
|
+
end
|
|
65
|
+
|
|
66
|
+
def phone=(val)
|
|
67
|
+
write_attribute :phone, val.nil? ? '' : val.split(//).select{|char| char.match(/^\d$/) }.join.gsub(/^1/, '')
|
|
68
|
+
end
|
|
69
|
+
|
|
70
|
+
def phone
|
|
71
|
+
p = read_attribute :phone
|
|
72
|
+
(p.nil? || p.size < 10) ? p : "(#{p[0,3]}) #{p[3,3]}-#{p[6,4]}#{p.size > 10 ? 'x' + p[10..-1]: ''}"
|
|
73
|
+
end
|
|
74
|
+
|
|
75
|
+
def to_client_model_json
|
|
76
|
+
to_json :except => [:created_at, :updated_at]
|
|
77
|
+
end
|
|
78
|
+
|
|
79
|
+
def user_count
|
|
80
|
+
profiles.count
|
|
81
|
+
end
|
|
82
|
+
|
|
83
|
+
private
|
|
84
|
+
|
|
85
|
+
def phone_formatting
|
|
86
|
+
errors[:phone] << "must be at least 10 digits long" unless self.phone.nil? || self.phone.empty? || self.phone.size >= 10
|
|
87
|
+
end
|
|
88
|
+
|
|
89
|
+
def zipcode_formatting
|
|
90
|
+
errors.add(:zipcode, "must be five numbers") unless zipcode && zipcode.match(ZIPCODE_PATTERN)
|
|
91
|
+
end
|
|
92
|
+
|
|
93
|
+
end
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
$color-base: #000000; // black to use as basis for all neutral gradients
|
|
2
|
+
|
|
3
|
+
// Import all the CSS3 and utility mixins that compass provides
|
|
4
|
+
@import "compass";
|
|
5
|
+
|
|
6
|
+
// Need to import global custom mixins after config variables are set, as the mixins use the variables
|
|
7
|
+
@import "../../global_sass/mixins";
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
@import "config";
|
|
2
|
+
|
|
3
|
+
#main #school-migration-message {
|
|
4
|
+
border-color: #D8CF7B;
|
|
5
|
+
background-color: #FCFCC7;
|
|
6
|
+
padding: .75em 1em;
|
|
7
|
+
@include border-radius(8px);
|
|
8
|
+
color: #333;
|
|
9
|
+
@include box-shadow(lighten($color-base, 75%) 0px 2px 3px);
|
|
10
|
+
margin-bottom: 1.5em;
|
|
11
|
+
font-size: 120%;
|
|
12
|
+
|
|
13
|
+
p {
|
|
14
|
+
margin-bottom: .5em;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
address {
|
|
18
|
+
padding: 0 0 0 4em;
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
|
|
@@ -0,0 +1,170 @@
|
|
|
1
|
+
#school-selection-fields {
|
|
2
|
+
margin-bottom: .357em;
|
|
3
|
+
|
|
4
|
+
legend {
|
|
5
|
+
display: block;
|
|
6
|
+
width: 25%;
|
|
7
|
+
float: left;
|
|
8
|
+
padding: .35em 5px 0 0;
|
|
9
|
+
font-size: 1em;
|
|
10
|
+
}
|
|
11
|
+
label {
|
|
12
|
+
@include visuallyhidden;
|
|
13
|
+
}
|
|
14
|
+
li {
|
|
15
|
+
margin-bottom: .25em !important;
|
|
16
|
+
}
|
|
17
|
+
p.inline-hints {
|
|
18
|
+
clear: both;
|
|
19
|
+
padding-left: 0 !important;
|
|
20
|
+
.schools-found & {
|
|
21
|
+
display: none;
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
#school-select-zipcode {
|
|
26
|
+
width: 45px !important;
|
|
27
|
+
min-width: 0 !important;
|
|
28
|
+
margin-right: 5px;
|
|
29
|
+
}
|
|
30
|
+
#school-select-zipcode-input,
|
|
31
|
+
#school-id-input {
|
|
32
|
+
float: left;
|
|
33
|
+
width: auto;
|
|
34
|
+
}
|
|
35
|
+
#main form #school-id-input p.inline-errors {
|
|
36
|
+
padding: 0;
|
|
37
|
+
margin: 3px 0 0;
|
|
38
|
+
}
|
|
39
|
+
#school-id {
|
|
40
|
+
width: 200px;
|
|
41
|
+
}
|
|
42
|
+
#new-school {
|
|
43
|
+
float: left;
|
|
44
|
+
width: 72%;
|
|
45
|
+
margin: 0;
|
|
46
|
+
padding: 0 0 0 25%;
|
|
47
|
+
|
|
48
|
+
.inline-hints {
|
|
49
|
+
padding-left: 0 !important;
|
|
50
|
+
margin: 0 !important;
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
#new-school-form {
|
|
54
|
+
display: none;
|
|
55
|
+
background: #EFF4FF;
|
|
56
|
+
border: 1px solid #A5B9C8;
|
|
57
|
+
@include border-radius(4px);
|
|
58
|
+
padding: 1.07em 15px;
|
|
59
|
+
width: 375px;
|
|
60
|
+
|
|
61
|
+
.ie7 & {
|
|
62
|
+
width: 400px;
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
#main form & p.inline-errors {
|
|
66
|
+
margin: 3px 0 0 100px;
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
.blockOverlay {
|
|
70
|
+
background: #EFF4FF;
|
|
71
|
+
@include opacity(.5);
|
|
72
|
+
@include border-radius(3px);
|
|
73
|
+
}
|
|
74
|
+
.blockMsg {
|
|
75
|
+
border: 1px solid #aaa;
|
|
76
|
+
@include box-shadow(rgba(0,0,0,.3) 2px 2px 5px);
|
|
77
|
+
@include border-radius(4px);
|
|
78
|
+
padding: 5px 10px 3px;
|
|
79
|
+
color: #444;
|
|
80
|
+
background: #fff;
|
|
81
|
+
line-height: 1em;
|
|
82
|
+
|
|
83
|
+
.ie7 & .text {
|
|
84
|
+
position: relative;
|
|
85
|
+
top: -3px;
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
.icon-loading {
|
|
89
|
+
background: image-url('scidea/icons/loading_barber_shop_pole.gif') 50% 40% no-repeat;
|
|
90
|
+
width: 220px;
|
|
91
|
+
@include inline-block;
|
|
92
|
+
height: 0px;
|
|
93
|
+
padding: 20px 0 0;
|
|
94
|
+
margin-left: 5px;
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
|
|
100
|
+
.adding-school &, .editing-school & {
|
|
101
|
+
display: block;
|
|
102
|
+
}
|
|
103
|
+
ol {
|
|
104
|
+
padding: 0 !important;
|
|
105
|
+
margin-bottom: 0 !important;
|
|
106
|
+
}
|
|
107
|
+
li {
|
|
108
|
+
margin-bottom: .714em;
|
|
109
|
+
}
|
|
110
|
+
input[type="text"] {
|
|
111
|
+
background: #fff !important;
|
|
112
|
+
border-color: #ccc;
|
|
113
|
+
}
|
|
114
|
+
label {
|
|
115
|
+
width: 100px;
|
|
116
|
+
}
|
|
117
|
+
.buttons {
|
|
118
|
+
padding-left: 105px !important;
|
|
119
|
+
margin-bottom: 0 !important;
|
|
120
|
+
}
|
|
121
|
+
}
|
|
122
|
+
#school_submit {
|
|
123
|
+
margin-right: 10px;
|
|
124
|
+
}
|
|
125
|
+
#add-school {
|
|
126
|
+
.schools-found & {
|
|
127
|
+
display: block;
|
|
128
|
+
}
|
|
129
|
+
&,
|
|
130
|
+
.adding-school &,
|
|
131
|
+
.new-school-exists & {
|
|
132
|
+
display: none;
|
|
133
|
+
}
|
|
134
|
+
}
|
|
135
|
+
#edit-school {
|
|
136
|
+
.new-school-exists & {
|
|
137
|
+
display: block;
|
|
138
|
+
}
|
|
139
|
+
&,
|
|
140
|
+
.editing-school &,
|
|
141
|
+
.schools-not-found & {
|
|
142
|
+
display: none;
|
|
143
|
+
}
|
|
144
|
+
}
|
|
145
|
+
|
|
146
|
+
#schools-not-found-message {
|
|
147
|
+
.schools-not-found & {
|
|
148
|
+
display: block;
|
|
149
|
+
}
|
|
150
|
+
&, .adding-school & {
|
|
151
|
+
display: none;
|
|
152
|
+
}
|
|
153
|
+
}
|
|
154
|
+
a[href="#add-new-school"] {
|
|
155
|
+
.new-school-exists & {
|
|
156
|
+
display: none;
|
|
157
|
+
}
|
|
158
|
+
}
|
|
159
|
+
a[href="#select-new-school"] {
|
|
160
|
+
display: none;
|
|
161
|
+
.new-school-exists & {
|
|
162
|
+
display: inline;
|
|
163
|
+
}
|
|
164
|
+
}
|
|
165
|
+
#schools-initial-message {
|
|
166
|
+
display: block;
|
|
167
|
+
.schools-not-found & {
|
|
168
|
+
display: none;
|
|
169
|
+
}
|
|
170
|
+
}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
<%= render :partial => 'shared/form_errors', :locals => { :object => @school } %>
|
|
2
|
+
|
|
3
|
+
<%= semantic_form_for ['admin', @school] do |f| %>
|
|
4
|
+
|
|
5
|
+
<%= f.inputs do %>
|
|
6
|
+
<%= f.input :name %>
|
|
7
|
+
<%= f.input :address_1 %>
|
|
8
|
+
<%= f.input :address_2 %>
|
|
9
|
+
<%= f.input :city %>
|
|
10
|
+
<%= f.input :state, :as => :select, :collection => GeographicalRegions.all_us_states_as_select_field_pairs %>
|
|
11
|
+
<%= f.input :zipcode, :input_html => { :maxlength => '5' } %>
|
|
12
|
+
<%= f.input :phone %>
|
|
13
|
+
<%= f.input :approved %>
|
|
14
|
+
<% end %>
|
|
15
|
+
|
|
16
|
+
<%= f.buttons do %>
|
|
17
|
+
<%= f.commit_button "Submit" %>
|
|
18
|
+
<% end %>
|
|
19
|
+
|
|
20
|
+
<% end %>
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
<address>
|
|
2
|
+
<%= school.name %><br />
|
|
3
|
+
<%= school.address_1 %><br />
|
|
4
|
+
<% if school.address_2 && !school.address_2.empty? %>
|
|
5
|
+
<%= school.address_2 %><br />
|
|
6
|
+
<% end %>
|
|
7
|
+
|
|
8
|
+
<%= school.city %>, <%= school.state %> <%= school.zipcode %><br />
|
|
9
|
+
<%= school.phone %>
|
|
10
|
+
</address>
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
<%= form_tag form_url, :method => 'get', :id => "listview_search" do %>
|
|
2
|
+
<%= hidden_field_tag :direction, params[:direction] %>
|
|
3
|
+
<%= hidden_field_tag :sort, params[:sort] %>
|
|
4
|
+
<%= hidden_field_tag :per_page, params[:per_page] %>
|
|
5
|
+
<ol id="schools-search">
|
|
6
|
+
<li>
|
|
7
|
+
<label for="search">Search by Name or Zipcode</label>
|
|
8
|
+
<%= text_field_tag :search, params[:search], { :placeholder => 'e.g., Eastern High School, 12345' } %>
|
|
9
|
+
</li>
|
|
10
|
+
<li>
|
|
11
|
+
<%= submit_tag "Search", :name => nil %>
|
|
12
|
+
</li>
|
|
13
|
+
</ol>
|
|
14
|
+
<% end %>
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
<% page_title 'Confirm User Migration between Educational Institutions' %>
|
|
2
|
+
|
|
3
|
+
<p><%= pluralize(@school.user_count, 'user') %> will be migrated from</p>
|
|
4
|
+
|
|
5
|
+
<%= render :partial => 'school', :locals => { :school => @school } %>
|
|
6
|
+
<p>to</p>
|
|
7
|
+
<%= render :partial => 'school', :locals => { :school => @target_school } %>
|
|
8
|
+
|
|
9
|
+
<p>Are you sure you want to do this?</p>
|
|
10
|
+
|
|
11
|
+
<%= form_tag create_migration_admin_school_path(@school, @target_school) do %>
|
|
12
|
+
<%= hidden_field_tag :school_id, @school.id %>
|
|
13
|
+
<%= hidden_field_tag :target_school_id, @target_school.id %>
|
|
14
|
+
<%= submit_tag("Yes, Migrate Users") %> |
|
|
15
|
+
<%= link_to "No, Choose a Different Institution", migration_new_admin_school_path(@school) %> |
|
|
16
|
+
<%= link_to 'Manage Educational Institutions', admin_schools_path %>
|
|
17
|
+
<% end %>
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
<% page_title 'Editing Educational Institution' %>
|
|
2
|
+
|
|
3
|
+
<%= render 'form' %>
|
|
4
|
+
|
|
5
|
+
<%= link_to 'Migrate Users to Different Educational Institution', migration_new_admin_school_path(@school) %> |
|
|
6
|
+
<%= link_to 'Show', admin_school_path(@school) %> |
|
|
7
|
+
<%= link_to 'Manage Educational Institutions', admin_schools_path %>
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
<% css do %>
|
|
2
|
+
<%= theme_css 'pages/admin_index.css', :media => 'screen' %>
|
|
3
|
+
<% end %>
|
|
4
|
+
|
|
5
|
+
<% page_title 'Manage Educational Institutions' %>
|
|
6
|
+
|
|
7
|
+
<%= render :partial => 'search', :locals => { :form_url => admin_schools_path, :params => params } %>
|
|
8
|
+
|
|
9
|
+
<%= render_widget :paginated_list, :display, {
|
|
10
|
+
:collection => @schools,
|
|
11
|
+
:entry_name => 'educational institution',
|
|
12
|
+
:css_class => "",
|
|
13
|
+
:id => "schools-found",
|
|
14
|
+
:list_renderer => [
|
|
15
|
+
:datatable,
|
|
16
|
+
{
|
|
17
|
+
:columns => [
|
|
18
|
+
{
|
|
19
|
+
:label => "Name",
|
|
20
|
+
:content => lambda{|item| link_to item.name, admin_school_path(item) },
|
|
21
|
+
:sort => 'name',
|
|
22
|
+
:width => "200px"
|
|
23
|
+
},
|
|
24
|
+
{
|
|
25
|
+
:label => "City",
|
|
26
|
+
:content => :city,
|
|
27
|
+
:sort => 'city',
|
|
28
|
+
:width => "150px"
|
|
29
|
+
},
|
|
30
|
+
{
|
|
31
|
+
:label => "State",
|
|
32
|
+
:content => :state,
|
|
33
|
+
:sort => 'state',
|
|
34
|
+
},
|
|
35
|
+
{
|
|
36
|
+
:label => "Zipcode",
|
|
37
|
+
:content => :zipcode,
|
|
38
|
+
:sort => 'zipcode'
|
|
39
|
+
},
|
|
40
|
+
{
|
|
41
|
+
:label => "Approved",
|
|
42
|
+
:content => lambda{ |item| item.approved ? 'Yes' : 'No' },
|
|
43
|
+
:sort => 'approved'
|
|
44
|
+
},
|
|
45
|
+
:actions => [
|
|
46
|
+
:edit,
|
|
47
|
+
:delete
|
|
48
|
+
]
|
|
49
|
+
],
|
|
50
|
+
:actions_are_admin => true,
|
|
51
|
+
:css_class => 'table-blue-zebra',
|
|
52
|
+
:sort_column => sort_column
|
|
53
|
+
}
|
|
54
|
+
],
|
|
55
|
+
:header => {
|
|
56
|
+
:css_class => 'plain'
|
|
57
|
+
},
|
|
58
|
+
:navigation => {}
|
|
59
|
+
} %>
|
|
60
|
+
<%= link_to 'New Educational Institution', new_admin_school_path %>
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
<% css do %>
|
|
2
|
+
<%= theme_css 'pages/admin_index.css', :media => 'screen' %>
|
|
3
|
+
<%= stylesheet_link_tag 'scidea/admin/pages/schools/user_migrate' %>
|
|
4
|
+
<% end %>
|
|
5
|
+
|
|
6
|
+
<% page_title 'Migrate Users between Educational Institutions' %>
|
|
7
|
+
|
|
8
|
+
<div id="school-migration-message">
|
|
9
|
+
<p>You are migrating users from</p>
|
|
10
|
+
<%= render :partial => 'school', :locals => { :school => @school } %>
|
|
11
|
+
</div>
|
|
12
|
+
|
|
13
|
+
<p>Choose the educational institution to which you would like to migrate users.</p>
|
|
14
|
+
|
|
15
|
+
<hr>
|
|
16
|
+
|
|
17
|
+
<%= render :partial => 'search', :locals => {
|
|
18
|
+
:form_url => migration_new_admin_school_path(@school),
|
|
19
|
+
:params => params } %>
|
|
20
|
+
|
|
21
|
+
<%= render_widget :paginated_list, :display, {
|
|
22
|
+
:collection => @target_schools,
|
|
23
|
+
:entry_name => 'educational institution',
|
|
24
|
+
:css_class => "",
|
|
25
|
+
:id => "schools-found",
|
|
26
|
+
:list_renderer => [
|
|
27
|
+
:datatable,
|
|
28
|
+
{
|
|
29
|
+
:columns => [
|
|
30
|
+
{
|
|
31
|
+
:label => "Name",
|
|
32
|
+
:content => :name,
|
|
33
|
+
:sort => 'name',
|
|
34
|
+
:width => "300px"
|
|
35
|
+
},
|
|
36
|
+
{
|
|
37
|
+
:label => "City",
|
|
38
|
+
:content => :city,
|
|
39
|
+
:sort => 'city',
|
|
40
|
+
},
|
|
41
|
+
{
|
|
42
|
+
:label => "State",
|
|
43
|
+
:content => :state,
|
|
44
|
+
:sort => 'state',
|
|
45
|
+
},
|
|
46
|
+
{
|
|
47
|
+
:label => "Zipcode",
|
|
48
|
+
:content => :zipcode,
|
|
49
|
+
:sort => 'zipcode'
|
|
50
|
+
},
|
|
51
|
+
{
|
|
52
|
+
:label => "Users",
|
|
53
|
+
:content => :user_count,
|
|
54
|
+
:sort => 'user_count'
|
|
55
|
+
},
|
|
56
|
+
{
|
|
57
|
+
:label => "Approved",
|
|
58
|
+
:content => lambda{ |item| item.approved ? 'Yes' : 'No' },
|
|
59
|
+
:sort => 'approve'
|
|
60
|
+
},
|
|
61
|
+
:actions => [
|
|
62
|
+
lambda {|item|
|
|
63
|
+
link_to 'Choose', confirm_migration_admin_school_path(@school, item), :class => 'do-choose', :title => "Choose"
|
|
64
|
+
}
|
|
65
|
+
]
|
|
66
|
+
],
|
|
67
|
+
:css_class => 'table-blue-zebra',
|
|
68
|
+
:sort_column => sort_column
|
|
69
|
+
}
|
|
70
|
+
],
|
|
71
|
+
:header => {
|
|
72
|
+
:css_class => 'plain'
|
|
73
|
+
},
|
|
74
|
+
:navigation => {}
|
|
75
|
+
} %>
|
|
76
|
+
<%= link_to 'Manage Educational Institutions', admin_schools_path %>
|