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

github.com/nextcloud/server.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBjoern Schiessle <bjoern@schiessle.org>2016-06-16 18:30:18 +0300
committerLukas Reschke <lukas@owncloud.com>2016-06-27 11:26:22 +0300
commitcc321bc140f707257ffe1a11b4fa0238887e16fc (patch)
treeefd62463ff9d53030d583650faaf9829c900fc5b
parent10f6ca20bcf521f125700f892b09bf745a595ea7 (diff)
add some visual feedback if the operation was succesful or not
-rw-r--r--apps/theming/css/settings-admin.css4
-rw-r--r--apps/theming/js/settings-admin.js28
-rw-r--r--apps/theming/lib/controller/themingcontroller.php63
-rw-r--r--apps/theming/templates/settings-admin.php3
4 files changed, 82 insertions, 16 deletions
diff --git a/apps/theming/css/settings-admin.css b/apps/theming/css/settings-admin.css
index b0739465ef2..931e4d4508b 100644
--- a/apps/theming/css/settings-admin.css
+++ b/apps/theming/css/settings-admin.css
@@ -22,3 +22,7 @@
#theming .icon-upload {
display: inline-flex;
}
+
+div#theming_settings_msg {
+ margin-left: 10px;
+}
diff --git a/apps/theming/js/settings-admin.js b/apps/theming/js/settings-admin.js
index 76456543076..dd2f051163c 100644
--- a/apps/theming/js/settings-admin.js
+++ b/apps/theming/js/settings-admin.js
@@ -20,9 +20,14 @@
*/
function setThemingValue(setting, value) {
+ OC.msg.startSaving('#theming_settings_msg');
$.post(
OC.generateUrl('/apps/theming/ajax/updateStylesheet'), {'setting' : setting, 'value' : value}
- );
+ ).done(function(response) {
+ OC.msg.finishedSaving('#theming_settings_msg', response);
+ }).fail(function(response) {
+ OC.msg.finishedSaving('#theming_settings_msg', response);
+ });
preview(setting, value);
}
@@ -45,12 +50,15 @@ $(document).ready(function () {
var uploadparms = {
pasteZone: null,
- done: function (e, data) {
- preview('logoName', data.result.name);
+ done: function (e, response) {
+ preview('logoName', response.result.data.name);
+ OC.msg.finishedSaving('#theming_settings_msg', response.result);
},
- submit: function(e, data) {
+ submit: function(e, response) {
+ OC.msg.startSaving('#theming_settings_msg');
},
fail: function (e, data){
+ OC.msg.finishedSaving('#theming_settings_msg', response);
}
};
@@ -86,18 +94,20 @@ $(document).ready(function () {
$('.theme-undo').click(function (e) {
var setting = $(this).data('setting');
+ OC.msg.startSaving('#theming_settings_msg');
$.post(
OC.generateUrl('/apps/theming/ajax/undoChanges'), {'setting' : setting}
- ).done(function(data) {
+ ).done(function(response) {
if (setting === 'color') {
var colorPicker = document.getElementById('theming-color');
- colorPicker.style.backgroundColor = data.value;
- colorPicker.value = data.value.slice(1);
+ colorPicker.style.backgroundColor = response.data.value;
+ colorPicker.value = response.data.value.slice(1);
} else if (setting !== 'logoName') {
var input = document.getElementById('theming-'+setting);
- input.value = data.value;
+ input.value = response.data.value;
}
- preview(setting, data.value);
+ preview(setting, response.data.value);
+ OC.msg.finishedSaving('#theming_settings_msg', response);
});
});
});
diff --git a/apps/theming/lib/controller/themingcontroller.php b/apps/theming/lib/controller/themingcontroller.php
index 0aa95384a81..5ffbbf71769 100644
--- a/apps/theming/lib/controller/themingcontroller.php
+++ b/apps/theming/lib/controller/themingcontroller.php
@@ -25,7 +25,9 @@ namespace OCA\Theming\Controller;
use OCA\Theming\Template;
use OCP\AppFramework\Controller;
+use OCP\AppFramework\Http;
use OCP\AppFramework\Http\DataResponse;
+use OCP\IL10N;
use OCP\IRequest;
/**
@@ -39,11 +41,28 @@ class ThemingController extends Controller {
/** @var Template */
private $template;
-
- public function __construct($appName, IRequest $request, Template $template) {
+
+ /** @var IL10N */
+ private $l;
+
+ /**
+ * ThemingController constructor.
+ *
+ * @param string $appName
+ * @param IRequest $request
+ * @param Template $template
+ * @param IL10N $l
+ */
+ public function __construct(
+ $appName,
+ IRequest $request,
+ Template $template,
+ IL10N $l
+ ) {
parent::__construct($appName, $request);
$this->template = $template;
+ $this->l = $l;
}
/**
@@ -54,7 +73,15 @@ class ThemingController extends Controller {
*/
public function updateStylesheet($setting, $value) {
$this->template->set($setting, $value);
- return new DataResponse();
+ return new DataResponse(
+ [
+ 'data' =>
+ [
+ 'message' => $this->l->t('Saved')
+ ],
+ 'status' => 'success'
+ ]
+ );
}
/**
@@ -65,12 +92,27 @@ class ThemingController extends Controller {
public function updateLogo() {
$newLogo = $this->request->getUploadedFile('uploadlogo');
if (empty($newLogo)) {
- return new DataResponse(['message' => 'No logo uploaded'], Http::STATUS_UNPROCESSABLE_ENTITY);
+ return new DataResponse(
+ [
+ 'data' => [
+ 'message' => $this->l->t('No logo uploaded')
+ ]
+ ],
+ Http::STATUS_UNPROCESSABLE_ENTITY);
}
$this->template->set('logoName', $newLogo['name']);
rename($newLogo['tmp_name'], \OC::$SERVERROOT . '/themes/theming-app/core/img/' . $newLogo['name']);
- return new DataResponse(['name' => $newLogo['name']]);
+ return new DataResponse(
+ [
+ 'data' =>
+ [
+ 'name' => $newLogo['name'],
+ 'message' => $this->l->t('Saved')
+ ],
+ 'status' => 'success'
+ ]
+ );
}
/**
@@ -81,6 +123,15 @@ class ThemingController extends Controller {
*/
public function undo($setting) {
$value = $this->template->undo($setting);
- return new DataResponse(['value' => $value]);
+ return new DataResponse(
+ [
+ 'data' =>
+ [
+ 'value' => $value,
+ 'message' => $this->l->t('Saved')
+ ],
+ 'status' => 'success'
+ ]
+ );
}
}
diff --git a/apps/theming/templates/settings-admin.php b/apps/theming/templates/settings-admin.php
index cfc18de9c13..4e2277b0533 100644
--- a/apps/theming/templates/settings-admin.php
+++ b/apps/theming/templates/settings-admin.php
@@ -6,7 +6,8 @@ script('theming', '3rdparty/jscolor/jscolor');
style('theming', 'settings-admin');
?>
<div id="theming" class="section">
- <h2><?php p($l->t('Theming')); ?></h2>
+ <h2 class="inlineblock"><?php p($l->t('Theming')); ?></h2>
+ <div id="theming_settings_msg" class="msg success inlineblock" style="display: none;">Saved</div>
<?php if ($_['themable'] === false) { ?>
<p>
<?php p($_['errorMessage']) ?>