Skip to content

Commit

Permalink
facebook integrated
Browse files Browse the repository at this point in the history
  • Loading branch information
martyndavies committed Jun 22, 2011
1 parent 11b2aa9 commit 677c8d9
Show file tree
Hide file tree
Showing 33 changed files with 737 additions and 59 deletions.
83 changes: 83 additions & 0 deletions app/controllers/playlists_controller.rb
@@ -0,0 +1,83 @@
class PlaylistsController < ApplicationController
# GET /playlists
# GET /playlists.xml
def index
@playlists = Playlist.all

respond_to do |format|
format.html # index.html.erb
format.xml { render :xml => @playlists }
end
end

# GET /playlists/1
# GET /playlists/1.xml
def show
@playlist = Playlist.find(params[:id])

respond_to do |format|
format.html # show.html.erb
format.xml { render :xml => @playlist }
end
end

# GET /playlists/new
# GET /playlists/new.xml
def new
@playlist = Playlist.new

respond_to do |format|
format.html # new.html.erb
format.xml { render :xml => @playlist }
end
end

# GET /playlists/1/edit
def edit
@playlist = Playlist.find(params[:id])
end

# POST /playlists
# POST /playlists.xml
def create
@playlist = Playlist.new(params[:playlist])

respond_to do |format|
if @playlist.save
format.html { redirect_to(@playlist, :notice => 'Playlist was successfully created.') }
format.xml { render :xml => @playlist, :status => :created, :location => @playlist }
else
format.html { render :action => "new" }
format.xml { render :xml => @playlist.errors, :status => :unprocessable_entity }
end
end
end

# PUT /playlists/1
# PUT /playlists/1.xml
def update
@playlist = Playlist.find(params[:id])

respond_to do |format|
if @playlist.update_attributes(params[:playlist])
format.html { redirect_to(@playlist, :notice => 'Playlist was successfully updated.') }
format.xml { head :ok }
else
format.html { render :action => "edit" }
format.xml { render :xml => @playlist.errors, :status => :unprocessable_entity }
end
end
end

# DELETE /playlists/1
# DELETE /playlists/1.xml
def destroy
@playlist = Playlist.find(params[:id])
@playlist.destroy

respond_to do |format|
format.html { redirect_to(playlists_url) }
format.xml { head :ok }
end
end
end
83 changes: 83 additions & 0 deletions app/controllers/tracks_controller.rb
@@ -0,0 +1,83 @@
class TracksController < ApplicationController
# GET /tracks
# GET /tracks.xml
def index
@tracks = Track.all

respond_to do |format|
format.html # index.html.erb
format.xml { render :xml => @tracks }
end
end

# GET /tracks/1
# GET /tracks/1.xml
def show
@track = Track.find(params[:id])

respond_to do |format|
format.html # show.html.erb
format.xml { render :xml => @track }
end
end

# GET /tracks/new
# GET /tracks/new.xml
def new
@track = Track.new

respond_to do |format|
format.html # new.html.erb
format.xml { render :xml => @track }
end
end

# GET /tracks/1/edit
def edit
@track = Track.find(params[:id])
end

# POST /tracks
# POST /tracks.xml
def create
@track = Track.new(params[:track])

respond_to do |format|
if @track.save
format.html { redirect_to(@track, :notice => 'Track was successfully created.') }
format.xml { render :xml => @track, :status => :created, :location => @track }
else
format.html { render :action => "new" }
format.xml { render :xml => @track.errors, :status => :unprocessable_entity }
end
end
end

# PUT /tracks/1
# PUT /tracks/1.xml
def update
@track = Track.find(params[:id])

respond_to do |format|
if @track.update_attributes(params[:track])
format.html { redirect_to(@track, :notice => 'Track was successfully updated.') }
format.xml { head :ok }
else
format.html { render :action => "edit" }
format.xml { render :xml => @track.errors, :status => :unprocessable_entity }
end
end
end

# DELETE /tracks/1
# DELETE /tracks/1.xml
def destroy
@track = Track.find(params[:id])
@track.destroy

