Permalink
Browse files

Rails 3.1.0.beta1 capability

  • Loading branch information...
1 parent 01bbb31 commit 3c3c66b376ba9fa9220559385224a305a651fdd0 @agrobbin committed May 11, 2011
Showing with 111 additions and 9,394 deletions.
  1. +1 −1 Rakefile
  2. +4 −0 app/assets/javascripts/application.js
  3. 0 {public → app/assets}/javascripts/basic.js
  4. 0 {public → app/assets}/javascripts/courses.js
  5. +9 −2 public/javascripts/application.js → app/assets/javascripts/default.js
  6. 0 {public → app/assets}/javascripts/documents.js
  7. 0 {public → app/assets}/javascripts/institutions.js
  8. +22 −12 public/javascripts/jquery-fileupload.js → app/assets/javascripts/jquery_fileupload.js
  9. 0 public/javascripts/jquery-fileupload-ui.js → app/assets/javascripts/jquery_fileupload_ui.js
  10. 0 public/javascripts/jquery-ui.js → app/assets/javascripts/jquery_ui.js
  11. 0 {public → app/assets}/javascripts/sessions.js
  12. 0 {public → app/assets}/javascripts/startup.js
  13. 0 {public → app/assets}/stylesheets/.gitkeep
  14. +1 −6 public/stylesheets/scss/application.scss → app/assets/stylesheets/application.css.scss
  15. 0 {public/stylesheets/scss → app/assets/stylesheets}/calendar.scss
  16. 0 {public/stylesheets/scss → app/assets/stylesheets}/courses.scss
  17. +5 −0 {public/stylesheets/scss → app/assets/stylesheets}/documents.scss
  18. 0 public/stylesheets/scss/ie7.scss → app/assets/stylesheets/ie7.css.scss
  19. 0 public/stylesheets/scss/ie9.scss → app/assets/stylesheets/ie9.css.scss
  20. 0 {public/stylesheets/scss → app/assets/stylesheets}/institutions.scss
  21. 0 {public/stylesheets/scss → app/assets/stylesheets}/sessions.scss
  22. 0 {public/stylesheets/scss → app/assets/stylesheets}/users.scss
  23. +1 −1 app/models/document.rb
  24. +1 −0 app/models/professor.rb
  25. +1 −0 app/models/student.rb
  26. +1 −1 app/models/user.rb
  27. +2 −2 app/views/courses/_document.haml
  28. +2 −2 app/views/documents/_document.haml
  29. +1 −1 app/views/documents/_edit.haml
  30. +9 −0 app/views/documents/_show.haml
  31. +7 −6 app/views/layouts/institutions.haml
  32. +1 −1 app/views/users/setup.haml
  33. +4 −2 config/application.rb
  34. +0 −1 config/environments/development.rb
  35. +5 −2 config/environments/production.rb
  36. +3 −0 config/environments/test.rb
  37. +1 −1 config/initializers/session_store.rb
  38. +2 −1 config/initializers/validation_display_order.rb
  39. +12 −0 config/initializers/wrap_parameters.rb
  40. +0 −406 public/javascripts/jquery-ui.min.js
  41. +0 −8,374 public/javascripts/jquery.js
  42. +0 −16 public/javascripts/jquery.min.js
  43. +0 −291 public/javascripts/rails.js
  44. +0 −169 public/stylesheets/application.css
  45. +0 −7 public/stylesheets/calendar.css
  46. +0 −17 public/stylesheets/courses.css
  47. +0 −18 public/stylesheets/documents.css
  48. +0 −3 public/stylesheets/ie7.css
  49. +0 −1 public/stylesheets/ie9.css
  50. +0 −4 public/stylesheets/institutions.css
  51. +0 −23 public/stylesheets/sessions.css
  52. +0 −7 public/stylesheets/users.css
  53. +16 −16 vendor/plugins/uclass/lib/uclass/google/documents.rb
