Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

initial commit

  • Loading branch information...
commit 288761945762e55dcbe273633e830bcd937d6e1f 0 parents
@rnhurt authored
Showing with 11,461 additions and 0 deletions.
  1. +12 −0 .gitignore
  2. +2 −0  README
  3. +10 −0 Rakefile
  4. +11 −0 app/controllers/application.rb
  5. +87 −0 app/controllers/assignments_controller.rb
  6. +81 −0 app/controllers/courses_controller.rb
  7. +3 −0  app/controllers/dashboard_controller.rb
  8. +87 −0 app/controllers/enrollments_controller.rb
  9. +87 −0 app/controllers/gradations_controller.rb
  10. +85 −0 app/controllers/sites_controller.rb
  11. +109 −0 app/controllers/students_controller.rb
  12. +87 −0 app/controllers/teachers_controller.rb
  13. +87 −0 app/controllers/users_controller.rb
  14. +18 −0 app/helpers/application_helper.rb
  15. +2 −0  app/helpers/assignments_helper.rb
  16. +2 −0  app/helpers/courses_helper.rb
  17. +2 −0  app/helpers/dashboard_helper.rb
  18. +2 −0  app/helpers/enrollments_helper.rb
  19. +2 −0  app/helpers/gradations_helper.rb
  20. +2 −0  app/helpers/sites_helper.rb
  21. +2 −0  app/helpers/students_helper.rb
  22. +2 −0  app/helpers/teachers_helper.rb
  23. +2 −0  app/helpers/users_helper.rb
  24. +5 −0 app/models/admin.rb
  25. +4 −0 app/models/assignment.rb
  26. +8 −0 app/models/course.rb
  27. +7 −0 app/models/enrollment.rb
  28. +6 −0 app/models/gradation.rb
  29. +5 −0 app/models/role.rb
  30. +4 −0 app/models/site.rb
  31. +3 −0  app/models/student.rb
  32. +11 −0 app/models/teacher.rb
  33. +5 −0 app/models/term.rb
  34. +11 −0 app/models/user.rb
  35. +27 −0 app/views/assignments/edit.html.erb
  36. +24 −0 app/views/assignments/index.html.erb
  37. +26 −0 app/views/assignments/new.html.erb
  38. +18 −0 app/views/assignments/show.html.erb
  39. +21 −0 app/views/campuses/edit.html.erb
  40. +22 −0 app/views/campuses/index.html.erb
  41. +21 −0 app/views/campuses/new.html.erb
  42. +13 −0 app/views/campuses/show.html.erb
  43. +42 −0 app/views/courses/edit.html.erb
  44. +30 −0 app/views/courses/index.html.erb
  45. +41 −0 app/views/courses/new.html.erb
  46. +33 −0 app/views/courses/show.html.erb
  47. +1 −0  app/views/dashboard/index.html.erb
  48. +22 −0 app/views/enrollments/edit.html.erb
  49. +27 −0 app/views/enrollments/index.html.erb
  50. +21 −0 app/views/enrollments/new.html.erb
  51. +13 −0 app/views/enrollments/show.html.erb
  52. +27 −0 app/views/gradations/edit.html.erb
  53. +24 −0 app/views/gradations/index.html.erb
  54. +26 −0 app/views/gradations/new.html.erb
  55. +18 −0 app/views/gradations/show.html.erb
  56. +51 −0 app/views/layouts/standard.html.erb
  57. +22 −0 app/views/sites/edit.html.erb
  58. +22 −0 app/views/sites/index.html.erb
  59. +21 −0 app/views/sites/new.html.erb
  60. +13 −0 app/views/sites/show.html.erb
  61. +65 −0 app/views/students/_student.html.erb
  62. +30 −0 app/views/students/_student_list.erb
  63. +12 −0 app/views/students/edit.html.erb
  64. +30 −0 app/views/students/index.html.erb
  65. +44 −0 app/views/students/new.html.erb
  66. +13 −0 app/views/students/show.html.erb
  67. +30 −0 app/views/teachers/_teacher_list.erb
  68. +37 −0 app/views/teachers/edit.html.erb
  69. +8 −0 app/views/teachers/index.html.erb
  70. +43 −0 app/views/teachers/new.html.erb
  71. +27 −0 app/views/teachers/show.html.erb
  72. +17 −0 app/views/user_types/edit.html.erb
  73. +20 −0 app/views/user_types/index.html.erb
  74. +16 −0 app/views/user_types/new.html.erb
  75. +8 −0 app/views/user_types/show.html.erb
  76. +37 −0 app/views/users/edit.html.erb
  77. +28 −0 app/views/users/index.html.erb
  78. +36 −0 app/views/users/new.html.erb
  79. +28 −0 app/views/users/show.html.erb
  80. +109 −0 config/boot.rb
  81. +59 −0 config/environment.rb
  82. +18 −0 config/environments/development.rb
  83. +19 −0 config/environments/production.rb
  84. +22 −0 config/environments/test.rb
  85. +10 −0 config/initializers/inflections.rb
  86. +5 −0 config/initializers/mime_types.rb
  87. +51 −0 config/routes.rb
  88. BIN  db/gradesheet_development
  89. +18 −0 db/migrate/002_create_courses.rb
  90. +19 −0 db/migrate/004_create_users.rb
  91. +14 −0 db/migrate/005_create_enrollments.rb
  92. +15 −0 db/migrate/006_create_gradations.rb
  93. +15 −0 db/migrate/007_create_assignments.rb
  94. +14 −0 db/migrate/011_create_terms.rb
  95. +14 −0 db/migrate/012_create_sites.rb
  96. +75 −0 db/schema.rb
  97. +2 −0  doc/README_FOR_APP
  98. BIN  doc/controllers.png
  99. +301 −0 doc/controllers.svg
  100. 0  doc/models.png
  101. 0  doc/models.svg
  102. +15 −0 lib/tasks/diagrams.rake
  103. +9 −0 lib/tasks/load_test_data.rake
  104. +32 −0 lib/tasks/rails.rake
  105. +24 −0 lib/tasks/rcov.rake
  106. +40 −0 public/.htaccess
  107. +30 −0 public/404.html
  108. +30 −0 public/422.html
  109. +30 −0 public/500.html
  110. +12 −0 public/dispatch.cgi
  111. +26 −0 public/dispatch.fcgi
  112. +12 −0 public/dispatch.rb
  113. 0  public/favicon.ico
  114. BIN  public/images/current-bg.gif
  115. BIN  public/images/llsh.gif
  116. BIN  public/images/menu-bg.gif
  117. BIN  public/images/rails.png
  118. BIN  public/images/spinner.gif
  119. +2 −0  public/javascripts/application.js
  120. +963 −0 public/javascripts/controls.js
  121. +972 −0 public/javascripts/dragdrop.js
  122. +1,120 −0 public/javascripts/effects.js
  123. +4,225 −0 public/javascripts/prototype.js
  124. +5 −0 public/robots.txt
  125. +130 −0 public/stylesheets/layout.css
  126. +35 −0 public/stylesheets/menu.css
  127. +74 −0 public/stylesheets/scaffold.css
  128. +91 −0 public/stylesheets/tables.css
  129. +3 −0  script/about
  130. +3 −0  script/console
  131. +3 −0  script/destroy
  132. +3 −0  script/generate
  133. +3 −0  script/performance/benchmarker
  134. +3 −0  script/performance/profiler
  135. +3 −0  script/performance/request
  136. +3 −0  script/plugin
  137. +3 −0  script/process/inspector
  138. +3 −0  script/process/reaper
  139. +3 −0  script/process/spawner
  140. +3 −0  script/runner
  141. +3 −0  script/server
  142. +11 −0 test/fixtures/assignments.yml
  143. +15 −0 test/fixtures/courses.yml
  144. +9 −0 test/fixtures/enrollments.yml
  145. +11 −0 test/fixtures/gradations.yml
  146. +7 −0 test/fixtures/sites.yml
  147. +10 −0 test/fixtures/terms.yml
  148. +43 −0 test/fixtures/users.yml
  149. +45 −0 test/functional/assignments_controller_test.rb
  150. +45 −0 test/functional/courses_controller_test.rb
  151. +8 −0 test/functional/dashboard_controller_test.rb
  152. +45 −0 test/functional/enrollments_controller_test.rb
  153. +45 −0 test/functional/gradations_controller_test.rb
  154. +45 −0 test/functional/sites_controller_test.rb
  155. +45 −0 test/functional/students_controller_test.rb
  156. +45 −0 test/functional/teachers_controller_test.rb
  157. +45 −0 test/functional/user_types_controller_test.rb
  158. +45 −0 test/functional/users_controller_test.rb
  159. +38 −0 test/test_helper.rb
  160. +8 −0 test/unit/assignment_test.rb
  161. +8 −0 test/unit/campus_test.rb
  162. +8 −0 test/unit/course_test.rb
  163. +8 −0 test/unit/dashboard_test.rb
  164. +8 −0 test/unit/enrollment_test.rb
  165. +8 −0 test/unit/gradation_test.rb
  166. +8 −0 test/unit/site_test.rb
  167. +8 −0 test/unit/student_test.rb
  168. +8 −0 test/unit/teacher_test.rb
  169. +8 −0 test/unit/user_test.rb
  170. +1 −0  vendor/actionmailer
  171. +1 −0  vendor/actionpack
  172. +1 −0  vendor/activemodel
  173. +1 −0  vendor/activerecord
  174. +1 −0  vendor/activeresource
  175. +1 −0  vendor/activesupport
  176. +20 −0 vendor/plugins/validates_existence/MIT-LICENSE
  177. +22 −0 vendor/plugins/validates_existence/README
  178. +22 −0 vendor/plugins/validates_existence/Rakefile
  179. +1 −0  vendor/plugins/validates_existence/init.rb
  180. +47 −0 vendor/plugins/validates_existence/lib/validates_existence.rb
  181. +1 −0  vendor/rails
  182. +1 −0  vendor/railties
