public
Fork of maddox/pyrot
Description: Your friendly neighborhood nzb downloader
Clone URL: git://github.com/mschrag/pyrot.git
Search Repo:
got season passes integrated into iphone series sections
maddox (author)
Thu Apr 24 17:24:46 -0700 2008
commit  b495933898851675ef263b1792526cfd1b6db71c
tree    c8d7627c444c0167ec58eec10b9ac1de6993bf52
parent  4118b63515dbd94accfe5ef726f99be431e5e760
...
25
26
27
 
 
 
 
 
 
28
29
30
...
40
41
42
43
44
45
46
47
48
49
50
 
51
52
53
...
25
26
27
28
29
30
31
32
33
34
35
36
...
46
47
48
 
49
50
51
 
 
 
 
52
53
54
55
0
@@ -25,6 +25,12 @@ class SeasonPassesController < ApplicationController
0
   # GET /season_passes/new
0
   def new
0
     @season_pass = SeasonPass.new
0
+
0
+ respond_to do |format|
0
+ format.html
0
+ format.iphone { render :layout => false }
0
+ end
0
+
0
   end
0
 
0
   # GET /season_passes/1;edit
0
@@ -40,14 +46,10 @@ class SeasonPassesController < ApplicationController
0
   # POST /season_passes
0
   # POST /season_passes.xml
0
   def create
0
- find_lengths_and_qualities
0
     @season_pass = SeasonPass.new(params[:season_pass])
0
     @season_pass.save!
0
 
0
- respond_to do |format|
0
- format.html { redirect_with_message('A new season pass was successfully created.') }
0
- format.xml { head :created, :location => season_pass_url(season) }
0
- end
0
+ redirect_to season_passes_path
0
 
0
   rescue ActiveRecord::RecordInvalid
0
 
...
163
164
165
 
 
 
 
 
 
 
166
 
 
 
 
 
 
 
 
167
168
169
...
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
0
@@ -163,7 +163,22 @@ module ApplicationHelper
0
       "movies/big_episode"
0
     end
0
   end
0
+
0
+ def determine_season_pass_link(series)
0
+ season_passes = SeasonPass.find(:all)
0
+ found_pass = nil
0
+ season_passes.each do |pass|
0
+ found_pass = pass if pass.title =~ /#{series.title}/i
0
+ end
0
 
0
+ case found_pass
0
+ when nil
0
+ link_to 'Create Season Pass', new_season_pass_path(:title => series.title)
0
+ else
0
+ link_to 'Edit Season Pass', edit_season_pass_path(found_pass)
0
+ end
0
+
0
+ end
0
 
0
   
0
 end
...
5
6
7
 
 
 
8
9
10
...
5
6
7
8
9
10
11
12
13
0
@@ -5,6 +5,9 @@
0
   <% unless @series.description.blank? -%>  
0
   <li id="small-description" class="result"><h5><%= @series.description[0..255] %></h5></li>
0
   <% end -%>
0
+
0
+ <li class="result"><%= determine_season_pass_link(@series) %></li>
0
+
0
   <% @episodes.each do |episode| -%>
0
     <li class="result"><%= link_to render( :partial => "episode", :locals => {:episode => episode}), series_episode_path(@series, episode), :class => 'clearfix' %></li>
0
   <% end -%>
...
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
 
43
...
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
0
@@ -1,42 +1 @@
0
-<% form_for @season_pass, :html => {:id => 'new_season_pass', :title => @season_pass.new_record? ? 'New Pass' : 'Edit Pass', :class => 'panel'} do |f| %>
0
- <h2>Show</h2>
0
- <fieldset>
0
- <div class="row">
0
- <%= f.label :title %>
0
- <%= f.text_field :title %>
0
- </div>
0
-
0
- <div class="row">
0
- <%= f.label('season') %>
0
- <%= f.select :season, (1..25) %>
0
- </div>
0
-
0
- <div class="row">
0
- <%= f.label('next_episode') %>
0
- <%= f.select :next_episode, (1..50) %>
0
- </div>
0
-
0
- </fieldset>
0
-
0
- <h2>Properties</h2>
0
- <fieldset>
0
- <div class="row">
0
- <%= f.label :hd, 'High Definition?' %>
0
- <div class="toggle" onclick="toggle_hidden('season_pass_hd'); return false;" <%= @season_pass.hd? ? %{toggled="true"} : '' %>><span class="thumb"></span><span class="toggleOn">ON</span><span class="toggleOff">OFF</span></div>
0
- <%= f.hidden_field :hd %>
0
- </div>
0
-
0
- <% unless @season_pass.new_record? -%>
0
- <div class="row">
0
- <%= f.label :on_hiatus, 'Hiatus?' %>
0
- <div class="toggle" onclick="toggle_hidden('season_pass_on_hiatus'); return false;" <%= @season_pass.on_hiatus? ? %{toggled="true"} : '' %>><span class="thumb"></span><span class="toggleOn">ON</span><span class="toggleOff">OFF</span></div>
0
- <%= f.hidden_field :on_hiatus %>
0
- </div>
0
- <% end -%>
0
-
0
-
0
- </fieldset>
0
-
0
- <%= submit_tag @season_pass.new_record? ? 'Create Pass' : 'Save Changes' %>
0
-
0
-<% end -%>
0
+<%= render :partial => "form" %>
0
\ No newline at end of file
...
3
4
5
6
 
7
8
 
9
10
11
12
...
3
4
5
 
6
7
 
8
9
10
11
12
0
@@ -3,9 +3,9 @@ function toggle_hidden(id){
0
   hidden_field = document.getElementById(id);
0
   
0
   if (hidden_field.value == '1' || hidden_field.value == 'true'){
0
- hidden_field.value = 'false'
0
+ hidden_field.value = '0'
0
   }else if(hidden_field.value == '0' || hidden_field.value == 'false'){
0
- hidden_field.value = 'true'
0
+ hidden_field.value = '1'
0
   }
0
   
0
 }
0
\ No newline at end of file

Comments

    No one has commented yet.