# HG changeset patch # User Atul Varma # Date 1272254091 25200 # Node ID 4bb45ff5788ab5a88e251863399c09feb642bbfc # Parent 00d2584cdd7b07f3326042c1f57af5ee042a58d2 added repair dialog diff -r 00d2584cdd7b -r 4bb45ff5788a index.html --- a/index.html Sun Apr 25 19:47:53 2010 -0700 +++ b/index.html Sun Apr 25 20:54:51 2010 -0700 @@ -19,10 +19,11 @@ class="requires-login">Change User
  • Refresh
  • +
  • Repair
  • Find A User
  • File A Bug
  • - +
     
    @@ -59,19 +60,31 @@
    -

    Just type in part of a product or component below, select from +

    Type in part of a product or component below, select from the auto-complete list, and press enter. You'll then get sent to a Bugzilla page where you can fill out a summary, description, and more details for the bug.

    - +
    Category
    +
    +
    +
    +

    If this page isn't working as you expect, enter the + text “repair my dashboard” below and + press enter. Hopefully that will fix things.

    +
    + +
    +
    +
    +
    @@ -90,6 +103,9 @@
    +
    Done. Try reloading this page and see + if your problem is fixed.
    +
    Hey, that wasn't the right text.
    diff -r 00d2584cdd7b -r 4bb45ff5788a js/modules/app.js --- a/js/modules/app.js Sun Apr 25 19:47:53 2010 -0700 +++ b/js/modules/app.js Sun Apr 25 20:54:51 2010 -0700 @@ -173,11 +173,11 @@ } }; - $("input#category").autocomplete(categoryOptions); + $("#file-bug .category").autocomplete(categoryOptions); $("#file-bug").submit( function(event) { event.preventDefault(); - var parts = $("input#category").val().split(EM_DASH); + var parts = $("#file-bug .category").val().split(EM_DASH); window.open(bugzilla.BASE_UI_URL + "/enter_bug.cgi?" + "product=" + escape(parts[0]) + "&" + "component=" + escape(parts[1])); @@ -187,6 +187,26 @@ }; }; +Require.modules["app/ui/repair"] = function(exports, require) { + var $ = require("jQuery"); + + $("#repair form").submit( + function() { + var phrase = $("#repair .phrase").val(); + var response; + if (phrase == "repair my dashboard") { + require("cache").clear(); + response = $("#templates .repair-success").clone(); + } else + response = $("#templates .repair-failure").clone(); + $("#repair .result").empty().append(response); + $("#repair .result").hide().slideDown(); + }); + + exports.init = function init() { + }; +}; + Require.modules["app/ui/find-user"] = function(exports, require) { var $ = require("jQuery"); var bugzilla = require("app/bugzilla-auth").Bugzilla; @@ -318,6 +338,7 @@ exports.init = function init(document) { setupDocumentTitleChanger(document); + require("app/ui/repair").init(); require("app/ui/dashboard").init(); require("app/ui/login-form").init(); require("app/ui/find-user").init(); diff -r 00d2584cdd7b -r 4bb45ff5788a js/modules/cache.js --- a/js/modules/cache.js Sun Apr 25 19:47:53 2010 -0700 +++ b/js/modules/cache.js Sun Apr 25 20:54:51 2010 -0700 @@ -1,6 +1,8 @@ Require.modules["cache"] = function(exports, require) { + const CACHE_NAME = "cache"; + var window = require("window"); - var cache = window.localStorage.getItem("cache"); + var cache = window.localStorage.getItem(CACHE_NAME); if (cache) cache = JSON.parse(cache); @@ -12,14 +14,20 @@ // Remove the key first, to get around a strange iPad // issue: http://stackoverflow.com/questions/2603682/is-anyone-else-receiving-a-quota-exceeded-err-on-their-ipad-when-accessing-locals - window.localStorage.removeItem("cache"); + window.localStorage.removeItem(CACHE_NAME); // TODO: We should really catch QUOTA_EXCEEDED_ERR here, // which could be thrown if the user is in private // browsing mode. - window.localStorage.setItem("cache", JSON.stringify(cache)); + window.localStorage.setItem(CACHE_NAME, JSON.stringify(cache)); }; + exports.get = function get(key) { return cache[key]; }; + + exports.clear = function clear() { + window.localStorage.removeItem(CACHE_NAME); + cache = {}; + }; };