Skip to content
This repository was archived by the owner on Aug 3, 2018. It is now read-only.
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
56 changes: 56 additions & 0 deletions ezpublish/config/ezpublish.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
# import the ezpublish.yml from your Bundle
imports:
- {resource: @EzTutorialBikeBundle/Resources/config/ezpublish.yml}

ezpublish:
repositories:
demo_repository:
engine: legacy
connection: default

siteaccess:
# Available siteaccesses
list:
- demo_site
- gobike

# Siteaccess groups. Use them to group common settings.
groups:
demo_site_group: [demo_site, gobike]
default_siteaccess: demo_site
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Because of working with demo_site siteaccess : not sure that my template_rules.yml are considered.

match:
URIElement: 1

imagemagick:
enabled: false

# System settings, grouped by siteaccess and/or siteaccess group
system:
demo_site_group:
repository: demo_repository
var_dir: var/ezdemo_site
languages:
- eng-GB
session:
name: eZSESSID
default:
content:
view_cache: true
ttl_cache: true
# TTL cache (http) in seconds
# Note that Http cache for a given content is always invalidated when publishing that content
default_ttl: 300

# Stash is used for persistence cache
stash:
caches:
default:
drivers:
# When using multiple webservers, you must use Memcache or Redis
- FileSystem
inMemory: true
registerDoctrineAdapter: false
# On Windows, using FileSystem, to avoid hitting filesystem limitations
# you need to change the keyHashFunction used to generate cache directories to "crc32"
# FileSystem
# keyHashFunction: crc32
55 changes: 23 additions & 32 deletions src/EzTutorial/BikeBundle/Controller/DefaultController.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@

namespace EzTutorial\BikeBundle\Controller;

use Doctrine\Common\Collections\Criteria;
use eZ\Bundle\EzPublishCoreBundle\Controller;
use eZ\Publish\API\Repository\Values\Content\LocationQuery;
use eZ\Publish\API\Repository\Values\ValueObject;
Expand All @@ -15,42 +14,34 @@