respond_to do |format|
format.html { redirect_to(tracks_url) }
format.xml { head :ok }
end
end
end
2 changes: 2 additions & 0 deletions app/helpers/playlists_helper.rb
@@ -0,0 +1,2 @@
module PlaylistsHelper
end
2 changes: 2 additions & 0 deletions app/helpers/tracks_helper.rb
@@ -0,0 +1,2 @@
module TracksHelper
end
2 changes: 2 additions & 0 deletions app/models/playlist.rb
@@ -0,0 +1,2 @@
class Playlist < ActiveRecord::Base
end
2 changes: 2 additions & 0 deletions app/models/track.rb
@@ -0,0 +1,2 @@
class Track < ActiveRecord::Base
end
21 changes: 15 additions & 6 deletions app/views/home/index.html.erb
Expand Up @@ -20,10 +20,19 @@
</ul>
</div>
<div id="returned-info">
<div class="infobox">Who: <span class="artistname"></span></div>
<div class="infobox">Kickin' it since: <span class="years_active"></span></div>
<div class="infobox">Spotify: <span class="spotifylink"></span></div>
<div class="infobox">Links
<ul class="listoflinks"></ul>
</div>
<div id="first-three">
<div class="infobox">Who: <span class="artistname"></span></div>
<div class="infobox">Kickin' it since: <span class="years_active"></span></div>
<div class="infobox">Genre: <span class="genre"></span></div>
</div>
<div id="second-three">
<div class="infobox">Facebook: <span class="facebook"></span></div>
<div class="infobox">7Digital: <span class="7digital"></span></div>
<div class="infobox">Spotify: <span class="spotifylink"></span></div>
</div>
<div id="final">
<div class="infobox">Links:
<ul class="listoflinks"></ul>
</div>
</div>
</div>
38 changes: 23 additions & 15 deletions app/views/layouts/application.html.erb
@@ -1,25 +1,31 @@
<!DOCTYPE html>
<html>
<head>
<title>TrackChat</title>
<title>TrackChattr</title>
<%= stylesheet_link_tag :all %>
<%= javascript_include_tag :defaults, "trackchat", "soundmanager2" %>
<script type="text/javascript" src="http://use.typekit.com/npg1zce.js"></script>
<script type="text/javascript">try{Typekit.load();}catch(e){}</script>
<%= javascript_include_tag :defaults, "trackchat", "soundmanager2" %>
<%= csrf_meta_tag %>
</head>
<body>
<div id="header">
<div id="header-stuff">
<% if current_user %>
<span class="welcome">Welcome <%= current_user.name %>!
<%= link_to "Sign Out", signout_path, :class => "link" %></span>
<%else%>
<span class="welcome"></span>
<% end %>
<span>
<h1>TrackChat</h1>
<h2>Music recommendations based on idle chatter!</h2>
<div id="welcome-container">
<div id="login">
<% if current_user %>
<span class="welcome">Welcome <%= current_user.name %>!
<%= link_to "Sign Out", signout_path, :class => "link" %></span>
<%else%>
<span class="welcome"></span>
<% end %>
</div>
</div>
<div id="logo">
<h1>TrackChattr</h1>
<h2>Music recommendations based on idle chatter!</h2>
</div>
</div>
</div>

Expand All @@ -33,10 +39,12 @@
<% else %>
<%= yield %>
<% end %>
<div id="about">
<div id="createdby">Created by <a href="http://www.twitter.com/martynrdavies">@martynrdavies</a> | &copy; <a href="http://www.sixtwoproductions.co.uk">Six Two Productions</a></div>
<div id="logos">Built with <a href="http://the.echonest.com">Echonest</a>, <a href="http://www.twitter.com">Twitter</a>, Ruby on Rails and jQuery</div>
</div>

</div>
<div id="about">
<div id="createdby">Created by <a href="http://www.twitter.com/martynrdavies">@martynrdavies</a> | &copy; <a href="http://www.sixtwoproductions.co.uk">Six Two Productions</a>, Built with <a href="http://the.echonest.com">Echonest</a>, <a href="http://www.twitter.com">Twitter</a>, Ruby on Rails and jQuery</div>

<div id="logos"><div id="facebook"><div id="fb-root"></div><script src="http://connect.facebook.net/en_US/all.js#xfbml=1"></script><fb:like href="http://trackchat.heroku.com" send="true" width="450" show_faces="false" font="segoe ui"></fb:like></div></div>
</div>

