Add CRUD for site credentials

This commit is contained in:
Jeremy Benoist 2016-12-04 13:51:58 +01:00
parent 873f6b8e03
commit f92fcb53ca
No known key found for this signature in database
GPG key ID: BCA73962457ACC3C
24 changed files with 1054 additions and 13 deletions

View file

@ -0,0 +1,56 @@
<?php
namespace Application\Migrations;
use Doctrine\DBAL\Migrations\AbstractMigration;
use Doctrine\DBAL\Schema\Schema;
use Symfony\Component\DependencyInjection\ContainerAwareInterface;
use Symfony\Component\DependencyInjection\ContainerInterface;
/**
* Add site credential table to store username & password for some website (behind authentication or paywall)
*/
class Version20161204115751 extends AbstractMigration implements ContainerAwareInterface
{
/**
* @var ContainerInterface
*/
private $container;
public function setContainer(ContainerInterface $container = null)
{
$this->container = $container;
}
private function getTable($tableName)
{
return $this->container->getParameter('database_table_prefix').$tableName;
}
/**
* @param Schema $schema
*/
public function up(Schema $schema)
{
$this->skipIf($schema->hasTable($this->getTable('site_credential')), 'It seems that you already played this migration.');
$table = $schema->createTable($this->getTable('site_credential'));
$table->addColumn('id', 'integer', ['autoincrement' => true]);
$table->addColumn('user_id', 'integer');
$table->addColumn('host', 'string', ['length' => 255]);
$table->addColumn('username', 'string', ['length' => 255]);
$table->addColumn('password', 'string', ['length' => 255]);
$table->addColumn('createdAt', 'datetime');
$table->addIndex(['user_id'], 'idx_user');
$table->setPrimaryKey(['id']);
$table->addForeignKeyConstraint($this->getTable('user'), ['user_id'], ['id'], [], 'fk_user');
}
/**
* @param Schema $schema
*/
public function down(Schema $schema)
{
$schema->dropTable($this->getTable('site_credential'));
}
}

View file

@ -0,0 +1,138 @@
<?php
namespace Wallabag\CoreBundle\Controller;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Bundle\FrameworkBundle\Controller\Controller;
use Sensio\Bundle\FrameworkExtraBundle\Configuration\Method;
use Sensio\Bundle\FrameworkExtraBundle\Configuration\Route;
use Wallabag\UserBundle\Entity\User;
use Wallabag\CoreBundle\Entity\SiteCredential;
/**
* SiteCredential controller.
*/
class SiteCredentialController extends Controller
{
/**
* Lists all User entities.
*
* @Route("/site-credential", name="site_credential_index")
* @Method("GET")
*/
public function indexAction()
{
$em = $this->getDoctrine()->getManager();
$credentials = $em->getRepository('WallabagCoreBundle:SiteCredential')->findAll();
return $this->render('WallabagCoreBundle:SiteCredential:index.html.twig', array(
'credentials' => $credentials,
));
}
/**
* Creates a new site credential entity.
*
* @Route("/site-credential/new", name="site_credential_new")
* @Method({"GET", "POST"})
*/
public function newAction(Request $request)
{
$credential = new SiteCredential($this->getUser());
$form = $this->createForm('Wallabag\CoreBundle\Form\Type\SiteCredentialType', $credential);
$form->handleRequest($request);
if ($form->isSubmitted() && $form->isValid()) {
$em = $this->getDoctrine()->getManager();
$em->persist($credential);
$em->flush($credential);
$this->get('session')->getFlashBag()->add(
'notice',
$this->get('translator')->trans('flashes.site_credential.notice.added', ['%host%' => $credential->getHost()])
);
return $this->redirectToRoute('site_credential_edit', array('id' => $credential->getId()));
}
return $this->render('WallabagCoreBundle:SiteCredential:new.html.twig', array(
'credential' => $credential,
'form' => $form->createView(),
));
}
/**
* Displays a form to edit an existing site credential entity.
*
* @Route("/site-credential/{id}/edit", name="site_credential_edit")
* @Method({"GET", "POST"})
*/
public function editAction(Request $request, SiteCredential $siteCredential)
{
$deleteForm = $this->createDeleteForm($siteCredential);
$editForm = $this->createForm('Wallabag\CoreBundle\Form\Type\SiteCredentialType', $siteCredential);
$editForm->handleRequest($request);
if ($editForm->isSubmitted() && $editForm->isValid()) {
$em = $this->getDoctrine()->getManager();
$em->persist($siteCredential);
$em->flush();
$this->get('session')->getFlashBag()->add(
'notice',
$this->get('translator')->trans('flashes.site_credential.notice.updated', ['%host%' => $siteCredential->getHost()])
);
return $this->redirectToRoute('site_credential_edit', array('id' => $siteCredential->getId()));
}
return $this->render('WallabagCoreBundle:SiteCredential:edit.html.twig', array(
'credential' => $siteCredential,
'edit_form' => $editForm->createView(),
'delete_form' => $deleteForm->createView(),
));
}
/**
* Deletes a site credential entity.
*
* @Route("/site-credential/{id}", name="site_credential_delete")
* @Method("DELETE")
*/
public function deleteAction(Request $request, SiteCredential $siteCredential)
{
$form = $this->createDeleteForm($siteCredential);
$form->handleRequest($request);
if ($form->isSubmitted() && $form->isValid()) {
$this->get('session')->getFlashBag()->add(
'notice',
$this->get('translator')->trans('flashes.site_credential.notice.deleted', ['%host%' => $siteCredential->getHost()])
);
$em = $this->getDoctrine()->getManager();
$em->remove($siteCredential);
$em->flush();
}
return $this->redirectToRoute('site_credential_index');
}
/**
* Creates a form to delete a site credential entity.
*
* @param SiteCredential $siteCredential The site credential entity
*
* @return \Symfony\Component\Form\Form The form
*/
private function createDeleteForm(SiteCredential $siteCredential)
{
return $this->createFormBuilder()
->setAction($this->generateUrl('site_credential_delete', array('id' => $siteCredential->getId())))
->setMethod('DELETE')
->getForm()
;
}
}

