forked from mzemel/kpsu.org
-
Notifications
You must be signed in to change notification settings - Fork 0
/
garbage.rhtml
447 lines (363 loc) · 20.7 KB
/
garbage.rhtml
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
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
<div class="float-right" style="margin:30px 25px 20px 0px;">
<div class="m1-thin large" style="margin-bottom:10px;">Recent Shows</div>
<ul class="vertical">
<% @i = 0 %>
<% @downloads.reverse.each do |d| %>
<% @i += 1 %>
<% if @i <= 4 %>
<li style="margin-left:10px;margin-top:2px;" class="vertical">
<%= link_to(Time.zone.at(d.title.to_i).strftime("%B %e\, %Y"), download_path(:id => d.id), :class => "red-font") %> <span class="small">(<%= d.count %> downloads)</span>
</li>
<% end %>
<% end %>
<li><span class="red-font pointer" id="program-archive">All Archived Shows</span></li>
</ul>
</div>
<div style="padding-bottom:10px;" class="float-left">
<%= @program.title %><br/>
<div id="program-url" class="program url" style="font-size:10px;padding-left:10px;margin-top:10px;">http://kpsu.org/shows/<%= @program.title.gsub("\s", "-").downcase %></div>
<div id="program-copy" style="position:relative;font-size:8px;"><div id="program-copy-button">Copy URL to Clipboard</div></div>
</div>
<% if @program.event %>
<div class="m1-light float-left clear-left">
<span class="m1-bold">On Air</span>
<br/> <%= i_to_day(@program.event.day_i) %> @ <%= @program.event.starts_at.to_s(:meridian_time) %>
</div>
<% end %>
<div class=" rounded-heavy-bottom clear-left" style="width:280px;line-height:12px;height:50px;float:left;margin:10px 0px 20px 0px;">
<div class="m1-bold clear-both float-left">Share</div>
<div title="Share <%= @program.title %>" class="social-networking" style="float:left;clear:both;width:280px;text-align:left;">
<div class="float-left clear-left" style="margin:10px 0px 0px 10px;">
<!-- REGARDING FACEBOOK %2F stands for / and w -->
<iframe src="http://www.facebook.com/plugins/like.php?href=http%3A%2F%2Fkpsu.org<%= url_for(@program) %>&layout=button_count&show_faces=true&width=40&action=like&font=segoe+ui&colorscheme=light&height=21" scrolling="no" frameborder="0" style="border:none; overflow:hidden; width:80px; height:21px;" allowTransparency="true"></iframe>
<a href="http://twitter.com/share/?url=http://kpsu.org<%= url_for(@program) %>" class="twitter-share-button" data-count="horizontal" data-via="KPSU_PDX" data-text="<%= @program.title %>: #kpsu">Tweet</a>
<script type="text/javascript" src="http://platform.twitter.com/widgets.js"></script>
</div>
</div>
</div>
<div class="post">
<div class="header">
<% if @post.content_type_id == 1 %>
<div class="green-text post-type">BLOG</div>
<div class="green chunk-five yellow-text float-left title-bar"><%= link_to @post.title, post, :class => "yellow-text" %></div>
<% elsif @post.content_type_id == 3 %>
<div class="yellow-text post-type">ANNOUNCEMENT</div>
<div class="yellow chunk-five magenta-text float-left title-bar"><%= link_to @post.title, post, :class => "magenta-text" %></div>
<% elsif @post.content_type_id == 2 %>
<div class="blue-text post-type">NEWS</div>
<div class="blue chunk-five white-text float-left title-bar"><%= link_to @post.title, post, :class => "white-text" %></div>
<% end %>
</div>
<div class="body">
<div class="author deja-condensed float-right">BY <span class="blue-text"><%= link_to @post.user.dj_name.upcase, @post.user, :class => "blue-text" %></span></div>
<div class="content dejavu-book float-lef">
<%= raw @post.body.bbcode_to_html({}, false) %>
</div>
</div>
<div class="footer green">
<div id="view-comments" class="float-left dejavu-condensed magenta-text">View Comments</div>
<div id="share" class="share float-right">
<div class="text dejavu-condensed float-left magenta-text">SHARE</div>
<div class="float-right icons">
<!-- REGARDING FACEBOOK %2F stands for / and w -->
<iframe src="http://www.facebook.com/plugins/like.php?href=http%3A%2F%2Fkpsu.org<%= url_for(post) %>&layout=button_count&show_faces=true&width=40&action=like&font=segoe+ui&colorscheme=light&height=21" scrolling="no" frameborder="0" style="border:none; overflow:hidden; width:80px; height:21px;" allowTransparency="true">
</iframe>
<a href="http://twitter.com/share/?url=http://kpsu.org<%= url_for(post) %>" class="twitter-share-button" data-count="horizontal" data-via="KPSU_PDX" data-text="<%= @post.title %>: ">
Tweet
</a>
<script type="text/javascript" src="http://platform.twitter.com/widgets.js"></script>
</div>
</div>
</div>
</div>
<div class="float-left" style="margin:0;width;">
<div class="m1-thin extra-large red-font clear-both">Latest News</div>
<ul class="vertical" style="padding-left:0px 0px 0px 0px;margin:10px 0px 10px 10px;text-left:right;display:block">
<% @posts.each do |post| %>
<li class="m1-regular vertical" style="margin:2px;"><%= link_to(post.title, post_path(post), :class => "red-font") %></li>
<% end %>
</ul>
<div class="m1-thin extra-large red-font clear-both">Recent Blogs</div>
<ul class="vertical" style="padding-left:0px 0px 0px 0px;margin:10px 0px 10px 10px;text-left:right;display:block">
<% @blogs.each do |post| %>
<li class="m1-regular vertical" style="margin:2px;"><%= link_to(post.title, post_path(post), :class => "red-font") %></li>
<% end %>
</ul>
</div>
def make_role_able(abilities_id_array, role_id)
abilities_id_array.each do |a|
r = Role.find(role_id)
s = Ability.find(a)
r.abilities << s
puts "added #{s.title} to #{r.title}"
end
end
<div class="social-wrapper rounded-heavy-bottom" style="padding:3px 3px 6px 3px;background-color:#ECECEC;width:574px;line-height:12px;height:25px;float:left;margin-bottom:0px;">
<div class="social-networking" style="float:left;clear:both;margin:5px 5px 50px 5px;width:580px;text-align:right;">
<div class="standard red-font m1-regular float-left" style="z-index:3;text-align:left !important;"><span id="view-comments" class="pointer m1-regular red-font">VIEW COMMENTS</span> | <span id="post-comment" class="pointer m1-regular red-font">POST COMMENT</span></div>
SHARE
<div class="float-right">
<!-- REGARDING FACEBOOK %2F stands for / and w -->
<iframe src="http://www.facebook.com/plugins/like.php?href=http%3A%2F%2Fkpsu.org<%= url_for(@post) %>&layout=button_count&show_faces=true&width=40&action=like&font=segoe+ui&colorscheme=light&height=21" scrolling="no" frameborder="0" style="border:none; overflow:hidden; width:80px; height:21px;" allowTransparency="true">
</iframe>
<a href="http://twitter.com/share/?url=http://kpsu.org<%= url_for(@post) %>" class="twitter-share-button" data-count="horizontal" data-via="KPSU_PDX" data-text="<%= @post.title %>: ">
Tweet
</a>
<script type="text/javascript" src="http://platform.twitter.com/widgets.js"></script>
</div>
</div>
<div class="chunk-five blue-text normal float-left" style="text-align:right;"><span>View Program Page</span><br/> <%= link_to(@playlist.program.title, program_path(@playlist.program), :class => "magenta-text dejavu-condensed", :title => "Program") %></div>
<div class="m1-regular normal float-right" style="text-align:right;clear:right;margin-bottom:20px;"><span class="chunk-five blue-text">View DJ Profile</span><br/> <% if @playlist.program.user %><%= link_to(@playlist.program.user.f_name, user_path(@playlist.program.user), :class => "magenta-text dejavu-sans", :title => "DJ") %><% end %><% if current_user %>
<% if current_user == @playlist.program.user || current_user.staff %>
<br/><br/><span class="m1-medium">Playlist Options</span><br/>
<%= raw("<a href='/dashboard/#/playlists/#{@playlist.id}/edit'>Edit</a>") %>
<br/>
<%= link_to 'Delete', @playlist, :confirm => "Are you sure?", :method => "delete", :class => "red-font" %>
<% end %>
<% end %>
</div>
<style type="text/css" media="screen">
.search-button:hover {
text-shadow: 0 0 5px rgba(255, 109, 100, 2);
-webkit-text-shadow: 0 0 5px rgba(255, 109, 100, 2);
-moz-text-shadow: 0 0 5px rgba(255, 109, 100, 2);
}
.playlist-items-wrapper .header {
background-color:#343434 ;
padding:2px;
}
.playlist-items .position, .playlist-items-wrapper .position {
text-align:center;
padding:2px;
width:30px;
}
.playlist-items .album, .playlist-items-wrapper .album {
padding:2px;
width:158px;
}
.playlist-items .title, .playlist-items-wrapper .title {
padding:2px;
width:290px;
}
.playlist-items .artist, .playlist-items-wrapper .artist {
padding:2px;
width:170px;
}
.track:hover {
text-shadow: 0 0 5px #EE3B3B;
-webkit-text-shadow: 0 0 5px #EE3B3B;
-moz-text-shadow: 0 0 5px rgba(0, 0, 255, 1);
}
.track-wrapper {
float:left;
clear:both;
}
</style>
<div class="float-left clear-both" style="width: 664px;">
<div id="new-playlist-wrapper" style="margin-bottom:30px;">
<form accept-charset="UTF-8" action="/playlists" class="new_playlist" data-remote="true" id="new_playlist" method="post">
<div style='width: 624px;height: auto;float: left;background-color: #343434;padding: 20px;'>
<div class="float-left blue-text chunk-five clear-both">
Program <%= select_tag "programs", options_from_collection_for_select(@programs, "id", "title", :selected => "#{ current_user.programs.first.id rescue nil }") %>
</div>
<div class="float-left clear-both blue-text chunk-five" style="margin-top:5px;">
Title <input class="rounded-heavy form" id="playlist_title" name="playlist[title]" size="30" type="text" value="">
</div>
<div class="float-left clear-both blue-text chunk-five" style="">
Description <br/><textarea name="playlist[description]" style="" class="dejavu-condensed twelve form"rows="3" cols="70"></textarea>
</div>
</div>
<div class="float-left clear-both blue rounded-heavy-top black-text bebas" style="margin-top:10px;width: 649px;height: 30px;padding: 15px 0 0 15px;">
Current Tracks
</div>
<div class="playlist-items-wrapper float-left clear-both medium" style="background-color:#343434;">
<div class="float-left dejavu-condensed yellow-text header position">#</div>
<div class="float-left dejavu-condensed yellow-text header artist" style="width:170px;">Artist</div>
<div class="float-left dejavu-condensed yellow-text header title" style="width:290px;">Track Title</div>
<div class="float-left dejavu-condensed yellow-text header album" style="width:158px;">Album</div>
<div class="playlist-items empty">
<% @i = 0; %>
<% @playlist.playlist_items.sort!{|x,y| x.position <=> y.position} && @playlist.playlist_items.each do |t| %>
<div class='track-wrapper'><div class='remove-track pointer invisible' style='position:absolute;z-index:300;width:664px;border:0px solid #343434;text-align:center;height:22px;'><div class='track-delete float-right rounded-heavy' style='width: 75px; background-color: #343434; '><img src='/images/delete.png' style='float: left; height: 100%; '><div style='float: left; margin-top: 1px; font-size:.75em;color:#FFF;'>Remove</div></div></div><div class='track-position float-left pointer yellow-text dejavu-condensed position' style=''><%= @i += 1 %></div><div data-artist='<%= t.track.artist.id rescue nil %>' class='float-left pointer yellow-text dejavu-condensed' style='font-size:.75em;padding-top:4px;width:170px;'><%= t.track.artist.name rescue nil %></div><div data-track='<%= t.track.id rescue nil %>' class='float-left title yellow-text dejavu-condensed' style='font-size:.75em;padding-top:4px;'><%= t.track.title rescue nil %></div><div data-album='<%= t.track.album.id rescue nil %>' class='float-left pointer yellow-text dejavu-condensed album' style='font-size:.75em;padding-top:4px;'><%= t.track.album.name rescue nil %></div>
</div>
<% end %>
</div>
</div>
<input type="hidden" name="tracks" value="" id="track-array">
<div class="save-playlist float-right green-text pointer bebas" style="margin-right:13px;">SAVE PLAYLIST</div>
</form>
</div>
<div id="create-track" class="invisible float-left clear-both">
<div class="float-left clear-both magenta rounded-heavy-top black-text bebas" style="margin-top:10px;width: 649px;height: 30px;padding: 15px 0 0 15px;margin:10px 0 0 0;">
Create New Track
<div class="hide-new-track red-text dejavu-condensed black-text float-right pointer" style="margin:0 21px 0 0;">Hide New Track</div>
</div>
<div class="new-playlist-search-wrapper rounded-heavy" style="background-color: #343434;float: left;width: 649px;padding: 15px 0 15px 15px;">
<form action="/tracks" id="new-track-form" data-remote="true" method="post" accept-charset="utf-8">
<div class="float-left" style="padding:2px 0px 0px 5px;">
<span class="transition-0-25 pointer search-button dejavu-condensed blue-text">Artist</span>
</div>
<input type="text" name="artist" value="" id="artist" class="form rounded-heavy curvy float-left">
<div class="float-left" style="margin-left:50px;padding:2px 0px 0px 5px;">
<span class="transition-0-25 pointer search-button dejavu-condensed blue-text">Title</span>
</div>
<input type="text" name="track" value="" id="track_title" class="form rounded-heavy curvy float-left">
<div class="float-left clear-left" style="padding:2px 0px 0px 5px;">
<span class="transition-0-25 pointer search-button dejavu-condensed blue-text">Album</span>
</div>
<input type="text" name="album" value="" id="album" class="form rounded-heavy curvy float-left">
<div class="float-left" style="margin-left:50px;padding:2px 0px 0px 5px;">
<span class="transition-0-25 pointer search-button dejavu-condensed blue-text">Label</span>
</div>
<input type="text" name="label" value="" id="album" class="form rounded-heavy curvy float-left">
<div class="float-right" style="margin-right:15px;">
<span class="dejavu-condensed green-text save-track pointer">Save Track</div>
</div>
<div class="track-error-wrapper">
</div>
<input type="submit" disabled="true" id="create-track-submit" style="display:none;" value="Continue →">
</form>
</div>
</div>
<div class="float-left clear-both yellow rounded-heavy-top black-text bebas" style="margin-top:10px;width: 649px;height: 30px;padding: 15px 0 0 15px;margin:10px 0 0 0;">
Find/Add Tracks
<div class="new-playlist-content black-text dejavu-condensed blue-text medium float-right pointer" style="margin:0 21px 0 0;">+ Add Missing Track</div>
</div>
<div class="new-playlist-search-wrapper rounded-heavy" style="background-color: #343434;float: left;width: 649px;padding: 15px 0 15px 15px;">
<form action="/playlists/new/search" id="search-form" data-remote="true" method="get" accept-charset="utf-8">
<input type="text" name="search" value="" id="search" style="margin-top: 6px;float: left;" class="form rounded-heavy curvy float-left">
<div class="float-left" style="padding:2px 0px 0px 5px;">
<span class="transition-0-25 pointer search-button blue-text chunk-five">Search</span>
</div>
<div class="float-right" style="margin-right:15px;">
<input type="radio" name="search_type" class="dejavu-condensed" value="artist" checked="true"> Artists
<input type="radio" name="search_type" class="dejavu-condensed" value="tracks"> Tracks
<input type="radio" name="search_type" class="dejavu-condensed" value="albums"> Albums
</div>
<input type="submit" id="playlist-search" style="display:none;" value="Continue →">
</form>
</div>
</div>
<div class="float-left clear-left rounded-heavy" style="background-color:#343434;margin-top:30px;">
<div class="float-left clear-both bebas black-text green rounded-heavy-top" style="width:649px;height:30px;padding:15px 0 0 15px;">
Search Results
</div>
<div class="results-wrapper" style="">
<div class="float-left white-text rounded-heavy-top-left dejavu-condensed artist" style="height:30px;padding:15px 0 0 15px;width:135px;">Artist</div>
<div class="float-left white-text dejavu-condensed title" style="height:30px;padding:15px 0 0 15px;width:305px;">Track Title</div>
<div class="float-left white-text rounded-heavy-top-right dejavu-condensed album" style="height:30px;padding:15px 0 0 15px;width:167px;">Album</div>
<div class="results">
<div class="float-left pointer dejavu-condensed artist" style="padding:2px;width:160px;"></div>
<div class="float-left dejavu-condensed title" style="color:#FFF;padding:2px;width:340px;">Search for something to get going...</div>
<div class="float-left pointer dejavu-condensed album" style="padding:2px;width:180px;"></div>
</div>
</div>
</div>
<script type="text/javascript" charset="utf-8">
function resetPlaylistLive(){
$(".track").die();
}
resetPlaylistLive();
function updatePlaylistPositions (){
var trackCount = $(".playlist-items .track-draggable").find(".track-wrapper");
$.each(trackCount, function(i, t){
var position = $(t).find(".track-position");
$(position).html(i+1);
});
}
// setup track counter
var tracks = 0;
$(".search-button").click(function(){
$("#search-form").submit();
});
$("#search-form").live("ajax:loading", function(){
var loader = _ajax_loader_black();
$(".results").html(loader);
});
// New Track JS
$(".hide-track-error").live("click", function(){
$(".track-error-wrapper").hide();
});
$(".save-track").click(function(){
$("#new-track-form").submit();
});
$(".new-playlist-content").click(function(){
$("#create-track").slideDown();
});
$(".hide-new-track").click(function(){
$("#create-track").slideUp();
});
// add track from search
$(".track").live("click", function(){
// increment track counter by one
tracks++;
var track = $(this);
var artistId = $(track).find(".artist").data("artist");
var albumId = $(track).find(".album").data("album");
var trackId = $(track).find(".title").data("track");
var artistName = $(track).find(".artist").text();
var albumName = $(track).find(".album").text();
var trackName = $(track).find(".title").text();
var playlistItems = $(".playlist-items");
if ($(playlistItems).hasClass("empty") == true){
$(playlistItems).html("").removeClass("empty");
}
var id = get_unique_id();
$(playlistItems).append("<div class='track-draggable float-left' style='width:664px;height:auto;'><div class='remove-track pointer red-font invisible' style='position:absolute;z-index:300;width:75px;border:0px solid #343434;text-align:center;height:22px;'><div class='track-delete float-right rounded-heavy' style='width: 75px; background-color: #343434; height:auto;'><img src='/images/delete.png' style='float: left; height: 100%; '><div style='float: left; margin-top: 1px; font-size:.75em;color:#FFF;'>Remove</div></div></div><div id='playlist-track-id"+id+"' class='track-wrapper invisible'><div class='track-position float-left pointer yellow-text dejavu-condensed position' style=''>"+tracks+"</div><div data-artist='"+artistId+"' class='float-left pointer yellow-text dejavu-condensed' style='font-size:.75em;padding-top:4px;width:170px;'>"+artistName+"</div><div data-track='"+trackId+"' class='float-left title yellow-text dejavu-condensed' style='font-size:.75em;padding-top:4px;'>"+trackName+"</div><div data-album='"+albumId+"' class='float-left pointer yellow-text dejavu-condensed album' style='font-size:.75em;padding-top:4px;'>"+albumName+"</div></div></div>");
$(".playlist-items").sortable("refresh");
updatePlaylistPositions ()
$(".track-wrapper:last").slideDown();
});
// remove track hover
// jQuery Tip: children hover
// to stop children from disappearing when hovered over
// use mouseenter and mouseleave events
// mouseover/mouseout will fire when hovering over
// children elements
$(".track-wrapper").live("mouseenter", function(){
var leftOff = $(this).offset().left
var topOff = $(this).offset().top
var removeTrack = $(this).prev();
var tTrackWidth = $(this).width()
var rTrackWidth = $(removeTrack).width()
$(removeTrack).css({position: 'absolute', left: leftOff + tTrackWidth - rTrackWidth, top: topOff});
$(removeTrack).removeClass("invisible").show();
});
$(".track-wrapper").live("mouseleave", function(){
var elem = $(this);
var removeTrack = $(this).prev();
if ($(removeTrack).is(":hover")){
}else{
$(removeTrack).hide();
}
$(this).prev().hover("mouseleave", function(){
$(this).hide();
});
return false;
});
$(".remove-track").live("click", function(){
var parentWrapper = $(this).parent();
$(parentWrapper).remove();
updatePlaylistPositions();
});
// sort the playlist items
$(".playlist-items").sortable({
placeHolder: true,
cursor: 'crosshair'
});
$(".playlist-items").live("sortupdate", function(){
$(this).click();
updatePlaylistPositions();
});
$(".save-playlist").click(function(){
var tracksArray = []
var playlistTracks = $(".playlist-items-wrapper").find(".track-wrapper");
for (var i = 0; i < playlistTracks.length; i++){
tId = $(playlistTracks[i]).find(".title").data("track")
tracksArray.push(tId)
}
tmp = tracksArray.toString();
$("input[name='tracks']").val(tracksArray);
$("#new_playlist").submit();
});
</script>