Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
services
t3o sites
voting.typo3.org
extensions
election
Commits
e4d36514
Commit
e4d36514
authored
Dec 22, 2015
by
Oliver Eglseder
Browse files
[TASK] Add quick hide/show buttons to nominees (property public)
parent
ed345da6
Changes
4
Hide whitespace changes
Inline
Side-by-side
Classes/Controller/BeNomineeController.php
View file @
e4d36514
...
...
@@ -28,6 +28,8 @@ class BeNomineeController extends AbstractProtectedBeController
const
ACTION_CREATE
=
'create'
;
const
ACTION_EDIT
=
'edit'
;
const
ACTION_UPDATE
=
'update'
;
const
ACTION_HIDE
=
'hide'
;
const
ACTION_SHOW
=
'show'
;
/**
* @var \TYPO3\Election\Domain\Repository\NomineeRepository
...
...
@@ -85,6 +87,26 @@ class BeNomineeController extends AbstractProtectedBeController
$this
->
redirect
(
self
::
ACTION_LIST
);
}
/**
* @param Nominee $nominee
*/
public
function
hideAction
(
Nominee
$nominee
)
{
$nominee
->
setPublic
(
false
);
$this
->
nomineeRepository
->
update
(
$nominee
);
$this
->
redirect
(
self
::
ACTION_LIST
);
}
/**
* @param Nominee $nominee
*/
public
function
showAction
(
Nominee
$nominee
)
{
$nominee
->
setPublic
(
true
);
$this
->
nomineeRepository
->
update
(
$nominee
);
$this
->
redirect
(
self
::
ACTION_LIST
);
}
/**
* @return string
*/
...
...
@@ -98,6 +120,8 @@ class BeNomineeController extends AbstractProtectedBeController
self
::
ACTION_CREATE
,
self
::
ACTION_EDIT
,
self
::
ACTION_UPDATE
,
self
::
ACTION_HIDE
,
self
::
ACTION_SHOW
,
]
);
}
...
...
Classes/Domain/Repository/NomineeRepository.php
View file @
e4d36514
...
...
@@ -14,6 +14,7 @@ namespace TYPO3\Election\Domain\Repository;
* The TYPO3 project - inspiring people to share!
*/
use
TYPO3\CMS\Extbase\Persistence\QueryInterface
;
use
TYPO3\CMS\Extbase\Persistence\Repository
;
/**
...
...
@@ -21,4 +22,11 @@ use TYPO3\CMS\Extbase\Persistence\Repository;
*/
class
NomineeRepository
extends
Repository
{
/**
* @var array
*/
protected
$defaultOrderings
=
[
'public'
=>
QueryInterface
::
ORDER_DESCENDING
,
'lastName'
=>
QueryInterface
::
ORDER_ASCENDING
,
];
}
Resources/Private/Language/locallang.xlf
View file @
e4d36514
...
...
@@ -246,6 +246,12 @@
<trans-unit
id=
"view.be.nominee.edit.welcome"
>
<source>
Edit a Nominee
</source>
</trans-unit>
<trans-unit
id=
"view.be.nominee.list.hide_link_title"
>
<source>
Hide this nominee from public
</source>
</trans-unit>
<trans-unit
id=
"view.be.nominee.list.show_link_title"
>
<source>
Make this nominee public
</source>
</trans-unit>
<!-- MODEL NOMINEE -->
...
...
Resources/Private/Partials/Model/Nominee/List.html
View file @
e4d36514
...
...
@@ -22,12 +22,12 @@
</thead>
<tbody>
<f:for
each=
"{nominees}"
as=
"nominee"
>
<tr>
<tr
{
f:if
(
condition:
'{
nominee.public
}',
else:
'
style=
"background-color:#ddd;"
')}
>
<td>
<f:image
image=
"{nominee.image}"
width=
"50c"
height=
"50c"
/>
</td>
<td>
<f:link.action
action=
"edit"
controller=
"Be
Elector
"
arguments=
"{
elector:elector
}"
>
<f:link.action
action=
"edit"
controller=
"Be
Nominee
"
arguments=
"{
nominee:nominee
}"
>
{nominee.fullName}
</f:link.action>
</td>
...
...
@@ -47,6 +47,20 @@
arguments=
"{nominee:nominee}"
>
<core:icon
identifier=
"actions-edit-delete"
/>
</f:link.action>
<f:if
condition=
"{nominee.public}"
>
<f:then>
<f:link.action
class=
"btn btn-default"
action=
"hide"
controller=
"BeNominee"
arguments=
"{nominee:nominee}"
title=
"{f:translate(key:'view.be.nominee.list.hide_link_title')}"
>
<core:icon
identifier=
"actions-edit-hide"
/>
</f:link.action>
</f:then>
<f:else>
<f:link.action
class=
"btn btn-default"
action=
"show"
controller=
"BeNominee"
arguments=
"{nominee:nominee}"
title=
"{f:translate(key:'view.be.nominee.list.show_link_title')}"
>
<core:icon
identifier=
"actions-edit-unhide"
/>
</f:link.action>
</f:else>
</f:if>
</div>
</td>
</tr>
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment