Created
May 10, 2012 03:08
-
-
Save brandon-beacher/2650802 to your computer and use it in GitHub Desktop.
This file contains 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
$("ul#selected_lessons a").live("click", function(event) { | |
event.preventDefault(); | |
$(this).closest("li").appendTo($("ul#available_lessons")); | |
$("ul#available_lessons").sortable("refresh"); | |
$("ul#selected_lessons").sortable("refresh"); | |
$.post( | |
$("ul#selected_lessons").data("update-url"), | |
$("ul#selected_lessons").sortable("serialize")); | |
}); |
This file contains 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
it "should remove a lesson from a pathway" do | |
pathway = create(:pathway) | |
lesson = create(:lesson, grade_level_id: pathway.grade_level_id) | |
pathway.lessons << lesson | |
pathway.lessons.reload.must_include lesson | |
visit edit_pathway_path(pathway) | |
page.click_on("remove") | |
sleep 5 | |
pathway.lessons.reload.wont_include lesson | |
end |
This file contains 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
$("ul#selected_lessons a").live("click", function(event) { | |
event.preventDefault(); | |
var li = $(this).closest("li").detach(); | |
$("ul#selected_lessons").sortable("refresh"); | |
$.post( | |
$("ul#selected_lessons").data("update-url"), | |
$("ul#selected_lessons").sortable("serialize"), | |
function() { | |
li.appendTo($("ul#available_lessons")); | |
$("ul#available_lessons").sortable("refresh"); | |
} | |
); | |
}); |
This file contains 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
it "should remove a lesson from a pathway" do | |
pathway = create(:pathway) | |
lesson = create(:lesson, grade_level_id: pathway.grade_level_id) | |
pathway.lessons << lesson | |
pathway.lessons.reload.must_include lesson | |
visit edit_pathway_path(pathway) | |
page.click_on("remove") | |
page.has_selector?("#available_lessons .handle").must_equal true | |
pathway.lessons.reload.wont_include lesson | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment