[TASK] Make the update-from-TER link more visible 87/18687/3
authorJost Baron <jost.baron@gmx.de>
Mon, 4 Mar 2013 20:41:21 +0000 (21:41 +0100)
committerChristian Kuhn <lolli@schwarzbu.ch>
Mon, 11 Mar 2013 20:30:09 +0000 (21:30 +0100)
Make the "update from TER"-action in the extension manager more
visible by showing a button for it, instead of a text link.

Also moved the rendering functionality of the update link from
a viewhelper to a partial, as partials tend to be more readable
and bug free.

Resolves: #46029
Releases: 6.1
Change-Id: If447bba28bc0dee3e7de286e1a93e062ef59843c
Reviewed-on: https://review.typo3.org/18687
Reviewed-by: Philipp Gampe
Tested-by: Philipp Gampe
Reviewed-by: Anja Leichsenring
Tested-by: Anja Leichsenring
Reviewed-by: Christian Kuhn
Tested-by: Christian Kuhn
typo3/sysext/extensionmanager/Classes/ViewHelpers/UpdateFromTerViewHelper.php [deleted file]
typo3/sysext/extensionmanager/Resources/Private/Language/locallang.xlf
typo3/sysext/extensionmanager/Resources/Private/Partials/List/UpdateFromTer.html [new file with mode: 0644]
typo3/sysext/extensionmanager/Resources/Private/Scss/page/_manage.scss
typo3/sysext/extensionmanager/Resources/Private/Templates/List/Ter.html
typo3/sysext/extensionmanager/Resources/Private/Templates/UpdateFromTer/UpdateExtensionListFromTer.json
typo3/sysext/extensionmanager/Resources/Public/Css/main.css
typo3/sysext/extensionmanager/Resources/Public/JavaScript/update.js

diff --git a/typo3/sysext/extensionmanager/Classes/ViewHelpers/UpdateFromTerViewHelper.php b/typo3/sysext/extensionmanager/Classes/ViewHelpers/UpdateFromTerViewHelper.php
deleted file mode 100644 (file)
index 7a9024f..0000000
+++ /dev/null
@@ -1,62 +0,0 @@
-<?php
-namespace TYPO3\CMS\Extensionmanager\ViewHelpers;
-
-/***************************************************************
- *  Copyright notice
- *
- *  (c) 2012 Susanne Moog <susanne.moog@typo3.org>
- *  All rights reserved
- *
- *  This script is part of the TYPO3 project. The TYPO3 project is
- *  free software; you can redistribute it and/or modify
- *  it under the terms of the GNU General Public License as published by
- *  the Free Software Foundation; either version 2 of the License, or
- *  (at your option) any later version.
- *
- *  The GNU General Public License can be found at
- *  http://www.gnu.org/copyleft/gpl.html.
- *  A copy is found in the textfile GPL.txt and important notices to the license
- *  from the author is found in LICENSE.txt distributed with these scripts.
- *
- *
- *  This script is distributed in the hope that it will be useful,
- *  but WITHOUT ANY WARRANTY; without even the implied warranty of
- *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- *  GNU General Public License for more details.
- *
- *  This copyright notice MUST APPEAR in all copies of the script!
- ***************************************************************/
-/**
- * Renders a link to update the extension list from TER
- *
- * @author Susanne Moog <susanne.moog@typo3.org>
- */
-class UpdateFromTerViewHelper extends \TYPO3\CMS\Fluid\ViewHelpers\Link\ActionViewHelper {
-
-       /**
-        * @var string
-        */
-       protected $tagName = 'a';
-
-       /**
-        * Renders a link to update extension list from TER
-        *
-        * @return string the rendered a tag
-        */
-       public function render() {
-               $uriBuilder = $this->controllerContext->getUriBuilder();
-               $action = 'updateExtensionListFromTer';
-               $uriBuilder->reset();
-               $uriBuilder->setFormat('json');
-               $uri = $uriBuilder->uriFor($action, array(), 'UpdateFromTer');
-               $this->tag->addAttribute('href', $uri);
-               $label = \TYPO3\CMS\Extbase\Utility\LocalizationUtility::translate('extensionList.updateFromTer.label', 'extensionmanager');
-               $this->tag->setContent($label);
-               $this->tag->addAttribute('class', 'text');
-               return '<div class="splash-receivedata x-mask-loading is-shown"><div class="spinner"></div>' . $this->tag->render() . '</div>';
-       }
-
-}
-
-
-?>
\ No newline at end of file
index 5342ed5..d5a67a2 100644 (file)
                        <trans-unit id="extensionList.updateFromTer.label" xml:space="preserve">
                                <source>Retrieving Extension-List from TYPO3 Extension Repository (TER)</source>
                        </trans-unit>
