Bug 16310 - Remove the use of "onclick" from audio alerts template

This patch removes one use of "onclick" in favor of defining events in
the JavaScript.

This patch also makes changes to the style of some buttons to make the
interface a little more consistent with current practices.

To test, apply the patch and go to Administration -> Audio alerts.

- In the list of existing audio alerts, click the "Edit" button for any
  alert. The correct data should be loaded in the edit form.

Signed-off-by: Marc Véron <veron@veron.ch>

Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>

Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
This commit is contained in:
Owen Leonard 2016-04-20 10:29:03 -04:00 committed by Kyle M Hall
parent 537adde2d2
commit fcd139b222
2 changed files with 13 additions and 2 deletions

View File

@ -111,14 +111,15 @@
</td>
<td>[% a.selector %]</td>
<td>[% a.sound %]</td>
<td><a class="btn btn-small" onclick="EditAlert( this, '[% a.id %]','[% a.precedence %]', '[% a.selector | replace( "'", "\\'" ) | html %]', '[% a.sound %]' )" ><i class="fa fa-pencil"></i> Edit</a></td>
<td>
<a class="btn btn-mini edit" data-soundid="[% a.id %]" data-precedence="[% a.precedence %]" data-selector="[% a.selector %]" data-sound="[% a.sound %]"><i class="fa fa-pencil"></i> Edit</a></td>
</tr>
[% END %]
</tbody>
</table>
<p>
<button id="delete-alerts" type="submit" class="btn disabled"><i class="fa fa-trash"></i> Delete selected alerts</button>
<button id="delete-alerts" type="submit" class="btn btn-small disabled"><i class="fa fa-trash"></i> Delete selected alerts</button>
</p>
</form>
</div>

View File

@ -65,6 +65,16 @@ $( document ).ready(function() {
return false;
}
});
$(".edit").on("click",function(e){
e.preventDefault();
var elt = this;
var id = $(this).data("soundid");
var precedence = $(this).data("precedence");
var selector = $(this).data("selector");
var sound = $(this).data("sound");
EditAlert( elt, id, precedence, selector, sound );
});
});
function enablePlayButton(sound_field_value,playbutton){