luci-base: form.js: allow to disable descriptions row in TableSection 3934/head
authorAnton Kikin <a.kikin@tano-systems.com>
Sun, 19 Apr 2020 02:54:15 +0000 (05:54 +0300)
committerAnton Kikin <a.kikin@tano-systems.com>
Sun, 19 Apr 2020 10:56:24 +0000 (13:56 +0300)
Add 'nodescriptions' property to the TableSection class that allows
to disable displaying table header row with descriptions.

Signed-off-by: Anton Kikin <a.kikin@tano-systems.com>
modules/luci-base/htdocs/luci-static/resources/form.js

index 400ca036a2acb860e3260042a195986ca49e1e00..9e0a80ad334d81a4e2563e90a1d467b9d9c79bdc 100644 (file)
@@ -2265,6 +2265,16 @@ var CBITableSection = CBITypedSection.extend(/** @lends LuCI.form.TableSection.p
         * @default false
         */
 
+       /**
+        * If set to `true`, the header row with the options descriptions will
+        * not be displayed. By default, descriptions row is automatically displayed
+        * when at least one option has a description.
+        *
+        * @name LuCI.form.TableSection.prototype#nodescriptions
+        * @type boolean
+        * @default false
+        */
+
        /**
         * The `TableSection` implementation does not support option tabbing, so
         * its implementation of `tab()` will always throw an exception when
@@ -2402,7 +2412,7 @@ var CBITableSection = CBITypedSection.extend(/** @lends LuCI.form.TableSection.p
                        trEls.appendChild(trEl);
                }
 
-               if (has_descriptions) {
+               if (has_descriptions && !this.nodescriptions) {
                        var trEl = E('div', {
                                'class': 'tr cbi-section-table-descr ' + anon_class
                        });