Skip to content

Commit

Permalink
window done
Browse files Browse the repository at this point in the history
  • Loading branch information
johnrees committed Mar 30, 2012
1 parent 88c624b commit f8157c0
Show file tree
Hide file tree
Showing 50 changed files with 824 additions and 29 deletions.
1 change: 1 addition & 0 deletions Gemfile
Expand Up @@ -19,6 +19,7 @@ group :assets do
end

gem 'friendly_id'
gem 'carrierwave'

group :production do
gem 'pg'
Expand Down
4 changes: 4 additions & 0 deletions Gemfile.lock
Expand Up @@ -40,6 +40,9 @@ GEM
rack-test (>= 0.5.4)
selenium-webdriver (~> 2.0)
xpath (~> 0.1.4)
carrierwave (0.6.0)
activemodel (>= 3.2.0)
activesupport (>= 3.2.0)
childprocess (0.3.1)
ffi (~> 1.0.6)
chronic (0.6.7)
Expand Down Expand Up @@ -156,6 +159,7 @@ PLATFORMS
DEPENDENCIES
bourbon
capybara
carrierwave
coffee-rails (~> 3.2.1)
database_cleaner
delorean
Expand Down
15 changes: 15 additions & 0 deletions app/assets/javascripts/contact.js.coffee
@@ -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!"
})
3 changes: 3 additions & 0 deletions app/assets/javascripts/downloads.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/
10 changes: 5 additions & 5 deletions app/assets/javascripts/home.js.coffee
Expand Up @@ -7,8 +7,8 @@ jQuery ->
loading_text: "loading tweets..."
template: "<div class='tweet_body'>{text}</div><div class='tweet_time'>{time}</div>"
$('#my-slideshow').bjqs
'width' : 940,
'height' : 340,
'showMarkers' : true,
'showControls' : true,
'centerMarkers' : false
width: '100%'
height : 360
showMarkers: true
showControls: true
centerMarkers: false
11 changes: 8 additions & 3 deletions app/assets/javascripts/projects.js.coffee
@@ -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
7 changes: 6 additions & 1 deletion app/assets/stylesheets/application.css.scss
Expand Up @@ -15,14 +15,19 @@ nav {
display: inline;
}
}

a {
text-decoration: none;
}
.container {
width: grid-width(7); // returns 520px;
margin: 0 auto;
}
#telephone_number {
float: right;
}
header {
margin-bottom: 20px;
}

@import "home";
@import "contact";
Expand Down
16 changes: 15 additions & 1 deletion app/assets/stylesheets/contact.css.scss
@@ -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);
}
3 changes: 3 additions & 0 deletions app/assets/stylesheets/downloads.css.scss
@@ -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/
8 changes: 5 additions & 3 deletions app/assets/stylesheets/home.css.scss
@@ -1,10 +1,12 @@
#my-slideshow {
margin-bottom: 30px;
margin-bottom: 20px;
// overflow: auto;
position: relative;
}

#window {
height: 400px;
height: 360px;
background: #111;
margin: 10px 0;
position: relative;
overflow: hidden;
h1 {
Expand Down
4 changes: 3 additions & 1 deletion app/assets/stylesheets/slider.css.scss
Expand Up @@ -60,7 +60,9 @@ a.bjqs-next{

ol.bjqs-markers{
position:absolute;
bottom:-50px;
// bottom:-50px;
bottom: 5px;
right: 5px;
}

ol.bjqs-markers li{
Expand Down
83 changes: 83 additions & 0 deletions app/controllers/downloads_controller.rb
@@ -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
4 changes: 2 additions & 2 deletions app/controllers/services_controller.rb
Expand Up @@ -44,7 +44,7 @@ def create

respond_to do |format|
if @service.save
format.html { redirect_to @service, notice: 'Service was successfully created.' }
format.html { redirect_to services_url, notice: 'Service was successfully created.' }
format.json { render json: @service, status: :created, location: @service }
else
format.html { render action: "new" }
Expand All @@ -60,7 +60,7 @@ def update

respond_to do |format|
if @service.update_attributes(params[:service])
format.html { redirect_to @service, notice: 'Service was successfully updated.' }
format.html { redirect_to services_url, notice: 'Service was successfully updated.' }
format.json { head :no_content }
else
format.html { render action: "edit" }
Expand Down
2 changes: 2 additions & 0 deletions app/helpers/downloads_helper.rb
@@ -0,0 +1,2 @@
module DownloadsHelper
end
3 changes: 3 additions & 0 deletions app/models/download.rb
@@ -0,0 +1,3 @@
class Download < ActiveRecord::Base
mount_uploader :file, FileUploader
end
4 changes: 4 additions & 0 deletions app/models/photo.rb
@@ -0,0 +1,4 @@
class Photo < ActiveRecord::Base
belongs_to :project
mount_uploader :image, ImageUploader
end
2 changes: 2 additions & 0 deletions app/models/project.rb
@@ -1,4 +1,6 @@
class Project < ActiveRecord::Base
extend FriendlyId
friendly_id :name, use: :slugged
has_many :videos
has_many :photos
end
3 changes: 3 additions & 0 deletions app/models/video.rb
@@ -0,0 +1,3 @@
class Video < ActiveRecord::Base
belongs_to :project
end
56 changes: 56 additions & 0 deletions app/uploaders/file_uploader.rb
@@ -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
60 changes: 60 additions & 0 deletions app/uploaders/image_uploader.rb
@@ -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

0 comments on commit f8157c0

Please sign in to comment.