-
Notifications
You must be signed in to change notification settings - Fork 151
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added Player table and scaffolding for Bandshell and hardware integra…
…tion
- Loading branch information
August
committed
Apr 18, 2012
1 parent
f715a54
commit 0729350
Showing
18 changed files
with
378 additions
and
36 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,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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
// Place all the styles related to the Players 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
body { | ||
background-color: #fff; | ||
color: #333; | ||
font-family: verdana, arial, helvetica, sans-serif; | ||
font-size: 13px; | ||
line-height: 18px; } | ||
|
||
p, ol, ul, td { | ||
font-family: verdana, arial, helvetica, sans-serif; | ||
font-size: 13px; | ||
line-height: 18px; } | ||
|
||
pre { | ||
background-color: #eee; | ||
padding: 10px; | ||
font-size: 11px; } | ||
|
||
a { | ||
color: #000; | ||
&:visited { | ||
color: #666; } | ||
&:hover { | ||
color: #fff; | ||
background-color: #000; } } | ||
|
||
div { | ||
&.field, &.actions { | ||
margin-bottom: 10px; } } | ||
|
||
#notice { | ||
color: green; } | ||
|
||
.field_with_errors { | ||
padding: 2px; | ||
background-color: red; | ||
display: table; } | ||
|
||
#error_explanation { | ||
width: 450px; | ||
border: 2px solid red; | ||
padding: 7px; | ||
padding-bottom: 0; | ||
margin-bottom: 20px; | ||
background-color: #f0f0f0; | ||
h2 { | ||
text-align: left; | ||
font-weight: bold; | ||
padding: 5px 5px 5px 15px; | ||
font-size: 12px; | ||
margin: -7px; | ||
margin-bottom: 0px; | ||
background-color: #c00; | ||
color: #fff; } | ||
ul li { | ||
font-size: 12px; | ||
list-style: square; } } |
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 PlayersController < ApplicationController | ||
# GET /players | ||
# GET /players.json | ||
def index | ||
@players = Player.all | ||
|
||
respond_to do |format| | ||
format.html # index.html.erb | ||
format.json { render json: @players } | ||
end | ||
end | ||
|
||
# GET /players/1 | ||
# GET /players/1.json | ||
def show | ||
@player = Player.find(params[:id]) | ||
|
||
respond_to do |format| | ||
format.html # show.html.erb | ||
format.json { render json: @player } | ||
end | ||
end | ||
|
||
# GET /players/new | ||
# GET /players/new.json | ||
def new | ||
@player = Player.new | ||
|
||
respond_to do |format| | ||
format.html # new.html.erb | ||
format.json { render json: @player } | ||
end | ||
end | ||
|
||
# GET /players/1/edit | ||
def edit | ||
@player = Player.find(params[:id]) | ||
end | ||
|
||
# POST /players | ||
# POST /players.json | ||
def create | ||
@player = Player.new(params[:player]) | ||
|
||
respond_to do |format| | ||
if @player.save | ||
format.html { redirect_to @player, notice: 'Player was successfully created.' } | ||
format.json { render json: @player, status: :created, location: @player } | ||
else | ||
format.html { render action: "new" } | ||
format.json { render json: @player.errors, status: :unprocessable_entity } | ||
end | ||
end | ||
end | ||
|
||
# PUT /players/1 | ||
# PUT /players/1.json | ||
def update | ||
@player = Player.find(params[:id]) | ||
|
||
respond_to do |format| | ||
if @player.update_attributes(params[:player]) | ||
format.html { redirect_to @player, notice: 'Player was successfully updated.' } | ||
format.json { head :no_content } | ||
else | ||
format.html { render action: "edit" } | ||
format.json { render json: @player.errors, status: :unprocessable_entity } | ||
end | ||
end | ||
end | ||
|
||
# DELETE /players/1 | ||
# DELETE /players/1.json | ||
def destroy | ||
@player = Player.find(params[:id]) | ||
@player.destroy | ||
|
||
respond_to do |format| | ||
format.html { redirect_to players_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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
module PlayersHelper | ||
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 Player < 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,33 @@ | ||
<%= form_for(@player) do |f| %> | ||
<% if @player.errors.any? %> | ||
<div id="error_explanation"> | ||
<h2><%= pluralize(@player.errors.count, "error") %> prohibited this player from being saved:</h2> | ||
|
||
<ul> | ||
<% @player.errors.full_messages.each do |msg| %> | ||
<li><%= msg %></li> | ||
<% end %> | ||
</ul> | ||
</div> | ||
<% end %> | ||
|
||
<div class="field"> | ||
<%= f.label :secret %><br /> | ||
<%= f.text_field :secret %> | ||
</div> | ||
<div class="field"> | ||
<%= f.label :ip_address %><br /> | ||
<%= f.text_field :ip_address %> | ||
</div> | ||
<div class="field"> | ||
<%= f.label :screen_id %><br /> | ||
<%= f.number_field :screen_id %> | ||
</div> | ||
<div class="field"> | ||
<%= f.label :activated %><br /> | ||
<%= f.check_box :activated %> | ||
</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 player</h1> | ||
|
||
<%= render 'form' %> | ||
<%= link_to 'Show', @player %> | | ||
<%= link_to 'Back', players_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,29 @@ | ||
<h1>Listing players</h1> | ||
|
||
<table> | ||
<tr> | ||
<th>Secret</th> | ||
<th>Ip address</th> | ||
<th>Screen</th> | ||
<th>Activated</th> | ||
<th></th> | ||
<th></th> | ||
<th></th> | ||
</tr> | ||
|
||
<% @players.each do |player| %> | ||
<tr> | ||
<td><%= player.secret %></td> | ||
<td><%= player.ip_address %></td> | ||
<td><%= player.screen_id %></td> | ||
<td><%= player.activated %></td> | ||
<td><%= link_to 'Show', player %></td> | ||
<td><%= link_to 'Edit', edit_player_path(player) %></td> | ||
<td><%= link_to 'Destroy', player, confirm: 'Are you sure?', method: :delete %></td> | ||
</tr> | ||
<% end %> | ||
</table> | ||
|
||
<br /> | ||
|
||
<%= link_to 'New Player', new_player_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 player</h1> | ||
|
||
<%= render 'form' %> | ||
<%= link_to 'Back', players_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 @@ | ||
<p id="notice"><%= notice %></p> | ||
|
||
<p> | ||
<b>Secret:</b> | ||
<%= @player.secret %> | ||
</p> | ||
|
||
<p> | ||
<b>Ip address:</b> | ||
<%= @player.ip_address %> | ||
</p> | ||
|
||
<p> | ||
<b>Screen:</b> | ||
<%= @player.screen_id %> | ||
</p> | ||
|
||
<p> | ||
<b>Activated:</b> | ||
<%= @player.activated %> | ||
</p> | ||
|
||
|
||
<%= link_to 'Edit', edit_player_path(@player) %> | | ||
<%= link_to 'Back', players_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
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,12 @@ | ||
class CreatePlayers < ActiveRecord::Migration | ||
def change | ||
create_table :players do |t| | ||
t.string :secret | ||
t.string :ip_address | ||
t.integer :screen_id | ||
t.boolean :activated | ||
|
||
t.timestamps | ||
end | ||
end | ||
end |
Oops, something went wrong.
0729350
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ahh! This needs to be an engine if it's going to exist at all as an special bridge between Screens -> Bandshell for the proper linux player so it doesn't turn into /hardware in Concerto 1. We should limit Concerto to code to things required to run the generic system across devices. If this can extend to manage all screens it should be part of the screen model not a separate thing.
Also, it would be useful to see some of the design of this before mode code rolls in....
0729350
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Well we don't have any design spec further than this table (which was stubbed so we can make Bandshell start working); we're assuming Andrew has plans for the rest of the hardware stuff. That said, this will probably only be relevant to player hardware, so I'll endeavor to refactor this into an engine...once I find out how to do that...
0729350
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
0729350
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That's a pain; does no one have a stable distribution and toolset anymore? Mike and I have only gone as far with the hardware management stuff as we need to be able to get a test box to pull content. We'll wait until all the details on the player environment have been hashed out before going any further there.