View file

@ -0,0 +1,197 @@
<?php
namespace Wallabag\CoreBundle\Entity;
use Doctrine\ORM\Mapping as ORM;
use Symfony\Component\Validator\Constraints as Assert;
use Wallabag\UserBundle\Entity\User;
/**
* SiteCredential.
*
* @ORM\Entity(repositoryClass="Wallabag\CoreBundle\Repository\SiteCredentialRepository")
* @ORM\Table(name="`site_credential`")
* @ORM\HasLifecycleCallbacks()
*/
class SiteCredential
{
/**
* @var int
*
* @ORM\Column(name="id", type="integer")
* @ORM\Id
* @ORM\GeneratedValue(strategy="AUTO")
*/
private $id;
/**
* @var string
*
* @Assert\NotBlank()
* @Assert\Length(max=255)
* @ORM\Column(name="host", type="string", length=255)
*/
private $host;
/**
* @var string
*
* @Assert\NotBlank()
* @Assert\Length(max=255)
* @ORM\Column(name="username", type="string", length=255)
*/
private $username;
/**
* @var string
*
* @Assert\NotBlank()
* @Assert\Length(max=255)
* @ORM\Column(name="password", type="string", length=255)
*/
private $password;
/**
* @var \DateTime
*
* @ORM\Column(name="createdAt", type="datetime")
*/
private $createdAt;
/**
* @ORM\ManyToOne(targetEntity="Wallabag\UserBundle\Entity\User", inversedBy="site_credentials")
*/
private $user;
/*
* @param User $user
*/
public function __construct(User $user)
{
$this->user = $user;
}
/**
* Get id.
*
* @return int
*/
public function getId()
{
return $this->id;
}
/**
* Set host.
*
* @param string $host
*
* @return SiteCredential
*/
public function setHost($host)
{
$this->host = $host;
return $this;
}
/**
* Get host.
*
* @return string
*/
public function getHost()
{
return $this->host;
}
/**
* Set username.
*
* @param string $username
*
* @return SiteCredential
*/
public function setUsername($username)
{
$this->username = $username;
return $this;
}
/**
* Get username.
*
* @return string
*/
public function getUsername()
{
return $this->username;
}
/**
* Set password.
*
* @param string $password
*
* @return SiteCredential
*/
public function setPassword($password)
{
$this->password = $password;
return $this;
}
/**
* Get password.
*
* @return string
*/
public function getPassword()
{
return $this->password;
}
/**
* Set createdAt.
*
* @param \DateTime $createdAt
*
* @return SiteCredential
*/
public function setCreatedAt($createdAt)
{
$this->createdAt = $createdAt;
return $this;
}
/**
* Get createdAt.
*
* @return \DateTime
*/
public function getCreatedAt()
{
return $this->createdAt;
}
/**
* @return User
*/
public function getUser()
{
return $this->user;
}
/**
* @ORM\PrePersist
*/
public function timestamps()
{
if (is_null($this->createdAt)) {
$this->createdAt = new \DateTime();
}
}
}

