libs/cbi: auto-hide apply messages and make title and description optional for Map...
authorJo-Philipp Wich <jow@openwrt.org>
Mon, 9 Nov 2009 00:33:45 +0000 (00:33 +0000)
committerJo-Philipp Wich <jow@openwrt.org>
Mon, 9 Nov 2009 00:33:45 +0000 (00:33 +0000)
libs/cbi/luasrc/view/cbi/map.htm
libs/cbi/luasrc/view/cbi/simpleform.htm

index 8616568945c37aec83ff967f02ed3bb2798fa5d8..6b6f3e43b3d30c48bab6255234e1c308f9b2c34f 100644 (file)
@@ -14,10 +14,10 @@ $Id$
 -%>
 
 <div class="cbi-map" id="cbi-<%=self.config%>">
-       <h2><a id="content" name="content"><%=self.title%></a></h2>
-       <div class="cbi-map-descr"><%=self.description%></div>
+       <% if self.title and #self.title > 0 then %><h2><a id="content" name="content"><%=self.title%></a></h2><% end %>
+       <% if self.description and #self.description > 0 then %><div class="cbi-map-descr"><%=self.description%></div><% end %>
        <%- if self._apply then -%>
-               <fieldset class="cbi-section">
+               <fieldset class="cbi-section" id="cbi-apply-<%=self.config%>">
                        <legend><%:Applying changes%></legend>
                        <ul class="cbi-apply"><%-
                                local fp = self._apply()
@@ -30,6 +30,12 @@ $Id$
                                fp:close()
                        -%></ul>
                </fieldset>
+               <script type="text/javascript">
+                       window.setTimeout(function() {
+                               var e = document.getElementById('cbi-apply-<%=self.config%>');
+                               if(e) e.style.display = 'none';
+                       }, 750);
+               </script>
        <%- end -%>
        <%- self:render_children() %>
        <br />
index a0bb0f02b5333fbe3ae578076f4f8179cf47c414..9c40f8290c1da636eda3883270deabd6f7570b3c 100644 (file)
@@ -20,8 +20,8 @@ $Id$
        </div>
 <% end %>
        <div class="cbi-map" id="cbi-<%=self.config%>">
-               <h2><a id="content" name="content"><%=self.title%></a></h2>
-               <div class="cbi-map-descr"><%=self.description%></div>
+               <% if self.title and #self.title > 0 then %><h2><a id="content" name="content"><%=self.title%></a></h2><% end %>
+               <% if self.description and #self.description > 0 then %><div class="cbi-map-descr"><%=self.description%></div><% end %>
                <% self:render_children() %>
                <br />
        </div>