This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class ActiveRecord::Base | |
@@cache_store = nil | |
def self.cache_store | |
@@cache_store ||= ActionController::Base.cache_store | |
end | |
def self.caches(method_name, key = nil, options = {}, &block) | |
if key.is_a?(Hash) | |
options = key | |
key = nil |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<table> | |
<thead> | |
<tr><th>Name</th></tr> | |
</thead> | |
<tbody id="specifications"> | |
<% @specifications.each do |spec| %> | |
<tr id="spec-<%= spec.id %>"><td><%= spec.name %></td></tr> | |
<% end %> | |
</tbody> | |
</table> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(function($) { | |
$.extend($.fn, { | |
validate: function(options) { | |
var form = this; | |
this.submit(function(event) { | |
form.find('label.error').filter('[generated=true]').empty() | |
if ((req_fields = form.find('.required[value=""]')).length > 0) { | |
req_fields.after('<label class="error" generated="true">This field is required</label>') |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Attachment < ActiveRecord::Base | |
def scribd_url | |
"http://www.scribd.com/word/full/#{self.scribd_doc_id}?access_key=#{self.scribd_access_key}" | |
end | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<% if attachments.any? %> | |
<ul class="attachments"> | |
<% attachments.each do |att| %> | |
<li id="attachment_<%= att.id %>"> | |
<%= link_to att.filename, attachment_url(att), :title => 'Download' %> | |
<%= link_to(image_tag('icons/page_white_magnify.png'), att.scribd_url, :id => att.scribd_doc_id, :rel => att.scribd_access_key, :class => 'scribd', :title => 'Preview') unless att.scribd_doc_id.blank? %> | |
</li> | |
<% end %> | |
</ul> | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var scribd_doc; | |
function showScribd(link) { | |
scribd_doc = new scribd.Document(link.id, link.rel); | |
scribd_doc.addParam('height', 400); | |
scribd_doc.addParam('width', 620); | |
scribd_doc.addParam('page', 1); | |
scribd_doc.write('scribd_preview'); | |
$('scribd').show(); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Submission < ActiveRecord::Base | |
def to_xml(options = {}) | |
super({ :include => [:source, :attachments] }.merge(options)) | |
end | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Zip::ZipFile.open(zipfile, Zip::ZipFile::CREATE) do |zip| | |
submissions.each do |submission| | |
submission.attachments.each do |file| | |
zip.add(file.relative_path, file.full_filename) | |
end | |
end | |
zip.add('submissions.xml', xmlfile) | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env ruby | |
require 'rubygems' | |
require 'right_aws' | |
require 'net/ssh' | |
require 'open-uri' | |
# Git rid of ssl verification warning | |
class Net::HTTP | |
alias_method :old_initialize, :initialize |
OlderNewer