<script type="text/javascript">
Expand Down
25 changes: 25 additions & 0 deletions app/views/playlists/_form.html.erb
@@ -0,0 +1,25 @@
<%= form_for(@playlist) do |f| %>
<% if @playlist.errors.any? %>
<div id="error_explanation">
<h2><%= pluralize(@playlist.errors.count, "error") %> prohibited this playlist from being saved:</h2>

<ul>
<% @playlist.errors.full_messages.each do |msg| %>
<li><%= msg %></li>
<% end %>
</ul>
</div>
<% end %>

<div class="field">
<%= f.label :name %><br />
<%= f.text_field :name %>
</div>
<div class="field">
<%= f.label :belongs_to %><br />
<%= f.text_field :belongs_to %>
</div>
<div class="actions">
<%= f.submit %>
</div>
<% end %>
6 changes: 6 additions & 0 deletions app/views/playlists/edit.html.erb
@@ -0,0 +1,6 @@
<h1>Editing playlist</h1>

<%= render 'form' %>
<%= link_to 'Show', @playlist %> |
<%= link_to 'Back', playlists_path %>
25 changes: 25 additions & 0 deletions app/views/playlists/index.html.erb
@@ -0,0 +1,25 @@
<h1>Listing playlists</h1>

<table>
<tr>
<th>Name</th>
<th>Belongs to</th>
<th></th>
<th></th>
<th></th>
</tr>

<% @playlists.each do |playlist| %>
<tr>
<td><%= playlist.name %></td>
<td><%= playlist.belongs_to %></td>
<td><%= link_to 'Show', playlist %></td>
<td><%= link_to 'Edit', edit_playlist_path(playlist) %></td>
<td><%= link_to 'Destroy', playlist, :confirm => 'Are you sure?', :method => :delete %></td>
</tr>
<% end %>
</table>

<br />

<%= link_to 'New Playlist', new_playlist_path %>
5 changes: 5 additions & 0 deletions app/views/playlists/new.html.erb
@@ -0,0 +1,5 @@
<h1>New playlist</h1>

<%= render 'form' %>
<%= link_to 'Back', playlists_path %>
15 changes: 15 additions & 0 deletions app/views/playlists/show.html.erb
@@ -0,0 +1,15 @@
<p id="notice"><%= notice %></p>

<p>
<b>Name:</b>
<%= @playlist.name %>
</p>

<p>
<b>Belongs to:</b>
<%= @playlist.belongs_to %>
</p>


<%= link_to 'Edit', edit_playlist_path(@playlist) %> |
<%= link_to 'Back', playlists_path %>
37 changes: 37 additions & 0 deletions app/views/tracks/_form.html.erb
@@ -0,0 +1,37 @@
<%= form_for(@track) do |f| %>
<% if @track.errors.any? %>
<div id="error_explanation">
<h2><%= pluralize(@track.errors.count, "error") %> prohibited this track from being saved:</h2>

<ul>
<% @track.errors.full_messages.each do |msg| %>
<li><%= msg %></li>
<% end %>
</ul>
</div>
<% end %>

<div class="field">
<%= f.label :artist %><br />
<%= f.text_field :artist %>
</div>
<div class="field">
<%= f.label :title %><br />
<%= f.text_field :title %>
</div>
<div class="field">
<%= f.label :belongs_to_playlist %><br />
<%= f.text_field :belongs_to_playlist %>
</div>
<div class="field">
<%= f.label :artist_echonest_id %><br />
<%= f.text_field :artist_echonest_id %>
</div>
<div class="field">
<%= f.label :track_echonest_id %><br />
<%= f.text_field :track_echonest_id %>
</div>
<div class="actions">
<%= f.submit %>
</div>
<% end %>
6 changes: 6 additions & 0 deletions app/views/tracks/edit.html.erb
@@ -0,0 +1,6 @@
<h1>Editing track</h1>

<%= render 'form' %>
<%= link_to 'Show', @track %> |
<%= link_to 'Back', tracks_path %>

0 comments on commit 677c8d9

Please sign in to comment.