View
@@ -1,7 +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__)
-require 'rake'
Uclass::Application.load_tasks
@@ -0,0 +1,4 @@
+//= require jquery
+//= require jquery_ui
+//= require jquery_ujs
+//= require default
File renamed without changes.
File renamed without changes.
@@ -18,7 +18,8 @@ $(window).load(function(){
});
$(window).resize(function(){
updateHeightFixes();
- $('#dialog-content').css('left', $(window).width()/2-322);
+ if ($('#dialog-content').hasClass('doc-viewer')) $('#dialog-content').css({left: 50, width: $(window).width()-140});
+ else $('#dialog-content').css('left', $(window).width()/2-322);
});
$(window).keydown(function(e){
if (e.keyCode == 27) clearModalandDialog();
@@ -66,7 +67,13 @@ $('a.cancel').live('click', function(){
$('a.dialog').live('click', function(){
$('#dialog').fadeTo(200, 0.6);
var top = document.documentElement.scrollTop || document.body.scrollTop;
- var left = $(window).width()/2-322;
+ if ($(this).hasClass('doc-viewer')){
+ $('#dialog-content').addClass('doc-viewer');
+ var left = 50;
+ $('#dialog-content').width($(window).width()-140);
+ } else {
+ var left = $(window).width()/2-322;
+ }
$.ajax({
url: this.href,
dataType: 'html',
@@ -1,5 +1,5 @@
/*
- * jQuery File Upload Plugin 4.4.3
+ * jQuery File Upload Plugin 4.5.1
* https://github.com/blueimp/jQuery-File-Upload
*
* Copyright 2010, Sebastian Tschan
@@ -97,7 +97,8 @@
forceIframeUpload: false,
sequentialUploads: false,
maxChunkSize: null,
- maxFileReaderSize: 50000000
+ maxFileReaderSize: 50000000,
+ replaceFileInput: true
},
documentListeners = {},
dropZoneListeners = {},
@@ -583,9 +584,12 @@
completeNext();
return;
}
- var originalAction = form.attr('action'),
- originalMethod = form.attr('method'),
- originalTarget = form.attr('target');
+ var originalAttributes = {
+ 'action': form.attr('action'),
+ 'method': form.attr('method'),
+ 'target': form.attr('target'),
+ 'enctype': form.attr('enctype')
+ };
iframe
.unbind('abort')
.bind('abort', function (e) {
@@ -615,15 +619,19 @@
form
.attr('action', getUrl(settings))
.attr('method', getMethod(settings))
- .attr('target', iframe.attr('name'));
+ .attr('target', iframe.attr('name'))
+ .attr('enctype', 'multipart/form-data');
legacyUploadFormDataInit(input, form, settings);
iframe.readyState = 2;
form.get(0).submit();
legacyUploadFormDataReset(input, form, settings);
- form
- .attr('action', originalAction)
- .attr('method', originalMethod)
- .attr('target', originalTarget);
+ $.each(originalAttributes, function (name, value) {
+ if (value) {
+ form.attr(name, value);
+ } else {
+ form.removeAttr(name);
+ }
+ });
};
multiLoader.push([files, index, iframe, settings]);
if (settings.sequentialUploads) {
@@ -779,8 +787,10 @@
var input = $(e.target),
form = $(e.target.form);
if (form.length === 1) {
- input.data(defaultNamespace + '_form', form);
- replaceFileInput(input);
+ if (settings.replaceFileInput) {
+ input.data(defaultNamespace + '_form', form);
+ replaceFileInput(input);
+ }
} else {
form = input.data(defaultNamespace + '_form');
}
File renamed without changes.
File renamed without changes.
File renamed without changes.
@@ -403,9 +403,4 @@ a.section {
padding: 20px 0;
}
-@import "calendar";
-@import "courses";
-@import "documents";
-@import "institutions";
-@import "sessions";
-@import "users";
+@import "calendar", "courses", "documents", "institutions", "sessions", "users";
@@ -86,4 +86,9 @@ p.file-info {
width: auto;
float: none;
}
+}
+
+iframe.doc-viewer {
+ width: 100%;
+ height: 600px;
}
View
@@ -33,7 +33,7 @@ def google_docs_create
if google_document_id.blank? # necessary to stop callback from continuously repeating itself, when after_save becomes after_create, this won't be necessary
google_document = google_docs_api.create_document(self)
update_attribute(:google_document_id, google_document[:id])
- google_docs_api.publish_document(self)
+ # google_docs_api.publish_document(self)
google_docs_api.move_resource(google_document_id, section.google_document_folder_id)
end
end
View
@@ -1,4 +1,5 @@
class Professor < User
+ include Uclass::App::Settings # this has to be here in Rails 3.1.0.beta1 because the polymorphic association SQL generated uses User as the class instead of subclasses Professor and Student
SETTINGS = {
:widget_order => {
View
@@ -1,4 +1,5 @@
class Student < User
+ include Uclass::App::Settings # this has to be here in Rails 3.1.0.beta1 because the polymorphic association SQL generated uses User as the class instead of subclasses Professor and Student
SETTINGS = {
:widget_order => {
View
@@ -1,5 +1,5 @@
class User < ActiveRecord::Base
- include Uclass::App::Settings
+ # include Uclass::App::Settings # this can't be here in Rails 3.1.0.beta1 because the polymorphic association SQL generated uses User as the class instead of subclasses Professor and Student
self.abstract_class = true
@@ -1,6 +1,6 @@
.document{:class => current_user.is_a?(Professor) && !document.visible ? 'invisible' : nil}
- = image_tag "icons/file-types-#{document.file_type_icon}-small.png"
- %b= link_to document.name, course_document_path(@section, document)
+ = image_tag "/images/icons/file-types-#{document.file_type_icon}-small.png"
+ %b= link_to document.name, course_document_path(@section, document), :class => 'dialog doc-viewer'
- if current_user.is_a?(Professor) && !document.visible
\- Invisible to students
%br
@@ -1,6 +1,6 @@
.document{:id => current_user.is_a?(Professor) ? "document_#{document.id}" : nil, :class => current_user.is_a?(Professor) && !document.visible ? 'invisible' : nil}
- = image_tag "icons/file-types-#{document.file_type_icon}-small.png"
- %b= link_to document.name, course_document_path(@section, document)
+ = image_tag "/images/icons/file-types-#{document.file_type_icon}-small.png"
+ %b= link_to document.name, course_document_path(@section, document), :class => 'dialog doc-viewer'
- if current_user.is_a?(Professor) && !document.visible
\- Invisible to students
%br
@@ -4,7 +4,7 @@
= form_for @document, :url => course_document_path(@section, @document), :remote => true do |f|
%label File Information
%p.file-info
- = image_tag "icons/file-types-#{@document.file_type_icon}.png"
+ = image_tag "/images/icons/file-types-#{@document.file_type_icon}.png"
%b= @document.upload.original_filename
%br
= number_to_human_size @document.upload_file_size
@@ -0,0 +1,9 @@
+%h2
+ = link_to 'Download', download_course_document_path(@section), :class => 'right button'
+ = @document.name
+%p= @document.description
+%br
+- if @document.upload_content_type =~ /^image/
+ .center= image_tag @document.upload.url
+- else
+ %iframe.doc-viewer{:src => "http://docs.google.com/viewer?url=#{CGI.escape("#{root_url}#{@document.upload.url.from(1)}")}&embedded=true", :frameborder => 0}
@@ -2,19 +2,20 @@
%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'}/
- = csrf_meta_tag
- %link{:rel => 'shortcut icon', :type => 'image/x-icon', :href => '/favicon.ico'}/
+ = csrf_meta_tags
+ = favicon_link_tag
%title= "#{@title || current_institution.name} - uClass"
= stylesheet_link_tag 'application'
- if @browser == 'IE'
- case @browser_version
- when 9 || 7
= stylesheet_link_tag "ie#{@browser_version}"
- = javascript_include_tag :defaults
+ = javascript_include_tag 'application'
= javascript_include_tag @startup ? 'startup' : 'basic'
- if @fileUpload
- = javascript_include_tag 'jquery-fileupload', 'jquery-fileupload-ui'
- - if File.exists?(File.join(Rails.root, 'public', 'javascripts', "#{params[:controller]}.js"))
+ = javascript_include_tag 'jquery_fileupload'
+ = javascript_include_tag 'jquery_fileupload_ui'
+ - if File.exists?(File.join(Rails.root, 'app', 'assets', 'javascripts', "#{params[:controller]}.js"))
= javascript_include_tag params[:controller]
- if @startup
:css
@@ -47,7 +48,7 @@
.clear
#footer Copyright &copy; #{Date.today.year} #{link_to 'uClass', root_url(:subdomain => nil)} | #{link_to 'Help', '#'}
- if @startup
- = image_tag 'uclass-large.png', :id => 'uclass-large'
+ = image_tag '/images/uclass-large.png', :id => 'uclass-large'
#loading Loading...
#modal
#dialog
@@ -28,7 +28,7 @@
%p
Before uClass can start fully integrating with your #{current_institution.name} Google account, we need to do a few setup tasks. It should only take a few seconds, and then you'll be ready to go.
%b DO NOT REFRESH YOUR BROWSER.
-= image_tag 'loading.gif', :id => 'setup-loading'
+= image_tag '/images/loading.gif', :id => 'setup-loading'
%ul#setup
%li.calendar Creating a calendar for your courses
%li.documents Connecting you to the documents folder for each of your courses
View
@@ -13,12 +13,14 @@ class Application < Rails::Application
config.time_zone = 'UTC'
- config.action_view.javascript_expansions[:defaults] = %w(jquery.min.js jquery-ui.min.js rails)
-
config.encoding = "utf-8"
config.filter_parameters += [:password]
+ config.active_record.identity_map = true
+
+ config.assets.enabled = true
+
config.action_mailer.delivery_method = :sendmail
GOOGLE_FEEDS = {
@@ -4,7 +4,6 @@
config.whiny_nils = true
config.consider_all_requests_local = true
- config.action_view.debug_rjs = true
config.action_controller.perform_caching = false
config.action_mailer.raise_delivery_errors = false
@@ -4,10 +4,13 @@
config.consider_all_requests_local = false
config.action_controller.perform_caching = true
- config.action_dispatch.x_sendfile_header = 'X-Accel-Redirect'
-
config.serve_static_assets = false
+ config.assets.js_compressor = :uglifier
+ config.assets.css_compressor = :scss
+
+ config.action_dispatch.x_sendfile_header = 'X-Accel-Redirect'
+
config.i18n.fallbacks = true
config.active_support.deprecation = :notify
@@ -1,6 +1,9 @@
Uclass::Application.configure do
config.cache_classes = true
+ config.serve_static_assets = true
+ config.static_cache_control = "public, max-age=3600"
+
config.whiny_nils = true
config.consider_all_requests_local = true
@@ -1,6 +1,6 @@
# Be sure to restart your server when you modify this file.
-Uclass::Application.config.session_store :cookie_store, :key => '_uclass_session'
+Uclass::Application.config.session_store :cookie_store, key: '_uclass_session'
# Use the database for sessions instead of the cookie-based default,
# which shouldn't be used to store highly confidential information
@@ -6,9 +6,10 @@
# rev 002 . 2010.05.13 - Dan Sharp: if not called, validation_order is nil
# rev 003 . 2010.05.20 - Alex Robbin: updated to work with nested attributes (Rails v2.3)
# rev 004 . 2011.01.09 - Alex Robbin: Rails 3 compatible
+# rev 005 . 2011.05.05 - Alex Robbin: Rails 3.1 compatible
module ActiveModel
- class Errors < ActiveSupport::OrderedHash
+ class Errors
mattr_accessor :validation_display_order
alias_method :old_full_messages, :full_messages
@@ -0,0 +1,12 @@
+# Be sure to restart your server when you modify this file.
+#
+# This file contains the settings for ActionController::ParametersWrapper
+# which will be enabled by default in the upcoming version of Ruby on Rails.
+
+# Enable parameter wrapping for JSON. You can disable this by set :format to empty array.
+ActionController::Base.wrap_parameters :format => [:json]
+
+# Disable root element in JSON by default.
+if defined?(ActiveRecord)
+ ActiveRecord::Base.include_root_in_json = false
+end
Oops, something went wrong.

0 comments on commit 3c3c66b

Please sign in to comment.