This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <div class="topic_holder"> | |
| <% @video.topics.uniq.each do |topic| %> | |
| <div class ="topic round"> | |
| <%= link_to "#{topic.name}", "#", :class => 'topic_link' %> | |
| <% topicable = Topicable.find_by_video_id_and_topic_id(@video.id, topic.id) %> | |
| <%= link_to "x", topicable_path(topicable.id), :method => :delete, :class => 'topic_delete' %> | |
| </div> | |
| <% end %> | |
| </div> | |
| <%= form_for @video, :url => {:action => "update"}, :remote => true do |f| %> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| $("#video_<%= @video.id %>").parent().parent().children(".topic_holder").html('<% @video.topics.uniq.each do |topic| %><div class ="topic"><%= link_to "#{topic.name}", '#', :class => 'topic_link' %><%= link_to "x", @topicable, :method => :delete, :class => 'topic_delete' %></div><% end %>'); | |
| $(".edit_video")[0].reset(); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| def destroy | |
| @topicable = Topicable.find(params[:id]) | |
| @topicable.destroy | |
| respond_to do |format| | |
| format.html {redirect_to :back} | |
| end | |
| end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| select: function(event, ui) { | |
| var url = $('.edit_video').attr('action'); | |
| var val = ui.item.topic.name; | |
| $.ajax({type:"PUT", url:url, data:{video:{topic_names:val}}}); | |
| return false; | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| def update | |
| @video = current_user.videos.find(params[:id]) | |
| respond_to do |format| | |
| if @video.update_attributes(params[:video]) | |
| format.html { redirect_to(@video) } | |
| format.js | |
| else | |
| format.html { render :action => "edit" } | |
| end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <%= link_to "#{(@video.topics.count == 0) ? 'Add descriptive topics so people can find your song!' : 'Edit Topics'}", '#', :id => 'edit_topics_link', :class => 'edit' %> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #{(@video.topics.count == 0) ? 'Add descriptive topics so people can find your song!' : 'Edit Topics'} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| $.get('layouts/text.js.erb', function(data) { | |
| $("#edit_topics_link").text(data); | |
| }); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| $("#edit_topics_link").text((@video.topics.count == 0) ? 'Add descriptive topics so people can find your song!' : 'Edit Topics'); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| $("#edit_topics_link").text(<%= (@video.topics().count() == 0) ? 'Add descriptive topics so people can find your song!' : 'Edit Topics' %>); |