mirror of
https://we.phorge.it/source/phorge.git
synced 2024-09-22 18:28:47 +02:00
8355f3592f
Summary: introduce an abstract "PhameBlogSkin" class and instantiate two versions -- PhabricatorBlogSkin (Default) and PhacilityBlogSkin. Most notable hack is including the directory /rsrc/images/phacility - this lets things "work" without messing around with the phacility.com CSS and instead just cutting and pasting most of the file. Test Plan: played around with Phame a bunch. In particular, created a blog with a custom domain and the phacility skin. Verified it looked good and individual posts looked okay. Reviewers: epriestley Reviewed By: epriestley CC: aran, Korvin Maniphest Tasks: T1373 Differential Revision: https://secure.phabricator.com/D3687
107 lines
2.5 KiB
PHP
107 lines
2.5 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 $blog;
|
|
private $bloggers;
|
|
|
|
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');
|
|
|
|
$user = $this->getUser();
|
|
$blog = $this->getBlog();
|
|
$bloggers = $this->getBloggers();
|
|
$name = phutil_escape_html($blog->getName());
|
|
$description = phutil_escape_html($blog->getDescription());
|
|
|
|
$detail = phutil_render_tag(
|
|
'div',
|
|
array(
|
|
'class' => 'blog-detail'
|
|
),
|
|
phutil_render_tag(
|
|
'div',
|
|
array(
|
|
'class' => 'header',
|
|
),
|
|
phutil_render_tag(
|
|
'h1',
|
|
array(),
|
|
$name
|
|
)
|
|
).
|
|
phutil_render_tag(
|
|
'div',
|
|
array(
|
|
'class' => 'description'
|
|
),
|
|
$description
|
|
).
|
|
phutil_render_tag(
|
|
'div',
|
|
array(
|
|
'class' => 'bloggers'
|
|
),
|
|
'Current bloggers: '.$this->getBloggersHTML($bloggers)
|
|
)
|
|
);
|
|
|
|
return $detail;
|
|
}
|
|
|
|
private function getBloggersHTML(array $bloggers) {
|
|
assert_instances_of($bloggers, 'PhabricatorObjectHandle');
|
|
|
|
$arr = array();
|
|
foreach ($bloggers as $blogger) {
|
|
$arr[] = '<strong>'.phutil_escape_html($blogger->getName()).'</strong>';
|
|
}
|
|
|
|
return implode(' · ', $arr);
|
|
}
|
|
}
|