mirror of
https://github.com/overte-org/overte.git
synced 2025-04-25 23:36:41 +02:00
Make localhost, anonymous, and logged-in rows non-deletable
This commit is contained in:
parent
fd77f8401c
commit
8a2685325b
2 changed files with 18 additions and 3 deletions
|
@ -148,7 +148,10 @@
|
||||||
"editable": true,
|
"editable": true,
|
||||||
"default": false
|
"default": false
|
||||||
}
|
}
|
||||||
]
|
],
|
||||||
|
|
||||||
|
"non-deletable-row-key": "permissions_id",
|
||||||
|
"non-deletable-row-values": ["localhost", "anonymous", "logged-in"]
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
|
|
|
@ -919,6 +919,9 @@ function makeTable(setting, keypath, setting_value, isLocked) {
|
||||||
html += "<span class='help-block'>" + setting.help + "</span>"
|
html += "<span class='help-block'>" + setting.help + "</span>"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
var nonDeletableRowKey = setting["non-deletable-row-key"];
|
||||||
|
var nonDeletableRowValues = setting["non-deletable-row-values"];
|
||||||
|
|
||||||
html += "<table class='table table-bordered " + (isLocked ? "locked-table" : "") + "' data-short-name='" + setting.name
|
html += "<table class='table table-bordered " + (isLocked ? "locked-table" : "") + "' data-short-name='" + setting.name
|
||||||
+ "' name='" + keypath + "' id='" + (typeof setting.html_id !== 'undefined' ? setting.html_id : keypath)
|
+ "' name='" + keypath + "' id='" + (typeof setting.html_id !== 'undefined' ? setting.html_id : keypath)
|
||||||
+ "' data-setting-type='" + (isArray ? 'array' : 'hash') + "'>";
|
+ "' data-setting-type='" + (isArray ? 'array' : 'hash') + "'>";
|
||||||
|
@ -961,6 +964,8 @@ function makeTable(setting, keypath, setting_value, isLocked) {
|
||||||
html += "<td class='key'>" + rowIndexOrName + "</td>"
|
html += "<td class='key'>" + rowIndexOrName + "</td>"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
var isNonDeletableRow = false;
|
||||||
|
|
||||||
_.each(setting.columns, function(col) {
|
_.each(setting.columns, function(col) {
|
||||||
|
|
||||||
if (isArray) {
|
if (isArray) {
|
||||||
|
@ -972,6 +977,9 @@ function makeTable(setting, keypath, setting_value, isLocked) {
|
||||||
colName = keypath + "." + rowIndexOrName + "." + col.name;
|
colName = keypath + "." + rowIndexOrName + "." + col.name;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
isNonDeletableRow = isNonDeletableRow
|
||||||
|
|| (nonDeletableRowKey === col.name && nonDeletableRowValues.indexOf(colValue) !== -1);
|
||||||
|
|
||||||
if (isArray && col.type === "checkbox" && col.editable) {
|
if (isArray && col.type === "checkbox" && col.editable) {
|
||||||
html += "<td class='" + Settings.DATA_COL_CLASS + "'name='" + col.name + "'>"
|
html += "<td class='" + Settings.DATA_COL_CLASS + "'name='" + col.name + "'>"
|
||||||
+ "<input type='checkbox' class='form-control toggle-checkbox table-checkbox' "
|
+ "<input type='checkbox' class='form-control toggle-checkbox table-checkbox' "
|
||||||
|
@ -990,8 +998,12 @@ function makeTable(setting, keypath, setting_value, isLocked) {
|
||||||
"'><a href='javascript:void(0);' class='" + Settings.MOVE_UP_SPAN_CLASSES + "'></a>"
|
"'><a href='javascript:void(0);' class='" + Settings.MOVE_UP_SPAN_CLASSES + "'></a>"
|
||||||
+ "<a href='javascript:void(0);' class='" + Settings.MOVE_DOWN_SPAN_CLASSES + "'></a></td>"
|
+ "<a href='javascript:void(0);' class='" + Settings.MOVE_DOWN_SPAN_CLASSES + "'></a></td>"
|
||||||
}
|
}
|
||||||
html += "<td class='" + Settings.ADD_DEL_BUTTONS_CLASSES +
|
if (isNonDeletableRow) {
|
||||||
"'><a href='javascript:void(0);' class='" + Settings.DEL_ROW_SPAN_CLASSES + "'></a></td>"
|
html += "<td></td>";
|
||||||
|
} else {
|
||||||
|
html += "<td class='" + Settings.ADD_DEL_BUTTONS_CLASSES
|
||||||
|
+ "'><a href='javascript:void(0);' class='" + Settings.DEL_ROW_SPAN_CLASSES + "'></a></td>";
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
html += "</tr>"
|
html += "</tr>"
|
||||||
|
|
Loading…
Reference in a new issue