View file

@ -0,0 +1,43 @@
<?php
namespace Wallabag\CoreBundle\Form\Type;
use Symfony\Component\Form\AbstractType;
use Symfony\Component\Form\Extension\Core\Type\PasswordType;
use Symfony\Component\Form\Extension\Core\Type\SubmitType;
use Symfony\Component\Form\Extension\Core\Type\TextType;
use Symfony\Component\Form\FormBuilderInterface;
use Symfony\Component\OptionsResolver\OptionsResolver;
class SiteCredentialType extends AbstractType
{
public function buildForm(FormBuilderInterface $builder, array $options)
{
$builder
->add('host', TextType::class, [
'label' => 'site_credential.form.host_label',
])
->add('username', TextType::class, [
'label' => 'site_credential.form.username_label',
])
->add('password', PasswordType::class, [
'label' => 'site_credential.form.password_label',
])
->add('save', SubmitType::class, [
'label' => 'config.form.save',
])
;
}
public function configureOptions(OptionsResolver $resolver)
{
$resolver->setDefaults([
'data_class' => 'Wallabag\CoreBundle\Entity\SiteCredential',
]);
}
public function getBlockPrefix()
{
return 'site_credential';
}
}

View file

@ -0,0 +1,13 @@
<?php
namespace Wallabag\CoreBundle\Repository;
/**
* SiteCredentialRepository.
*
* This class was generated by the Doctrine ORM. Add your own custom
* repository methods below.
*/
class SiteCredentialRepository extends \Doctrine\ORM\EntityRepository
{
}

View file

@ -518,6 +518,26 @@ user:
search:
# placeholder: Filter by username or email
site_credential:
# page_title: Site credentials management
# new_site_credential: Create a credential
# edit_site_credential: Edit an existing credential
# description: "Here you can manage all credentials for sites which required them (create, edit and delete), like a paywall, an authentication, etc."
# list:
# actions: Actions
# edit_action: Edit
# yes: Yes
# no: No
# create_new_one: Create a new credential
# form:
# username_label: 'Username'
# host_label: 'Host'
# password_label: 'Password'
# save: Save
# delete: Delete
# delete_confirm: Are you sure?
# back_to_list: Back to list
error:
# page_title: An error occurred
@ -570,3 +590,8 @@ flashes:
# added: 'User "%username%" added'
# updated: 'User "%username%" updated'
# deleted: 'User "%username%" deleted'
site_credential:
notice:
# added: 'Site credential for "%host%" added'
# updated: 'Site credential for "%host%" updated'
# deleted: 'Site credential for "%host%" deleted'

View file

@ -519,6 +519,26 @@ user:
search:
placeholder: Filtere nach Benutzer oder E-Mail-Adresse
site_credential:
# page_title: Site credentials management
# new_site_credential: Create a credential
# edit_site_credential: Edit an existing credential
# description: "Here you can manage all credentials for sites which required them (create, edit and delete), like a paywall, an authentication, etc."
list:
actions: Aktionen
edit_action: Bearbeiten
yes: Ja
no: Nein
# create_new_one: Create a new credential
form:
# username_label: 'Username'
# host_label: 'Host'
# password_label: 'Password'
save: Speichern
delete: Löschen
delete_confirm: Bist du sicher?
back_to_list: Zurück zur Liste
error:
page_title: Ein Fehler ist aufgetreten
@ -571,3 +591,8 @@ flashes:
added: 'Benutzer "%username%" hinzugefügt'
updated: 'Benutzer "%username%" aktualisiert'
deleted: 'Benutzer "%username%" gelöscht'
site_credential:
notice:
# added: 'Site credential for "%host%" added'
# updated: 'Site credential for "%host%" updated'
# deleted: 'Site credential for "%host%" deleted'