12 .gitignore
@@ -0,0 +1,12 @@
+*~
+DELETEME/*
+log/*
+tmp/*
+coverage.data
+coverage/*
+database.yml
+*.sqlite
+*.sqlite3
+doc/api
+.DS_Store
+.svn
2  README
@@ -0,0 +1,2 @@
+== Welcome to Gradesheet
+
10 Rakefile
@@ -0,0 +1,10 @@
+# Add your own tasks in files placed in lib/tasks ending in .rake,
+# for example lib/tasks/capistrano.rake, and they will automatically be available to Rake.
+
+require(File.join(File.dirname(__FILE__), 'config', 'boot'))
+
+require 'rake'
+require 'rake/testtask'
+require 'rake/rdoctask'
+
+require 'tasks/rails'
11 app/controllers/application.rb
@@ -0,0 +1,11 @@
+# Filters added to this controller apply to all controllers in the application.
+# Likewise, all the methods added will be available for all controllers.
+
+class ApplicationController < ActionController::Base
+ helper :all # include all helpers, all the time
+
+ # See ActionController::RequestForgeryProtection for details
+ # Uncomment the :secret if you're not using the cookie session store
+ protect_from_forgery # :secret => 'e09cdc0512f2d77a60d7ccb4c46775c1'
+
+end
87 app/controllers/assignments_controller.rb
@@ -0,0 +1,87 @@
+class AssignmentsController < ApplicationController
+ layout "standard"
+
+ # GET /assignments
+ # GET /assignments.xml
+ def index
+ @assignments = Assignment.find(:all)
+
+ respond_to do |format|
+ format.html # index.html.erb
+ format.xml { render :xml => @assignments }
+ end
+ end
+
+ # GET /assignments/1
+ # GET /assignments/1.xml
+ def show
+ @assignment = Assignment.find(params[:id])
+
+ respond_to do |format|
+ format.html # show.html.erb
+ format.xml { render :xml => @assignment }
+ end
+ end
+
+ # GET /assignments/new
+ # GET /assignments/new.xml
+ def new
+ @assignment = Assignment.new
+
+ respond_to do |format|
+ format.html # new.html.erb
+ format.xml { render :xml => @assignment }
+ end
+ end
+
+ # GET /assignments/1/edit
+ def edit
+ @assignment = Assignment.find(params[:id])
+ end
+
+ # POST /assignments
+ # POST /assignments.xml
+ def create
+ @assignment = Assignment.new(params[:assignment])
+
+ respond_to do |format|
+ if @assignment.save
+ flash[:notice] = 'Assignment was successfully created.'
+ format.html { redirect_to(@assignment) }
+ format.xml { render :xml => @assignment, :status => :created, :location => @assignment }
+ else
+ format.html { render :action => "new" }
+ format.xml { render :xml => @assignment.errors, :status => :unprocessable_entity }
+ end
+ end
+ end
+
+ # PUT /assignments/1
+ # PUT /assignments/1.xml
+ def update
+ @assignment = Assignment.find(params[:id])
+
+ respond_to do |format|
+ if @assignment.update_attributes(params[:assignment])
+ flash[:notice] = 'Assignment was successfully updated.'
+ format.html { redirect_to(@assignment) }
+ format.xml { head :ok }
+ else
+ format.html { render :action => "edit" }
+ format.xml { render :xml => @assignment.errors, :status => :unprocessable_entity }
+ end
+ end
+ end
+
+ # DELETE /assignments/1
+ # DELETE /assignments/1.xml
+ def destroy
+ @assignment = Assignment.find(params[:id])
+ @assignment.destroy
+
+ respond_to do |format|
+ format.html { redirect_to(assignments_url) }
+ format.xml { head :ok }
+ end
+ end
+end
81 app/controllers/courses_controller.rb
@@ -0,0 +1,81 @@
+class CoursesController < ApplicationController
+ layout "standard"
+
+
+ def index
+ @courses = Course.find(:all)
+
+ respond_to do |format|
+ format.html # index.html.erb
+ format.xml { render :xml => @courses }
+ end
+ end
+
+
+ def show
+ @course = Course.find(params[:id])
+
+ respond_to do |format|
+ format.html # show.html.erb
+ format.xml { render :xml => @course }
+ end
+ end
+
+
+ def new
+ @course = Course.new
+
+ respond_to do |format|
+ format.html # new.html.erb
+ format.xml { render :xml => @course }
+ end
+ end
+
+
+ def edit
+ @course = Course.find(params[:id])
+ end
+
+
+ def create
+ @course = Course.new(params[:course])
+
+ respond_to do |format|
+ if @course.save
+ flash[:notice] = 'Course was successfully created.'
+ format.html { redirect_to(@course) }
+ format.xml { render :xml => @course, :status => :created, :location => @course }
+ else
+ format.html { render :action => "new" }
+ format.xml { render :xml => @course.errors, :status => :unprocessable_entity }
+ end
+ end
+ end
+
+
+ def update
+ @course = Course.find(params[:id])
+
+ respond_to do |format|
+ if @course.update_attributes(params[:course])
+ flash[:notice] = 'Course was successfully updated.'
+ format.html { redirect_to(@course) }
+ format.xml { head :ok }
+ else
+ format.html { render :action => "edit" }
+ format.xml { render :xml => @course.errors, :status => :unprocessable_entity }
+ end
+ end
+ end
+
+
+ def destroy
+ @course = Course.find(params[:id])
+ @course.destroy
+
+ respond_to do |format|
+ format.html { redirect_to(courses_url) }
+ format.xml { head :ok }
+ end
+ end
+end
3  app/controllers/dashboard_controller.rb
@@ -0,0 +1,3 @@
+class DashboardController < ApplicationController
+ layout "standard"
+end
87 app/controllers/enrollments_controller.rb
@@ -0,0 +1,87 @@
+class EnrollmentsController < ApplicationController
+ layout "standard"
+
+ # GET /enrollments
+ # GET /enrollments.xml
+ def index
+ @enrollments = Enrollment.find(:all)
+
+ respond_to do |format|
+ format.html # index.html.erb
+ format.xml { render :xml => @enrollments }
+ end
+ end
+
+ # GET /enrollments/1
+ # GET /enrollments/1.xml
+ def show
+ @enrollment = Enrollment.find(params[:id])
+
+ respond_to do |format|
+ format.html # show.html.erb
+ format.xml { render :xml => @enrollment }
+ end
+ end
+
+ # GET /enrollments/new
+ # GET /enrollments/new.xml
+ def new
+ @enrollment = Enrollment.new
+
+ respond_to do |format|
+ format.html # new.html.erb
+ format.xml { render :xml => @enrollment }
+ end
+ end
+
+ # GET /enrollments/1/edit
+ def edit
+ @enrollment = Enrollment.find(params[:id])
+ end
+
+ # POST /enrollments
+ # POST /enrollments.xml
+ def create
+ @enrollment = Enrollment.new(params[:enrollment])
+
+ respond_to do |format|
+ if @enrollment.save
+ flash[:notice] = 'Enrollment was successfully created.'
+ format.html { redirect_to(@enrollment) }
+ format.xml { render :xml => @enrollment, :status => :created, :location => @enrollment }
+ else
+ format.html { render :action => "new" }
+ format.xml { render :xml => @enrollment.errors, :status => :unprocessable_entity }
+ end
+ end
+ end
+
+ # PUT /enrollments/1
+ # PUT /enrollments/1.xml
+ def update
+ @enrollment = Enrollment.find(params[:id])
+
+ respond_to do |format|
+ if @enrollment.update_attributes(params[:enrollment])
+ flash[:notice] = 'Enrollment was successfully updated.'
+ format.html { redirect_to(@enrollment) }
+ format.xml { head :ok }
+ else
+ format.html { render :action => "edit" }
+ format.xml { render :xml => @enrollment.errors, :status => :unprocessable_entity }
+ end
+ end
+ end
+
+ # DELETE /enrollments/1
+ # DELETE /enrollments/1.xml
+ def destroy
+ @enrollment = Enrollment.find(params[:id])
+ @enrollment.destroy
+
+ respond_to do |format|
+ format.html { redirect_to(enrollments_url) }
+ format.xml { head :ok }
+ end
+ end
+end
87 app/controllers/gradations_controller.rb
@@ -0,0 +1,87 @@
+class GradationsController < ApplicationController
+ layout "standard"
+
+ # GET /gradations
+ # GET /gradations.xml
+ def index
+ @gradations = Gradation.find(:all)
+
+ respond_to do |format|
+ format.html # index.html.erb
+ format.xml { render :xml => @gradations }
+ end
+ end
+
+ # GET /gradations/1
+ # GET /gradations/1.xml
+ def show
+ @gradation = Gradation.find(params[:id])
+
+ respond_to do |format|
+ format.html # show.html.erb
+ format.xml { render :xml => @gradation }
+ end
+ end
+
+ # GET /gradations/new
+ # GET /gradations/new.xml
+ def new
+ @gradation = Gradation.new
+
+ respond_to do |format|
+ format.html # new.html.erb
+ format.xml { render :xml => @gradation }
+ end
+ end
+
+ # GET /gradations/1/edit
+ def edit
+ @gradation = Gradation.find(params[:id])
+ end
+
+ # POST /gradations
+ # POST /gradations.xml
+ def create
+ @gradation = Gradation.new(params[:gradation])
+
+ respond_to do |format|
+ if @gradation.save
+ flash[:notice] = 'Gradation was successfully created.'
+ format.html { redirect_to(@gradation) }
+ format.xml { render :xml => @gradation, :status => :created, :location => @gradation }
+ else
+ format.html { render :action => "new" }
+ format.xml { render :xml => @gradation.errors, :status => :unprocessable_entity }
+ end
+ end
+ end
+
+ # PUT /gradations/1
+ # PUT /gradations/1.xml
+ def update
+ @gradation = Gradation.find(params[:id])
+
+ respond_to do |format|
+ if @gradation.update_attributes(params[:gradation])
+ flash[:notice] = 'Gradation was successfully updated.'
+ format.html { redirect_to(@gradation) }
+ format.xml { head :ok }
+ else
+ format.html { render :action => "edit" }
+ format.xml { render :xml => @gradation.errors, :status => :unprocessable_entity }
+ end
+ end
+ end
+
+ # DELETE /gradations/1
+ # DELETE /gradations/1.xml
+ def destroy
+ @gradation = Gradation.find(params[:id])
+ @gradation.destroy
+
+ respond_to do |format|
+ format.html { redirect_to(gradations_url) }
+ format.xml { head :ok }
+ end
+ end
+end
85 app/controllers/sites_controller.rb
@@ -0,0 +1,85 @@
+class SitesController < ApplicationController
+ # GET /sites
+ # GET /sites.xml
+ def index
+ @sites = Site.find(:all)
+
+ respond_to do |format|
+ format.html # index.html.erb
+ format.xml { render :xml => @sites }
+ end
+ end
+
+ # GET /sites/1
+ # GET /sites/1.xml
+ def show
+ @site = Site.find(params[:id])
+
+ respond_to do |format|
+ format.html # show.html.erb
+ format.xml { render :xml => @site }
+ end
+ end
+
+ # GET /sites/new
+ # GET /sites/new.xml
+ def new
+ @site = Site.new
+
+ respond_to do |format|
+ format.html # new.html.erb
+ format.xml { render :xml => @site }
+ end
+ end
+
+ # GET /sites/1/edit
+ def edit
+ @site = Site.find(params[:id])
+ end
+
+ # POST /sites
+ # POST /sites.xml
+ def create
+ @site = Site.new(params[:site])
+
+ respond_to do |format|
+ if @site.save
+ flash[:notice] = 'Site was successfully created.'
+ format.html { redirect_to(@site) }
+ format.xml { render :xml => @site, :status => :created, :location => @site }
+ else
+ format.html { render :action => "new" }
+ format.xml { render :xml => @site.errors, :status => :unprocessable_entity }
+ end
+ end
+ end
+
+ # PUT /sites/1
+ # PUT /sites/1.xml
+ def update
+ @site = Site.find(params[:id])
+
+ respond_to do |format|
+ if @site.update_attributes(params[:site])
+ flash[:notice] = 'Site was successfully updated.'
+ format.html { redirect_to(@site) }
+ format.xml { head :ok }
+ else
+ format.html { render :action => "edit" }
+ format.xml { render :xml => @site.errors, :status => :unprocessable_entity }
+ end
+ end
+ end
+
+ # DELETE /sites/1
+ # DELETE /sites/1.xml
+ def destroy
+ @site = Site.find(params[:id])
+ @site.destroy
+
+ respond_to do |format|
+ format.html { redirect_to(sites_url) }
+ format.xml { head :ok }
+ end
+ end
+end
109 app/controllers/students_controller.rb
@@ -0,0 +1,109 @@
+class StudentsController < ApplicationController
+ layout "standard"
+
+ def list
+
+ items_per_page = 10
+
+ sort = case params['sort']
+ when "name" then "name"
+ when "qty" then "quantity"
+ when "price" then "price"
+ when "name_reverse" then "name DESC"
+ when "qty_reverse" then "quantity DESC"
+ when "price_reverse" then "price DESC"
+ end
+
+ conditions = ["name LIKE ?", "%#{params[:query]}%"] unless params[:query].nil?
+
+ @total = Item.count(:conditions => conditions)
+ @items_pages, @items = paginate :items, :order => sort, :conditions => conditions, :per_page => items_per_page
+
+ if request.xml_http_request?
+ render :partial => "items_list", :layout => false
+ end
+
+ end
+
+
+
+
+
+
+ def index
+ @students = Student.find(:all)
+
+ respond_to do |format|
+ format.html # index.html.erb
+ format.xml { render :xml => @students }
+ end
+ end
+
+
+ def show
+ @student = Student.find(params[:id])
+
+ respond_to do |format|
+ format.html # show.html.erb
+ format.xml { render :xml => @student }
+ end
+ end
+
+
+ def new
+ @student = Student.new
+
+ respond_to do |format|
+ format.html # new.html.erb
+ format.xml { render :xml => @student }
+ end
+ end
+
+
+ def edit
+ @student = Student.find(params[:id])
+ end
+
+
+ def create
+ @student = Student.new(params[:student])
+
+ respond_to do |format|
+ if @student.save
+ flash[:notice] = 'Student was successfully created.'
+ format.html { redirect_to(@student) }
+ format.xml { render :xml => @student, :status => :created, :location => @student }
+ else
+ format.html { render :action => "new" }
+ format.xml { render :xml => @student.errors, :status => :unprocessable_entity }
+ end
+ end
+ end
+
+
+ def update
+ @student = Student.find(params[:id])
+
+ respond_to do |format|
+ if @student.update_attributes(params[:student])
+ flash[:notice] = 'Student was successfully updated.'
+ format.html { redirect_to(students_url) }
+ format.xml { head :ok }
+ else
+ format.html { render :action => "edit" }
+ format.xml { render :xml => @student.errors, :status => :unprocessable_entity }
+ end
+ end
+ end
+
+
+ def destroy
+ @student = Student.find(params[:id])
+ @student.destroy
+
+ respond_to do |format|
+ format.html { redirect_to(students_url) }
+ format.xml { head :ok }
+ end
+ end
+end
87 app/controllers/teachers_controller.rb
@@ -0,0 +1,87 @@
+class TeachersController < ApplicationController
+ layout "standard"
+
+ # GET /teachers
+ # GET /teachers.xml
+ def index
+ @teachers = Teacher.find(:all)
+
+ respond_to do |format|
+ format.html # index.html.erb
+ format.xml { render :xml => @teachers }
+ end
+ end
+
+ # GET /teachers/1
+ # GET /teachers/1.xml
+ def show
+ @teacher = Teacher.find(params[:id])
+
+ respond_to do |format|
+ format.html # show.html.erb
+ format.xml { render :xml => @teacher }
+ end
+ end
+
+ # GET /teachers/new
+ # GET /teachers/new.xml
+ def new
+ @teacher = Teacher.new
+
+ respond_to do |format|
+ format.html # new.html.erb
+ format.xml { render :xml => @teacher }
+ end
+ end
+
+ # GET /teachers/1/edit
+ def edit
+ @teacher = Teacher.find(params[:id])
+ end
+
+ # POST /teachers
+ # POST /teachers.xml
+ def create
+ @teacher = Teacher.new(params[:teacher])
+
+ respond_to do |format|
+ if @teacher.save
+ flash[:notice] = 'Teacher was successfully created.'
+ format.html { redirect_to(@teacher) }
+ format.xml { render :xml => @teacher, :status => :created, :location => @teacher }
+ else
+ format.html { render :action => "new" }
+ format.xml { render :xml => @teacher.errors, :status => :unprocessable_entity }
+ end
+ end
+ end
+
+ # PUT /teachers/1
+ # PUT /teachers/1.xml
+ def update
+ @teacher = Teacher.find(params[:id])
+
+ respond_to do |format|
+ if @teacher.update_attributes(params[:teacher])
+ flash[:notice] = 'Teacher was successfully updated.'
+ format.html { redirect_to(teachers_url) }
+ format.xml { head :ok }
+ else
+ format.html { render :action => "edit" }
+ format.xml { render :xml => @teacher.errors, :status => :unprocessable_entity }
+ end
+ end
+ end
+
+ # DELETE /teachers/1
+ # DELETE /teachers/1.xml
+ def destroy
+ @teacher = Teacher.find(params[:id])
+ @teacher.destroy
+
+ respond_to do |format|
+ format.html { redirect_to(teachers_url) }
+ format.xml { head :ok }
+ end
+ end
+end
87 app/controllers/users_controller.rb
@@ -0,0 +1,87 @@
+class UsersController < ApplicationController
+ layout "standard"
+
+ # GET /users
+ # GET /users.xml
+ def index
+ @users = User.find(:all)
+
+ respond_to do |format|
+ format.html # index.html.erb
+ format.xml { render :xml => @users }
+ end
+ end
+
+ # GET /users/1
+ # GET /users/1.xml
+ def show
+ @user = User.find(params[:id])
+
+ respond_to do |format|
+ format.html # show.html.erb
+ format.xml { render :xml => @user }
+ end
+ end
+
+ # GET /users/new
+ # GET /users/new.xml
+ def new
+ @user = User.new
+
+ respond_to do |format|
+ format.html # new.html.erb
+ format.xml { render :xml => @user }
+ end
+ end
+
+ # GET /users/1/edit
+ def edit
+ @user = User.find(params[:id])
+ end
+
+ # POST /users
+ # POST /users.xml
+ def create
+ @user = User.new(params[:user])
+
+ respond_to do |format|
+ if @user.save
+ flash[:notice] = 'User was successfully created.'
+ format.html { redirect_to(@user) }
+ format.xml { render :xml => @user, :status => :created, :location => @user }
+ else
+ format.html { render :action => "new" }
+ format.xml { render :xml => @user.errors, :status => :unprocessable_entity }
+ end
+ end
+ end
+
+ # PUT /users/1
+ # PUT /users/1.xml
+ def update
+ @user = User.find(params[:id])
+
+ respond_to do |format|
+ if @user.update_attributes(params[:user])
+ flash[:notice] = 'User was successfully updated.'
+ format.html { redirect_to(@user) }
+ format.xml { head :ok }
+ else
+ format.html { render :action => "edit" }
+ format.xml { render :xml => @user.errors, :status => :unprocessable_entity }
+ end
+ end
+ end
+
+ # DELETE /users/1
+ # DELETE /users/1.xml
+ def destroy
+ @user = User.find(params[:id])
+ @user.destroy
+
+ respond_to do |format|
+ format.html { redirect_to(users_url) }
+ format.xml { head :ok }
+ end
+ end
+end
18 app/helpers/application_helper.rb
@@ -0,0 +1,18 @@
+# Methods added to this helper will be available to all templates in the application.
+module ApplicationHelper
+
+ ## Generate the page title
+ def title(new_title)
+ content_tag('h2', new_title, :class => 'page_title') if new_title
+ end
+
+ ## Generate the MENU html
+ def layout_link_to(link_text, path)
+ curl = url_for(:controller => request.path_parameters['controller'],
+ :action => request.path_parameters['action'])
+ html = ''
+ options = path == curl ? {:class => 'current'} : {}
+ html << content_tag("li", link_to(link_text, path, options))
+ end
+
+end
2  app/helpers/assignments_helper.rb
@@ -0,0 +1,2 @@
+module AssignmentsHelper
+end
2  app/helpers/courses_helper.rb
@@ -0,0 +1,2 @@
+module CoursesHelper
+end
2  app/helpers/dashboard_helper.rb
@@ -0,0 +1,2 @@
+module DashboardHelper
+end
2  app/helpers/enrollments_helper.rb
@@ -0,0 +1,2 @@
+module EnrollmentsHelper
+end
2  app/helpers/gradations_helper.rb
@@ -0,0 +1,2 @@
+module GradationsHelper
+end
2  app/helpers/sites_helper.rb
@@ -0,0 +1,2 @@
+module SitesHelper
+end
2  app/helpers/students_helper.rb
@@ -0,0 +1,2 @@
+module StudentsHelper
+end
2  app/helpers/teachers_helper.rb
@@ -0,0 +1,2 @@
+module TeachersHelper
+end
2  app/helpers/users_helper.rb
@@ -0,0 +1,2 @@
+module UsersHelper
+end
5 app/models/admin.rb
@@ -0,0 +1,5 @@
+class Admin < User
+ def is_admin?
+ true
+ end
+end
4 app/models/assignment.rb
@@ -0,0 +1,4 @@
+class Assignment < ActiveRecord::Base
+ belongs_to :course
+ has_many :gradations
+end
8 app/models/course.rb
@@ -0,0 +1,8 @@
+class Course < ActiveRecord::Base
+ has_many :assignments
+ has_many :enrollments
+ belongs_to :terms
+# belongs_to :teacher
+
+ validates_presence_of :teacher, :message => "%s wasn't found"
+end
7 app/models/enrollment.rb
@@ -0,0 +1,7 @@
+class Enrollment < ActiveRecord::Base
+ belongs_to :student
+ belongs_to :course
+
+ validates_presence_of :student, :message => "is not in the database"
+ validates_presence_of :course, :message => "is not in the database"
+end
6 app/models/gradation.rb
@@ -0,0 +1,6 @@
+class Gradation < ActiveRecord::Base
+ belongs_to :assignment
+ belongs_to :student
+
+ validates_presence_of :assignment
+end
5 app/models/role.rb
@@ -0,0 +1,5 @@
+class Role < ActiveRecord::Base
+ has_many :users
+# has_many :teachers
+# has_many :students
+end
4 app/models/site.rb
@@ -0,0 +1,4 @@
+class Site < ActiveRecord::Base
+ belongs_to :school
+ has_many :users
+end
3  app/models/student.rb
@@ -0,0 +1,3 @@
+class Student < User
+ validates_inclusion_of :class_of, :in => 2008..2010
+end
11 app/models/teacher.rb
@@ -0,0 +1,11 @@
+class Teacher < User
+ def full_name
+ [first_name, last_name].join(' ')
+ end
+
+ def full_name=(name)
+ split = name.split(' ', 2)
+ self.first_name = split.first
+ self.last_name = split.last
+ end
+end
5 app/models/term.rb
@@ -0,0 +1,5 @@
+class Term < ActiveRecord::Base
+ has_many :courses
+# has_many :comments
+
+end
11 app/models/user.rb
@@ -0,0 +1,11 @@
+class User < ActiveRecord::Base
+ belongs_to :site
+ has_many :courses, :through => :enrollment
+ has_many :gradations
+# has_many :comments
+
+ validates_presence_of :first_name, :message => " is required"
+ validates_presence_of :last_name, :message => " is required"
+# validates_existence_of :site
+
+end
27 app/views/assignments/edit.html.erb
@@ -0,0 +1,27 @@
+<h1>Editing assignment</h1>
+
+<%= error_messages_for :assignment %>
+
+<% form_for(@assignment) do |f| %>
+ <p>
+ <b>Name</b><br />
+ <%= f.text_field :name %>
+ </p>
+
+ <p>
+ <b>Course</b><br />
+ <%= f.text_field :course_id %>
+ </p>
+
+ <p>
+ <b>Possible points</b><br />
+ <%= f.text_field :possible_points %>
+ </p>
+
+ <p>
+ <%= f.submit "Update" %>
+ </p>
+<% end %>
+
+<%= link_to 'Show', @assignment %> |
+<%= link_to 'Back', assignments_path %>
24 app/views/assignments/index.html.erb
@@ -0,0 +1,24 @@
+<h1>Listing assignments</h1>
+
+<table>
+ <tr>
+ <th>Name</th>
+ <th>Course</th>
+ <th>Possible points</th>
+ </tr>
+
+<% for assignment in @assignments %>
+ <tr>
+ <td><%=h assignment.name %></td>
+ <td><%=h assignment.course_id %></td>
+ <td><%=h assignment.possible_points %></td>
+ <td><%= link_to 'Show', assignment %></td>
+ <td><%= link_to 'Edit', edit_assignment_path(assignment) %></td>
+ <td><%= link_to 'Destroy', assignment, :confirm => 'Are you sure?', :method => :delete %></td>
+ </tr>
+<% end %>
+</table>
+
+<br />
+
+<%= link_to 'New assignment', new_assignment_path %>
26 app/views/assignments/new.html.erb
@@ -0,0 +1,26 @@
+<h1>New assignment</h1>
+
+<%= error_messages_for :assignment %>
+
+<% form_for(@assignment) do |f| %>
+ <p>
+ <b>Name</b><br />
+ <%= f.text_field :name %>
+ </p>
+
+ <p>
+ <b>Course</b><br />
+ <%= f.text_field :course_id %>
+ </p>
+
+ <p>
+ <b>Possible points</b><br />
+ <%= f.text_field :possible_points %>
+ </p>
+
+ <p>
+ <%= f.submit "Create" %>
+ </p>
+<% end %>
+
+<%= link_to 'Back', assignments_path %>
18 app/views/assignments/show.html.erb
@@ -0,0 +1,18 @@
+<p>
+ <b>Name:</b>
+ <%=h @assignment.name %>
+</p>
+
+<p>
+ <b>Course:</b>
+ <%=h @assignment.course_id %>
+</p>
+
+<p>
+ <b>Possible points:</b>
+ <%=h @assignment.possible_points %>
+</p>
+
+
+<%= link_to 'Edit', edit_assignment_path(@assignment) %> |
+<%= link_to 'Back', assignments_path %>
21 app/views/campuses/edit.html.erb
@@ -0,0 +1,21 @@
+<h1>Editing Campus</h1>
+
+<%= error_messages_for :campus %>
+
+<% form_for :campus, @campus do |f| %>
+ <p>
+ <b>Name</b><br />
+ <%= f.text_field :name %>
+ </p>
+
+ <p>
+ <b>School</b><br />
+ <%= f.text_field :school_id %>
+ </p>
+
+ <p>
+ <%= f.submit "Update" %>
+ </p>
+<% end %>
+
+
22 app/views/campuses/index.html.erb
@@ -0,0 +1,22 @@
+<h1>Listing campus</h1>
+
+<table>
+ <tr>
+ <th>School</th>
+ <th>Name</th>
+ </tr>
+
+<% for campus in @campuses %>
+ <tr>
+ <td><%=h campus.school_id %></td>
+ <td><%=h campus.name %></td>
+ <td><%= link_to 'Show', campus %></td>
+ <td><%= link_to 'Edit', edit_campus_path(campuses) %></td>
+ <td><%= link_to 'Destroy', campuses, :confirm => 'Are you sure?', :method => :delete %></td>
+ </tr>
+<% end %>
+</table>
+
+<br />
+
+<%= link_to 'New campus', new_campuses_path %>
21 app/views/campuses/new.html.erb
@@ -0,0 +1,21 @@
+<h1>New campus</h1>
+
+<%= error_messages_for :campus %>
+
+<% form_for(@campus) do |f| %>
+ <p>
+ <b>School</b><br />
+ <%= f.text_field :school_id %>
+ </p>
+
+ <p>
+ <b>Name</b><br />
+ <%= f.text_field :name %>
+ </p>
+
+ <p>
+ <%= f.submit "Create" %>
+ </p>
+<% end %>
+
+<%= link_to 'Back', campuses_path %>
13 app/views/campuses/show.html.erb
@@ -0,0 +1,13 @@
+<p>
+ <b>School:</b>
+ <%=h @campus.school_id %>
+</p>
+
+<p>
+ <b>Name:</b>
+ <%=h @campus.name %>
+</p>
+
+
+<%= link_to 'Edit', edit_campus_path(@campus) %> |
+<%= link_to 'Back', campus_path %>
42 app/views/courses/edit.html.erb
@@ -0,0 +1,42 @@
+<h1>Editing course</h1>
+
+<%= error_messages_for :course %>
+
+<% form_for(@course) do |f| %>
+ <p>
+ <b>Name</b><br />
+ <%= f.text_field :name %>
+ </p>
+
+ <p>
+ <b>Teacher</b><br />
+ <%= f.text_field :teacher_id %>
+ </p>
+
+ <p>
+ <b>Term</b><br />
+ <%= f.text_field :term_id %>
+ </p>
+
+ <p>
+ <b>Grade scale</b><br />
+ <%= f.text_field :grade_scale_id %>
+ </p>
+
+ <p>
+ <b>Course att</b><br />
+ <%= f.text_field :course_att_id %>
+ </p>
+
+ <p>
+ <b>Course type</b><br />
+ <%= f.text_field :course_type_id %>
+ </p>
+
+ <p>
+ <%= f.submit "Update" %>
+ </p>
+<% end %>
+
+<%= link_to 'Show', @course %> |
+<%= link_to 'Back', courses_path %>
30 app/views/courses/index.html.erb
@@ -0,0 +1,30 @@
+<h1>Listing courses</h1>
+
+<table>
+ <tr>
+ <th>Name</th>
+ <th>Teacher</th>
+ <th>Term</th>
+ <th>Grade scale</th>
+ <th>Course att</th>
+ <th>Course type</th>
+ </tr>
+
+<% for course in @courses %>
+ <tr>
+ <td><%=h course.name %></td>
+ <td><%=h course.teacher_id %></td>
+ <td><%=h course.term_id %></td>
+ <td><%=h course.grade_scale_id %></td>
+ <td><%=h course.course_att_id %></td>
+ <td><%=h course.course_type_id %></td>
+ <td><%= link_to 'Show', course %></td>
+ <td><%= link_to 'Edit', edit_course_path(course) %></td>
+ <td><%= link_to 'Destroy', course, :confirm => 'Are you sure?', :method => :delete %></td>
+ </tr>
+<% end %>
+</table>
+
+<br />
+
+<%= link_to 'New course', new_course_path %>
41 app/views/courses/new.html.erb
@@ -0,0 +1,41 @@
+<h1>New course</h1>
+
+<%= error_messages_for :course %>
+
+<% form_for(@course) do |f| %>
+ <p>
+ <b>Name</b><br />
+ <%= f.text_field :name %>
+ </p>
+
+ <p>
+ <b>Teacher</b><br />
+ <%= f.text_field :teacher_id %>
+ </p>
+
+ <p>
+ <b>Term</b><br />
+ <%= f.text_field :term_id %>
+ </p>
+
+ <p>
+ <b>Grade scale</b><br />
+ <%= f.text_field :grade_scale_id %>
+ </p>
+
+ <p>
+ <b>Course att</b><br />
+ <%= f.text_field :course_att_id %>
+ </p>
+
+ <p>
+ <b>Course type</b><br />
+ <%= f.text_field :course_type_id %>
+ </p>
+
+ <p>
+ <%= f.submit "Create" %>
+ </p>
+<% end %>
+
+<%= link_to 'Back', courses_path %>
33 app/views/courses/show.html.erb
@@ -0,0 +1,33 @@
+<p>
+ <b>Name:</b>
+ <%=h @course.name %>
+</p>
+
+<p>
+ <b>Teacher:</b>
+ <%=h @course.teacher_id %>
+</p>
+
+<p>
+ <b>Term:</b>
+ <%=h @course.term_id %>
+</p>
+
+<p>
+ <b>Grade scale:</b>
+ <%=h @course.grade_scale_id %>
+</p>
+
+<p>
+ <b>Course att:</b>
+ <%=h @course.course_att_id %>
+</p>
+
+<p>
+ <b>Course type:</b>
+ <%=h @course.course_type_id %>
+</p>
+
+
+<%= link_to 'Edit', edit_course_path(@course) %> |
+<%= link_to 'Back', courses_path %>
1  app/views/dashboard/index.html.erb
@@ -0,0 +1 @@
+Ipsolurm
22 app/views/enrollments/edit.html.erb
@@ -0,0 +1,22 @@
+<h1>Editing enrollment</h1>
+
+<%= error_messages_for :enrollment %>
+
+<% form_for(@enrollment) do |f| %>
+ <p>
+ <b>Student</b><br />
+ <%= f.text_field :student_id %>
+ </p>
+
+ <p>
+ <b>Course</b><br />
+ <%= f.text_field :course_id %>
+ </p>
+
+ <p>
+ <%= f.submit "Update" %>
+ </p>
+<% end %>
+
+<%= link_to 'Show', @enrollment %> |
+<%= link_to 'Back', enrollments_path %>
27 app/views/enrollments/index.html.erb
@@ -0,0 +1,27 @@
+<h1>Listing enrollments</h1>
+
+<table border='1'>
+ <tr>
+ <th>Student</th>
+ <th>First Name</th>
+ <th>Last Name</th>
+ <th>Course</th>
+ <th>Course Name</th>
+ </tr>
+
+<% for enrollment in @enrollments %>
+ <tr>
+ <td><%=h enrollment.student_id %></td>
+ <td><%=h User.find(enrollment.student_id).first_name %></td>
+ <td><%=h enrollment.course_id %></td>
+ <td><%=h Course.find(enrollment.course_id).name %></td>
+ <td><%= link_to 'Show', enrollment %></td>
+ <td><%= link_to 'Edit', edit_enrollment_path(enrollment) %></td>
+ <td><%= link_to 'Destroy', enrollment, :confirm => 'Are you sure?', :method => :delete %></td>
+ </tr>
+<% end %>
+</table>
+
+<br />
+
+<%= link_to 'New enrollment', new_enrollment_path %>
21 app/views/enrollments/new.html.erb
@@ -0,0 +1,21 @@
+<h1>New enrollment</h1>
+
+<%= error_messages_for :enrollment %>
+
+<% form_for(@enrollment) do |f| %>
+ <p>
+ <b>Student</b><br />
+ <%= f.text_field :student_id %>
+ </p>
+
+ <p>
+ <b>Course</b><br />
+ <%= f.text_field :course_id %>
+ </p>
+
+ <p>
+ <%= f.submit "Create" %>
+ </p>
+<% end %>
+
+<%= link_to 'Back', enrollments_path %>
13 app/views/enrollments/show.html.erb
@@ -0,0 +1,13 @@
+<p>
+ <b>Student:</b>
+ <%=h @enrollment.student_id %>
+</p>
+
+<p>
+ <b>Course:</b>
+ <%=h @enrollment.course_id %>
+</p>
+
+
+<%= link_to 'Edit', edit_enrollment_path(@enrollment) %> |
+<%= link_to 'Back', enrollments_path %>
27 app/views/gradations/edit.html.erb
@@ -0,0 +1,27 @@
+<h1>Editing gradation</h1>
+
+<%= error_messages_for :gradation %>
+
+<% form_for(@gradation) do |f| %>
+ <p>
+ <b>Student</b><br />
+ <%= f.text_field :student_id %>
+ </p>
+
+ <p>
+ <b>Assignment</b><br />
+ <%= f.text_field :assignment_id %>
+ </p>
+
+ <p>
+ <b>Points earned</b><br />
+ <%= f.text_field :points_earned %>
+ </p>
+
+ <p>
+ <%= f.submit "Update" %>
+ </p>
+<% end %>
+
+<%= link_to 'Show', @gradation %> |
+<%= link_to 'Back', gradations_path %>
24 app/views/gradations/index.html.erb
@@ -0,0 +1,24 @@
+<h1>Listing gradations</h1>
+
+<table>
+ <tr>
+ <th>Student</th>
+ <th>Assignment</th>
+ <th>Points earned</th>
+ </tr>
+
+<% for gradation in @gradations %>
+ <tr>
+ <td><%=h gradation.student_id %></td>
+ <td><%=h gradation.assignment_id %></td>
+ <td><%=h gradation.points_earned %></td>
+ <td><%= link_to 'Show', gradation %></td>
+ <td><%= link_to 'Edit', edit_gradation_path(gradation) %></td>
+ <td><%= link_to 'Destroy', gradation, :confirm => 'Are you sure?', :method => :delete %></td>
+ </tr>
+<% end %>
+</table>
+
+<br />
+
+<%= link_to 'New gradation', new_gradation_path %>
26 app/views/gradations/new.html.erb
@@ -0,0 +1,26 @@
+<h1>New gradation</h1>
+
+<%= error_messages_for :gradation %>
+
+<% form_for(@gradation) do |f| %>
+ <p>
+ <b>Student</b><br />
+ <%= f.text_field :student_id %>
+ </p>
+
+ <p>
+ <b>Assignment</b><br />
+ <%= f.text_field :assignment_id %>
+ </p>
+
+ <p>
+ <b>Points earned</b><br />
+ <%= f.text_field :points_earned %>
+ </p>
+
+ <p>
+ <%= f.submit "Create" %>
+ </p>
+<% end %>
+
+<%= link_to 'Back', gradations_path %>
18 app/views/gradations/show.html.erb
@@ -0,0 +1,18 @@
+<p>
+ <b>Student:</b>
+ <%=h @gradation.student_id %>
+</p>
+
+<p>
+ <b>Assignment:</b>
+ <%=h @gradation.assignment_id %>
+</p>
+
+<p>
+ <b>Points earned:</b>
+ <%=h @gradation.points_earned %>
+</p>
+
+
+<%= link_to 'Edit', edit_gradation_path(@gradation) %> |
+<%= link_to 'Back', gradations_path %>
51 app/views/layouts/standard.html.erb
@@ -0,0 +1,51 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+
+<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
+<head>
+ <meta http-equiv="content-type" content="text/html;charset=UTF-8" />
+ <title>Gradesheet<%#= controller.action_name.capitalize + "ing" %></title>
+ <%#= stylesheet_link_tag 'scaffold' %>
+ <%= stylesheet_link_tag 'layout' %>
+ <%= stylesheet_link_tag 'tables' %>
+ <%= stylesheet_link_tag 'menu' %>
+</head>
+<body>
+
+
+
+<div id="header">
+ <div class="login"><a href="/login">Login</a></div>
+ <div class="tagline">GradeSheet</div>
+ <img src="/images/rails.png">
+
+ <div class="flash"><%= flash[:notice] %></div>
+
+ <div id="menucontainer">
+ <ul id="menu">
+ <%= layout_link_to "Home", "/" %>
+ <%= layout_link_to "Teachers", teachers_path %>
+ <%= layout_link_to "Students", students_path %>
+ <%= layout_link_to "Courses", courses_path %>
+ <%= layout_link_to "Assignments", assignments_path %>
+ </ul>
+ </div>
+
+</div>
+
+
+<div id="container">
+
+ <div id="content" class="column">
+ <%= yield %>
+ </div>
+
+</div>
+
+
+<div id="footer">
+ &copy; 2005 - 2008 <a href="http://www.kangaroobox.com">KangarooBox</a>, LLC. All rights reserved.
+</div>
+</body>
+</html>
+
22 app/views/sites/edit.html.erb
@@ -0,0 +1,22 @@
+<h1>Editing site</h1>
+
+<%= error_messages_for :site %>
+
+<% form_for(@site) do |f| %>
+ <p>
+ <b>Name</b><br />
+ <%= f.text_field :name %>
+ </p>
+
+ <p>
+ <b>School</b><br />
+ <%= f.text_field :school_id %>
+ </p>
+
+ <p>
+ <%= f.submit "Update" %>
+ </p>
+<% end %>
+
+<%= link_to 'Show', @site %> |
+<%= link_to 'Back', sites_path %>
22 app/views/sites/index.html.erb
@@ -0,0 +1,22 @@
+<h1>Listing sites</h1>
+
+<table>
+ <tr>
+ <th>Name</th>
+ <th>School</th>
+ </tr>
+
+<% for site in @sites %>
+ <tr>
+ <td><%=h site.name %></td>
+ <td><%=h site.school_id %></td>
+ <td><%= link_to 'Show', site %></td>
+ <td><%= link_to 'Edit', edit_site_path(site) %></td>
+ <td><%= link_to 'Destroy', site, :confirm => 'Are you sure?', :method => :delete %></td>
+ </tr>
+<% end %>
+</table>
+
+<br />
+
+<%= link_to 'New site', new_site_path %>
21 app/views/sites/new.html.erb
@@ -0,0 +1,21 @@
+<h1>New site</h1>
+
+<%= error_messages_for :site %>
+
+<% form_for(@site) do |f| %>
+ <p>
+ <b>Name</b><br />
+ <%= f.text_field :name %>
+ </p>
+
+ <p>
+ <b>School</b><br />
+ <%= f.text_field :school_id %>
+ </p>
+
+ <p>
+ <%= f.submit "Create" %>
+ </p>
+<% end %>
+
+<%= link_to 'Back', sites_path %>
13 app/views/sites/show.html.erb
@@ -0,0 +1,13 @@
+<p>
+ <b>Name:</b>
+ <%=h @site.name %>
+</p>
+
+<p>
+ <b>School:</b>
+ <%=h @site.school_id %>
+</p>
+
+
+<%= link_to 'Edit', edit_site_path(@site) %> |
+<%= link_to 'Back', sites_path %>
65 app/views/students/_student.html.erb
@@ -0,0 +1,65 @@
+<% # Are we editing this Student?
+if true
+%>
+ <p>
+ <b>Short name:</b>
+ <%= f.text_field :short_name %>
+ </p>
+
+ <p>
+ <b>First name:</b>
+ <%= f.text_field :first_name %>
+ </p>
+
+ <p>
+ <b>Last name:</b>
+ <%= f.text_field :last_name %>
+ </p>
+
+ <p>
+ <b>Email:</b>
+ <%= f.text_field :email %>
+ </p>
+
+ <p>
+ <b>Site:</b>
+ <%= collection_select :student, :site_id, Site.find(:all), :id, :name %>
+ </p>
+
+ <p>
+ <b>Class of:</b>
+ <%= f.text_field :class_of %>
+ </p>
+
+<% # No, we are just displaying them
+else %>
+ <p>
+ <b>Short name:</b>
+ <%=h @student.short_name %>
+ </p>
+
+ <p>
+ <b>First name:</b>
+ <%=h @student.first_name %>
+ </p>
+
+ <p>
+ <b>Last name:</b>
+ <%=h @student.last_name %>
+ </p>
+
+ <p>
+ <b>Email:</b>
+ <%=h @student.email %>
+ </p>
+
+ <p>
+ <b>Campus:</b>
+ <%=h Site.find(@student.site_id).name %>
+ </p>
+
+ <p>
+ <b>Class of:</b>
+ <%=h @student.class_of %>
+ </p>
+<% end %>
30 app/views/students/_student_list.erb
@@ -0,0 +1,30 @@
+<% %>
+<table id="students" class="master">
+ <thead>
+ <th>ID</th>
+ <th>Name</th>
+ <th>Email Address</th>
+ <th>Campus</th>
+ <th>Class Of</th>
+ </thead>
+ <tfoot>
+ <th>ID</th>
+ <th>Name</th>
+ <th>Email Address</th>
+ <th>Campus</th>
+ <th>Class Of</th>
+ </tfoot>
+
+ <tbody>
+ <% for student in @students %>
+ <tr class="<%= cycle ('odd', 'even') %>" onclick="location.href='<%= edit_student_path(student) %>'">
+ <td><%=h student.short_name %></td>
+ <td><%=h student.last_name %>, <%=h student.first_name %></td>
+ <td><%=h student.email %></td>
+ <td><%=h Site.find(student.site_id).name %></td>
+ <td><%=h student.class_of %></td>
+ </tr>
+ <% end %>
+ </tbody>
+</table>
+
12 app/views/students/edit.html.erb
@@ -0,0 +1,12 @@
+
+<%= title "Editing Student: #{@student.first_name} #{@student.last_name}" %>
+
+<%= error_messages_for :student %>
+
+<% form_for(@student) do |f| %>
+ <%= render :partial => 'student' , :locals => {:f => f} %>
+ <%= submit_tag 'Update' %>
+<% end %>
+
+<%= link_to 'Show', @student %> |
+<%= link_to 'Back', students_path %>
30 app/views/students/index.html.erb
@@ -0,0 +1,30 @@
+<p>
+<form name="sform" action="" style="display:inline;">
+ <label for="item_name">Filter on Student name : </label>
+ <%= text_field_tag("query", params['query'], :size => 10 ) %>
+</form>
+
+<%= image_tag("spinner.gif",
+ :align => "absmiddle",
+ :border => 0,
+ :id => "spinner",
+ :style =>"display: none;" ) %>
+</p>
+
+<%= observe_field :query, :frequency => 2,
+ :update => "table",
+ :before => "Element.hide('table')",
+ :success => "Element.show('table')",
+ :url => {:action => :update_list },
+ :with => "query",
+ :on => "blur" %>
+
+<div id="table">
+ <%= render :partial => "student_list" %>
+</div>
+
+
+<br />
+
+<%= link_to 'New Student', new_student_path %>
+
44 app/views/students/new.html.erb
@@ -0,0 +1,44 @@
+<h1>New Student</h1>
+
+<%= error_messages_for :student %>
+
+<% form_for(@student) do |f| %>
+ render_partial 'student', @students
+
+ <p>
+ <b>Short Name</b><br />
+ <%= f.text_field :short_name %>
+ </p>
+
+
+ <p>
+ <b>First Name</b><br />
+ <%= f.text_field :first_name %>
+ </p>
+
+ <p>
+ <b>Last Name</b><br />
+ <%= f.text_field :last_name %>
+ </p>
+
+ <p>
+ <b>Email Address</b><br />
+ <%= f.text_field :email %>
+ </p>
+
+ <p>
+ <b>Class of</b><br />
+ <%= f.text_field :class_of %>
+ </p>
+
+ <p>
+ <b>Site</b><br />
+ <%= collection_select :student, :site, Site.find(:all), :id, :name %>
+ </p>
+
+
+ <%= submit_tag 'Create' %>
+
+<% end %>
+
+<%= link_to 'Back', students_path %>
13 app/views/students/show.html.erb
@@ -0,0 +1,13 @@
+<%= title "Student: #{@student.first_name} #{@student.last_name}" %>
+
+<%#= render :partial => @student %>
+
+<%= link_to 'Edit', edit_student_path(@student) %> |
+<%= link_to 'Back', students_path %>
+
+
+
+
+
+
+
30 app/views/teachers/_teacher_list.erb
@@ -0,0 +1,30 @@
+<% %>
+<table id="teachers" class="master">
+ <thead>
+ <th>ID</th>
+ <th>Name</th>
+ <th>Email Address</th>
+ <th>Campus</th>
+ <th>Class Of</th>
+ </thead>
+ <tfoot>
+ <th>ID</th>
+ <th>Name</th>
+ <th>Email Address</th>
+ <th>Campus</th>
+ <th>Class Of</th>
+ </tfoot>
+
+ <tbody>
+ <% for teacher in @teachers %>
+ <tr class="<%= cycle('odd', 'even') %>" onclick="location.href='<%= edit_teacher_path(teacher) %>'">
+ <td><%=h teacher.short_name %></a></td>
+ <td><%= link_to teacher.full_name, edit_teacher_path(teacher) %></td>
+ <td><%=h teacher.email %></td>
+ <td><%=h Site.find(teacher.site_id).name %></td>
+ <td><%=h teacher.class_of %></td>
+ </tr>
+ <% end %>
+ </tbody>
+</table>
+
37 app/views/teachers/edit.html.erb
@@ -0,0 +1,37 @@
+<h1>Editing Teacher</h1>
+
+<%= error_messages_for :Teacher %>
+
+<% form_for(@teacher) do |f| %>
+ <p>
+ <b>Short Name</b><br />
+ <%= f.text_field :short_name %>
+ </p>
+
+ <p>
+ <b>First Name</b><br />
+ <%= f.text_field :first_name %>
+ </p>
+
+ <p>
+ <b>Last Name</b><br />
+ <%= f.text_field :last_name %>
+ </p>
+
+ <p>
+ <b>Email Address</b><br />
+ <%= f.text_field :email %>
+ </p>
+
+ <p>
+ <b>Site</b><br />
+ <%= collection_select :teacher, :site_id, Site.find(:all), :id, :name %>
+ </p>
+
+<div style="width: 200px; margin: auto; border: 1px solid red; ">
+ <%= f.submit " Save " %>
+ <%= f.submit " Cancel " %>
+</div>
+<% end %>
+
+<%= link_to 'Back', teachers_path %>
8 app/views/teachers/index.html.erb
@@ -0,0 +1,8 @@
+
+<div id="table">
+ <%= render :partial => "teacher_list" %>
+</div>
+
+<br />
+
+<%= link_to 'New teacher', new_teacher_path %>
43 app/views/teachers/new.html.erb
@@ -0,0 +1,43 @@
+
+<%= error_messages_for :teacher %>
+
+<% form_for(@teacher) do |f| %>
+ render_partial 'teacher', @teachers
+
+ <p>
+ <b>Short Name</b><br />
+ <%= f.text_field :short_name %>
+ </p>
+
+ <p>
+ <b>First Name</b><br />
+ <%= f.text_field :first_name %>
+ </p>
+
+ <p>
+ <b>Last Name</b><br />
+ <%= f.text_field :last_name %>
+ </p>
+
+ <p>
+ <b>Email Address</b><br />
+ <%= f.text_field :email %>
+ </p>
+
+ <p>
+ <b>Class of</b><br />
+ <%= f.text_field :class_of %>
+ </p>
+
+ <p>
+ <b>Site</b><br />
+ <%= collection_select :teacher, :site, Site.find(:all), :id, :name %>
+ </p>
+
+
+ <%= submit_tag 'Create' %>
+
+<% end %>
+
+<%= link_to 'Back', teachers_path %>
+
27 app/views/teachers/show.html.erb
@@ -0,0 +1,27 @@
+<p>
+ <b>Short name:</b>
+ <%=h @teacher.short_name %>
+</p>
+
+<p>
+ <b>Full Name:</b>
+ <%=h @teacher.full_name %>
+</p>
+
+<p>
+ <b>Email:</b>
+ <%=h @teacher.email %>
+</p>
+
+<p>
+ <b>Site:</b>
+ <%=h @teacher.site_id %>
+</p>
+
+<p>
+ <b>Class of:</b>
+ <%=h @teacher.class_of %>
+</p>
+
+<%= link_to 'Edit', edit_teacher_path(@teacher) %> |
+<%= link_to 'Back', teachers_path %>
17 app/views/user_types/edit.html.erb
@@ -0,0 +1,17 @@
+<h1>Editing user_type</h1>
+
+<%= error_messages_for :user_type %>
+
+<% form_for(@user_type) do |f| %>
+ <p>
+ <b>Name</b><br />
+ <%= f.text_field :name %>
+ </p>
+
+ <p>
+ <%= f.submit "Update" %>
+ </p>
+<% end %>
+
+<%= link_to 'Show', @user_type %> |
+<%= link_to 'Back', user_types_path %>
20 app/views/user_types/index.html.erb
@@ -0,0 +1,20 @@
+<h1>Listing user_types</h1>
+
+<table>
+ <tr>
+ <th>Name</th>
+ </tr>
+
+<% for user_type in @user_types %>
+ <tr>
+ <td><%=h user_type.name %></td>
+ <td><%= link_to 'Show', user_type %></td>
+ <td><%= link_to 'Edit', edit_user_type_path(user_type) %></td>
+ <td><%= link_to 'Destroy', user_type, :confirm => 'Are you sure?', :method => :delete %></td>
+ </tr>
+<% end %>
+</table>
+
+<br />
+
+<%= link_to 'New user_type', new_user_type_path %>
16 app/views/user_types/new.html.erb
@@ -0,0 +1,16 @@
+<h1>New user_type</h1>
+
+<%= error_messages_for :user_type %>
+
+<% form_for(@user_type) do |f| %>
+ <p>
+ <b>Name</b><br />
+ <%= f.text_field :name %>
+ </p>
+
+ <p>
+ <%= f.submit "Create" %>
+ </p>
+<% end %>
+
+<%= link_to 'Back', user_types_path %>
8 app/views/user_types/show.html.erb
@@ -0,0 +1,8 @@
+<p>
+ <b>Name:</b>
+ <%=h @user_type.name %>
+</p>
+
+
+<%= link_to 'Edit', edit_user_type_path(@user_type) %> |
+<%= link_to 'Back', user_types_path %>
37 app/views/users/edit.html.erb
@@ -0,0 +1,37 @@
+<h1>Editing user</h1>
+
+<%= error_messages_for :user %>
+
+<% form_for(@user) do |f| %>
+ <p>
+ <b>Short name</b><br />
+ <%= f.text_field :short_name %>
+ </p>
+
+ <p>
+ <b>First name</b><br />
+ <%= f.text_field :first_name %>
+ </p>
+
+ <p>
+ <b>Last name</b><br />
+ <%= f.text_field :last_name %>
+ </p>
+
+ <p>
+ <b>Email</b><br />
+ <%= f.text_field :email %>
+ </p>
+