mirror of
https://we.phorge.it/source/phorge.git
synced 2024-09-22 18:28:47 +02:00
52770a086d
Summary: "blog style" for now is just "true" to make this UI render better for the blog LATER it will be a string which will choose the larger template. this will also have to do some messing around with links; when viewing on a phabricator instance links need to be a bit dirtier to carry around the blog whereas when viewing offsite we can tell what blog it is based on the host domain. anyhoo, this is future diff work Test Plan: looked at blog - less ugly. resized blog to smaller sizes - became a "single list" of goodness for quality reading quite quickly. Reviewers: epriestley Reviewed By: epriestley CC: aran, Korvin Maniphest Tasks: T1373 Differential Revision: https://secure.phabricator.com/D3587
97 lines
2.4 KiB
PHP
97 lines
2.4 KiB
PHP
<?php
|
|
|
|
/*
|
|
* Copyright 2012 Facebook, Inc.
|
|
*
|
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
* you may not use this file except in compliance with the License.
|
|
* You may obtain a copy of the License at
|
|
*
|
|
* http://www.apache.org/licenses/LICENSE-2.0
|
|
*
|
|
* Unless required by applicable law or agreed to in writing, software
|
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
* See the License for the specific language governing permissions and
|
|
* limitations under the License.
|
|
*/
|
|
|
|
/**
|
|
* @group phame
|
|
*/
|
|
final class PhameBlogDetailView extends AphrontView {
|
|
|
|
private $user;
|
|
|
|
private $isAdmin;
|
|
private $blog;
|
|
private $bloggers;
|
|
|
|
public function setIsAdmin($is_admin) {
|
|
$this->isAdmin = $is_admin;
|
|
return $this;
|
|
}
|
|
private function getIsAdmin() {
|
|
return $this->isAdmin;
|
|
}
|
|
|
|
public function setUser(PhabricatorUser $user) {
|
|
$this->user = $user;
|
|
return $this;
|
|
}
|
|
private function getUser() {
|
|
return $this->user;
|
|
}
|
|
|
|
public function setBloggers(array $bloggers) {
|
|
assert_instances_of($bloggers, 'PhabricatorObjectHandle');
|
|
$this->bloggers = $bloggers;
|
|
return $this;
|
|
}
|
|
private function getBloggers() {
|
|
return $this->bloggers;
|
|
}
|
|
|
|
public function setBlog(PhameBlog $blog) {
|
|
$this->blog = $blog;
|
|
return $this;
|
|
}
|
|
private function getBlog() {
|
|
return $this->blog;
|
|
}
|
|
|
|
|
|
public function render() {
|
|
require_celerity_resource('phabricator-remarkup-css');
|
|
require_celerity_resource('phame-blog-detail-css');
|
|
|
|
$user = $this->getUser();
|
|
$blog = $this->getBlog();
|
|
$bloggers = $this->getBloggers();
|
|
$name = phutil_escape_html($blog->getName());
|
|
$description = phutil_escape_html($blog->getDescription());
|
|
$bloggers_txt = implode(' · ', mpull($bloggers, 'renderLink'));
|
|
$panel = id(new AphrontPanelView())
|
|
->addClass('blog-detail')
|
|
->setHeader($name)
|
|
->setCaption($description)
|
|
->setWidth(AphrontPanelView::WIDTH_FORM)
|
|
->appendChild('Current bloggers: '.$bloggers_txt);
|
|
|
|
if ($this->getIsAdmin()) {
|
|
$panel->addButton(
|
|
phutil_render_tag(
|
|
'a',
|
|
array(
|
|
'href' => $blog->getEditURI(),
|
|
'class' => 'button grey',
|
|
),
|
|
'Edit Blog')
|
|
);
|
|
|
|
}
|
|
|
|
return $panel->render();
|
|
}
|
|
|
|
}
|