Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/nextcloud/nextcloudpi.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authornachoparker <nacho@ownyourbits.com>2017-09-10 15:57:56 +0300
committernachoparker <nacho@ownyourbits.com>2017-09-10 16:15:45 +0300
commit60711f3ca6f9eb139f78cbde40a94575d9cceeac (patch)
tree1fb69ea4946bceaf749514bb067fab51f6a2252f
parent1da6b12672c61db8dec10439ee5cad0169319f90 (diff)
ncp-web: click version for changelog. click new version notification to nc-updatev0.26.25
-rw-r--r--ncp-web/index.php20
-rw-r--r--ncp-web/ncp.css16
-rw-r--r--ncp-web/ncp.js53
3 files changed, 70 insertions, 19 deletions
diff --git a/ncp-web/index.php b/ncp-web/index.php
index 988f64e1..5b43c034 100644
--- a/ncp-web/index.php
+++ b/ncp-web/index.php
@@ -47,8 +47,8 @@
if ( $ret == 0 )
{
echo '<div id="notification">';
- echo '<div class="row type-error closeable">';
- echo "<a target=\"_blank\" href=\"https://github.com/nextcloud/nextcloudpi/blob/devel/changelog.md\">version " . file_get_contents( "/var/run/.ncp-latest-version" ) . " is available</a>";
+ echo '<div id="update-notification" class="row type-error closeable">';
+ echo "version " . file_get_contents( "/var/run/.ncp-latest-version" ) . " is available";
echo '<a class="action close icon-close" href="#" alt="Dismiss"></a>';
echo '</div>';
echo '</div>';
@@ -58,13 +58,15 @@
<header role="banner"><div id="header">
<div id="header-left">
- <a href="https://ownyourbits.com/2017/02/13/nextcloud-ready-raspberry-pi-image/"
- id="nextcloudpi" tabindex="1" target="_blank">
- <div class="logo-icon">
- <h1 class="hidden-visually">NextCloudPi</h1>
- </div>
- </a>
- <?php echo file_get_contents( "/usr/local/etc/ncp-version" ) . "&nbsp;&nbsp;"; ?>
+ <a href="https://ownyourbits.com/2017/02/13/nextcloud-ready-raspberry-pi-image/"
+ id="nextcloudpi" tabindex="1" target="_blank">
+ <div class="logo-icon">
+ <h1 class="hidden-visually">NextCloudPi</h1>
+ </div>
+ </a>
+ <a id=versionlink target="_blank" href="https://github.com/nextcloud/nextcloudpi/blob/devel/changelog.md">
+ <?php echo file_get_contents( "/usr/local/etc/ncp-version" ) ?>
+ </a>
</div>
<div id="header-right">
<div id="poweroff">
diff --git a/ncp-web/ncp.css b/ncp-web/ncp.css
index 284a7d89..c04f8790 100644
--- a/ncp-web/ncp.css
+++ b/ncp-web/ncp.css
@@ -1133,3 +1133,19 @@ select {
padding: 8px;
opacity: 0.6;
}
+
+a#versionlink{
+ border:0;
+ color:white;
+ text-decoration:none;
+ cursor:pointer
+}
+
+#update-notification {
+ cursor: pointer;
+}
+
+/* lower version link */
+#header #header-left {
+ align-items:baseline
+}
diff --git a/ncp-web/ncp.js b/ncp-web/ncp.js
index a41d5cde..11df76a8 100644
--- a/ncp-web/ncp.js
+++ b/ncp-web/ncp.js
@@ -17,6 +17,18 @@ function errorMsg()
$('#config-box').fill( "Something went wrong. Try refreshing the page" );
}
+function cfgreqReceive( result )
+{
+ var ret = $.parseJSON( result );
+ if ( ret.token )
+ $('#csrf-token').set( { value: ret.token } );
+ $('#circle-retstatus').hide();
+ $('#config-box').ht( ret.output );
+ $('#config-box-title').fill( $( '#' + selectedID + '-desc' ).get( '.value' ) );
+ $('#config-box-info' ).fill( $( '#' + selectedID + '-info' ).get( '.value' ) );
+ $('#config-box-wrapper').show();
+}
+
$(function()
{
// Event source to receive process output in real time
@@ -45,8 +57,6 @@ $(function()
confLock = true;
$( '#' + selectedID ).set('-active');
- this.set( '+active' );
-
var that = this;
$.request('post', 'ncp-launcher.php', { action:'cfgreq',
ref:this.get('.id') ,
@@ -54,14 +64,10 @@ $(function()
function success( result )
{
selectedID = that.get('.id');
- var ret = $.parseJSON( result );
- if ( ret.token )
- $('#csrf-token').set( { value: ret.token } );
- $('#circle-retstatus').hide();
- $('#config-box').ht( ret.output );
- $('#config-box-title').fill( $( '#' + selectedID + '-desc' ).get( '.value' ) );
- $('#config-box-info' ).fill( $( '#' + selectedID + '-info' ).get( '.value' ) );
- $('#config-box-wrapper').show();
+ that.set( '+active' );
+
+ cfgreqReceive( result );
+
confLock = false;
}).error( errorMsg );
@@ -114,6 +120,33 @@ $(function()
}).error( errorMsg );
});
+ // Update notification
+ $( '#notification' ).on('click', function(e)
+ {
+ if ( confLock ) return;
+ confLock = true;
+
+ $( '#' + selectedID ).set('-active');
+
+ // request
+ $.request('post', 'ncp-launcher.php', { action:'cfgreq',
+ ref:'nc-update' ,
+ csrf_token: $( '#csrf-token' ).get( '.value' ) }).then(
+ function success( result )
+ {
+ selectedID = 'nc-update';
+ $( '#nc-update' ).set( '+active' );
+
+ cfgreqReceive( result );
+
+ confLock = false;
+ }
+ ).error( errorMsg );
+
+ //clear details box
+ $('#details-box').hide( '' );
+ } );
+
// Power-off button
$( '#poweroff' ).on('click', function(e)
{