Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Dunno

  • Loading branch information...
commit 62e48732466003ff6d192eb5117c00a20f2f4cae 1 parent e3e8deb
@Cosmo authored
Showing with 272 additions and 35 deletions.
  1. +2 −0  .gitignore
  2. +1 −0  Gemfile
  3. +9 −0 Gemfile.lock
  4. BIN  app/assets/images/ui/current-video.jpg
  5. BIN  app/assets/images/ui/missed-video.jpg
  6. BIN  app/assets/images/ui/preview-video.jpg
  7. BIN  app/assets/images/ui/teaser-video.jpg
  8. +0 −3  app/assets/javascripts/logs.js.coffee
  9. +0 −3  app/assets/javascripts/sessions.js.coffee
  10. +0 −3  app/assets/javascripts/users.js.coffee
  11. +6 −0 app/assets/stylesheets/ie.css.sass
  12. +0 −3  app/assets/stylesheets/logs.css.scss
  13. +6 −0 app/assets/stylesheets/print.css.sass
  14. +82 −0 app/assets/stylesheets/screen.css.sass
  15. +0 −3  app/assets/stylesheets/sessions.css.scss
  16. +0 −3  app/assets/stylesheets/users.css.scss
  17. +8 −0 app/controllers/application_controller.rb
  18. +23 −0 app/controllers/home_controller.rb
  19. +30 −8 app/controllers/logs_controller.rb
  20. +8 −1 app/views/home/index.html.erb
  21. 0  app/views/home/ui.html.erb
  22. +16 −4 app/views/layouts/application.html.erb
  23. +47 −0 app/views/layouts/ui.html.erb
  24. +7 −1 app/views/logs/index.html.erb
  25. +13 −0 app/views/logs/new.html.erb
  26. +2 −2 app/views/welcome/index.html.erb
  27. +2 −0  config/compass.rb
  28. +2 −0  config/initializers/pusher.rb
  29. +1 −0  config/routes.rb
  30. +5 −0 db/migrate/20121020115720_add_uid_to_users.rb
  31. +2 −1  db/schema.rb
View
2  .gitignore
@@ -13,3 +13,5 @@
# Ignore all logfiles and tempfiles.
/log/*.log
/tmp
+
+.DS_Store
View
1  Gemfile
@@ -18,6 +18,7 @@ group :assets do
# gem 'therubyracer', :platforms => :ruby
gem 'uglifier', '>= 1.0.3'
+ gem 'compass-rails'
end
gem 'jquery-rails'
View
9 Gemfile.lock
@@ -31,6 +31,7 @@ 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)
@@ -38,9 +39,16 @@ GEM
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)
View
BIN  app/assets/images/ui/current-video.jpg
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View
BIN  app/assets/images/ui/missed-video.jpg
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View
BIN  app/assets/images/ui/preview-video.jpg
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View
BIN  app/assets/images/ui/teaser-video.jpg
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View
3  app/assets/javascripts/logs.js.coffee
@@ -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/
View
3  app/assets/javascripts/sessions.js.coffee
@@ -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/
View
3  app/assets/javascripts/users.js.coffee
@@ -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/
View
6 app/assets/stylesheets/ie.css.sass
@@ -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]-->
View
3  app/assets/stylesheets/logs.css.scss
@@ -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/
View
6 app/assets/stylesheets/print.css.sass
@@ -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" />
+
+
View
82 app/assets/stylesheets/screen.css.sass
@@ -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
View
3  app/assets/stylesheets/sessions.css.scss
@@ -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/
View
3  app/assets/stylesheets/users.css.scss
@@ -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/
View
8 app/controllers/application_controller.rb
@@ -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
View
23 app/controllers/home_controller.rb
@@ -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
View
38 app/controllers/logs_controller.rb
@@ -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
View
9 app/views/home/index.html.erb
@@ -1 +1,8 @@
-awesome html code goes here
+Previous:
+<%= @schedule_previous %>
+<br />
+Now:
+<%= @schedule_now["TIT"] =%>
+<br />
+Next:
+<%= @schedule_next["TIT"] =%>
View
0  app/views/home/ui.html.erb
No changes.
View
20 app/views/layouts/application.html.erb
@@ -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 %>
View
47 app/views/layouts/ui.html.erb
@@ -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>
View
8 app/views/logs/index.html.erb
@@ -9,4 +9,10 @@
<%= log.body %>
</dd>
<% end %>
-</dl>
+</dl>
+
+<% if logged_in? %>
+ <p>
+ <%= link_to 'new log', new_log_path %>
+ </p>
+<% end %>
View
13 app/views/logs/new.html.erb
@@ -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 %>
View
4 app/views/welcome/index.html.erb
@@ -4,14 +4,14 @@
<h3>javascript files</h3>
<p>
javascript files path:<br />
- - app/assets/javascripts<br />
+ - hackday/app/assets/javascripts<br />
werden automatisch geladen - ansonsten app/assets/javascripts/application.js editieren
</p>
<h3>images</h3>
<p>
images path<br />
- - app/assets/images/
+ - hackday/app/assets/images/
</p>
<hr />
View
2  config/compass.rb
@@ -0,0 +1,2 @@
+# Require any additional compass plugins here.
+project_type = :rails
View
2  config/initializers/pusher.rb
@@ -0,0 +1,2 @@
+PUSHER_KEY = '9b398a15a5cdeb082e7d'
+PUSHER_SECRET = '6f97399638c0bda6db0c'
View
1  config/routes.rb
@@ -11,6 +11,7 @@
match 'logout' => 'sessions#destroy'
match 'signup' => 'users#new'
match 'home' => 'home#index'
+ match 'ui' => 'home#ui'
# Sample of named route:
# match 'products/:id/purchase' => 'catalog#purchase', :as => :purchase
View
5 db/migrate/20121020115720_add_uid_to_users.rb
@@ -0,0 +1,5 @@
+class AddUidToUsers < ActiveRecord::Migration
+ def change
+ add_column :users, :uid, :integer
+ end
+end
View
3  db/schema.rb
@@ -11,7 +11,7 @@
#
# It's strongly recommended to check this file into your version control system.
-ActiveRecord::Schema.define(:version => 20121020102159) do
+ActiveRecord::Schema.define(:version => 20121020115720) do
create_table "logs", :force => true do |t|
t.integer "user_id"
@@ -28,6 +28,7 @@
t.string "password_digest"
t.datetime "created_at", :null => false
t.datetime "updated_at", :null => false
+ t.integer "uid"
end
end
Please sign in to comment.
Something went wrong with that request. Please try again.