Commit fd557967 authored by Stefan Busemann's avatar Stefan Busemann
Browse files

[TASK] Add edit action and view

parent 75a5a9fe
......@@ -40,6 +40,9 @@ class MyProfileController extends ActionController
$this->persistenceManager = $persistenceManager;
}
/**
* @param MyProfile|null $user
*/
public function showAction (MyProfile $user = null) {
if ($user === null) {
$user = $this->myProfileRepository->findByUid(
......@@ -54,15 +57,22 @@ class MyProfileController extends ActionController
);
}
}
\TYPO3\CMS\Extbase\Utility\DebuggerUtility::var_dump($user, __FILE__ . '@' . __LINE__);
$this->view->assign('user',$user);
}
public function editAction () {
/**
* @param MyProfile $user
*/
public function editAction(MyProfile $user){
$this->view->assign('user', $user);
}
public function updateAction () {
/**
* @param MyProfile $user
*/
public function updateAction (MyProfile $user) {
$this->myProfileRepository->update($user);
$this->persistenceManager->persistAll();
$this->redirect('show');
}
}
<section class="container">
<h1>Edit {userProfile.name}</h1>
<h1>Edit {user.name}</h1>
<f:flashMessages/>
<f:form action="update" name="userProfile" object="{userProfile}">
<label for="userProfile.aboutMe">About me:</label><br />
<f:form.textarea id="userProfile.aboutMe" property="aboutMe" value="{userProfile.aboutMe}" class="xxlarge form-control"/>
<input type="submit" value="back" class="btn btn-secondary"/> <input type="submit" value="update" class="btn btn-success"/>
<f:form action="update" objectName="user" object="{user}">
<label for="user.github">Github:</label><br />
<f:form.textfield id="user.github" property="github" value="{user.github}" class="xxlarge form-control"/>
<label for="user.twitter">Github:</label><br />
<f:form.textfield id="user.twitter" property="twitter" value="{user.twitter}" class="xxlarge form-control"/>
<label for="user.facebook">facebook:</label><br />
<f:form.textfield id="user.facebook" property="facebook" value="{user.facebook}" class="xxlarge form-control"/>
<f:link.action action="show" arguments="{user:user}" class="btn btn-secondary">back</f:link.action> <input type="submit" value="update" class="btn btn-success"/>
</f:form>
</section>
......@@ -7,6 +7,7 @@
<li>Facebook: {user.facebook}</li>
<li>twitter: {user.twitter}</li>
</ul>
<f:link.action action="edit" arguments="{user:user}" class="btn btn-primary" >Edit your profile</f:link.action>
</f:if>
</section>
......@@ -2,7 +2,6 @@
{namespace slack=T3o\T3oSlack\ViewHelpers}
<section class="container">
<h1>{user.name}</h1>
<f:debug>{user}</f:debug>
<ul>
<f:if condition="{userprofile:isPropertyVisible(propertyName:'name', user:user)}">
<li>Name: {user.name}</li>
......@@ -36,7 +35,6 @@
<li>Email: {user.email}</li>
</f:if>
<f:if condition="{userprofile:isPropertyVisible(propertyName:'country', user:user)}">
<li>Country: {user.country}</li>
</f:if>
......
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