mirror of
https://github.com/lucaspalomodevelop/core.git
synced 2026-03-14 00:24:40 +00:00
ui: improve on previous, translations for callers, inform dialog; closes #1762
This commit is contained in:
parent
fb6125ccb2
commit
3cbb4f554f
@ -95,7 +95,9 @@ POSSIBILITY OF SUCH DAMAGE.
|
||||
grid_clients.on("loaded.rs.jquery.bootgrid", function(){
|
||||
grid_clients.find(".command-disconnect").on("click", function(e) {
|
||||
var sessionId=$(this).data("row-id");
|
||||
stdDialogRemoveItem('{{ lang._('Disconnect selected client?') }}',function() {
|
||||
stdDialogConfirm('{{ lang._('Confirm disconnect') }}',
|
||||
'{{ lang._('Do you want to disconnect the selected client?') }}',
|
||||
'{{ lang._('Yes') }}', '{{ lang._('Cancel') }}', function () {
|
||||
ajaxCall(url="/api/captiveportal/session/disconnect/" + zoneid + '/',
|
||||
sendData={'sessionId': sessionId}, callback=function(data,status){
|
||||
// reload grid after delete
|
||||
@ -130,8 +132,8 @@ POSSIBILITY OF SUCH DAMAGE.
|
||||
<tr>
|
||||
<th data-column-id="sessionid" data-type="string" data-identifier="true" data-visible="false">{{ lang._('Session') }}</th>
|
||||
<th data-column-id="userName" data-type="string">{{ lang._('userName') }}</th>
|
||||
<th data-column-id="macAddress" data-type="string" data-css-class="hidden-xs hidden-sm" data-header-css-class="hidden-xs hidden-sm">{{ lang._('macAddress') }}</th>
|
||||
<th data-column-id="ipAddress" data-type="string" data-css-class="hidden-xs hidden-sm" data-header-css-class="hidden-xs hidden-sm">{{ lang._('ipAddress') }}</th>
|
||||
<th data-column-id="macAddress" data-type="string" data-css-class="hidden-xs hidden-sm" data-header-css-class="hidden-xs hidden-sm">{{ lang._('macAddress') }}</th>
|
||||
<th data-column-id="ipAddress" data-type="string" data-css-class="hidden-xs hidden-sm" data-header-css-class="hidden-xs hidden-sm">{{ lang._('ipAddress') }}</th>
|
||||
<th data-column-id="startTime" data-type="datetime">{{ lang._('connected since') }}</th>
|
||||
<th data-column-id="commands" data-width="7em" data-formatter="commands" data-sortable="false"></th>
|
||||
</tr>
|
||||
|
||||
@ -79,7 +79,9 @@ POSSIBILITY OF SUCH DAMAGE.
|
||||
});
|
||||
grid_templates.find(".command-delete").on("click", function(e) {
|
||||
var uuid=$(this).data("row-id");
|
||||
stdDialogRemoveItem('Remove selected item?',function() {
|
||||
stdDialogConfirm('{{ lang._('Confirm removal') }}',
|
||||
'{{ lang._('Do you want to remove the selected item?') }}',
|
||||
'{{ lang._('Yes') }}', '{{ lang._('Cancel') }}', function () {
|
||||
ajaxCall(url="/api/captiveportal/service/delTemplate/" + uuid,
|
||||
sendData={},callback=function(data,status){
|
||||
// reload grid after delete
|
||||
@ -187,10 +189,10 @@ POSSIBILITY OF SUCH DAMAGE.
|
||||
<thead>
|
||||
<tr>
|
||||
<th data-column-id="enabled" data-width="6em" data-type="string" data-formatter="rowtoggle">{{ lang._('Enabled') }}</th>
|
||||
<th data-column-id="zoneid" data-type="number" data-visible="false">{{ lang._('Zoneid') }}</th>
|
||||
<th data-column-id="zoneid" data-type="number" data-visible="false">{{ lang._('Zoneid') }}</th>
|
||||
<th data-column-id="description" data-type="string">{{ lang._('Description') }}</th>
|
||||
<th data-column-id="commands" data-width="7em" data-formatter="commands" data-sortable="false">{{ lang._('Commands') }}</th>
|
||||
<th data-column-id="uuid" data-type="string" data-identifier="true" data-visible="false">{{ lang._('ID') }}</th>
|
||||
<th data-column-id="uuid" data-type="string" data-identifier="true" data-visible="false">{{ lang._('ID') }}</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
@ -211,10 +213,10 @@ POSSIBILITY OF SUCH DAMAGE.
|
||||
<table id="grid-templates" class="table table-condensed table-hover table-striped table-responsive" data-editDialog="DialogTemplate">
|
||||
<thead>
|
||||
<tr>
|
||||
<th data-column-id="fileid" data-type="string" data-visible="false">{{ lang._('Fileid') }}</th>
|
||||
<th data-column-id="fileid" data-type="string" data-visible="false">{{ lang._('Fileid') }}</th>
|
||||
<th data-column-id="name" data-type="string">{{ lang._('Name') }}</th>
|
||||
<th data-column-id="commands" data-width="7em" data-formatter="commands" data-sortable="false">{{ lang._('Commands') }}</th>
|
||||
<th data-column-id="uuid" data-type="string" data-identifier="true" data-visible="false">{{ lang._('ID') }}</th>
|
||||
<th data-column-id="uuid" data-type="string" data-identifier="true" data-visible="false">{{ lang._('ID') }}</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
@ -233,12 +235,11 @@ POSSIBILITY OF SUCH DAMAGE.
|
||||
</div>
|
||||
<div class="col-md-12">
|
||||
<hr/>
|
||||
<button class="btn btn-primary" id="reconfigureAct" type="button"><b>{{ lang._('Apply') }}</b><i id="reconfigureAct_progress" class=""></i></button>
|
||||
<button class="btn btn-primary" id="reconfigureAct" type="button"><b>{{ lang._('Apply') }}</b> <i id="reconfigureAct_progress"></i></button>
|
||||
<br/><br/>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
{# include dialogs #}
|
||||
{{ partial("layout_partials/base_dialog",['fields':formDialogZone,'id':'DialogZone','label':'Edit zone'])}}
|
||||
|
||||
|
||||
@ -154,17 +154,7 @@ POSSIBILITY OF SUCH DAMAGE.
|
||||
if (data['details'] != undefined) {
|
||||
details = data['details'];
|
||||
}
|
||||
BootstrapDialog.show({
|
||||
type:BootstrapDialog.TYPE_INFO,
|
||||
title: "{{ lang._('Plugin details') }}",
|
||||
message: details,
|
||||
buttons: [{
|
||||
label: "{{ lang._('Close') }}",
|
||||
action: function(dialogRef){
|
||||
dialogRef.close();
|
||||
}
|
||||
}]
|
||||
});
|
||||
stdDialogInform("{{ lang._('Plugin details') }}", details, "{{ lang._('Close') }}");
|
||||
});
|
||||
}
|
||||
|
||||
@ -178,17 +168,7 @@ POSSIBILITY OF SUCH DAMAGE.
|
||||
if (data['license'] != undefined) {
|
||||
license = data['license'];
|
||||
}
|
||||
BootstrapDialog.show({
|
||||
type:BootstrapDialog.TYPE_INFO,
|
||||
title: "{{ lang._('License details') }}",
|
||||
message: license,
|
||||
buttons: [{
|
||||
label: "{{ lang._('Close') }}",
|
||||
action: function(dialogRef){
|
||||
dialogRef.close();
|
||||
}
|
||||
}]
|
||||
});
|
||||
stdDialogInform("{{ lang._('License details') }}", license, "{{ lang._('Close') }}");
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
@ -209,6 +209,7 @@ $.fn.UIBootgrid = function (params) {
|
||||
{
|
||||
if (gridParams['del'] != undefined) {
|
||||
var uuid=$(this).data("row-id");
|
||||
// XXX must be replaced, cannot translate
|
||||
stdDialogRemoveItem('Remove selected item?',function() {
|
||||
ajaxCall(url=gridParams['del'] + uuid,
|
||||
sendData={},callback=function(data,status){
|
||||
@ -269,6 +270,7 @@ $.fn.UIBootgrid = function (params) {
|
||||
// link delete selected items action
|
||||
$(this).find("*[data-action=deleteSelected]").click(function(){
|
||||
if ( gridParams['del'] != undefined) {
|
||||
// XXX must be replaced, cannot translate
|
||||
stdDialogRemoveItem("Remove selected items?",function(){
|
||||
var rows =$("#"+gridId).bootgrid('getSelectedRows');
|
||||
if (rows != undefined){
|
||||
|
||||
@ -270,19 +270,59 @@ function initFormAdvancedUI() {
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* standard dialog when information is required, wrapper around BootstrapDialog
|
||||
*/
|
||||
function stdDialogInform(title, message, close, callback, type) {
|
||||
var types = {
|
||||
"danger": BootstrapDialog.TYPE_DANGER,
|
||||
"default": BootstrapDialog.TYPE_DEFAULT,
|
||||
"info": BootstrapDialog.TYPE_INFO,
|
||||
"primary": BootstrapDialog.TYPE_PRIMARY,
|
||||
"success": BootstrapDialog.TYPE_SUCCESS,
|
||||
"warning": BootstrapDialog.TYPE_WARNING
|
||||
};
|
||||
if (!(type in types)) {
|
||||
type = 'info';
|
||||
}
|
||||
BootstrapDialog.show({
|
||||
title: title,
|
||||
message: message,
|
||||
type: types[type],
|
||||
buttons: [{
|
||||
label: close,
|
||||
action: function (dialogRef) {
|
||||
if (typeof callback !== 'undefined') {
|
||||
callback();
|
||||
}
|
||||
dialogRef.close();
|
||||
}
|
||||
}]
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* standard dialog when confirmation is required, wrapper around BootstrapDialog
|
||||
*/
|
||||
function stdDialogConfirmation(title, message, accept, decline, callback) {
|
||||
function stdDialogConfirm(title, message, accept, decline, callback, type) {
|
||||
var types = {
|
||||
// only types that make sense for confirmation
|
||||
"danger": BootstrapDialog.TYPE_DANGER,
|
||||
"default": BootstrapDialog.TYPE_DEFAULT,
|
||||
"warning": BootstrapDialog.TYPE_WARNING
|
||||
};
|
||||
if (!(type in types)) {
|
||||
type = 'warning';
|
||||
}
|
||||
BootstrapDialog.confirm({
|
||||
title: title,
|
||||
message: message,
|
||||
type:BootstrapDialog.TYPE_DANGER,
|
||||
type: types[type],
|
||||
btnCancelLabel: decline,
|
||||
btnOKLabel: accept,
|
||||
btnOKClass: 'btn-primary',
|
||||
btnOKClass: 'btn-' + type,
|
||||
callback: function(result) {
|
||||
if(result) {
|
||||
if (result) {
|
||||
callback();
|
||||
}
|
||||
}
|
||||
@ -290,8 +330,8 @@ function stdDialogConfirmation(title, message, accept, decline, callback) {
|
||||
}
|
||||
|
||||
/**
|
||||
* wrapper for backwards compatibility
|
||||
* wrapper for backwards compatibility (do not use)
|
||||
*/
|
||||
function stdDialogRemoveItem(message, callback) {
|
||||
stdDialogConfirmation('Remove', message, 'Yes', 'Cancel', callback)
|
||||
stdDialogConfirm('Remove', message, 'Yes', 'Cancel', callback);
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user