Skip to content

Commit

Permalink
merge dev2.0
Browse files Browse the repository at this point in the history
  • Loading branch information
imsamthomas committed Jul 22, 2016
1 parent d7afd5d commit 5acc971
Show file tree
Hide file tree
Showing 31 changed files with 741 additions and 18,886 deletions.
4 changes: 2 additions & 2 deletions Block/Adminhtml/System/Config/Head.php
Original file line number Diff line number Diff line change
Expand Up @@ -42,8 +42,8 @@ public function render(\Magento\Framework\Data\Form\Element\AbstractElement $ele
{
// $html='<li class="notice-msg">
//
// * <a href="https://mageplaza.freshdesk.com/support/solutions/folders/6000213306" target="_blank">User Guide</a> <br>
// * <a href="https://mageplaza.freshdesk.com/support/discussions/topics/new?forum_id=6000240988" target="_blank">Report a problem</a> <br>
// * <a href="https://docs.mageplaza.com/blog-m2/" target="_blank">User Guide</a> <br>
// * <a href="https://mageplaza.freshdesk.com/support/discussions/topics/new?forum_id=6000241371" target="_blank">Report a problem</a> <br>
// * Your default blog URL <strong>domain.com/blog/</strong> <br>
// * Atom Feed <strong>domain.com/blog/post/rss/</strong> <br>
// * Sitemap <strong>domain.com/sitemap/blog.xml</strong> <br>
Expand Down
3 changes: 2 additions & 1 deletion Block/Sidebar/Mostview.php
Original file line number Diff line number Diff line change
Expand Up @@ -42,12 +42,13 @@ public function getLimitPost()

public function getRecentPost()
{
$ob = $this->objectManager->get('Mageplaza\Blog\Model\Post');
$ob = $this->objectManager->get('Mageplaza\Blog\Model\Post');
$posts = $ob->getCollection();
$posts->setOrder('created_at', 'DESC');

return $posts;
}

public function getLimitRecentPost()
{
return $this->helperData->getBlogConfig('sidebar/number_recent_posts');
Expand Down
41 changes: 41 additions & 0 deletions Model/Config/Source/Backend/Image.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
<?php
NameSpace Mageplaza\Blog\Model\Config\Source\Backend;
class Image extends \Magento\Config\Model\Config\Backend\Image
{
/**
* The tail part of directory path for uploading
*
*/
const UPLOAD_DIR = 'mageplaza/author'; // Folder save image

/**
* Return path to directory for upload file
*
* @return string
* @throw \Magento\Framework\Exception\LocalizedException
*/
protected function _getUploadDir()
{
return $this->_mediaDirectory->getAbsolutePath($this->_appendScopeInfo(self::UPLOAD_DIR));
}

/**
* Makes a decision about whether to add info about the scope.
*
* @return boolean
*/
protected function _addWhetherScopeInfo()
{
return true;
}

/**
* Getter for allowed extensions of uploaded files.
*
* @return string[]
*/
protected function _getAllowedExtensions()
{
return ['jpg', 'jpeg', 'gif', 'png', 'svg'];
}
}
4 changes: 2 additions & 2 deletions Model/ResourceModel/Category.php
Original file line number Diff line number Diff line change
Expand Up @@ -91,9 +91,9 @@ public function getCategoryNameById($id)
*/
protected function _beforeSave(\Magento\Framework\Model\AbstractModel $object)
{
$object->setUpdatedAt($this->date->date('Y-m-d'));
$object->setUpdatedAt($this->date->date());
if ($object->isObjectNew()) {
$object->setCreatedAt($this->date->date('Y-m-d'));
$object->setCreatedAt($this->date->date());
}
/** @var \Mageplaza\Blog\Model\Category $object */
parent::_beforeSave($object);
Expand Down
93 changes: 51 additions & 42 deletions etc/adminhtml/system.xml
Original file line number Diff line number Diff line change
Expand Up @@ -31,82 +31,88 @@
showInWebsite="1" showInStore="1">
<label>Enable</label>
<source_model>Magento\Config\Model\Config\Source\Yesno</source_model>
<comment>Enable/Disable Blog module</comment>
</field>
<field id="name"
translate="label" type="text" sortOrder="11" showInDefault="1"
showInWebsite="1" showInStore="1">
<label>Blog name</label>
<comment>Blog name</comment>
<comment><![CDATA[Blog label will be displayed in frontend <a href="http://prntscr.com/bw0m51" target="_blank">Learn more</a>.]]></comment>
</field>
<field id="url_prefix"
translate="label" type="text" sortOrder="15" showInDefault="1"
showInWebsite="1" showInStore="1">
<label>Url Prefix</label>
<label>Blog Route</label>
<comment><![CDATA[It can be <strong>blog</strong>, <strong>news</strong> or what you want. It should be lower case. ]]></comment>

</field>
<field id="url_suffix"
translate="label" type="text" sortOrder="16" showInDefault="1"
showInWebsite="1" showInStore="1">
<label>Url Suffix</label>
<comment>Leave empty for no suffix. Default: html</comment>
<label>Blog Url Suffix</label>
<comment><![CDATA[Default: empty. Leave empty for "/". You can change to <strong>.html</strong> ]]></comment>

</field>
<field id="toplinks" translate="label comment" type="select" sortOrder="20" showInDefault="20"
showInWebsite="1" showInStore="1">
<label>Show Blog Link in Top links</label>
<source_model>Magento\Config\Model\Config\Source\Yesno</source_model>
<comment><![CDATA[<strong>Deprecated</strong> function. ]]></comment>

</field>
<field id="footer" translate="label comment" type="select" sortOrder="25" showInDefault="20"
showInWebsite="1" showInStore="1">
<label>Show Blog Link in Footer links</label>
<source_model>Magento\Config\Model\Config\Source\Yesno</source_model>
<comment><![CDATA[We will add a link to Blog URL in footer, <a href="http://prntscr.com/bw0o7d" target="_blank">learn more</a>. ]]></comment>
</field>
<field id="sidebar_right" translate="label comment" type="select" sortOrder="30" showInDefault="20"
showInWebsite="1" showInStore="1">
<label>Show Sidebar Right</label>
<label>Show Widgets on Right Sidebar</label>
<source_model>Magento\Config\Model\Config\Source\Yesno</source_model>
<comment><![CDATA[Widgets: Popular posts, recent posts, categories, tags... ]]></comment>

</field>
<field id="sidebar_left" translate="label comment" type="select" sortOrder="30" showInDefault="20"
showInWebsite="1" showInStore="1">
<label>Show Sidebar Left</label>
<label>Show Widgets on Left Sidebar</label>
<source_model>Magento\Config\Model\Config\Source\Yesno</source_model>
<comment><![CDATA[Widgets: Popular posts, recent posts, categories, tags... ]]></comment>

</field>
<field id="display_style" translate="label comment" type="select" sortOrder="40" showInDefault="1"
showInStore="1" showInWebsite="1">
<label>Display blogs style</label>
<label>Listing Posts Mode</label>
<source_model>Mageplaza\Blog\Model\Config\Source\Blogview\Display</source_model>
<comment>Grid view style is better</comment>
<comment>You can display blog posts in Grid/List mode</comment>
</field>
<field id="enable_mpbootstrap" translate="label comment" type="select" sortOrder="50" showInWebsite="1" showInStore="1" showInDefault="1">
<label>Enable Bootstrap</label>
<source_model>Magento\Config\Model\Config\Source\Yesno</source_model>
<comment>If you already had bootstrap css library, then select no.</comment>
<comment><![CDATA[If your store has already included <a href="http://getbootstrap.com/" target="_blank">BoostrapCSS</a>, so select <strong>No</strong> ]]></comment>

</field>
<field id="font_color" translate="label comment" type="text" sortOrder="60" showInWebsite="1" showInStore="1" showInDefault="1">
<label>Choose blog's color</label>
<comment>Type color code. Eg: #1abc9c, #1979c3...</comment>
</field>
<field id="display_author" translate="label comment" type="select" sortOrder="70" showInWebsite="1" showInStore="1" showInDefault="1">
<label>Display author in blog</label>
<source_model>Magento\Config\Model\Config\Source\Yesno</source_model>
<comment>If your choose Yes, Author name, avatar and author description will be display in blog</comment>
</field>
<field id="author_name" translate="label comment" type="text" sortOrder="80" showInWebsite="1" showInStore="1" showInDefault="1">
<label>Author name</label>
<comment>Author name in your blog</comment>
</field>
<field id="upload_image" translate="label comment" type="image" sortOrder="90" showInDefault="1" showInWebsite="1" showInStore="1">
<label>Author avatar</label>
<backend_model>Mageplaza\Blog\Model\Config\Source\Backend\Image</backend_model>
<base_url type="media" scope_info="1">mageplaza/author</base_url>
<comment>Author avatar in your blog</comment>
</field>
<field id="author_description" translate="label" type="textarea" sortOrder="100" showInDefault="1" showInWebsite="1" showInStore="1">
<label>Author description</label>
<comment>This field is required if you choose Yes at Display author in blog</comment>
</field>
<label>Blog color</label>
<comment><![CDATA[Default: #1abc9c; This color will be used in heading, background, link, tags ... There are few sample of color: Blue #2cc5e1; Green: #0ed08e; Orange: #f1703d; Violet: #6f5499; Black: #333333; Red: #f15d59]]></comment>
</field>
<!--<field id="display_author" translate="label comment" type="select" sortOrder="70" showInWebsite="1" showInStore="1" showInDefault="1">-->
<!--<label>Display author in blog</label>-->
<!--<source_model>Magento\Config\Model\Config\Source\Yesno</source_model>-->
<!--<comment>If your choose Yes, Author name, avatar and author description will be display in blog</comment>-->
<!--</field>-->
<!--<field id="author_name" translate="label comment" type="text" sortOrder="80" showInWebsite="1" showInStore="1" showInDefault="1">-->
<!--<label>Author name</label>-->
<!--<comment>Author name in your blog</comment>-->
<!--</field>-->
<!--<field id="author_description" translate="label" type="textarea" sortOrder="100" showInDefault="1" showInWebsite="1" showInStore="1">-->
<!--<label>Author description</label>-->
<!--<comment>This field is required if you choose Yes at Display author in blog</comment>-->
<!--</field>-->
</group>
<group id="sidebar" translate="label" type="text" sortOrder="10" showInDefault="1" showInWebsite="1"
showInStore="1">
<label>Sidebar</label>
<label>Sidebar Widgets</label>
<field id="number_recent_posts"
translate="label" type="text" sortOrder="1" showInDefault="1"
showInWebsite="1" showInStore="1">
Expand All @@ -115,7 +121,7 @@
<field id="number_mostview_posts"
translate="label" type="text" sortOrder="10" showInDefault="1"
showInWebsite="1" showInStore="1">
<label>Number of most view posts</label>
<label>Number of popular posts</label>
</field>
</group>
<group id="comment" translate="label" type="text" sortOrder="13" showInDefault="1" showInWebsite="1"
Expand All @@ -124,21 +130,22 @@
<field id="type"
translate="label" type="select" sortOrder="1" showInDefault="1"
showInWebsite="1" showInStore="1">
<label>Number of recent posts</label>
<label>Comment Engine</label>
<source_model>Mageplaza\Blog\Model\Config\Source\Comments\Type</source_model>
<comment>You can switch Disqus comment or Facebook Comment.</comment>
</field>
<field id="disqus"
translate="label" type="text" sortOrder="10" showInDefault="1"
showInWebsite="1" showInStore="1">
<label>Disqus unique name</label>
<comment><![CDATA[Create at <a href="https://disqus.com/admin/create/" target="_blank">Disqus</a>]]></comment>
<comment><![CDATA[You should create your own key at <a href="https://disqus.com/admin/create/" target="_blank">Disqus</a>.]]></comment>
<depends><field id="type">3</field></depends>
</field>
<field id="facebook_appid"
translate="label" type="text" sortOrder="15" showInDefault="1"
showInWebsite="1" showInStore="1">
<label>Facebook: AppID</label>
<comment><![CDATA[Regiter AppID <a href="https://developers.facebook.com/apps/" target="_blank">here</a>]]></comment>
<comment><![CDATA[Register Your own Facebook AppID <a href="https://developers.facebook.com/apps/" target="_blank">here</a>]]></comment>
<depends><field id="type">2</field></depends>
</field>
<field id="facebook_number_comment"
Expand Down Expand Up @@ -167,35 +174,37 @@
</group>
<group id="seo" translate="label" type="text" sortOrder="15" showInDefault="1" showInWebsite="1"
showInStore="1">
<label>SEO</label>
<label>Blog SEO Meta Information</label>
<field id="meta_title"
translate="label" type="text" sortOrder="1" showInDefault="1"
showInWebsite="1" showInStore="1">
<label>Meta title for posts list page</label>
<label>Blog Meta title</label>
</field>
<field id="meta_description"
translate="label" type="textarea" sortOrder="10" showInDefault="1"
showInWebsite="1" showInStore="1">
<label>Meta description for posts list page</label>
<label>Blog Meta description</label>
</field>
<field id="meta_keywords"
translate="label" type="textarea" sortOrder="15" showInDefault="1"
showInWebsite="1" showInStore="1">
<label>Meta keywords for posts list page</label>
<label>Blog Meta keywords</label>
</field>
</group>
<group id="share" translate="label" type="text" sortOrder="20" showInDefault="1" showInWebsite="1"
showInStore="1">
<label>Social</label>
<label>Social Share</label>
<field id="enabled" translate="label comment" type="select" sortOrder="1" showInDefault="1"
showInWebsite="1" showInStore="1">
<label>Enable</label>
<source_model>Magento\Config\Model\Config\Source\Yesno</source_model>
<comment><![CDATA[Enable Social Share buttons. <a href="http://prntscr.com/bw0tlg" target="_blank">Learn more</a>]]></comment>
</field>
<field id="pubid_id"
translate="label" type="text" sortOrder="2" showInDefault="1"
showInWebsite="1" showInStore="2">
<label>Pubid Id</label>
<label>Addthis PubID</label>
<comment><![CDATA[Default: ra-568cdc40e9eab41d. You can create your own Addthis PubID <a href="http://www.addthis.com/" target="_blank">here</a>]]></comment>
</field>
</group>
</section>
Expand Down
12 changes: 6 additions & 6 deletions etc/config.xml
Original file line number Diff line number Diff line change
@@ -1,17 +1,17 @@
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="urn:magento:module:Magento_Store:etc/config.xsd">
<?xml version="1.0"?>

<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:module:Magento_Store:etc/config.xsd">
<default>
<blog>
<general>
<enabled>1</enabled>
<name>Blog</name>
<url_prefix>blog</url_prefix>
<url_suffix>.html</url_suffix>
<url_suffix></url_suffix>
<sidebar_right>1</sidebar_right>
<enable_mpbootstrap>1</enable_mpbootstrap>
<font_color>#1abc9c</font_color>
<display_author>1</display_author>
<author_name>admin</author_name>
<font_color><![CDATA[#1abc9c]]></font_color>
<display_author>0</display_author>
</general>
<sidebar>
<number_recent_posts>5</number_recent_posts>
Expand Down
22 changes: 7 additions & 15 deletions view/adminhtml/templates/system/config/head.phtml
Original file line number Diff line number Diff line change
@@ -1,17 +1,9 @@
<ul class="mageplaza-head" style="position: static">
<li>
<a href="https://mageplaza.freshdesk.com/support/solutions/folders/6000213306" target="_blank">User Guide</a> <br>
</li>
<li>
<a href="https://mageplaza.freshdesk.com/support/discussions/topics/new?forum_id=6000240988" target="_blank">Report a problem</a> <br>
</li>
<li>
Your default blog URL <strong>domain.com/blog/</strong> <br>
</li>
<li>
Atom Feed <strong>domain.com/blog/post/rss/</strong> <br>
</li>
<li>
Sitemap <strong>domain.com/sitemap/blog.xml</strong> <br>
</li>
<li><a href="https://docs.mageplaza.com/blog-m2/" target="_blank">User Guide</a> <br> </li>
<li><a href="https://mageplaza.freshdesk.com/support/discussions/topics/new?forum_id=6000241371" target="_blank">Report a problem</a> <br></li>
<li>Your default blog URL <strong>domain.com/blog/</strong> <br></li>
<li>Atom Feed <strong>domain.com/blog/post/rss/</strong> <br> </li>
<li>Sitemap <strong>domain.com/sitemap/blog.xml</strong> <br> </li>
<li><strong><a href="https://www.mageplaza.com/" target="_blank">Find more extensions</a></strong> <br></li>

</ul>
8 changes: 8 additions & 0 deletions view/frontend/layout/blog_category_index.xml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,14 @@
<page xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" layout="1column" xsi:noNamespaceSchemaLocation="urn:magento:framework:View/Layout/etc/page_configuration.xsd">
<head>
<css src="Mageplaza_Blog::css/index/style.css"/>
<css src="Mageplaza_Blog::css/index/owl.carousel.css"/>
<css src="Mageplaza_Blog::css/index/owl.theme.css"/>
<css src="Mageplaza_Blog::css/index/font-awesome.css"/>
<css src="Mageplaza_Blog::css/index/font-awesome.min.css"/>
<script src="Mageplaza_Blog::js/jquery-1.12.4.min.js"/>
<script src="Mageplaza_Blog::js/owl.carousel.min.js"/>
<block class="Mageplaza\Blog\Block\Frontend" name="mp.blog.header" template="Mageplaza_Blog::blog/header.phtml"/>

</head>
<body>
<referenceContainer name="content">
Expand Down
Loading

0 comments on commit 5acc971

Please sign in to comment.