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