Commit 3e25b2be authored by Oliver Eglseder's avatar Oliver Eglseder
Browse files

[TASK] Link electionVotes to elections

parent 02120452
......@@ -54,6 +54,11 @@ class Election extends AbstractEntity
*/
protected $numberOfVotes = 0;
/**
* @var \TYPO3\CMS\Extbase\Persistence\ObjectStorage<\TYPO3\Election\Domain\Model\ElectionVote>
*/
protected $electionVotes = null;
/**
* @return string
*/
......@@ -165,4 +170,20 @@ class Election extends AbstractEntity
{
$this->numberOfVotes = $numberOfVotes;
}
/**
* @return \TYPO3\CMS\Extbase\Persistence\ObjectStorage
*/
public function getElectionVotes()
{
return $this->electionVotes;
}
/**
* @param \TYPO3\CMS\Extbase\Persistence\ObjectStorage $electionVotes
*/
public function setElectionVotes($electionVotes)
{
$this->electionVotes = $electionVotes;
}
}
......@@ -237,6 +237,9 @@
<trans-unit id="model.election.field.number_of_votes">
<source># of Votes/Elector</source>
</trans-unit>
<trans-unit id="view.be.election.list.voting_started">
<source>Can not alter or delete; Voting has started</source>
</trans-unit>
<!-- BE ELECTOR -->
......
......@@ -27,12 +27,30 @@
</td>
<td>
<div class="btn-group">
<f:link.action class="btn btn-default" action="edit" controller="BeElection" arguments="{election:election}">
<core:icon identifier="actions-edit-rename"/>
</f:link.action>
<f:link.action class="btn btn-default" action="delete" controller="BeElection" arguments="{election:election}">
<core:icon identifier="actions-edit-delete"/>
</f:link.action>
<f:if condition="{election.electionVotes}">
<f:then>
<span class="btn btn-default disabled">
<core:icon identifier="actions-edit-rename" state="disabled"/>
</span>
<span class="btn btn-default disabled">
<core:icon identifier="actions-edit-delete" state="disabled"/>
</span>
<f:link.action class="btn btn-default" action="summary" controller="BeElection"
arguments="{election:election}">
<core:icon identifier="actions-edit-rename"/>
</f:link.action>
</f:then>
<f:else>
<f:link.action class="btn btn-default" action="edit" controller="BeElection"
arguments="{election:election}">
<core:icon identifier="actions-edit-rename"/>
</f:link.action>
<f:link.action class="btn btn-default" action="delete" controller="BeElection"
arguments="{election:election}">
<core:icon identifier="actions-edit-delete"/>
</f:link.action>
</f:else>
</f:if>
</div>
</td>
</tr>
......
......@@ -37,6 +37,7 @@ CREATE TABLE tx_election_domain_model_election (
electorate INT(11) unsigned DEFAULT '0' NOT NULL,
nominees INT(11) unsigned DEFAULT '0' NOT NULL,
number_of_votes INT(11) unsigned DEFAULT '0' NOT NULL,
election_votes INT(11) unsigned DEFAULT '0' NOT NULL,
PRIMARY KEY (uid),
KEY parent (pid)
......
......@@ -111,7 +111,6 @@ config.tx_extbase.persistence.classes {
foreign_table = tx_election_domain_model_electorate
}
}
nominees {
mapOnProperty = nominees
config {
......@@ -120,6 +119,14 @@ config.tx_extbase.persistence.classes {
foreign_table = tx_election_domain_model_nominee
}
}
election_votes {
mapOnProperty = electionVotes
config {
type = inline
foreign_table = tx_election_domain_model_electionvote
foreign_field = election
}
}
}
}
}
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment