Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
bug fixes, RESTful states, cleaned up JSON, nav keys for performing, …
…some extra nav links
- Loading branch information
Showing
9 changed files
with
368 additions
and
59 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
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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,58 @@ | ||
<TABLE ID="bodyTable"><TR><TD VALIGN="top" STYLE="background: ;"> | ||
|
||
<CENTER> | ||
|
||
<FORM NAME="rhymeForm" ID="rhymeForm" METHOD="post" ACTION="/rhymes/update"> | ||
<INPUT TYPE="hidden" NAME="rhymeID" VALUE="<%= rhymes.rhymeID %>" /> | ||
<TABLE BORDER=0> | ||
<TR><TD ALIGN="right" VALIGN="middle">rhyme/s</TD> | ||
<TD><INPUT TYPE="text" NAME="rhymeBody" ID="rhymeBody" VALUE="<%= rhymes.body %>" CLASS="text ui-widget-content ui-corner-all" SIZE=40 /></TD></TR> | ||
<TR><TD ALIGN="right" VALIGN="middle">topic #1</TD> | ||
<TD><INPUT TYPE="text" NAME="rhymeTopic1" ID="rhymeTopic1" VALUE="<%= rhymes.topic1 %>" CLASS="text ui-widget-content ui-corner-all" /></TD></TR> | ||
<TR><TD ALIGN="right" VALIGN="middle">topic #2</TD> | ||
<TD><INPUT TYPE="text" NAME="rhymeTopic2" ID="rhymeTopic2" VALUE="<%= rhymes.topic2 %>" CLASS="text ui-widget-content ui-corner-all" /></TD></TR> | ||
<TR><TD ALIGN="right" VALIGN="middle">date</TD> | ||
<TD><INPUT TYPE="text" NAME="rhymeDate" ID="rhymeDate" READONLY="true" VALUE="<%= rhymes.date %>" CLASS="text ui-widget-content ui-corner-all" SIZE=35 /></TD></TR> | ||
</TABLE> | ||
|
||
<INPUT NAME="updateRhyme" TYPE="submit" ID="updateRhyme" VALUE="update dis rhyme!" CLASS="glow" STYLE="font-size: 17pt;" /> | ||
|
||
<!-- DIV confirms successful AJAX post msg --> | ||
<DIV ID="updated" CLASS="text ui-widget-content ui-corner-all" STYLE="display: none; background: yellow;"></DIV> | ||
|
||
</FORM> | ||
|
||
</CENTER> | ||
|
||
</TD></TR></TABLE> <!-- /bodyTable --> | ||
|
||
<script type="text/javascript"> | ||
|
||
$(function() { | ||
// loops through all rhymes and gives them click handlers | ||
$('#updateRhyme').click(function(e) { | ||
console.log("Fired"); | ||
formData = $('#rhymeForm').serialize(); | ||
$.ajax({ | ||
url: "/rhymes/update", | ||
type: "POST", | ||
data: formData, | ||
dataType: "json", | ||
success: function(response) { | ||
if (response.status == "OK") { | ||
console.log("Rhyme modified successfully, let's display it."); | ||
$("#updated").html("Updated!"); | ||
$("#updated").css("display", "block"); | ||
} | ||
}, | ||
error : function(error) { | ||
console.log("There was an error updating the rhyme."); | ||
console.log(error); | ||
} | ||
}); | ||
e.preventDefault(); | ||
return false; | ||
}); | ||
}); | ||
|
||
</script> |
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,67 @@ | ||
<CENTER> | ||
|
||
<TABLE BORDER=0 CELLPADDING=10><TR><TD VALIGN="middle"><H2>All Da Rhymes.</H2></TD></TR></TABLE><BR /> | ||
|
||
<TABLE ID="bodyTable"><TR><TD VALIGN="top"> | ||
|
||
<CENTER> | ||
|
||
<!-- creates a new form for each rhyme to be edited --> | ||
<% for (var i=0; i<rhymes.length; i++) { %> | ||
<FORM NAME="rhymeForm<%= i %>" ID="rhymeForm<%= i %>" METHOD="post" ACTION="/rhymes/update"> | ||
<INPUT TYPE="hidden" NAME="rhymeID" VALUE="<%= rhymes[i].rhymeID %>" /> | ||
<TABLE BORDER=0> | ||
<TR><TD ALIGN="right" VALIGN="middle">rhyme/s</TD> | ||
<TD><INPUT TYPE="text" NAME="rhymeBody" ID="rhyme<%= i %>Body" VALUE="<%= rhymes[i].body %>" CLASS="text ui-widget-content ui-corner-all" SIZE=40 /></TD></TR> | ||
<TR><TD ALIGN="right" VALIGN="middle">topic #1</TD> | ||
<TD><INPUT TYPE="text" NAME="rhymeTopic1" ID="rhyme<%= i %>Topic1" VALUE="<%= rhymes[i].topic1 %>" CLASS="text ui-widget-content ui-corner-all" /></TD></TR> | ||
<TR><TD ALIGN="right" VALIGN="middle">topic #2</TD> | ||
<TD><INPUT TYPE="text" NAME="rhymeTopic2" ID="rhyme<%= i %>Topic2" VALUE="<%= rhymes[i].topic2 %>" CLASS="text ui-widget-content ui-corner-all" /></TD></TR> | ||
<TR><TD ALIGN="right" VALIGN="middle">date</TD> | ||
<TD><INPUT TYPE="text" NAME="rhymeDate" ID="rhyme<%= i %>Date" READONLY="true" VALUE="<%= rhymes[i].date %>" CLASS="text ui-widget-content ui-corner-all" SIZE=35 /></TD></TR> | ||
</TABLE> | ||
|
||
<INPUT NAME="updateRhyme" TYPE="submit" ID="updateRhyme<%= i %>" VALUE="update dis rhyme!" CLASS="glow" STYLE="font-size: 17pt;" /> | ||
|
||
<!-- DIV confirms successful AJAX post msg --> | ||
<DIV ID="updated<%= i %>" CLASS="text ui-widget-content ui-corner-all" STYLE="display: none; background: yellow;"></DIV> | ||
|
||
</FORM><BR /><HR NOSHADE SIZE=1 COLOR="black"><BR /> | ||
<% } %> | ||
|
||
</CENTER> | ||
|
||
</TD></TR></TABLE> <!-- /bodyTable --> | ||
|
||
<script type="text/javascript"> | ||
|
||
$(function() { | ||
// loops through all rhymes and gives them click handlers | ||
<% for (var i=0; i<rhymes.length; i++) { %> | ||
$('#updateRhyme<%= i %>').click(function(e) { | ||
console.log("Fired"); | ||
formData<%= i %> = $('#rhymeForm<%= i %>').serialize(); | ||
$.ajax({ | ||
url: "/rhymes/update", | ||
type: "POST", | ||
data: formData<%= i %>, | ||
dataType: "json", | ||
success: function(response) { | ||
if (response.status == "OK") { | ||
console.log("Rhyme modified successfully, let's display it."); | ||
$("#updated<%= i %>").html("Updated!"); | ||
$("#updated<%= i %>").css("display", "block"); | ||
} | ||
}, | ||
error : function(error) { | ||
console.log("There was an error updating the rhyme."); | ||
console.log(error); | ||
} | ||
}); | ||
e.preventDefault(); | ||
return false; | ||
}); | ||
<% } %> | ||
}); | ||
|
||
</script> |
Oops, something went wrong.