Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Issue 55 crear formulario de registro del meetup en easy admin #71

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
"dms/meetup-api-client": "^2.3",
"doctrine/doctrine-migrations-bundle": "^2.0",
"easycorp/easyadmin-bundle": "^2.1",
"friendsofsymfony/ckeditor-bundle": "^2.1",
"friendsofsymfony/ckeditor-bundle": "^2.2",
"google/recaptcha": "^1.2",
"gravatarphp/gravatar": "^2.0",
"jaybizzle/crawler-detect": "^1.2",
Expand Down Expand Up @@ -67,6 +67,7 @@
"scripts": {
"auto-scripts": {
"cache:clear": "symfony-cmd",
"ckeditor:install": "symfony-cmd",
"assets:install %PUBLIC_DIR%": "symfony-cmd"
},
"post-install-cmd": [
Expand Down
2 changes: 1 addition & 1 deletion composer.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

37 changes: 36 additions & 1 deletion config/packages/easy_admin.yaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,8 @@
easy_admin:
design:
form_theme:
- '@EasyAdmin/form/bootstrap_4.html.twig'
- '@FOSCKEditor/Form/ckeditor_widget.html.twig'
entities:
job:
class: App\Entity\Job
Expand Down Expand Up @@ -60,4 +64,35 @@ easy_admin:
- contact_name
- email
- description
- { property: 'imageFile', type: 'vich_image' }
- { property: 'imageFile', type: 'vich_image' }
meetup:
class: App\Entity\MeetupEvent
label: 'Meetup Events'
form:
fields:
- { type: 'section', label: 'Información General' }
- meetupId
- { property: 'scheduledAt', label: 'Fecha' }
- { property: 'title', label: 'Título' }
- { property: 'place', label: 'Lugar' }
- { property: 'description', type: 'fos_ckeditor', label: 'Descripción'}
- { property: 'attendingCount', label: 'Num. participantes'}
- { property: 'url', label: 'Url Meetup.com' }
- { property: 'imageFile', type: 'vich_image', label: 'Imagen de Portada'}
- { property: 'youtubeUrl', label: 'Url Youtube' }
- { property: 'twitterUrl', label: 'Url Twitter' }
- { property: 'facebookUrl', label: 'Url Facebook' }
- { property: 'slideUrl', label: 'Url Diapositivas' }
- { type: 'section', label: 'Información de Ponente' }
- { property: 'speaker', label: 'Ponente' }
- { property: 'speakerLinkedinUrl', label: 'Url Linkedin' }
- { property: 'speakerGitUrl', label: 'Url Git Personal' }
- { property: 'speakerTwitterUrl', label: 'Url Twitter' }
- { property: 'speakerFacebookUrl', label: 'Url Facebook' }
list:
fields:
- id
- scheduledAt
- title
- speaker
- { property: 'image', type: 'image', base_path: '%app.path.meetup_images%' }
3 changes: 3 additions & 0 deletions config/packages/vich_uploader.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,6 @@ vich_uploader:
sponsor_images:
uri_prefix: '%app.path.sponsor_images%'
upload_destination: '%kernel.project_dir%/public%app.path.sponsor_images%'
meetup_images:
uri_prefix: '%app.path.meetup_images%'
upload_destination: '%kernel.project_dir%/public%app.path.meetup_images%'
1 change: 1 addition & 0 deletions config/services.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ parameters:
google_recaptcha_site_key: '%env(GOOGLE_RECAPTCHA_SITE_KEY)%'
meetup_events_url: '%env(MEETUP_EVENTS_URL)%'
app.path.sponsor_images: /uploads/sponsors
app.path.meetup_images: /uploads/meetups

services:
# default configuration for services in *this* file
Expand Down
195 changes: 195 additions & 0 deletions src/Entity/MeetupEvent.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,15 @@
namespace App\Entity;

use App\Repository\MeetupEventRepository;
use DateTimeImmutable;
use DateTimeInterface;
use Doctrine\ORM\Mapping as ORM;
use Symfony\Component\HttpFoundation\File\File;
use Vich\UploaderBundle\Mapping\Annotation as Vich;

/**
* @ORM\Entity(repositoryClass=MeetupEventRepository::class)
* @Vich\Uploadable
*/
class MeetupEvent
{
Expand Down Expand Up @@ -63,6 +67,61 @@ class MeetupEvent
*/
private $image;

/**
* @Vich\UploadableField(mapping="meetup_images", fileNameProperty="image")
*/
private $imageFile;

/**
* @ORM\Column(type="string", length=255, nullable=true)
*/
private $youtubeUrl;

/**
* @ORM\Column(type="string", length=255, nullable=true)
*/
private $twitterUrl;

/**
* @ORM\Column(type="string", length=255, nullable=true)
*/
private $facebookUrl;

/**
* @ORM\Column(type="string", length=255, nullable=true)
*/
private $slideUrl;

/**
* @ORM\Column(type="string", length=255, nullable=true)
*/
private $speakerLinkedinUrl;

/**
* @ORM\Column(type="string", length=255, nullable=true)
*/
private $speakerGitUrl;

/**
* @ORM\Column(type="string", length=255, nullable=true)
*/
private $speakerTwitterUrl;

/**
* @ORM\Column(type="string", length=255, nullable=true)
*/
private $speakerFacebookUrl;

/**
* @ORM\Column(type="datetime", columnDefinition="TIMESTAMP DEFAULT CURRENT_TIMESTAMP")
*/
private $createdAt;

/**
* @ORM\Column(type="datetime", nullable=true)
*/
private $updatedAt;

public function getId(): ?int
{
return $this->id;
Expand Down Expand Up @@ -193,4 +252,140 @@ public function setImage(?string $image): self

return $this;
}

public function setImageFile(File $imageFile = null): self
{
$this->imageFile = $imageFile;

if ($imageFile) {
$this->updated_at = new DateTimeImmutable();
}

return $this;
}

public function getImageFile(): ?File
{
return $this->imageFile;
}

public function setYoutubeUrl(?string $youtubeUrl): self
{
$this->youtubeUrl = $youtubeUrl;

return $this;
}

public function getYoutubeUrl(): ?string
{
return $this->youtubeUrl;
}

public function setSpeakerLinkedinUrl(?string $linkedinUrl): self
{
$this->speakerLinkedinUrl = $linkedinUrl;

return $this;
}

public function getSpeakerLinkedinUrl(): ?string
{
return $this->speakerLinkedinUrl;
}

public function setSpeakerGitUrl(?string $gitUrl): self
{
$this->speakerGitUrl = $gitUrl;

return $this;
}

public function getSpeakerGitUrl(): ?string
{
return $this->speakerGitUrl;
}

public function setTwitterUrl(?string $twitterUrl): self
{
$this->twitterUrl = $twitterUrl;

return $this;
}

public function getTwitterUrl(): ?string
{
return $this->twitterUrl;
}

public function setFacebookUrl(?string $facebookUrl): self
{
$this->facebookUrl = $facebookUrl;

return $this;
}

public function getFacebookUrl(): ?string
{
return $this->facebookUrl;
}

public function setSlideUrl(?string $slideUrl): self
{
$this->slideUrl = $slideUrl;

return $this;
}

public function getSlideUrl(): ?string
{
return $this->slideUrl;
}

public function setSpeakerTwitterUrl(?string $speakerTwitterUrl): self
{
$this->speakerTwitterUrl = $speakerTwitterUrl;

return $this;
}

public function getSpeakerTwitterUrl(): ?string
{
return $this->speakerTwitterUrl;
}

public function setSpeakerFacebookUrl(?string $speakerFacebookUrl): self
{
$this->speakerFacebookUrl = $speakerFacebookUrl;

return $this;
}

public function getSpeakerFacebookUrl(): ?string
{
return $this->speakerFacebookUrl;
}

public function setCreatedAt(DateTimeInterface $createdAt): self
{
$this->createdAt = $createdAt;

return $this;
}

public function getCreatedAt(): ?DateTimeInterface
{
return $this->createdAt;
}

public function setUpdatedAt(DateTimeInterface $updatedAt): self
{
$this->updatedAt = $updatedAt;

return $this;
}

public function getUpdatedAt(): ?DateTimeInterface
{
return $this->updatedAt;
}
}
35 changes: 35 additions & 0 deletions src/Migrations/Version20201111230154.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
<?php

declare(strict_types=1);

namespace DoctrineMigrations;

use Doctrine\DBAL\Schema\Schema;
use Doctrine\Migrations\AbstractMigration;

/**
* Auto-generated Migration: Please modify to your needs!
*/
final class Version20201111230154 extends AbstractMigration
{
public function getDescription(): string
{
return '';
}

public function up(Schema $schema): void
{
// this up() migration is auto-generated, please modify it to your needs
$this->abortIf('mysql' !== $this->connection->getDatabasePlatform()->getName(), 'Migration can only be executed safely on \'mysql\'.');

$this->addSql('ALTER TABLE meetup_event ADD youtube_url VARCHAR(255) DEFAULT NULL, ADD twitter_url VARCHAR(255) DEFAULT NULL, ADD facebook_url VARCHAR(255) DEFAULT NULL, ADD slide_url VARCHAR(255) DEFAULT NULL, ADD speaker_linkedin_url VARCHAR(255) DEFAULT NULL, ADD speaker_git_url VARCHAR(255) DEFAULT NULL, ADD speaker_twitter_url VARCHAR(255) DEFAULT NULL, ADD speaker_facebook_url VARCHAR(255) DEFAULT NULL, ADD created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP, ADD updated_at DATETIME DEFAULT NULL');
}

public function down(Schema $schema): void
{
// this down() migration is auto-generated, please modify it to your needs
$this->abortIf('mysql' !== $this->connection->getDatabasePlatform()->getName(), 'Migration can only be executed safely on \'mysql\'.');

$this->addSql('ALTER TABLE meetup_event DROP youtube_url, DROP twitter_url, DROP facebook_url, DROP slide_url, DROP speaker_linkedin_url, DROP speaker_git_url, DROP speaker_twitter_url, DROP speaker_facebook_url, DROP created_at, DROP updated_at');
}
}