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
1 parent
11b2aa9
commit 677c8d9
Showing
33 changed files
with
737 additions
and
59 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 |
---|---|---|
@@ -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 |
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 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 |
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 PlaylistsHelper | ||
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,2 @@ | ||
module TracksHelper | ||
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,2 @@ | ||
class Playlist < ActiveRecord::Base | ||
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,2 @@ | ||
class Track < ActiveRecord::Base | ||
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
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,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 %> |
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,6 @@ | ||
<h1>Editing playlist</h1> | ||
|
||
<%= render 'form' %> | ||
<%= link_to 'Show', @playlist %> | | ||
<%= link_to 'Back', playlists_path %> |
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,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 %> |
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,5 @@ | ||
<h1>New playlist</h1> | ||
|
||
<%= render 'form' %> | ||
<%= link_to 'Back', playlists_path %> |
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 @@ | ||
<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 %> |
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,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 %> |
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,6 @@ | ||
<h1>Editing track</h1> | ||
|
||
<%= render 'form' %> | ||
<%= link_to 'Show', @track %> | | ||
<%= link_to 'Back', tracks_path %> |
Oops, something went wrong.