Skip to content

Commit

Permalink
hasta Voter inicio mas Entrada Base Usuario .AlamedaCMS
Browse files Browse the repository at this point in the history
  • Loading branch information
gerMdz authored and Gerardo Montivero committed May 9, 2020
1 parent 3ecbdb3 commit e2c251f
Show file tree
Hide file tree
Showing 32 changed files with 1,499 additions and 14 deletions.
250 changes: 250 additions & 0 deletions assets/css/styles.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,250 @@
body {
position: relative;
background: #efefee;
min-height: 45rem;
padding-bottom: 80px;
}

html {height:100%}

/* NAVIGATION */

.navbar-bg {
background: url('../images/cabecera_index.jpg');
background-size: 80%;
}

.dropdown-menu, .dropdown-menu.show {
right: 0;
}

.space-brand {
color: #fff;
font-weight: bold;
}

.nav-profile-img {
width: 50px;
border: 1px solid #fff;
}


/* LOGIN REGISTRATION */

.form-container {
border-left: 1px solid #ddd;
border-right: 1px solid #ddd;
border-bottom: 1px solid #ddd;
background: #fff;
}

.inactive {
border-color: lightgray lightgray lightgray;
background: darkgray;
color: #fff;
}

.nav-tabs .nav-link:focus, .nav-tabs .nav-link:hover {
color: #efefee;
}

/* ADVERTISEMENT */

.ad-space {
background: #fff;
border-radius: 5px;
border-top: 5px solid green;
}

.advertisement-img {
width: 150px;
height: auto;
border: 2px solid #efefee;
border-radius: 5px;
}

.advertisement-text {
font-weight: bold;
}

.quote-space {
background: #fff;
margin-top: 30px;
border-radius: 5px;
border-top: 5px solid hotpink;
}

/* ARTICLES */

.main-article {
border: 2px solid #efefee;
Background: #fff;
border-top-left-radius: 6px;
border-top-right-radius: 6px;
}

.main-article img {
width: 100%;
height: 250px;
border-top-right-radius: 5px;
border-top-left-radius: 5px;
border-top: 5px solid lightblue;
}

.article-container {
border: 1px solid #efefee;
border-top-left-radius: 5px;
border-bottom-left-radius: 5px;
background: #fff;
}

.main-article-link, .article-container a {
text-decoration: none;
color: #000;
}

.main-article-link:hover {
text-decoration: none;
color: #000;
}

.article-title {
min-width: 300px;

}

@media (max-width: 440px) {
.article-title {
min-width: 100px;
max-width: 245px;
}
}

.article-img {
height: 100px;
width: 100px;
border-top-left-radius: 5px;
border-bottom-left-radius: 5px;
}

.article-author-img {
height: 25px;
border: 1px solid darkgray;
}

.article-details {
font-size: .8em;
}

/* PROFILE */

.profile-img {
width: 150px;
height: auto;
border: 2px solid #fff;
}

.profile-name {
font-size: 1.5em;
}

.my-article-container {
background: #FFBC49;
border: solid 1px #efefee;
border-radius: 5px;
}


/* CREATE ARTICLE */

.create-article-container {
min-width: 400px;
background-color: lightblue;
border-radius: 5px;
}

/* ARTICLE SHOW PAGE */

.show-article-container {
width: 100%;
background-color: #fff;
}

.show-article-container.show-article-container-border-green {
border-top: 3px solid green;
border-radius: 3px;
}

.show-article-img {
width: 250px;
height: auto;
border-radius: 5px;
}

.show-article-title {
font-size: 2em;
}

.like-article, .like-article:hover {
color: red;
text-decoration: none;
}

@media (max-width: 991px) {
.show-article-title {
font-size: 1.5em;
}

.show-article-title-container {
max-width: 220px;
}
}

.article-text {
margin-top: 20px;
}

.share-icons i {
font-size: 1.5em;
}

.comment-container {
max-width: 600px;
}

