Skip to content
Browse files

first

  • Loading branch information...
0 parents commit 65ff940a6911244e06220f20a9d75b1615ef8e33 @ernz23 committed
Showing with 15,605 additions and 0 deletions.
  1. BIN .DS_Store
  2. +15 −0 .gitignore
  3. +41 −0 Gemfile
  4. +137 −0 Gemfile.lock
  5. +261 −0 README.rdoc
  6. +7 −0 Rakefile
  7. BIN app/assets/images/rails.png
  8. +22 −0 app/assets/javascripts/application.js
  9. +4 −0 app/assets/javascripts/bootstrap.js.coffee
  10. +3 −0 app/assets/javascripts/courses.js.coffee
  11. +3 −0 app/assets/javascripts/distributions.js.coffee
  12. +3 −0 app/assets/javascripts/home.js.coffee
  13. +3 −0 app/assets/javascripts/schedules.js.coffee
  14. +3 −0 app/assets/javascripts/sessions.js.coffee
  15. +3 −0 app/assets/javascripts/students.js.coffee
  16. +3 −0 app/assets/javascripts/users.js.coffee
  17. +16 −0 app/assets/stylesheets/application.css
  18. +17 −0 app/assets/stylesheets/bootstrap_and_overrides.css.less
  19. +3 −0 app/assets/stylesheets/courses.css.scss
  20. +3 −0 app/assets/stylesheets/distributions.css.scss
  21. +3 −0 app/assets/stylesheets/home.css.scss
  22. +56 −0 app/assets/stylesheets/scaffolds.css.scss
  23. +3 −0 app/assets/stylesheets/schedules.css.scss
  24. +3 −0 app/assets/stylesheets/sessions.css.scss
  25. +3 −0 app/assets/stylesheets/students.css.scss
  26. +3 −0 app/assets/stylesheets/users.css.scss
  27. +17 −0 app/controllers/application_controller.rb
  28. +87 −0 app/controllers/courses_controller.rb
  29. +83 −0 app/controllers/distributions_controller.rb
  30. +7 −0 app/controllers/home_controller.rb
  31. +84 −0 app/controllers/schedules_controller.rb
  32. +21 −0 app/controllers/sessions_controller.rb
  33. +84 −0 app/controllers/students_controller.rb
  34. +15 −0 app/controllers/users_controller.rb
  35. +9 −0 app/helpers/application_helper.rb
  36. +2 −0 app/helpers/courses_helper.rb
  37. +2 −0 app/helpers/distributions_helper.rb
  38. +2 −0 app/helpers/home_helper.rb
  39. +2 −0 app/helpers/schedules_helper.rb
  40. +2 −0 app/helpers/sessions_helper.rb
  41. +2 −0 app/helpers/students_helper.rb
  42. +2 −0 app/helpers/users_helper.rb
  43. 0 app/mailers/.gitkeep
  44. 0 app/models/.gitkeep
  45. +12 −0 app/models/course.rb
  46. +4 −0 app/models/distribution.rb
  47. +5 −0 app/models/enrollment.rb
  48. +4 −0 app/models/student.rb
  49. +7 −0 app/models/user.rb
  50. +5 −0 app/views/courses/_distribution_fields.html.erb
  51. +48 −0 app/views/courses/_form.html.erb
  52. +1 −0 app/views/courses/edit.html.erb
  53. +26 −0 app/views/courses/index.html.erb
  54. +3 −0 app/views/courses/new.html.erb
  55. +27 −0 app/views/courses/show.html.erb
  56. +31 −0 app/views/distributions/_form.html.erb
  57. +1 −0 app/views/distributions/edit.html.erb
  58. +26 −0 app/views/distributions/index.html.erb
  59. +1 −0 app/views/distributions/new.html.erb
  60. +22 −0 app/views/distributions/show.html.erb
  61. +29 −0 app/views/home/global_links.html.erb
  62. +2 −0 app/views/home/index.html.erb
  63. +38 −0 app/views/layouts/application.html.erb
  64. +29 −0 app/views/schedules/_form.html.erb
  65. +6 −0 app/views/schedules/edit.html.erb
  66. +27 −0 app/views/schedules/index.html.erb
  67. +5 −0 app/views/schedules/new.html.erb
  68. +20 −0 app/views/schedules/show.html.erb
  69. 0 app/views/sessions/index.html.erb
  70. +14 −0 app/views/sessions/new.html.erb
  71. +38 −0 app/views/students/_form.html.erb
  72. +4 −0 app/views/students/_students_fields.html.erb
  73. +1 −0 app/views/students/edit.html.erb
  74. +26 −0 app/views/students/index.html.erb
  75. +1 −0 app/views/students/new.html.erb
  76. +27 −0 app/views/students/show.html.erb
  77. +24 −0 app/views/users/_form.html.erb
  78. +1 −0 app/views/users/edit.html.erb
  79. +26 −0 app/views/users/index.html.erb
  80. +1 −0 app/views/users/new.html.erb
  81. +17 −0 app/views/users/show.html.erb
  82. +4 −0 config.ru
  83. +59 −0 config/application.rb
  84. +6 −0 config/boot.rb
  85. +29 −0 config/database-sql.yml
  86. +25 −0 config/database.yml
  87. +5 −0 config/environment.rb
  88. +37 −0 config/environments/development.rb
  89. +67 −0 config/environments/production.rb
  90. +37 −0 config/environments/test.rb
  91. +7 −0 config/initializers/backtrace_silencers.rb
  92. +15 −0 config/initializers/inflections.rb
  93. +5 −0 config/initializers/mime_types.rb
  94. +7 −0 config/initializers/secret_token.rb
  95. +8 −0 config/initializers/session_store.rb
  96. +14 −0 config/initializers/wrap_parameters.rb
  97. +5 −0 config/locales/en.yml
  98. +71 −0 config/routes.rb
  99. +12 −0 db-bu/2012-03-01_10:05:11_+0800/courses.yml
  100. +12 −0 db-bu/data.yml
  101. BIN db-bu/development.sqlite3
  102. +12 −0 db-bu/migrate/20120228123516_create_courses.rb
  103. +11 −0 db-bu/migrate/20120228135430_create_schedules.rb
  104. +12 −0 db-bu/migrate/20120228225432_create_students.rb
  105. +10 −0 db-bu/migrate/20120229033210_create_users.rb
  106. +11 −0 db-bu/migrate/20120229111020_create_distributions.rb
  107. +64 −0 db-bu/schema.rb
  108. +7 −0 db-bu/seeds.rb
  109. BIN db-bu/test.sqlite3
  110. +12 −0 db/2012-03-01_10:05:11_+0800/courses.yml
  111. +12 −0 db/data.yml
  112. +12 −0 db/migrate/20120228123516_create_courses.rb
  113. +11 −0 db/migrate/20120228135430_create_schedules.rb
  114. +12 −0 db/migrate/20120228225432_create_students.rb
  115. +10 −0 db/migrate/20120229033210_create_users.rb
  116. +11 −0 db/migrate/20120229111020_create_distributions.rb
  117. +64 −0 db/schema.rb
  118. +7 −0 db/seeds.rb
  119. +2 −0 doc/README_FOR_APP
  120. 0 lib/assets/.gitkeep
  121. 0 lib/tasks/.gitkeep
  122. 0 log/.gitkeep
  123. +19 −0 package/ruby/1.8/bin/erubis
  124. +19 −0 package/ruby/1.8/bin/lessc
  125. +19 −0 package/ruby/1.8/bin/rackup
  126. +19 −0 package/ruby/1.8/bin/rails
  127. +19 −0 package/ruby/1.8/bin/rake
  128. +19 −0 package/ruby/1.8/bin/rake2thor
  129. +19 −0 package/ruby/1.8/bin/rdoc
  130. +19 −0 package/ruby/1.8/bin/ri
  131. +19 −0 package/ruby/1.8/bin/sass
  132. +19 −0 package/ruby/1.8/bin/sass-convert
  133. +19 −0 package/ruby/1.8/bin/scss
  134. +19 −0 package/ruby/1.8/bin/therubyracer
  135. +19 −0 package/ruby/1.8/bin/thor
  136. +19 −0 package/ruby/1.8/bin/tilt
  137. +19 −0 package/ruby/1.8/bin/tt
  138. BIN package/ruby/1.8/cache/actionmailer-3.2.1.gem
  139. BIN package/ruby/1.8/cache/actionpack-3.2.1.gem
  140. BIN package/ruby/1.8/cache/activemodel-3.2.1.gem
  141. BIN package/ruby/1.8/cache/activerecord-3.2.1.gem
  142. BIN package/ruby/1.8/cache/activeresource-3.2.1.gem
  143. BIN package/ruby/1.8/cache/activesupport-3.2.1.gem
  144. BIN package/ruby/1.8/cache/arel-3.0.2.gem
  145. BIN package/ruby/1.8/cache/backbone-rails-0.9.0.gem
  146. BIN package/ruby/1.8/cache/bcrypt-ruby-3.0.1.gem
  147. BIN package/ruby/1.8/cache/bootstrap-sass-2.0.1.gem
  148. BIN package/ruby/1.8/cache/builder-3.0.0.gem
  149. BIN package/ruby/1.8/cache/coffee-rails-3.2.2.gem
  150. BIN package/ruby/1.8/cache/coffee-script-2.2.0.gem
  151. BIN package/ruby/1.8/cache/coffee-script-source-1.2.0.gem
  152. BIN package/ruby/1.8/cache/commonjs-0.2.0.gem
  153. BIN package/ruby/1.8/cache/erubis-2.7.0.gem
  154. BIN package/ruby/1.8/cache/execjs-1.3.0.gem
  155. BIN package/ruby/1.8/cache/hike-1.2.1.gem
  156. BIN package/ruby/1.8/cache/i18n-0.6.0.gem
  157. BIN package/ruby/1.8/cache/journey-1.0.3.gem
  158. BIN package/ruby/1.8/cache/jquery-rails-2.0.1.gem
  159. BIN package/ruby/1.8/cache/json-1.6.5.gem
  160. BIN package/ruby/1.8/cache/less-2.0.9.gem
  161. BIN package/ruby/1.8/cache/less-rails-2.1.6.gem
  162. BIN package/ruby/1.8/cache/libv8-3.3.10.4-x86_64-darwin-11.gem
  163. BIN package/ruby/1.8/cache/mail-2.4.1.gem
  164. BIN package/ruby/1.8/cache/mime-types-1.17.2.gem
  165. BIN package/ruby/1.8/cache/multi_json-1.1.0.gem
  166. BIN package/ruby/1.8/cache/nested_form-0.2.0.gem
  167. BIN package/ruby/1.8/cache/polyglot-0.3.3.gem
  168. BIN package/ruby/1.8/cache/rack-1.4.1.gem
  169. BIN package/ruby/1.8/cache/rack-cache-1.1.gem
  170. BIN package/ruby/1.8/cache/rack-ssl-1.3.2.gem
  171. BIN package/ruby/1.8/cache/rack-test-0.6.1.gem
  172. BIN package/ruby/1.8/cache/rails-3.2.1.gem
  173. BIN package/ruby/1.8/cache/railties-3.2.1.gem
  174. BIN package/ruby/1.8/cache/rake-0.9.2.2.gem
  175. BIN package/ruby/1.8/cache/rdoc-3.12.gem
  176. BIN package/ruby/1.8/cache/sass-3.1.15.gem
  177. BIN package/ruby/1.8/cache/sass-rails-3.2.4.gem
  178. BIN package/ruby/1.8/cache/sprockets-2.1.2.gem
  179. BIN package/ruby/1.8/cache/sqlite3-1.3.5.gem
  180. BIN package/ruby/1.8/cache/therubyracer-0.9.10.gem
  181. BIN package/ruby/1.8/cache/thor-0.14.6.gem
  182. BIN package/ruby/1.8/cache/tilt-1.3.3.gem
  183. BIN package/ruby/1.8/cache/treetop-1.4.10.gem
  184. BIN package/ruby/1.8/cache/twitter-bootstrap-rails-2.0.3.gem
  185. BIN package/ruby/1.8/cache/tzinfo-0.3.31.gem
  186. BIN package/ruby/1.8/cache/uglifier-1.2.3.gem
  187. BIN package/ruby/1.8/cache/yaml_db-0.2.2.gem
  188. +461 −0 package/ruby/1.8/gems/actionmailer-3.2.1/CHANGELOG.md
  189. +21 −0 package/ruby/1.8/gems/actionmailer-3.2.1/MIT-LICENSE
  190. +163 −0 package/ruby/1.8/gems/actionmailer-3.2.1/README.rdoc
  191. +49 −0 package/ruby/1.8/gems/actionmailer-3.2.1/lib/action_mailer.rb
  192. +736 −0 package/ruby/1.8/gems/actionmailer-3.2.1/lib/action_mailer/base.rb
  193. +30 −0 package/ruby/1.8/gems/actionmailer-3.2.1/lib/action_mailer/collector.rb
  194. +86 −0 package/ruby/1.8/gems/actionmailer-3.2.1/lib/action_mailer/delivery_methods.rb
  195. +22 −0 package/ruby/1.8/gems/actionmailer-3.2.1/lib/action_mailer/log_subscriber.rb
  196. +56 −0 package/ruby/1.8/gems/actionmailer-3.2.1/lib/action_mailer/mail_helper.rb
  197. +44 −0 package/ruby/1.8/gems/actionmailer-3.2.1/lib/action_mailer/railtie.rb
  198. +82 −0 package/ruby/1.8/gems/actionmailer-3.2.1/lib/action_mailer/test_case.rb
  199. +61 −0 package/ruby/1.8/gems/actionmailer-3.2.1/lib/action_mailer/test_helper.rb
  200. +10 −0 package/ruby/1.8/gems/actionmailer-3.2.1/lib/action_mailer/version.rb
  201. +18 −0 package/ruby/1.8/gems/actionmailer-3.2.1/lib/rails/generators/mailer/USAGE
  202. +16 −0 package/ruby/1.8/gems/actionmailer-3.2.1/lib/rails/generators/mailer/mailer_generator.rb
  203. +18 −0 package/ruby/1.8/gems/actionmailer-3.2.1/lib/rails/generators/mailer/templates/mailer.rb
  204. +5,835 −0 package/ruby/1.8/gems/actionpack-3.2.1/CHANGELOG.md
  205. +21 −0 package/ruby/1.8/gems/actionpack-3.2.1/MIT-LICENSE
  206. +341 −0 package/ruby/1.8/gems/actionpack-3.2.1/README.rdoc
  207. +28 −0 package/ruby/1.8/gems/actionpack-3.2.1/lib/abstract_controller.rb
  208. +10 −0 package/ruby/1.8/gems/actionpack-3.2.1/lib/abstract_controller/asset_paths.rb
  209. +213 −0 package/ruby/1.8/gems/actionpack-3.2.1/lib/abstract_controller/base.rb
  210. +198 −0 package/ruby/1.8/gems/actionpack-3.2.1/lib/abstract_controller/callbacks.rb
  211. +32 −0 package/ruby/1.8/gems/actionpack-3.2.1/lib/abstract_controller/collector.rb
  212. +167 −0 package/ruby/1.8/gems/actionpack-3.2.1/lib/abstract_controller/helpers.rb
  213. +424 −0 package/ruby/1.8/gems/actionpack-3.2.1/lib/abstract_controller/layouts.rb
  214. +13 −0 package/ruby/1.8/gems/actionpack-3.2.1/lib/abstract_controller/logger.rb
  215. +18 −0 package/ruby/1.8/gems/actionpack-3.2.1/lib/abstract_controller/railties/routes_helpers.rb
  216. +178 −0 package/ruby/1.8/gems/actionpack-3.2.1/lib/abstract_controller/rendering.rb
  217. +13 −0 package/ruby/1.8/gems/actionpack-3.2.1/lib/abstract_controller/translation.rb
  218. +33 −0 package/ruby/1.8/gems/actionpack-3.2.1/lib/abstract_controller/url_for.rb
  219. +96 −0 package/ruby/1.8/gems/actionpack-3.2.1/lib/abstract_controller/view_paths.rb
  220. +65 −0 package/ruby/1.8/gems/actionpack-3.2.1/lib/action_controller.rb
  221. +236 −0 package/ruby/1.8/gems/actionpack-3.2.1/lib/action_controller/base.rb
  222. +83 −0 package/ruby/1.8/gems/actionpack-3.2.1/lib/action_controller/caching.rb
  223. +183 −0 package/ruby/1.8/gems/actionpack-3.2.1/lib/action_controller/caching/actions.rb
  224. +127 −0 package/ruby/1.8/gems/actionpack-3.2.1/lib/action_controller/caching/fragments.rb
  225. +187 −0 package/ruby/1.8/gems/actionpack-3.2.1/lib/action_controller/caching/pages.rb
  226. +97 −0 package/ruby/1.8/gems/actionpack-3.2.1/lib/action_controller/caching/sweeping.rb
  227. +3 −0 package/ruby/1.8/gems/actionpack-3.2.1/lib/action_controller/deprecated.rb
  228. +2 −0 package/ruby/1.8/gems/actionpack-3.2.1/lib/action_controller/deprecated/integration_test.rb
  229. +1 −0 package/ruby/1.8/gems/actionpack-3.2.1/lib/action_controller/deprecated/performance_test.rb
  230. +66 −0 package/ruby/1.8/gems/actionpack-3.2.1/lib/action_controller/log_subscriber.rb
  231. +250 −0 package/ruby/1.8/gems/actionpack-3.2.1/lib/action_controller/metal.rb
  232. +64 −0 package/ruby/1.8/gems/actionpack-3.2.1/lib/action_controller/metal/compatibility.rb
  233. +131 −0 package/ruby/1.8/gems/actionpack-3.2.1/lib/action_controller/metal/conditional_get.rb
  234. +16 −0 package/ruby/1.8/gems/actionpack-3.2.1/lib/action_controller/metal/cookies.rb
  235. +157 −0 package/ruby/1.8/gems/actionpack-3.2.1/lib/action_controller/metal/data_streaming.rb
  236. +46 −0 package/ruby/1.8/gems/actionpack-3.2.1/lib/action_controller/metal/exceptions.rb
  237. +28 −0 package/ruby/1.8/gems/actionpack-3.2.1/lib/action_controller/metal/flash.rb
  238. +38 −0 package/ruby/1.8/gems/actionpack-3.2.1/lib/action_controller/metal/force_ssl.rb
  239. +34 −0 package/ruby/1.8/gems/actionpack-3.2.1/lib/action_controller/metal/head.rb
  240. +113 −0 package/ruby/1.8/gems/actionpack-3.2.1/lib/action_controller/metal/helpers.rb
  241. +47 −0 package/ruby/1.8/gems/actionpack-3.2.1/lib/action_controller/metal/hide_actions.rb
  242. +466 −0 package/ruby/1.8/gems/actionpack-3.2.1/lib/action_controller/metal/http_authentication.rb
  243. +19 −0 package/ruby/1.8/gems/actionpack-3.2.1/lib/action_controller/metal/implicit_render.rb
  244. +105 −0 package/ruby/1.8/gems/actionpack-3.2.1/lib/action_controller/metal/instrumentation.rb
  245. +310 −0 package/ruby/1.8/gems/actionpack-3.2.1/lib/action_controller/metal/mime_responds.rb
  246. +238 −0 package/ruby/1.8/gems/actionpack-3.2.1/lib/action_controller/metal/params_wrapper.rb
  247. +26 −0 package/ruby/1.8/gems/actionpack-3.2.1/lib/action_controller/metal/rack_delegation.rb
  248. +99 −0 package/ruby/1.8/gems/actionpack-3.2.1/lib/action_controller/metal/redirecting.rb
  249. +109 −0 package/ruby/1.8/gems/actionpack-3.2.1/lib/action_controller/metal/renderers.rb
  250. +65 −0 package/ruby/1.8/gems/actionpack-3.2.1/lib/action_controller/metal/rendering.rb
  251. +113 −0 package/ruby/1.8/gems/actionpack-3.2.1/lib/action_controller/metal/request_forgery_protection.rb
