[Libreoffice-commits] .: bug/bug bug/bug.xhtml

Loic Dachary loic at kemper.freedesktop.org
Sun Sep 18 00:59:15 PDT 2011


 bug/bug.xhtml   |   10 +++++++-
 bug/bug/bug.css |    5 ++++
 bug/bug/bug.js  |    2 -
 bug/bug/skin.js |   69 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++
 4 files changed, 84 insertions(+), 2 deletions(-)

New commits:
commit 42e0dad5868972db7891a19668a2585b73813cd5
Author: Loic Dachary <loic at dachary.org>
Date:   Sun Sep 18 09:57:55 2011 +0200

    If ?skin is added to the Bug Submission Assistant URL, links are shown to display all the states. For instance ?skin=submit will show the page as it would look just before the user submit the form. For HTML/CSS integration, it helps to visualize the states locally without the need to actually install the corresponding reverse proxy.

diff --git a/bug/bug.xhtml b/bug/bug.xhtml
index affe3e1..4a25786 100644
--- a/bug/bug.xhtml
+++ b/bug/bug.xhtml
@@ -15,9 +15,11 @@
     <script type="text/javascript" src="jquery-validation-1.8.1/jquery.validate.js"></script>
     <script type="text/javascript" src="jquery.iframe-post-form.js"></script>
     <script type="text/javascript" src="bug.js"></script>
+    <script type="text/javascript" src="skin.js"></script>
     <link rel="stylesheet" href="bug.css" type="text/css" media="screen"></link>
   </head>
   <body>
+    <div class="skin"><a href="?skin=login">login</a> <a href="?skin=component">component</a> <a href="?skin=subcomponent">subcomponent</a> <a href="?skin=description">description</a> <a href="?skin=submit">submit</a> <a href="?skin=complete">complete</a> </div>
     <div class="content">
       <div class="left">
         <div class="submission">Steps</div>
@@ -139,7 +141,13 @@
       </div>
     </div>
     <script>
-      $(document).ready($.bug.main);
+      $(document).ready(function() {
+        if(location.search.indexOf('skin') >= 0) {
+          $.skin();
+        } else {
+          $.bug.main();
+        }
+      });
     </script>
   </body>
 </html>
diff --git a/bug/bug/bug.css b/bug/bug/bug.css
index e311113..43370b3 100644
--- a/bug/bug/bug.css
+++ b/bug/bug/bug.css
@@ -112,3 +112,8 @@ body {
 .state_attach {
     display: none;
 }
+
+/* skin */
+.skin {
+    display: none;
+}
diff --git a/bug/bug/bug.js b/bug/bug/bug.js
index 2f6b7f2..4d5e31b 100644
--- a/bug/bug/bug.js
+++ b/bug/bug/bug.js
@@ -215,7 +215,7 @@
             var component = $('.state_component .component').val().replace('_','%20');
             var subcomponent = $('.state_subcomponent .subcomponent').val();
             var list = '/buglist.cgi?columnlist=short_desc&component=' + component + '&product=LibreOffice&query_format=advanced&short_desc_type=allwordssubstr&ctype=csv&short_desc=' + subcomponent;
-            $.bug.ajax('GET', list, undefined, function(data) {
+            $.bug.ajax('GET', list).pipe(function(data) {
                 var lines = data.split('\n');
                 var bug_urls = [];
                 for(var i = 1; i < lines.length; i++) {
diff --git a/bug/bug/skin.js b/bug/bug/skin.js
new file mode 100644
index 0000000..1b626e2
--- /dev/null
+++ b/bug/bug/skin.js
@@ -0,0 +1,69 @@
+//
+//     Copyright (C) 2011 Loic Dachary <loic at dachary.org>
+//
+//     This program is free software: you can redistribute it and/or modify
+//     it under the terms of the GNU General Public License as published by
+//     the Free Software Foundation, either version 3 of the License, or
+//     (at your option) any later version.
+//
+//     This program is distributed in the hope that it will be useful,
+//     but WITHOUT ANY WARRANTY; without even the implied warranty of
+//     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+//     GNU General Public License for more details.
+//
+//     You should have received a copy of the GNU General Public License
+//     along with this program.  If not, see <http://www.gnu.org/licenses/>.
+//
+
+(function($) {
+
+  $.skin = function() {
+      $('.skin').show();
+      if(location.search.indexOf('skin=login') >= 0) {
+          $.bug.state_signin();
+      } else if(location.search.indexOf('skin=component') >= 0) {
+          $.bug.state_component();
+      } else if(location.search.indexOf('skin=subcomponent') >= 0) {
+          $.bug.state_component();
+          $('.state_component .component').prop("selectedIndex", 2);
+          $('.state_component .component').change();
+          $('.state_subcomponent .subcomponent').prop("selectedIndex", 2);
+          $.bug.ajax = function(settings) {
+              return $.Deferred().resolve('NUM,DESC\n100,"BUG 1"\n200,"BUG 2"\n');
+          };
+          $('.state_subcomponent .subcomponent').change();
+      } else if(location.search.indexOf('skin=description') >= 0) {
+          $.bug.state_component();
+          $('.state_component .component').prop("selectedIndex", 2);
+          $('.state_component .component').change();
+          $('.state_subcomponent .subcomponent').prop("selectedIndex", 2);
+          $.bug.ajax = function(settings) {
+              return $.Deferred().resolve('NUM,DESC\n100,"BUG 1"\n200,"BUG 2"\n');
+          };
+          $('.state_subcomponent .subcomponent').change();
+          $('.state_version .versions').prop("selectedIndex", 2);
+          $('.state_version .versions').change();
+          $('.state_description .short').val('12');
+          $('.state_description .long').val('123456');
+      } else if(location.search.indexOf('skin=submit') >= 0) {
+          $.bug.state_component();
+          $('.state_component .component').prop("selectedIndex", 2);
+          $('.state_component .component').change();
+          $('.state_subcomponent .subcomponent').prop("selectedIndex", 2);
+          $.bug.ajax = function(settings) {
+              return $.Deferred().resolve('NUM,DESC\n100,"BUG 1"\n200,"BUG 2"\n');
+          };
+          $('.state_subcomponent .subcomponent').change();
+          $('.state_version .versions').prop("selectedIndex", 2);
+          $('.state_version .versions').change();
+          $('.state_description .short').val('1234567890');
+          $('.state_description .long').val('12345678901');
+          $('.state_description .short').change();
+      } else if(location.search.indexOf('skin=complete') >= 0) {
+          $.bug.state_success();
+          $.bug.state_attach();
+          $('.state_attach img').attr('src', 'icons/Database.png');
+      }
+  };
+
+})(jQuery);


More information about the Libreoffice-commits mailing list