Save button responds to change. Data updated
This commit is contained in:
		| @@ -38,7 +38,7 @@ | ||||
|                             <!-- status --> | ||||
|                             <div class="max-width  small-vertical-margin"> | ||||
|                                 <label for="httpStatus">Http Status</label> | ||||
|                                 <input id="httpStatus" class="bordered-field max-width" type="text" value="200" list="httpStatusSuggestion"> | ||||
|                                 <input id="httpStatus" class="bordered-field max-width data-field" type="text" value="200" list="httpStatusSuggestion"> | ||||
|                                 <datalist id="httpStatusSuggestion"> | ||||
|                                     <option value="200"> | ||||
|                                     <option value="300"> | ||||
| @@ -51,7 +51,7 @@ | ||||
|                             <!-- content type --> | ||||
|                             <div class="max-width  small-vertical-margin"> | ||||
|                                 <label for="typeSelector">Content Type</label> | ||||
|                                 <input id="typeSelector" class="bordered-field max-width" type="text" value="application/xml" list="contentTypes"> | ||||
|                                 <input id="typeSelector" class="bordered-field max-width data-field" type="text" value="application/xml" list="contentTypes"> | ||||
|                                 <datalist id="contentTypes"> | ||||
|                                     <option value="application/xml"> | ||||
|                                     <option value="application/json"> | ||||
| @@ -59,12 +59,12 @@ | ||||
|                                 </datalist> | ||||
|                             </div> | ||||
|                         </div> | ||||
|                         <button class="small-margins half-width with-padding action-button active">Save</button> | ||||
|                         <button id="btn-save" class="small-margins half-width with-padding action-button">Save</button> | ||||
|                     </div> | ||||
|                     <!-- body --> | ||||
|                     <div class="small-vertical-margin"> | ||||
|                         <label for="bodyEditor">Body</label> | ||||
|                         <textarea id="bodyEditor" class="bordered-field max-width with-padding height-300 vertically-resizeable"></textarea> | ||||
|                         <textarea id="bodyEditor" class="data-field bordered-field max-width with-padding height-300 vertically-resizeable"></textarea> | ||||
|                     </div> | ||||
|                     <!-- show/hide --> | ||||
|                     <div id="optional" class="clickable-text highlight"> | ||||
|   | ||||
| @@ -64,18 +64,16 @@ function getDomain(){ | ||||
| function setDataModified(){ | ||||
|     if(dataModified) return; | ||||
|     dataModified = true; | ||||
|     $('#btn-save').removeClass('btn-inactive'); | ||||
|     $('#btn-save').addClass('btn-action'); | ||||
|     $('#btn-save').addClass('active'); | ||||
|     $('#btn-save').click(getUpdate); | ||||
| } | ||||
|  | ||||
| //Adding change listener to fields | ||||
| $('.field').change(setModified); | ||||
| $('.data-field').change(setModified); | ||||
|  | ||||
| function setDataOrigin(){ | ||||
|     dataModified = false; | ||||
|     $('#btn-save').addClass('btn-inactive'); | ||||
|     $('#btn-save').removeClass('btn-action'); | ||||
|     $('#btn-save').removeClass('active'); | ||||
|     $('#btn-save').off(); | ||||
| } | ||||
|  | ||||
|   | ||||
| @@ -38,7 +38,7 @@ | ||||
|                             <!-- status --> | ||||
|                             <div class="max-width  small-vertical-margin"> | ||||
|                                 <label for="httpStatus">Http Status</label> | ||||
|                                 <input id="httpStatus" class="bordered-field max-width" type="text" value="200" list="httpStatusSuggestion"> | ||||
|                                 <input id="httpStatus" class="bordered-field max-width data-field" type="text" value="200" list="httpStatusSuggestion"> | ||||
|                                 <datalist id="httpStatusSuggestion"> | ||||
|                                     <option value="200"> | ||||
|                                     <option value="300"> | ||||
| @@ -51,7 +51,7 @@ | ||||
|                             <!-- content type --> | ||||
|                             <div class="max-width  small-vertical-margin"> | ||||
|                                 <label for="typeSelector">Content Type</label> | ||||
|                                 <input id="typeSelector" class="bordered-field max-width" type="text" value="application/xml" list="contentTypes"> | ||||
|                                 <input id="typeSelector" class="bordered-field max-width data-field" type="text" value="application/xml" list="contentTypes"> | ||||
|                                 <datalist id="contentTypes"> | ||||
|                                     <option value="application/xml"> | ||||
|                                     <option value="application/json"> | ||||
| @@ -59,12 +59,12 @@ | ||||
|                                 </datalist> | ||||
|                             </div> | ||||
|                         </div> | ||||
|                         <button class="small-margins half-width with-padding action-button active">Save</button> | ||||
|                         <button id="btn-save" class="small-margins half-width with-padding action-button">Save</button> | ||||
|                     </div> | ||||
|                     <!-- body --> | ||||
|                     <div class="small-vertical-margin"> | ||||
|                         <label for="bodyEditor">Body</label> | ||||
|                         <textarea id="bodyEditor" class="bordered-field max-width with-padding height-300 vertically-resizeable"></textarea> | ||||
|                         <textarea id="bodyEditor" class="data-field bordered-field max-width with-padding height-300 vertically-resizeable"></textarea> | ||||
|                     </div> | ||||
|                     <!-- show/hide --> | ||||
|                     <div id="optional" class="clickable-text highlight"> | ||||
|   | ||||
| @@ -64,18 +64,16 @@ function getDomain(){ | ||||
| function setDataModified(){ | ||||
|     if(dataModified) return; | ||||
|     dataModified = true; | ||||
|     $('#btn-save').removeClass('btn-inactive'); | ||||
|     $('#btn-save').addClass('btn-action'); | ||||
|     $('#btn-save').addClass('active'); | ||||
|     $('#btn-save').click(getUpdate); | ||||
| } | ||||
|  | ||||
| //Adding change listener to fields | ||||
| $('.field').change(setModified); | ||||
| $('.data-field').change(setModified); | ||||
|  | ||||
| function setDataOrigin(){ | ||||
|     dataModified = false; | ||||
|     $('#btn-save').addClass('btn-inactive'); | ||||
|     $('#btn-save').removeClass('btn-action'); | ||||
|     $('#btn-save').removeClass('active'); | ||||
|     $('#btn-save').off(); | ||||
| } | ||||
|  | ||||
| @@ -306,9 +304,6 @@ function fillMessageList(){ | ||||
|     $('.tile').click(function() { | ||||
|         console.log(this); | ||||
|         loadMessage(parseInt($(this).attr('tileid'))); | ||||
|         // console.log(e.target); | ||||
|         // const id = parseInt(e.target.tileid); | ||||
|         // loadMessage(id); | ||||
|     }); | ||||
|     // $('.btn-tile').click(tileRemoval); | ||||
| } | ||||
|   | ||||
		Reference in New Issue
	
	Block a user