luci2: make sort / remove column in L.cbi.TableSection as narrow as possible
[project/luci2/ui.git] / luci2 / htdocs / luci2 / luci2.js
index d275d1b..7ade584 100644 (file)
@@ -5989,7 +5989,7 @@ function LuCI2()
                        return $('<div />')
                                .addClass('form-control-static')
                                .attr('id', this.id(sid))
-                               .html(this.ucivalue(sid));
+                               .html(this.ucivalue(sid) || this.label('placeholder'));
                },
 
                formvalue: function(sid)
@@ -6066,11 +6066,11 @@ function LuCI2()
                                $('<li />')
                                        .append($('<label />')
                                                .addClass(itype + ' inline text-muted')
-                                               .append($('<input />')
+                                               .append(this.validator(sid, $('<input />')
                                                        .attr('name', itype + id)
                                                        .attr('type', itype)
                                                        .attr('value', '')
-                                                       .prop('checked', $.isEmptyObject(check)))
+                                                       .prop('checked', $.isEmptyObject(check)), true))
                                                .append(L.tr('unspecified')))
                                        .appendTo(ul);
                        }
@@ -6482,6 +6482,11 @@ function LuCI2()
                        return true;
                },
 
+               sort: function(section1, section2)
+               {
+                       return 0;
+               },
+
                sections: function(cb)
                {
                        var s1 = L.uci.sections(this.map.uci_package);
@@ -6492,6 +6497,8 @@ function LuCI2()
                                        if (this.filter(s1[i]))
                                                s2.push(s1[i]);
 
+                       s2.sort(this.sort);
+
                        if (typeof(cb) == 'function')
                                for (var i = 0; i < s2.length; i++)
                                        cb.call(this, s2[i]);
@@ -7046,6 +7053,7 @@ function LuCI2()
                        if (this.options.addremove !== false || this.options.sortable)
                        {
                                row.append($('<td />')
+                                       .css('width', '1%')
                                        .addClass('text-right')
                                        .append($('<div />')
                                                .addClass('btn-group')