.comment-img {
width: 50px;
height: auto;
border: 1px solid darkgray;
}

.commenter-name {
font-weight: bold;
}

.comment-form {
min-width: 500px;
}

@media (max-width: 767px) {
.comment-form {
min-width: 260px;
}
.comment-container {
max-width: 280px;
}
}



/* FOOTER */

.footer {
position: absolute;
bottom: 0;
width: 100%;
height: 60px; /* Set the fixed height of the footer here */
line-height: 60px; /* Vertically center the text there */
background-color: #fff;
margin-top: 10px;
}
33 changes: 33 additions & 0 deletions src/Controller/AdminEntradaController.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
<?php

namespace App\Controller;

use App\Entity\Entrada;
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
use Symfony\Component\Routing\Annotation\Route;

class AdminEntradaController extends AbstractController
{
/**
* @Route("/admin/entrada", name="admin_entrada")
*/
public function index()
{
// return $this->render('admin_entrada/index.html.twig', [
// 'controller_name' => 'AdminEntradaController',
// ]);
dd('acceso denegado');
}

/**
* @param Entrada $entrada
* @Route("admin/entrada/{id}/edit", name="admin_entrada_edit")
*/
public function edit(Entrada $entrada){

if ($entrada->getAutor() != $this->getUser() && !$this->isGranted('ROLE_ADMIN')) {
throw $this->createAccessDeniedException('No permitido');
}
dd($entrada);
}
}
94 changes: 94 additions & 0 deletions src/Controller/EntradaController.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,94 @@
<?php

namespace App\Controller;

use App\Entity\Entrada;
use App\Form\EntradaType;
use App\Repository\EntradaRepository;
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\HttpFoundation\Response;
use Symfony\Component\Routing\Annotation\Route;

/**
* @Route("/entrada")
*/
class EntradaController extends AbstractController
{
/**
* @Route("/", name="entrada_index", methods={"GET"})
*/
public function index(EntradaRepository $entradaRepository): Response
{
return $this->render('entrada/index.html.twig', [
'entradas' => $entradaRepository->findAll(),
]);
}

/**
* @Route("/new", name="entrada_new", methods={"GET","POST"})
*/
public function new(Request $request): Response
{
$entrada = new Entrada();
$form = $this->createForm(EntradaType::class, $entrada);
$form->handleRequest($request);

if ($form->isSubmitted() && $form->isValid()) {
$entityManager = $this->getDoctrine()->getManager();
$entityManager->persist($entrada);
$entityManager->flush();

return $this->redirectToRoute('entrada_index');
}

return $this->render('entrada/new.html.twig', [
'entrada' => $entrada,
'form' => $form->createView(),
]);
}

/**
* @Route("/{id}", name="entrada_show", methods={"GET"})
*/
public function show(Entrada $entrada): Response
{
return $this->render('entrada/show.html.twig', [
'entrada' => $entrada,
]);
}

/**
* @Route("/{id}/edit", name="entrada_edit", methods={"GET","POST"})
*/
public function edit(Request $request, Entrada $entrada): Response
{
$form = $this->createForm(EntradaType::class, $entrada);
$form->handleRequest($request);

if ($form->isSubmitted() && $form->isValid()) {
$this->getDoctrine()->getManager()->flush();

return $this->redirectToRoute('entrada_index');
}

return $this->render('entrada/edit.html.twig', [
'entrada' => $entrada,
'form' => $form->createView(),
]);
}

/**
* @Route("/{id}", name="entrada_delete", methods={"DELETE"})
*/
public function delete(Request $request, Entrada $entrada): Response
{
if ($this->isCsrfTokenValid('delete'.$entrada->getId(), $request->request->get('_token'))) {
$entityManager = $this->getDoctrine()->getManager();
$entityManager->remove($entrada);
$entityManager->flush();
}

return $this->redirectToRoute('entrada_index');
}
}
Loading

0 comments on commit e2c251f

Please sign in to comment.