diff options
author | Andrew Dolgov <[email protected]> | 2021-11-10 20:44:51 +0300 |
---|---|---|
committer | Andrew Dolgov <[email protected]> | 2021-11-10 20:44:51 +0300 |
commit | 9e8d69739f21e5ac85977d57a2a6c961e318c26e (patch) | |
tree | 0fc52f7be644b5f86e236cc7cb8f4dc4351da8f9 /js/App.js | |
parent | 7a52560e4e3b0652d32645b60ae13e4904f606bc (diff) |
add two helper account access levels:
- read only - can't subscribe to more feeds, feed updates are skipped
- disabled - can't login
define used access levels as UserHelper constants and refactor code to
use them instead of hardcoded numbers
Diffstat (limited to 'js/App.js')
-rw-r--r-- | js/App.js | 12 |
1 files changed, 10 insertions, 2 deletions
@@ -17,6 +17,9 @@ const App = { hotkey_actions: {}, is_prefs: false, LABEL_BASE_INDEX: -1024, + UserAccessLevels: { + ACCESS_LEVEL_READONLY: -1 + }, _translations: {}, Hash: { get: function() { @@ -76,10 +79,15 @@ const App = { </select> ` }, - select_hash: function(name, value, values = {}, attributes = {}, id = "") { + select_hash: function(name, value, values = {}, attributes = {}, id = "", params = {}) { + let keys = Object.keys(values); + + if (params.numeric_sort) + keys = keys.sort((a,b) => a - b); + return ` <select name="${name}" dojoType="fox.form.Select" id="${App.escapeHtml(id)}" ${this.attributes_to_string(attributes)}> - ${Object.keys(values).map((vk) => + ${keys.map((vk) => `<option ${vk == value ? 'selected="selected"' : ''} value="${App.escapeHtml(vk)}">${App.escapeHtml(values[vk])}</option>` ).join("")} </select> |