Skip to content

Commit

Permalink
add the ability to add or remove all videos
Browse files Browse the repository at this point in the history
  • Loading branch information
rweald committed Jun 10, 2011
1 parent bb92e3b commit 4511e3b
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 10 deletions.
21 changes: 11 additions & 10 deletions app/views/jobs/new.html.haml
Expand Up @@ -9,17 +9,18 @@
-#= @query
%a#add_all_videos{:href => "#"}
Add All Videos
=form_for Video.new, :url => search_path(:query => @query),:html => {:method => :get, :id => "filter_form"}, :remote => true do |f|
= label :query, :query
= text_field_tag :query , @query
= f.label :name
= f.select :name, options_for_select(Video.unique_names), :include_blank => true
= f.label "Camera Angle", :source_cam
= f.select :source_cam, options_for_select(Video.unique_source_cams ), :include_blank => true
= submit_tag "Filter", :hidden => true
.add_video_container
=form_for Video.new, :url => search_path(:query => @query),:html => {:method => :get, :id => "filter_form"}, :remote => true do |f|
= label :query, :query
= text_field_tag :query , @query
= f.label :name
= f.select :name, options_for_select(Video.unique_names), :include_blank => true
= f.label "Camera Angle", :source_cam
= f.select :source_cam, options_for_select(Video.unique_source_cams ), :include_blank => true
= submit_tag "Filter", :hidden => true

#result_container.job_video_search
= render "search/search_results"
#result_container.job_video_search
= render "search/search_results"

%br
%br
Expand Down
15 changes: 15 additions & 0 deletions public/javascripts/application.js
Expand Up @@ -42,6 +42,21 @@ $(document).ready(function(){
$('#result_container').html("An Error Occured");
});

$("#add_all_videos").live("click",function(){
event.preventDefault();
$('#added_video_list').attr("value", "all");
$('.add_video_container').css("display", "none");
$(this).before('<a href="#" id="remove_all_videos"> Remove All Videos </a>');
$(this).remove();
});

$('#remove_all_videos').live("click", function(){
$('#added_video_list').attr("value", "");
$(this).before('<a href="#" id="add_all_videos"> Add All Videos </a>');
$('.add_video_container').css("display", "block");
$(this).remove();
});

$('.job_video_search').delegate(".search_result", "click", function(){
event.preventDefault();
if ($(this).hasClass("selected")) {
Expand Down

0 comments on commit 4511e3b

Please sign in to comment.