Commit 53c144d7 authored by tomalo.stuttgart's avatar tomalo.stuttgart

Finished adding tags.

git-svn-id: https://svn.typo3.org/TYPO3v4/Extensions/terfe/branches/ter_fe2@45837 735d13b6-9817-0410-8766-e36946ffe9aa
parent 54396121
......@@ -51,7 +51,6 @@
*/
protected function initializeAction() {
$this->tagRepository = t3lib_div::makeInstance('Tx_TerFe2_Domain_Repository_TagRepository');
$this->extensionRepository = t3lib_div::makeInstance('Tx_TerFe2_Domain_Repository_ExtensionRepository');
// Pre-parse TypoScript setup
$this->settings = Tx_TerFe2_Utility_TypoScript::parse($this->settings);
......@@ -76,7 +75,7 @@
* @return void
* @dontvalidate $newTag
*/
public function newAction(Tx_TerFe2_Domain_Model_Tag $newTag = NULL, Tx_TerFe2_Domain_Model_Extension $extension) {
public function newAction(Tx_TerFe2_Domain_Model_Extension $extension, Tx_TerFe2_Domain_Model_Tag $newTag = NULL) {
$this->view->assign('newTag', $newTag);
$this->view->assign('extension', $extension);
}
......@@ -88,13 +87,15 @@
* @param Tx_TerFe2_Domain_Model_Tag $newTag A fresh Tag object which has not yet been added to the repository
* @return void
*/
public function createAction(Tx_TerFe2_Domain_Model_Tag $newTag) {
if ($tag = $this->tagRepository->findByTitle($newTag->getTitle())) {
public function createAction(Tx_TerFe2_Domain_Model_Tag $newTag, Tx_TerFe2_Domain_Model_Extension $extension) {
if ($tag = $this->tagRepository->findByTitle($newTag->getTitle())->getFirst()) {
$extension->addTag($tag);
} else {
$this->tagRepository->add($newTag);
$extension->addTag($newTag);
}
$this->tagRepository->add($newTag);
$this->flashMessageContainer->add($this->translate('msg.tag_created'));
$this->redirect('index');
$this->redirect('show', 'Extension', NULL, array('extension' => $extension));
}
......
......@@ -10,7 +10,7 @@
</h3>
<p class="description">{extension.lastVersion.description}</p>
<p class="categories"><f:for each="{extension.categories}" as="{category}">{category.title}</f:for></p>
<p class="tags"><f:for each="{extension.tags}" as="tag" iteration="tagIterator">{tag.title}{f:if(condition: tagIterator.isLast, then:'', else, then: ', ')}</f:for><f:link.action action="new" controller="Tag" arguments="{extension : extension}"><f:translate key="create_tag" /></f:link.action> </p>
<p class="tags"><f:for each="{extension.tags}" as="tag" iteration="tagIterator">{tag.title}{f:if(condition:tagIterator.isLast,then:'',else:', ')}</f:for><br /><f:link.action action="new" controller="Tag" arguments="{extension : extension}"><f:translate key="create_tag" /></f:link.action> </p>
<p class="download"><f:link.action action="download" arguments="{extension : extension, version : extension.lastVersion}"><f:translate key="download"/></f:link.action></p>
<f:if condition="{extension.forgeLink}"><p class="forgeLink"><f:link.action absolute="{extension.forgeLink}"><f:translate key="tx_terfe2_domain_model_extension.forge_link" /></f:link.action></p></f:if>
<f:if condition="{extension.hudsonLink}"><p class="hudsonLink"><f:link.action absolute="{extension.hudsonLink}"><f:translate key="tx_terfe2_domain_model_extension.hudson_link" /></f:link.action></p></f:if>
......
<f:layout name="Default" />
<f:section name="main">
<h2><f:translate key="new_tag"/> {extension.title}</h2>
<h2><f:translate key="new_tag"/> {extension.extKey}</h2>
<f:form method="post" action="create" name="tag" arguments="{extension : extension.uid}" object="{newTag}">
<f:form method="post" action="create" name="newTag" arguments="{extension : extension}" object="{newTag}">
<label for="title"><f:translate key="tx_terfe2_domain_model_tag.title" /></label><br />
<f:form.textbox property="title" /><br /><br />
......
Markdown is supported
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