Age | Commit message (Collapse) | Author |
|
All supported browsers natively support this functionality since
quite a while already.
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
|
|
Reduce if to a simple boolean evaluation
Signed-off-by: Sergey Ponomarev <stokito@gmail.com>
|
|
On legacy views, the `L.ui` JavaScript class is not automatically loaded,
so request it before updating tables.
Fixes: e0e6989a4a ("luci-base: introduce new LuCI.ui.Table class")
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
|
|
Introduce a new `LuCI.ui.Table` class to simplify generating HTML tables
for data output and turn the existing `cbi_update_table()` procedure into
a wrapper around this new facility.
Tables generated by the new class closely resemble the old markup but
provide additional sorting capabilities.
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
|
|
Only replace null, objects and function values with the empty string but
return booleans and numbers as strings.
Spotted while debugging #5587.
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
|
|
Fixes: #5544
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
|
|
Fixes: #5354
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
|
|
luci-base: prevent empty field for adding new entry
|
|
Signed-off-by: Florian Eckert <fe@dev.tdt.de>
|
|
Fixes: #5189
Fixes: f919635310 ("luci-base: batch DOM updates to prevent slowdown")
Ref: https://github.com/openwrt/luci/commit/f919635310286b3b905aedb716d707da1ea2c811#commitcomment-53495580
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
|
|
Signed-off-by: Olli Asikainen <olli.asikainen@gmail.com>
|
|
Signed-off-by: DeYu Liu <vito_sam@outlook.com>
|
|
Modern browsers allow decomposing table markup equally well as nested div
constructs, therefor migrate our <div> table markup to actual <table> tags
but keep the old table/tr/th/td CSS classes for now to allow for a smooth
theme transition.
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
|
|
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
|
|
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
|
|
- Implement `N_(count, "String singular", "String plural" [, "Context"])`
plural translation function.
- Extend `_()` to optionally accept a second disambiguation context
argument.
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
|
|
To mirror the behavior of the Lua runtime, we need to collapse whitepace
in translation source strings before doing the string table lookup.
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
|
|
Fixes: #3066
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
|
|
Remove the old server side support for file browsing and file uploading
and switch to a client side widget instead which uses XMLHTTPRequests to
upload files via cgi-io and RPC calls for file listing and status queries.
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
|
|
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
|
|
Fixes: #3003
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
|
|
Ensure that patterns like %d, %x, %o or %b properly truncate their
operands to whole integers.
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
|
|
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
|
|
Implement further widget primitives like text inputs or checkboxes and
support custom validation callback functions when instantiating CBI
validators.
Also add support initializing ui.js widgets from the "data-ui-widget"
HTML attribute.
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
|
|
Move the widget code to the ui class and replace it with compatibility
shims in cbi.js
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
|
|
JS CBI fields have no parent form element anymore.
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
|
|
In order to prepare the move of the dynlist and dropdown widgets into
the LuCI ui class, remove the direct calls to cbi_d_update() and replace
them with custom events instead.
Extend cbi_init() to handle these custom events and to invoke
cbi_d_update() when receiving them.
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
|
|
In cbi.js there is an error which causes ipaddrport validation to always fail.
JS match() return the entire match as ret[0] and individual matches (for multiple ()) as the
subsequent list members. So we fix it by just fixing the index in the calls that want the
individual parts.
Signed-off-by: Daniel F. Dickinson <cshored@thecshore.com>
|
|
Do not call cbi_init() from the browser field template but lazily initialize
the field, like it is being done for all other widgets as well.
Fixes: #2398
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
|
|
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
|
|
- Instantiate tab menus on the client side
- Simplify server side markup generation
- Show error indicators in cbi tabs
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
|
|
The showTooltip() and hideTooltip() functions have been moved to luci.js
Reported-by: brv phoenix <feixuekaka1@gmail.com>
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
|
|
Introduce a new luci.dom class which groups the DOM manipulation helpers
such as E(), findParent(), matchesElem() etc.
Provide wrappers for the old functions to ease the transition to the new
functions.
Also add a new widget helper function L.itemlist() which consolidates
the item enumeration formatting code found on various pages.
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
|
|
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
|
|
- cbi.js: make sure to treat single bytes as signed char when
handling end cases
- template_lmo.c: make sure to treat single bytes as signed
char when handling end cases, avoids hash miscalculations
on ARM
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
|
|
Replace a sign-propagating right shift by a zero-filling right shift to avoid
calculating a wrong hash code in the three-trailing-bytes case.
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
|
|
The C side implementation of the hash operates on bytes while the JS variant
operated on UTF-16 codepoints, leading to miscalculations on input strings
containing multibyte sequences.
Recode the given string to an internal UTF-8 byte representation and
calculate the hash over that.
Fixes client side mapping of translation strings containing non-ASCII
characters.
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
|
|
Add two new functions showModal() and hideModal() which will fade in and
close an open modal respectively.
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
|
|
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
|
|
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
|
|
Directly attach validation handlers to cbi dropdowns as well, this allows
validating dropdown choices made by the user, similar to how plain select
boxes are handled by the cbi JavaScript.
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
|
|
In order to make cbi dropdowns usable for validation and other code
expecting native form elements, set the .value DOM property on the
dropdown parent element whenever the selection is changed.
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
|
|
Rework the tooltip event delegation logic to prevent hiding the tooltop
when the cursor is moved to a children of the tooltip container element.
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
|
|
In order to prepare support for calling cbi validation on non-native form
widgets, remove direct usages of the node.form property and lookup the
containing form using findParent() instead.
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
|
|
Due to a misspelled property name, only the first value was passed in
the event details.
Fixes: c2b570998 ("luci-base: cbi.js: rework dropdown implementation")
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
|
|
Fixed several issues for translation.
- add translation markup to "Expecting "
- add missing ")" into "valid time (HH:MM:SS"
Signed-off-by: INAGAKI Hiroshi <musashino.open@gmail.com>
|
|
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
|
|
If a given attribute value is a function, register it as event listener,
if it is an object, filter it through JSON.stringify(), else set it
as-is.
This helps to reduce some boiler-plate code when building DOM structures.
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
|
|
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
|
|
- Refactor event handler closures into class methods and bind them instead
- Fix quirk in dropdown placement calculation
- Different dropdown placement strategy on touch devices
- Broadcast custom "cbi-dropdown-change" event when value is changed
- Implement setValues() method to alter dropdown selection
- Prevent creating empty custom values
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
|