migrate privacy policy and changelog to a tab

10.7.0-preview
Kyle K 2019-08-02 06:48:50 +00:00
parent 5eedc3b507
commit 6fe3cb1500
11 changed files with 82 additions and 204 deletions

View File

@ -1,3 +1,4 @@
<div class="title" i18n="defaultChangelogHead"></div>
<span>2019.04.10 - 10.5.0 - BetaFlight</span>
<ul>
<li>Fixes:

View File

@ -75,7 +75,7 @@ const getChangesetId = gulp.series(getHash, writeChangesetId);
gulp.task('get-changeset-id', getChangesetId);
// dist_yarn MUST be done after dist_src
var distBuild = gulp.series(dist_src, dist_yarn, dist_locale, dist_libraries, dist_resources, getChangesetId);
var distBuild = gulp.series(dist_src, dist_changelog, dist_yarn, dist_locale, dist_libraries, dist_resources, getChangesetId);
var distRebuild = gulp.series(clean_dist, distBuild);
gulp.task('dist', distRebuild);
@ -240,10 +240,14 @@ function dist_src() {
.pipe(gulp.src(distSources, { base: 'src' }))
.pipe(gulp.src('manifest.json', { passthrougth: true }))
.pipe(gulp.src('yarn.lock', { passthrougth: true }))
.pipe(gulp.src('changelog.html', { passthrougth: true }))
.pipe(gulp.dest(DIST_DIR));
}
function dist_changelog() {
return gulp.src('changelog.html')
.pipe(gulp.dest(DIST_DIR+"tabs/"));
}
// This function relies on files from the dist_src function
function dist_yarn() {
return gulp.src(['./dist/package.json', './dist/yarn.lock'])

View File

@ -947,7 +947,7 @@ li.active .ic_mission {
#content {
margin-top: 0px;
padding: 0px;
height: calc(100% - 150px);
height: calc(100% - 156px);
/* (port picker 105px, log CLOSED 25px, status bar: 20px + padding) - was: calc(100% - 171px)*/
background-color: white;
overflow-x: hidden;
@ -960,7 +960,7 @@ li.active .ic_mission {
#content.logopen {
margin-top: 0px;
padding: 0px;
height: calc(100% - 234px); /* (port picker, log OPEN, status bar: 20px + padding) - was: calc(100% - 171px)*/
height: calc(100% - 240px); /* (port picker, log OPEN, status bar: 20px + padding) - was: calc(100% - 171px)*/
background-color: white;
overflow-x: hidden;
overflow-y: auto;

View File

@ -180,139 +180,3 @@
display: block;
float: left;
}
/* changelog block */
#changelog {
width: 250px;
height: 100%;
position: fixed;
right: -245px;
top: 0px;
}
#changelog .wrapper {
height: 100%;
padding: 0 20px;
border-left: 5px solid var(--accent);
overflow-y: auto;
display: none;
}
#changelog .button {
transform: rotate(270deg);
top: 50px;
right: 215px;
position: absolute;
background: var(--accent);
border-radius: 5px 5px 0 0;
border-bottom: none;
height: 30px;
}
#changelog .button a {
display: block;
padding: 5px 10px;
width: 70px;
text-align: center;
color: #000;
}
#changelog .title {
margin: 20px 0;
font-size: 16px;
}
#content.log_open #changelog {
right: 0px;
color: var(--defaultText);
background: var(--sideBackground);
}
#content.log_open #changelog .wrapper {
display: block;
}
/* changelog content */
#changelog .log {
line-height: 17px;
}
#changelog .log span {
display: block;
font-weight: bold;
padding-bottom: 5px;
border-bottom: 1px solid var(--subtleAccent);
}
#changelog .log ul {
margin: 5px 0 20px 10px;
}
#changelog .log li {
font-weight: normal;
margin-bottom: 5px;
}
#changelog .log p {
margin-bottom: 20px;
}
/* privacy policy block */
#privacy_policy {
width: 500px;
height: 100%;
position: fixed;
right: -495px;
top: 0px;
}
#privacy_policy .wrapper {
height: 100%;
padding: 0 20px;
border-left: 5px solid var(--accent);
overflow-y: auto;
display: none;
}
#privacy_policy .button {
transform: rotate(270deg);
top: 170px;
right: 450px;
position: absolute;
background: var(--accent);
border-radius: 5px 5px 0 0;
border-bottom: none;
height: 30px;
}
#privacy_policy .button a {
display: block;
padding: 5px 10px;
width: 100px;
text-align: center;
color: #000;
}
#content.policy_open #privacy_policy {
right: 0px;
color: var(--defaultText);
background: var(--sideBackground);
}
#content.policy_open #privacy_policy .wrapper {
display: block;
}
/* privacy policy content */
#privacy_policy .policy ul {
margin: 5px 0 20px 10px;
}
#privacy_policy .policy li {
font-weight: normal;
margin-bottom: 5px;
}
#privacy_policy .policy p {
margin-bottom: 20px;
}

