-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit ad4fd70
Showing
43 changed files
with
1,221 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,101 @@ | ||
<?php namespace Pmesolution\Blog; | ||
|
||
use Backend; | ||
use System\Classes\PluginBase; | ||
use Pmesolution\Blog\Models\Comment; | ||
use Event; | ||
|
||
/** | ||
* blog Plugin Information File | ||
*/ | ||
class Plugin extends PluginBase | ||
{ | ||
/** | ||
* Returns information about this plugin. | ||
* | ||
* @return array | ||
*/ | ||
public function pluginDetails() | ||
{ | ||
return [ | ||
'name' => 'pmesolution.blog::lang.plugin.name', | ||
'description' => 'pmesolution.blog::lang.plugin.description', | ||
'author' => 'pmesolution', | ||
'icon' => 'icon-edit' | ||
]; | ||
} | ||
|
||
/** | ||
* Register method, called when the plugin is first registered. | ||
* | ||
* @return void | ||
*/ | ||
public function register() | ||
{ | ||
|
||
} | ||
|
||
/** | ||
* Boot method, called right before the request route. | ||
* | ||
* @return array | ||
*/ | ||
public function boot() | ||
{ | ||
|
||
} | ||
|
||
/** | ||
* Registers any front-end components implemented in this plugin. | ||
* | ||
* @return array | ||
*/ | ||
public function registerComponents() | ||
{ | ||
|
||
return [ | ||
'\Pmesolution\Blog\Components\Blog' => 'Blog', | ||
'\Pmesolution\Blog\Components\Categories' => 'Categories', | ||
'\Pmesolution\Blog\Components\Post' => 'Post', | ||
'\Pmesolution\Blog\Components\Category' => 'Category', | ||
'\Pmesolution\Blog\Components\Comment' => 'Comment', | ||
|
||
]; | ||
} | ||
|
||
/** | ||
* Registers any back-end permissions used by this plugin. | ||
* | ||
* @return array | ||
*/ | ||
public function registerPermissions() | ||
{ | ||
return []; // Remove this line to activate | ||
|
||
return [ | ||
'pmesolution.blog.some_permission' => [ | ||
'tab' => 'blog', | ||
'label' => 'Some permission' | ||
], | ||
]; | ||
} | ||
|
||
/** | ||
* Registers back-end navigation items for this plugin. | ||
* | ||
* @return array | ||
*/ | ||
public function registerNavigation() | ||
{ | ||
|
||
return [ | ||
'blog' => [ | ||
'label' => 'pmesolution.blog::lang.menu_item.title', | ||
'url' => Backend::url('pmesolution/blog/Post'), | ||
'icon' => 'icon-edit', | ||
'permissions' => ['pmesolution.blog.*'], | ||
'order' => 500, | ||
], | ||
]; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,65 @@ | ||
.clear { clear:both;} | ||
.bloglist {} | ||
.bloglist ul {} | ||
.bloglist ul li { | ||
list-style-type:none; | ||
} | ||
|
||
.bloglist .featured-image { | ||
width:250px; | ||
margin:0 20px 0 0; | ||
float:left; | ||
} | ||
|
||
|
||
.block-categories ul{ | ||
padding-left:0; | ||
} | ||
.block-categories ul li { | ||
list-style-type:none; | ||
} | ||
|
||
.featured-image { | ||
max-width:100%; | ||
} | ||
|
||
.comments { | ||
width:100%; | ||
margin-top:20px; | ||
} | ||
.comments form { | ||
margin:40px 0; | ||
} | ||
.comments form label { | ||
width:100%; | ||
} | ||
|
||
.comments form textarea , .comments form input { | ||
width:350px; | ||
display:block; | ||
} | ||
.comments .submit { | ||
width:350px; | ||
margin-top:20px; | ||
padding:10px; | ||
} | ||
/*comments list*/ | ||
|
||
.comments ul { | ||
padding-left:0; | ||
} | ||
|
||
.comments ul li { | ||
width:100%; | ||
list-style-type:none; | ||
margin:20px 0; | ||
} | ||
.comments ul li .author { | ||
font-weight:bold; | ||
} | ||
/* block categories */ | ||
.block-categories {} | ||
.block-categories li a { | ||
text-decoration:none; | ||
color:#333; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
<?php namespace Pmesolution\Blog\Components; | ||
|
||
use Cms\Classes\ComponentBase; | ||
use Pmesolution\Blog\Models\Post; | ||
use Session; | ||
|
||
class Blog extends ComponentBase | ||
{ | ||
public function articles(){ | ||
//conditions here | ||
return Post::where('lang_id', Session::get('lang_id'))->get(); | ||
} | ||
|
||
public function onRun(){ | ||
$this->addCss('/plugins/pmesolution/blog/assets/css/blog.css'); | ||
} | ||
|
||
public function componentDetails() | ||
{ | ||
return [ | ||
'name' => 'pmesolution.blog::lang.components.blog.name', | ||
'description' => 'pmesolution.blog::lang.components.blog.description', | ||
]; | ||
} | ||
|
||
public function defineProperties() | ||
{ | ||
return []; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
<?php namespace Pmesolution\Blog\Components; | ||
|
||
use Cms\Classes\ComponentBase; | ||
use Pmesolution\Blog\Models\Category as ModelCategory; | ||
use Session; | ||
|
||
class Categories extends ComponentBase | ||
{ | ||
|
||
public function getlist(){ | ||
return ModelCategory::where('lang_id', Session::get('lang_id'))->get(); | ||
} | ||
|
||
public function componentDetails() | ||
{ | ||
return [ | ||
'name' => 'pmesolution.blog::lang.components.category.name', | ||
'description' => 'pmesolution.blog::lang.components.category.description' | ||
]; | ||
} | ||
|
||
public function defineProperties() | ||
{ | ||
return []; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
<?php namespace Pmesolution\Blog\Components; | ||
|
||
use Cms\Classes\ComponentBase; | ||
use Pmesolution\Blog\Models\Category as ModelCategory; | ||
use Pmesolution\Blog\Models\Post as ModelPost; | ||
use Redirect; | ||
|
||
class Category extends ComponentBase | ||
{ | ||
|
||
public $title = 'dd'; | ||
public $description = 'default description'; | ||
public function filter($slug){ | ||
$cat = ModelCategory::where('name' , $slug)->first(); | ||
|
||
if($cat !== NULL){ | ||
return Post::where('category', $cat->ID)->get(); | ||
}else { | ||
$this->title = 'foo'; | ||
$this->description ='bar'; | ||
return Post::All(); | ||
} | ||
|
||
} | ||
public function componentDetails() | ||
{ | ||
return [ | ||
|
||
'name' => 'pmesolution.blog::lang.components.category.name', | ||
'description' => 'pmesolution.blog::lang.components.category.description' | ||
]; | ||
} | ||
|
||
public function defineProperties() | ||
{ | ||
return []; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
<?php namespace Pmesolution\Blog\Components; | ||
|
||
use Cms\Classes\ComponentBase; | ||
use Request; | ||
use Input; | ||
|
||
class Comment extends ComponentBase | ||
{ | ||
public function componentDetails() | ||
{ | ||
return [ | ||
'name' => 'pmesolution.blog::lang.components.comment.name', | ||
'description' => 'pmesolution.blog::lang.components.comment.description' | ||
]; | ||
} | ||
|
||
public function defineProperties() | ||
{ | ||
return []; | ||
} | ||
|
||
public function onNewComment(){ | ||
var_dump(Input::get('name')); | ||
return 'foo'; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
<?php namespace Pmesolution\Blog\Components; | ||
|
||
use Cms\Classes\ComponentBase; | ||
use Request; | ||
use Pmesolution\Blog\Models\Post as Blogpost; | ||
|
||
|
||
class Post extends ComponentBase | ||
{ | ||
public function componentDetails() | ||
{ | ||
return [ | ||
'name' => 'pmesolution.blog::lang.components.post.name', | ||
'description' => 'pmesolution.blog::lang.components.post.description' | ||
]; | ||
} | ||
|
||
public function defineProperties() | ||
{ | ||
return []; | ||
} | ||
|
||
public function getone($slug){ | ||
|
||
return Blogpost::where('slug', $slug)->first(); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
<div class="bloglist"> | ||
<ul> | ||
{%for article in Blog.articles %} | ||
<li> | ||
<h3><a href="{{ url('/post') }}/{{article.slug}}">{{article.title}}</a></h3> | ||
{% if article.featured %} | ||
<img class="featured-image" src="{{article.featured.getpath()}}" /> | ||
{% endif%} | ||
<p>{{article.excerpt}}</p> | ||
<div class="clear"></div> | ||
</li> | ||
{% endfor %} | ||
</ul> | ||
</div> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
<div class="block-categories"> | ||
<ul> | ||
{%for item in Categories.getlist %} | ||
<li><a href="{{item.link}}">{{item.name}}</a></li> | ||
{% endfor %} | ||
</ul> | ||
</div> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
<div> | ||
<h1>{{__SELF__.title}}</h1> | ||
<p>{{ Category.description}}</p> | ||
<p>post list</p> | ||
{% set list=Category.filter(this.param.slug)%} | ||
<ul> | ||
{%for article in list %} | ||
<li><a href="{{ url('/post') }}/{{article.slug}}">{{article.title}}</a></li> | ||
{% endfor %} | ||
</ul> | ||
</div> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
<!-- comment form --> | ||
<div class="comments"> | ||
<form datarequest="onNewComment"> | ||
<fieldset><legend>{{ 'Submit a comment' | l }}</legend> | ||
<label>{{ 'Name' | l }}</label> | ||
<input type="text" id="name" name="name"/> | ||
<br/> | ||
<label>{{ 'email' | l }} </label> | ||
<input type="text" id="email" name="email"/> | ||
|
||
<label>{{ 'Message'}}</label> | ||
<textarea id="message" name="message"> | ||
</textarea> | ||
</fieldset> | ||
|
||
<button class="primary submit">{{'Submit' | l }}</button> | ||
</form> | ||
<!-- list of old comments --> | ||
|
||
<h4>{{ 'Comments' | l }}</h4> | ||
<ul> | ||
<li> | ||
<div class="author">author1</div> | ||
<div class="comment">comment 1</div> | ||
</li> | ||
<li> | ||
<div class="author">author2</div> | ||
<div class="comment">Comment 2</div> | ||
</li> | ||
<li> | ||
<div class="author">author3</div> | ||
<div class="comment">Comment 3</div> | ||
</li> | ||
</ul> | ||
</div> |
Oops, something went wrong.