Skip to content

Commit

Permalink
Merge pull request #7 from webburza/development
Browse files Browse the repository at this point in the history
Development
  • Loading branch information
ychanan committed Apr 27, 2016
2 parents ed618e5 + 48f383d commit a28bceb
Show file tree
Hide file tree
Showing 8 changed files with 39 additions and 9 deletions.
2 changes: 1 addition & 1 deletion Controller/ArticleController.php
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ public function showFrontAction(Request $request, $slug)
$relatedArticles =
$this
->get('webburza.repository.article')
->getRelatedArticles($article, $locale);
->getRelatedArticles($article, $locale, 3);

// Create the view
$view = View::create();
Expand Down
11 changes: 8 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,13 +1,14 @@
# Sylius Article Bundle

[![Build Status](https://travis-ci.org/webburza/sylius-article-bundle.svg?branch=master)](https://travis-ci.org/webburza/sylius-article-bundle)
This bundle extends the Sylius e-commerce platform with Article resource, which can be used to
publish news, articles, or as a blog. It comes with full multilingual support, the ability to
group articles into categories and to list related articles.

[<img title="Single Article" src="http://i.imgur.com/aFZg03r.png" width="235">](http://i.imgur.com/aFZg03r.png)
[<img title="Single Article in CMS" src="http://i.imgur.com/oMZ5Z7i.png" width="235">](http://i.imgur.com/oMZ5Z7i.png)
[<img title="Article Listing in CMS" src="http://i.imgur.com/zjFYdyN.png" width="235">](http://i.imgur.com/zjFYdyN.png)


This bundle extends the Sylius e-commerce platform with Article resource, which can be used to publish news, articles, or as a blog.
---

## Installation

Expand Down Expand Up @@ -109,3 +110,7 @@ For more information, see http://docs.ckeditor.com/#!/guide/dev_file_browse_uplo
## License

This bundle is available under the [MIT license](LICENSE).

## To-do

- Tests
3 changes: 3 additions & 0 deletions Resources/translations/messages.en.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,9 @@ webburza:
articles: Articles
frontend:
articles: Articles
latest_from_category: 'Latest from category'
related_articles: 'Related articles'
latest_articles: 'Latest articles'
breadcrumb:
index: Articles
index_header: Articles
Expand Down
3 changes: 3 additions & 0 deletions Resources/translations/messages.hr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,9 @@ webburza:
articles: Članci
frontend:
articles: Članci
latest_from_category: 'Najnovije iz kategorije'
related_articles: 'Povezani članci'
latest_articles: 'Najnoviji članci'
breadcrumb:
index: Članci
index_header: Članci
Expand Down
6 changes: 3 additions & 3 deletions Resources/views/Frontend/Article/macros.html.twig
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@

<div class="col-md-9">
<a href="{{ path('webburza_article_frontend_show', {slug: article.slug}) }}">
<h2>{{ article.title }}</h2>
<p class="h3">{{ article.title }}</p>
</a>

<span>{{ article.publishedAt|date }}</span>
Expand All @@ -27,7 +27,7 @@
{% endfor %}
{% endmacro %}

{% macro articleSidebar(categories, currentID, articleView) %}
{% macro articleSidebar(categories, currentCategory, articleView) %}
<div class="col-md-3{{ articleView ? ' col-md-offset-2' : '' }}">
<ul class="nav">
<li class="first">
Expand All @@ -37,7 +37,7 @@

<ul class="nav nav-pills nav-stacked menu_level_1">
{% for category in categories %}
<li class="nav-item{{ loop.first ? ' first' : loop.last ? ' last' : '' }}{{ currentID == category.id ? ' active' : '' }}">
<li class="nav-item{{ loop.first ? ' first' : loop.last ? ' last' : '' }}{{ currentCategory and (currentCategory.id == category.id) ? ' active' : '' }}">
<a href="{{ path('webburza_article_category_frontend_show', {slug: category.slug}) }}">
<i class="icon-angle-right"></i> <span>{{ category.title }}</span>
</a>
Expand Down
18 changes: 17 additions & 1 deletion Resources/views/Frontend/Article/show.html.twig
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,23 @@
</div>

{% if categories is not empty %}
{{ macro.articleSidebar(categories, article.category.id, true) }}
{{ macro.articleSidebar(categories, article.category, true) }}
{% endif %}
</div>

{% if related_articles is not empty %}
<hr>

<div class="row">
<div class="col-md-9">
{% if article.category %}
<h2>{{ 'webburza.sylius.article.frontend.latest_from_category' | trans }} &quot;{{ article.category.title }}&quot;</h2>
{% else %}
<h2>{{ 'webburza.sylius.article.frontend.latest_articles' | trans }}</h2>
{% endif %}

{{ macro.list(related_articles) }}
</div>
</div>
{% endif %}
{% endblock %}
2 changes: 1 addition & 1 deletion Resources/views/Frontend/Category/show.html.twig
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
</div>

{% if categories is not empty %}
{{ macro.articleSidebar(categories, category.id) }}
{{ macro.articleSidebar(categories, category) }}
{% endif %}
</div>

Expand Down
3 changes: 3 additions & 0 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,9 @@
"autoload": {
"psr-4": { "Webburza\\Sylius\\ArticleBundle\\": "" }
},
"require": {
"sylius/core": "^0.17"
},
"require-dev": {
"phpunit/phpunit": "^4.8"
}
Expand Down

0 comments on commit a28bceb

Please sign in to comment.