$post = $post->unserialize();
$this->view->post = $post->unserialize();
+ $this->view->author = $post->getAuthorModel()->unserialize();
$this->view->headTitle($post->getTitle(), 'SET');
}
$blog->setLabel('Blog Posts');\r
$this->addElement($blog);\r
\r
+ $authors = new Fluidbook_Form_CMS_Element_Authors('authors');\r
+ $authors->setLabel('Authors');\r
+ $this->addElement($authors);\r
+\r
}\r
}\r
--- /dev/null
+<?php
+
+class Fluidbook_Form_CMS_Element_AuthorSelectList extends CubeIT_Form_Element_SelectList {
+
+ public function init() {
+ parent::init();
+ $this->setBaseForm(new Fluidbook_Form_CMS_Sub_Authors());
+ }
+
+}
--- /dev/null
+<?php
+
+class Fluidbook_Form_CMS_Element_Authors extends CubeIT_Form_Element_List {
+ public function init() {
+ parent::init();
+
+ $this->setBaseForm(new Fluidbook_Form_CMS_Sub_Authors());
+ $this->clearDecorators();
+ }
+
+}
--- /dev/null
+<?php
+
+class Fluidbook_Form_CMS_Sub_Authors extends CubeIT_Form_List_Model
+{
+
+ public function init() {
+ parent::init();
+
+ $compact_translations = false;
+
+ $id = new CubeIT_Form_Element_Id();
+ $this->addElement($id);
+
+ $photo = new CubeIT_Form_Element_File_Image('photo');
+ $photo->setLabel(__('Photo'));
+ $photo->setMaxItems(1);
+ $this->addElement($photo);
+
+ $name = new CubeIT_Form_Element_Text('name');
+ $name->setLabel(__('Author Name'));
+ $this->addElement($name);
+
+ $email = new CubeIT_Form_Element_Text('email');
+ $email->setLabel(__('E-mail address'));
+ $this->addElement($email);
+
+ $bio = new CubeIT_Form_Element_Markitup('bio');
+ $bio->setLabel(__('Author Bio'));
+ $this->addElementLocalized($bio, $compact_translations);
+
+ $this->setListTitle(__('Authors'));
+ $this->setNewTitle(__('New Author'));
+ $this->setEditTitle(__('Editing author « $name »'));
+ $this->setModel('Fluidbook_Model_Author');
+ $this->setTitleColumn('name');
+ $this->setAdditionnalColumns(['email']);
+
+ }
+}
$date->setLabel(__('Publish Date'));
$this->addElement($date);
+ $author = new Fluidbook_Form_CMS_Element_AuthorSelectList('author_id');
+ $author->setLabel('Author');
+ $this->addElement($author);
+
$title = new CubeIT_Form_Element_Text('title');
$title->setLabel(__('Post Title'));
$this->addElementLocalized($title, $compact_translations);
--- /dev/null
+<?php\r
+\r
+class Fluidbook_Model_Author extends CubeIT_Model_Data_Table\r
+{\r
+ protected static $_table = 'authors';\r
+\r
+ protected $name;\r
+ protected $email;\r
+ protected $bio;\r
+ protected $photo;\r
+\r
+ public static function getSchema($schema) {\r
+ $table = parent::getSchema($schema);\r
+ $table->addColumn('name', 'string', ['length' => 255]);\r
+ $table->addColumn('email', 'string', ['length' => 255]);\r
+ $table->addColumn('bio', 'text');\r
+ $table->addColumn('photo', 'string', ['length' => 255]);\r
+ return $table;\r
+ }\r
+\r
+}\r
return $table;\r
}\r
\r
+ public function getAuthorModel() {\r
+ $authorID = $this->getAuthorId();\r
+ if ($authorID == 0)\r
+ return null;\r
+\r
+ $author = Fluidbook_Model_Author::factory()->where('id = ?', $authorID)->find();\r
+ return reset($author);\r
+ }\r
+\r
}\r
$res .= '</div>'; // .block-$content->content_type
}
+ // Author details
+ $photo = $this->imageProcess()->imageProcessGetUrl($this->author->getPhoto(), null, 120, 120);
+ $res .= '<div class="blog-author" itemscope itemtype="http://schema.org/Person">';
+ $res .= '<div class="blog-author-photo" itemprop="image" style="background-image:url('. $photo .');"></div>';
+ $res .= '<div class="blog-author-details">';
+ $res .= '<h3 class="blog-author-name" itemprop="name">'. $this->author->getName() .'</h3>';
+ $res .= '<p class="blog-author-bio" itemprop="jobTitle">'. $this->author->getBio() .'</p>';
+ $res .= $this->linkEmail($this->author->getEmail(), null, ['class' => 'blog-author-email', 'itemprop' => 'email']);
+ $res .= '</div>'; // .blog-author-details
+// $res .= '<pre>';
+// $res .= print_r($this->author, true);
+// $res .= '</pre>';
+ $res .= '</div>'; // .blog-author
+
$res .= '</div>'; // .blog-post-body
$res .= '</div>'; // .content-wrapper
&:after {
background-color: currentColor !important;
+ bottom: 0.7em !important;
}
a {
&-excerpt {
font-size: 15px;
line-height: 1.7;
+ max-width: 550px;
}
.picture {
.blog-post-body {
- max-width: 1008px;
margin: 0 auto;
font-size: 24px;
line-height: 1.67;
+ max-width: 1008px;
+ width: 100%;
> * + * {
margin-top: 1.5em;
}
- img {
- max-width: 100%;
- height: auto;
+ .image {
+
+ // Super-sized images that break out of the content column when
+ // there is space but never go beyond 90% width. On smaller screens,
+ // they scale down normally within the content column...
+ &-xl {
+ position: relative;
+ left: 50%;
+ transform: translateX(-50%);
+ width: 1512px; // 90% of 1680px
+ max-width: 90vw;
+ }
+
+ img {
+ display: block;
+ max-width: 100%;
+ height: auto;
+ margin: 0 auto;
+ }
+
+ figcaption {
+ font-size: 15px;
+ text-align: center;
+ margin-top: 1.5em;
+ }
+ }
+
+}
+
+.blog-author {
+ display: flex;
+ align-items: center;
+ background-color: #f3f3f3;
+ margin-top: 50px;
+ padding: 1.5em;
+ font-size: 15px;
+
+ &-photo {
+ width: 120px;
+ height: 120px;
+ background-size: cover;
+ background-position: center;
+ background-repeat: no-repeat;
+ border-radius: 50%;
+ margin-right: 1.5em;
}
+ &-name {
+ font-family: @heading-font;
+ font-size: 30px;
+ }
}