class DefaultController extends Controller
{
public function indexAction($name)
{
$rideList = $this->findRidesAction(65);
return $this->render('EzTutorialBikeBundle:Default:index.html.twig', array('name' => $name, 'rideList' => $rideList));
}

/**
* @return Response
*/
public function listRidesAction()
public function indexAction()
{
$response = new Response();
$rides = null;


// Using the criteria helper (a demobundle custom service) to generate our query's criteria.
// This is a good practice in order to have less code in your controller.
$criteria = new Criteria();

// Generating query
$query = new Query();
$query->criterion = $criteria;
$query->sortClauses = array(
new SortClause\Field('ride', 'creation_date', Query::SORT_DESC)
);
$folderId = 124;
$rideList = $this->findRidesAction($folderId);
return $this->render('EzTutorialBikeBundle:Default:index.html.twig', array('rideList' => $rideList));
}

$rides = $this->searchService->findContent($query);

return $this->render(
'EzTutorialBikeBundle:frontpage.html.twig',
array(
'content' => $rides,
),
$response
/**
* Renders article with extra parameters that controls page elements visibility such as image and summary
*
* @param $locationId
* @param $viewType
* @param bool $layout
* @param array $params
* @return \Symfony\Component\HttpFoundation\Response
*/
public function showRideAction($locationId, $viewType, $layout = false, array $params = array())
{
return $this->get('ez_content')->viewLocation(
$locationId,
$viewType,
$layout,
array() + $params
);

}

/**
Expand Down Expand Up @@ -78,15 +69,15 @@ public function findRidesAction($folderId)
$criteria = array();
$criteria[] = new Criterion\Visibility(Criterion\Visibility::VISIBLE);
$criteria[] = new Criterion\Subtree($location->pathString);
$criteria[] = new Criterion\ContentTypeIdentifier(array('ride'));
$criteria[] = new Criterion\ContentTypeIdentifier(array('ride2'));
$criteria[] = new Criterion\LanguageCode($languages);

// Generating query to retrieve only Rides
$query = new LocationQuery();
$query->criterion = new Criterion\LogicalAnd(
array(
new Criterion\ParentLocationId($folderId),
new Criterion\ContentTypeIdentifier(array('ride'))
new Criterion\ContentTypeIdentifier(array('ride','ride2'))
)
);
$searchService = $repository->getSearchService();
Expand Down
2 changes: 2 additions & 0 deletions src/EzTutorial/BikeBundle/Resources/config/ezpublish.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
imports:
- { resource: @EzTutorialBikeBundle/Resources/config/template_rules.yml }
6 changes: 5 additions & 1 deletion src/EzTutorial/BikeBundle/Resources/config/routing.yml
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
ez_tutorial_bike_homepage:
path: /hello/{name}
path: /hello
defaults: { _controller: EzTutorialBikeBundle:Default:index }

ez_tutorial_bike_ride_full:
path: /ride/:id
defaults: { _controller: EzTutorialBikeBundle:Default:ride }
18 changes: 18 additions & 0 deletions src/EzTutorial/BikeBundle/Resources/config/template_rules.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
ezpublish:
system:
default:
location_view:
line:
ride_line:
template: "EzTutorialBikeBundle:line:ride.html.twig"
match:
Identifier\ContentType: [ride, ride2] #I had to recreate the Contenttype so I am using ride2
poi:
template: "EzTutorialBikeBundle:line:poi.html.twig"
match:
Identifier\ContentType: [poi]
full:
ride:
template: "EzTutorialBikeBundle:full:ride.html.twig"
match:
Identifier\ContentType: [ride, ride2]
124 changes: 19 additions & 105 deletions src/EzTutorial/BikeBundle/Resources/views/Default/index.html.twig
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
<!DOCTYPE html>
<html lang="en">


<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
Expand All @@ -10,63 +9,20 @@
<meta name="Bike Tutorial" content="eZ Systems tutorial">

<title>Beginners Tutorial - Bike Rides</title>
{{ include('EzTutorialBikeBundle::page_head_css.html.twig') }}

<!-- Bootstrap Core CSS -->
{% stylesheets filter='cssrewrite'
'@EzTutorialBikeBundle/Resources/css/bootstrap.min.css'
'@EzTutorialBikeBundle/Resources/css/bootstrap-theme.css'
'@EzTutorialBikeBundle/Resources/css/style.css'
'@EzTutorialBikeBundle/Resources/css/normalize.css' %}
<link rel="stylesheet" type="text/css" href="{{ asset_url }}"/>
{% endstylesheets %}
<!-- Custom Fonts & Themes -->
<link rel="stylesheet" href="http://maxcdn.bootstrapcdn.com/font-awesome/4.3.0/css/font-awesome.min.css">

<link href='http://fonts.googleapis.com/css?family=Oswald' rel='stylesheet' type='text/css'>
<link href='http://fonts.googleapis.com/css?family=Roboto+Slab' rel='stylesheet' type='text/css'>
<link href='http://fonts.googleapis.com/css?family=Fjalla+One' rel='stylesheet' type='text/css'>
</head>

<body>
<!-- Navigation -->
<nav class="navbar navbar-default navbar-fixed-top" id="total-navbar">
<div class="container">
<!-- Brand and toggle -->
<div class="navbar-header page-scroll">
<button type="button" class="navbar-toggle" data-toggle="collapse" data-target="#go-bike-navbar">
<span class="sr-only">Toggle navigation</span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</button>
<a class="navbar-brand" href="index.html">
{% image '@EzTutorialBikeBundle/Resources/images/128_bike_white_avenir.png' %}
<img src="{{ asset_url }}" alt="Logo"/>
{% endimage %}
</a>
</div>
{{ include('EzTutorialBikeBundle::navigation.html.twig') }}
{{ include('EzTutorialBikeBundle::header.html.twig') }}

<!-- nav links -->
<div id="go-bike-navbar" class="navbar-collapse collapse">
<ul class="nav navbar-nav">
<li><a href="#">ALL RIDES</a></li>
</ul>
</div>
<!--/.nav-collapse -->
</div>
<!-- /.container -->
</nav>

<!-- Header -->
<header class="below-navbar">
<div class="container">
<div class="row" id="banner">
<div class="col-md-12">
<div class="banner-header-block">
{% image '@EzTutorialBikeBundle/Resources/images/logo_just_letters.png' %}
<img src="{{ asset_url }}" alt="Logo just letters" style="width: 100%;"/>
{% endimage %}
<h3 class="banner-header">Discover new rides! Go Bike!</h3>
</div>
</div>
</div>
</div>
</header>

<section class="buttons">
<div class="container">
Expand All @@ -79,9 +35,9 @@
<thead>
<tr class="table-header">
<th>{% image '@EzTutorialBikeBundle/Resources/images/3.jpg' %}
<img src="{{ asset_url }}" alt="3" class="img-rounded"
style="width: 20%;"/>
{% endimage %}</th>
<img src="{{ asset_url }}" alt="3" class="img-rounded"
style="width: 20%;"/>
{% endimage %}</th>
<th>Name</th>
<th>Starting Point</th>
<th>Length</th>
Expand All @@ -90,15 +46,12 @@
</thead>
<tbody>
{% for ride in rideList %}
<tr>
<td colspan="2">
<strong><a href="{{ ride.id }}/ride_view.html"
target="_self">{{ ride.title }} </a></strong>
</td>
<td>{{ ride.starting_point }}</td>
<td>{{ ride.length }} Km</td>
<td>{{ ride.difficulty }}<i class="fa fa-star star-color"></i></td>
</tr>
{#{{ ez_render_field( #}
{#ride, #}
{#'ride',#}
{#{ 'template': 'EzTutorialBikeBundle:line:ride.html.twig' }#}
{#) }}#}
{{ include('EzTutorialBikeBundle:line:ride.html.twig') }}
{% endfor %}
</tbody>
</table>
Expand All @@ -107,46 +60,7 @@
</div>
</section>

<!-- Footer -->
<footer class="text-center">
<div class="footer-color-one">
<div class="container">
<div class="col-xs-10 col-xs-offset-1 text-center" id="intouch">

</div>
</div>
</div>
<div class="footer-color-two">
<div class="container">
<div class="row regular-content-size">
<div class="col-md-8 col-md-offset-2 footer-links-block">
<ul class="list-inline footer-links">
<li><a href="#">About Us</a></li>
<li><a href="map.html">All Rides</a></li>
</ul>
</div>
<div class="col-md-8 col-md-offset-2 footer-links-block">
<ul class="list-inline footer-links">
<li><a href="#">Contact Us</a></li>
<li><a href="#">My Account</a></li>
<li><a href="#">Language</a></li>
<li><a href="#">Support</a></li>
</ul>
</div>
</div>
</div>
</div>
<div class="footer-color-three">
<div class="container">
<div class="row">
<div class="col-md-12">
<p class="small">Website design &#38; content © copyright 2015 eZ Systems. This website was made
with eZ Platform</p>
</div>
</div>
</div>
</div>
</footer>

{{ include('EzTutorialBikeBundle::footer.html.twig') }}
{{ include('EzTutorialBikeBundle::page_javascript.html.twig') }}
</body>
</html>
41 changes: 41 additions & 0 deletions src/EzTutorial/BikeBundle/Resources/views/footer.html.twig
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
<!-- Footer -->
<footer class="text-center">
<div class="footer-color-one">
<div class="container">
<div class="col-xs-10 col-xs-offset-1 text-center" id="intouch">

</div>
</div>
</div>
<div class="footer-color-two">
<div class="container">
<div class="row regular-content-size">
<div class="col-md-8 col-md-offset-2 footer-links-block">
<ul class="list-inline footer-links">
<li><a href="#">About Us</a></li>
<li><a href="index.html">All Rides</a></li>
<li><a href="#">Submit a Ride</a></li>
<li><a href="#">FAQ</a></li>
</ul>
</div>
<div class="col-md-8 col-md-offset-2 footer-links-block">
<ul class="list-inline footer-links">
<li><a href="#">Contact Us</a></li>
<li><a href="#">Language</a></li>
<li><a href="#">Support</a></li>
</ul>
</div>
</div>
</div>
</div>
<div class="footer-color-three">
<div class="container">
<div class="row">
<div class="col-md-12">
<p class="small">Website design &#38; content © copyright 2015 eZ Systems. This website was made
with eZ Platform</p>
</div>
</div>
</div>
</div>
</footer>
Loading