View file

@ -519,6 +519,26 @@ user:
search:
placeholder: Filter by username or email
site_credential:
page_title: Site credentials management
new_site_credential: Create a credential
edit_site_credential: Edit an existing credential
description: "Here you can manage all credentials for sites which required them (create, edit and delete), like a paywall, an authentication, etc."
list:
actions: Actions
edit_action: Edit
yes: Yes
no: No
create_new_one: Create a new credential
form:
username_label: 'Username'
host_label: 'Host'
password_label: 'Password'
save: Save
delete: Delete
delete_confirm: Are you sure?
back_to_list: Back to list
error:
page_title: An error occurred
@ -571,3 +591,8 @@ flashes:
added: 'User "%username%" added'
updated: 'User "%username%" updated'
deleted: 'User "%username%" deleted'
site_credential:
notice:
added: 'Site credential for "%host%" added'
updated: 'Site credential for "%host%" updated'
deleted: 'Site credential for "%host%" deleted'

View file

@ -519,6 +519,26 @@ user:
search:
# placeholder: Filter by username or email
site_credential:
# page_title: Site credentials management
# new_site_credential: Create a credential
# edit_site_credential: Edit an existing credential
# description: "Here you can manage all credentials for sites which required them (create, edit and delete), like a paywall, an authentication, etc."
# list:
# actions: Actions
# edit_action: Edit
# yes: Yes
# no: No
# create_new_one: Create a new credential
# form:
# username_label: 'Username'
# host_label: 'Host'
# password_label: 'Password'
# save: Save
# delete: Delete
# delete_confirm: Are you sure?
# back_to_list: Back to list
error:
page_title: Ha ocurrido un error
@ -571,3 +591,8 @@ flashes:
added: 'Añadido el usuario "%username%"'
updated: 'Actualizado el usuario "%username%"'
deleted: 'Eliminado el usuario "%username%"'
site_credential:
notice:
# added: 'Site credential for "%host%" added'
# updated: 'Site credential for "%host%" updated'
# deleted: 'Site credential for "%host%" deleted'

View file

@ -519,6 +519,26 @@ user:
search:
# placeholder: Filter by username or email
site_credential:
# page_title: Site credentials management
# new_site_credential: Create a credential
# edit_site_credential: Edit an existing credential
# description: "Here you can manage all credentials for sites which required them (create, edit and delete), like a paywall, an authentication, etc."
# list:
# actions: Actions
# edit_action: Edit
# yes: Yes
# no: No
# create_new_one: Create a new credential
# form:
# username_label: 'Username'
# host_label: 'Host'
# password_label: 'Password'
# save: Save
# delete: Delete
# delete_confirm: Are you sure?
# back_to_list: Back to list
error:
# page_title: An error occurred
@ -571,3 +591,8 @@ flashes:
# added: 'User "%username%" added'
# updated: 'User "%username%" updated'
# deleted: 'User "%username%" deleted'
site_credential:
notice:
# added: 'Site credential for "%host%" added'
# updated: 'Site credential for "%host%" updated'
# deleted: 'Site credential for "%host%" deleted'

View file

@ -519,6 +519,26 @@ user:
search:
placeholder: "Filtrer par nom dutilisateur ou email"
site_credential:
page_title: Gestion des accès aux sites
new_site_credential: Créer un accès à un site
edit_site_credential: Éditer l'accès d'un site
description: "Ici vous pouvez gérer les accès aux différents sites. Ces accès permettent de récupérer des contenus sur des sites qui requiert une authentification ou un paywall"
list:
actions: Actions
edit_action: Éditer
yes: Oui
no: Non
create_new_one: Créer un nouvel accès à un site
form:
username_label: 'Identifiant'
host_label: 'Domaine'
password_label: 'Mot de passe'
save: "Sauvegarder"
delete: "Supprimer"
delete_confirm: "Voulez-vous vraiment ?"
back_to_list: "Revenir à la liste"
error:
page_title: "Une erreur est survenue"
@ -568,6 +588,11 @@ flashes:
client_deleted: "Client %name% supprimé"
user:
notice:
added: "Utilisateur \"%username%\" ajouté"
updated: "Utilisateur \"%username%\" mis à jour"
deleted: "Utilisateur \"%username%\" supprimé"
added: 'Utilisateur "%username%" ajouté'
updated: 'Utilisateur "%username%" mis à jour'
deleted: 'Utilisateur "%username%" supprimé'
site_credential:
notice:
added: 'Accès au site "%host%" ajouté'
updated: 'Accès au site "%host%" mis à jour'
deleted: 'Accès au site "%host%" supprimé'

