Permalink
Browse files

Merge branch 'master' of git@github.com:sudara/alonetone

  • Loading branch information...
2 parents 6d28179 + 626e8da commit d47f1dff28f7f448fc0107b64fb3e6b61e7d8568 @sudara committed Dec 21, 2008
View
2 app/controllers/features_controller.rb
@@ -33,7 +33,7 @@ def show
:commentable_id => @feature.id
)
- @comments = @feature.comments.find(:all, :limit => 10)
+ @comments = @feature.comments.include_private.find(:all)
@page_title = "Featured Artist: #{@user.name}"
View
8 app/controllers/pages_controller.rb
@@ -2,7 +2,11 @@
class PagesController < ApplicationController
- class Fuck < StandardError; end
+ class Hell < StandardError; end
+
+ def twentyfour
+ render :layout => '24houralbum'
+ end
def index
@page_title = "About alonetone, the kickass home for musicians"
@@ -43,7 +47,7 @@ def actually_going_somewhere_with_facebooker_and_rails
end
def answers
- raise Fuck
+ raise Hell
end
def not_yet
View
27 app/helpers/pages_helper.rb
@@ -12,5 +12,32 @@ def w3c_date(date)
date.utc.strftime("%Y-%m-%dT%H:%M:%S+00:00")
end
+ def twenty_four(permalink, type)
+ album = type == :playlist ? grab_playlist(permalink) : grab_track(permalink)
+ result = '<div class="album">'
+ result += link_to image_tag(album[:image]), album[:link], :class => 'pic'
+ result += link_to album[:title], album[:link], :class => 'album_title'
+ result += link_to album[:username], album[:link], :class => 'artist_name'
+ result += '</div>'
+ result
+ rescue
+ ''
+ end
+
+ def grab_playlist(permalink)
+ playlist = Playlist.find_by_permalink(permalink)
+ { :image => playlist.cover(:small),
+ :link => user_playlist_path(playlist.user, playlist.permalink),
+ :username => playlist.user.name,
+ :title => playlist.title}
+ end
+
+ def grab_track(permalink)
+ track = Asset.find_by_permalink(permalink)
+ { :image => track.user.avatar(:small),
+ :link => user_track_path(track.user, track.permalink),
+ :username => track.user.name,
+ :title => track.name}
+ end
end
View
5 app/views/features/show.html.erb
@@ -62,5 +62,8 @@
<%= render :partial => 'featured_tracks'%>
<%= render :partial => 'users/mostly_listens_to' if @feature.featured_user.has_tracks? %>
- <%= render :partial => 'shared/comment', :collection => @comments %>
+ <h2 class="box">Comments</h2>
+ <% @single_track = true %>
+ <%= render :partial => 'shared/comment', :collection => @comments %>
+
<% end %>
View
54 app/views/layouts/24houralbum.html.erb
@@ -0,0 +1,54 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml">
+ <head>
+ <meta http-equiv="Content-type" content="text/html; charset=utf-8" />
+ <title>The 24 hour album 2008</title>
+ <link type="text/css" rel="stylesheet" media="screen" href="/stylesheets/24houralbum.css">
+ <link rel="shortcut icon" href="/favicon.ico" type="image/x-icon" />
+ <meta content="index,follow" name="robots"/>
+ <meta content="24 hour album. alonetone musicians write 24 minutes of music in 24 hours" name="Description"/>
+ <meta content="alonetone 24hour 24 hour album music EP" name="Keywords" />
+ </head>
+ <body>
+
+ <div id="wrapper">
+ <div id="left-background">
+ </div>
+
+ <div id="content">
+ <a id="back-to-alonetone" href="/">
+ </a>
+ <div id="albums">
+ <div id="dec6" class="date"></div>
+ <div class="columns clearfix">
+ <%= yield :dec6thalbums %>
+
+ </div>
+
+ <div id="dec13" class="date"></div>
+ <div class="columns clearfix">
+ <%= yield :dec13thalbums %>
+ </div>
+
+ <div id="betterlate" class="date"></div>
+
+ <div class="columns text clearfix">
+ Excited by the idea? Don't worry, you didn't miss the boat. There was no boat.
+
+ You can still do a 24 hour album and get it listed here. Just give Sudara a
+ heads up on <%= link_to 'the 24 hour album features page', '/features/24houralbum' %>
+ and we'll link up your album here.
+ </div>
+ </div>
+
+
+ </div>
+ <div id="footer">
+
+ </div>
+ </div>
+
+
+ </body>
+</html>
View
184 app/views/pages/_facebooker.html.haml
@@ -1,184 +0,0 @@
-=pretty_text 'Facebook and the rails facebooker plugin', :h1
-
-%h2.spacey
- How to actually use it and do something useful
-
-#static
- %p
- Ok, so this isn't a complete how-to, or a all-inclusive guide, but hopefully it should cover the basics, and explain the tougher bits. Unfortunately developing for facebook doesn't (to me) feel as easy as it could. Facebook themselves went ahead and took the liberty of inventing, uhm, 4 Domain Specific Lanugages that you have to learn and then the facebooker library itself abstracts the real API calls into ruby-friendly goodness, bringing the total amount of information to absorb fairly high.
-
- %p
- Thanks to recent work by the facebooker crew (Mike Mangino seems on top of it), integration with rails is relatively painless.
-
- %p
- I'm not going to take you on the 'how facebook works' ride. You can hop on that somewhere else.
- %p
- Oh, and this is for Rails 2.0.2 and facebooker as of January 2008. So, if you are in the future, maybe some stuff has changed (silver suits, melted icecaps, flying cars)
-
- %h1
- facebook
- %p
- Get on facebook. Add the developer application, and create a new facebook app. Edit the settings. They look like this:
-
- =image_tag 'http://img.skitch.com/20080126-migbj41h66ag1wmi6y5xhaufrp.jpg'
-
- %p
- Note the Callback Url. See how it is your domain there? Good. Keep it like that. If you are coming from rFacebook to facebooker, don't freak out, you want your plain jane domain there, bub.
-
-
- %h1
- On rails
- %pre.code
- script/plugin install http://facebooker.rubyforge.org/svn/trunk/facebooker/
-
- %p
- Get your rails app going (either a baby fresh new one, or one you wish to integrate with facebook)
-
-You'll get a file called facebooker.yml
-
-
- %h1
- Routes
-
- %p
- Ok. Let's start with routes. Pretend you built your app already. Wow, that was easy. Ok, now, someone added your application and is cruising your app inside facebook. They are digging it. Lets say you give them the ability to edit their profile for the app.
-
- %p
- Did you work with rFacebook before? Then get this in your skull - don't try and play with callback_paths, canvas_paths, etc. Forget about it. It is easy. All incoming calls from facebook are going to hit the root of your site. What you say? You already have other stuff mapped to root? Yeah, cool. But not other FACEBOOK stuff mapped to root, and so there is no need to worry. facebooker does a great job at seperating normal calls from facebook calls, so don't worry if you are overlapping your mapping.
-
- %p
- Now wait. We are using rails. facebooker is hot. It tries its best to let you forget about the hard stuff and just write rails code.
-
- %p
- So, try this out in routes.rb
- %pre.code
- map.resources :profiles, :conditions=>{:canvas=>true}
-
- %p
- Yum! That looks familiar. That will give us create, update, destroy, and all that other stuff. That will generate fake restful routes. Fake? Fake because really facebook only will issue POSTs to your app. Restful because uhmm....they fake you out and look restful. Silly, but hey, easy to remember. Actually, forget I said anything. They are restful, ok? The only way this differs in reality from real rails restful routes (rrrrrr!) is that you are adding a condition: Canvas has to be true before this route will do anything for you. Where you do set canvas? Nowhere, facebooker handles that part. Just remember...if you want a route to respond to in-canvas calls, add the condition. If you want the route to respond to regular rails calls, uhm, just keep doing your thing as you normally would.
-
- %p
- Ok, wait. There is one other difference with facebook routes. Because they only WANT TO BE restful, we can't use the same exact url helpers in all cases. Instead, we have to be a bit more explicit. So, if you want to get the url for deleting a profile it is destroy_profile_path(@profile). Get it? Here is an example:
-
- %pre.code
- new_profile POST /profiles/new {:controller=>"profiles", :action=>"new"}
- profiles POST /profiles/index {:controller=>"profiles", :action=>"index"}
- show_profile POST /profiles/:id/show {:controller=>"profiles", :action=>"show"}
- create_profile POST /profiles/create {:controller=>"profiles", :action=>"create"}
- edit_profile POST /profiles/:id/edit {:controller=>"profiles", :action=>"edit"}
- update_profile POST /profiles/:id/update {:controller=>"profiles", :action=>"update"}
- destroy_profile POST /profiles/:id/destroy {:controller=>"profiles", :action=>"destroy"}
-
-Now remember, this call to map.resources ain't no hack, so you can do all your same fancy tricks as always, such as:
-
- map.resources 'facebook', :controller => 'facebook_accounts', :member => {:add_thingy_to_profile => :post}, :collection => {:search => :get}, :conditions =>{:canvas => true}
-
-Oh, and normal routes work fine. For example, this might be a good time to map the root of your app to a facebook-friendly controller.
-
- map.facebook_home 'facebook_home', :controller => 'facebook_accounts', :action => 'index', :canvas => true
-
-
-Controller stuff
-
-Ok, so in the controller, you get two before filters. They are:
-
- ensure_authenticated_to_facebook
- ensure_application_is_installed_by_facebook_user
-
-I'm not going to explain what they are because I know how smart you are. It is strange because you don't see 'before_filter' there, but don't worry, you can still do this:
-
- ensure_authenticated_to_facebook :only => [:create, :update, :destroy]
-
-Ok, I will explain, just in case you are new. What happens with that before filter? If the user does not have the app installed, a magic redirect to login and/or install your application will occur.
-
-What if you just want to check if the user has the app installed, but NOT redirect. You know, peep the situation a bit. Maybe you allow everyone to visit your facebook app's main page, but want to display special stuff for those that have installed your app:
-
- application_is_installed?
-
-Everything you need is in the session
-
-I'll repeat that. All fancy dancy calls you need to make to the facebook API you are going to do from the session. Like so:
-
-Want to grab the friends of the current user?
-
- @current_friends = session[:facebook_session].user.friends!
-
-The friends! method (with exclamation) will not only grab the friends, but grab the friends info (name, etc) and cache it in memory because it knows how often you need to check to see if you have friends, remember where they live, and remember how many you have.
-
-Wont to set the user's profile?
-
- session[:facebook_session].user.profile_fbml = 'put some fbml or a render :partial call here'
-
-redirects are smart (of course), so you can do
-
- redirect_to facebook_user_path
-
-it knows if you are in the facebook canvas (aka, your app is running within facebook) to redirect to a proper in-canvas url (like http://apps.facebook.com/yourapp/facebook_user/345 )
-
-Useful things
-
-You probably want to save some of the facebook junk inside your trunk.
-
-Well, you are going to need a big trunk. Facebook has a lot of users, and you'll need to get all BIGINT on it if you want to store facebook ids in your DB.
-
-As far as I know, facebooker doesn't help you out with models. I think it should be kept that way. Personally, my users are my users, and my facebook_users are my facebook_users.
-
-Anywho, like I said, make you BIGINT the DB column that is storing the facebook user id. Add the following to a migration, but make sure you specify whatever table and column YOU are using. You probably have something more sane than 'fb_user_id' as your column name, right?
-
-execute("alter table facebook_accounts modify fb_user_id bigint")
-
-
-Views
-
-Same story. Rails is smart, facebooker is smart. What do you want to generate when inside the facebook canvas? FBML. Ok, so name your views like so:
-
-profile.fbml.erb
-
-or if you are funky and like HAML
-
-profile.fbml.haml
-
-rFacebook users, don't flinch. You don't need to do a single other thing (like set a before filter or manually set the format, or any of the Giant Robots rFacebook tutorial stuff). Just name your views right.
-
-In the views, link_to will detect if you are in facebook canvas or not and write the appropriate path. Same with image_tag. If you are running a normal rails app together with facebook stuff....no worries, it is smart, like we said. It won't touch your link_to, buddy.
-
-There are a handful of special view helpers to help you avoid dealing with FBML. Most notably, facebook_form_for, fb_profile_pic...uhm...fb_pronoun...yeah, the list goes on, check Facebooker::Rails::Helpers and don't try and write all that FBML bullshit by yourself. Use ruby, dude(ette). Actually, do FBML if you like that. It is your choice - poke around the facebook documentation and write FBML or poke around rdoc (yuk) and write rubyish things.
-
-Flash Messages
-
-If you know rails, you know flash[:error] and flash[:notice]
-
-Use those as normal in your controller, and place this in your views:
-
- <%= facebook_messages %>
-
-You may find yourself backing away from using link_to, and using url_for more often because of the way facebook demands forms and stuff like that. Please note that if the page being rendered is being rendered in canvas, you will always get your canvas_path prepended to the url. Say that ten times fast. That means link_to is always going to keep you in the canvas, and won't let you link to your main rails app or anywhere outside of http://apps.facebook.com/yourappname. If you DO want to escape the jail that the facebook canvas is (for example linking to an external file, a download, whatever) then you can use the option :canvas => false like so:
-
-url_for :controller => 'blah', :action 'blee', :canvas => false
-
-One strange thing about the facebook_form_for is that it is a bit unintuitive if you want to build an url from a hash (not a helper):
-
- facebook_form_for :asset, asset, :url => (url_for(:controller => 'profile', :action => 'add_to_profile', :id => asset.id))
-
-Didn't quite get why it is like that. The code seems to say that whatever goes to the :url option gets passed directly to the form action.
-
-Try it out, the smart way
-
-The facebooker rails plugin also comes with a tunnel task. rFacebook folks know about this: facebook has it too, don't worry. If you are new, listen up, this is a big deal: This lets you develop your facebook app locally, but view and test out your app live on apps.facebook.com. Get it? You don't have to deploy anything, though you do need to have a production server setup somewhere and then generate this config file.
-
- rake facebooker:tunnel:configure to create a blank config in config/tunnel.yml
-
-Edit that file, then run
-
- rake facebooker:tunnel:start
-
-What this does is route all requests from your production server to your local machine. A proxy. It means, when facebook comes asking for something, your little localhost-that-could is serving it what it needs.
-
-For this to work, you need to go and edit your facebook application's settings (on facebook itself) and make sure the callback url to be http://yourpublicsite.com:8888 like I did -replace the 8888 with whatever port you want to be using. Also, you may want to change the ssh timeout on your server so that it can just hang there forever. Otherwise you may get booted from the server if you wait a whole gosh darn 2 minutes between requests.
-
-Nothing to do with shame, but indeed a pliggity plug
-
-Hey, I learned facebooker and wrote this article to do one thing. Build my baby. http://alonetone.com It is a home for musicians to upload their music and easily share it. Musicians are kinda screwed these days and being taken advantage for left and right. This is an alternative to the sketchy other musician homes out there. It costs them nothing, and yet music makers get everything they need (and nothing they don't need). We don't run ads, it is built by a musician (me) and is non-commercial (I'm personally losing money).
-
-If this article helped you out, do me a favor and the next time a musician friend asks you where s/he can upload their stuff, tell them alonetone.com will give them a good home.
-
View
23 app/views/pages/twentyfour.html.erb
@@ -0,0 +1,23 @@
+<% content_for :dec6thalbums do %>
+ <%= twenty_four('24-hours-of-staying-foolish', :playlist) %>
+ <%= twenty_four('dystopioid-the-24-hour-project', :playlist) %>
+ <%= twenty_four('the-loathsome-terrace-recordings', :playlist) %>
+ <%= twenty_four('oh-crap-ep', :playlist) %>
+ <%= twenty_four('montgomeru-family-fortunes', :track) %>
+ <%= twenty_four('brando24', :track) %>
+ <%= twenty_four('24-hours-of-aargh', :playlist) %>
+<% end %>
+
+
+
+<% content_for :dec13thalbums do %>
+
+ <%= twenty_four('kavin-121308', :playlist)%>
+ <%= twenty_four('now-is-the-winter-of-our-disconnect', :playlist)%>
+ <%= twenty_four('timespace',:playlist)%>
+ <%= twenty_four("24-lives-to-die", :playlist)%>
+ <%= twenty_four('24-hour-party-person', :playlist)%>
+ <%= twenty_four('sudaras-24',:track) %>
+ <%= twenty_four('diminishing-returns-24hr-ep', :playlist)%>
+ <%= twenty_four('practice-makes-perfect-ep-24-hours-of-work', :track)%>
+<% end %>
View
2 app/views/shared/_comment.html.erb
@@ -1,6 +1,6 @@
<% if not @single_track and comment.commentable_type == 'Asset'%>
<%= render :partial => 'assets/asset', :locals => { :asset => comment.commentable}%>
-<% else %>
+<% elsif not @single_track %>
<h2 class="box comment_header"><%= link_for_comment(comment) %></h2>
<% end %>
View
4 config/routes.rb
@@ -18,8 +18,8 @@
map.sitemap 'sitemap.xml', :controller => 'pages', :action => 'sitemap', :format => 'xml'
map.about 'about/:action', :controller => 'pages'
map.halp 'about/halp/:action', :controller => 'pages'
-
- map.logged_exceptions 'logged_exceptions/:action/:id', :controller => 'logged_exceptions'
+
+ map.twentyfour '24houralbum', :controller => 'pages', :action => 'twentyfour'
# You can have the root of your site routed by hooking up ''
# -- just remember to delete public/index.html.
View
BIN public/images/24hour/24-hour-album-background.jpg
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View
BIN public/images/24hour/24h-album-04.jpg
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View
BIN public/images/24hour/Adhoc.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View
BIN public/images/24hour/album-background-large-over.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View
BIN public/images/24hour/album-background-large.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View
BIN public/images/24hour/album-background.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View
BIN public/images/24hour/background-left.jpg
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View
BIN public/images/24hour/background-right.jpg
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View
BIN public/images/24hour/betterlatethannever.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View
BIN public/images/24hour/commentswelcome.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View
BIN public/images/24hour/december13th.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View
BIN public/images/24hour/december6th.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View
BIN public/images/24hour/history.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View
149 public/stylesheets/24houralbum.css
@@ -0,0 +1,149 @@
+html, body, div, span, applet, object, iframe,
+h1, h2, h3, h4, h5, h6, p, blockquote, pre,
+a, abbr, acronym, address, big, cite, code,
+del, dfn, em, font, img, ins, kbd, q, s, samp,
+small, strike, strong, sub, sup, tt, var,
+dl, dt, dd, ol, ul, li,
+fieldset, form, label, legend,
+table, caption, tbody, tfoot, thead, tr, th, td {
+ margin: 0;
+ padding: 0;
+ border: 0;
+ outline: 0;
+ font-weight: inherit;
+ font-style: inherit;
+ font-size: 100%;
+ font-family: inherit;
+ vertical-align: baseline;
+}
+:focus {
+ outline: 0;
+}
+body {
+ line-height: 1;
+ font-family: Helvetica, Arial, Geneva, sans-serif;
+ background-color: #1e1918;
+ background: url(../images/24hour/background-right.jpg) repeat-x top left;
+ color: #e9e2d3;
+}
+
+a, a:hover, a:visited{
+ color: #e9e2d3;
+ text-decoration:none;
+}
+
+
+#wrapper{
+ position: relative;
+ width: 100%;
+ text-align: center;
+ background-color: #1e1918;
+}
+
+#content{
+ width: 100%;
+ background: #1e1918 url(../images/24hour/24-hour-album-background.jpg) no-repeat center top;
+ float: left;
+ text-align: center;
+ margin: auto;
+}
+a#back-to-alonetone{
+ height: 200px;
+ width:200px;
+ display:block;
+ margin:0 auto;
+}
+#albums{
+ width: 1011px;
+ position: relative;
+ margin: auto;
+ margin-top: 210px;
+}
+div.columns{
+ width: 1011px;
+ position: relative;
+ float: none;
+ text-align: left;
+ clear:both;
+ margin-bottom: 25px;
+ margin-left: 25px;
+}
+.columns.text{
+ width: 600px;
+ line-height: 20px;
+}
+.columns.text a{
+ text-decoration: underline;
+}
+div.album{
+ width: 445px;
+ height: 50px;
+ margin-right: 25px;
+ margin-bottom: 21px;
+ text-align: left;
+ background: url(../images/24hour/album-background-large-over.png) no-repeat right top;
+ float: left;
+ position:relative;
+}
+a.pic{
+ width:50px;
+ height:50px;
+ float:left;
+ display:block;
+ margin-right:10px;
+}
+div.date{
+ margin-bottom: 27px;
+ height: 27px;
+ clear: both;
+}
+
+div#dec6{
+ background: url(../images/24hour/december6th.png) no-repeat;
+}
+div#dec13{
+ background: url(../images/24hour/december13th.png) no-repeat;
+}
+div#betterlate{
+ background: url(../images/24hour/betterlatethannever.png) no-repeat;
+}
+.album-photo{
+ height: 50px;
+ width: 50px;
+}
+a.album_title{
+ font-weight: bold;
+ font-size: 18px;
+ line-height:28px;
+ margin-top: 4px;
+ display:block;
+}
+a.artist_name{
+ font-size: 12px;
+ line-height: 10px;
+ display:block;
+}
+
+
+#footer{
+ height: 100px;
+}
+
+
+
+.clearfix:after {
+ clear: both;
+ content: ".";
+ display: block;
+ height: 0pt;
+ line-height: 0pt;
+ visibility: hidden; }
+
+.clearfix {
+ display: inline-block; }
+
+html[xmlns] .clearfix {
+ display: block; }
+
+* html .clearfix {
+ height: 1%; }
View
5 public/stylesheets/sass/alonetone.sass
@@ -218,7 +218,7 @@
:padding 0px 20px 30px 0px
:margin-bottom 3px
:margin-left 72px
- a
+ a, a:visited, a:hover
:color = !white
:text-shadow #000 1px 1px 1px
p
@@ -229,7 +229,8 @@
:margin-top 13px
.comment_controls
:float right
- a
+ a, a:visited, a:hover
+ :color = !white
:font-size 11px
:font-weight normal
h1,h2,h3
View
1 vendor/plugins/haml/init.rb
@@ -4,4 +4,5 @@
require 'haml' # From gem
end
+# Load Haml and Sass
Haml.init_rails(binding)

0 comments on commit d47f1df

Please sign in to comment.