Sorry, we could not display the entire diff because too many files (9,930) changed.
BIN .DS_Store
Binary file not shown.
15 .gitignore
@@ -0,0 +1,15 @@
+# See http://help.github.com/ignore-files/ for more about ignoring files.
+#
+# If you find yourself ignoring temporary files generated by your text editor
+# or operating system, you probably want to add a global ignore instead:
+# git config --global core.excludesfile ~/.gitignore_global
+
+# Ignore bundler config
+/.bundle
+
+# Ignore the default SQLite database.
+/db/*.sqlite3
+
+# Ignore all logfiles and tempfiles.
+/log/*.log
+/tmp
41 Gemfile
@@ -0,0 +1,41 @@
+source 'https://rubygems.org'
+
+gem 'rails', '3.2.1'
+
+# Bundle edge Rails instead:
+# gem 'rails', :git => 'git://github.com/rails/rails.git'
+
+gem 'sqlite3'
+
+gem 'json'
+
+# Gems used only for assets and not required
+# in production environments by default.
+group :assets do
+ gem 'sass-rails', '~> 3.2.3'
+ gem 'coffee-rails', '~> 3.2.1'
+ gem 'twitter-bootstrap-rails'
+ gem 'uglifier', '>= 1.0.3'
+end
+
+gem 'jquery-rails'
+
+#backbone
+gem 'backbone-rails'
+
+# To use ActiveModel has_secure_password
+gem 'bcrypt-ruby', '~> 3.0.0'
+
+# To use Jbuilder templates for JSON
+# gem 'jbuilder'
+
+# Use unicorn as the web server
+# gem 'unicorn'
+
+# Deploy with Capistrano
+# gem 'capistrano'
+
+# To use debugger
+# gem 'ruby-debug'
+gem 'yaml_db'
+gem "nested_form"
137 Gemfile.lock
@@ -0,0 +1,137 @@
+GEM
+ remote: https://rubygems.org/
+ specs:
+ actionmailer (3.2.1)
+ actionpack (= 3.2.1)
+ mail (~> 2.4.0)
+ actionpack (3.2.1)
+ activemodel (= 3.2.1)
+ activesupport (= 3.2.1)
+ builder (~> 3.0.0)
+ erubis (~> 2.7.0)
+ journey (~> 1.0.1)
+ rack (~> 1.4.0)
+ rack-cache (~> 1.1)
+ rack-test (~> 0.6.1)
+ sprockets (~> 2.1.2)
+ activemodel (3.2.1)
+ activesupport (= 3.2.1)
+ builder (~> 3.0.0)
+ activerecord (3.2.1)
+ activemodel (= 3.2.1)
+ activesupport (= 3.2.1)
+ arel (~> 3.0.0)
+ tzinfo (~> 0.3.29)
+ activeresource (3.2.1)
+ activemodel (= 3.2.1)
+ activesupport (= 3.2.1)
+ activesupport (3.2.1)
+ i18n (~> 0.6)
+ multi_json (~> 1.0)
+ arel (3.0.2)
+ backbone-rails (0.9.0)
+ rails (>= 3.0.0)
+ bcrypt-ruby (3.0.1)
+ builder (3.0.0)
+ coffee-rails (3.2.2)
+ coffee-script (>= 2.2.0)
+ railties (~> 3.2.0)
+ coffee-script (2.2.0)
+ coffee-script-source
+ execjs
+ coffee-script-source (1.2.0)
+ commonjs (0.2.0)
+ therubyracer (~> 0.9.9)
+ erubis (2.7.0)
+ execjs (1.3.0)
+ multi_json (~> 1.0)
+ hike (1.2.1)
+ i18n (0.6.0)
+ journey (1.0.3)
+ jquery-rails (2.0.1)
+ railties (>= 3.2.0, < 5.0)
+ thor (~> 0.14)
+ json (1.6.5)
+ less (2.0.9)
+ commonjs (~> 0.2.0)
+ therubyracer (~> 0.9.9)
+ less-rails (2.1.6)
+ actionpack (>= 3.1)
+ less (~> 2.0.7)
+ libv8 (3.3.10.4)
+ mail (2.4.1)
+ i18n (>= 0.4.0)
+ mime-types (~> 1.16)
+ treetop (~> 1.4.8)
+ mime-types (1.17.2)
+ multi_json (1.1.0)
+ nested_form (0.2.0)
+ polyglot (0.3.3)
+ rack (1.4.1)
+ rack-cache (1.1)
+ rack (>= 0.4)
+ rack-ssl (1.3.2)
+ rack
+ rack-test (0.6.1)
+ rack (>= 1.0)
+ rails (3.2.1)
+ actionmailer (= 3.2.1)
+ actionpack (= 3.2.1)
+ activerecord (= 3.2.1)
+ activeresource (= 3.2.1)
+ activesupport (= 3.2.1)
+ bundler (~> 1.0)
+ railties (= 3.2.1)
+ railties (3.2.1)
+ actionpack (= 3.2.1)
+ activesupport (= 3.2.1)
+ rack-ssl (~> 1.3.2)
+ rake (>= 0.8.7)
+ rdoc (~> 3.4)
+ thor (~> 0.14.6)
+ rake (0.9.2.2)
+ rdoc (3.12)
+ json (~> 1.4)
+ sass (3.1.15)
+ sass-rails (3.2.4)
+ railties (~> 3.2.0)
+ sass (>= 3.1.10)
+ tilt (~> 1.3)
+ sprockets (2.1.2)
+ hike (~> 1.2)
+ rack (~> 1.0)
+ tilt (~> 1.1, != 1.3.0)
+ sqlite3 (1.3.5)
+ therubyracer (0.9.10)
+ libv8 (~> 3.3.10)
+ thor (0.14.6)
+ tilt (1.3.3)
+ treetop (1.4.10)
+ polyglot
+ polyglot (>= 0.3.1)
+ twitter-bootstrap-rails (2.0.3)
+ actionpack (>= 3.1)
+ less-rails (~> 2.1.6)
+ railties (>= 3.1)
+ tzinfo (0.3.31)
+ uglifier (1.2.3)
+ execjs (>= 0.3.0)
+ multi_json (>= 1.0.2)
+ yaml_db (0.2.2)
+
+PLATFORMS
+ ruby
+
+DEPENDENCIES
+ backbone-rails
+ bcrypt-ruby (~> 3.0.0)
+ coffee-rails (~> 3.2.1)
+ jquery-rails
+ json
+ nested_form
+ rails (= 3.2.1)
+ sass-rails (~> 3.2.3)
+ sqlite3
+ twitter-bootstrap-rails
+ uglifier (>= 1.0.3)
+ yaml_db
261 README.rdoc
@@ -0,0 +1,261 @@
+== Welcome to Rails
+
+Rails is a web-application framework that includes everything needed to create
+database-backed web applications according to the Model-View-Control pattern.
+
+This pattern splits the view (also called the presentation) into "dumb"
+templates that are primarily responsible for inserting pre-built data in between
+HTML tags. The model contains the "smart" domain objects (such as Account,
+Product, Person, Post) that holds all the business logic and knows how to
+persist themselves to a database. The controller handles the incoming requests
+(such as Save New Account, Update Product, Show Post) by manipulating the model
+and directing data to the view.
+
+In Rails, the model is handled by what's called an object-relational mapping
+layer entitled Active Record. This layer allows you to present the data from
+database rows as objects and embellish these data objects with business logic
+methods. You can read more about Active Record in
+link:files/vendor/rails/activerecord/README.html.
+
+The controller and view are handled by the Action Pack, which handles both
+layers by its two parts: Action View and Action Controller. These two layers
+are bundled in a single package due to their heavy interdependence. This is
+unlike the relationship between the Active Record and Action Pack that is much
+more separate. Each of these packages can be used independently outside of
+Rails. You can read more about Action Pack in
+link:files/vendor/rails/actionpack/README.html.
+
+
+== Getting Started
+
+1. At the command prompt, create a new Rails application:
+ <tt>rails new myapp</tt> (where <tt>myapp</tt> is the application name)
+
+2. Change directory to <tt>myapp</tt> and start the web server:
+ <tt>cd myapp; rails server</tt> (run with --help for options)
+
+3. Go to http://localhost:3000/ and you'll see:
+ "Welcome aboard: You're riding Ruby on Rails!"
+
+4. Follow the guidelines to start developing your application. You can find
+the following resources handy:
+
+* The Getting Started Guide: http://guides.rubyonrails.org/getting_started.html
+* Ruby on Rails Tutorial Book: http://www.railstutorial.org/
+
+
+== Debugging Rails
+
+Sometimes your application goes wrong. Fortunately there are a lot of tools that
+will help you debug it and get it back on the rails.
+
+First area to check is the application log files. Have "tail -f" commands
+running on the server.log and development.log. Rails will automatically display
+debugging and runtime information to these files. Debugging info will also be
+shown in the browser on requests from 127.0.0.1.
+
+You can also log your own messages directly into the log file from your code
+using the Ruby logger class from inside your controllers. Example:
+
+ class WeblogController < ActionController::Base
+ def destroy
+ @weblog = Weblog.find(params[:id])
+ @weblog.destroy
+ logger.info("#{Time.now} Destroyed Weblog ID ##{@weblog.id}!")
+ end
+ end
+
+The result will be a message in your log file along the lines of:
+
+ Mon Oct 08 14:22:29 +1000 2007 Destroyed Weblog ID #1!
+
+More information on how to use the logger is at http://www.ruby-doc.org/core/
+
+Also, Ruby documentation can be found at http://www.ruby-lang.org/. There are
+several books available online as well:
+
+* Programming Ruby: http://www.ruby-doc.org/docs/ProgrammingRuby/ (Pickaxe)
+* Learn to Program: http://pine.fm/LearnToProgram/ (a beginners guide)
+
+These two books will bring you up to speed on the Ruby language and also on
+programming in general.
+
+
+== Debugger
+
+Debugger support is available through the debugger command when you start your
+Mongrel or WEBrick server with --debugger. This means that you can break out of
+execution at any point in the code, investigate and change the model, and then,
+resume execution! You need to install ruby-debug to run the server in debugging
+mode. With gems, use <tt>sudo gem install ruby-debug</tt>. Example:
+
+ class WeblogController < ActionController::Base
+ def index
+ @posts = Post.all
+ debugger
+ end
+ end
+
+So the controller will accept the action, run the first line, then present you
+with a IRB prompt in the server window. Here you can do things like:
+
+ >> @posts.inspect
+ => "[#<Post:0x14a6be8
+ @attributes={"title"=>nil, "body"=>nil, "id"=>"1"}>,
+ #<Post:0x14a6620
+ @attributes={"title"=>"Rails", "body"=>"Only ten..", "id"=>"2"}>]"
+ >> @posts.first.title = "hello from a debugger"
+ => "hello from a debugger"
+
+...and even better, you can examine how your runtime objects actually work:
+
+ >> f = @posts.first
+ => #<Post:0x13630c4 @attributes={"title"=>nil, "body"=>nil, "id"=>"1"}>
+ >> f.
+ Display all 152 possibilities? (y or n)
+
+Finally, when you're ready to resume execution, you can enter "cont".
+
+
+== Console
+
+The console is a Ruby shell, which allows you to interact with your
+application's domain model. Here you'll have all parts of the application
+configured, just like it is when the application is running. You can inspect
+domain models, change values, and save to the database. Starting the script
+without arguments will launch it in the development environment.
+
+To start the console, run <tt>rails console</tt> from the application
+directory.
+
+Options:
+
+* Passing the <tt>-s, --sandbox</tt> argument will rollback any modifications
+ made to the database.
+* Passing an environment name as an argument will load the corresponding
+ environment. Example: <tt>rails console production</tt>.
+
+To reload your controllers and models after launching the console run
+<tt>reload!</tt>
+
+More information about irb can be found at:
+link:http://www.rubycentral.org/pickaxe/irb.html
+
+
+== dbconsole
+
+You can go to the command line of your database directly through <tt>rails
+dbconsole</tt>. You would be connected to the database with the credentials
+defined in database.yml. Starting the script without arguments will connect you
+to the development database. Passing an argument will connect you to a different
+database, like <tt>rails dbconsole production</tt>. Currently works for MySQL,
+PostgreSQL and SQLite 3.
+
+== Description of Contents
+
+The default directory structure of a generated Ruby on Rails application:
+
+ |-- app
+ | |-- assets
+ | |-- images
+ | |-- javascripts
+ | `-- stylesheets
+ | |-- controllers
+ | |-- helpers
+ | |-- mailers
+ | |-- models
+ | `-- views
+ | `-- layouts
+ |-- config
+ | |-- environments
+ | |-- initializers
+ | `-- locales
+ |-- db
+ |-- doc
+ |-- lib
+ | `-- tasks
+ |-- log
+ |-- public
+ |-- script
+ |-- test
+ | |-- fixtures
+ | |-- functional
+ | |-- integration
+ | |-- performance
+ | `-- unit
+ |-- tmp
+ | |-- cache
+ | |-- pids
+ | |-- sessions
+ | `-- sockets
+ `-- vendor
+ |-- assets
+ `-- stylesheets
+ `-- plugins
+
+app
+ Holds all the code that's specific to this particular application.
+
+app/assets
+ Contains subdirectories for images, stylesheets, and JavaScript files.
+
+app/controllers
+ Holds controllers that should be named like weblogs_controller.rb for
+ automated URL mapping. All controllers should descend from
+ ApplicationController which itself descends from ActionController::Base.
+
+app/models
+ Holds models that should be named like post.rb. Models descend from
+ ActiveRecord::Base by default.
+
+app/views
+ Holds the template files for the view that should be named like
+ weblogs/index.html.erb for the WeblogsController#index action. All views use
+ eRuby syntax by default.
+
+app/views/layouts
+ Holds the template files for layouts to be used with views. This models the
+ common header/footer method of wrapping views. In your views, define a layout
+ using the <tt>layout :default</tt> and create a file named default.html.erb.
+ Inside default.html.erb, call <% yield %> to render the view using this
+ layout.
+
+app/helpers
+ Holds view helpers that should be named like weblogs_helper.rb. These are
+ generated for you automatically when using generators for controllers.
+ Helpers can be used to wrap functionality for your views into methods.
+
+config
+ Configuration files for the Rails environment, the routing map, the database,
+ and other dependencies.
+
+db
+ Contains the database schema in schema.rb. db/migrate contains all the
+ sequence of Migrations for your schema.
+
+doc
+ This directory is where your application documentation will be stored when
+ generated using <tt>rake doc:app</tt>
+
+lib
+ Application specific libraries. Basically, any kind of custom code that
+ doesn't belong under controllers, models, or helpers. This directory is in
+ the load path.
+
+public
+ The directory available for the web server. Also contains the dispatchers and the
+ default HTML files. This should be set as the DOCUMENT_ROOT of your web
+ server.
+
+script
+ Helper scripts for automation and generation.
+
+test
+ Unit and functional tests along with fixtures. When using the rails generate
+ command, template test files will be generated for you and placed in this
+ directory.
+
+vendor
+ External libraries that the application depends on. Also includes the plugins
+ subdirectory. If the app has frozen rails, those gems also go here, under
+ vendor/rails/. This directory is in the load path.
7 Rakefile
@@ -0,0 +1,7 @@
+#!/usr/bin/env rake
+# 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.expand_path('../config/application', __FILE__)
+
+GradeServer::Application.load_tasks
BIN app/assets/images/rails.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
22 app/assets/javascripts/application.js
@@ -0,0 +1,22 @@
+// This is a manifest file that'll be compiled into application.js, which will include all the files
+// listed below.
+//
+// Any JavaScript/Coffee file within this directory, lib/assets/javascripts, vendor/assets/javascripts,
+// or vendor/assets/javascripts of plugins, if any, can be referenced here using a relative path.
+//
+// It's not advisable to add code directly here, but if you do, it'll appear at the bottom of the
+// the compiled file.
+//
+// WARNING: THE FIRST BLANK LINE MARKS THE END OF WHAT'S TO BE PROCESSED, ANY BLANK LINE SHOULD
+// GO AFTER THE REQUIRES BELOW.
+//
+//= require jquery
+//= require jquery_ujs
+//= require twitter/bootstrap
+//= require_tree .
+
+function add_fields(link, association, content) {
+      var new_id = new Date().getTime();
+      var regexp = new RegExp("new_" + association, "g")
+      $(link).parent().before(content.replace(regexp, new_id));
+}
4 app/assets/javascripts/bootstrap.js.coffee
@@ -0,0 +1,4 @@
+jQuery ->
+ $("a[rel=popover]").popover()
+ $(".tooltip").tooltip()
+ $("a[rel=tooltip]").tooltip()
3 app/assets/javascripts/courses.js.coffee
@@ -0,0 +1,3 @@
+# Place all the behaviors and hooks related to the matching controller here.
+# All this logic will automatically be available in application.js.
+# You can use CoffeeScript in this file: http://jashkenas.github.com/coffee-script/
3 app/assets/javascripts/distributions.js.coffee
@@ -0,0 +1,3 @@
+# Place all the behaviors and hooks related to the matching controller here.
+# All this logic will automatically be available in application.js.
+# You can use CoffeeScript in this file: http://jashkenas.github.com/coffee-script/
3 app/assets/javascripts/home.js.coffee
@@ -0,0 +1,3 @@
+# Place all the behaviors and hooks related to the matching controller here.
+# All this logic will automatically be available in application.js.
+# You can use CoffeeScript in this file: http://jashkenas.github.com/coffee-script/
3 app/assets/javascripts/schedules.js.coffee
@@ -0,0 +1,3 @@
+# Place all the behaviors and hooks related to the matching controller here.
+# All this logic will automatically be available in application.js.
+# You can use CoffeeScript in this file: http://jashkenas.github.com/coffee-script/
3 app/assets/javascripts/sessions.js.coffee
@@ -0,0 +1,3 @@
+# Place all the behaviors and hooks related to the matching controller here.
+# All this logic will automatically be available in application.js.
+# You can use CoffeeScript in this file: http://jashkenas.github.com/coffee-script/
3 app/assets/javascripts/students.js.coffee
@@ -0,0 +1,3 @@
+# Place all the behaviors and hooks related to the matching controller here.
+# All this logic will automatically be available in application.js.
+# You can use CoffeeScript in this file: http://jashkenas.github.com/coffee-script/
3 app/assets/javascripts/users.js.coffee
@@ -0,0 +1,3 @@
+# Place all the behaviors and hooks related to the matching controller here.
+# All this logic will automatically be available in application.js.
+# You can use CoffeeScript in this file: http://jashkenas.github.com/coffee-script/
16 app/assets/stylesheets/application.css
@@ -0,0 +1,16 @@
+/*
+ * This is a manifest file that'll be compiled into application.css, which will include all the files
+ * listed below.
+ *
+ * Any CSS and SCSS file within this directory, lib/assets/stylesheets, vendor/assets/stylesheets,
+ * or vendor/assets/stylesheets of plugins, if any, can be referenced here using a relative path.
+ *
+ * You're free to add application-wide styles to this file and they'll appear at the top of the
+ * compiled file, but it's generally better to create a new file per style scope.
+ *
+ *= require_self
+ *= require_tree .
+*/
+
+/* compensate the overlap caused by bootstrap top navigation, min. 40px at the top! */
+body { padding: 60px 10px 10px 10px; }
17 app/assets/stylesheets/bootstrap_and_overrides.css.less
@@ -0,0 +1,17 @@
+@import "twitter/bootstrap/bootstrap";
+@import "twitter/bootstrap/responsive";
+
+// Set the correct sprite paths
+@iconSpritePath: asset-path('twitter/bootstrap/glyphicons-halflings.png');
+@iconWhiteSpritePath: asset-path('twitter/bootstrap/glyphicons-halflings-white.png');
+
+// Your custom LESS stylesheets goes here
+//
+// Since bootstrap was imported above you have access to its mixins which
+// you may use and inherit here
+//
+// If you'd like to override bootstrap's own variables, you can do so here as well
+// See http://twitter.github.com/bootstrap/less.html for their names and documentation
+//
+// Example:
+// @linkColor: #ff0000;
3 app/assets/stylesheets/courses.css.scss
@@ -0,0 +1,3 @@
+// Place all the styles related to the Courses controller here.
+// They will automatically be included in application.css.
+// You can use Sass (SCSS) here: http://sass-lang.com/
3 app/assets/stylesheets/distributions.css.scss
@@ -0,0 +1,3 @@
+// Place all the styles related to the Distributions controller here.
+// They will automatically be included in application.css.
+// You can use Sass (SCSS) here: http://sass-lang.com/
3 app/assets/stylesheets/home.css.scss
@@ -0,0 +1,3 @@
+// Place all the styles related to the home controller here.
+// They will automatically be included in application.css.
+// You can use Sass (SCSS) here: http://sass-lang.com/
56 app/assets/stylesheets/scaffolds.css.scss
@@ -0,0 +1,56 @@
+body {
+ background-color: #fff;
+ color: #333;
+ font-family: verdana, arial, helvetica, sans-serif;
+ font-size: 13px;
+ line-height: 18px; }
+
+p, ol, ul, td {
+ font-family: verdana, arial, helvetica, sans-serif;
+ font-size: 13px;
+ line-height: 18px; }
+
+pre {
+ background-color: #eee;
+ padding: 10px;
+ font-size: 11px; }
+
+a {
+ color: #000;
+ &:visited {
+ color: #666; }
+ &:hover {
+ color: #fff;
+ background-color: #000; } }
+
+div {
+ &.field, &.actions {
+ margin-bottom: 10px; } }
+
+#notice {
+ color: green; }
+
+.field_with_errors {
+ padding: 2px;
+ background-color: red;
+ display: table; }
+
+#error_explanation {
+ width: 450px;
+ border: 2px solid red;
+ padding: 7px;
+ padding-bottom: 0;
+ margin-bottom: 20px;
+ background-color: #f0f0f0;
+ h2 {
+ text-align: left;
+ font-weight: bold;
+ padding: 5px 5px 5px 15px;
+ font-size: 12px;
+ margin: -7px;
+ margin-bottom: 0px;
+ background-color: #c00;
+ color: #fff; }
+ ul li {
+ font-size: 12px;
+ list-style: square; } }
3 app/assets/stylesheets/schedules.css.scss
@@ -0,0 +1,3 @@
+// Place all the styles related to the Schedules controller here.
+// They will automatically be included in application.css.
+// You can use Sass (SCSS) here: http://sass-lang.com/
3 app/assets/stylesheets/sessions.css.scss
@@ -0,0 +1,3 @@
+// Place all the styles related to the sessions controller here.
+// They will automatically be included in application.css.
+// You can use Sass (SCSS) here: http://sass-lang.com/
3 app/assets/stylesheets/students.css.scss
@@ -0,0 +1,3 @@
+// Place all the styles related to the students controller here.
+// They will automatically be included in application.css.
+// You can use Sass (SCSS) here: http://sass-lang.com/
3 app/assets/stylesheets/users.css.scss
@@ -0,0 +1,3 @@
+// Place all the styles related to the users controller here.
+// They will automatically be included in application.css.
+// You can use Sass (SCSS) here: http://sass-lang.com/
17 app/controllers/application_controller.rb
@@ -0,0 +1,17 @@
+class ApplicationController < ActionController::Base
+
+ protect_from_forgery
+
+private
+
+ def current_user
+ @current_user ||= User.find(session[:user_id]) if session[:user_id]
+ end
+
+ helper_method :current_user
+
+ def authorize
+ redirect_to login_url, alert: "Not authorized" if current_user.nil?
+ end
+
+end
87 app/controllers/courses_controller.rb
@@ -0,0 +1,87 @@
+class CoursesController < ApplicationController
+ # GET /courses
+ # GET /courses.json
+
+ before_filter :authorize
+
+ def index
+ @courses = Course.all
+
+ respond_to do |format|
+ format.html # index.html.erb
+ format.json { render :json => @courses }
+ end
+ end
+
+ # GET /courses/1
+ # GET /courses/1.json
+ def show
+ @course = Course.find(params[:id])
+
+ respond_to do |format|
+ format.html # show.html.erb
+ format.json { render :json => @course }
+ end
+ end
+
+ # GET /courses/new
+ # GET /courses/new.json
+ def new
+ @course = Course.new
+
+
+ respond_to do |format|
+ format.html # new.html.erb
+ format.json { render :json => @course }
+ end
+ end
+
+ # GET /courses/1/edit
+ def edit
+ @course = Course.find(params[:id])
+ end
+
+ # POST /courses
+ # POST /courses.json
+ def create
+ @course = Course.new(params[:course])
+
+ respond_to do |format|
+ if @course.save
+ format.html { redirect_to @course, :notice => 'Course was successfully created.' }
+ format.json { render :json => @course, :status => :created, :location => @course }
+ else
+ format.html { render :action => "new" }
+ format.json { render :json => @course.errors, :status => :unprocessable_entity }
+ end
+ end
+ end
+
+ # PUT /courses/1
+ # PUT /courses/1.json
+ def update
+ @course = Course.find(params[:id])
+
+ respond_to do |format|
+ if @course.update_attributes(params[:course])
+ format.html { redirect_to @course, :notice => 'Course was successfully updated.' }
+ format.json { head :no_content }
+ else
+ format.html { render :action => "edit" }
+ format.json { render :json => @course.errors, :status => :unprocessable_entity }
+ end
+ end
+ end
+
+ # DELETE /courses/1
+ # DELETE /courses/1.json
+ def destroy
+ @course = Course.find(params[:id])
+ @course.destroy
+
+ respond_to do |format|
+ format.html { redirect_to courses_url }
+ format.json { head :no_content }
+ end
+ end
+end
83 app/controllers/distributions_controller.rb
@@ -0,0 +1,83 @@
+class DistributionsController < ApplicationController
+ # GET /distributions
+ # GET /distributions.json
+ def index
+ @distributions = Distribution.all
+
+ respond_to do |format|
+ format.html # index.html.erb
+ format.json { render json: @distributions }
+ end
+ end
+
+ # GET /distributions/1
+ # GET /distributions/1.json
+ def show
+ @distribution = Distribution.find(params[:id])
+
+ respond_to do |format|
+ format.html # show.html.erb
+ format.json { render json: @distribution }
+ end
+ end
+
+ # GET /distributions/new
+ # GET /distributions/new.json
+ def new
+ @distribution = Distribution.new
+
+ respond_to do |format|
+ format.html # new.html.erb
+ format.json { render json: @distribution }
+ end
+ end
+
+ # GET /distributions/1/edit
+ def edit
+ @distribution = Distribution.find(params[:id])
+ end
+
+ # POST /distributions
+ # POST /distributions.json
+ def create
+ @distribution = Distribution.new(params[:distribution])
+
+ respond_to do |format|
+ if @distribution.save
+ format.html { redirect_to @distribution, notice: 'Distribution was successfully created.' }
+ format.json { render json: @distribution, status: :created, location: @distribution }
+ else
+ format.html { render action: "new" }
+ format.json { render json: @distribution.errors, status: :unprocessable_entity }
+ end
+ end
+ end
+
+ # PUT /distributions/1
+ # PUT /distributions/1.json
+ def update
+ @distribution = Distribution.find(params[:id])
+
+ respond_to do |format|
+ if @distribution.update_attributes(params[:distribution])
+ format.html { redirect_to @distribution, notice: 'Distribution was successfully updated.' }
+ format.json { head :no_content }
+ else
+ format.html { render action: "edit" }
+ format.json { render json: @distribution.errors, status: :unprocessable_entity }
+ end
+ end
+ end
+
+ # DELETE /distributions/1
+ # DELETE /distributions/1.json
+ def destroy
+ @distribution = Distribution.find(params[:id])
+ @distribution.destroy
+
+ respond_to do |format|
+ format.html { redirect_to distributions_url }
+ format.json { head :no_content }
+ end
+ end
+end
7 app/controllers/home_controller.rb
@@ -0,0 +1,7 @@
+class HomeController < ApplicationController
+ before_filter :authorize
+
+ def index
+
+ end
+end
84 app/controllers/schedules_controller.rb
@@ -0,0 +1,84 @@
+class SchedulesController < ApplicationController
+ # GET /schedules
+ # GET /schedules.json
+ before_filter :authorize
+ def index
+ @schedules = Schedule.all
+
+ respond_to do |format|
+ format.html # index.html.erb
+ format.json { render :json => @schedules }
+ end
+ end
+
+ # GET /schedules/1
+ # GET /schedules/1.json
+ def show
+ @schedule = Schedule.find(params[:id])
+
+ respond_to do |format|
+ format.html # show.html.erb
+ format.json { render :json => @schedule }
+ end
+ end
+
+ # GET /schedules/new
+ # GET /schedules/new.json
+ def new
+ @schedule = Schedule.new
+
+ respond_to do |format|
+ format.html # new.html.erb
+ format.json { render :json => @schedule }
+ end
+ end
+
+ # GET /schedules/1/edit
+ def edit
+ @schedule = Schedule.find(params[:id])
+ end
+
+ # POST /schedules
+ # POST /schedules.json
+ def create
+ @schedule = Schedule.new(params[:schedule])
+
+ respond_to do |format|
+ if @schedule.save
+ format.html { redirect_to @schedule, :notice => 'Schedule was successfully created.' }
+ format.json { render :json => @schedule, :status => :created, :location => @schedule }
+ else
+ format.html { render :action => "new" }
+ format.json { render :json => @schedule.errors, :status => :unprocessable_entity }
+ end
+ end
+ end
+
+ # PUT /schedules/1
+ # PUT /schedules/1.json
+ def update
+ @schedule = Schedule.find(params[:id])
+
+ respond_to do |format|
+ if @schedule.update_attributes(params[:schedule])
+ format.html { redirect_to @schedule, :notice => 'Schedule was successfully updated.' }
+ format.json { head :no_content }
+ else
+ format.html { render :action => "edit" }
+ format.json { render :json => @schedule.errors, :status => :unprocessable_entity }
+ end
+ end
+ end
+
+ # DELETE /schedules/1
+ # DELETE /schedules/1.json
+ def destroy
+ @schedule = Schedule.find(params[:id])
+ @schedule.destroy
+
+ respond_to do |format|
+ format.html { redirect_to schedules_url }
+ format.json { head :no_content }
+ end
+ end
+end
21 app/controllers/sessions_controller.rb
@@ -0,0 +1,21 @@
+class SessionsController < ApplicationController
+
+ def new
+ end
+
+ def create
+ user = User.find_by_email(params[:email])
+ if user && user.authenticate(params[:password])
+ session[:user_id] = user.id
+ redirect_to root_url, notice: "Logged in!"
+ else
+ flash.now.alert = "Email or password is invalid"
+ render "new"
+ end
+ end
+
+ def destroy
+ session[:user_id] = nil
+ redirect_to root_url, notice: "Logged out!"
+ end
+end
84 app/controllers/students_controller.rb
@@ -0,0 +1,84 @@
+class StudentsController < ApplicationController
+ # GET /students
+ # GET /students.json
+ #before_filter :authorize
+ def index
+ @students = Student.all
+
+ respond_to do |format|
+ format.html # index.html.erb
+ format.json { render :json => @students }
+ end
+ end
+
+ # GET /students/1
+ # GET /students/1.json
+ def show
+ @student = Student.find(params[:id])
+
+ respond_to do |format|
+ format.html # show.html.erb
+ format.json { render :json => @student }
+ end
+ end
+
+ # GET /students/new
+ # GET /students/new.json
+ def new
+ @student = Student.new
+
+ respond_to do |format|
+ format.html # new.html.erb
+ format.json { render :json => @student }
+ end
+ end
+
+ # GET /students/1/edit
+ def edit
+ @student = Student.find(params[:id])
+ end
+
+ # POST /students
+ # POST /students.json
+ def create
+ @student = Student.new(params[:student])
+
+ respond_to do |format|
+ if @student.save
+ format.html { redirect_to @student, :notice => 'Student was successfully created.' }
+ format.json { render :json => @student, :status => :created, :location => @student }
+ else
+ format.html { render :action => "new" }
+ format.json { render :json => @student.errors, :status => :unprocessable_entity }
+ end
+ end
+ end
+
+ # PUT /students/1
+ # PUT /students/1.json
+ def update
+ @student = Student.find(params[:id])
+
+ respond_to do |format|
+ if @student.update_attributes(params[:student])
+ format.html { redirect_to @student, :notice => 'Student was successfully updated.' }
+ format.json { head :no_content }
+ else
+ format.html { render :action => "edit" }
+ format.json { render :json => @student.errors, :status => :unprocessable_entity }
+ end
+ end
+ end
+
+ # DELETE /students/1
+ # DELETE /students/1.json
+ def destroy
+ @student = Student.find(params[:id])
+ @student.destroy
+
+ respond_to do |format|
+ format.html { redirect_to students_url }
+ format.json { head :no_content }
+ end
+ end
+end
15 app/controllers/users_controller.rb
@@ -0,0 +1,15 @@
+class UsersController < ApplicationController
+ def new
+ @user = User.new
+ end
+
+ def create
+ @user = User.new(params[:user])
+ if @user.save
+
+ redirect_to root_url, notice => "Thank you for signing up"
+ else
+ render "new"
+ end
+ end
+end
9 app/helpers/application_helper.rb
@@ -0,0 +1,9 @@
+module ApplicationHelper
+ def link_to_add_fields(name, f, association)
+ new_object = f.object.class.reflect_on_association(association).klass.new
+ fields = f.fields_for(association, new_object, ":" + association.to_s.singularize + "_index" => "new_#{association}") do |builder|
+ render(association.to_s.singularize + "_fields", :f => builder)
+ end
+ link_to_function(name, "add_fields(this, \"#{association}\", \"#{escape_javascript(fields)}\")")
+ end
+end
2 app/helpers/courses_helper.rb
@@ -0,0 +1,2 @@
+module CoursesHelper
+end
2 app/helpers/distributions_helper.rb
@@ -0,0 +1,2 @@
+module DistributionsHelper
+end
2 app/helpers/home_helper.rb
@@ -0,0 +1,2 @@
+module HomeHelper
+end
2 app/helpers/schedules_helper.rb
@@ -0,0 +1,2 @@
+module SchedulesHelper
+end
2 app/helpers/sessions_helper.rb
@@ -0,0 +1,2 @@
+module SessionsHelper
+end
2 app/helpers/students_helper.rb
@@ -0,0 +1,2 @@
+module StudentsHelper
+end
2 app/helpers/users_helper.rb
@@ -0,0 +1,2 @@
+module UsersHelper
+end
0 app/mailers/.gitkeep
No changes.
0 app/models/.gitkeep
No changes.
12 app/models/course.rb
@@ -0,0 +1,12 @@
+class Course < ActiveRecord::Base
+ has_many :students
+ has_many :distributions
+
+ accepts_nested_attributes_for :distributions, :reject_if => lambda { |a| a[:name].blank? }, :allow_destroy => true
+ accepts_nested_attributes_for :students
+
+ validates :code, :presence => true,
+ :length => { :minimum => 7}
+ validates :desc, :presence => true
+
+end
4 app/models/distribution.rb
@@ -0,0 +1,4 @@
+class Distribution < ActiveRecord::Base
+ belongs_to :course
+
+end
5 app/models/enrollment.rb
@@ -0,0 +1,5 @@
+class User < ActiveRecord::Base
+ belongs_to :student
+ belongs_to :course
+ validates_presence_of :student_id, :course_id
+end
4 app/models/student.rb
@@ -0,0 +1,4 @@
+class Student < ActiveRecord::Base
+ has_many :courses, :through => :enrollments
+ has_many :enrollments
+end
7 app/models/user.rb
@@ -0,0 +1,7 @@
+class User < ActiveRecord::Base
+ has_secure_password
+
+ attr_accessible :email, :password, :password_confirmation
+
+ validates_uniqueness_of :email
+end
5 app/views/courses/_distribution_fields.html.erb
@@ -0,0 +1,5 @@
+
+<div class="controls">
+ <%= f.text_field :category, :class => 'text-field', :placeholder => "distribution"%>
+ <%= f.number_field :percent, :class => 'text-fied', :placeholder => "percent" %>
+</div>
48 app/views/courses/_form.html.erb
@@ -0,0 +1,48 @@
+<%= nested_form_for @course, :html => { :class => 'form-horizontal' } do |f| %>
+ <fieldset>
+ <legend><%= controller.action_name.capitalize %> Course</legend>
+
+ <div class="control-group">
+ <%= f.label :code, :class => 'control-label' %>
+ <div class="controls">
+ <%= f.text_field :code, :class => 'text_field' %>
+ </div>
+ </div>
+
+ <div class="control-group">
+ <%= f.label :desc, :class => 'control-label' %>
+ <div class="controls">
+ <%= f.text_field :desc, :class => 'text_field' %>
+ </div>
+ </div>
+
+ <div class="control-group">
+ <%= f.label :school_year, :class => 'control-label' %>
+ <div class="controls">
+ <%= f.text_field :school_year, :class => 'text_field' %>
+ </div>
+ </div>
+
+ <div class="control-group">
+ <%= f.label :period, :class => 'control-label' %>
+ <div class="controls">
+ <%= f.text_field :period, :class => 'text_field' %>
+ </div>
+ </div>
+
+ <legend>Set Course Distributions </legend>
+ <p class="control-label"><%= link_to_add_fields "Add Distribution", f, :distributions %></p>
+ <div class="control-group">
+ <%f.fields_for :distributions, do |builder| %>
+ <%= render 'distribution_fields', :f => builder %>
+ <%end%>
+ </div>
+
+
+
+ <div class="form-actions">
+ <%= f.submit nil, :class => 'btn btn-primary' %>
+ <%= link_to 'Cancel', courses_path, :class => 'btn' %>
+ </div>
+ </fieldset>
+<% end %>
1 app/views/courses/edit.html.erb
@@ -0,0 +1 @@
+<%= render :partial => 'form' %>
26 app/views/courses/index.html.erb
@@ -0,0 +1,26 @@
+<h1>Courses</h1>
+<table class="table table-striped">
+ <thead>
+ <tr>
+ <th>ID</th>
+ <th>Code</th>
+ <th>Created at</th>
+ <th>Actions</th>
+ </tr>
+ </thead>
+ <tbody>
+ <% @courses.each do |course| %>
+ <tr>
+ <td><%= course.id %></td>
+ <td><%= link_to course.code, course_path(course) %></td>
+ <td><%= course.created_at %></td>
+ <td>
+ <%= link_to 'Edit', edit_course_path(course), :class => 'btn btn-mini' %>
+ <%= link_to 'Destroy', course_path(course), :method => :delete, :confirm => 'Are you sure?', :class => 'btn btn-mini btn-danger' %>
+ </td>
+ </tr>
+ <% end %>
+ </tbody>
+</table>
+
+<%= link_to 'New', new_course_path, :class => 'btn btn-primary' %>
3 app/views/courses/new.html.erb
@@ -0,0 +1,3 @@
+
+<%= render :partial => 'form' %>
+
27 app/views/courses/show.html.erb
@@ -0,0 +1,27 @@
+<h1>Course</h1>
+
+<p>
+ <b>Code</b><br>
+ <%= @course.code %>
+</p>
+
+<p>
+ <b>Desc</b><br>
+ <%= @course.desc %>
+</p>
+
+<p>
+ <b>School year</b><br>
+ <%= @course.school_year %>
+</p>
+
+<p>
+ <b>Period</b><br>
+ <%= @course.period %>
+</p>
+
+<div class="form-actions">
+ <%= link_to 'Back', courses_path, :class => 'btn' %>
+ <%= link_to 'Edit', edit_course_path(@course), :class => 'btn' %>
+ <%= link_to 'Delete', course_path(@course), :method => 'delete', :confirm => 'Are you sure?', :class => 'btn btn-danger' %>
+</div>
31 app/views/distributions/_form.html.erb
@@ -0,0 +1,31 @@
+<%= form_for @distribution, :html => { :class => 'form-horizontal' } do |f| %>
+ <fieldset>
+ <legend><%= controller.action_name.capitalize %> Distribution</legend>
+
+ <div class="control-group">
+ <%= f.label :category, :class => 'control-label' %>
+ <div class="controls">
+ <%= f.text_field :category, :class => 'text_field' %>
+ </div>
+ </div>
+
+ <div class="control-group">
+ <%= f.label :percent, :class => 'control-label' %>
+ <div class="controls">
+ <%= f.number_field :percent, :class => 'number_field' %>
+ </div>
+ </div>
+
+ <div class="control-group">
+ <%= f.label :course_id, :class => 'control-label' %>
+ <div class="controls">
+ <%= f.number_field :course_id, :class => 'number_field' %>
+ </div>
+ </div>
+
+ <div class="form-actions">
+ <%= f.submit nil, :class => 'btn btn-primary' %>
+ <%= link_to 'Cancel', distributions_path, :class => 'btn' %>
+ </div>
+ </fieldset>
+<% end %>
1 app/views/distributions/edit.html.erb
@@ -0,0 +1 @@
+<%= render :partial => 'form' %>
26 app/views/distributions/index.html.erb
@@ -0,0 +1,26 @@
+<h1>Distributions</h1>
+<table class="table table-striped">
+ <thead>
+ <tr>
+ <th>ID</th>
+ <th>Category</th>
+ <th>Created at</th>
+ <th>Actions</th>
+ </tr>
+ </thead>
+ <tbody>
+ <% @distributions.each do |distribution| %>
+ <tr>
+ <td><%= distribution.id %></td>
+ <td><%= link_to distribution.category, distribution_path(distribution) %></td>
+ <td><%= distribution.created_at %></td>
+ <td>
+ <%= link_to 'Edit', edit_distribution_path(distribution), :class => 'btn btn-mini' %>
+ <%= link_to 'Destroy', distribution_path(distribution), :method => :delete, :confirm => 'Are you sure?', :class => 'btn btn-mini btn-danger' %>
+ </td>
+ </tr>
+ <% end %>
+ </tbody>
+</table>
+
+<%= link_to 'New', new_distribution_path, :class => 'btn btn-primary' %>
1 app/views/distributions/new.html.erb
@@ -0,0 +1 @@
+<%= render :partial => 'form' %>
22 app/views/distributions/show.html.erb
@@ -0,0 +1,22 @@
+<h1>Distribution</h1>
+
+<p>
+ <b>Category</b><br>
+ <%= @distribution.category %>
+</p>
+
+<p>
+ <b>Percent</b><br>
+ <%= @distribution.percent %>
+</p>
+
+<p>
+ <b>Course</b><br>
+ <%= @distribution.course_id %>
+</p>
+
+<div class="form-actions">
+ <%= link_to 'Back', distributions_path, :class => 'btn' %>
+ <%= link_to 'Edit', edit_distribution_path(@distribution), :class => 'btn' %>
+ <%= link_to 'Delete', distribution_path(@distribution), :method => 'delete', :confirm => 'Are you sure?', :class => 'btn btn-danger' %>
+</div>
29 app/views/home/global_links.html.erb
@@ -0,0 +1,29 @@
+
+ <% if current_user %>
+ <ul class="nav">
+ <li class="active">
+ <a href="<%= root_url%>"> Home </a>
+ </li>
+ <li class="active">
+ <%= link_to "Course Load", courses_path%>
+ </li>
+ <li class="active">
+ <%= link_to "My Students", students_path%>
+ </li>
+ <li class="active">
+ <%= link_to "Distributions", distributions_path%>
+ </li>
+
+ </ul>
+ <%end%>
+ <div class="pull-right">
+
+ <% if current_user %>
+ <span style="color:white;"> Logged in as <%= current_user.email %> <%= link_to "Log Out", logout_path %>
+ <% else %>
+ <%= link_to "Sign Up", signup_path %> or
+ <%= link_to "Log In", login_path %>
+ <% end %></span>
+
+ </div>
+
2 app/views/home/index.html.erb
@@ -0,0 +1,2 @@
+<%= link_to 'Create New Class', new_course_path %>
+
38 app/views/layouts/application.html.erb
@@ -0,0 +1,38 @@
+<!DOCTYPE html>
+<html>
+<head>
+ <title>GradeServer</title>
+ <meta name="viewport" content="width=device-width, initial-scale=1.0">
+ <%= stylesheet_link_tag "application", :media => "all" %>
+ <%= javascript_include_tag "application" %>
+ <%= csrf_meta_tags %>
+</head>
+<body>
+ <div class="navbar navbar-fixed-top">
+ <div class="navbar-inner">
+ <div class="container">
+ <a class="btn btn-navbar" data-toggle="collapse" data-target=".nav-collapse">
+ <span class="icon-bar"></span>
+ <span class="icon-bar"></span>
+ <span class="icon-bar"></span>
+ </a>
+ <a class="brand" href="<%= root_url %>">GradeServer</a>
+ <div class="nav-collapse">
+
+ <%= render :template => 'home/global_links' %>
+
+ </div>
+ </div>
+ </div>
+ </div>
+
+ <div class="container">
+ <div class="row">
+ <div class="span9"><%= yield %></div>
+
+
+ </div>
+ </div>
+ </div>
+</body>
+</html>
29 app/views/schedules/_form.html.erb
@@ -0,0 +1,29 @@
+<%= form_for(@schedule) do |f| %>
+ <% if @schedule.errors.any? %>
+ <div id="error_explanation">
+ <h2><%= pluralize(@schedule.errors.count, "error") %> prohibited this schedule from being saved:</h2>
+
+ <ul>
+ <% @schedule.errors.full_messages.each do |msg| %>
+ <li><%= msg %></li>
+ <% end %>
+ </ul>
+ </div>
+ <% end %>
+
+ <div class="field">
+ <%= f.label :section %><br />
+ <%= f.text_field :section %>
+ </div>
+ <div class="field">
+ <%= f.label :days %><br />
+ <%= f.text_field :days %>
+ </div>
+ <div class="field">
+ <%= f.label :time %><br />
+ <%= f.text_field :time %>
+ </div>
+ <div class="actions">
+ <%= f.submit %>
+ </div>
+<% end %>
6 app/views/schedules/edit.html.erb
@@ -0,0 +1,6 @@
+<h1>Editing schedule</h1>
+
+<%= render 'form' %>
+
+<%= link_to 'Show', @schedule %> |
+<%= link_to 'Back', schedules_path %>
27 app/views/schedules/index.html.erb
@@ -0,0 +1,27 @@
+<h1>Listing schedules</h1>
+
+<table>
+ <tr>
+ <th>Section</th>
+ <th>Days</th>
+ <th>Time</th>
+ <th></th>
+ <th></th>
+ <th></th>
+ </tr>
+
+<% @schedules.each do |schedule| %>
+ <tr>
+ <td><%= schedule.section %></td>
+ <td><%= schedule.days %></td>
+ <td><%= schedule.time %></td>
+ <td><%= link_to 'Show', schedule %></td>
+ <td><%= link_to 'Edit', edit_schedule_path(schedule) %></td>
+ <td><%= link_to 'Destroy', schedule, :confirm => 'Are you sure?', :method => :delete %></td>
+ </tr>
+<% end %>
+</table>
+
+<br />
+
+<%= link_to 'New Schedule', new_schedule_path %>
5 app/views/schedules/new.html.erb
@@ -0,0 +1,5 @@
+<h1>New schedule</h1>
+
+<%= render 'form' %>
+
+<%= link_to 'Back', schedules_path %>
20 app/views/schedules/show.html.erb
@@ -0,0 +1,20 @@
+<p id="notice"><%= notice %></p>
+
+<p>
+ <b>Section:</b>
+ <%= @schedule.section %>
+</p>
+
+<p>
+ <b>Days:</b>
+ <%= @schedule.days %>
+</p>
+
+<p>
+ <b>Time:</b>
+ <%= @schedule.time %>
+</p>
+
+
+<%= link_to 'Edit', edit_schedule_path(@schedule) %> |
+<%= link_to 'Back', schedules_path %>
0 app/views/sessions/index.html.erb
No changes.
14 app/views/sessions/new.html.erb
@@ -0,0 +1,14 @@
+<h1>Log In</h1>
+
+<%= form_tag sessions_path do %>
+
+ <div class="field">
+ <%= label_tag :email %><br />
+ <%= text_field_tag :email, params[:email] %>
+ </div>
+ <div class="field">
+ <%= label_tag :password %><br />
+ <%= password_field_tag :password %>
+ </div>
+ <div class="actions"><%= submit_tag "Log In" %></div>
+<% end %>
38 app/views/students/_form.html.erb
@@ -0,0 +1,38 @@
+<%= form_for @student, :html => { :class => 'form-horizontal' } do |f| %>
+ <fieldset>
+ <legend><%= controller.action_name.capitalize %> Student</legend>
+
+ <div class="control-group">
+ <%= f.label :student_id, :class => 'control-label' %>
+ <div class="controls">
+ <%= f.text_field :student_id, :class => 'text_field' %>
+ </div>
+ </div>
+
+ <div class="control-group">
+ <%= f.label :firstname, :class => 'control-label' %>
+ <div class="controls">
+ <%= f.text_field :firstname, :class => 'text_field' %>
+ </div>
+ </div>
+
+ <div class="control-group">
+ <%= f.label :lastname, :class => 'control-label' %>
+ <div class="controls">
+ <%= f.text_field :lastname, :class => 'text_field' %>
+ </div>
+ </div>
+
+ <div class="control-group">
+ <%= f.label :email, :class => 'control-label' %>
+ <div class="controls">
+ <%= f.text_field :email, :class => 'text_field' %>
+ </div>
+ </div>
+
+ <div class="form-actions">
+ <%= f.submit nil, :class => 'btn btn-primary' %>
+ <%= link_to 'Cancel', students_path, :class => 'btn' %>
+ </div>
+ </fieldset>
+<% end %>
4 app/views/students/_students_fields.html.erb
@@ -0,0 +1,4 @@
+<div>
+ <%= f.text_field :id%>
+ <%= f.text_field :lastname%>
+</div>
1 app/views/students/edit.html.erb
@@ -0,0 +1 @@
+<%= render :partial => 'form' %>
26 app/views/students/index.html.erb
@@ -0,0 +1,26 @@
+<h1>Students</h1>
+<table class="table table-striped">
+ <thead>
+ <tr>
+ <th>ID</th>
+ <th>Student</th>
+ <th>Created at</th>
+ <th>Actions</th>
+ </tr>
+ </thead>
+ <tbody>
+ <% @students.each do |student| %>
+ <tr>
+ <td><%= student.id %></td>
+ <td><%= link_to student.student_id, student_path(student) %></td>
+ <td><%= student.created_at %></td>
+ <td>
+ <%= link_to 'Edit', edit_student_path(student), :class => 'btn btn-mini' %>
+ <%= link_to 'Destroy', student_path(student), :method => :delete, :confirm => 'Are you sure?', :class => 'btn btn-mini btn-danger' %>
+ </td>
+ </tr>
+ <% end %>
+ </tbody>
+</table>
+
+<%= link_to 'New', new_student_path, :class => 'btn btn-primary' %>
1 app/views/students/new.html.erb
@@ -0,0 +1 @@
+<%= render :partial => 'form' %>
27 app/views/students/show.html.erb
@@ -0,0 +1,27 @@
+<h1>Student</h1>
+
+<p>
+ <b>Student</b><br>
+ <%= @student.student_id %>
+</p>
+
+<p>
+ <b>Firstname</b><br>
+ <%= @student.firstname %>
+</p>
+
+<p>
+ <b>Lastname</b><br>
+ <%= @student.lastname %>
+</p>
+
+<p>
+ <b>Email</b><br>
+ <%= @student.email %>
+</p>
+
+<div class="form-actions">
+ <%= link_to 'Back', students_path, :class => 'btn' %>
+ <%= link_to 'Edit', edit_student_path(@student), :class => 'btn' %>
+ <%= link_to 'Delete', student_path(@student), :method => 'delete', :confirm => 'Are you sure?', :class => 'btn btn-danger' %>
+</div>
24 app/views/users/_form.html.erb
@@ -0,0 +1,24 @@
+<%= form_for @user, :html => { :class => 'form-horizontal' } do |f| %>
+ <fieldset>
+ <legend><%= controller.action_name.capitalize %> User</legend>
+
+ <div class="control-group">
+ <%= f.label :email, :class => 'control-label' %>
+ <div class="controls">
+ <%= f.text_field :email, :class => 'text_field' %>
+ </div>
+ </div>
+
+ <div class="control-group">
+ <%= f.label :password_digest, :class => 'control-label' %>
+ <div class="controls">
+ <%= f.text_field :password_digest, :class => 'text_field' %>
+ </div>
+ </div>
+
+ <div class="form-actions">
+ <%= f.submit nil, :class => 'btn btn-primary' %>
+ <%= link_to 'Cancel', users_path, :class => 'btn' %>
+ </div>
+ </fieldset>
+<% end %>
1 app/views/users/edit.html.erb
@@ -0,0 +1 @@
+<%= render :partial => 'form' %>