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();
|
||||
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':
|
||||
$("#dialogfooteryes").click(
|
||||
function() {
|
||||
@@ -124,6 +133,11 @@ var rc = {
|
||||
|
||||
'delete-source-confirm': function(params) {
|
||||
rc.sources.remove_confirmed(params['plugin'], params['id']);
|
||||
},
|
||||
|
||||
'add-setting': function(params) {
|
||||
// TODO
|
||||
console.log('todo');
|
||||
}
|
||||
|
||||
},
|
||||
@@ -148,11 +162,17 @@ var rc = {
|
||||
settings: {
|
||||
|
||||
init: function() {
|
||||
$("#settings_save").click(
|
||||
function() {
|
||||
$("#settings_save").click(function() {
|
||||
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) {
|
||||
|
||||
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>
|
||||
<td colspan="2">
|
||||
<input type="button" id="settings_save" name="save" value="Save" />
|
||||
<input type="button" id="settings_add" name="add" value="Add Setting" />
|
||||
</td>
|
||||
</tr>
|
||||
</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" />
|
||||
</fieldset>
|
||||
</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">
|
||||
<fieldset>
|
||||
<input type="button" class="dialogbutton" id="dialogfooteryes" value="Yes" />
|
||||
|
||||
Reference in New Issue
Block a user