View file

@ -519,6 +519,26 @@ user:
search:
# placeholder: Filter by username or email
site_credential:
# page_title: Site credentials management
# new_site_credential: Create a credential
# edit_site_credential: Edit an existing credential
# description: "Here you can manage all credentials for sites which required them (create, edit and delete), like a paywall, an authentication, etc."
# list:
# actions: Actions
# edit_action: Edit
# yes: Yes
# no: No
# create_new_one: Create a new credential
# form:
# username_label: 'Username'
# host_label: 'Host'
# password_label: 'Password'
# save: Save
# delete: Delete
# delete_confirm: Are you sure?
# back_to_list: Back to list
error:
# page_title: An error occurred
@ -571,3 +591,8 @@ flashes:
# added: 'User "%username%" added'
# updated: 'User "%username%" updated'
# deleted: 'User "%username%" deleted'
site_credential:
notice:
# added: 'Site credential for "%host%" added'
# updated: 'Site credential for "%host%" updated'
# deleted: 'Site credential for "%host%" deleted'

View file

@ -519,6 +519,26 @@ user:
search:
placeholder: "Filtrar per nom d'utilizaire o corrièl"
site_credential:
# page_title: Site credentials management
# new_site_credential: Create a credential
# edit_site_credential: Edit an existing credential
# description: "Here you can manage all credentials for sites which required them (create, edit and delete), like a paywall, an authentication, etc."
list:
actions: 'Accions'
edit_action: 'Modificar'
yes: 'Òc'
no: 'Non'
# create_new_one: Create a new credential
form:
# username_label: 'Username'
# host_label: 'Host'
# password_label: 'Password'
save: 'Enregistrar'
delete: 'Suprimir'
delete_confirm: 'Sètz segur ?'
back_to_list: 'Tornar a la lista'
error:
page_title: Una error s'es produsida
@ -571,3 +591,8 @@ flashes:
added: 'Utilizaire "%username%" ajustat'
updated: 'Utilizaire "%username%" mes a jorn'
deleted: 'Utilizaire "%username%" suprimit'
site_credential:
notice:
# added: 'Site credential for "%host%" added'
# updated: 'Site credential for "%host%" updated'
# deleted: 'Site credential for "%host%" deleted'

View file

@ -519,6 +519,26 @@ user:
search:
placeholder: Filtruj po nazwie użytkownika lub adresie e-mail
site_credential:
# page_title: Site credentials management
# new_site_credential: Create a credential
# edit_site_credential: Edit an existing credential
# description: "Here you can manage all credentials for sites which required them (create, edit and delete), like a paywall, an authentication, etc."
list:
actions: Akcje
edit_action: Edytuj
yes: Tak
no: Nie
# create_new_one: Create a new credential
form:
# username_label: 'Username'
# host_label: 'Host'
# password_label: 'Password'
save: Zapisz
delete: Usuń
delete_confirm: Jesteś pewien?
back_to_list: Powrót do listy
error:
page_title: Wystąpił błąd
@ -571,3 +591,8 @@ flashes:
added: 'Użytkownik "%username%" dodany'
updated: 'Użytkownik "%username%" zaktualizowany'
deleted: 'Użytkownik "%username%" usunięty'
site_credential:
notice:
# added: 'Site credential for "%host%" added'
# updated: 'Site credential for "%host%" updated'
# deleted: 'Site credential for "%host%" deleted'

View file

