Add initial support for adding settings.
Adds "Add Setting" button to table, and shows a popup with form elements for adding a new setting. Does not yet add setting to the db.
This commit is contained in:
@@ -63,6 +63,15 @@ var rc = {
|
|||||||
);
|
);
|
||||||
$("#dialogfooterok").show();
|
$("#dialogfooterok").show();
|
||||||
break;
|
break;
|
||||||
|
case 'okcancel':
|
||||||
|
$("#dialogfooterokcancel_ok").click(function() {
|
||||||
|
rc.trigger(d.dialog.buttons.actions.ok, d.dialog.buttons.params);
|
||||||
|
});
|
||||||
|
$("#dialogfooterokcancel_cancel").click(function() {
|
||||||
|
rc.trigger(d.dialog.buttons.actions.cancel, d.dialog.buttons.params);
|
||||||
|
});
|
||||||
|
$("#dialogfooterokcancel").show();
|
||||||
|
break;
|
||||||
case 'yesno':
|
case 'yesno':
|
||||||
$("#dialogfooteryes").click(
|
$("#dialogfooteryes").click(
|
||||||
function() {
|
function() {
|
||||||
@@ -124,6 +133,11 @@ var rc = {
|
|||||||
|
|
||||||
'delete-source-confirm': function(params) {
|
'delete-source-confirm': function(params) {
|
||||||
rc.sources.remove_confirmed(params['plugin'], params['id']);
|
rc.sources.remove_confirmed(params['plugin'], params['id']);
|
||||||
|
},
|
||||||
|
|
||||||
|
'add-setting': function(params) {
|
||||||
|
// TODO
|
||||||
|
console.log('todo');
|
||||||
}
|
}
|
||||||
|
|
||||||
},
|
},
|
||||||
@@ -148,11 +162,17 @@ var rc = {
|
|||||||
settings: {
|
settings: {
|
||||||
|
|
||||||
init: function() {
|
init: function() {
|
||||||
$("#settings_save").click(
|
$("#settings_save").click(function() {
|
||||||
function() {
|
|
||||||
rc.settings.save();
|
rc.settings.save();
|
||||||
}
|
});
|
||||||
);
|
|
||||||
|
$("#settings_add").click(function() {
|
||||||
|
rc.settings.add();
|
||||||
|
});
|
||||||
|
},
|
||||||
|
|
||||||
|
add: function() {
|
||||||
|
rc.ajax.get(base_url + "ajax/admin/add-setting/");
|
||||||
},
|
},
|
||||||
|
|
||||||
add_stringlist_field: function(id) {
|
add_stringlist_field: function(id) {
|
||||||
|
|||||||
21
webui/source/templates/admin/add-setting.tpl
Normal file
21
webui/source/templates/admin/add-setting.tpl
Normal file
@@ -0,0 +1,21 @@
|
|||||||
|
<table>
|
||||||
|
<thead>
|
||||||
|
<th>Name</th>
|
||||||
|
<th>Type</th>
|
||||||
|
</thead>
|
||||||
|
<tbody>
|
||||||
|
<tr>
|
||||||
|
<td>
|
||||||
|
<input type="text" id="settings_add_name" value="" />
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
<select id="settings_add_tpe">
|
||||||
|
<option value="int">Integer</option>
|
||||||
|
<option value="bool">Boolean</option>
|
||||||
|
<option value="string">String</option>
|
||||||
|
<option value="string_list">String List</option>
|
||||||
|
</select>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
</tbody>
|
||||||
|
</table>
|
||||||
@@ -22,6 +22,7 @@
|
|||||||
<tr>
|
<tr>
|
||||||
<td colspan="2">
|
<td colspan="2">
|
||||||
<input type="button" id="settings_save" name="save" value="Save" />
|
<input type="button" id="settings_save" name="save" value="Save" />
|
||||||
|
<input type="button" id="settings_add" name="add" value="Add Setting" />
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
</tfoot>
|
</tfoot>
|
||||||
|
|||||||
26
webui/source/templates/ajax/admin/add-setting.tpl
Normal file
26
webui/source/templates/ajax/admin/add-setting.tpl
Normal file
@@ -0,0 +1,26 @@
|
|||||||
|
"page_replacements": {
|
||||||
|
|
||||||
|
"dialogheadertitle": {
|
||||||
|
"content": "Add Setting"
|
||||||
|
},
|
||||||
|
|
||||||
|
"dialogcontent": {
|
||||||
|
{include file="admin/add-setting.tpl" assign=add_setting_content}
|
||||||
|
"content": {$add_setting_content|json_encode}
|
||||||
|
}
|
||||||
|
|
||||||
|
},
|
||||||
|
|
||||||
|
"dialog": {
|
||||||
|
"show": true,
|
||||||
|
"buttons": {
|
||||||
|
"type": "okcancel",
|
||||||
|
"actions": {
|
||||||
|
"ok": [
|
||||||
|
"add-setting",
|
||||||
|
"close-dialog"
|
||||||
|
],
|
||||||
|
"cancel": "close-dialog"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -69,6 +69,12 @@
|
|||||||
<input type="button" class="dialogbutton" id="dialogfooterok" value="Ok" />
|
<input type="button" class="dialogbutton" id="dialogfooterok" value="Ok" />
|
||||||
</fieldset>
|
</fieldset>
|
||||||
</div>
|
</div>
|
||||||
|
<div id="dialogfooterokcancel" class="dialogfooterbuttonset">
|
||||||
|
<fieldset>
|
||||||
|
<input type="button" class="dialogbutton" id="dialogfooterokcancel_ok" value="Ok" />
|
||||||
|
<input type="button" class="dialogbutton" id="dialogfooterokcancel_cancel" value="Cancel" />
|
||||||
|
</fieldset>
|
||||||
|
</div>
|
||||||
<div id="dialogfooteryesno" class="dialogfooterbuttonset">
|
<div id="dialogfooteryesno" class="dialogfooterbuttonset">
|
||||||
<fieldset>
|
<fieldset>
|
||||||
<input type="button" class="dialogbutton" id="dialogfooteryes" value="Yes" />
|
<input type="button" class="dialogbutton" id="dialogfooteryes" value="Yes" />
|
||||||
|
|||||||
Reference in New Issue
Block a user