Skip to content

Instantly share code, notes, and snippets.

View vinniefranco's full-sized avatar
🏡
WFH

Vincent Franco vinniefranco

🏡
WFH
View GitHub Profile
json.gallery do |g|
g.info do |info|
info.title @gallery.title if @gallery.title
info.image @gallery.image.l(:medium) if @gallery.image
info.parent_id @gallery.parent_id if @gallery.parent_id
info.root true unless @gallery.parent_id
end
@gallery.photos.each do |photo|
g.photos do |p|
p.id photo.id
= form_for @gallery, :html => { :multipart => true }, :remote => true do |f|
%ol.dialog.form
%li.text
= f.label :title
= f.text_field :title
%li.select
= f.label :parent_id, 'Parent'
= f.select :parent_id , @galleries.collect {|g| [g.title, g.id]}, { :include_blank => 'Pick a parent' }
%li.file
- f.fields_for :image do |image|
class Image < ActiveRecord::Base
attr_accessor :asset_url
# This should pull in dynamic styles based of what
# model is calling it Articles, Events, etc.
has_attached_file :asset,
:storage => :s3,
:s3_credentials => "#{Rails.root}/config/s3.yml",
:path => "/media/:class/:attachment/:style.:filename",
# Create a new image
ruby-1.9.2-p136 :120 > image = Image.new()
=> #<Image id: nil, table_name: nil, table_id: nil, title: nil, description: nil, tiny: nil, small: nil, medium: nil, large: nil, original: nil, dcreate: nil, asset_file_name: nil, asset_content_type: nil, asset_file_size: nil, asset_updated_at: nil, asset_remote_url: nil>
# Set a style dynamically
ruby-1.9.2-p136 :126 > image.asset.styles[:large] = Paperclip::Style.new(:large, '300x300#', image.asset)
=> #<Paperclip::Style:0x00000100f0f5e0 @name=:large, @attachment=/assets/original/missing.png, @geometry="300x300#", @format=nil, @other_args={}>
# Add a new asset and BOOM
ruby-1.9.2-p136 :127 > image.asset = File.new(Rails.root+'public/images/rails.png')
SPA.extend("SearchableList", (function($) {
var my = {},
options = {
url: "/",
clearCallback: function() {},
clickCallback: function() {},
list: {},
guid: null,
itemTemplate: "",
name: "List"
group :development, :test do
gem 'rspec-rails', '>= 2.5.0'
gem 'capybara'
gem 'launchy'
end
group :test do
gem 'cucumber-rails'
gem 'factory_girl_rails'
gem 'database_cleaner'
if (Array.prototype.map === undefined) {
Array.prototype.map = function(callback) {
var len = this.length;
if (typeof callback != "function") {
throw new TypeError();
}
var mapped = [len],
o = arguments[1];
for (var i = 0; i < len; i++) {
#
# Configuration File for JavaScript Lint 0.3.0
# Developed by Matthias Miller (http://www.JavaScriptLint.com)
#
# This configuration file can be used to lint a collection of scripts, or to enable
# or disable warnings for scripts that are linted via the command line.
#
### Warnings
# Enable or disable warnings based on requirements.
module AdminHelper
def link_to_direction(field)
title = field.humanize
dir = @order_dir == 'ASC' ? 'desc' : 'asc'
link_to title, yield(:order => field, :dir => dir) if block_given?
end
end
require 'yaml'
asset_path = File.expand_path(File.dirname(__FILE__) + '/../lib/assets/content/')
assets = Dir.glob(asset_path + '/*.yml')
assets.each do |url|
key = File.basename(url, '.yml')
parsed = YAML.load_file(url)
if parsed
klass = Admin.const_get(key.classify)