Bug 1059756 - Add a link to Loop's help page in the gear menu. r=MattN

This commit is contained in:
Romain Gauthier 2014-11-24 09:57:44 +00:00
parent ec74dc79d7
commit 023d0a2865
7 changed files with 67 additions and 1 deletions

View File

@ -1669,6 +1669,7 @@ pref("loop.oauth.google.scope", "https://www.google.com/m8/feeds");
pref("loop.rooms.enabled", true);
pref("loop.fxa_oauth.tokendata", "");
pref("loop.fxa_oauth.profile", "");
pref("loop.support_url", "https://support.mozilla.org/kb/group-conversations-firefox-hello-webrtc");
// serverURL to be assigned by services team
pref("services.push.serverURL", "wss://push.services.mozilla.com/");

View File

@ -281,6 +281,13 @@ loop.panel = (function(_, mozL10n) {
}
},
handleHelpEntry: function(event) {
event.preventDefault();
var helloSupportUrl = navigator.mozLoop.getLoopPref('support_url');
window.open(helloSupportUrl);
window.close();
},
_isSignedIn: function() {
return !!navigator.mozLoop.userProfile;
},
@ -318,7 +325,10 @@ loop.panel = (function(_, mozL10n) {
mozL10n.get("settings_menu_item_signin"),
onClick: this.handleClickAuthEntry,
displayed: navigator.mozLoop.fxAEnabled,
icon: this._isSignedIn() ? "signout" : "signin"})
icon: this._isSignedIn() ? "signout" : "signin"}),
SettingsDropdownEntry({label: mozL10n.get("help_label"),
onClick: this.handleHelpEntry,
icon: "help"})
)
)
);

View File

@ -281,6 +281,13 @@ loop.panel = (function(_, mozL10n) {
}
},
handleHelpEntry: function(event) {
event.preventDefault();
var helloSupportUrl = navigator.mozLoop.getLoopPref('support_url');
window.open(helloSupportUrl);
window.close();
},
_isSignedIn: function() {
return !!navigator.mozLoop.userProfile;
},
@ -319,6 +326,9 @@ loop.panel = (function(_, mozL10n) {
onClick={this.handleClickAuthEntry}
displayed={navigator.mozLoop.fxAEnabled}
icon={this._isSignedIn() ? "signout" : "signin"} />
<SettingsDropdownEntry label={mozL10n.get("help_label")}
onClick={this.handleHelpEntry}
icon="help" />
</ul>
</div>
);

View File

@ -659,6 +659,10 @@ body[dir=rtl] .generate-url-spinner {
background: transparent url(../img/svg/glyph-signout-16x16.svg) no-repeat center center;
}
.settings-menu .icon-help {
background: transparent url(../img/svg/glyph-help-16x16.svg) no-repeat center center;
}
/* Footer */
.footer {

View File

@ -0,0 +1,15 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- This Source Code Form is subject to the terms of the Mozilla Public
- License, v. 2.0. If a copy of the MPL was not distributed with this
- file, You can obtain one at http://mozilla.org/MPL/2.0/. -->
<!-- Generator: Adobe Illustrator 18.1.0, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
viewBox="0 0 16 16" enable-background="new 0 0 16 16" xml:space="preserve">
<circle fill="#5A5A5A" cx="8" cy="8" r="8"/>
<g>
<path fill="#FFFFFF" d="M10.716,5.643c0,1.943-2.158,1.812-2.158,3.154v0.3H6.831V8.726c0-2.075,1.907-1.932,1.907-2.915
c0-0.432-0.312-0.684-0.84-0.684c-0.491,0-0.972,0.24-1.403,0.731L5.284,4.923C5.967,4.121,6.855,3.64,8.09,3.64
C9.841,3.64,10.716,4.576,10.716,5.643z M8.797,11.268c0,0.6-0.479,1.092-1.079,1.092s-1.079-0.492-1.079-1.092
c0-0.588,0.479-1.079,1.079-1.079S8.797,10.68,8.797,11.268z"/>
</g>
</svg>

After

Width:  |  Height:  |  Size: 1.0 KiB

View File

@ -50,6 +50,7 @@ browser.jar:
content/browser/loop/shared/img/svg/glyph-account-16x16.svg (content/shared/img/svg/glyph-account-16x16.svg)
content/browser/loop/shared/img/svg/glyph-signin-16x16.svg (content/shared/img/svg/glyph-signin-16x16.svg)
content/browser/loop/shared/img/svg/glyph-signout-16x16.svg (content/shared/img/svg/glyph-signout-16x16.svg)
content/browser/loop/shared/img/svg/glyph-help-16x16.svg (content/shared/img/svg/glyph-help-16x16.svg)
content/browser/loop/shared/img/audio-call-avatar.svg (content/shared/img/audio-call-avatar.svg)
content/browser/loop/shared/img/beta-ribbon.svg (content/shared/img/beta-ribbon.svg)
content/browser/loop/shared/img/icons-10x10.svg (content/shared/img/icons-10x10.svg)

View File

@ -356,6 +356,31 @@ describe("loop.panel", function() {
});
});
describe("Help", function() {
var supportUrl = "https://example.com";
beforeEach(function() {
navigator.mozLoop.getLoopPref = function(pref) {
if (pref === "support_url")
return supportUrl;
return "unseen";
};
sandbox.stub(window, "open");
sandbox.stub(window, "close");
});
it("should open a tab to the support page", function() {
var view = TestUtils.renderIntoDocument(loop.panel.SettingsDropdown());
TestUtils.Simulate
.click(view.getDOMNode().querySelector(".icon-help"));
sinon.assert.calledOnce(window.open);
sinon.assert.calledWithExactly(window.open, supportUrl);
});
});
describe("#render", function() {
it("should render a ToSView", function() {
var view = createTestPanelView();