mirror of
https://github.com/Sylius/Sylius.git
synced 2026-07-14 09:02:12 +00:00
default interface made with Twitter Bootstrap and initial translations.
This commit is contained in:
parent
a5b50df32f
commit
99482b46b0
9 changed files with 204 additions and 224 deletions
|
|
@ -1,157 +0,0 @@
|
|||
SyliusAddressingBundle documentation.
|
||||
=====================================
|
||||
|
||||
This bundle provides models and interfaces for managing addresses in Symfony2 applications.
|
||||
|
||||
**Note!** This documentation is inspired by [FOSUserBundle docs](https://github.com/FriendsOfSymfony/FOSUserBundle/blob/master/Resources/doc/index.md).
|
||||
|
||||
Installation.
|
||||
-------------
|
||||
|
||||
+ Installing dependencies.
|
||||
+ Downloading the bundle.
|
||||
+ Autoloader configuration.
|
||||
+ Adding bundle to kernel.
|
||||
+ Creating your Address class.
|
||||
+ DIC configuration.
|
||||
+ Importing routing cfgs.
|
||||
+ Updating database schema.
|
||||
|
||||
### Installing dependencies.
|
||||
|
||||
This bundle uses Pagerfanta library and PagerfantaBundle.
|
||||
The installation guide can be found [here](https://github.com/whiteoctober/WhiteOctoberPagerfantaBundle).
|
||||
|
||||
### Downloading the bundle.
|
||||
|
||||
The good practice is to download the bundle to the `vendor/bundles/Sylius/Bundle/AddressingBundle` directory.
|
||||
|
||||
This can be done in several ways, depending on your preference. The first
|
||||
method is the standard Symfony2 method.
|
||||
|
||||
**Using the vendors script.**
|
||||
|
||||
Add the following lines in your `deps` file...
|
||||
|
||||
```
|
||||
[SyliusAddressingBundle]
|
||||
git=git://github.com/Sylius/SyliusAddressingBundle.git
|
||||
target=bundles/Sylius/Bundle/AddressingBundle
|
||||
```
|
||||
|
||||
Now, run the vendors script to download the bundle.
|
||||
|
||||
``` bash
|
||||
$ php bin/vendors install
|
||||
```
|
||||
|
||||
**Using submodules.**
|
||||
|
||||
If you prefer instead to use git submodules, the run the following:
|
||||
|
||||
``` bash
|
||||
$ git submodule add git://github.com/Sylius/SyliusAddressingBundle.git vendor/bundles/Sylius/Bundle/AssortmentBundle
|
||||
$ git submodule update --init
|
||||
```
|
||||
|
||||
### Autoloader configuration.
|
||||
|
||||
Add the `Sylius\Bundle` namespace to your autoloader.
|
||||
|
||||
``` php
|
||||
<?php
|
||||
// app/autoload.php
|
||||
|
||||
$loader->registerNamespaces(array(
|
||||
// ...
|
||||
'Sylius\\Bundle' => __DIR__.'/../vendor/bundles',
|
||||
));
|
||||
```
|
||||
|
||||
### Adding bundle to kernel.
|
||||
|
||||
Finally, enable the bundle in the kernel.
|
||||
|
||||
``` php
|
||||
<?php
|
||||
// app/AppKernel.php
|
||||
|
||||
public function registerBundles()
|
||||
{
|
||||
$bundles = array(
|
||||
// ...
|
||||
new Sylius\Bundle\AddressingBundle\SyliusAddressingBundle(),
|
||||
);
|
||||
}
|
||||
```
|
||||
### Creating your address class or using the standard one.
|
||||
|
||||
If you want to use the default address object skip this step.
|
||||
Creating your own address class is pretty simple!
|
||||
|
||||
``` php
|
||||
<?php
|
||||
// src/Application/Bundle/AddressingBundle/Entity/Address.php
|
||||
|
||||
namespace Application\Bundle\AddressingBundle\Entity;
|
||||
|
||||
use Sylius\Bundle\AddressingBundle\Entity\Address as BaseAddress;
|
||||
use Doctrine\ORM\Mapping as ORM;
|
||||
|
||||
/**
|
||||
* @ORM\Entity
|
||||
* @ORM\Table(name="sylius_addressing_address")
|
||||
*/
|
||||
class Address extends BaseAddress
|
||||
{
|
||||
/**
|
||||
* @ORM\Id
|
||||
* @ORM\Column(type="integer")
|
||||
* @ORM\GeneratedValue(strategy="AUTO")
|
||||
*/
|
||||
protected $id;
|
||||
}
|
||||
```
|
||||
|
||||
### Container configuration.
|
||||
|
||||
Now you have to do the minimal configuration, no worries, it is not painful.
|
||||
|
||||
Open up your `config.yml` file and add this...
|
||||
|
||||
``` yaml
|
||||
sylius_addressing:
|
||||
driver: ORM
|
||||
classes:
|
||||
model:
|
||||
address: Application\Bundle\AddressingBundle\Entity\Address
|
||||
```
|
||||
|
||||
`Please note, that the "ORM" is currently the only supported driver.`
|
||||
|
||||
### Import routing files.
|
||||
|
||||
Now is the time to import routing files. Open up your `routing.yml` file. Customize the prefixes or whatever you want.
|
||||
|
||||
``` yaml
|
||||
sylius_addressing_backend_address:
|
||||
resource: "@SyliusAddressingBundle/Resources/config/routing/backend/address.yml"
|
||||
prefix: /administration
|
||||
```
|
||||
|
||||
### Updating database schema.
|
||||
|
||||
The last thing you need to do is updating the database schema.
|
||||
|
||||
For "ORM" driver run the following command.
|
||||
|
||||
``` bash
|
||||
$ php app/console doctrine:schema:update --force
|
||||
```
|
||||
|
||||
### Finish.
|
||||
|
||||
That is all, I hope it was not so bad.
|
||||
Now you can visit `/administration/addresses` to see the list of addresses.
|
||||
|
||||
`This documentation is under construction.`
|
||||
|
|
@ -0,0 +1,24 @@
|
|||
# This file is part of the Sylius package.
|
||||
# (c) Paweł Jędrzejewski
|
||||
|
||||
show: details
|
||||
create: create
|
||||
update: update
|
||||
delete: delete
|
||||
list: list
|
||||
save: save changes
|
||||
|
||||
address:
|
||||
show: Address details
|
||||
create: Create address
|
||||
update: Update address
|
||||
delete: Delete address
|
||||
list: List adresses
|
||||
|
||||
header:
|
||||
show: Address details
|
||||
create: Create new address
|
||||
update: Update existing address
|
||||
list: List addresses <small>All registered addresses in database</small>
|
||||
|
||||
list.empty: There are no addresses to display
|
||||
|
|
@ -0,0 +1,24 @@
|
|||
# This file is part of the Sylius package.
|
||||
# (c) Paweł Jędrzejewski
|
||||
|
||||
show: szczegóły
|
||||
create: stwórz
|
||||
update: edytuj
|
||||
delete: usuń
|
||||
list: lista
|
||||
save: zapisz zmiany
|
||||
|
||||
address:
|
||||
show: Szczegóły adresu
|
||||
create: Stwórz adres
|
||||
update: Edytuj adres
|
||||
delete: Usuń adres
|
||||
list: Lista adressów
|
||||
|
||||
header:
|
||||
show: Szczegóły adresu
|
||||
create: Stwórz nowy adres
|
||||
update: Edytuj istniejący adres
|
||||
list: Lista adresów <small>Wszystkie adresy w bazie danych</small>
|
||||
|
||||
list.empty: Brak adresów do wyświetlenia
|
||||
|
|
@ -1,15 +1,17 @@
|
|||
{% extends 'SyliusAddressingBundle:Backend:layout.html.twig' %}
|
||||
{% extends 'SyliusAddressingBundle::layout.html.twig' %}
|
||||
|
||||
{% block content %}
|
||||
|
||||
<h2>creating new address...</h2>
|
||||
<div class="page-header">
|
||||
<h1>{{ "header.create" | trans({}, 'SyliusAddressingBundle') }}</h1>
|
||||
</div>
|
||||
|
||||
<form action="{{ path('sylius_addressing_backend_address_create') }}" method="post">
|
||||
|
||||
{{ form_widget(form) }}
|
||||
|
||||
<input type="submit" value="create address" />
|
||||
<div class="actions">
|
||||
<input type="submit" value="{{ "create" | trans({}, 'SyliusAddressingBundle') }}" class="btn primary large" />
|
||||
</div>
|
||||
|
||||
</form>
|
||||
|
||||
{% endblock content %}
|
||||
{% endblock %}
|
||||
|
|
|
|||
|
|
@ -1,27 +1,51 @@
|
|||
{% extends 'SyliusAddressingBundle:Backend:layout.html.twig' %}
|
||||
{% extends 'SyliusAddressingBundle::layout.html.twig' %}
|
||||
|
||||
{% block content %}
|
||||
|
||||
<h2>addresses list.</h2>
|
||||
<div class="page-header">
|
||||
<h1>{{ "header.list" | trans({}, 'SyliusAddressingBundle') | raw }}</h1>
|
||||
</div>
|
||||
|
||||
{% for address in addresses %}
|
||||
<div class="well">
|
||||
<a href="{{ path('sylius_addressing_backend_address_create') }}" class="btn primary large">{{ "address.create" | trans({}, 'SyliusAddressingBundle') }}</a>
|
||||
</div>
|
||||
|
||||
id: {{ address.id }} <br />
|
||||
name: {{ address.name }} <br />
|
||||
surname: {{ address.surname }} <br />
|
||||
city: {{ address.city }} <br />
|
||||
postcode: {{ address.postcode }} <br />
|
||||
street: {{ address.street }} <br />
|
||||
|
||||
<ul>
|
||||
<li><a href="{{ path('sylius_addressing_backend_address_show', {'id': address.id}) }}">details</a></li>
|
||||
<li><a href="{{ path('sylius_addressing_backend_address_update', {'id': address.id}) }}">edit</a></li>
|
||||
<li><a href="{{ path('sylius_addressing_backend_address_delete', {'id': address.id}) }}">delete</a></li>
|
||||
</ul>
|
||||
{% if paginator.haveToPaginate() %}
|
||||
{{ pagerfanta(paginator, 'twitter_bootstrap_translated') }}
|
||||
{% endif %}
|
||||
|
||||
{% endfor %}
|
||||
{% if addresses %}
|
||||
<table class="zebra-stripped">
|
||||
<thead>
|
||||
<tr>
|
||||
<th><a href="{{ path('sylius_addressing_backend_address_list', {'sort': 'id', 'order': sorter.order}) }}">#id</a></th>
|
||||
<th></th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
{% for address in addresses %}
|
||||
<tr>
|
||||
<td>{{ address.id }}</td>
|
||||
<td><a href="mailto:{{ address.email }}">{{ address.email }}</a></td>
|
||||
<td>
|
||||
<div class="pull-right">
|
||||
<a href="{{ path('sylius_addressing_backend_address_show', {'id': address.id}) }}" class="btn">{{ "show" | trans({}, 'SyliusAddressingBundle') }}</a>
|
||||
<a href="{{ path('sylius_addressing_backend_address_update', {'id': address.id}) }}" class="btn">{{ "update" | trans({}, 'SyliusAddressingBundle') }}</a>
|
||||
<a href="{{ path('sylius_addressing_backend_address_delete', {'id': address.id}) }}" class="btn danger">{{ "delete" | trans({}, 'SyliusAddressingBundle') }}</a>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
{% endfor %}
|
||||
</tbody>
|
||||
</table>
|
||||
{% else %}
|
||||
<div class="alert-message info">
|
||||
<p>{{ "list.empty" | trans({}, 'SyliusAddressingBundle') }}</p>
|
||||
</div>
|
||||
{% endif %}
|
||||
|
||||
<br /> <br />
|
||||
{{ pagerfanta(paginator, 'default') }}
|
||||
{% if paginator.haveToPaginate() %}
|
||||
{{ pagerfanta(paginator, 'twitter_bootstrap_translated') }}
|
||||
{% endif %}
|
||||
|
||||
{% endblock %}
|
||||
|
|
|
|||
|
|
@ -1,19 +1,27 @@
|
|||
{% extends 'SyliusAddressingBundle:Backend:layout.html.twig' %}
|
||||
{% extends 'SyliusAddressingBundle::layout.html.twig' %}
|
||||
|
||||
{% block content %}
|
||||
|
||||
<h2>address details.</h2>
|
||||
<div class="page-header">
|
||||
<h1>{{ "header.show" | trans({}, 'SyliusAddressingBundle') | raw }}</h1>
|
||||
</div>
|
||||
|
||||
id: {{ address.id }} <br />
|
||||
name: {{ address.name }} <br />
|
||||
surname: {{ address.surname }} <br />
|
||||
city: {{ address.city }} <br />
|
||||
postcode: {{ address.postcode }} <br />
|
||||
street: {{ address.street }} <br />
|
||||
<div class="well">
|
||||
<a href="{{ path('sylius_addressing_backend_address_update', {'id': address.id}) }}" class="btn">{{ "update" | trans({}, 'SyliusAddressingBundle') }}</a>
|
||||
<a href="{{ path('sylius_addressing_backend_address_delete', {'id': address.id}) }}" class="btn danger">{{ "delete" | trans({}, 'SyliusAddressingBundle') }}</a>
|
||||
</div>
|
||||
|
||||
<ul>
|
||||
<li><a href="{{ path('sylius_addressing_backend_address_update', {'id': address.id}) }}">edit</a></li>
|
||||
<li><a href="{{ path('sylius_addressing_backend_address_delete', {'id': address.id}) }}">delete</a></li>
|
||||
</ul>
|
||||
<table class="bordered-table">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>#id</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<tr>
|
||||
<td>{{ address.id }}</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
|
||||
{% endblock %}
|
||||
|
|
|
|||
|
|
@ -1,15 +1,17 @@
|
|||
{% extends 'SyliusAddressingBundle:Backend:layout.html.twig' %}
|
||||
{% extends 'SandboxCoreBundle:Backend:layout.html.twig' %}
|
||||
|
||||
{% block content %}
|
||||
|
||||
<h2>updating address...</h2>
|
||||
<div class="page-header">
|
||||
<h1>{{ "header.update" | trans({}, 'SyliusAddressingBundle') }}</h1>
|
||||
</div>
|
||||
|
||||
<form action="{{ path('sylius_addressing_backend_address_update', {'id': address.id}) }}" method="post">
|
||||
|
||||
{{ form_widget(form) }}
|
||||
|
||||
<input type="submit" value="update address" />
|
||||
<div class="actions">
|
||||
<input type="submit" value="{{ "save" | trans({}, 'SyliusAddressingBundle') }}" class="btn primary large" />
|
||||
</div>
|
||||
|
||||
</form>
|
||||
|
||||
{% endblock content %}
|
||||
{% endblock %}
|
||||
|
|
|
|||
|
|
@ -1,25 +0,0 @@
|
|||
<!doctype html>
|
||||
|
||||
<head>
|
||||
|
||||
<title> Sylius e-commerce platform administration. </title>
|
||||
<meta charset="utf-8">
|
||||
|
||||
</head>
|
||||
|
||||
<body>
|
||||
|
||||
<h1>backend.</h1>
|
||||
|
||||
<ul>
|
||||
<li><a href="{{ path('sylius_addressing_backend_address_list') }}">list addresses</a></li>
|
||||
<li><a href="{{ path('sylius_addressing_backend_address_create') }}">create address</a></li>
|
||||
</ul>
|
||||
|
||||
{% block content %}
|
||||
|
||||
{% endblock %}
|
||||
|
||||
</body>
|
||||
|
||||
</html>
|
||||
|
|
@ -0,0 +1,78 @@
|
|||
<!DOCTYPE html>
|
||||
|
||||
<html>
|
||||
<head>
|
||||
<title>{% block title %} Sylius administration. {% endblock %}</title>
|
||||
<meta charset="UTF-8">
|
||||
|
||||
<!-- Le HTML5 shim, for IE6-8 support of HTML elements -->
|
||||
<!--[if lt IE 9]>
|
||||
<script src="http://html5shim.googlecode.com/svn/trunk/html5.js"></script>
|
||||
<![endif]-->
|
||||
|
||||
<link rel="stylesheet" href="http://twitter.github.com/bootstrap/1.4.0/bootstrap.min.css">
|
||||
|
||||
<style type="text/css">
|
||||
html, body {
|
||||
background-color: #eee;
|
||||
}
|
||||
|
||||
body {
|
||||
padding-top: 40px;
|
||||
}
|
||||
|
||||
.content {
|
||||
background-color: #fff;
|
||||
padding: 20px;
|
||||
margin: 0 -20px;
|
||||
-webkit-border-radius: 0 0 0 6px;
|
||||
-moz-border-radius: 0 0 0 6px;
|
||||
border-radius: 0 0 0 6px;
|
||||
-webkit-box-shadow: 0 1px 2px rgba(0,0,0,.15);
|
||||
-moz-box-shadow: 0 1px 2px rgba(0,0,0,.15);
|
||||
box-shadow: 0 1px 2px rgba(0,0,0,.15);
|
||||
}
|
||||
|
||||
.page-header {
|
||||
background-color: #f5f5f5;
|
||||
padding: 20px 20px 10px;
|
||||
margin: -20px -20px 20px;
|
||||
}
|
||||
|
||||
th {
|
||||
background-color: #f5f5f5;
|
||||
}
|
||||
|
||||
fieldset div {
|
||||
margin-bottom: 10px;
|
||||
}
|
||||
|
||||
label {
|
||||
margin-right: 10px;
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<div class="topbar">
|
||||
<div class="topbar-inner">
|
||||
<div class="container-fluid">
|
||||
<a class="brand" href="http://sylius.org">Sylius.org</a>
|
||||
<ul class="nav">
|
||||
<li><a href="{{ path('sylius_addressing_backend_address_list') }}">{{ "address.list" | trans({}, 'SyliusAddressingBundle') }}</a></li>
|
||||
<li><a href="{{ path('sylius_addressing_backend_address_create') }}">{{ "address.create" | trans({}, 'SyliusAddressingBundle') }}</a></li>
|
||||
<li><a href="http://github.com/Sylius">find us at <strong>@github</strong></a></li>
|
||||
<li><a href="http://twitter.com/_Sylius">or at <strong>@twitter</strong></a></li>
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="container-fluid">
|
||||
<div class="content">
|
||||
{% block content %} {% endblock %}
|
||||
<footer>
|
||||
<p>© <a href="http://sylius.org">Sylius</a>, 2011.</p>
|
||||
</footer>
|
||||
</div>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
Loading…
Add table
Reference in a new issue