+                       <trans-unit id="extensionList.updateFromTer.buttonLabel" xml:space="preserve">
+                               <source>Update now</source>
+                       </trans-unit>
+                       <trans-unit id="extensionList.updateFromTer.lastUpdate.label" xml:space="preserve">
+                               <source>Last update:</source>
+                       </trans-unit>
+                       <trans-unit id="extensionList.updateFromTer.lastUpdate.noInfo" xml:space="preserve">
+                               <source>No information available about last update.</source>
+                       </trans-unit>
 
                        <trans-unit id="task.updateExtensionListTask.name" xml:space="preserve">
                                <source>Update extension list</source>
diff --git a/typo3/sysext/extensionmanager/Resources/Private/Partials/List/UpdateFromTer.html b/typo3/sysext/extensionmanager/Resources/Private/Partials/List/UpdateFromTer.html
new file mode 100644 (file)
index 0000000..d765e48
--- /dev/null
@@ -0,0 +1,16 @@
+
+<div class="splash-receivedata x-mask-loading is-shown">
+       <div class="spinner"></div>
+       <f:form
+               action="updateExtensionListFromTer"
+               controller="UpdateFromTer"
+               format="json"
+               class="update-from-ter"
+               >
+               {f:translate(key: 'extensionList.updateFromTer.lastUpdate.label')}
+               <span class="text">{f:translate(key: 'extensionList.updateFromTer.lastUpdate.noInfo')}</span>
+               <input
+                       type="submit"
+                       value="{f:translate(key: 'extensionList.updateFromTer.buttonLabel')}" />
+       </f:form>
+</div>
index 2b5fdec..06422fe 100644 (file)
@@ -1,4 +1,8 @@
 
+.typo3-extensionmanager-headerRowLeft {
+       display: inline-block;
+}
+
 // Upload extension
 .typo3-extensionmanager-headerRowRight {
        float: right;
index 91cf143..6d72570 100644 (file)
@@ -26,7 +26,7 @@
                                        </f:form>
                                </div>
                                <div class="typo3-extensionmanager-headerRowRight">
-                                       <em:updateFromTer />
+                                       <f:render partial="List/UpdateFromTer" />
                                </div>
                        </div>
                        <div id="terTableWrapper">
index 7b3076b..1186d71 100644 (file)
@@ -2,7 +2,7 @@
 <em:format.jsonEncode
        additionalAttributes="{
                updated: updated,
-               message: 'last update: {repository.lastUpdate -> f:format.date()} ({repository.extensionCount} extensions)',
+               message: '{repository.lastUpdate -> f:format.date()} ({repository.extensionCount} extensions)',
                errorMessage: errorMessage
        }"
-/>
\ No newline at end of file
+/>
index 29efb6f..46e93c5 100644 (file)
@@ -1631,6 +1631,9 @@ button.ui-button::-moz-focus-inner {
 .headerTooltip {
   width: 150px; }
 
+.typo3-extensionmanager-headerRowLeft {
+  display: inline-block; }
+
 .typo3-extensionmanager-headerRowRight {
   float: right; }
 
index c2a33a4..f5be476 100644 (file)
@@ -2,14 +2,26 @@
 (function ($) {
 
        $(document).ready(function() {
-               $('.splash-receivedata a').each(function() {
-                       $(this).data('href', $(this).attr('href'));
-                       $(this).attr('href', '#');
-                       $(this).click(function() {
-                                       // force update on click
-                               updateFromTer($(this).data('href'), 1);
+
+               // Register "update from ter" action
+               $('.splash-receivedata form.update-from-ter').each(function() {
+
+                       // "this" is the form which updates the extension list from
+                       // TER on submit
+                       var updateURL = $(this).attr('action');
+                       $(this).attr('action', '#');
+
+                       $(this).submit(function() {
+                               // Force update on click.
+                               updateFromTer(updateURL, 1);
+
+                               // Prevent normal submit action.
+                               return false;
                        });
-                       updateFromTer($(this).data('href'), 0);
+
+                       // This might give problems when there are more "update"-buttons,
+                       // each one would trigger a TER-update.
+                       updateFromTer(updateURL, 0);
                });
        });