
_view_request_info_x-editable.js.html
About this file
This file contains xeditable scripts. It contains html templates for submit and cancel buttons. The script enables the user to modify the title and agency request summary on the page (using ajax). The html templates for those fields have parsley attributes applied to them. Upon submitting the form, which is allowed by pressing enter, they form is validated.
Code Issues
-
Lines 20, 25, 30, 35 use the variables
pk, url
. What do these variables represent? Recommend using a more meaningful variable names for them.
Code Check Report
Documentation drawn from source code
/*
Sets submit and cancel buttons for xeditable.
*/
/*
Sets request title and agency request summary to be editable inline.
Sends a PUT request to to view/edit endpoint when data is submitted.
Data being sent is updated editable content from input textarea.
*/
$(document).ready(function () {
/*
Enables parsley to validate on editable submit button.
*/
$(document).on('click', '.editable-submit', function (e) {
/*
Do nothing when cancel button is clicked
*/
$(document).on("mousedown", ".editable-cancel", function(e) {
/*
Enables editable textarea to submit on enter.
*/
$(document).on('keypress', '.request-editable', function (e) {
/*
Enables editable textarea to submit on blur (click outside of textarea).
*/
function bindFocusOut() {
$(document).on('focusout', '.request-editable', function (e) {
/*
Rebind focusout event on click of xeditable input fields
*/
$(".xedit").click(function () {