Skip to content

Commit

Permalink
alert window works w button + uses new media field
Browse files Browse the repository at this point in the history
  • Loading branch information
hinanaya committed Jun 4, 2024
1 parent 073217c commit 5045913
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 8 deletions.
4 changes: 1 addition & 3 deletions html/alert/addedit.html
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

<div class="fieldrow">
<label class="required" data-t>Media Item</label>
<span id="alert_item_info"></span>
<ob-field-media data-edit data-single data-record id="alert_item_id"></ob-field-media>
</div>

<div class="fieldrow">
Expand Down Expand Up @@ -173,8 +173,6 @@
</div>
</fieldset>


<input type="hidden" id="alert_item_id" value="">
<input type="hidden" id="alert_id" value="">

</div>
4 changes: 4 additions & 0 deletions html/alert/alert.html
Original file line number Diff line number Diff line change
Expand Up @@ -26,4 +26,8 @@ <h1 data-t>Alerts</h1>
</table>
</div>

<p>
<button class="add" onclick="OB.Alert.addeditAlertWindow()">Add Alert</button>
</p>

</div>
8 changes: 3 additions & 5 deletions js/alert.js
Original file line number Diff line number Diff line change
Expand Up @@ -188,7 +188,7 @@ OB.Alert.saveAlert = function()
else fields.stop = Math.round(stop_date.getTime()/1000)+'';

fields.id = $('#alert_id').val();
fields.item_id = $('#alert_item_id').val();
fields.item_id = document.querySelector('#alert_item_id').value[0];

OB.API.post('alerts','save',fields,function(data)
{
Expand Down Expand Up @@ -239,10 +239,9 @@ OB.Alert.editAlert = function(id)
}
else $('#alert_duration').hide();

$('#alert_item_info').text(emerg.item_name);
$('#alert_name').val(emerg.name);
$('#alert_frequency').val(emerg.frequency);
$('#alert_item_id').val(emerg.item_id);
document.querySelector('#alert_item_id').value = [emerg.item_id];
$('#alert_id').val(emerg.id);

$('#alert_start_datetime').val(new Date(parseInt(emerg.start)*1000));
Expand All @@ -261,8 +260,7 @@ OB.Alert.addAlert = function(item_id,item_name,item_type)
OB.Alert.addeditAlertWindow();
$('.edit_only').hide();

$('#alert_item_id').val(item_id);
$('#alert_item_info').text(item_name);
document.querySelector('#alert_item_id').value = [item_id];

if(item_type=='image') $('#alert_duration').show();
else $('#alert_duration').hide();
Expand Down

0 comments on commit 5045913

Please sign in to comment.