-
Notifications
You must be signed in to change notification settings - Fork 0
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
Chris
committed
Jan 18, 2011
1 parent
0c5f019
commit 1b4625a
Showing
34 changed files
with
630 additions
and
48 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,2 @@ | ||
class BlogsController < ApplicationController | ||
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 |
---|---|---|
@@ -1,7 +1,22 @@ | ||
class GeronimoController < ApplicationController | ||
|
||
def index | ||
@latest_front_page_blogpost = Blog.latest_for_frontpage.blogtext | ||
render :layout => false | ||
blog = Blog.latest_for_frontpage | ||
@latest_front_page_blogpost = blog ? blog.blogtext : "Nothing to say" | ||
@next_show = Show.next_show | ||
render :layout => false | ||
end | ||
|
||
def shows | ||
@page_name = "Shows" | ||
@upcoming_shows = Show.upcoming_shows | ||
@past_shows = Show.past_shows | ||
render :layout => 'g_application' | ||
end | ||
|
||
def blogs | ||
@page_name = "Says Things" | ||
@blogs = Blog.order("created_at DESC") | ||
render :layout => 'g_application' | ||
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
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,13 @@ | ||
class ShowsController < ApplicationController | ||
|
||
def show | ||
@show = Show.find(params[:id]) | ||
end | ||
|
||
def destroy | ||
redirect_to root_path unless signed_in? | ||
@show = Show.find(params[:id]) | ||
@show.destroy | ||
redirect_to all_shows_path, :flash => { :success => "Micropost deleted!" } | ||
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 BlogsHelper | ||
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 ShowsHelper | ||
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,82 @@ | ||
# == Schema Information | ||
# Schema version: 20110113205037 | ||
# | ||
# Table name: shows | ||
# | ||
# id :integer not null, primary key | ||
# showtext :text | ||
# showdate :date not null | ||
# created_at :datetime | ||
# updated_at :datetime | ||
# | ||
|
||
class Show < ActiveRecord::Base | ||
|
||
class << self | ||
|
||
def next_show() | ||
Show.where("showdate > ?", DateTime.now.next_day(-1)).order("showdate ASC").first | ||
end | ||
|
||
def upcoming_shows() | ||
Show.where("showdate > ?", DateTime.now.next_day(-1)).order("showdate ASC") | ||
end | ||
|
||
def past_shows() | ||
Show.where("showdate < ?", Date.today).order("showdate DESC") | ||
end | ||
|
||
def new_from_post(post) | ||
Show.new do |show| | ||
if(is_show_post?(post)) | ||
show.showdate = get_date(post) | ||
show.showtext = get_show_text post | ||
else | ||
raise "#{post} isn't a show post" | ||
end | ||
end | ||
end | ||
|
||
def is_show_post?(post) | ||
post.split()[0] == 'show' | ||
end | ||
|
||
def get_date(post) | ||
|
||
regexpFormats = [/\d+\/\d+\/\d+/, /\d+-\d+-\d+/, /\d+-\d+/] | ||
formats = ['%m/%d/%Y', '%m/%d/%y', '%m-%d-%Y', '%m-%d-%y', '%m-%d'] | ||
|
||
show_date = nil | ||
|
||
while (not show_date or (show_date < DateTime.now or show_date > DateTime.now.next_year(2))) and formats.size > 0 | ||
begin | ||
format = formats.shift(1)[0] | ||
for r_format in regexpFormats | ||
if post =~ r_format | ||
show_date = Date.strptime($~[0], format) | ||
end | ||
end | ||
rescue | ||
puts $! | ||
retry unless formats.size == 0 | ||
end | ||
end | ||
|
||
if(not show_date) | ||
begin | ||
show_date = Date.parse(post) | ||
rescue | ||
#if has reached here show_date should be nil | ||
end | ||
end | ||
|
||
return show_date | ||
end | ||
|
||
def get_show_text(post) | ||
post_array = post.split() | ||
post_array.shift(1) | ||
post_array.join(' ') | ||
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,5 @@ | ||
<div class="blogContainer round"> | ||
<article> | ||
<%= blog.blogtext %> | ||
</article> | ||
</div> |
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 @@ | ||
<div class="blogContainer"> | ||
<article> | ||
<%= blog.blogtext %> | ||
</article> | ||
</div> |
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,8 @@ | ||
<div id="BlogsContainer"> | ||
|
||
<div id="AllBlogs"> | ||
|
||
<%= render @blogs %> | ||
|
||
</div> | ||
</div> |
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,13 @@ | ||
<div id="ShowsContainer"> | ||
<div class="showsHeader">---------------------Upcoming Shows-----------------------</div> | ||
<div id="UpcomingShows" class="round"> | ||
|
||
<%= render @upcoming_shows %> | ||
</div> | ||
<div class="showsHeader">---------------------Past Shows---------------------------</div> | ||
<div id="PastShows" class="round"> | ||
|
||
<%= render @past_shows %> | ||
|
||
</div> | ||
</div> |
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 @@ | ||
<div class="footer"> | ||
<nav class="footer"> | ||
<ul> | ||
<li><%= link_to "Front", root_path %></li> | ||
<li><%= link_to "Myspace", 'http://www.myspace.com/thegeronimoband' %></li> | ||
<li><%= link_to "Facebook", 'http://www.facebook.com/thegeronimoband' %></li> | ||
<% if signed_in? %> | ||
<li><%= link_to "Sign out", signout_path %></li> | ||
<% end %> | ||
</ul> | ||
</nav> | ||
</div> |
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 @@ | ||
<div class="BandName">Geronimo!</div> |
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 @@ | ||
<%= stylesheet_link_tag 'geronimo', :media => 'screen' %> |
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,20 @@ | ||
<!DOCTYPE html> | ||
<html> | ||
<head> | ||
<title>Geronimo!</title> | ||
<%= csrf_meta_tag %> | ||
<%= render 'layouts/g_stylesheets' %> | ||
<%= javascript_include_tag :defaults %> | ||
</head> | ||
<body> | ||
<div class="container"> | ||
<div class="PageName"><%= @page_name%></div> | ||
<%= render 'layouts/g_header' %> | ||
<section class="round"> | ||
<%= yield %> | ||
</section> | ||
<%= render 'layouts/g_footer' %> | ||
<%= debug(params) if Rails.env.development? %> | ||
</div> | ||
</body> | ||
</html> |
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,13 @@ | ||
<div> | ||
|
||
<span class="show">* <%= show.showtext %></span> | ||
|
||
|
||
<% if signed_in? %> | ||
<span> | ||
<%= link_to "delete", show, :method => :delete, | ||
:confirm => "You sure?" %> | ||
</span> | ||
|
||
<% end %> | ||
</div> |
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 @@ | ||
<%= @show.showtext %> |
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,14 @@ | ||
class CreateShows < ActiveRecord::Migration | ||
def self.up | ||
create_table :shows do |t| | ||
t.text :showtext | ||
t.date :showdate, :null => false | ||
|
||
t.timestamps | ||
end | ||
end | ||
|
||
def self.down | ||
drop_table :shows | ||
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
Oops, something went wrong.