Skip to content
Snippets Groups Projects
Commit 1d8ddd0b authored by Torsten Oppermann's avatar Torsten Oppermann
Browse files

[TASK] Starting work on location filters + create + edit function

parent 4a52d8b9
No related branches found
No related tags found
No related merge requests found
<?php
namespace SGalinski\SgJobs\ViewHelpers\Backend;
/***************************************************************
* Copyright notice
*
* (c) sgalinski Internet Services (https://www.sgalinski.de)
*
* 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 3 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.
*
* 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!
***************************************************************/
use TYPO3\CMS\Backend\Utility\BackendUtility;
use TYPO3\CMS\Fluid\Core\ViewHelper\AbstractViewHelper;
/**
* Class EditOnClickViewHelper
**/
class EditLinkViewHelper extends AbstractViewHelper {
/**
* Renders the onclick script for editing a record
*
* @param string $table
* @param int $uid
* @param boolean $new
* @return string
*/
public function render($table, $uid, $new = FALSE) {
return BackendUtility::getModuleUrl('record_edit') . '&edit[' . $table . '][' . $uid . ']=' . ($new ? 'new' : 'edit');
}
}
......@@ -18,6 +18,29 @@
<f:translate key="backend.filters.locations" />
</label>
<f:form.select class="form-control" multiple="1" size="4" property="locations" options="{locationOptions}" id="filter-locations" />
<small>
<f:format.raw><f:translate key="backend.filters.locations.description" />
</f:format.raw>
</small>
<script>
var LocationEditLinks = {};
</script>
<f:for each="{locationOptions}" key="uid" as="location">
<script>
LocationEditLinks["{uid}"] = "{sg:backend.editLink(table: 'tx_sgroutes_domain_model_location', uid: uid) -> f:format.raw()}";
</script>
</f:for>
<br />
<a href="#" class="btn btn-default" onclick="editSelectedLocation();">
<span class="t3js-icon icon icon-size-small icon-state-default icon-actions-document-new">
<span class="icon-markup">
<img src="/typo3/sysext/core/Resources/Public/Icons/T3Icons/actions/actions-document-open.svg" width="16" height="16">
</span>
</span>
<f:translate key="backend.filters.editCategory" />
</a>
</div>
</div>
<div class="col-xs-6">
......
......@@ -81,10 +81,10 @@ function gotToPageCallback(path){
*
* @return {boolean}
*/
function editSelectedCategory(){
var selected = TYPO3.jQuery('#filter-categories').val();
if(selected && CategoryEditLinks[selected[0]]) {
jumpToUrl(CategoryEditLinks[selected[0]] + '&returnUrl=' + T3_THIS_LOCATION);
function editSelectedLocation(){
var selected = TYPO3.jQuery('#filter-locations').val();
if(selected && LocationEditLinks[selected[0]]) {
jumpToUrl(LocationEditLinks[selected[0]] + '&returnUrl=' + T3_THIS_LOCATION);
}
return false;
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment