Skip to content

Commit

Permalink
Primera importación
Browse files Browse the repository at this point in the history
  • Loading branch information
javiereguiluz committed Oct 3, 2011
0 parents commit 7525021
Show file tree
Hide file tree
Showing 190 changed files with 10,853 additions and 0 deletions.
14 changes: 14 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
app/bootstrap.php.cache
app/bootstrap_cache.php.cache
app/phpunit.xml
app/cache/*
app/logs/*

vendor/*
!vendor/bundles/Cupon/
!vendor/bundles/Cupon/*

web/bundles/*
web/uploads/*
web/css/*
web/js/*
26 changes: 26 additions & 0 deletions LICENSE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
# License #

* Application Code: Copyright (c) 2011 Javier Eguiluz <[email protected]>
* Symfony and other libraries: see their own license files
* Product sample photos: Copyright http://www.sxc.hu/ See details: http://www.sxc.hu/help/7_2

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software to deal in the software without restriction, subject to the
following conditions:

1. This copyright notice and this LICENSE file shall be included in all copies
or substantial portions of the software.
2. You must publish your work as open source.

# Licencia #

* Application Code: Copyright (c) 2011 Javier Eguiluz <[email protected]>
* Symfony y otras herramientas y librerías: consulta la licencia que se distribuye con cada una
* Fotos de prueba de los productos: Copyright http://www.sxc.hu/ Detalles: http://www.sxc.hu/help/7_2

Se concede permiso para que cualquier persona utilice este software para cualquier
fin y sin ninguna restricción, siempre que cumpla las dos siguientes condiciones:

1. Se debe incluir este aviso de copyright y este archivo de licencia en todas las
copias o porciones significativas del software.
2. Debes publicar tu trabajo como software libre.
108 changes: 108 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,108 @@
# Cupon sample application #

Cupon is a sample application designed to learn Symfony2 development. It's a Groupon inspired clone, hence its name. Cupon application is explained in the upcoming book about Symfony2 written by Javier Eguiluz from [symfony.es](http://symfony.es).

If you find a bug, please fill in a bug report in the Github issues page.

## How to install ##

1. `mkdir cupon`
2. `git clone [email protected]:javiereguiluz/Cupon.git cupon`
3. `cd cupon`
4. `php bin/vendors install`
5. `chmod -R 777 app/cache app/logs`
5. Configure your web server

## How to use ##

Before trying the application:

1. Load data fixtures: `php app/console doctrine:fixtures:load`
2. Dump web assets with Assetic: `php app/console assetic:dump --env=prod --no-debug`

In case of error, don't forget to clear de cache:

* Development environment: `php app/console cache:clear`
* Production environment: `php app/console cache:clear --env=prod`

### Frontend ###

* URL:
* Development environment: `http://cupon/app_dev.php`
* Production environment: `http://cupon/app.php`
* User credentials:
* Login: `usuarioN@localhost` being `N` an integer ranging from `1` to `500`
* Password: `usuarioN` being `N` the number used in login

### Extranet ###

* URL:
* Development environment: `http://cupon/app_dev.php/extranet`
* Production environment: `http://cupon/app.php/extranet`
* User credentials:
* Login: `tiendaN` being `N` an integer ranging from `1` to `80` approximately (the upper bound is randomly generated)
* Password: same as login

### Backend ###

* URL:
* Development environment: `http://cupon/app_dev.php/backend`
* Production environment: `http://cupon/app.php/backend`
* User credentials:
* Login: `admin`
* Password: `1234`

# Aplicación de prueba Cupon #

Cupon es una aplicación de prueba desarrollada para aprender a programar con Symfony2. Se trata de un clon simplificado de Groupon, de ahí el nombre. Esta aplicación es la base del próximo libro sobre Symfony2 que publicará Javier Eguiluz.

Si descubres algún error, por favor utiliza la página de issues de Github para avisarnos.

## Instalación ##

1. `mkdir cupon`
2. `git clone [email protected]:javiereguiluz/Cupon.git cupon`
3. `cd cupon`
4. `php bin/vendors install`
5. `chmod -R 777 app/cache app/logs`
5. Configura bien tu servidor web

## Uso ##

Para poder probar bien la aplicación:

1. Carga los datos de pruebas con el siguiente comando: `php app/console doctrine:fixtures:load`
2. Genera los web assets con Assetic: `php app/console assetic:dump --env=prod --no-debug`

Si tienes algún problema, limpia la cache:

* Entorno de desarrollo: `php app/console cache:clear`
* Entorno de producción: `php app/console cache:clear --env=prod`

### Frontend ###

* URL:
* Entorno de desarrollo: `http://cupon/app_dev.php`
* Entorno de producción: `http://cupon/app.php`
* Credenciales de usuarios:
* Nombre de usuario: `usuarioN@localhost` siendo `N` un número entre `1` y `500`
* Contraseña: `usuarioN` siendo `N` el mismo valor que el del nombre de usuario

### Extranet ###

* URL:
* Entorno de desarrollo: `http://cupon/app_dev.php/extranet`
* Entorno de producción: `http://cupon/app.php/extranet`
* Credenciales de usuarios:
* Nombre de usuario: `tiendaN` siendo `N` un número entre `1` y `80` aproximadamente (el límite superior es aleatorio)
* Contraseña: la misma que el nombre de usuario

### Backend ###

* URL:
* Entorno de desarrollo: `http://cupon/app_dev.php/backend`
* Entorno de producción: `http://cupon/app.php/backend`
* Credenciales de usuarios:
* Nombre de usuario: `admin`
* Contraseña: `1234`

1 change: 1 addition & 0 deletions app/.htaccess
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
deny from all
21 changes: 21 additions & 0 deletions app/AppCache.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
<?php

require_once __DIR__.'/AppKernel.php';

use Symfony\Bundle\FrameworkBundle\HttpCache\HttpCache;

class AppCache extends HttpCache
{
protected function getOptions()
{
return array(
'debug' => true,
'default_ttl' => 600,
'private_headers' => array('Authorization', 'Cookie'),
'allow_reload' => false,
'allow_revalidate' => false,
'stale_while_revalidate' => 2,
'stale_if_error' => 60,
);
}
}
46 changes: 46 additions & 0 deletions app/AppKernel.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
<?php

use Symfony\Component\HttpKernel\Kernel;
use Symfony\Component\Config\Loader\LoaderInterface;

class AppKernel extends Kernel
{
public function registerBundles()
{
$bundles = array(
new Symfony\Bundle\FrameworkBundle\FrameworkBundle(),
new Symfony\Bundle\SecurityBundle\SecurityBundle(),
new Symfony\Bundle\TwigBundle\TwigBundle(),
new Symfony\Bundle\MonologBundle\MonologBundle(),
new Symfony\Bundle\SwiftmailerBundle\SwiftmailerBundle(),
new Symfony\Bundle\DoctrineBundle\DoctrineBundle(),
new Symfony\Bundle\AsseticBundle\AsseticBundle(),
new Sensio\Bundle\FrameworkExtraBundle\SensioFrameworkExtraBundle(),
new JMS\SecurityExtraBundle\JMSSecurityExtraBundle(),
new Symfony\Bundle\DoctrineFixturesBundle\DoctrineFixturesBundle(),

new Cupon\CiudadBundle\CiudadBundle(),
new Cupon\UsuarioBundle\UsuarioBundle(),
new Cupon\TiendaBundle\TiendaBundle(),
new Cupon\OfertaBundle\OfertaBundle(),
new Cupon\BackendBundle\BackendBundle(),

new Cupon\ComunBundle\CuponComunBundle(),

new Ideup\SimplePaginatorBundle\IdeupSimplePaginatorBundle(),
);

if (in_array($this->getEnvironment(), array('dev', 'test'))) {
$bundles[] = new Symfony\Bundle\WebProfilerBundle\WebProfilerBundle();
$bundles[] = new Sensio\Bundle\DistributionBundle\SensioDistributionBundle();
$bundles[] = new Sensio\Bundle\GeneratorBundle\SensioGeneratorBundle();
}

return $bundles;
}

public function registerContainerConfiguration(LoaderInterface $loader)
{
$loader->load(__DIR__.'/config/config_'.$this->getEnvironment().'.yml');
}
}
19 changes: 19 additions & 0 deletions app/Resources/TwigBundle/views/Exception/error404.html.twig
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
{% extends '::frontend.html.twig' %}

{% block title %}Se ha producido un error{% endblock %}
{% block id 'error' %}

{% block article %}
{% if exception.message %}
<h1>{{ exception.message }}</h1>
{% else %}
<h1>No se ha encontrado la página solicitada <span>(error 404)</span></h1>
{% endif %}

<p>La mayoría de errores son temporales, provocados por pequeños cambios y actualizaciones del sitio web.</p>

<p>Prueba a actualizar la página dentro de unos instantes y seguramente podrás acceder a la página solicitada. Si el error persiste, te agradeceríamos que nos avisaras en la dirección [email protected]</p>
{% endblock %}

{% block aside %}
{% endblock %}
15 changes: 15 additions & 0 deletions app/Resources/TwigBundle/views/Exception/error500.html.twig
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
{% extends '::frontend.html.twig' %}

{% block title %}Se ha producido un error{% endblock %}
{% block id 'error' %}

{% block article %}
<h1>Se ha producido un error grave <span>(error 500)</span></h1>

<p>La mayoría de errores son temporales, provocados por pequeños cambios y actualizaciones del sitio web.</p>

<p>Prueba a actualizar la página dentro de unos instantes y seguramente podrás acceder a la página solicitada. Si el error persiste, te agradeceríamos que nos avisaras en la dirección [email protected]</p>
{% endblock %}

{% block aside %}
{% endblock %}
Binary file added app/Resources/java/yuicompressor-2.4.6.jar
Binary file not shown.
32 changes: 32 additions & 0 deletions app/Resources/views/backend.html.twig
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
{% extends '::base.html.twig' %}

{% block stylesheets %}
{% stylesheets '@OfertaBundle/Resources/public/css/normalizar.css'
'@OfertaBundle/Resources/public/css/comun.css'
'@BackendBundle/Resources/public/css/backend.css'
output='css/backend.css' %}
<link href="{{ asset_url }}" rel="stylesheet" type="text/css" />
{% endstylesheets %}
{% endblock %}

{% block body %}
<header>
<h1><a href="{{ path('backend_portada') }}">CUPON ADMIN</a></h1>
<nav>
<ul>
<li><a href="{{ path('backend_oferta') }}">Ofertas</a></li>
<li><a href="{{ path('backend_tienda') }}">Tiendas</a></li>
<li><a href="{{ path('backend_usuario') }}">Usuarios</a></li>
<li><a href="{{ path('backend_ciudad') }}">Ciudades</a></li>

<li>{% render "CiudadBundle:Default:listaCiudades" with { 'ciudad': app.session.get('ciudad') } %}</li>
</ul>
</nav>
</header>

{% include ':includes:flashes.html.twig' %}

<article>
{% block article %}{% endblock %}
</article>
{% endblock %}
36 changes: 36 additions & 0 deletions app/Resources/views/base.html.twig
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
<!DOCTYPE html>
<html>

<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>{% block title %}{% endblock %} | Cupon</title>
{% block stylesheets %}{% endblock %}
{% block rss %}{% endblock %}
<link rel="shortcut icon" href="{{ asset('favicon.png') }}" />

</head>

<body id="{% block id '' %}"><div id="contenedor">
{% block body %}{% endblock %}

<footer>
&copy; {{ 'now'|date('Y') }} - Cupon
<a href="{{ path('estatica', { 'pagina': 'ayuda' }) }}">{{ "Ayuda" | trans }}</a>
<a href="{{ path('contacto') }}">{{ "Contacto" | trans }}</a>
<a href="{{ path('estatica', { 'pagina': 'privacidad' }) }}">{{ "Privacidad" | trans }}</a>
<a href="{{ path('estatica', { 'pagina': 'sobre-nosotros' }) }}">{{ "Sobre nosotros" | trans }}</a>

{% set locale = app.request.get('_locale') %}
<section id="idioma">
{% if locale == 'es' %}
<span>Español</span> - <a href="{{ path('portada', { '_locale': 'en' }) }}">English</a>
{% elseif locale == 'en' %}
<a href="{{ path('portada', { '_locale': 'es' }) }}">Español</a> - <span>English</span>
{% endif %}
</section>
</footer>

{% block javascripts %}{% endblock %}
</div></body>

</html>
22 changes: 22 additions & 0 deletions app/Resources/views/base.rss.twig
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
<?xml version="1.0"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">
<channel>
<title>{% block title %}Cupon{% endblock %}</title>

<link>{% block url %}{% endblock %}</link>

<description>{% block descripcion %}{% endblock %}</description>

<language>{{ app.request.session.locale }}</language>

<pubDate>{{ 'now'|date('r') }}</pubDate>

<lastBuildDate>{{ 'now'|date('r') }}</lastBuildDate>

<generator>Symfony2</generator>

<atom:link href="{% block self %}{% endblock %}" rel="self" type="application/rss+xml" />

{% block items %}{% endblock %}
</channel>
</rss>
Loading

0 comments on commit 7525021

Please sign in to comment.