Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added AJAX functionality to display a dialog box containing a source …
…feature files contents. Added pending spec but had trouble getting it to pass, will implement when paying off our technical debt
- Loading branch information
Showing
5 changed files
with
46 additions
and
0 deletions.
There are no files selected for viewing
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
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
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
/** | ||
* This plugin makes an ajax call to the backend requesting a specific piece of data from an object | ||
* For the moment, we'll primarily be using this to retrieve Salad's feature content but we should be able | ||
* to extend it to pull in any time of data and display it in a dialog box. | ||
* | ||
* @author Yomi Colledge | ||
* | ||
**/ | ||
$(function() { | ||
// create dialog div | ||
var $dialog = $('<div>').addClass('dialog path'); | ||
|
||
// bind click event to related property on page | ||
$('a#file-feature').live('click', function() { | ||
// make ajax call | ||
$.ajax({ | ||
url: $('a#file-feature').attr('href'), | ||
type: 'GET', | ||
dataType: 'html', | ||
complete: function(xhr, textStatus) { | ||
}, | ||
success: function(data, textStatus, xhr) { | ||
// populate dialog box with content | ||
$dialog | ||
.append(data) | ||
.dialog({ | ||
title: 'Source feature content', | ||
width: '75%', | ||
buttons: { "Ok": function() { $(this).dialog("close"); } } | ||
}); | ||
}, | ||
error: function(xhr, textStatus, errorThrown) { | ||
// display flash error | ||
} | ||
}); | ||
|
||
return false; | ||
}) | ||
}); |
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