@ -519,6 +519,26 @@ user:
search:
# placeholder: Filter by username or email
site_credential:
# page_title: Site credentials management
# new_site_credential: Create a credential
# edit_site_credential: Edit an existing credential
# description: "Here you can manage all credentials for sites which required them (create, edit and delete), like a paywall, an authentication, etc."
list:
actions: 'Ações'
edit_action: 'Editar'
yes: 'Sim'
no: 'Não'
# create_new_one: Create a new credential
form:
# username_label: 'Username'
# host_label: 'Host'
# password_label: 'Password'
save: 'Salvar'
delete: 'Apagar'
delete_confirm: 'Tem certeza?'
back_to_list: 'Voltar para a lista'
error:
# page_title: An error occurred
@ -571,3 +591,8 @@ flashes:
added: 'Usuário "%username%" adicionado'
updated: 'Usuário "%username%" atualizado'
deleted: 'Usuário "%username%" removido'
site_credential:
notice:
# added: 'Site credential for "%host%" added'
# updated: 'Site credential for "%host%" updated'
# deleted: 'Site credential for "%host%" deleted'

View file

@ -519,6 +519,26 @@ user:
search:
# placeholder: Filter by username or email
site_credential:
# page_title: Site credentials management
# new_site_credential: Create a credential
# edit_site_credential: Edit an existing credential
# description: "Here you can manage all credentials for sites which required them (create, edit and delete), like a paywall, an authentication, etc."
# list:
# actions: Actions
# edit_action: Edit
# yes: Yes
# no: No
# create_new_one: Create a new credential
# form:
# username_label: 'Username'
# host_label: 'Host'
# password_label: 'Password'
# save: Save
# delete: Delete
# delete_confirm: Are you sure?
# back_to_list: Back to list
error:
# page_title: An error occurred
@ -571,3 +591,8 @@ flashes:
# added: 'User "%username%" added'
# updated: 'User "%username%" updated'
# deleted: 'User "%username%" deleted'
site_credential:
notice:
# added: 'Site credential for "%host%" added'
# updated: 'Site credential for "%host%" updated'
# deleted: 'Site credential for "%host%" deleted'

View file

@ -571,3 +571,8 @@ flashes:
# added: 'User "%username%" added'
# updated: 'User "%username%" updated'
# deleted: 'User "%username%" deleted'
site_credential:
notice:
# added: 'Site credential for "%host%" added'
# updated: 'Site credential for "%host%" updated'
# deleted: 'Site credential for "%host%" deleted'

View file

@ -0,0 +1,60 @@
{% extends "WallabagCoreBundle::layout.html.twig" %}
{% block title %}{{ 'site_credential.page_title'|trans }}{% endblock %}
{% block content %}
<div class="row">
<div class="col s12">
<div class="card-panel">
<div class="row">
<div class="input-field col s12">
<h4>{{ 'site_credential.edit_site_credential'|trans }}</h4>
<div id="set6" class="col s12">
{{ form_start(edit_form) }}
{{ form_errors(edit_form) }}
<div class="row">
<div class="input-field col s12">
{{ form_label(edit_form.host) }}
{{ form_errors(edit_form.host) }}
{{ form_widget(edit_form.host) }}
</div>
</div>
<div class="row">
<div class="input-field col s12">
{{ form_label(edit_form.username) }}
{{ form_errors(edit_form.username) }}
{{ form_widget(edit_form.username) }}
</div>
</div>
<div class="row">
<div class="input-field col s12">
{{ form_label(edit_form.password) }}
{{ form_errors(edit_form.password) }}
{{ form_widget(edit_form.password) }}
</div>
</div>
<br/>
{{ form_widget(edit_form.save, {'attr': {'class': 'btn waves-effect waves-light'}}) }}
{{ form_widget(edit_form._token) }}
</form>
<p>
{{ form_start(delete_form) }}
<button onclick="return confirm('{{ 'site_credential.form.delete_confirm'|trans|escape('js') }}')" type="submit" class="btn waves-effect waves-light red">{{ 'site_credential.form.delete'|trans }}</button>
{{ form_end(delete_form) }}
</p>
<p><a class="waves-effect waves-light btn blue-grey" href="{{ path('site_credential_index') }}">{{ 'site_credential.form.back_to_list'|trans }}</a></p>
</div>
</div>
</div>
</div>
</div>
</div>
{% endblock %}

