From 09973ae15103670df727eb73d129ad49420c54d4 Mon Sep 17 00:00:00 2001 From: Marcin Kurczewski Date: Tue, 10 Jun 2014 11:01:24 +0200 Subject: [PATCH] Shortened a few lines in views --- src/Views/post/post-edit.phtml | 30 +++++++----- src/Views/post/post-view.phtml | 89 +++++++++++++++++----------------- src/Views/user/user-edit.phtml | 24 +++++---- src/Views/user/user-view.phtml | 67 ++++++++++++------------- 4 files changed, 107 insertions(+), 103 deletions(-) diff --git a/src/Views/post/post-edit.phtml b/src/Views/post/post-edit.phtml index 9cd1a426..d6bb6e1c 100644 --- a/src/Views/post/post-edit.phtml +++ b/src/Views/post/post-edit.phtml @@ -1,7 +1,11 @@ +context->transport->post; +?> +
$post->getId()]) ?>" enctype="multipart/form-data" class="edit-post"> @@ -10,12 +14,12 @@ + value="getRevision()) ?>"/> context->transport->post->getUploader())))) + Access::getIdentity($post->getUploader())))) { $safety = PostSafety::getAll(); @@ -24,13 +28,13 @@ $context->name = 'safety'; $context->optionValues = array_map(function($s) { return $s->toInteger(); }, $safety); $context->optionLabels = array_map(function($s) { return ucfirst($s->toDisplayString()); }, $safety); - $context->activeOptionValue = $this->context->transport->post->getSafety()->toInteger(); + $context->activeOptionValue = $post->getSafety()->toInteger(); $this->renderExternal('input-radioboxes', $context); } if (Access::check(new Privilege( Privilege::EditPostTags, - Access::getIdentity($this->context->transport->post->getUploader())))) + Access::getIdentity($post->getUploader())))) { $context = new StdClass; $context->label = 'Tags'; @@ -41,24 +45,24 @@ { return htmlspecialchars($tag->getName()); }, - $this->context->transport->post->getTags())); + $post->getTags())); $this->renderExternal('input-text', $context); } if (Access::check(new Privilege( Privilege::EditPostSource, - Access::getIdentity($this->context->transport->post->getUploader())))) + Access::getIdentity($post->getUploader())))) { $context = new StdClass; $context->label = 'Source'; $context->name = 'source'; - $context->value = htmlspecialchars($this->context->transport->post->getSource()); + $context->value = htmlspecialchars($post->getSource()); $this->renderExternal('input-text', $context); } if (Access::check(new Privilege( Privilege::EditPostRelations, - Access::getIdentity($this->context->transport->post->getUploader())))) + Access::getIdentity($post->getUploader())))) { $context = new StdClass; $context->label = 'Relations'; @@ -69,13 +73,13 @@ { return $post->getId(); }, - $this->context->transport->post->getRelations())); + $post->getRelations())); $this->renderExternal('input-text', $context); } if (Access::check(new Privilege( Privilege::EditPostContent, - Access::getIdentity($this->context->transport->post->getUploader())))) + Access::getIdentity($post->getUploader())))) { $context = new StdClass; $context->label = 'File'; @@ -90,12 +94,12 @@ if (Access::check(new Privilege( Privilege::EditPostThumbnail, - Access::getIdentity($this->context->transport->post->getUploader())))) + Access::getIdentity($post->getUploader())))) { $context = new StdClass; $context->name = 'thumbnail'; $context->label = 'Thumb'; - if ($this->context->transport->post->hasCustomThumbnail()) + if ($post->hasCustomThumbnail()) $context->additionalInfo = '(Currently using custom thumb)'; $this->renderExternal('input-file', $context); } diff --git a/src/Views/post/post-view.phtml b/src/Views/post/post-view.phtml index 5ceb02d7..f0c267b7 100644 --- a/src/Views/post/post-view.phtml +++ b/src/Views/post/post-view.phtml @@ -1,7 +1,8 @@ context->transport->post; $subTitle = sprintf('showing %s – %s', - TextHelper::reprPost($this->context->transport->post), - TextHelper::reprTags($this->context->transport->post->getTags())); + TextHelper::reprPost($post), + TextHelper::reprTags($post->getTags())); $this->assets->setSubTitle($subTitle); $this->assets->addStylesheet('post-view.css'); $this->assets->addScript('post-view.js'); @@ -19,7 +20,7 @@ foreach (array_keys($editPostPrivileges) as $privilege) { if (Access::check(new Privilege( $privilege, - Access::getIdentity($this->context->transport->post->getUploader())))) + Access::getIdentity($post->getUploader())))) $editPostPrivileges[$privilege] = true; } @@ -69,7 +70,7 @@ $canEditAnything = count(array_filter($editPostPrivileges)) > 0;
- context->transport->post->getTags() ?> + getTags() ?>

tags ()