From 9d8bdceac4f4db11f3f2d2a18918f13f90756ea5 Mon Sep 17 00:00:00 2001 From: Giulio Cesare Solaroli Date: Wed, 11 Mar 2015 18:18:00 +0100 Subject: [PATCH] =?UTF-8?q?Disabled=20=E2=80=98download=E2=80=99=20link=20?= =?UTF-8?q?when=20offline=20copy=20feature=20is=20not=20available?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Components/Panels/ExtraFeaturesPanel.js | 21 ++++++++++++++----- 1 file changed, 16 insertions(+), 5 deletions(-) diff --git a/frontend/delta/js/Clipperz/PM/UI/Components/Panels/ExtraFeaturesPanel.js b/frontend/delta/js/Clipperz/PM/UI/Components/Panels/ExtraFeaturesPanel.js index 43a4498..f226ec6 100644 --- a/frontend/delta/js/Clipperz/PM/UI/Components/Panels/ExtraFeaturesPanel.js +++ b/frontend/delta/js/Clipperz/PM/UI/Components/Panels/ExtraFeaturesPanel.js @@ -32,7 +32,9 @@ Clipperz.PM.UI.Components.Panels.ExtraFeaturesPanel = React.createClass({ }, handleDownloadOfflineCopyLink: function (anEvent) { - MochiKit.Signal.signal(Clipperz.Signal.NotificationCenter, 'downloadOfflineCopy'); + if (this.isFeatureEnabled('OFFLINE_COPY')) { + MochiKit.Signal.signal(Clipperz.Signal.NotificationCenter, 'downloadOfflineCopy'); + } }, propTypes: { @@ -56,6 +58,10 @@ Clipperz.PM.UI.Components.Panels.ExtraFeaturesPanel = React.createClass({ }, this); }, + isFeatureEnabled: function (aValue) { + return (this.props['features'].indexOf(aValue) > -1); + }, + //========================================================================= render: function () { @@ -65,11 +71,16 @@ Clipperz.PM.UI.Components.Panels.ExtraFeaturesPanel = React.createClass({ 'right': true, 'open': this.props['settingsPanelStatus'] == 'OPEN' } + + var offlineCopyButtonClasses = { + 'button': true, + 'disabled': !this.isFeatureEnabled('OFFLINE_COPY') + } - return React.DOM.div({key:'extraFeaturesPanel', id:'extraFeaturesPanel', className:React.addons.classSet(classes)}, [ + return React.DOM.div({'key':'extraFeaturesPanel', 'id':'extraFeaturesPanel', 'className':React.addons.classSet(classes)}, [ React.DOM.header({}, [ - React.DOM.div({className:'settingsToggle'}, [ - Clipperz.PM.UI.Components.Button({eventName:'settingsToggleButton', label:"menu", handler:this.settingsToggleHandler}) + React.DOM.div({'className':'settingsToggle'}, [ + Clipperz.PM.UI.Components.Button({'eventName':'settingsToggleButton', 'label':"menu", 'handler':this.settingsToggleHandler}) ]) ]), @@ -146,7 +157,7 @@ Clipperz.PM.UI.Components.Panels.ExtraFeaturesPanel = React.createClass({ React.DOM.h2({}, "Offline copy"), React.DOM.div({}, [ React.DOM.p({}, "With just one click you can dump all your encrypted data from Clipperz servers to your hard disk and create a read-only offline version of Clipperz to be used when you are not connected to the Internet."), - React.DOM.a({'className':'button', 'onClick':this.handleDownloadOfflineCopyLink}, "Download") + React.DOM.a({'className':React.addons.classSet(offlineCopyButtonClasses), 'onClick':this.handleDownloadOfflineCopyLink}, "Download") ]) ]), React.DOM.li({}, [