summaryrefslogtreecommitdiffstats
path: root/apps
diff options
context:
space:
mode:
authorRoeland Jago Douma <rullzer@users.noreply.github.com>2020-04-06 16:42:39 +0200
committerGitHub <noreply@github.com>2020-04-06 16:42:39 +0200
commit1d62b9786f07474bd6910b04aa905ccf3745690b (patch)
treebfe9e112fd15a8fc5892f742c62edb37f20b8cfe /apps
parent71b342fb158b3492f6a85454a5ba9d277b2e540f (diff)
parent857957b45e563b9ac789adec0374d486c71a96ed (diff)
downloadnextcloud-server-1d62b9786f07474bd6910b04aa905ccf3745690b.tar.gz
nextcloud-server-1d62b9786f07474bd6910b04aa905ccf3745690b.zip
Merge pull request #20276 from nextcloud/files-external-param-tooltop
allow setting tooltips for external storage config options
Diffstat (limited to 'apps')
-rw-r--r--apps/files_external/js/settings.js5
-rw-r--r--apps/files_external/lib/Lib/DefinitionParameter.php22
-rw-r--r--apps/files_external/tests/DefinitionParameterTest.php12
3 files changed, 34 insertions, 5 deletions
diff --git a/apps/files_external/js/settings.js b/apps/files_external/js/settings.js
index c7e06506340..93a27d5f75d 100644
--- a/apps/files_external/js/settings.js
+++ b/apps/files_external/js/settings.js
@@ -999,6 +999,11 @@ MountConfigListView.prototype = _.extend({
} else {
newElement = $('<input type="text" class="'+classes.join(' ')+'" data-parameter="'+parameter+'" placeholder="'+ trimmedPlaceholder+'" />');
}
+
+ if (placeholder.tooltip) {
+ newElement.attr('title', placeholder.tooltip);
+ }
+
highlightInput(newElement);
$td.append(newElement);
return newElement;
diff --git a/apps/files_external/lib/Lib/DefinitionParameter.php b/apps/files_external/lib/Lib/DefinitionParameter.php
index 7250a77e6c1..2e1ce7fb1dd 100644
--- a/apps/files_external/lib/Lib/DefinitionParameter.php
+++ b/apps/files_external/lib/Lib/DefinitionParameter.php
@@ -48,6 +48,9 @@ class DefinitionParameter implements \JsonSerializable {
/** @var string human-readable parameter text */
private $text;
+ /** @var string human-readable parameter tooltip */
+ private $tooltip = '';
+
/** @var int value type, see self::VALUE_* constants */
private $type = self::VALUE_TEXT;
@@ -147,6 +150,22 @@ class DefinitionParameter implements \JsonSerializable {
}
/**
+ * @return string
+ */
+ public function getTooltip(): string {
+ return $this->tooltip;
+ }
+
+ /**
+ * @param string $tooltip
+ * @return self
+ */
+ public function setTooltip(string $tooltip) {
+ $this->tooltip = $tooltip;
+ return $this;
+ }
+
+ /**
* Serialize into JSON for client-side JS
*
* @return string
@@ -155,7 +174,8 @@ class DefinitionParameter implements \JsonSerializable {
return [
'value' => $this->getText(),
'flags' => $this->getFlags(),
- 'type' => $this->getType()
+ 'type' => $this->getType(),
+ 'tooltip' => $this->getTooltip(),
];
}
diff --git a/apps/files_external/tests/DefinitionParameterTest.php b/apps/files_external/tests/DefinitionParameterTest.php
index 4482bdbae25..862d3deb557 100644
--- a/apps/files_external/tests/DefinitionParameterTest.php
+++ b/apps/files_external/tests/DefinitionParameterTest.php
@@ -33,14 +33,16 @@ class DefinitionParameterTest extends \Test\TestCase {
$this->assertEquals([
'value' => 'bar',
'flags' => 0,
- 'type' => 0
+ 'type' => 0,
+ 'tooltip' => '',
], $param->jsonSerialize());
$param->setType(Param::VALUE_BOOLEAN);
$this->assertEquals([
'value' => 'bar',
'flags' => 0,
- 'type' => Param::VALUE_BOOLEAN
+ 'type' => Param::VALUE_BOOLEAN,
+ 'tooltip' => '',
], $param->jsonSerialize());
$param->setType(Param::VALUE_PASSWORD);
@@ -48,7 +50,8 @@ class DefinitionParameterTest extends \Test\TestCase {
$this->assertEquals([
'value' => 'bar',
'flags' => Param::FLAG_OPTIONAL,
- 'type' => Param::VALUE_PASSWORD
+ 'type' => Param::VALUE_PASSWORD,
+ 'tooltip' => '',
], $param->jsonSerialize());
$param->setType(Param::VALUE_HIDDEN);
@@ -56,7 +59,8 @@ class DefinitionParameterTest extends \Test\TestCase {
$this->assertEquals([
'value' => 'bar',
'flags' => Param::FLAG_NONE,
- 'type' => Param::VALUE_HIDDEN
+ 'type' => Param::VALUE_HIDDEN,
+ 'tooltip' => '',
], $param->jsonSerialize());
}