View File

@ -0,0 +1,37 @@
#tab-static {
background-color: inherit;
background-image: url(/images/osd-bg-1.jpg);
background-attachment: fixed;
background-size: cover;
background-position: bottom right;
}
#tab-static span {
display: block;
font-weight: bold;
padding-top: 16px;
padding-bottom: 5px;
border-bottom: 1px solid var(--subtleAccent);
}
#tab-static .title {
font-size: 16px;
}
#tab-static ul {
margin: 5px 0 20px 10px;
}
#tab-static li {
font-weight: normal;
margin-bottom: 5px;
}
#tab-static-contents {
padding-top: 10px;
padding-left: 16px;
padding-right: 16px;
padding-bottom: 40px;
background-color: inherit;
max-width: 650px;
}

View File

@ -16,7 +16,9 @@ var GUI_control = function () {
this.defaultAllowedTabsWhenDisconnected = [
'landing',
'changelog',
'firmware_flasher',
'privacy_policy',
'help'
];
this.defaultAllowedFCTabsWhenConnected = [
@ -243,7 +245,7 @@ GUI_control.prototype.tab_switch_cleanup = function (callback) {
MSP.callbacks_cleanup(); // we don't care about any old data that might or might not arrive
GUI.interval_kill_all(); // all intervals (mostly data pulling) needs to be removed on tab switch
if (this.active_tab) {
if (this.active_tab && TABS[this.active_tab]) {
TABS[this.active_tab].cleanup(callback);
} else {
callback();

View File

@ -222,6 +222,12 @@ function startProcess() {
case 'landing':
TABS.landing.initialize(content_ready);
break;
case 'changelog':
TABS.staticTab.initialize('changelog', content_ready);
break;
case 'privacy_policy':
TABS.staticTab.initialize('privacy_policy', content_ready);
break;
case 'firmware_flasher':
TABS.firmware_flasher.initialize(content_ready);
break;

View File

@ -12,46 +12,6 @@ TABS.landing.initialize = function (callback) {
// translate to user-selected language
i18n.localizePage();
// load changelog content
$('#changelog .log').load('./changelog.html');
/** changelog trigger **/
$("#changelog_toggle").on('click', function() {
var state = $(this).data('state2');
if (state) {
$("#changelog").animate({right: -245}, 200, function () {
$("#content").removeClass('log_open');
});
state = false;
} else {
$("#changelog").animate({right: 0}, 200);
$("#content").addClass('log_open');
state = true;
}
$(this).text(state ? i18n.getMessage('close') : i18n.getMessage('defaultChangelogAction'));
$(this).data('state2', state);
});
// load privacy policy content
$('#privacy_policy .policy').load('./tabs/privacy_policy.html');
/** changelog trigger **/
$("#privacy_policy_toggle").on('click', function() {
var state = $(this).data('state2');
if (state) {
$("#privacy_policy").animate({right: -495}, 200, function () {
$("#content").removeClass('policy_open');
});
state = false;
} else {
$("#privacy_policy").animate({right: 0}, 200);
$("#content").addClass('policy_open');
state = true;
}
$(this).text(state ? i18n.getMessage('close') : i18n.getMessage('defaultPrivacyPolicyAction'));
$(this).data('state2', state);
});
GUI.content_ready(callback);
});

21
src/js/tabs/static_tab.js Normal file
View File

@ -0,0 +1,21 @@
'use strict';
TABS.staticTab = {};
TABS.staticTab.initialize = function (staticTabName, callback) {
var self = this;
if (GUI.active_tab != staticTabName) {
GUI.active_tab = staticTabName;
}
var tabFile = "./tabs/" + staticTabName + ".html";
$('#content').html('<div id="tab-static"><div id="tab-static-contents"></div>');
$('#tab-static-contents').load(tabFile, function () {
// translate to user-selected language
i18n.localizePage();
GUI.content_ready(callback);
});
};
// Just noting that other tabs have cleanup functions.

View File

@ -8,6 +8,7 @@
<link type="text/css" rel="stylesheet" href="./js/libraries/jquery.nouislider.pips.min.css"/>
<link type="text/css" rel="stylesheet" href="./js/libraries/flightindicators.css"/>
<link type="text/css" rel="stylesheet" href="./css/main.css" media="all"/>
<link type="text/css" rel="stylesheet" href="./css/tabs/static_tab.css" media="all"/>
<link type="text/css" rel="stylesheet" href="./css/tabs/landing.css" media="all"/>
<link type="text/css" rel="stylesheet" href="./css/tabs/setup.css" media="all"/>
<link type="text/css" rel="stylesheet" href="./css/tabs/help.css" media="all"/>
@ -136,6 +137,7 @@
<script type="text/javascript" src="./js/jenkins_loader.js"></script>
<script type="text/javascript" src="./js/Analytics.js"></script>
<script type="text/javascript" src="./js/main.js"></script>
<script type="text/javascript" src="./js/tabs/static_tab.js"></script>
<script type="text/javascript" src="./js/tabs/landing.js"></script>
<script type="text/javascript" src="./js/tabs/setup.js"></script>
<script type="text/javascript" src="./js/tabs/setup_osd.js"></script>
@ -217,7 +219,7 @@
<label for="port-override"><span i18n="portOverrideText">Port:</span> <input id="port-override" type="text"
value="/dev/rfcomm0"/></label>
</div>
<div>
<div id="autoConnectSwitch">
<label><input class="auto_connect togglesmall" type="checkbox"/><span
class="auto_connect" i18n="autoConnect"></span></label>
</div>
@ -288,9 +290,11 @@
<ul class="mode-disconnected">
<li class="tab_landing" id="tab_landing"><a href="#" i18n="tabLanding" class="tabicon ic_welcome" i18n_title="tabLanding"></a>
</li>
<li class="tab_changelog"><a href="#" class="tabicon ic_help" i18n="defaultChangelogAction"></a></li>
<li class="tab_privacy_policy"><a href="#" class="tabicon ic_help" i18n="defaultPrivacyPolicyAction"></a></li>
<li class="tab_help" id="tab_help"><a href="#" i18n="tabHelp" class="tabicon ic_help"
i18n_title="tabHelp"></a></li>
<li class="tab_firmware_flasher"><a href="#" i18n="tabFirmwareFlasher" class="tabicon ic_flasher"
<li class="tab_firmware_flasher" id="tabFirmware"><a href="#" i18n="tabFirmwareFlasher" class="tabicon ic_flasher"
i18n_title="tabFirmwareFlasher"></a></li>
</ul>
<ul class="mode-connected">

View File

@ -44,25 +44,4 @@
</div>
</div>
</div>
<div id="changelog">
<div class="button">
<a id="changelog_toggle" href="#" i18n="defaultChangelogAction"></a>
</div>
<div class="wrapper">
<div class="title" i18n="defaultChangelogHead"></div>
<div class="log">
<!-- changelog content will be loaded here -->
</div>
</div>
</div>
<div id="privacy_policy">
<div class="button">
<a id="privacy_policy_toggle" href="#" i18n="defaultPrivacyPolicyAction"></a>
</div>
<div class="wrapper">
<div class="policy">
<!-- privacy policy content will be loaded here -->
</div>
</div>
</div>
</div>