Permalink
Browse files

Dunno

  • Loading branch information...
1 parent e3e8deb commit 62e48732466003ff6d192eb5117c00a20f2f4cae @Cosmo committed Oct 20, 2012
View
@@ -13,3 +13,5 @@
# Ignore all logfiles and tempfiles.
/log/*.log
/tmp
+
+.DS_Store
View
@@ -18,6 +18,7 @@ group :assets do
# gem 'therubyracer', :platforms => :ruby
gem 'uglifier', '>= 1.0.3'
+ gem 'compass-rails'
end
gem 'jquery-rails'
View
@@ -31,16 +31,24 @@ GEM
arel (3.0.2)
bcrypt-ruby (3.0.1)
builder (3.0.4)
+ chunky_png (1.2.6)
coffee-rails (3.2.2)
coffee-script (>= 2.2.0)
railties (~> 3.2.0)
coffee-script (2.2.0)
coffee-script-source
execjs
coffee-script-source (1.3.3)
+ compass (0.12.2)
+ chunky_png (~> 1.2)
+ fssm (>= 0.2.7)
+ sass (~> 3.1)
+ compass-rails (1.0.3)
+ compass (>= 0.12.2, < 0.14)
erubis (2.7.0)
execjs (1.4.0)
multi_json (~> 1.0)
+ fssm (0.2.9)
hike (1.2.1)
i18n (0.6.1)
journey (1.0.4)
@@ -108,6 +116,7 @@ PLATFORMS
DEPENDENCIES
bcrypt-ruby (~> 3.0.0)
coffee-rails (~> 3.2.1)
+ compass-rails
jquery-rails
puma
rails (= 3.2.8)
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@@ -1,3 +0,0 @@
-# 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/
@@ -1,3 +0,0 @@
-# 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/
@@ -1,3 +0,0 @@
-# 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/
@@ -0,0 +1,6 @@
+/*
+ Welcome to Compass. Use this file to write IE specific override styles.
+ Import this file using the following HTML or equivalent:
+ <!--[if IE]>
+ <link href="/stylesheets/ie.css" media="screen, projection" rel="stylesheet" type="text/css" />
+ <![endif]-->
@@ -1,3 +0,0 @@
-// Place all the styles related to the logs controller here.
-// They will automatically be included in application.css.
-// You can use Sass (SCSS) here: http://sass-lang.com/
@@ -0,0 +1,6 @@
+/*
+ Welcome to Compass. Use this file to define print styles.
+ Import this file using the following HTML or equivalent:
+ <link href="/stylesheets/print.css" media="print" rel="stylesheet" type="text/css" />
+
+
@@ -0,0 +1,82 @@
+/*
+ Welcome to Compass.
+ In this file you should write your main styles. (or centralize your imports)
+ Import this file using the following HTML or equivalent:
+ <link href="/stylesheets/screen.css" media="screen, projection" rel="stylesheet" type="text/css" />
+
+@import compass/reset
+@import compass/css3
+
+body.ui
+ background: #444
+ width: 100%
+ height: 100%
+ font: 14px/1.2em "Helvetica Neue", Arial, Helvetica, Geneva, sans-serif
+
+ img
+ dipslay: block
+
+ a
+ text-decoration: none
+
+ #container
+ width: 1024px
+ min-height: 768px
+ position: relative
+ left: 50%
+ margin-left: -512px
+
+ #prev
+ width: 220px
+ position: absolute
+ top: 0
+ left: 0
+ bottom: 0
+
+ #current
+ width: 584px
+ position: absolute
+ top: 0
+ left: 220px
+ bottom: 0
+ @include box-shadow(rgba(0,0,0,.8) 0 4px 20px)
+ z-index: 20
+
+ #current-video
+ @include background-image(linear-gradient(#F5C200, #B07F00))
+ min-height: 240px
+
+ img
+ border: 4px solid #222
+ margin: 16px
+ float: left
+
+ #description
+ width: 268px
+ margin-top: 16px
+ float: left
+ @include single-text-shadow(0, 1px, 0, false, rgba(255,255,255,.3))
+
+ h1
+ font-size: 28px
+ line-height: 28px
+ margin-bottom: 5px
+
+ h2
+ margin-bottom: 10px
+
+ strong
+ font-weight: bold
+
+ p
+ margin-bottom: 15px
+
+ strong
+ font-weight: bold
+
+ #next
+ width: 220px
+ position: absolute
+ top: 0
+ right: 0
+ bottom: 0
@@ -1,3 +0,0 @@
-// Place all the styles related to the sessions controller here.
-// They will automatically be included in application.css.
-// You can use Sass (SCSS) here: http://sass-lang.com/
@@ -1,3 +0,0 @@
-// Place all the styles related to the users controller here.
-// They will automatically be included in application.css.
-// You can use Sass (SCSS) here: http://sass-lang.com/
@@ -1,3 +1,5 @@
+require 'net/http'
+
class ApplicationController < ActionController::Base
protect_from_forgery
# force_ssl
@@ -9,4 +11,10 @@ def current_user
end
helper_method :current_user
+
+ def logged_in?
+ current_user.present? ? true : false
+ end
+ helper_method :logged_in?
+
end
@@ -1,5 +1,28 @@
class HomeController < ApplicationController
+ layout 'ui', :only => 'ui'
+
def index
+ schedule_now_and_next_url = "http://www.arte.tv/tvhack/tvguide/epg/live/D/L3/2.json"
+
+ schedule_now_and_next = parse_json(schedule_now_and_next_url)
+ @schedule_now = schedule_now_and_next["abstractBroadcastList"][0]
+ @schedule_next = schedule_now_and_next["abstractBroadcastList"][1]
+
+ schedule_url = "http://www.arte.tv/tvhack/tvguide/epg/schedule/D/L2/2012-10-20/2012-10-20.json"
+
+ schedule_day = parse_json(schedule_url)
+ schedule_day["abstractBroadcastList"].each_with_index {|program, index|
+ if program["PID"] = @schedule_now["PID"]
+ @schedule_previous = schedule_day["abstractBroadcastList"][index]
+ end
+ }
+ end
+
+ def parse_json(url)
+ return JSON.parse(Net::HTTP.get_response(URI.parse(url)).body)
+ end
+
+ def ui
end
end
@@ -1,17 +1,39 @@
class LogsController < ApplicationController
def index
@logs = Log.scoped
+
+ if params[:at]
+ # Format: "2012-10-20-10-00"
+ at = DateTime.strptime(params[:at],"%Y-%m-%d-%H-%M").to_time
+ @logs = @logs.where("at >= ?", at).where("at <= ?", at + 1.minute)
+ end
+
+ respond_to do |format|
+ format.html # index.html.erb
+ format.json { render json: @logs }
+ end
+ end
+
+ def new
+ @log = Log.new
end
def create
- @log = Log.new(user_id: current_user.id, body: params[:body])
- if params[:time].present?
- @log.at = params[:time]
+ if logged_in?
+ @log = Log.new(body: params[:log][:body])
+ @log.user_id = current_user.id
+ if params[:time].present?
+ @log.at = params[:time]
+ else
+ @log.at = Time.now
+ end
+ if @log.save
+ logger.info "awesome, #{current_user.email} tagged a video at #{@log.at}"
+ end
+ redirect_to logs_path
else
- @log.at = Time.now
- end
- if @log.save
- logger.info "awesome, #{current_user.email} tagged a video at #{@log.at}"
+ flash[:notice] = 'not logged in!'
+ redirect_to new_log_path
end
end
-end
+end
@@ -1 +1,8 @@
-awesome html code goes here
+Previous:
+<%= @schedule_previous %>
+<br />
+Now:
+<%= @schedule_now["TIT"] =%>
+<br />
+Next:
+<%= @schedule_next["TIT"] =%>
No changes.
@@ -2,12 +2,22 @@
<html>
<head>
<title>Hackday</title>
- <%= stylesheet_link_tag "application", :media => "all" %>
<%= javascript_include_tag "application" %>
<%= csrf_meta_tags %>
</head>
<body>
-
+
+ <% flash.each do |name, message| %>
+ <% message_type = (name == :notice ? "success" : name) %>
+ <div>
+ <%= message.html_safe %>
+ </div>
+ <% end %>
+
+ <%= yield %>
+
+ <hr />
+
<p>
<% if current_user.present? %>
User:
@@ -16,11 +26,13 @@
<%= link_to 'login', login_path %>
<% end %>
</p>
- <%= yield %>
<ul>
<li>
- <%= link_to "home", root_path %>
+ <%= link_to "root", root_path %>
+ </li>
+ <li>
+ <%= link_to "home", home_path %>
</li>
<li>
<%= link_to "view all logs", logs_path %>
@@ -0,0 +1,47 @@
+<!DOCTYPE html>
+<html>
+<head>
+ <title>Hackday</title>
+ <%= stylesheet_link_tag "application", :media => "all" %>
+ <%= javascript_include_tag "application" %>
+ <%= csrf_meta_tags %>
+</head>
+<body class="ui">
+ <div id="container">
+ <div id="prev">
+ Sendung verpasst?
+ <%= image_tag("ui/missed-video.jpg") %>
+ 2.11.12
+ </div>
+ <div id="current">
+ <div id="current-video">
+ <%= image_tag("ui/teaser-video.jpg") %>
+ <div id="description">
+ <div id="nowon">Jetzt läuft</div>
+ <h1>Breaking Bad</h1>
+ <h2>
+ <strong>Folge 7</strong> Lilly of the Valley
+ </h2>
+ <p>
+ Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod
+ tempor incididunt ut labore et dolore magna aliqua.
+ </p>
+ <p>
+ Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo
+ consequat.
+ </p>
+ </div>
+ </div>
+ </div>
+ <div id="next">
+ Vorschau Nächste Woche
+ <%= image_tag("ui/preview-video.jpg") %>
+ 2.11.12
+ </div>
+ </div>
+
+
+ <%= yield %>
+
+</body>
+</html>
@@ -9,4 +9,10 @@
<%= log.body %>
</dd>
<% end %>
-</dl>
+</dl>
+
+<% if logged_in? %>
+ <p>
+ <%= link_to 'new log', new_log_path %>
+ </p>
+<% end %>
@@ -0,0 +1,13 @@
+<%= form_for @log do |f| %>
+ <p>
+ <%= f.label :body %>
+ <%= f.text_field :body %>
+ </p>
+ <p>
+ <%= f.label :at %>
+ <%= f.datetime_select :at %>
+ </p>
+ <p>
+ <%= f.submit %>
+ </p>
+<% end %>
Oops, something went wrong.

0 comments on commit 62e4873

Please sign in to comment.