View file

@ -0,0 +1,44 @@
{% extends "WallabagCoreBundle::layout.html.twig" %}
{% block title %}{{ 'site_credential.page_title'|trans }}{% endblock %}
{% block content %}
<div class="row">
<div class="col s12">
<div class="card-panel">
<div class="row">
<div class="input-field col s12">
<p class="help">{{ 'site_credential.description'|trans|raw }}</p>
<table class="bordered">
<thead>
<tr>
<th>{{ 'site_credential.form.host_label'|trans }}</th>
<th>{{ 'site_credential.form.username_label'|trans }}</th>
<th>{{ 'site_credential.list.actions'|trans }}</th>
</tr>
</thead>
<tbody>
{% for credential in credentials %}
<tr>
<td>{{ credential.host }}</td>
<td>{{ credential.username }}</td>
<td>
<a href="{{ path('site_credential_edit', { 'id': credential.id }) }}">{{ 'site_credential.list.edit_action'|trans }}</a>
</td>
</tr>
{% endfor %}
</tbody>
</table>
<br />
<p>
<a href="{{ path('site_credential_new') }}" class="waves-effect waves-light btn">{{ 'site_credential.list.create_new_one'|trans }}</a>
</p>
</div>
</div>
</div>
</div>
</div>
{% endblock %}

View file

@ -0,0 +1,53 @@
{% extends "WallabagCoreBundle::layout.html.twig" %}
{% block title %}{{ 'site_credential.page_title'|trans }}{% endblock %}
{% block content %}
<div class="row">
<div class="col s12">
<div class="card-panel">
<div class="row">
<div class="input-field col s12">
<h4>{{ 'site_credential.new_site_credential'|trans }}</h4>
<div id="set6" class="col s12">
{{ form_start(form) }}
{{ form_errors(form) }}
<div class="row">
<div class="input-field col s12">
{{ form_label(form.host) }}
{{ form_errors(form.host) }}
{{ form_widget(form.host) }}
</div>
</div>
<div class="row">
<div class="input-field col s12">
{{ form_label(form.username) }}
{{ form_errors(form.username) }}
{{ form_widget(form.username) }}
</div>
</div>
<div class="row">
<div class="input-field col s12">
{{ form_label(form.password) }}
{{ form_errors(form.password) }}
{{ form_widget(form.password) }}
</div>
</div>
{{ form_widget(form.save, {'attr': {'class': 'btn waves-effect waves-light'}}) }}
{{ form_rest(form) }}
</form>
<p><a class="waves-effect waves-light btn blue-grey" href="{{ path('site_credential_index') }}">{{ 'site_credential.form.back_to_list'|trans }}</a></p>
</div>
</div>
</div>
</div>
</div>
</div>
{% endblock %}

View file

@ -66,13 +66,13 @@
</div>
</div>
<div class="row">
<div class="input-field col s12">
{{ form_errors(form.config.action_mark_as_read) }}
{{ form_widget(form.config.action_mark_as_read) }}
{{ form_label(form.config.action_mark_as_read) }}
<div class="row">
<div class="input-field col s12">
{{ form_label(form.config.action_mark_as_read) }}
{{ form_errors(form.config.action_mark_as_read) }}
{{ form_widget(form.config.action_mark_as_read) }}
</div>
</div>
</div>
<div class="row">
<div class="input-field col s11">
@ -254,11 +254,11 @@
{{ form_start(form.pwd) }}
{{ form_errors(form.pwd) }}
<div class="row">
<div class="input-field col s12">
{{ 'config.form_password.description'|trans }}
<div class="row">
<div class="input-field col s12">
{{ 'config.form_password.description'|trans }}
</div>
</div>
</div>
<div class="row">
<div class="input-field col s12">

View file

