Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .drone.yml
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,7 @@ steps:
- name: vue-build
image: nextcloudci/node:node-4
commands:
- find js/ -type f ! -name 'activate.js' ! -name 'about.js' -delete
- find js/ -type f ! -name 'activate.js' ! -name 'personalsettings.js' ! -name 'about.js' -delete
- npm ci
- npm run build
- git status
Expand Down
10 changes: 10 additions & 0 deletions css/personalsettings.css
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,13 @@
margin-top: 20px;
margin-bottom: 20px;
}
.clipboardButton {
display: inline-block;
position: relative;
top: 2px;
margin-left: 5px;
}
#endpoint-url {
width: 80%;
max-width: 415px;
}
10 changes: 5 additions & 5 deletions js/firstrunwizard.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion js/firstrunwizard.js.map

Large diffs are not rendered by default.

71 changes: 71 additions & 0 deletions js/personalsettings.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
(function($, OC, _) {
$(document).ready(function() {
initLinkToClipboard()
$('#endpoint-url').on('click', function() {
$(this).select()
})
})

function initLinkToClipboard() {
var originalTitle = t('firstrunwizard', 'Copy to clipboard')

/* reused from settings/js/authtoken_view.js */
$('#endpoint-url + .clipboardButton').tooltip({
placement: 'bottom',
title: originalTitle,
trigger: 'hover'
})

// Clipboard!
var clipboard = new Clipboard('.clipboardButton')
clipboard.on('success', function(e) {
var $input = $(e.trigger)

// show copied notification
$input.tooltip('hide')
.attr('data-original-title', t('firstrunwizard', 'Copied!'))
.tooltip('fixTitle')
.tooltip({
placement: 'bottom',
trigger: 'manual'
})
.tooltip('show')

// revert back to original title
_.delay(function() {
$input.tooltip('hide')
.attr('data-original-title', originalTitle)
.tooltip('fixTitle')
}, 3000)
})

clipboard.on('error', function(e) {
var $input = $(e.trigger)
var actionMsg = ''
if (/iPhone|iPad/i.test(navigator.userAgent)) {
actionMsg = t('firstrunwizard', 'Not supported!')
} else if (/Mac/i.test(navigator.userAgent)) {
actionMsg = t('firstrunwizard', 'Press ⌘-C to copy.')
} else {
actionMsg = t('firstrunwizard', 'Press Ctrl-C to copy.')
}

// show error
$input.tooltip('hide')
.attr('data-original-title', actionMsg)
.tooltip('fixTitle')
.tooltip({
placement: 'bottom',
trigger: 'manual'
})
.tooltip('show')

// revert back to original title
_.delay(function() {
$input.tooltip('hide')
.attr('data-original-title', originalTitle)
.tooltip('fixTitle')
}, 3000)
})
}
})(jQuery, OC, _)
7 changes: 5 additions & 2 deletions lib/Settings/Personal.php
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@
use OCP\AppFramework\Http\TemplateResponse;
use OCP\IConfig;
use OCP\Settings\ISettings;
use OCP\IURLGenerator;

class Personal implements ISettings {

Expand All @@ -35,8 +36,9 @@ class Personal implements ISettings {
/** @var \OC_Defaults */
private $defaults;

public function __construct(IConfig $config, \OC_Defaults $defaults) {
public function __construct(IConfig $config, IURLGenerator $urlGenerator, \OC_Defaults $defaults) {
$this->config = $config;
$this->urlGenerator = $urlGenerator;
$this->defaults = $defaults;
}

Expand All @@ -45,7 +47,8 @@ public function __construct(IConfig $config, \OC_Defaults $defaults) {
* @since 9.1
*/
public function getForm() {
$parameters = [ 'clients' => $this->getClientLinks() ];
$url = $this->urlGenerator->getAbsoluteURL('');
$parameters = [ 'clients' => $this->getClientLinks() ,'url' => $url];
return new TemplateResponse('firstrunwizard', 'personal-settings', $parameters);
}

Expand Down
Loading