From 2b38da305a32876bd6af3d1e26346fa1c133ec56 Mon Sep 17 00:00:00 2001 From: 4Giedrius <4giedrius@gmail.com> Date: Wed, 3 Dec 2014 15:25:03 +0200 Subject: [PATCH 1/3] News link updated in breadcrumbs --- src/bb-modules/News/html_client/mod_news_post.phtml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/bb-modules/News/html_client/mod_news_post.phtml b/src/bb-modules/News/html_client/mod_news_post.phtml index 251a93fb5..fca2db60f 100644 --- a/src/bb-modules/News/html_client/mod_news_post.phtml +++ b/src/bb-modules/News/html_client/mod_news_post.phtml @@ -2,7 +2,7 @@ {% block meta_title %}{{post.title}}{% endblock %} {% block breadcrumb %} -
  • {% trans 'Blog' %}/
  • +
  • {% trans 'Blog' %}/
  • {{post.title}}
  • {% endblock %} From de18acb391549537c7b09ca36fc18d066cd3aa3c Mon Sep 17 00:00:00 2001 From: 4Giedrius <4giedrius@gmail.com> Date: Wed, 3 Dec 2014 15:27:46 +0200 Subject: [PATCH 2/3] News list for admin area fix --- src/bb-modules/News/Api/Admin.php | 2 +- src/bb-modules/News/html_admin/mod_news_index.phtml | 1 - 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/src/bb-modules/News/Api/Admin.php b/src/bb-modules/News/Api/Admin.php index 9ebf72dae..312d0d05d 100644 --- a/src/bb-modules/News/Api/Admin.php +++ b/src/bb-modules/News/Api/Admin.php @@ -31,7 +31,7 @@ class Admin extends \Api_Abstract $pager = $this->di['pager']->getSimpleResultSet($sql, $params, $per_page); foreach ($pager['list'] as $key => $item) { $post = $this->di['db']->getExistingModelById('Post', $item['id'], 'Post not found'); - $pager['list'][$key] = $this->getService()->toApiArray($post); + $pager['list'][$key] = $this->getService()->toApiArray($post, 'admin'); } return $pager; diff --git a/src/bb-modules/News/html_admin/mod_news_index.phtml b/src/bb-modules/News/html_admin/mod_news_index.phtml index b5191d544..e34bee9a4 100644 --- a/src/bb-modules/News/html_admin/mod_news_index.phtml +++ b/src/bb-modules/News/html_admin/mod_news_index.phtml @@ -21,7 +21,6 @@ - # {% trans 'Title' %} {% trans 'Active' %} {% trans 'Date' %} From 9badc2d0b5fa585969788eb1d5b689f1cfa4d769 Mon Sep 17 00:00:00 2001 From: 4Giedrius <4giedrius@gmail.com> Date: Wed, 3 Dec 2014 15:47:21 +0200 Subject: [PATCH 3/3] tag added to News module --- src/bb-modules/News/Service.php | 46 ++++++++++--------- .../News/html_admin/mod_news_index.phtml | 2 + .../News/html_admin/mod_news_post.phtml | 2 + 3 files changed, 28 insertions(+), 22 deletions(-) diff --git a/src/bb-modules/News/Service.php b/src/bb-modules/News/Service.php index f1eed9a1a..87690dac9 100644 --- a/src/bb-modules/News/Service.php +++ b/src/bb-modules/News/Service.php @@ -37,8 +37,7 @@ class Service public function getSearchQuery($data) { - $sql='SELECT *, - SUBSTRING( content, 1, LOCATE( "", content ) -1 ) AS excerpt + $sql='SELECT * FROM post WHERE 1 '; @@ -64,32 +63,35 @@ class Service public function toApiArray($row, $role = 'guest', $deep = true) { - $admin = $this->di['db']->getRow('SELECT name, email FROM admin WHERE id=:id', array('id'=>$row->admin_id)); - + $admin = $this->di['db']->getRow('SELECT name, email FROM admin WHERE id=:id', array('id' => $row->admin_id)); + + $pos = strpos($row->content, ''); + $excerpt = ($pos) ? substr($row->content, 0, $pos) : null; + $data = array( - 'id' => $row->id, - 'title' => $row->title, - 'content' => $row->content, - 'slug' => $row->slug, - 'image' => $row->image, - 'section' => $row->section, - 'publish_at' => $row->publish_at, - 'published_at' => $row->published_at, - 'expires_at' => $row->expires_at, - 'created_at' => $row->created_at, - 'updated_at' => $row->updated_at, - 'author' => array( - 'name' => $admin['name'], - 'email' => $admin['email'], + 'id' => $row->id, + 'title' => $row->title, + 'content' => $row->content, + 'slug' => $row->slug, + 'image' => $row->image, + 'section' => $row->section, + 'publish_at' => $row->publish_at, + 'published_at' => $row->published_at, + 'expires_at' => $row->expires_at, + 'created_at' => $row->created_at, + 'updated_at' => $row->updated_at, + 'author' => array( + 'name' => $admin['name'], + 'email' => $admin['email'], ), - 'excerpt' => $row->excerpt, + 'excerpt' => $excerpt, //'tags' => array('foo', 'bar', 'bas'), //@todo ); - - if($role == 'admin') { + + if ($role == 'admin') { $data['status'] = $row->status; } - + return $data; } } \ No newline at end of file diff --git a/src/bb-modules/News/html_admin/mod_news_index.phtml b/src/bb-modules/News/html_admin/mod_news_index.phtml index e34bee9a4..aff48f6a6 100644 --- a/src/bb-modules/News/html_admin/mod_news_index.phtml +++ b/src/bb-modules/News/html_admin/mod_news_index.phtml @@ -79,6 +79,8 @@
    +

    If the text is very long you can use <!--more--> tag. Inserting this tag within the post will create and excerpt of text (before the tag) to be displayed in posts list. Users will be able to see whole content when they click on "Read more" button.

    +
    diff --git a/src/bb-modules/News/html_admin/mod_news_post.phtml b/src/bb-modules/News/html_admin/mod_news_post.phtml index f867866eb..c35cb2755 100644 --- a/src/bb-modules/News/html_admin/mod_news_post.phtml +++ b/src/bb-modules/News/html_admin/mod_news_post.phtml @@ -19,6 +19,8 @@
    +

    If the text is very long you can use <!--more--> tag. Inserting this tag within the post will create and excerpt of text (before the tag) to be displayed in posts list. Users will be able to see whole content when they click on "Read more" button.

    +