]> source.dussan.org Git - sonarqube.git/commitdiff
SONAR-3548 move the search box of widgets to the right
authorSimon Brandhof <simon.brandhof@gmail.com>
Sat, 14 Jul 2012 11:22:16 +0000 (13:22 +0200)
committerSimon Brandhof <simon.brandhof@gmail.com>
Sat, 14 Jul 2012 11:22:16 +0000 (13:22 +0200)
sonar-server/src/main/webapp/WEB-INF/app/views/dashboard/_widget_definitions.html.erb
sonar-server/src/main/webapp/WEB-INF/app/views/dashboard/configure.html.erb

index 4a66f567ac1250ad6be7f5b50e485910f1d44c7a..49f6dbcd6fdd02b0789f73b8d0607ccd807d14b3 100644 (file)
@@ -1,21 +1,20 @@
-<div style="line-height: 20px; vertical-align: middle; padding: 0px 3px; margin-right: 10px">
+<div style="float: right; padding: 0 3px">
+  Search:
+  <input id="filter-widget-box" name="filter-widget-box" size="10" onKeyUp="filtersWidgetsByContent(this.value);"/>
+</div>
+
+<div style="line-height: 20px; vertical-align: middle; padding: 0 3px; margin-right: 10px">
   <ul class="horizontal widget_categs" id="widget-filters">
-    <li>Filter by category:</li>
+    <li>Category:</li>
     <li class="<%= 'selected' if category.blank? -%>">
-      <a href="#" onClick="return filterWidgets('')" id="widget-filter-none"><%= message('none') -%></a>
+      <a href="#" onClick="return filterWidgetsByCategory('')" id="widget-filter-none"><%= message('none') -%></a>
     </li>
     <% @widget_categories.each do |c| %>
       <li class="<%= 'selected' if category==c -%>">
-        <a href="#" onClick="return filterWidgets('<%= escape_javascript(c) -%>')" id="widget-filter-<%= u(c) -%>"><%= h(c) -%></a>
+        <a href="#" onClick="return filterWidgetsByCategory('<%= escape_javascript(c) -%>')" id="widget-filter-<%= u(c) -%>"><%= h(c) -%></a>
       </li>
     <% end %>
   </ul>
-</div>
-<div style="float: left; padding: 0px 3px">
-  Filter by content: 
-  <input id="filter-widget-box" name="filter-widget-box" size="20" onKeyUp="findWidgetsByContent(this.value);"/>
-</div>
-<div style="float: left; padding: 0px 3px;">
   <%= image_tag 'loading.gif', :style => 'vertical-align: top; display: none', :id => 'filter-widgets-loading' -%>
 </div>
 <div style="clear: both"></div>
index 087489d98627d5f94817e6321f7dc7f61dd85bdb..137945150f15f7efc435e47a1e5c242fec580a77 100644 (file)
@@ -69,7 +69,7 @@
   }
   Event.observe(window, 'load', init_dashboard, false);
 
-  function filterWidgets(category) {
+  function filterWidgetsByCategory(category) {
     new Ajax.Updater(
       'widget_defs',
       '<%= add_category_to_url(url_for dashboard_action(:widget_definitions))  -%>' + encodeURIComponent(category),
     $('filter-widgets-loading').show();
     return false;
   }
-  
+
   var widgetContents = [
-  <% 
-    number_of_widgets = @widget_definitions.size()
-    @widget_definitions.each_with_index do |definition, index|
-      widget_id = "def_#{definition.id.tr('_', '')}"
-      widget_title = message("widget.#{definition.id}.name", :default => definition.title).downcase
-      widget_description = message("widget.#{definition.id}.description", :default => definition.description).downcase 
-  %>
+    <%
+      number_of_widgets = @widget_definitions.size()
+      @widget_definitions.each_with_index do |definition, index|
+        widget_id = "def_#{definition.id.tr('_', '')}"
+        widget_title = message("widget.#{definition.id}.name", :default => definition.title).downcase
+        widget_description = message("widget.#{definition.id}.description", :default => definition.description).downcase
+    %>
     { id:"<%= widget_id -%>", c:"<%= widget_title.gsub(/\r\n?/, " ") -%> <%= widget_description.gsub(/\r\n?/, " ") -%>" } <%= "," unless index==number_of_widgets-1 -%>
-  <% end %>
-  ]
-  
-  function findWidgetsByContent(text) {
+    <% end %>
+  ];
+
+  function filtersWidgetsByContent(text) {
     var userInput = text.toLowerCase();
     widgetContents.each(function (widget) {
       var element = $(widget.id);
     return false;
   }
   //-->
-  
+
   $('filter-widget-box').focus();
 </script>