Correct a parameter order swap in "diffusion.historyquery" for Mercurial
[phabricator.git] / src / applications / phame / view / PhameBlogListView.php
blob5aa58ee8f9e8b3851992aa4780c5005c336f914e
1 <?php
3 final class PhameBlogListView extends AphrontTagView {
5 private $blogs;
7 public function setBlogs($blogs) {
8 assert_instances_of($blogs, 'PhameBlog');
9 $this->blogs = $blogs;
10 return $this;
13 protected function getTagAttributes() {
14 $classes = array();
15 $classes[] = 'phame-blog-list';
16 return array('class' => implode(' ', $classes));
19 protected function getTagContent() {
20 require_celerity_resource('phame-css');
22 $list = array();
23 foreach ($this->blogs as $blog) {
24 $image_uri = $blog->getProfileImageURI();
25 $image = phutil_tag(
26 'a',
27 array(
28 'class' => 'phame-blog-list-image',
29 'style' => 'background-image: url('.$image_uri.');',
30 'href' => $blog->getViewURI(),
31 ));
33 $title = phutil_tag(
34 'a',
35 array(
36 'class' => 'phame-blog-list-title',
37 'href' => $blog->getViewURI(),
39 $blog->getName());
41 $icon = id(new PHUIIconView())
42 ->setIcon('fa-plus-square')
43 ->addClass('phame-blog-list-icon');
45 $add_new = phutil_tag(
46 'a',
47 array(
48 'href' => '/phame/post/edit/?blog='.$blog->getID(),
49 'class' => 'phame-blog-list-new-post',
51 $icon);
53 $list[] = phutil_tag(
54 'div',
55 array(
56 'class' => 'phame-blog-list-item',
58 array(
59 $image,
60 $title,
61 $add_new,
62 ));
65 if (empty($list)) {
66 $list = phutil_tag(
67 'a',
68 array(
69 'href' => '/phame/blog/edit/',
71 pht('Create a Blog'));
74 $header = phutil_tag(
75 'h4',
76 array(
77 'class' => 'phame-blog-list-header',
79 phutil_tag(
80 'a',
81 array(
82 'href' => '/phame/blog/',
84 pht('Blogs')));
86 return id(new PHUIBoxView())
87 ->appendChild($header)
88 ->appendChild($list)
89 ->addClass('pl')
90 ->setColor(PHUIBoxView::BLUE);