@ -0,0 +1,60 @@
{% extends "WallabagCoreBundle::layout.html.twig" %}
{% block title %}{{ 'site_credential.page_title'|trans }}{% endblock %}
{% block content %}
<div class="row">
<div class="col s12">
<div class="card-panel">
<div class="row">
<div class="input-field col s12">
<h4>{{ 'site_credential.edit_site_credential'|trans }}</h4>
<div id="set6" class="col s12">
{{ form_start(edit_form) }}
{{ form_errors(edit_form) }}
<div class="row">
<div class="input-field col s12">
{{ form_label(edit_form.host) }}
{{ form_errors(edit_form.host) }}
{{ form_widget(edit_form.host) }}
</div>
</div>
<div class="row">
<div class="input-field col s12">
{{ form_label(edit_form.username) }}
{{ form_errors(edit_form.username) }}
{{ form_widget(edit_form.username) }}
</div>
</div>
<div class="row">
<div class="input-field col s12">
{{ form_label(edit_form.password) }}
{{ form_errors(edit_form.password) }}
{{ form_widget(edit_form.password) }}
</div>
</div>
<br/>
{{ form_widget(edit_form.save, {'attr': {'class': 'btn waves-effect waves-light'}}) }}
{{ form_widget(edit_form._token) }}
</form>
<p>
{{ form_start(delete_form) }}
<button onclick="return confirm('{{ 'site_credential.form.delete_confirm'|trans|escape('js') }}')" type="submit" class="btn waves-effect waves-light red">{{ 'site_credential.form.delete'|trans }}</button>
{{ form_end(delete_form) }}
</p>
<p><a class="waves-effect waves-light btn blue-grey" href="{{ path('site_credential_index') }}">{{ 'site_credential.form.back_to_list'|trans }}</a></p>
</div>
</div>
</div>
</div>
</div>
</div>
{% endblock %}

View file

@ -0,0 +1,44 @@
{% extends "WallabagCoreBundle::layout.html.twig" %}
{% block title %}{{ 'site_credential.page_title'|trans }}{% endblock %}
{% block content %}
<div class="row">
<div class="col s12">
<div class="card-panel">
<div class="row">
<div class="input-field col s12">
<p class="help">{{ 'site_credential.description'|trans|raw }}</p>
<table class="bordered">
<thead>
<tr>
<th>{{ 'site_credential.form.host_label'|trans }}</th>
<th>{{ 'site_credential.form.username_label'|trans }}</th>
<th>{{ 'site_credential.list.actions'|trans }}</th>
</tr>
</thead>
<tbody>
{% for credential in credentials %}
<tr>
<td>{{ credential.host }}</td>
<td>{{ credential.username }}</td>
<td>
<a href="{{ path('site_credential_edit', { 'id': credential.id }) }}">{{ 'site_credential.list.edit_action'|trans }}</a>
</td>
</tr>
{% endfor %}
</tbody>
</table>
<br />
<p>
<a href="{{ path('site_credential_new') }}" class="waves-effect waves-light btn">{{ 'site_credential.list.create_new_one'|trans }}</a>
</p>
</div>
</div>
</div>
</div>
</div>
{% endblock %}

View file

@ -0,0 +1,53 @@
{% extends "WallabagCoreBundle::layout.html.twig" %}
{% block title %}{{ 'site_credential.page_title'|trans }}{% endblock %}
{% block content %}
<div class="row">
<div class="col s12">
<div class="card-panel">
<div class="row">
<div class="input-field col s12">
<h4>{{ 'site_credential.new_site_credential'|trans }}</h4>
<div id="set6" class="col s12">
{{ form_start(form) }}
{{ form_errors(form) }}
<div class="row">
<div class="input-field col s12">
{{ form_label(form.host) }}
{{ form_errors(form.host) }}
{{ form_widget(form.host) }}
</div>
</div>
<div class="row">
<div class="input-field col s12">
{{ form_label(form.username) }}
{{ form_errors(form.username) }}
{{ form_widget(form.username) }}
</div>
</div>
<div class="row">
<div class="input-field col s12">
{{ form_label(form.password) }}
{{ form_errors(form.password) }}
{{ form_widget(form.password) }}
</div>
</div>
{{ form_widget(form.save, {'attr': {'class': 'btn waves-effect waves-light'}}) }}
{{ form_rest(form) }}
</form>
<p><a class="waves-effect waves-light btn blue-grey" href="{{ path('site_credential_index') }}">{{ 'site_credential.form.back_to_list'|trans }}</a></p>
</div>
</div>
</div>
</div>
</div>
</div>
{% endblock %}