Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

updated to beta 1 & some improvments

  • Loading branch information...
commit baf8aba7aafa58a7192e354c34aff709eff4ea23 1 parent 5c3aa8b
@carlossg00 authored
View
26 Admin/CategoryAdmin.php
@@ -0,0 +1,26 @@
+<?php
+
+//src/Application/Jobeet2Bundle/Admin/CategoryAdmin.php
+
+namespace Application\Jobeet2Bundle\Admin;
+
+use Sonata\AdminBundle\Admin\Admin;
+use Sonata\AdminBundle\Form\FormMapper;
+use Sonata\AdminBundle\Datagrid\DatagridMapper;
+use Sonata\AdminBundle\Datagrid\ListMapper;
+
+class CategoryAdmin extends Admin
+{
+ protected $list = array(
+ 'id' => array('identifier' => true),
+ 'name',
+ );
+
+ protected $form = array(
+ 'name',
+ );
+
+ protected $filter = array(
+ 'name',
+ );
+}
View
58 Admin/JobAdmin.php
@@ -0,0 +1,58 @@
+<?php
+
+//src/Application/Jobeet2Bundle/Admin/JobAdmin.php
+
+namespace Application\Jobeet2Bundle\Admin;
+
+use Sonata\AdminBundle\Admin\Admin;
+use Sonata\AdminBundle\Form\FormMapper;
+use Sonata\AdminBundle\Datagrid\DatagridMapper;
+use Sonata\AdminBundle\Datagrid\ListMapper;
+
+class JobAdmin extends Admin
+{
+ protected $list = array(
+ 'company' => array('identifier' => true),
+ 'position',
+ 'location',
+ 'is_activated',
+ 'email',
+ 'category',
+ 'expires_at',
+ '_action' => array(
+ 'actions' => array(
+ 'delete' => array(),
+ 'edit' => array(),
+ )
+ ),
+ );
+
+
+ protected $maxPerPage = 5;
+
+ protected $form = array(
+ 'category',
+ 'type',
+ 'company',
+ 'logo',
+ 'url',
+ 'position',
+ 'location',
+ 'description',
+ 'how_to_apply',
+ 'is_public',
+ 'email',
+ 'is_activated',
+ );
+
+ protected $filter = array(
+ 'category',
+ 'company',
+ 'position',
+ 'description',
+ 'is_activated',
+ 'is_public',
+ 'email',
+// 'expiresAt', #Bundle still without date filters
+ );
+}
View
11 Controller/CategoryAdminController.php
@@ -0,0 +1,11 @@
+<?php
+
+//src/Application/Jobeet2Bundle/Controller/JobAdminController.php
+
+namespace Application\Jobeet2Bundle\Controller;
+
+use Sonata\AdminBundle\Controller\CRUDController as Controller;
+
+class CategoryAdminController extends Controller
+{
+}
View
11 Controller/JobAdminController.php
@@ -0,0 +1,11 @@
+<?php
+
+//src/Application/Jobeet2Bundle/Controller/JobAdminController.php
+
+namespace Application\Jobeet2Bundle\Controller;
+
+use Sonata\AdminBundle\Controller\CRUDController as Controller;
+
+class JobAdminController extends Controller
+{
+}
View
115 Controller/JobController.php
@@ -5,7 +5,7 @@
use Application\Jobeet2Bundle\Entity\Job;
use Application\Jobeet2Bundle\Entity\User;
use Application\Jobeet2Bundle\Entity\Category;
-use Application\Jobeet2Bundle\Form\JobForm;
+use Application\Jobeet2Bundle\Form\JobType;
use Symfony\Component\DependencyInjection\ContainerAware;
use Doctrine\ORM\EntityRepository;
@@ -23,6 +23,7 @@ class JobController extends ContainerAware
private $repository;
private $router;
private $templating;
+ private $em;
/**
* Post Constructor.
@@ -36,6 +37,8 @@ public function __postConstruct()
$this->router = $this->container->get('router');
$this->repository = $this->container->get('jobeet2.job.repository');
$this->templating = $this->container->get('templating');
+ $this->em = $this->container->get('jobeet2.object_manager');
+ $this->active_days = $this->container->getParameter('jobeet2.active_days');
}
/**
@@ -64,7 +67,7 @@ public function listAction(Category $category = null, $max = 10)
/**
* Show deatiled job info
- * @param: slug
+ * @param: id
*/
public function showAction($id)
@@ -76,40 +79,116 @@ public function showAction($id)
throw new NotFoundHttpException('The Job does not exist.');
}
return $this->templating->renderResponse('Jobeet2Bundle:Job:show.html.twig',
- array('job'=>$job));
+ array('job'=>$job,
+ 'active_days' => $this->active_days));
}
-
- //TODO Refactor
- public function newAction()
+
+ public function deleteAction($id)
{
- /*return $this->templating->renderResponse('Jobeet2:Job:new.html.twig',
- array('form'=>$form));*/
-
+ $this->container->get('session')->setFlash('notice', 'Your changes were saved!');
+
+ $job = $this->repository->findOneById($id);
+
+ if (!$job) {
+ throw new NotFoundHttpException('The Job does not exist.');
+ }
+
+ $this->em->remove($job);
+ $this->em->flush();
+
+ return new RedirectResponse($this->router->generate('homepage'));
+
+ /*$httpKernel = $this->container->get('http_kernel');
+ return $httpKernel->forward('job.controller:listAction');*/
+
}
+ public function editAction($id = null)
+ {
+ if (isset($id)) {
+ $job = $this->repository->findOneById($id);
- public function deleteAction($id)
+ if (!$job) {
+ throw new NotFoundHttpException('The Job does not exist.');
+ }
+
+ } else {
+ $job = new Job();
+ }
+
+ $form = $this->container->get('form.factory')->create(new JobType($this->em),$job);
+
+ if ($this->request->getMethod() == 'POST') {
+
+ $form->bindRequest($this->request);
+
+ if ($form->isValid()) {
+ $this->em->persist($job);
+ $this->em->flush();
+
+ $httpKernel = $this->container->get('http_kernel');
+ return $httpKernel->forward('job.controller:showAction', array(
+ 'id' => $job->getID()
+ ));
+ }
+ }
+
+ return $this->templating->renderResponse('Jobeet2Bundle:Job:create.html.twig',
+ array('form' => $form->createView(),
+ ));
+ }
+
+ public function publishAction($id)
{
- $em = $this->getEm();
- $job = $em->find("Jobeet2Bundle:Job",$id);
+ $job = $this->repository->findOneById($id);
- if (!$this->job) {
+ if (!$job) {
throw new NotFoundHttpException('The Job does not exist.');
}
- $em->remove($job);
- $em->flush();
+ $job->setIsActivated(true);
+
+ $this->em->persist($job);
+ $this->em->flush();
- return new RedirectResponse($this->router->generate('index'));
+ $this->container->get('session')->setFlash('notice', "Your job is now online for $this->active_days days");
+ $httpKernel = $this->container->get('http_kernel');
+ return $httpKernel->forward('job.controller:showAction', array(
+ 'id' => $job->getID()
+ ));
+
+ return new RedirectResponse($this->router->generate('show',array('id'=>$job->getID(),
+ 'company' => $job->getCompanySlug(),
+ 'location' => $job->getLocationSlug(),
+ 'position' => $job->getPositionSlug())
+ ));
}
- public function editAction($id)
+ public function extendAction($id)
{
-
+ $job = $this->repository->findOneById($id);
+
+ if (!$job) {
+ throw new NotFoundHttpException('The Job does not exist.');
+ }
+
+ $str = sprintf('P%sD',$this->active_days);
+ $expirationDate = clone $job->getExpiresAt();
+ $job->setExpiresAt($expirationDate->add(new \DateInterval($str)));
+
+ $this->em->persist($job);
+ $this->em->flush();
+
+ return new RedirectResponse($this->router->generate('show',array('id'=>$job->getID(),
+ 'company' => $job->getCompanySlug(),
+ 'location' => $job->getLocationSlug(),
+ 'position' => $job->getPositionSlug())
+ ));
+
}
}
View
6 DataFixtures/ORM/data.php
@@ -45,7 +45,7 @@ public function load($manager)
$job1->setHowToApply("Send your resume to fabien.pontecier [at] sensio.com");
$job1->setIsActivated(true);
$job1->setIsPublic(true);
- $job1->setToken("job_sensio_labs");
+ $job1->set_Token("job_sensio_labs");
$job1->setEmail("job@example.com");
@@ -68,7 +68,7 @@ public function load($manager)
$job2->setHowToApply("Send your resume to fabien.pontecier [at] sensio.com");
$job2->setIsActivated(true);
$job2->setIsPublic(true);
- $job2->setToken("job_extreme_sensi");
+ $job2->set_Token("job_extreme_sensi");
$job2->setEmail("job@example.com");
@@ -104,7 +104,7 @@ public function load($manager)
$jobs[$i]->setHowToApply("Send your resume to lorem.ipsum [at] Company".$i);
$jobs[$i]->setIsActivated(true);
$jobs[$i]->setIsPublic(true);
- $jobs[$i]->setToken("job_".$i);
+ $jobs[$i]->set_Token("job_".$i);
$jobs[$i]->setEmail("job@example.com");
$manager->persist($jobs[$i]);
View
2  DependencyInjection/Jobeet2Extension.php
@@ -44,7 +44,7 @@ public function load(array $configs, ContainerBuilder $container)
$loader->load('model.xml');
$loader->load('orm.xml');
$loader->load('controller.xml');
- $loader->load('form.xml');
+ // $loader->load('form.xml');
}
public function getXsdValidationBasePath()
View
10 Entity/Category.php
@@ -200,6 +200,16 @@ function getSlug()
{
return $this->slug;
}
+
+ /**
+ * To String
+ *
+ * @return string
+ */
+ public function __toString()
+ {
+ return $this->name;
+ }
}
View
5 Entity/CategoryRepository.php
@@ -31,7 +31,10 @@ public function getWithJobs()
->innerJoin('c.job','j');
//TODO ActiveJobs
- return $qb->getQuery()->getResult();
+ return $this->_em->getRepository('Jobeet2Bundle:Job')->addActiveJobsQuery($qb)
+ ->getResult();
+
+ //return $qb->getQuery()->getResult();
}
View
66 Entity/Job.php
@@ -31,6 +31,7 @@ class Job
/**
* @var string $company
* @orm:Column(type="string", length=255)
+ * @assert:NotBlank()
*/
private $company;
@@ -49,18 +50,21 @@ class Job
/**
* @var string $position
* @orm:Column(type="string", length=255)
+ * @assert:NotNull()
*/
private $position;
/**
* @var string $location
* @orm:Column(type="string", length=255)
+ * @assert:NotNull()
*/
private $location;
/**
* @var string $description
* @orm:Column(type="string", length=255)
+ * @assert:NotNull()
*/
private $description;
@@ -74,7 +78,7 @@ class Job
* @var string $token
* @orm:Column(type="string", length=255, nullable=true)
*/
- private $token;
+ private $_token;
/**
* @var boolean $is_public
@@ -91,6 +95,7 @@ class Job
/**
* @var string $email
* @orm:Column(type="string", length=255, nullable=true)
+ * @assert:Email()
*/
private $email;
@@ -119,8 +124,9 @@ class Job
* owning Side
* @orm:ManyToOne(targetEntity="Category", inversedBy="job")
* @orm:JoinColumn(name="category_id", referencedColumnName="id")
- */
-
+ * @assert:Type(type="Application\Jobeet2Bundle\Entity\Category")
+ */
+
private $category;
/**
@@ -137,6 +143,9 @@ class Job
function __construct($active_days = 30)
{
$this->active_days = $active_days;
+ $this->type = 'full-time';
+ $this->is_public = true;
+ $this->is_activated = false;
}
/**
@@ -314,9 +323,9 @@ public function getHowToApply()
*
* @param string $token
*/
- public function setToken($token)
+ public function set_Token($token)
{
- $this->token = $token;
+ $this->_token = $token;
}
/**
@@ -324,9 +333,9 @@ public function setToken($token)
*
* @return string $token
*/
- public function getToken()
+ public function get_Token()
{
- return $this->token;
+ return $this->_token;
}
/**
@@ -515,6 +524,23 @@ function setActiveDays($active_days)
{
$this->active_days = $active_days;
}
+
+ public function isExpired()
+ {
+ return $this->getDaysBeforeExpires() < 0;
+ }
+
+ public function expiresSoon()
+ {
+ return $this->getDaysBeforeExpires() < 5;
+ }
+
+ public function getDaysBeforeExpires()
+ {
+ $interval = $this->expires_at->diff(new \DateTime('now'));
+ return $interval->format('%a');
+ }
+
/**
* @orm:PrePersist
@@ -522,11 +548,16 @@ function setActiveDays($active_days)
public function touchCreated()
{
-
- $this->createdAt = $this->updatedAt = new \DateTime();
+ $this->created_at = $this->updated_at = new \DateTime();
$str = sprintf('P%sD',$this->active_days);
- $date = new \DateTime('now');
- $this->setExpiresAt($date->add(new \DateInterval($str)));
+ $date = new \DateTime('now');
+ $this->setExpiresAt($date->add(new \DateInterval($str)));
+
+ //set token if not
+ if (!isset($this->_token))
+ {
+ $this->set_Token(sha1($this->getEmail().rand(11111,99999)));
+ }
}
/**
@@ -535,10 +566,15 @@ public function touchCreated()
public function touchUpdated()
{
- $this->updatedAt = new \DateTime();
- $str = sprintf('P%sD',$this->active_days);
- $date = new \DateTime('now');
- $this->setExpiresAt($date->add(new \DateInterval($str)));
+ $this->updated_at = new \DateTime('now');
}
+ static public function getJobTypes()
+ {
+ return array(
+ 'full-time' => 'Full time',
+ 'part-time' => 'Part time',
+ 'freelance' => 'Freelance',
+ );
+ }
}
View
4 Entity/JobRepository.php
@@ -54,10 +54,10 @@ public function addActiveJobsQuery(QueryBuilder $qb = null)
$qb = $this->createQueryBuilder('j')
->select('j');
}
- //TODO set date to 'now'
- $date = new \DateTime('2010-01-01');
+ $date = new \DateTime('now');
$qb->andWhere('j.expires_at > :date')
+ ->andWhere('j.is_activated = 1')
->addOrderBy('j.created_at', 'DESC')
->setParameter('date', $date->format('Y-m-d'));
View
23 Form/CategoryType.php
@@ -0,0 +1,23 @@
+<?php
+// src/Testing/MongoBundle/Form/Runner.php
+
+namespace Application\Jobeet2Bundle\Form;
+
+use Symfony\Component\Form\AbstractType;
+use Symfony\Component\Form\FormBuilder;
+
+class CategoryType extends AbstractType
+{
+ public function buildForm(FormBuilder $builder, array $options)
+ {
+ $builder->add('name');
+ }
+
+
+ public function getDefaultOptions(array $options)
+ {
+ return array(
+ 'data_class' => 'Application\Jobeet2Bundle\Entity\Category',
+ );
+ }
+}
View
44 Form/JobForm.php
@@ -1,44 +0,0 @@
-<?php
-
-namespace Application\Jobeet2Bundle\Form;
-
-use Symfony\Component\Form\Form;
-use Symfony\Component\Form\TextField;
-use Symfony\Component\Form\IntegerField;
-use Symfony\Component\Form\CheckboxField;
-use Symfony\Component\Form\DateTimeField;
-use Symfony\Component\Form\ChoiceField;
-
-class JobForm extends Form
-{
-
- public function configure() {
-
- $this->addOption('categories');
- $this->addOption('categoryTransformer');
-
- $this->add(new ChoiceField('category',array(
- 'choices'=>$this->getOption('categories'),
- 'value_transformer' => $this->getOption('categoryTransformer'),
- )));
-
- $this->add(new TextField('type'));
- $this->add(new TextField('company'));
- $this->add(new TextField('logo'));
- $this->add(new TextField('url'));
- $this->add(new TextField('position'));
- $this->add(new TextField('location'));
- $this->add(new TextField('description'));
- $this->add(new TextField('how_to_apply'));
- $this->add(new TextField('token'));
- $this->add(new CheckboxField('is_Public'));
- $this->add(new CheckboxField('is_activated'));
- $this->add(new TextField('email'));
- //$this->add(new DateTimeField('expires_at'));
- //$this->add(new DateTimeField('created_at'));
- //$this->add(new DateTimeField('updated_at'));
- }
-}
-
-
-
View
54 Form/JobType.php
@@ -0,0 +1,54 @@
+<?php
+// src/Testing/MongoBundle/Form/Runner.php
+
+namespace Application\Jobeet2Bundle\Form;
+
+use Symfony\Component\Form\AbstractType;
+use Symfony\Component\Form\FormBuilder;
+use Symfony\Bridge\Doctrine\Form\DataTransformer\EntityToIdTransformer;
+use Symfony\Bridge\Doctrine\Form\ChoiceList\EntityChoiceList;
+use Application\Jobeet2Bundle\Form\CategoryType;
+use Application\Jobeet2Bundle\Entity\Job;
+use Doctrine\ORM\EntityManager;
+
+
+class JobType extends AbstractType
+{
+ protected $em;
+
+ public function __construct(EntityManager $em)
+ {
+ $this->em = $em;
+ }
+ public function buildForm(FormBuilder $builder, array $options)
+ {
+ $builder->add('category','entity',array('class' => 'Application\Jobeet2Bundle\Entity\Category'));
+ /*$builder->add(
+ $builder->create('category','choice')
+ ->appendClientTransformer(new EntityToIdTransformer(
+ new EntityChoiceList($this->em,'Application\Jobeet2Bundle\Entity\Category'))
+ ));*/
+
+
+ $builder->add('type','choice',array('choices' => Job::getJobTypes(),'required' => false, 'expanded' => true,));
+ $builder->add('company');
+ $builder->add('logo','file',array('required'=>false));
+ $builder->add('url','text',array('required'=>false));
+ $builder->add('position','text');
+ $builder->add('location','text');
+ $builder->add('description','textarea');
+ $builder->add('how_to_apply','textarea',array('label' => 'How to apply?'));
+ $builder->add('is_public','checkbox',array('required'=>false,'label' => 'Public?'));
+ $builder->add('email','text');
+ $builder->add('_token');
+ }
+
+ public function getDefaultOptions(array $options)
+ {
+ return array(
+ 'data_class' => 'Application\Jobeet2Bundle\Entity\Job',
+ 'csrf_protection' => true,
+ 'csrf_field_name' => '_token',
+ );
+ }
+}
View
17 Resources/config/config.xml
@@ -9,4 +9,21 @@
<parameter key="jobeet2.max_jobs_on_homepage">10</parameter>
<parameter key="jobeet2.max_jobs_on_category">20</parameter>
</parameters>
+
+ <services>
+ <service id="sonata.jobeet2.admin.job" class="Application\Jobeet2Bundle\Admin\JobAdmin">
+ <tag name="sonata.admin" manager_type="orm" group="jobeet2" label="job"/>
+ <argument></argument>
+ <argument>%jobeet2.job.entity.class%</argument>
+ <argument>Jobeet2Bundle:JobAdmin</argument>
+ </service>
+
+ <service id="sonata.jobeet2.admin.category" class="Application\Jobeet2Bundle\Admin\CategoryAdmin">
+ <tag name="sonata.admin" manager_type="orm" group="jobeet2" label="category"/>
+ <argument></argument>
+ <argument>%jobeet2.category.entity.class%</argument>
+ <argument>Jobeet2Bundle:CategoryAdmin</argument>
+ </service>
+ </services>
+
</container>
View
6 Resources/config/model.xml
@@ -4,6 +4,12 @@
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://symfony.com/schema/dic/services http://symfony.com/schema/dic/services/services-1.0.xsd">
+ <parameters>
+ <parameter key="jobeet2.job.entity.class">Application\Jobeet2Bundle\Entity\Job</parameter>
+ <parameter key="jobeet2.category.entity.class">Application\Jobeet2Bundle\Entity\Category</parameter>
+ <parameter key="jobeet2.affiliate.entity.class">Application\Jobeet2Bundle\Enity\Affiliate</parameter>
+ </parameters>
+
<services>
<!-- Job Repository Service -->
<service id="jobeet2.job.repository"
View
52 Resources/config/routing.yml
@@ -11,33 +11,49 @@ index:
show:
pattern: /{company}/{location}/{id}/{position}.{_format}
defaults: { _controller: job.controller:showAction, _format: html }
- requirements: { _method: "GET" }
+ requirements:
+ _method: "GET"
+ id : \d+
-update:
- pattern: /update/{id}.{_format}
- defaults: { _controller: job.controller:updateAction, _format: html }
- requirements: { _method: "GET" }
+tokenized_show:
+ pattern: /{token}/show.{_format}
+ defaults: { _controller: job.controller:showAction, _format: html }
+ requirements:
+ _method: "GET"
+ token : \w+
-new:
- pattern: /new.{_format}
- defaults: { _controller: job.controller:newAction, _format: html }
- requirements: { _method: "GET" }
-delete:
- pattern: /delete/{id}.{_format}
- defaults: { _controller: job.controller:deleteAction, _format: html }
- requirements: { _method: "GET" }
+create:
+ pattern: /create.{_format}
+ defaults: { _controller: job.controller:editAction, _format: html }
+ requirements:
+ _method: "GET|POST"
edit:
- pattern: /edit/{id}.{_format}
+ pattern: /{id}/edit.{_format}
defaults: { _controller: job.controller:editAction, _format: html }
- requirements: { _method: "GET" }
+ requirements:
+ _method: "GET|POST"
+ id : \d+
-create:
- pattern: /create.{_format}
- defaults: { _controller: job.controller:createAction, _format: html }
+delete:
+ pattern: /{id}/delete.{_format}
+ defaults: { _controller: job.controller:deleteAction, _format: html }
requirements: { _method: "GET" }
+publish:
+ pattern: /{id}/publish.{_format}
+ defaults: { _controller: job.controller:publishAction, _format: html }
+ requirements:
+ id : \d+
+
+extend:
+ pattern: /{id}/extend.{_format}
+ defaults: { _controller: job.controller:extendAction, _format: html }
+ requirements:
+ id : \d+
+
+
category:
pattern: /category/{slug}.{_format}
defaults: {_controller: category.controller:showAction, _format: html }
View
5 Resources/public/css/main.css
@@ -374,3 +374,8 @@ em
{
display: inline;
}
+
+.required
+{
+ color: #dc143c;
+}
View
29 Resources/views/Admin/_admin.html.twig
@@ -0,0 +1,29 @@
+{# Application\Jobbet2Bundle\Resources\views\Admin\_admin.html.twig #}
+
+<div id="job_actions">
+ <h3>Admin</h3>
+ <ul>
+ {% if not(job.isActivated) %}
+ <li><a href="{{ path('edit', {'id': job.id}) }}">Edit</a></li>
+ <li><a href="{{ path('publish', {'id': job.id}) }}">Publish</a></li>
+ {% endif %}
+ <li><a href="{{ path('delete', {'id' : job.id }) }}">Delete</a></li>
+ {% if job.isActivated %}
+ <li class='expires_soon'>
+ {% if job.isExpired() %} Expired
+ {% else %} Expires in <strong>{{ job.getDaysBeforeExpires() }}</strong> days
+ {% endif %}
+
+ {% if job.expiresSoon() %}
+ - <a href="{{ path('extend', {'id' : job.id}) }}">Extend</a> for another {{ active_days }} days
+ {% endif %}
+ </li>
+ {% else %}
+ <li>
+ [Bookmark this page <a href="{{ path('show',{'company':job.getCompanySlug, 'location': job.getLocationSlug
+ ,'id': job.id, 'position':job.getPositionSlug }) }}">URL</a>
+ to manage this job in the future.]
+ </li>
+ {% endif %}
+ </ul>
+</div>
View
45 Resources/views/Form/fields.html.twig
@@ -0,0 +1,45 @@
+{# src/Application/Jobeet2Bundle/Resources/views/Form/fields.html.twig #}
+{% extends 'TwigBundle:Form:div_layout.html.twig' %}
+
+{% block field_row %}
+ <tr>
+ <td>{{ form_label(form) }}</td>
+ <td>{{ form_errors(form) }}
+ {% if help is defined %}
+ {{ form_widget(form , { 'help': help }) }}
+ {% else %}
+ {{ form_widget(form) }}
+ {% endif %}
+ </td>
+ </tr>
+{% endblock field_row %}
+
+{% block field_errors %}
+{% spaceless %}
+ {% if errors|length > 0 %}
+ <ul class='error_list'>
+ {% for error in errors %}
+ <li>{{ error.messageTemplate|trans(error.messageParameters, 'validators') }}</li>
+ {% endfor %}
+ </ul>
+ {% endif %}
+{% endspaceless %}
+{% endblock field_errors %}
+
+
+{% block field_label %}
+ {{ parent() }}
+ {% if required %}
+ <span class="required" title="This field is required">*</span>
+ {% endif %}
+{% endblock field_label %}
+
+
+{% block field_widget %}
+ {{ parent() }}
+ {% if help is defined %}
+ <span class="help">{{ help }}</div>
+ {% endif %}
+{% endblock %}
+
+
View
28 Resources/views/Job/_form.html.twig
@@ -0,0 +1,28 @@
+{% form_theme form 'Jobeet2Bundle:Form:fields.html.twig' %}
+{# form_theme form _self #}
+{# use 'TwigBundle:Form:div_layout.html.twig' #}
+
+<form action="{{ app.request.requestUri }}" method="post" {{ form_enctype(form) }}>
+ <table id='job_form'>
+ <tfoot>
+ <tr>
+ <td collspan="2">
+ <input type="submit" value="Preview your job"/>
+ </td>
+ </tr>
+ </tfoot>
+ <tbody>
+ {{form_row(form.category) }}
+ {{form_row(form.type) }}
+ {{form_row(form.company) }}
+ {{form_row(form.logo) }}
+ {{form_row(form.url) }}
+ {{form_row(form.position) }}
+ {{form_row(form.location) }}
+ {{form_row(form.description) }}
+ {{form_row(form.how_to_apply) }}
+ {{form_row(form.is_public) }}
+ {{form_row(form.email , { 'help' : 'email' }) }}
+ </tbody>
+ </table>
+</form>
View
10 Resources/views/Job/create.html.twig
@@ -0,0 +1,10 @@
+{% extends "Jobeet2Bundle::layout.html.twig" %}
+
+{% block stylesheet %}
+ <link href="{{ asset('./bundles/jobeet2/css/job.css') }}" rel="stylesheet" type="text/css" />
+{% endblock %}
+
+{% block content %}
+ <h1>Post a Job</h1>
+ {% include 'Jobeet2Bundle:Job:_form.html.twig' with {'form': form} %}
+{% endblock %}
View
8 Resources/views/Job/new.html.twig
@@ -1,8 +0,0 @@
-{% extends "Jobeet2Bundle::layout.html.twig" %}
-
-{% block content %}
- <form action="#" method="post">
- {{ form_field(form) }}
- <input type="submit" />
- </form>
-{% endblock %}
View
16 Resources/views/Job/show.html.twig
@@ -8,7 +8,17 @@
{% endblock %}
{% block content %}
+{% if true %}
+ {% include 'Jobeet2Bundle:Admin:_admin.html.twig' with {'job': job} %}
+{% endif %}
<div id="job">
+
+ {% if app.session.hasFlash('notice') %}
+ <div class="flash-notice">
+ {{ app.session.flash('notice') }}
+ </div>
+ {% endif %}
+
<h1>{{ job.company }}</h1>
<h2>{{ job.location }}</h2>
<h3>
@@ -35,11 +45,5 @@
<small>posted on {{ job.createdAt|date('d/m/Y') }} </small>
</div>
- <div style="padding:20px 0">
- <a href="{{ path('edit',{'id':job.id})}}">
- Edit
- </a>
- </div>
-
</div>
{% endblock %}
View
4 Resources/views/index.html.twig
@@ -3,10 +3,8 @@
{% block title %}Jobeet - Your best job board{% endblock %}
-{% block head %}
- {{ parent () }}
+{% block stylesheet %}
<link href="{{ asset('./bundles/jobeet2/css/jobs.css') }}" rel="stylesheet" type="text/css" />
-
{% endblock %}
View
8 Resources/views/layout.html.twig
@@ -6,10 +6,14 @@
{% block head %}
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<link href="{{ asset('./bundles/jobeet2/css/main.css') }}" rel="stylesheet" type="text/css" />
- <title>{% block title %} title by default layout {% endblock %}</title>
+ {% block stylesheet %} {% endblock %}
+ <title>{% block title %} Jobeet2, your best job board {% endblock %}</title>
{% endblock %}
<body>
+
+ {% block javascript %}{% endblock %}
+
{% block body %}
<div id="container">
<div id="header">
@@ -23,7 +27,7 @@
<div class="post">
<h2>Ask for people</h2>
<div>
- <a href="{{ path('homepage') }}">Post a Job</a>
+ <a href="{{ path('create') }}">Post a Job</a>
</div>
</div>
Please sign in to comment.
Something went wrong with that request. Please try again.