Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
50 changed files
with
824 additions
and
29 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -19,6 +19,7 @@ group :assets do | |
end | ||
|
||
gem 'friendly_id' | ||
gem 'carrierwave' | ||
|
||
group :production do | ||
gem 'pg' | ||
|
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
jQuery -> | ||
if $('#map_canvas').length | ||
myLatlng = new google.maps.LatLng(53.472169,-2.181558); | ||
myOptions = { | ||
zoom: 13, | ||
center: myLatlng, | ||
mapTypeId: google.maps.MapTypeId.ROADMAP | ||
} | ||
map = new google.maps.Map(document.getElementById("map_canvas"), myOptions) | ||
|
||
marker = new google.maps.Marker({ | ||
position: myLatlng, | ||
map: map, | ||
title:"Hello World!" | ||
}) |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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/ |
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,8 @@ | ||
# 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/ | ||
jQuery -> | ||
|
||
$('#add_video').click -> | ||
embed_code = $('#video_url').val().replace(/^[^v]+v.(.{11}).*/,"$1") | ||
$('#video_url').val('').focus() | ||
player = "<iframe width='280' height='156' src='http://www.youtube.com/embed/#{embed_code}' frameborder='0' allowfullscreen></iframe>" | ||
$('#video_list').append("<li>#{player}</li>") | ||
return false |
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,19 @@ | ||
.address { | ||
#address { | ||
span { | ||
display: block; | ||
} | ||
width: grid-width(2); | ||
float: left; | ||
} | ||
|
||
#map_canvas { | ||
display: block; | ||
width: grid-width(5); | ||
height: 400px; | ||
float: left; | ||
} | ||
|
||
#downloads { | ||
clear: both; | ||
width: grid-width(8); | ||
} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
// Place all the styles related to the Downloads controller here. | ||
// They will automatically be included in application.css. | ||
// You can use Sass (SCSS) here: http://sass-lang.com/ |
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
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,83 @@ | ||
class DownloadsController < ApplicationController | ||
# GET /downloads | ||
# GET /downloads.json | ||
def index | ||
@downloads = Download.all | ||
|
||
respond_to do |format| | ||
format.html # index.html.erb | ||
format.json { render json: @downloads } | ||
end | ||
end | ||
|
||
# GET /downloads/1 | ||
# GET /downloads/1.json | ||
def show | ||
@download = Download.find(params[:id]) | ||
|
||
respond_to do |format| | ||
format.html # show.html.erb | ||
format.json { render json: @download } | ||
end | ||
end | ||
|
||
# GET /downloads/new | ||
# GET /downloads/new.json | ||
def new | ||
@download = Download.new | ||
|
||
respond_to do |format| | ||
format.html # new.html.erb | ||
format.json { render json: @download } | ||
end | ||
end | ||
|
||
# GET /downloads/1/edit | ||
def edit | ||
@download = Download.find(params[:id]) | ||
end | ||
|
||
# POST /downloads | ||
# POST /downloads.json | ||
def create | ||
@download = Download.new(params[:download]) | ||
|
||
respond_to do |format| | ||
if @download.save | ||
format.html { redirect_to @download, notice: 'Download was successfully created.' } | ||
format.json { render json: @download, status: :created, location: @download } | ||
else | ||
format.html { render action: "new" } | ||
format.json { render json: @download.errors, status: :unprocessable_entity } | ||
end | ||
end | ||
end | ||
|
||
# PUT /downloads/1 | ||
# PUT /downloads/1.json | ||
def update | ||
@download = Download.find(params[:id]) | ||
|
||
respond_to do |format| | ||
if @download.update_attributes(params[:download]) | ||
format.html { redirect_to @download, notice: 'Download was successfully updated.' } | ||
format.json { head :no_content } | ||
else | ||
format.html { render action: "edit" } | ||
format.json { render json: @download.errors, status: :unprocessable_entity } | ||
end | ||
end | ||
end | ||
|
||
# DELETE /downloads/1 | ||
# DELETE /downloads/1.json | ||
def destroy | ||
@download = Download.find(params[:id]) | ||
@download.destroy | ||
|
||
respond_to do |format| | ||
format.html { redirect_to downloads_url } | ||
format.json { head :no_content } | ||
end | ||
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
module DownloadsHelper | ||
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
class Download < ActiveRecord::Base | ||
mount_uploader :file, FileUploader | ||
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
class Photo < ActiveRecord::Base | ||
belongs_to :project | ||
mount_uploader :image, ImageUploader | ||
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,6 @@ | ||
class Project < ActiveRecord::Base | ||
extend FriendlyId | ||
friendly_id :name, use: :slugged | ||
has_many :videos | ||
has_many :photos | ||
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
class Video < ActiveRecord::Base | ||
belongs_to :project | ||
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
# encoding: utf-8 | ||
|
||
class FileUploader < CarrierWave::Uploader::Base | ||
|
||
# Include RMagick or MiniMagick support: | ||
# include CarrierWave::RMagick | ||
# include CarrierWave::MiniMagick | ||
|
||
# Include the Sprockets helpers for Rails 3.1+ asset pipeline compatibility: | ||
# include Sprockets::Helpers::RailsHelper | ||
# include Sprockets::Helpers::IsolatedHelper | ||
|
||
# Choose what kind of storage to use for this uploader: | ||
storage :file | ||
# storage :fog | ||
|
||
# Override the directory where uploaded files will be stored. | ||
# This is a sensible default for uploaders that are meant to be mounted: | ||
def store_dir | ||
# uploads/#{model.class.to_s.underscore}/ | ||
"#{mounted_as}/#{model.id}" | ||
end | ||
|
||
# Provide a default URL as a default if there hasn't been a file uploaded: | ||
# def default_url | ||
# # For Rails 3.1+ asset pipeline compatibility: | ||
# # asset_path("fallback/" + [version_name, "default.png"].compact.join('_')) | ||
# | ||
# "/images/fallback/" + [version_name, "default.png"].compact.join('_') | ||
# end | ||
|
||
# Process files as they are uploaded: | ||
# process :scale => [200, 300] | ||
# | ||
# def scale(width, height) | ||
# # do something | ||
# end | ||
|
||
# Create different versions of your uploaded files: | ||
# version :thumb do | ||
# process :scale => [50, 50] | ||
# end | ||
|
||
# Add a white list of extensions which are allowed to be uploaded. | ||
# For images you might use something like this: | ||
# def extension_white_list | ||
# %w(jpg jpeg gif png) | ||
# end | ||
|
||
# Override the filename of the uploaded files: | ||
# Avoid using model.id or version_name here, see uploader/store.rb for details. | ||
# def filename | ||
# "something.jpg" if original_filename | ||
# 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,60 @@ | ||
# encoding: utf-8 | ||
|
||
class ImageUploader < CarrierWave::Uploader::Base | ||
|
||
# Include RMagick or MiniMagick support: | ||
# include CarrierWave::RMagick | ||
# include CarrierWave::MiniMagick | ||
|
||
# Include the Sprockets helpers for Rails 3.1+ asset pipeline compatibility: | ||
# include Sprockets::Helpers::RailsHelper | ||
# include Sprockets::Helpers::IsolatedHelper | ||
|
||
# Choose what kind of storage to use for this uploader: | ||
storage :file | ||
# storage :fog | ||
|
||
# Override the directory where uploaded files will be stored. | ||
# This is a sensible default for uploaders that are meant to be mounted: | ||
def store_dir | ||
"uploads/#{model.class.to_s.underscore}/#{mounted_as}/#{model.id}" | ||
end | ||
|
||
process :resize_to_fit => [800, 800] | ||
version :thumb do | ||
process :resize_to_fill => [200,200] | ||
end | ||
|
||
# Provide a default URL as a default if there hasn't been a file uploaded: | ||
# def default_url | ||
# # For Rails 3.1+ asset pipeline compatibility: | ||
# # asset_path("fallback/" + [version_name, "default.png"].compact.join('_')) | ||
# | ||
# "/images/fallback/" + [version_name, "default.png"].compact.join('_') | ||
# end | ||
|
||
# Process files as they are uploaded: | ||
# process :scale => [200, 300] | ||
# | ||
# def scale(width, height) | ||
# # do something | ||
# end | ||
|
||
# Create different versions of your uploaded files: | ||
# version :thumb do | ||
# process :scale => [50, 50] | ||
# end | ||
|
||
# Add a white list of extensions which are allowed to be uploaded. | ||
# For images you might use something like this: | ||
# def extension_white_list | ||
# %w(jpg jpeg gif png) | ||
# end | ||
|
||
# Override the filename of the uploaded files: | ||
# Avoid using model.id or version_name here, see uploader/store.rb for details. | ||
# def filename | ||
# "something.jpg" if original_filename | ||
# end | ||
|
||
end |
Oops, something went wrong.