From 24a0e52f380bc30efade6186c087818e0262d681 Mon Sep 17 00:00:00 2001 From: "R. Eric Wheeler" Date: Fri, 5 May 2017 22:49:54 -0700 Subject: [PATCH] Lots, sorry I forgot --- .gitattributes | 1 + app/AppKernel.php | 1 + .../FOSUserBundle/views/Group/edit.html.twig | 5 - .../views/Group/edit_content.html.twig | 8 - .../FOSUserBundle/views/Group/list.html.twig | 5 - .../views/Group/list_content.html.twig | 7 - .../FOSUserBundle/views/Group/new.html.twig | 5 - .../views/Group/new_content.html.twig | 8 - .../FOSUserBundle/views/Group/show.html.twig | 5 - .../views/Group/show_content.html.twig | 5 - .../views/Profile/edit.html.twig | 2 +- .../views/Profile/edit_content.html.twig | 24 +- .../views/Profile/show.html.twig | 2 +- .../views/Profile/show_content.html.twig | 30 +- .../views/Registration/check_email.html.twig | 7 - .../views/Registration/email.txt.twig | 13 - .../Registration/register_content.html.twig | 23 +- .../views/Resetting/email.txt.twig | 3 +- .../views/Security/login_content.html.twig | 7 +- .../views/Connect/connect_confirm.html.twig | 2 +- .../views/Connect/connect_success.html.twig | 12 +- .../views/Connect/login.html.twig | 20 +- .../views/Connect/registration.html.twig | 16 +- .../Connect/registration_success.html.twig | 13 +- .../HWIOAuthBundle/views/layout.html.twig | 12 - .../views/Exception/error.html.twig | 21 + .../views/Exception/error403.html.twig | 16 + .../views/Exception/error404.html.twig | 14 + .../views/Exception/error500.html.twig | 31 + app/Resources/views/base.html.twig | 74 ++- app/Resources/views/default/index.html.twig | 13 +- app/Resources/views/form/contact.html.twig | 30 +- app/Resources/views/form/token.html.twig | 33 - app/Resources/views/gallery_comment.html.twig | 15 + app/Resources/views/location.html.twig | 38 +- app/Resources/views/off_canvas.html.twig | 41 +- app/Resources/views/our_story.html.twig | 10 +- app/Resources/views/social_login.html.twig | 13 +- app/Resources/views/user/index.html.twig | 4 - app/Resources/views/user/logout.html.twig | 7 - .../views/user_registered.txt.twig.html.twig | 14 +- app/config/config.yml | 26 +- app/config/config_dev.yml | 11 + app/config/config_prod.yml | 34 +- app/config/easy_admin.yml | 42 +- app/config/routing.yml | 21 +- app/config/security.yml | 1 - app/config/services.yml | 16 +- build/images/yahoo2.svg | 3 + build/less/doughnut.less | 111 +++- composer.json | 3 +- email/doughnut_wedding.html | 599 +++++++++++------- .../Controller/DefaultController.php | 40 +- .../Controller/GalleryController.php | 217 ++++++- .../Controller/RsvpController.php | 163 ----- .../DoughnutWeddingBundle/Entity/Contact.php | 89 +-- .../DoughnutWeddingBundle/Entity/Image.php | 237 ++++--- .../Entity/ImageComment.php | 82 ++- .../DoughnutWeddingBundle/Entity/Rsvp.php | 9 +- .../DoughnutWeddingBundle/Entity/User.php | 320 ++++++---- ...hatEmailAndUserNameExistOnResetRequest.php | 40 +- .../NeedToAuthenticateListenerEvent.php | 69 +- .../RedirectFromHwiConnectPageEvent.php | 74 +++ .../RedirectOnUserRegisterListener.php | 107 +++- .../UserRedirectOnLoggedInListener.php | 5 +- .../GoogleCloudStorageServiceFactory.php | 70 +- .../Form/ChangePasswordFormType.php | 43 +- .../Form/ContactFormType.php | 90 ++- .../Form/GalleryUploadType.php | 85 ++- .../Form/ProfileEditType.php | 52 +- .../Form/RegistrationType.php | 19 +- .../Pager/View/UIkitTemplate.php | 174 +++++ .../Repository/ContactRepository.php | 20 +- .../Repository/ImageCategoryRepository.php | 20 +- .../Repository/ImageCommentRepository.php | 20 +- .../Repository/ImageRepository.php | 63 +- .../Repository/ImageTagRepository.php | 20 +- .../Resources/views/Image/index.html.twig | 147 ++++- .../Resources/views/Image/upload.html.twig | 64 +- .../views/Image/view_image.html.twig | 123 ++++ .../Security/AccessDeniedHandler.php | 41 +- 81 files changed, 2761 insertions(+), 1219 deletions(-) delete mode 100644 app/Resources/FOSUserBundle/views/Group/edit.html.twig delete mode 100644 app/Resources/FOSUserBundle/views/Group/edit_content.html.twig delete mode 100644 app/Resources/FOSUserBundle/views/Group/list.html.twig delete mode 100644 app/Resources/FOSUserBundle/views/Group/list_content.html.twig delete mode 100644 app/Resources/FOSUserBundle/views/Group/new.html.twig delete mode 100644 app/Resources/FOSUserBundle/views/Group/new_content.html.twig delete mode 100644 app/Resources/FOSUserBundle/views/Group/show.html.twig delete mode 100644 app/Resources/FOSUserBundle/views/Group/show_content.html.twig delete mode 100644 app/Resources/FOSUserBundle/views/Registration/check_email.html.twig delete mode 100644 app/Resources/FOSUserBundle/views/Registration/email.txt.twig delete mode 100644 app/Resources/HWIOAuthBundle/views/layout.html.twig create mode 100644 app/Resources/TwigBundle/views/Exception/error.html.twig create mode 100644 app/Resources/TwigBundle/views/Exception/error403.html.twig create mode 100644 app/Resources/TwigBundle/views/Exception/error404.html.twig create mode 100644 app/Resources/TwigBundle/views/Exception/error500.html.twig delete mode 100644 app/Resources/views/form/token.html.twig create mode 100644 app/Resources/views/gallery_comment.html.twig delete mode 100644 app/Resources/views/user/index.html.twig delete mode 100644 app/Resources/views/user/logout.html.twig create mode 100644 build/images/yahoo2.svg delete mode 100644 src/Sikofitt/DoughnutWeddingBundle/Controller/RsvpController.php create mode 100644 src/Sikofitt/DoughnutWeddingBundle/EventListener/RedirectFromHwiConnectPageEvent.php create mode 100644 src/Sikofitt/DoughnutWeddingBundle/Pager/View/UIkitTemplate.php create mode 100644 src/Sikofitt/DoughnutWeddingBundle/Resources/views/Image/view_image.html.twig diff --git a/.gitattributes b/.gitattributes index 1b23cea..7af8979 100644 --- a/.gitattributes +++ b/.gitattributes @@ -27,3 +27,4 @@ build/images/favicon.png filter=lfs diff=lfs merge=lfs -text build/images/home_photo_1.jpg filter=lfs diff=lfs merge=lfs -text build/images/home_photo_2.jpg filter=lfs diff=lfs merge=lfs -text build/images/location.jpg filter=lfs diff=lfs merge=lfs -text +build/images/yahoo2.svg filter=lfs diff=lfs merge=lfs -text diff --git a/app/AppKernel.php b/app/AppKernel.php index dc96687..e3d2275 100644 --- a/app/AppKernel.php +++ b/app/AppKernel.php @@ -41,6 +41,7 @@ class AppKernel extends Kernel new Vich\UploaderBundle\VichUploaderBundle(), new JavierEguiluz\Bundle\EasyAdminBundle\EasyAdminBundle(), new Sikofitt\DoughnutWeddingBundle\SikofittDoughnutWeddingBundle(), + new WhiteOctober\PagerfantaBundle\WhiteOctoberPagerfantaBundle(), ]; if (in_array($this->getEnvironment(), ['dev', 'test'], true)) { diff --git a/app/Resources/FOSUserBundle/views/Group/edit.html.twig b/app/Resources/FOSUserBundle/views/Group/edit.html.twig deleted file mode 100644 index f1caa9f..0000000 --- a/app/Resources/FOSUserBundle/views/Group/edit.html.twig +++ /dev/null @@ -1,5 +0,0 @@ -{% extends "@FOSUser/layout.html.twig" %} - -{% block fos_user_content %} -{% include "@FOSUser/Group/edit_content.html.twig" %} -{% endblock fos_user_content %} diff --git a/app/Resources/FOSUserBundle/views/Group/edit_content.html.twig b/app/Resources/FOSUserBundle/views/Group/edit_content.html.twig deleted file mode 100644 index 5fcce27..0000000 --- a/app/Resources/FOSUserBundle/views/Group/edit_content.html.twig +++ /dev/null @@ -1,8 +0,0 @@ -{% trans_default_domain 'FOSUserBundle' %} - -{{ form_start(form, { 'action': path('fos_user_group_edit', {'groupName': group_name}), 'attr': { 'class': 'fos_user_group_edit' } }) }} - {{ form_widget(form) }} -
- -
-{{ form_end(form) }} diff --git a/app/Resources/FOSUserBundle/views/Group/list.html.twig b/app/Resources/FOSUserBundle/views/Group/list.html.twig deleted file mode 100644 index 9371b1b..0000000 --- a/app/Resources/FOSUserBundle/views/Group/list.html.twig +++ /dev/null @@ -1,5 +0,0 @@ -{% extends "@FOSUser/layout.html.twig" %} - -{% block fos_user_content %} -{% include "@FOSUser/Group/list_content.html.twig" %} -{% endblock fos_user_content %} diff --git a/app/Resources/FOSUserBundle/views/Group/list_content.html.twig b/app/Resources/FOSUserBundle/views/Group/list_content.html.twig deleted file mode 100644 index 04f09c0..0000000 --- a/app/Resources/FOSUserBundle/views/Group/list_content.html.twig +++ /dev/null @@ -1,7 +0,0 @@ -
- -
diff --git a/app/Resources/FOSUserBundle/views/Group/new.html.twig b/app/Resources/FOSUserBundle/views/Group/new.html.twig deleted file mode 100644 index 93c4fd9..0000000 --- a/app/Resources/FOSUserBundle/views/Group/new.html.twig +++ /dev/null @@ -1,5 +0,0 @@ -{% extends "@FOSUser/layout.html.twig" %} - -{% block fos_user_content %} -{% include "@FOSUser/Group/new_content.html.twig" %} -{% endblock fos_user_content %} diff --git a/app/Resources/FOSUserBundle/views/Group/new_content.html.twig b/app/Resources/FOSUserBundle/views/Group/new_content.html.twig deleted file mode 100644 index 20d0e67..0000000 --- a/app/Resources/FOSUserBundle/views/Group/new_content.html.twig +++ /dev/null @@ -1,8 +0,0 @@ -{% trans_default_domain 'FOSUserBundle' %} - -{{ form_start(form, { 'action': path('fos_user_group_new'), 'attr': { 'class': 'fos_user_group_new' } }) }} - {{ form_widget(form) }} -
- -
-{{ form_end(form) }} diff --git a/app/Resources/FOSUserBundle/views/Group/show.html.twig b/app/Resources/FOSUserBundle/views/Group/show.html.twig deleted file mode 100644 index f63136e..0000000 --- a/app/Resources/FOSUserBundle/views/Group/show.html.twig +++ /dev/null @@ -1,5 +0,0 @@ -{% extends "@FOSUser/layout.html.twig" %} - -{% block fos_user_content %} -{% include "@FOSUser/Group/show_content.html.twig" %} -{% endblock fos_user_content %} diff --git a/app/Resources/FOSUserBundle/views/Group/show_content.html.twig b/app/Resources/FOSUserBundle/views/Group/show_content.html.twig deleted file mode 100644 index 528b021..0000000 --- a/app/Resources/FOSUserBundle/views/Group/show_content.html.twig +++ /dev/null @@ -1,5 +0,0 @@ -{% trans_default_domain 'FOSUserBundle' %} - -
-

{{ 'group.show.name'|trans }}: {{ group.getName() }}

-
diff --git a/app/Resources/FOSUserBundle/views/Profile/edit.html.twig b/app/Resources/FOSUserBundle/views/Profile/edit.html.twig index 5aa007b..3ca5ea4 100644 --- a/app/Resources/FOSUserBundle/views/Profile/edit.html.twig +++ b/app/Resources/FOSUserBundle/views/Profile/edit.html.twig @@ -1,5 +1,5 @@ {% extends "base.html.twig" %} - +{% block title %}Edit Profile{% endblock title %} {% block body %} {% include "@FOSUser/Profile/edit_content.html.twig" %} {% endblock body %} diff --git a/app/Resources/FOSUserBundle/views/Profile/edit_content.html.twig b/app/Resources/FOSUserBundle/views/Profile/edit_content.html.twig index 106a91b..338544f 100644 --- a/app/Resources/FOSUserBundle/views/Profile/edit_content.html.twig +++ b/app/Resources/FOSUserBundle/views/Profile/edit_content.html.twig @@ -1,26 +1,28 @@ {% trans_default_domain 'FOSUserBundle' %} -{% if form.vars.errors is not empty %} -
- {{ form_errors(form) }} -
-{% endif %} + +{{ form_errors(form) }} + + {{ form_start(form, { 'action': path('fos_user_profile_edit'), 'attr': { 'class': 'uk-form-horizontal fos_user_profile_edit' } }) }} {{ form_label(form.email) }}
+ {{ form_errors(form.email) }} {{ form_widget(form.email) }}
{{ form_label(form.name) }}
+ {{ form_errors(form.name) }} {{ form_widget(form.name) }}
-{{ form_label(form.rsvp) }} -
- {{ form_widget(form.rsvp) }} -
+ {{ form_label(form.rsvp) }} +
+ {{ form_errors(form.rsvp) }} + {{ form_widget(form.rsvp) }} +
-
- +
+
Cancel diff --git a/app/Resources/FOSUserBundle/views/Profile/show.html.twig b/app/Resources/FOSUserBundle/views/Profile/show.html.twig index 3e1f355..9170cb2 100644 --- a/app/Resources/FOSUserBundle/views/Profile/show.html.twig +++ b/app/Resources/FOSUserBundle/views/Profile/show.html.twig @@ -1,5 +1,5 @@ {% extends "base.html.twig" %} - +{% block title %}Profile{% endblock title %} {% block body %} {% include "@FOSUser/Profile/show_content.html.twig" %} {% endblock body %} diff --git a/app/Resources/FOSUserBundle/views/Profile/show_content.html.twig b/app/Resources/FOSUserBundle/views/Profile/show_content.html.twig index a00d8d8..ba3f161 100644 --- a/app/Resources/FOSUserBundle/views/Profile/show_content.html.twig +++ b/app/Resources/FOSUserBundle/views/Profile/show_content.html.twig @@ -1,5 +1,6 @@ {% trans_default_domain 'SikofittDoughnutweddingBundle' %} -

User Information

+ +

User Information

@@ -19,18 +20,25 @@ -
+
    -
  • - -
  • -
  • -
  • -
  • -
  • - -
  • +
  • {% set serviceActiveClass ='' %} + {% if user.facebookid is not null %}{% set serviceActiveClass ='uk-icon-facebook' %}{% endif %} + +
  • {% set serviceActiveClass='' %} +
  • {% if user.googleid is not null %}{% set serviceActiveClass ='uk-icon-google' %}{% endif %} + +
  • {% set serviceActiveClass='' %} +
  • {% if user.twitterid is not null %}{% set serviceActiveClass ='uk-icon-twitter' %}{% endif %} + +
  • {% set serviceActiveClass='' %} +
  • {% if user.yahooid is not null %}{% set serviceActiveClass = 'uk-icon-yahoo' %}{% endif %} + +
  • {% set serviceActiveClass='' %} +
  • {% if user.amazonid is not null %}{% set serviceActiveClass = 'uk-icon-amazon' %}{% endif %} + +
  • {% set serviceActiveClass='' %}
{{ 'profile.member_since'|trans({'%date%':user.created|date('l F jS, Y (h:i a)')}) }}
diff --git a/app/Resources/FOSUserBundle/views/Registration/check_email.html.twig b/app/Resources/FOSUserBundle/views/Registration/check_email.html.twig deleted file mode 100644 index 41af21d..0000000 --- a/app/Resources/FOSUserBundle/views/Registration/check_email.html.twig +++ /dev/null @@ -1,7 +0,0 @@ -{% extends "@FOSUser/layout.html.twig" %} - -{% trans_default_domain 'FOSUserBundle' %} - -{% block fos_user_content %} -

{{ 'registration.check_email'|trans({'%email%': user.email}) }}

-{% endblock fos_user_content %} diff --git a/app/Resources/FOSUserBundle/views/Registration/email.txt.twig b/app/Resources/FOSUserBundle/views/Registration/email.txt.twig deleted file mode 100644 index acbc685..0000000 --- a/app/Resources/FOSUserBundle/views/Registration/email.txt.twig +++ /dev/null @@ -1,13 +0,0 @@ -{% trans_default_domain 'FOSUserBundle' %} -{% block subject %} -{%- autoescape false -%} -{{ 'registration.email.subject'|trans({'%username%': user.username, '%confirmationUrl%': confirmationUrl}) }} -{%- endautoescape -%} -{% endblock %} - -{% block body_text %} -{% autoescape false %} -{{ 'registration.email.message'|trans({'%username%': user.username, '%confirmationUrl%': confirmationUrl}) }} -{% endautoescape %} -{% endblock %} -{% block body_html %}{% endblock %} diff --git a/app/Resources/FOSUserBundle/views/Registration/register_content.html.twig b/app/Resources/FOSUserBundle/views/Registration/register_content.html.twig index ab49e49..8f5d2eb 100644 --- a/app/Resources/FOSUserBundle/views/Registration/register_content.html.twig +++ b/app/Resources/FOSUserBundle/views/Registration/register_content.html.twig @@ -1,6 +1,19 @@ {% trans_default_domain 'FOSUserBundle' %} -
+{% set show_social = false %} + {{ form_errors(form) }} + +{% set ownerCount = hwi_oauth_resource_owners()|length %} + +
+
+ Connect with : +
+ {% for owner in hwi_oauth_resource_owners() %} + + {% endfor %}
{{ form_start(form, {'method': 'post', 'action': path('fos_user_registration_register'), 'attr': {'class': 'fos_user_registration_register uk-form'}}) }} @@ -11,9 +24,10 @@
+ {{ form_errors(form.email) }} {{ form_widget(form.email, { 'attr': {'placeholder':'Email address', 'class':'uk-input uk-form-large uk-padding-small'} }) }}
-
+
@@ -28,6 +42,7 @@ {{ form_errors(form.rsvp) }} {{ form_widget(form.rsvp) }}
+
@@ -50,8 +65,8 @@
-
- +
+
Already have an account? Login here.
diff --git a/app/Resources/FOSUserBundle/views/Resetting/email.txt.twig b/app/Resources/FOSUserBundle/views/Resetting/email.txt.twig index caa4724..0435679 100644 --- a/app/Resources/FOSUserBundle/views/Resetting/email.txt.twig +++ b/app/Resources/FOSUserBundle/views/Resetting/email.txt.twig @@ -21,4 +21,5 @@ Katrina and Eric ❤ {% endautoescape %} {% endblock %} -{% block body_html %}{% endblock %} +{% block body_html %} +{% endblock %} diff --git a/app/Resources/FOSUserBundle/views/Security/login_content.html.twig b/app/Resources/FOSUserBundle/views/Security/login_content.html.twig index d581f6c..2fef661 100644 --- a/app/Resources/FOSUserBundle/views/Security/login_content.html.twig +++ b/app/Resources/FOSUserBundle/views/Security/login_content.html.twig @@ -8,6 +8,9 @@ {% if csrf_token %} {% endif %} +
@@ -23,9 +26,9 @@
-
+
- +
diff --git a/app/Resources/HWIOAuthBundle/views/Connect/connect_confirm.html.twig b/app/Resources/HWIOAuthBundle/views/Connect/connect_confirm.html.twig index b68c38c..b97e496 100644 --- a/app/Resources/HWIOAuthBundle/views/Connect/connect_confirm.html.twig +++ b/app/Resources/HWIOAuthBundle/views/Connect/connect_confirm.html.twig @@ -1,5 +1,5 @@ {% extends 'base.html.twig' %} - +{% block title %}Register with {{ service }}{% endblock title %} {% block body %}

{{ 'header.connecting' | trans({}, 'HWIOAuthBundle')}}

diff --git a/app/Resources/HWIOAuthBundle/views/Connect/connect_success.html.twig b/app/Resources/HWIOAuthBundle/views/Connect/connect_success.html.twig index 0d1f7cf..b72cdff 100644 --- a/app/Resources/HWIOAuthBundle/views/Connect/connect_success.html.twig +++ b/app/Resources/HWIOAuthBundle/views/Connect/connect_success.html.twig @@ -1,5 +1,9 @@ -{% extends 'HWIOAuthBundle::layout.html.twig' %} +{% extends 'base.html.twig' %} -{% block hwi_oauth_content %} -

{{ 'header.success' | trans({'%name%': userInformation.realName}, 'HWIOAuthBundle') }}

-{% endblock hwi_oauth_content %} +{% block title %}Connected account with {{ userInformation.resourceOwner.name }}{% endblock title %} +{% block body %} +

Connected account with {{ userInformation.resourceOwner.name }}

+

+ Go to your profile +

+{% endblock body %} diff --git a/app/Resources/HWIOAuthBundle/views/Connect/login.html.twig b/app/Resources/HWIOAuthBundle/views/Connect/login.html.twig index 0310aa5..9d834f6 100644 --- a/app/Resources/HWIOAuthBundle/views/Connect/login.html.twig +++ b/app/Resources/HWIOAuthBundle/views/Connect/login.html.twig @@ -1,11 +1,17 @@ -{% extends 'HWIOAuthBundle::layout.html.twig' %} - -{% block hwi_oauth_content %} - +{% extends 'base.html.twig' %} +{% block title %}Connect with your social media accounts{% endblock title %} +{% block body %} {% if error is defined and error %} - {{ error }} +
+ +

{{ error }}

+
{% endif %} +
{% for owner in hwi_oauth_resource_owners() %} - {{ owner | trans({}, 'HWIOAuthBundle') }}
+ {% endfor %} -{% endblock hwi_oauth_content %} +
+{% endblock body %} diff --git a/app/Resources/HWIOAuthBundle/views/Connect/registration.html.twig b/app/Resources/HWIOAuthBundle/views/Connect/registration.html.twig index 3a9cc6c..de5c3ac 100644 --- a/app/Resources/HWIOAuthBundle/views/Connect/registration.html.twig +++ b/app/Resources/HWIOAuthBundle/views/Connect/registration.html.twig @@ -37,27 +37,33 @@ {{ form_start(form, {'action': path('hwi_oauth_connect_registration', {'key': key}), 'attr': {'class': 'hwi_oauth_registration_register uk-form uk-form-horizontal'}}) }} {{ form_label(form.name, 'Name', {'label_attr':{'class':'uk-form-label uk-visible@m'}}) }}
- {{ form_widget(form.name, {'value': name,'attr':{'class':'uk-input uk-form-large', 'placeholder':'Your name'}}) }} + {{ form_errors(form.name) }} + {{ form_widget(form.name, {'value': name,'attr':{'class':'uk-input uk-form-large', 'placeholder':'Your name'}}) }}
{{ form_label(form.email, 'Email address', {'label_attr':{'class':'uk-form-label uk-visible@m'}}) }}
- {{ form_widget(form.email, {'attr':{'class':'uk-input uk-form-large', 'placeholder':'Email address'}}) }} + {{ form_errors(form.email) }} + {{ form_widget(form.email, {'attr':{'class':'uk-input uk-form-large', 'placeholder':'Email address'}}) }}
{{ form_label(form.plainPassword.first, 'Password', {'label_attr':{'class':'uk-form-label uk-visible@m'}}) }}
- {{ form_widget(form.plainPassword.first, {'attr':{'class':'uk-input uk-form-large', 'placeholder':'Create password'}}) }} + {{ form_errors(form.plainPassword.first) }} + {{ form_widget(form.plainPassword.first, {'attr':{'class':'uk-input uk-form-large', 'placeholder':'Create password'}}) }}
{{ form_label(form.plainPassword.second, 'Repeat password', {'label_attr':{'class':'uk-form-label uk-visible@m'}}) }}
+ {{ form_errors(form.plainPassword.second) }} {{ form_widget(form.plainPassword.second, {'attr':{'class':'uk-input uk-form-large', 'placeholder':'Repeat password'}}) }}
{{ form_label(form.rsvp, 'Number of guests? (including yourself)', {'label_attr':{'class':'uk-form-label uk-visible@m'}}) }}
- {{ form_widget(form.rsvp, {'attr':{'placeholder':'Guest\'s including yourself.'}}) }} + {{ form_errors(form.rsvp) }} + {{ form_widget(form.rsvp, {'attr':{'placeholder':'Number of guests including yourself.'}}) }}
{{ form_label(form.comment) }}
- {{ form_widget(form.comment) }} + {{ form_errors(form.comment) }} + {{ form_widget(form.comment) }}
diff --git a/app/Resources/HWIOAuthBundle/views/Connect/registration_success.html.twig b/app/Resources/HWIOAuthBundle/views/Connect/registration_success.html.twig index c0764b4..3bede4f 100644 --- a/app/Resources/HWIOAuthBundle/views/Connect/registration_success.html.twig +++ b/app/Resources/HWIOAuthBundle/views/Connect/registration_success.html.twig @@ -1,5 +1,8 @@ -{% extends 'HWIOAuthBundle::layout.html.twig' %} - -{% block hwi_oauth_content %} -

{{ 'header.registration_success' | trans({'%username%': app.user.username}, 'HWIOAuthBundle') }}

-{% endblock hwi_oauth_content %} +{% extends 'base.html.twig' %} +{% block title %}Successfully Registered with {{ userInformation.resourceOwner.name }}.{% endblock title %} +{% block body %} +

{{ 'header.registration_success' | trans({'%username%': app.user.username}, 'HWIOAuthBundle') }}

+

+ Go to your profile +

+{% endblock body %} diff --git a/app/Resources/HWIOAuthBundle/views/layout.html.twig b/app/Resources/HWIOAuthBundle/views/layout.html.twig deleted file mode 100644 index d23b61e..0000000 --- a/app/Resources/HWIOAuthBundle/views/layout.html.twig +++ /dev/null @@ -1,12 +0,0 @@ - - - - - - -
- {% block hwi_oauth_content %} - {% endblock hwi_oauth_content %} -
- - diff --git a/app/Resources/TwigBundle/views/Exception/error.html.twig b/app/Resources/TwigBundle/views/Exception/error.html.twig new file mode 100644 index 0000000..c5950c1 --- /dev/null +++ b/app/Resources/TwigBundle/views/Exception/error.html.twig @@ -0,0 +1,21 @@ +{% extends 'base.html.twig' %} +{% block title %}Error {{ status_code }} {{ status_text }}{% endblock title %} +{% block debug %}{{ dump() }}{% endblock debug %} +{% block body %} + +

+ {{ status_code|replace({0:''})|raw }} +

+
+
+

{{ status_text }}

+

+ Sorry about that. I tried to get the page {{ app.request.requestUri }} but it told me {{ status_text }}. +

+

+ I don't know what this means because it's not a 1 or a 0, but I sent an email with the error details to my owner and I'm sure they'll get right on it. +

+

The best I can do right now is redirect you to the home page.

+
+ +{% endblock body %} diff --git a/app/Resources/TwigBundle/views/Exception/error403.html.twig b/app/Resources/TwigBundle/views/Exception/error403.html.twig new file mode 100644 index 0000000..880bd12 --- /dev/null +++ b/app/Resources/TwigBundle/views/Exception/error403.html.twig @@ -0,0 +1,16 @@ +{% extends 'base.html.twig' %} +{% block title %}Error {{ status_code }} {{ status_text }}{% endblock title %} +{% block body %} + +

+ 43 +

+
+
+

+ So it turns out I can't give you access to this page. Sorry about that. +

+

The best I can do is redirect you to the home page.

+
+ +{% endblock body %} \ No newline at end of file diff --git a/app/Resources/TwigBundle/views/Exception/error404.html.twig b/app/Resources/TwigBundle/views/Exception/error404.html.twig new file mode 100644 index 0000000..e0c37f6 --- /dev/null +++ b/app/Resources/TwigBundle/views/Exception/error404.html.twig @@ -0,0 +1,14 @@ +{% extends 'base.html.twig' %} +{% block title %}Error {{ status_code }} {{ status_text }}{% endblock title %} +{% block body %} + +

+ 44 +

+
+
+

I wish the page '{{ app.request.requestUri }}' existed, I really do. Unfortunately it does not.

+

The best I can do is redirect you to the home page.

+
+ +{% endblock body %} \ No newline at end of file diff --git a/app/Resources/TwigBundle/views/Exception/error500.html.twig b/app/Resources/TwigBundle/views/Exception/error500.html.twig new file mode 100644 index 0000000..b364c28 --- /dev/null +++ b/app/Resources/TwigBundle/views/Exception/error500.html.twig @@ -0,0 +1,31 @@ +{% extends 'base.html.twig' %} +{% block title %}Error {{ status_code }} {{ status_text }}{% endblock title %} +{% block body %} +

+ What did you do!! Just kidding .. +

+

+ 5 +

+

+ +

+
+
+

+ Nothing is more intolerable than to have to admit to yourself your own errors. +

+
Ludwig van Beethoven
+
+ +

+ A message has been sent with the details of the error.
+ We will fix it as soon as possible. +

+

+ Sorry for any inconvenience caused. +

+

+ Go to the home page +

+{% endblock body %} \ No newline at end of file diff --git a/app/Resources/views/base.html.twig b/app/Resources/views/base.html.twig index 9053a5c..08997c9 100644 --- a/app/Resources/views/base.html.twig +++ b/app/Resources/views/base.html.twig @@ -1,27 +1,38 @@ {% if form is defined %} {% form_theme form with [_self, 'form_errors.html.twig'] %} {% endif %} + +{% set bucket = 'https://storage.googleapis.com/zgluzzkwodfky2m0ytbhmjhmmzqzntq2ngy3ndjmntyxmzg4' %} {% block title %}{% endblock title %}{% if app.request.requestUri != '/' %} | {% endif %}♥ Doughnut Wedding - + + + + + + + - - + + {% block stylesheets %}{% endblock %} {% block javascripts %}{% endblock %} +{% if app.request.requestUri == path('sikofitt_doughnutwedding_default_index') %} +
+
+ +
+{% endif %} {% block debug %} - {% if app.request.requestUri != '/' %} - {# dump(app.request.requestUri) #} - {% endif %} {% endblock %}
@@ -32,6 +43,8 @@ {% if is_granted('IS_AUTHENTICATED_FULLY') %}
  • {{ app.user.name }}
  • |
    +
  • Upload a photo
  • +
    |
  • Logout
  • {% else %}
  • Login
  • @@ -41,9 +54,9 @@
    -
    + diff --git a/app/Resources/views/default/index.html.twig b/app/Resources/views/default/index.html.twig index 2679323..1f9fc4d 100644 --- a/app/Resources/views/default/index.html.twig +++ b/app/Resources/views/default/index.html.twig @@ -8,7 +8,7 @@
    @@ -47,11 +47,16 @@

    - Watch us tie the knot on Facebook! We know many of you wont be here in person. so we'll be broadcasting the ceremony live. Join our wedding group on Facebook and you'll be able to see the doughnut festivities as they happen! + Watch us tie the knot on Facebook or Instagram! We know many of you wont be here in person. so we'll be broadcasting the ceremony live. Join our wedding group on Facebook or follow us on Instagram and you'll be able to see the doughnut festivities as they happen!

    - + + +
    {% endblock %} diff --git a/app/Resources/views/form/contact.html.twig b/app/Resources/views/form/contact.html.twig index d9eb72c..9aab8c6 100644 --- a/app/Resources/views/form/contact.html.twig +++ b/app/Resources/views/form/contact.html.twig @@ -2,8 +2,8 @@ {% block title %}Get in touch{% endblock title %} {% block body %}

    Get in touch

    -

    - We'd LOVE to hear from you! Send us your wishes, thoughts, advice or questions. +

    + We'd LOVE to hear from you!
    Send us your wishes, thoughts, advice, stories or questions.

    {% if(form is defined) %} {{ form_errors(form) }} @@ -30,9 +30,19 @@ {{ form_errors(form.comment) }} {{ form_widget(form.comment) }}
    -
    +
    +
    {{ form_widget(form.submit) }}
    +
    +

    + #doughnutwedding +

    +

    + Follow us on Instagram and Facebook for wedding updates! +

    +
    +
    {{ form_rest(form) }} {{ form_end(form) }} {% else %} @@ -43,17 +53,19 @@ {% if message|length > 1 %}

    {{ message|last }}

    {% endif %} +

    + #doughnutwedding +

    +

    + Follow us on Instagram and Facebook for wedding updates! +

    Go to the home page

    + {% endif %} -

    - #doughnutwedding -

    -

    - Follow us on Instagram and Facebook for wedding updates! -

    + {% endblock %} \ No newline at end of file diff --git a/app/Resources/views/form/token.html.twig b/app/Resources/views/form/token.html.twig deleted file mode 100644 index bc359f2..0000000 --- a/app/Resources/views/form/token.html.twig +++ /dev/null @@ -1,33 +0,0 @@ -{% extends 'base.html.twig' %} -{% block body %} - {{ dump(app.session.get('user')) }} - {{ form_start(form) }} -
    - Enter Token -
    -
    -
    - {{ form_row(form.user_token) }} -
    -
    - {{ form_row(form.submit) }} -
    -
    -
    -
    -

    - You can also send a new auto login link to your email. -

    -
    -
    - {{ form_row(form.email) }} -
    -
    - {{ form_row(form.update_token) }} -
    -
    -
    - {{ form_rest(form) }} -
    - {{ form_end(form) }} -{% endblock %} \ No newline at end of file diff --git a/app/Resources/views/gallery_comment.html.twig b/app/Resources/views/gallery_comment.html.twig new file mode 100644 index 0000000..858f851 --- /dev/null +++ b/app/Resources/views/gallery_comment.html.twig @@ -0,0 +1,15 @@ +
  • +
    +
    +
    +

    {{ comment.user.name }} | {{ comment.created|date('m/d/y') }} at {{ comment.created|date('g:ia') }}

    +
    +
    +
    +

    {{ comment.comment }}

    +
    +
    +
  • +
  • +

    +
  • diff --git a/app/Resources/views/location.html.twig b/app/Resources/views/location.html.twig index ec5ddc7..ff1344e 100644 --- a/app/Resources/views/location.html.twig +++ b/app/Resources/views/location.html.twig @@ -23,14 +23,16 @@ {% endblock %} {% block body %}
    -

    Our Doughnut Wedding

    +

    Our Doughnut Wedding

    - +
    +

    Wedding

    +

    The ceremony will begin at 2pm at Voodoo Doughnut Too -- located where Sandy, Davis and 15th meet. The shop is just across the street from Portland's famous @@ -38,11 +40,33 @@ but street parking is easy to find. We'll be serving Voodoo Doughnuts and coffee immediately after the ceremony.

    -

    Voodoo Doughnut Too

    -

    1501 NE Davis St.
    Portland, Oregon

    -

    - CHECK OUT THE DOUGHNUTS +

    Reception

    +

    + A reception will be held at the Bar Bar patio from 4pm to 7pm. Street parking is available.

    +
    +

    +
    +
    +
    +

    Voodoo Doughnut Too

    +

    1501 NE Davis St.
    Portland, Oregon + (Map) +

    +

    + Check Out The Doughnuts! +

    +
    +
    +

    Bar Bar

    +

    3939 N. Mississippi Ave.
    Portland, Oregon + (Map) +

    +

    + Check Out Bar Bar! +

    +
    +

    Directions

    @@ -61,7 +85,7 @@ Continue on OR-99E N/SE Grand Ave. Drive to NE Davis St.

    - Open in Google Maps + Open in Google Maps

    diff --git a/app/Resources/views/off_canvas.html.twig b/app/Resources/views/off_canvas.html.twig index d490e44..189f180 100644 --- a/app/Resources/views/off_canvas.html.twig +++ b/app/Resources/views/off_canvas.html.twig @@ -1,12 +1,12 @@ -
    +
    - +
    • Navigation
    • Home
    • Our Story
    • -
    • RSVP
    • +
    • RSVP
    • Gallery
    • Location
    • Get In Touch
    • @@ -16,7 +16,7 @@
    • {{ app.user.name }}
    • Profile
    • -
    • Change password
    • +
    • Change Password
    • Logout
    • {% else %}
    • User
    • @@ -28,13 +28,32 @@
    • {{ social_prefix }}

      -
    • diff --git a/app/Resources/views/our_story.html.twig b/app/Resources/views/our_story.html.twig index 803aa71..3867259 100644 --- a/app/Resources/views/our_story.html.twig +++ b/app/Resources/views/our_story.html.twig @@ -1,9 +1,13 @@ {% extends 'base.html.twig' %} {% block title %}Our Story{% endblock title %} {% block body %} -

      Our Story

      +

      Our Story

      +
      +
      + +
      -
      +

      Eric and Katrina first met online in 2014. After texting back and forth for a week they finally met in persion at a little coffee shop in Oakland on July 23, 2014. Eric was shy and Katrina was nervous, but somehow they found enough to talk about to agree to a second date where they continued to bond over coffee, cigarettes, and zombie movies.

      @@ -12,7 +16,7 @@

      In August 2016 they packed everything into a couple of crates and moved up north to Portland, Oregon. After six months of the both of them working from home, they realized that they were still madly in love (despite seeing each other all day, every day.) So on February 6, 2017 Eric proposed to Katrina.

      -
      +

      On May 12, 2017 they will both say "yes" and live happily ever after til death do they part.

      diff --git a/app/Resources/views/social_login.html.twig b/app/Resources/views/social_login.html.twig index 27c98e0..95be003 100644 --- a/app/Resources/views/social_login.html.twig +++ b/app/Resources/views/social_login.html.twig @@ -1,21 +1,22 @@ -{% if(not is_granted('IS_AUTHENTICATED_FULLY')) %} -
      +{% if not is_granted('IS_AUTHENTICATED_FULLY') %} + +

      Login Register

      -
        +
        • -
        • -
        • +
        • +
        • -
      + {% endif %} \ No newline at end of file diff --git a/app/Resources/views/user/index.html.twig b/app/Resources/views/user/index.html.twig deleted file mode 100644 index a8e1fc6..0000000 --- a/app/Resources/views/user/index.html.twig +++ /dev/null @@ -1,4 +0,0 @@ -{% extends 'base.html.twig' %} -{% block body %} -{{ dump(app.session.get('user')) }} -{% endblock %} diff --git a/app/Resources/views/user/logout.html.twig b/app/Resources/views/user/logout.html.twig deleted file mode 100644 index c7da610..0000000 --- a/app/Resources/views/user/logout.html.twig +++ /dev/null @@ -1,7 +0,0 @@ -{% extends 'base.html.twig' %} -{% block body %} -

      You have been successfully logged out.

      -

      - You can log in again by going to the login page. -

      -{% endblock %} \ No newline at end of file diff --git a/app/Resources/views/user_registered.txt.twig.html.twig b/app/Resources/views/user_registered.txt.twig.html.twig index 4f15832..3e4761f 100644 --- a/app/Resources/views/user_registered.txt.twig.html.twig +++ b/app/Resources/views/user_registered.txt.twig.html.twig @@ -1,19 +1,19 @@ {% block body_text %} {% autoescape false %} -Heyo!, +Heyo! -{{ user.name }} has registered a new account. +{{ user.name }} has registered a new account with the email {{ user.email }} and is bringing {% if user.rsvp.guests != 0 %}{{ user.rsvp.guests - 1 }}{% else %}0{% endif %} guests with them. -Info, - -Email : {{ user.email }} -Guests: {{ user.rsvp.guests }} {% if user.comment is not null %} -Comment : +{{ user.name }} wants you to know - {{ user.comment }} {% endif %} +{% if resourceOwner is defined and resourceOwner is not null %} +{{ user.name }} connected with {{ resourceOwner|capitalize }} +{% endif %} + Love, Your website ❤ diff --git a/app/config/config.yml b/app/config/config.yml index 5e2b5f7..c3df565 100644 --- a/app/config/config.yml +++ b/app/config/config.yml @@ -49,6 +49,9 @@ framework: twig: debug: '%kernel.debug%' strict_variables: '%kernel.debug%' + form_themes: + # other form themes + - 'VichUploaderBundle:Form:fields.html.twig' # Doctrine Configuration doctrine: @@ -126,7 +129,6 @@ swiftmailer: username: '%mailer_user%' password: '%mailer_password%' spool: { type: memory } - delivery_addresses: ['eric@rewiv.com'] sender_address: 'noreply@doughnutwedding.com' hwi_oauth: @@ -148,10 +150,6 @@ hwi_oauth: type: amazon client_id: 'amzn1.application-oa2-client.15f87b8a4f23465b9022ba0a3f55610d' client_secret: '84d6f402c53386ae0f196062945f217dcc56e7b7122cffb76c95b6a5775d22e0' - instagram: - type: instagram - client_id: '70e7edd280834c429d49f985ff308230' - client_secret: '9c405020a3ef412086032a4514909705' twitter: type: twitter client_id: 'YmXGQN2Az0eTlkwJrnaO2wR9r' @@ -170,7 +168,6 @@ hwi_oauth: google: googleId facebook: facebookId amazon: amazonId - instagram: instagramId twitter: twitterId yahoo: yahooId # if you want to use 'connect' and do not use the FOSUB integration, configure these separately @@ -219,12 +216,23 @@ knp_gaufrette: assets: adapter: assets alias: cloud_assets + vich_uploader: db_driver: orm - storage: gaufrette mappings: gallery_image: - upload_destination: cloud - uri_prefix: / + namer: + service: vich_uploader.namer_hash + options: + length: 32 + algorithm: 'sha3-512' + delete_on_update: true + delete_on_remove: true + sikofitt_doughnut_wedding: max_rsvps: ~ + +white_october_pagerfanta: + exceptions_strategy: + out_of_range_page: ~ + not_valid_current_page: ~ \ No newline at end of file diff --git a/app/config/config_dev.yml b/app/config/config_dev.yml index c126e55..c1addb4 100644 --- a/app/config/config_dev.yml +++ b/app/config/config_dev.yml @@ -36,6 +36,17 @@ monolog: #chromephp: # type: chromephp # level: info +vich_uploader: + storage: gaufrette + mappings: + gallery_image: + upload_destination: cloud + uri_prefix: / + #storage: file_system + #mappings: + # gallery_image: + # uri_prefix: /images/gallery + # upload_destination: '%kernel.root_dir%/../web/images/gallery' swiftmailer: transport: null diff --git a/app/config/config_prod.yml b/app/config/config_prod.yml index 6dcdec9..d9b71e1 100644 --- a/app/config/config_prod.yml +++ b/app/config/config_prod.yml @@ -5,11 +5,41 @@ monolog: handlers: main: type: fingers_crossed - action_level: error + action_level: notice handler: redis console: type: console redis: type: service id: snc_redis.monolog.handler - level: debug + level: notice + mail: + type: fingers_crossed + # 500 errors are logged at the critical level + action_level: error + excluded_404s: + - ^/ + # to also log 400 level errors (but not 404's): + # action_level: error + #excluded_404s: + # - ^/ + handler: deduplicated + deduplicated: + type: deduplication + handler: swift + swift: + type: swift_mailer + from_email: 'action@doughnutwedding.com' + to_email: ['sikofitt@gmail.com','katrina.a.johnson@gmail.com'] + # or list of recipients + # to_email: ['dev1@example.com', 'dev2@example.com', ...] + subject: 'An Error Occurred! %%message%%' + level: error + formatter: monolog.formatter.html + content_type: text/html +vich_uploader: + storage: gaufrette + mappings: + gallery_image: + upload_destination: cloud + uri_prefix: / \ No newline at end of file diff --git a/app/config/easy_admin.yml b/app/config/easy_admin.yml index ef40bac..5e96441 100644 --- a/app/config/easy_admin.yml +++ b/app/config/easy_admin.yml @@ -1,17 +1,37 @@ easy_admin: + site_name: Doughnut Wedding design: - form_theme: 'vertical' + form_theme: 'horizontal' entities: - Contact: - class: Sikofitt\DoughnutWeddingBundle\Entity\Contact - list: - actions: ['show','edit','delete'] - fields: ['userid','email','name','comment','createdAt'] + ImageComments: + class: Sikofitt\DoughnutWeddingBundle\Entity\ImageComment + disabled_actions: ['new'] User: class: Sikofitt\DoughnutWeddingBundle\Entity\User list: actions: ['show','edit','delete'] fields: ['name','username','email','enabled','lastLogin','rsvp'] + edit: + fields: + - name + - username + - email + - { property: rsvp, type_options: { disabled: true } } + - comment + - images + - enabled + - lastLogin + - confirmationToken + - passwordRequestedAt + - roles + - created + - updated + - facebookId + - googleId + - amazonId + - instagramId + - twitterId + - yahooId show: fields: - name @@ -34,20 +54,26 @@ easy_admin: - yahooId Rsvp: class: Sikofitt\DoughnutWeddingBundle\Entity\Rsvp - Image: + Contact: + class: Sikofitt\DoughnutWeddingBundle\Entity\Contact + list: + actions: ['show','edit','delete'] + fields: ['userid','email','name','comment','createdAt'] + Images: class: Sikofitt\DoughnutWeddingBundle\Entity\Image image_base_path: 'https://storage.googleapis.com/zgluzzkwodfky2m0ytbhmjhmmzqzntq2ngy3ndjmntyxmzg4/gallery/' list: actions: ['show','delete'] fields: - { property: 'imageName', label: 'Image', type: 'image', base_path: 'https://storage.googleapis.com/zgluzzkwodfky2m0ytbhmjhmmzqzntq2ngy3ndjmntyxmzg4/gallery/' } - + - description - category - tags - user form: fields: - { property: 'imageFile', type: 'vich_image', base_path: 'https://storage.googleapis.com/zgluzzkwodfky2m0ytbhmjhmmzqzntq2ngy3ndjmntyxmzg4/gallery/' } + - description - { property: tags, type: 'collection'} - category - user diff --git a/app/config/routing.yml b/app/config/routing.yml index c5ee747..2cf24cd 100644 --- a/app/config/routing.yml +++ b/app/config/routing.yml @@ -2,54 +2,63 @@ hwi_oauth_redirect: resource: "@HWIOAuthBundle/Resources/config/routing/redirect.xml" prefix: /connect + hwi_oauth_connect: resource: "@HWIOAuthBundle/Resources/config/routing/connect.xml" prefix: /connect + hwi_oauth_login: resource: "@HWIOAuthBundle/Resources/config/routing/login.xml" prefix: /connect + facebook_login: path: /login/callback/facebook + google_login: path: /login/callback/google + twitter_login: path: /login/callback/twitter -instagram_login: - path: /login/callback/instagram + amazon_login: path: /login/callback/amazon + yahoo_login: path: /login/callback/yahoo + fos_user_security: resource: "@FOSUserBundle/Resources/config/routing/security.xml" -#paths -# /login -# /login_check -# /logout + + fos_user_profile: resource: "@FOSUserBundle/Resources/config/routing/profile.xml" prefix: /user/profile + fos_user_register: resource: "@FOSUserBundle/Resources/config/routing/registration.xml" prefix: /register + fos_user_resetting: resource: "@FOSUserBundle/Resources/config/routing/resetting.xml" prefix: /resetting + fos_user_change_password: resource: "@FOSUserBundle/Resources/config/routing/change_password.xml" prefix: /user/profile + easy_admin_bundle: resource: "@EasyAdminBundle/Controller/" type: annotation prefix: /admin + sikofitt_doughnut_wedding: resource: "@SikofittDoughnutWeddingBundle/Controller/" type: annotation diff --git a/app/config/security.yml b/app/config/security.yml index 27aea2c..a73c302 100644 --- a/app/config/security.yml +++ b/app/config/security.yml @@ -35,7 +35,6 @@ security: facebook: /login/callback/facebook google: /login/callback/google twitter: /login/callback/twitter - instagram: /login/callback/instagram amazon: /login/callback/amazon yahoo: /login/callback/yahoo login_path: /login diff --git a/app/config/services.yml b/app/config/services.yml index 674ff13..6b7946e 100644 --- a/app/config/services.yml +++ b/app/config/services.yml @@ -23,12 +23,17 @@ services: arguments: ['@security.token_storage', '@router'] tags: - { name: kernel.event_listener, event: kernel.request } + doughnutwedding.event.redirect_from_hwi_connect_page: + class: Sikofitt\DoughnutWeddingBundle\EventListener\RedirectFromHwiConnectPageEvent + arguments: ['@router', '@service_container'] + tags: + - { name: kernel.event_listener, event: kernel.request } doughnutwedding.event.redirect_user_after_register_event: class: Sikofitt\DoughnutWeddingBundle\EventListener\RedirectOnUserRegisterListener arguments: ['@service_container'] tags: - - { name: kernel.event_listener, event: fos_user.registration.confirmed } - { name: kernel.event_listener, event: fos_user.registration.completed } + - { name: kernel.event_listener, event: security.interactive_login } doughnutwedding.google_cloud_storage.service: class: \Google_Service_Storage factory: ['Sikofitt\DoughnutWeddingBundle\Factory\GoogleCloudStorageServiceFactory', createGoogleCloudService] @@ -45,4 +50,11 @@ services: - { name: kernel.event_listener, event: kernel.response } doughnutwedding.security.access_denied_handler: class: Sikofitt\DoughnutWeddingBundle\Security\AccessDeniedHandler - arguments: ['@router', '@monolog.logger'] \ No newline at end of file + arguments: ['@router', '@monolog.logger'] + doughnutwedding.uikit.template: + class: Sikofitt\DoughnutWeddingBundle\Pager\View\UIkitTemplate + pagerfanta.view.default: + class: Pagerfanta\View\DefaultView + arguments: ['@doughnutwedding.uikit.template'] + public: false + tags: [{ name: pagerfanta.view, alias: default }] \ No newline at end of file diff --git a/build/images/yahoo2.svg b/build/images/yahoo2.svg new file mode 100644 index 0000000..9ad44dd --- /dev/null +++ b/build/images/yahoo2.svg @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:806dc0af681d43dd94bf783335f3e6de6bdf769e4f882b513a106696c69cca82 +size 763 diff --git a/build/less/doughnut.less b/build/less/doughnut.less index 55bbbac..0ea725f 100644 --- a/build/less/doughnut.less +++ b/build/less/doughnut.less @@ -1,6 +1,6 @@ @import "../../vendor/bower/uikit/src/less/uikit.less"; @import "../../vendor/bower/uikit/src/less/components/variables.less"; - +@import url('https://fonts.googleapis.com/css?family=Sigmar+One'); //@global-font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif; //@global-font-size: 16px; @global-font-family: 'Raleway', sans-serif; @@ -8,18 +8,69 @@ @base-body-font-family: 'Raleway', sans-serif; @base-heading-font-family: 'Raleway', sans-serif; @base-heading-text-transform: uppercase; +@button-text-transform:capitalize; @base-body-font-weight: 200; @base-heading-font-weight: 300; @form-background: #ffffff; -@global-link-color: #90d5c1; +@global-link-color: #5fbabd; @base-link-color: @global-link-color; @base-link-hover-color: darken(@base-link-color, 20%); -@button-primary-background: #90d5c1; +@button-primary-background: #9dd3d5; @button-primary-color: #333; +@text-primary-color: @button-primary-background; @button-primary-hover-color: darken(@button-primary-color, 10%); @button-primary-hover-background: darken(@button-primary-background, 10%); -.uk-login-container { +@button-danger-background: #fa6581; +@button-danger-color: #333; +@button-danger-hover-color: darken(@button-danger-color, 10%); +@button-danger-hover-background: darken(@button-danger-background, 10%); +blockquote p { + +} + +blockquote footer:before { + content: "— "; +} +.uk-404 { + font-family: 'Sigmar One', cursive; + line-height:0; + &.uk-doughnut { + @media(min-width: @breakpoint-small-max) { + font-size: 10rem; + } + @media(max-width: @breakpoint-small) { + font-size: 5rem; + } + .uk-spin { + @media(min-width: @breakpoint-small-max) { + width: 128px; + height: 128px; + } + @media(max-width: @breakpoint-small) { + width: 64px; + height:64px; + } + background-image:url(https://storage.googleapis.com/zgluzzkwodfky2m0ytbhmjhmmzqzntq2ngy3ndjmntyxmzg4/assets/doughnut_404.png) + } + } +} + +@-moz-keyframes spin { 100% { -moz-transform: rotate(360deg); } } +@-webkit-keyframes spin { 100% { -webkit-transform: rotate(360deg); } } +@keyframes spin { 100% { -webkit-transform: rotate(360deg); transform:rotate(360deg); } } + +.uk-spin { + position: relative; + top: 0%; + left: 0%; + margin:0px 12px; + -webkit-animation:spin 1.5s linear infinite; + -moz-animation:spin 1.5s linear infinite; + animation:spin 1.5s linear infinite; + +} +.uk-login-container { .uk-navbar { .uk-navbar-nav { li { @@ -37,7 +88,7 @@ label.required:after { color: @form-danger-color; font-size: @global-large-font-size; font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif; - font-weight: bol + font-weight: bold } .uk-home { @@ -63,22 +114,22 @@ label.required:after { .uk-our-story-home { height:465px !important; - background-image: url('/images/home_our_story_1.jpg'); + background-image: url('https://storage.googleapis.com/zgluzzkwodfky2m0ytbhmjhmmzqzntq2ngy3ndjmntyxmzg4/assets/home_our_story_1.jpg'); &:hover { - background-image: url('/images/home_our_story_2.jpg') + background-image: url('https://storage.googleapis.com/zgluzzkwodfky2m0ytbhmjhmmzqzntq2ngy3ndjmntyxmzg4/assets/home_our_story_2.jpg') } } // photo // location .uk-photo-home { - background-image: url('/images/home_photo_2.jpg'); + background-image: url('https://storage.googleapis.com/zgluzzkwodfky2m0ytbhmjhmmzqzntq2ngy3ndjmntyxmzg4/assets/home_photo_2.jpg'); &:hover { - background-image: url('/images/home_photo_1.jpg'); + background-image: url('https://storage.googleapis.com/zgluzzkwodfky2m0ytbhmjhmmzqzntq2ngy3ndjmntyxmzg4/assets/home_photo_1.jpg'); } } .uk-location-home { margin-bottom:15px !important; - background-image: url('/images/home_location.jpg'); + background-image: url('https://storage.googleapis.com/zgluzzkwodfky2m0ytbhmjhmmzqzntq2ngy3ndjmntyxmzg4/assets/home_location.jpg'); transition-duration: .3s; transition-timing-function: ease-out; transition-property: filter; @@ -90,15 +141,15 @@ label.required:after { } .uk-doughnut-rsvp { margin-bottom:15px !important; - background-image: url('/images/home_doughnut_1.jpg'); + background-image: url('https://storage.googleapis.com/zgluzzkwodfky2m0ytbhmjhmmzqzntq2ngy3ndjmntyxmzg4/assets/home_doughnut_1.jpg'); &:hover { - background-image: url('/images/home_doughnut_2.jpg'); + background-image: url('https://storage.googleapis.com/zgluzzkwodfky2m0ytbhmjhmmzqzntq2ngy3ndjmntyxmzg4/assets/home_doughnut_2.jpg'); } } .uk-doughnut-get-in-touch-home { - background-image: url('/images/home_doughnut_2.jpg'); + background-image: url('https://storage.googleapis.com/zgluzzkwodfky2m0ytbhmjhmmzqzntq2ngy3ndjmntyxmzg4/assets/home_doughnut_2.jpg'); &:hover { - background-image: url('/images/home_doughnut_1.jpg'); + background-image: url('https://storage.googleapis.com/zgluzzkwodfky2m0ytbhmjhmmzqzntq2ngy3ndjmntyxmzg4/assets/home_doughnut_1.jpg'); } } @@ -106,7 +157,39 @@ label.required:after { } } +.uk-icon.uk-icon-facebook { + color: #3b5998; +} +.uk-icon.uk-icon-google { + color: #d50f25; +} +.uk-icon.uk-icon-twitter { + color: #1da1f2; +} +.uk-icon.uk-icon-yahoo { + color: #7b0099; + /*color: #720e9e;*/ +} +.uk-icon.uk-icon-amazon { + color: #ff9900; +} +.uk-preload { + background-repeat: no-repeat; + background-position-x: -9999px; + background-position-y: -9999px; + .our-story { + background-image:url('https://storage.googleapis.com/zgluzzkwodfky2m0ytbhmjhmmzqzntq2ngy3ndjmntyxmzg4/assets/home_our_story_2.jpg'); + } + .photo-gallery { + background-image:url('https://storage.googleapis.com/zgluzzkwodfky2m0ytbhmjhmmzqzntq2ngy3ndjmntyxmzg4/assets/home_photo_1.jpg'); + } + +} +.uk-registration-connect a, +.uk-doughnut-main-nav li a { + font-weight:bold !important; +} .uk-input, .uk-select, .uk-textarea { diff --git a/composer.json b/composer.json index 89a63d2..112d8f0 100644 --- a/composer.json +++ b/composer.json @@ -55,7 +55,8 @@ "tedivm/stash-bundle": "^0.6.2", "twig/extensions": "^1.4", "twig/twig": "^1.0||^2.0", - "vich/uploader-bundle": "^1.5" + "vich/uploader-bundle": "^1.5", + "white-october/pagerfanta-bundle": "^1.0" }, "require-dev": { "doctrine/doctrine-fixtures-bundle": "^2.3", diff --git a/email/doughnut_wedding.html b/email/doughnut_wedding.html index 6031d72..c329bc4 100644 --- a/email/doughnut_wedding.html +++ b/email/doughnut_wedding.html @@ -1,248 +1,377 @@ - + -Eric and Katrina's Doughnut Wedding! - - - - - - - - + Eric and Katrina's Doughnut Wedding! + + + + + + + + - - - - - - - - - - - - - -
      - - - - - - - -
      - + + + + - + + + + + + + + + + - - -
      + + + + + + + +
      + +
      +
      + + + + + + + + + + + + + + + + + + + + + + + + + + +
      + + + + +
      + + + + +
      Please join us for ERIC + KATRINA'S +
      +
      +
      + + + + +
      + + + + +
      + + DOUGHNUT WEDDING + +
      +
      +
      + + + + +
      + + + + +
      Friday, May 12, 2017<br>Two O'Clock +
      +
      +
      + + + + +
      + + + + +
      RSVP Online +
      +
      +
      + + + + +
      + doughnutwedding.com +
      +
      +
      + + + + + +
      +
      - - - -
      - - +
      - - - -
      Please join us for ERIC + KATRINA'S
      +
      - - +
      - - - -
      DOUGHNUT WEDDING
      - - - - - - - - -
      - - - -
      Friday, May 12, 2017<br>Two O'Clock
      - - - - - - - - -
      - - - -
      RSVP Online
      - - - - - - - - -
      doughnutwedding.com
      - - - - - - - - - - - - - - -
      - - - - - - - diff --git a/src/Sikofitt/DoughnutWeddingBundle/Controller/DefaultController.php b/src/Sikofitt/DoughnutWeddingBundle/Controller/DefaultController.php index 8cd1934..fb4ade0 100644 --- a/src/Sikofitt/DoughnutWeddingBundle/Controller/DefaultController.php +++ b/src/Sikofitt/DoughnutWeddingBundle/Controller/DefaultController.php @@ -45,18 +45,20 @@ class DefaultController extends Controller if (null !== $this->getUser()) { $parameters['hide_social'] = true; } + return $this->render('default/index.html.twig', $parameters); } - /** - * @Route("/our_story") - * - * @param \Symfony\Component\HttpFoundation\Request $request - * - * @return Response - */ - public function ourStoryAction(Request $request) { - return $this->render('our_story.html.twig'); + /** + * @Route("/our_story") + * + * @param \Symfony\Component\HttpFoundation\Request $request + * + * @return Response + */ + public function ourStoryAction(Request $request): Response + { + return $this->render('our_story.html.twig'); } /** @@ -66,19 +68,22 @@ class DefaultController extends Controller * * @return Response */ - public function locationAction(Request $request) { + public function locationAction(Request $request): Response + { return $this->render('location.html.twig'); } /** * @Route("/get_in_touch") + * * @param \Symfony\Component\HttpFoundation\Request $request * * @return \Symfony\Component\HttpFoundation\Response */ - public function contactAction(Request $request) : Response { + public function contactAction(Request $request): Response + { $contact = new Contact(); - if(null !== $this->getUser()) { + if (null !== $this->getUser()) { $contact ->setName($this->getUser()->getName()) ->setEmail($this->getUser()->getEmail()) @@ -88,13 +93,11 @@ class DefaultController extends Controller $form = $this->get('form.factory')->create(ContactFormType::class, $contact); - - if($request->isMethod('POST')) { + if ($request->isMethod('POST')) { $form->handleRequest($request); - if($form->isValid() && $form->isSubmitted()) { + if ($form->isValid() && $form->isSubmitted()) { $em = $this->get('doctrine.orm.entity_manager'); /** @var Contact $data */ - $data = $form->getData(); $data->setCreatedAt(new \DateTime('now')); @@ -102,11 +105,11 @@ class DefaultController extends Controller $em->persist($data); $em->flush(); - $responseMessage[] = 'Thank you for your message ' . $data->getName() . '!'; + $responseMessage[] = 'Thank you for your message '.$data->getName().'!'; $email = $data->getEmail(); - if( null !== $email ) { + if (null !== $email) { $responseMessage[] = sprintf('We will respond to you at %s as soon as possible.', $email); } else { $email = 'no-reply@doughnutwedding.com'; @@ -129,6 +132,5 @@ class DefaultController extends Controller } return $this->render('form/contact.html.twig', ['form' => $form->createView()]); - } } diff --git a/src/Sikofitt/DoughnutWeddingBundle/Controller/GalleryController.php b/src/Sikofitt/DoughnutWeddingBundle/Controller/GalleryController.php index 1063df8..4714354 100644 --- a/src/Sikofitt/DoughnutWeddingBundle/Controller/GalleryController.php +++ b/src/Sikofitt/DoughnutWeddingBundle/Controller/GalleryController.php @@ -20,11 +20,21 @@ namespace Sikofitt\DoughnutWeddingBundle\Controller; +use Pagerfanta\Adapter\ArrayAdapter; +use Pagerfanta\Pagerfanta; +use Sensio\Bundle\FrameworkExtraBundle\Configuration\Method; use Sensio\Bundle\FrameworkExtraBundle\Configuration\Route; use Sikofitt\DoughnutWeddingBundle\Entity\Image; +use Sikofitt\DoughnutWeddingBundle\Entity\ImageComment; use Sikofitt\DoughnutWeddingBundle\Form\GalleryUploadType; use Symfony\Bundle\FrameworkBundle\Controller\Controller; -use Vich\UploaderBundle\Form\Type\VichImageType; +use Symfony\Component\HttpFoundation\JsonResponse; +use Symfony\Component\HttpFoundation\RedirectResponse; +use Symfony\Component\HttpFoundation\Request; +use Symfony\Component\HttpFoundation\Response; +use Symfony\Component\HttpKernel\Exception\NotFoundHttpException; +use Symfony\Component\Security\Core\Authentication\Token\TokenInterface; +use Symfony\Component\Security\Csrf\CsrfToken; /** * Class ImageController. @@ -35,44 +45,213 @@ class GalleryController extends Controller { /** * @Route("/") + * @Method({"GET"}) */ - public function indexAction() + public function indexAction(Request $request) : Response { - $images = $this->get('doctrine.orm.default_entity_manager')->getRepository('SikofittDoughnutWeddingBundle:Image')->findAll(); - return $this->render('SikofittDoughnutWeddingBundle:Image:index.html.twig', ['images' => $images]); + $images = $this->get('doctrine.orm.default_entity_manager')->getRepository('SikofittDoughnutWeddingBundle:Image')->findAll(); + + $chunks = array_chunk($images, 12); + $adapter = new ArrayAdapter($images); + $pager = new Pagerfanta($adapter); + $pager->setMaxPerPage(12); + + return $this->render('SikofittDoughnutWeddingBundle:Image:index.html.twig', [ + 'images' => $chunks[0] ?? $images, + 'pager' => $pager, + ]); + } + + /** + * @Route("/page/{number}", defaults={"number":1}, name="gallery_page_view", requirements={"number":"\d+"}) + * + * @param \Symfony\Component\HttpFoundation\Request $request + * @param int $number + * + * @return Response + */ + public function pageAction(Request $request, int $number) + { + $images = $this->get('doctrine.orm.default_entity_manager')->getRepository('SikofittDoughnutWeddingBundle:Image')->findAll(); + + $adapter = new ArrayAdapter($images); + $pager = new Pagerfanta($adapter); + $chunks = array_chunk($images, 12); + $pager->setMaxPerPage(12); + $pager->setCurrentPage($number); + + return $this->render('SikofittDoughnutWeddingBundle:Image:index.html.twig', ['images' => $chunks[$number - 1], 'pager' => $pager]); } /** * @Route("/upload") */ - public function uploadAction() + public function uploadAction(Request $request, Response $response = null) { - if(false === $this->isGranted('IS_AUTHENTICATED_FULLY')) { - $this->addFlash('error', 'You must be logged in to upload photos.'); - } - $form = $this->get('form.factory')->create(GalleryUploadType::class, new Image()); + if (false === $this->isGranted('IS_AUTHENTICATED_FULLY')) { + $this->addFlash('error', 'You must be logged in to upload photos.'); + } + + $image = new Image(); + $image->setUser($request->getSession()->get('user')); + $form = $this->get('form.factory')->create(GalleryUploadType::class, $image); + $form->handleRequest($request); + if ($form->isSubmitted() && $form->isValid()) { + /** @var \Sikofitt\DoughnutWeddingBundle\Entity\User $user */ + $user = $this->getUser(); + $image->setUser($user); + + $em = $this->get('doctrine.orm.entity_manager'); + $em->persist($image); + $em->flush(); + + $baseName = $image->getImageFile()->getBasename('.'.$image->getImageFile()->getExtension()); + + return new RedirectResponse($this->get('router')->generate('view_gallery_image_by_hash', ['imageHash' => $baseName])); + } + return $this->render('SikofittDoughnutWeddingBundle:Image:upload.html.twig', [ - 'form' => $form->createView() + 'form' => $form->createView(), ]); } /** - * @Route("/tag") + * @Route("/ajax") + * @Method({"POST"}) */ - public function tagAction() + public function ajaxCommentAction(Request $request): JsonResponse { - return $this->render('SikofittDoughnutWeddingBundle:Image:tag.html.twig', [ - // ... + if (false === $request->getSession()->has('_security_secured_area')) { + return new JsonResponse(['status' => 403, 'message' => 'You must be logged in to post a comment'], 403); + } + /** @var \Symfony\Component\Security\Core\Authentication\Token\TokenInterface $data */ + $data = unserialize($request->getSession()->get('_security_secured_area'), [TokenInterface::class]); + + $tokenManager = $this->get('security.csrf.token_manager'); + $fileName = $request->request->get('file'); + + $token = $request->request->get('_token'); + $csrfToken = new CsrfToken($fileName, $token); + + if (false === $tokenManager->isTokenValid($csrfToken)) { + return new JsonResponse(['status' => Response::HTTP_EXPECTATION_FAILED, 'message' => 'Invalid Token'], Response::HTTP_EXPECTATION_FAILED); + } + $em = $this->get('doctrine.orm.entity_manager'); + $user = $em + ->getRepository('SikofittDoughnutWeddingBundle:User') + ->findOneBy(['id' => $data->getUser()->getId()]); + + $comment = $request->request->get('comment'); + $fileId = $request->request->get('id'); + + $image = $em + ->getRepository('SikofittDoughnutWeddingBundle:Image') + ->findOneBy(['id' => $fileId]); + + $newComment = new ImageComment(); + $newComment->setUser($user) + ->setComment($comment) + ->setImage($image) + ->setIsChild(false) + ->setCreated(new \DateTime('now')) + ->setChildComments(null); + $em->persist($newComment); + $em->flush(); + + $commentHtml = $this->renderView('gallery_comment.html.twig', ['comment' => $newComment]); + + return new JsonResponse([ + 'id' => $user->getId(), + 'name' => $user->getName(), + 'date_short' => date('m/d/y').' at '.date('g:ia'), + 'date_long' => date('l F jS, Y').' at '.date('g:ia'), + 'status' => Response::HTTP_OK, + 'html' => $commentHtml, ]); } /** - * @Route("/category") + * @Route("/{imageHash}", name="view_gallery_image_by_hash", requirements={"imageHash":"\w{32,32}"}) + * @Method({"GET","HEAD"}) + * + * @param \Symfony\Component\HttpFoundation\Request $request + * @param string $imageHash + * + * @throws \Symfony\Component\HttpKernel\Exception\NotFoundHttpException + * + * @return Response */ - public function categoryAction() + public function viewImageAction(Request $request, string $imageHash): ?Response { - return $this->render('SikofittDoughnutWeddingBundle:Image:category.html.twig', [ - // ... - ]); + $image = $this + ->get('doctrine.orm.entity_manager') + ->createQueryBuilder() + ->select('i') + ->from('Sikofitt\DoughnutWeddingBundle\Entity\Image', 'i') + ->where('i.imageName LIKE :imageHash') + ->setParameter('imageHash', $imageHash.'%') + ->getQuery()->getOneOrNullResult(); + if (null !== $image) { + return $this->render('@SikofittDoughnutWedding/Image/view_image.html.twig', + ['image' => $image]); + } + + throw new NotFoundHttpException(); + } + + /** + * @Route("/tag/{tag}/{number}", name="gallery_tag_action", defaults={"number":1}, requirements={"number":"\d+"}) + * + * @param \Symfony\Component\HttpFoundation\Request $request + * @param string $tag + * @param int $number + * + * @return Response + */ + public function tagAction(Request $request, string $tag, int $number): Response + { + $images = $this + ->get('doctrine.orm.entity_manager') + ->getRepository('SikofittDoughnutWeddingBundle:Image') + ->findImageByTag($tag); + $adapter = new ArrayAdapter($images); + $pager = new Pagerfanta($adapter); + $pager->setMaxPerPage(12); + $chunks = array_chunk($images, 12); + + return $this + ->render('SikofittDoughnutWeddingBundle:Image:index.html.twig', [ + 'pager' => $pager, + 'tag' => $tag, + 'images' => $chunks[$number - 1] ?? $images, + ]); + } + + /** + * @Route("/category/{category}/{number}", name="gallery_category_action", defaults={"number":1}, requirements={"number":"\d+"}) + * + * @param \Symfony\Component\HttpFoundation\Request $request + * @param string $category + * + * @return Response + */ + public function categoryAction(Request $request, string $category, int $number): Response + { + $images = $this + ->get('doctrine.orm.entity_manager') + ->getRepository('SikofittDoughnutWeddingBundle:Image') + ->findImageByCategory($category); + + $adapter = new ArrayAdapter($images); + $pager = new Pagerfanta($adapter); + $pager->setMaxPerPage(12); + $chunks = array_chunk($images, 12); + + return $this + ->render('SikofittDoughnutWeddingBundle:Image:index.html.twig', [ + 'pager' => $pager, + 'category' => $category, + 'images' => $chunks[$number - 1] ?? $images, + ]); } } diff --git a/src/Sikofitt/DoughnutWeddingBundle/Controller/RsvpController.php b/src/Sikofitt/DoughnutWeddingBundle/Controller/RsvpController.php deleted file mode 100644 index 8f49ce3..0000000 --- a/src/Sikofitt/DoughnutWeddingBundle/Controller/RsvpController.php +++ /dev/null @@ -1,163 +0,0 @@ -. - */ - -namespace Sikofitt\DoughnutWeddingBundle\Controller; - -use Doctrine\ORM\EntityManager; - -use Sikofitt\DoughnutWeddingBundle\Form\RsvpType; -use Symfony\Bundle\FrameworkBundle\Controller\Controller; -use Symfony\Bundle\FrameworkBundle\Tests\Controller\ContainerAwareController; -use Symfony\Component\Form\FormFactory; -use Symfony\Component\HttpFoundation\Request; -use Symfony\Component\Routing\Annotation\Route; -use Symfony\Component\Validator\ConstraintViolationList; - -class RsvpController extends Controller -{ - /** - * @Route("/rsvp") - * - * @param \Symfony\Component\HttpFoundation\Request $request - * - * @return \Symfony\Component\HttpFoundation\RedirectResponse|\Symfony\Component\HttpFoundation\Response - */ - public function indexAction(Request $request) - { - /** - * @var EntityManager $em - * @var RsvpRepository $rsvpRepo - * @var UserRepository $userRepo - */ - $em = $this->get('doctrine.orm.entity_manager'); - $user = $this->getUser(); - $form = $this->get('form.factory')->create(RsvpType::class, $user); - - - - - - if ($request->isMethod('POST')) { - $form->handleRequest($request); - if ($form->isSubmitted() && $form->isValid()) { - $user = $form->getData(); - $user->setPassword($user->getPlainPassword()); - /** - * @var EntityManager $em - */ - - $em->persist($user); - $em->flush(); - - return $this->render('rsvp_form.html.twig', ['form' => $form->createView()]); - } - } - - return $this->redirect($this->generateUrl('fos_user_profile_edit')); - - } - - /** - * @param \Symfony\Component\HttpFoundation\Request $request - * @param \Kernel $app - * @param string $token - * - * @return \Symfony\Component\HttpFoundation\Response - */ - public function resetAction(Request $request, \Kernel $app) - { - $formFactory = $app->getFormFactory(); - $passwordResetForm = $formFactory - ->createBuilder(ResetType::class) - ->getForm(); - $update = false; - if ($request->isMethod('POST')) { - $passwordResetForm->handleRequest($request); - if ($passwordResetForm->isSubmitted() && $passwordResetForm->isValid()) { - $data = $passwordResetForm->get('email')->getData(); - $update = $app['orm.em']->getRepository('Sikofitt\App\Entity\User') - ->setResetToken($data); - } else { - $data = null; - } - } else { - $data = null; - } - /** - * @var UserRepository $userRepo - */ - $userRepo = $app['orm.em']->getRepository('Sikofitt\App\Entity\User'); - - //$emailResult = $userRepo->getEmail($passwordResetForm->get('email')); - /*if(null === $emailResult) { - return $app->render('reset_password_confirm.html.twig', [ - 'message' => 'Email was not found in database', - ]); - } elseif($emailResult instanceof ConstraintViolationList) { - return $app->render( - 'reset_password.html.twig', - [ - 'form' => $passwordResetForm->createView(), - 'data' => $data, - 'email' => $emailResult, - 'message' => $emailResult, - ] - ); - } else { - return $app->render('reset_password_confirm.html.twig', [ - 'message' => 'Please check your email. A reset request has been sent.', - ]); - }*/ - $app->addInfo('Message', 'message 2'); - - return $app->render( - 'reset_password.html.twig', - [ - 'form' => $passwordResetForm->createView(), - 'data' => $data, - //'email' => $emailResult, - ] - ); - } - - public function tokenAction(Request $request, \Kernel $app, string $token = null) - { - $user = $app['orm.em']->getRepository('Sikofitt\App\Entity\User')->getUserByToken($token); - - if (null === $user) { - return $app->render('reset_password_token.html.twig', ['token' => ['valid' => false, 'value' => $token]]); - } else { - $passwordForm = $app->getFormFactory()->create(ResetPasswordType::class); - if ($request->isMethod('POST')) { - $passwordForm->handleRequest($request); - if ($passwordForm->isValid() && $passwordForm->isSubmitted()) { - $hash = $app->encodePassword($user, $passwordForm->get('password')->getData()); - $user->setPassword($hash); - $app['orm.em']->getRepository('Sikofitt\App\Entity\User')->updatePassword($user); - $app->addSuccess('Successfully changed your password!'); - - return $app->redirect($app->url('rsvp')); - } - } - - return $app->render('reset_password_token.html.twig', ['token' => ['valid' => true, 'value' => $token], 'form' => $passwordForm->createView(), 'user' => $user]); - } - } -} diff --git a/src/Sikofitt/DoughnutWeddingBundle/Entity/Contact.php b/src/Sikofitt/DoughnutWeddingBundle/Entity/Contact.php index c6dd288..996c263 100644 --- a/src/Sikofitt/DoughnutWeddingBundle/Entity/Contact.php +++ b/src/Sikofitt/DoughnutWeddingBundle/Entity/Contact.php @@ -1,11 +1,29 @@ . + */ + namespace Sikofitt\DoughnutWeddingBundle\Entity; use Doctrine\ORM\Mapping as ORM; /** - * Contact + * Contact. * * @ORM\Table(name="contact") * @ORM\Entity(repositoryClass="Sikofitt\DoughnutWeddingBundle\Repository\ContactRepository") @@ -35,11 +53,11 @@ class Contact */ private $name; - /** - * @var string - * - * @ORM\Column(name="email", type="string", length=255, nullable=true) - */ + /** + * @var string + * + * @ORM\Column(name="email", type="string", length=255, nullable=true) + */ private $email; /** @@ -55,7 +73,6 @@ class Contact * @ORM\Column(name="comment", type="text") */ private $comment; - /** * @var \DateTime @@ -64,9 +81,8 @@ class Contact */ private $createdAt; - /** - * Get id + * Get id. * * @return int */ @@ -76,7 +92,7 @@ class Contact } /** - * Set name + * Set name. * * @param int $userId * @@ -90,7 +106,7 @@ class Contact } /** - * Get name + * Get name. * * @return string */ @@ -100,7 +116,7 @@ class Contact } /** - * Set name + * Set name. * * @param string $name * @@ -114,7 +130,7 @@ class Contact } /** - * Get name + * Get name. * * @return string */ @@ -123,30 +139,32 @@ class Contact return $this->name; } - /** - * Set Email - * - * @param null|string $email - * - * @return \Sikofitt\DoughnutWeddingBundle\Entity\Contact - */ - public function setEmail(?string $email) : Contact { - $this->email = $email; + /** + * Set Email. + * + * @param null|string $email + * + * @return \Sikofitt\DoughnutWeddingBundle\Entity\Contact + */ + public function setEmail(?string $email): Contact + { + $this->email = $email; - return $this; + return $this; } /** - * Get Email - * - * @return null|string - */ - public function getEmail() : ?string { - return $this->email; + * Get Email. + * + * @return null|string + */ + public function getEmail(): ?string + { + return $this->email; } /** - * Set subject + * Set subject. * * @param string $subject * @@ -160,7 +178,7 @@ class Contact } /** - * Get subject + * Get subject. * * @return string */ @@ -170,7 +188,7 @@ class Contact } /** - * Set comment + * Set comment. * * @param string $comment * @@ -184,7 +202,7 @@ class Contact } /** - * Get comment + * Get comment. * * @return string */ @@ -193,9 +211,8 @@ class Contact return $this->comment; } - /** - * Set createdAt + * Set createdAt. * * @param \DateTime $createdAt * @@ -209,7 +226,7 @@ class Contact } /** - * Get createdAt + * Get createdAt. * * @return \DateTime */ diff --git a/src/Sikofitt/DoughnutWeddingBundle/Entity/Image.php b/src/Sikofitt/DoughnutWeddingBundle/Entity/Image.php index caeca72..bb29904 100644 --- a/src/Sikofitt/DoughnutWeddingBundle/Entity/Image.php +++ b/src/Sikofitt/DoughnutWeddingBundle/Entity/Image.php @@ -1,13 +1,35 @@ . + */ + namespace Sikofitt\DoughnutWeddingBundle\Entity; +use Doctrine\Common\Collections\ArrayCollection; +use Doctrine\Common\Collections\Collection; use Doctrine\ORM\Mapping as ORM; -use Vich\UploaderBundle\Mapping\Annotation as Vich; -use Symfony\Component\HttpFoundation\File\UploadedFile; use Symfony\Component\HttpFoundation\File\File; +use Symfony\Component\HttpFoundation\File\UploadedFile; +use Vich\UploaderBundle\Mapping\Annotation as Vich; + /** - * Image + * Image. + * * @Vich\Uploadable() * @ORM\Table(name="image") * @ORM\Entity(repositoryClass="Sikofitt\DoughnutWeddingBundle\Repository\ImageRepository") @@ -24,7 +46,7 @@ class Image private $id; /** - * @var File + * @var UploadedFile * * @Vich\UploadableField(mapping="gallery_image", fileNameProperty="imageName", size="imageSize") */ @@ -44,46 +66,64 @@ class Image */ private $user; - /** - * @var string - * - * @ORM\Column(name="tags", type="json_array", nullable=true, unique=false) - */ + /** + * @var \Sikofitt\DoughnutWeddingBundle\Entity\ImageComment + * + * @ORM\OneToMany(targetEntity="Sikofitt\DoughnutWeddingBundle\Entity\ImageComment", mappedBy="image", cascade={"remove"}) + */ + private $comments; + + /** + * @var string + * + * @ORM\Column(name="tags", type="json_array", nullable=true, unique=false) + */ private $tags; - /** - * @var string - * - * @ORM\Column(name="category", type="string", length=255, nullable=true, unique=false) - */ + /** + * @var string + * + * @ORM\Column(name="category", type="string", length=255, nullable=true, unique=false) + */ private $category; - /** - * @var string - * - * @ORM\Column(name="description", type="text", nullable=true, unique=false) - */ + /** + * @var string + * + * @ORM\Column(name="description", type="text", nullable=true, unique=false) + */ private $description; - /** - * @var bool - * - * @ORM\Column(name="is_published", type="boolean") - */ + /** + * @var bool + * + * @ORM\Column(name="is_published", type="boolean") + */ private $isPublished = true; - /** - * @var \DateTimeImmutable - * - * @ORM\Column(name="updated_at", type="datetime", nullable=true) - */ - private $updatedAt; /** - * Get id + * @var \DateTimeImmutable + * + * @ORM\Column(name="updated_at", type="datetime", nullable=true) + */ + private $updatedAt; + + public function __construct() + { + $this->comments = new ArrayCollection(); + } + + public function __toString() + { + return $this->imageName; + } + + /** + * Get id. * * @return int */ - public function getId() : ?int + public function getId(): ?int { return $this->id; } @@ -91,8 +131,9 @@ class Image /** * @return string */ - public function getDescription(): ?string { - return $this->description; + public function getDescription(): ?string + { + return $this->description; } /** @@ -100,16 +141,56 @@ class Image * * @return Image */ - public function setDescription(?string $description): Image { - $this->description = $description; - return $this; + public function setDescription(?string $description): Image + { + $this->description = $description; + + return $this; + } + + public function getComments(): ?Collection + { + return $this->comments; + } + + /** + * @param \Doctrine\Common\Collections\ArrayCollection|null $comments + * + * @return \Sikofitt\DoughnutWeddingBundle\Entity\Image + */ + public function setComments(?ArrayCollection $comments): Image + { + $this->comments = $comments; + + return $this; + } + + /** + * @param \Sikofitt\DoughnutWeddingBundle\Entity\ImageComment|null $comment + */ + public function addComment(ImageComment $comment = null): void + { + $this->comments[] = $comment; + } + + /** + * @param \Sikofitt\DoughnutWeddingBundle\Entity\ImageComment|null $comment + * + * @return \Sikofitt\DoughnutWeddingBundle\Entity\Image + */ + public function removeComment(ImageComment $comment = null): Image + { + $this->comments->removeElement($comment); + + return $this; } /** * @return bool */ - public function isIsPublished(): bool { - return $this->isPublished; + public function isIsPublished(): bool + { + return $this->isPublished; } /** @@ -117,63 +198,68 @@ class Image * * @return Image */ - public function setIsPublished(bool $isPublished): Image { - $this->isPublished = $isPublished; - return $this; + public function setIsPublished(bool $isPublished): Image + { + $this->isPublished = $isPublished; + + return $this; } /** - * @return \DateTimeImmutable + * @return \DateTimeInterface */ - public function getUpdatedAt(): ?\DateTimeImmutable { - return $this->updatedAt; + public function getUpdatedAt(): ?\DateTimeInterface + { + return $this->updatedAt; } /** - * @param \DateTimeImmutable $updatedAt + * @param \DateTimeInterface $updatedAt * * @return Image */ - public function setUpdatedAt(\DateTimeImmutable $updatedAt): Image { - $this->updatedAt = $updatedAt; - return $this; + public function setUpdatedAt(\DateTimeInterface $updatedAt): Image + { + $this->updatedAt = $updatedAt; + + return $this; } - /** - * Set imageFile + * Set imageFile. * * @param File|UploadedFile $imageFile * * @return Image */ - public function setImageFile(?File $imageFile) : Image + public function setImageFile(?File $imageFile): Image { $this->imageFile = $imageFile; - if($imageFile) { - $this->updatedAt = new \DateTimeImmutable(); + if ($imageFile) { + $this->updatedAt = new \DateTimeImmutable(); } + return $this; } /** - * Get imageFile + * Get imageFile. * * @return File|null */ - public function getImageFile() : ?File + public function getImageFile(): ?File { return $this->imageFile; } /** - * Set imageName + * Set imageName. * * @param string $imageName * * @return Image */ - public function setImageName(string $imageName) : Image + public function setImageName(?string $imageName): Image { $this->imageName = $imageName; @@ -181,28 +267,27 @@ class Image } /** - * Get imageName + * Get imageName. * * @return string */ - public function getImageName() : ?string + public function getImageName(): ?string { - if(null === $this->imageName && null !== $this->imageFile) { - return $this->imageFile->getFilename(); - } - return $this->imageName; + if (null === $this->imageName && null !== $this->imageFile) { + return $this->imageFile->getFilename(); + } + return $this->imageName; } - /** - * Set user + * Set user. * * @param User $user * * @return Image */ - public function setUser(?User $user) : Image + public function setUser(?User $user): Image { $this->user = $user; @@ -210,23 +295,23 @@ class Image } /** - * Get user + * Get user. * * @return User */ - public function getUser() : ?User + public function getUser(): ?User { return $this->user; } /** - * Set tags + * Set tags. * * @param array $tags * * @return Image */ - public function setTags($tags) : Image + public function setTags($tags): Image { $this->tags = $tags; @@ -234,7 +319,7 @@ class Image } /** - * Get tags + * Get tags. * * @return array */ @@ -244,7 +329,7 @@ class Image } /** - * Set category + * Set category. * * @param string $category * @@ -258,7 +343,7 @@ class Image } /** - * Get category + * Get category. * * @return string */ @@ -266,8 +351,4 @@ class Image { return $this->category; } - public function __toString() { - return $this->imageName; - //return sprintf('%s', $this->imageName, $this->imageName); - } } diff --git a/src/Sikofitt/DoughnutWeddingBundle/Entity/ImageComment.php b/src/Sikofitt/DoughnutWeddingBundle/Entity/ImageComment.php index 5692828..68a5768 100644 --- a/src/Sikofitt/DoughnutWeddingBundle/Entity/ImageComment.php +++ b/src/Sikofitt/DoughnutWeddingBundle/Entity/ImageComment.php @@ -1,11 +1,29 @@ . + */ + namespace Sikofitt\DoughnutWeddingBundle\Entity; use Doctrine\ORM\Mapping as ORM; /** - * ImageComment + * ImageComment. * * @ORM\Table(name="image_comment") * @ORM\Entity(repositoryClass="Sikofitt\DoughnutWeddingBundle\Repository\ImageCommentRepository") @@ -22,16 +40,23 @@ class ImageComment private $id; /** - * @var int + * @var \Sikofitt\DoughnutWeddingBundle\Entity\User * - * @ORM\Column(name="user", type="integer") + * @ORM\ManyToOne(targetEntity="Sikofitt\DoughnutWeddingBundle\Entity\User", inversedBy="imageComment") */ private $user; + /** + * @var int + * + * @ORM\ManyToOne(targetEntity="Sikofitt\DoughnutWeddingBundle\Entity\Image", inversedBy="comments", cascade={"persist"}) + */ + private $image; + /** * @var string * - * @ORM\Column(name="comment", type="text") + * @ORM\Column(type="text", name="comment", nullable=false, unique=false) */ private $comment; @@ -49,13 +74,6 @@ class ImageComment */ private $created; - /** - * @var int - * - * @ORM\Column(name="image", type="integer") - */ - private $image; - /** * @var bool * @@ -63,9 +81,8 @@ class ImageComment */ private $isChild; - /** - * Get id + * Get id. * * @return int */ @@ -75,13 +92,13 @@ class ImageComment } /** - * Set user + * Set user. * - * @param integer $user + * @param \Sikofitt\DoughnutWeddingBundle\Entity\User|null $user * * @return ImageComment */ - public function setUser($user) + public function setUser(?User $user): ImageComment { $this->user = $user; @@ -89,17 +106,17 @@ class ImageComment } /** - * Get user + * Get user. * - * @return int + * @return \Sikofitt\DoughnutWeddingBundle\Entity\User */ - public function getUser() + public function getUser(): ?User { return $this->user; } /** - * Set comment + * Set comment. * * @param string $comment * @@ -113,7 +130,7 @@ class ImageComment } /** - * Get comment + * Get comment. * * @return string */ @@ -123,9 +140,9 @@ class ImageComment } /** - * Set childComments + * Set childComments. * - * @param integer $childComments + * @param int $childComments * * @return ImageComment */ @@ -137,7 +154,7 @@ class ImageComment } /** - * Get childComments + * Get childComments. * * @return int */ @@ -147,7 +164,7 @@ class ImageComment } /** - * Set created + * Set created. * * @param \DateTime $created * @@ -161,7 +178,7 @@ class ImageComment } /** - * Get created + * Get created. * * @return \DateTime */ @@ -171,9 +188,9 @@ class ImageComment } /** - * Set image + * Set image. * - * @param integer $image + * @param int $image * * @return ImageComment */ @@ -185,7 +202,7 @@ class ImageComment } /** - * Get image + * Get image. * * @return int */ @@ -195,9 +212,9 @@ class ImageComment } /** - * Set isChild + * Set isChild. * - * @param boolean $isChild + * @param bool $isChild * * @return ImageComment */ @@ -209,7 +226,7 @@ class ImageComment } /** - * Get isChild + * Get isChild. * * @return bool */ @@ -218,4 +235,3 @@ class ImageComment return $this->isChild; } } - diff --git a/src/Sikofitt/DoughnutWeddingBundle/Entity/Rsvp.php b/src/Sikofitt/DoughnutWeddingBundle/Entity/Rsvp.php index 7ae08e8..654a960 100644 --- a/src/Sikofitt/DoughnutWeddingBundle/Entity/Rsvp.php +++ b/src/Sikofitt/DoughnutWeddingBundle/Entity/Rsvp.php @@ -75,6 +75,11 @@ class Rsvp $this->updated = new \DateTime('now'); } + public function __toString() + { + return sprintf('%d guests', $this->guests); + } + /** * Get id. * @@ -180,8 +185,4 @@ class Rsvp { return $this->user; } - - public function __toString() { - return sprintf('%d guests', $this->guests); - } } diff --git a/src/Sikofitt/DoughnutWeddingBundle/Entity/User.php b/src/Sikofitt/DoughnutWeddingBundle/Entity/User.php index 6f0d78e..656363d 100644 --- a/src/Sikofitt/DoughnutWeddingBundle/Entity/User.php +++ b/src/Sikofitt/DoughnutWeddingBundle/Entity/User.php @@ -22,7 +22,6 @@ namespace Sikofitt\DoughnutWeddingBundle\Entity; use Doctrine\Common\Collections\ArrayCollection; use Doctrine\ORM\Mapping as ORM; -use Doctrine\ORM\PersistentCollection; use Symfony\Component\Validator\Constraints as Assert; /** @noinspection ClassOverridesFieldOfSuperClassInspection */ @@ -33,11 +32,11 @@ use Symfony\Component\Validator\Constraints as Assert; * @ORM\Entity(repositoryClass="Sikofitt\DoughnutWeddingBundle\Repository\UserRepository") * @ORM\Table(name="users") */ -class User extends \FOS\UserBundle\Model\User { +class User extends \FOS\UserBundle\Model\User +{ + const KATRINA_SIDE = 'Katrina'; - const KATRINA_SIDE = 'Katrina'; - - const ERIC_SIDE = 'Eric'; + const ERIC_SIDE = 'Eric'; /** * @ORM\Id() @@ -79,6 +78,13 @@ class User extends \FOS\UserBundle\Model\User { */ private $images; + /** + * @var \Sikofitt\DoughnutWeddingBundle\Entity\ImageComment + * + * @ORM\OneToMany(targetEntity="Sikofitt\DoughnutWeddingBundle\Entity\ImageComment", mappedBy="user") + */ + private $imageComment; + /** * @var string * @@ -91,66 +97,100 @@ class User extends \FOS\UserBundle\Model\User { */ private $facebookId; - private $facebookAccessToken; + private $facebookAccessToken; /** * @ORM\Column(name="google_id", type="string", length=255, nullable=true) */ private $googleId; - private $googleAccessToken; + private $googleAccessToken; /** * @ORM\Column(name="amazon_id", type="string", length=255, nullable=true) */ private $amazonId; - private $amazonAccessToken; + private $amazonAccessToken; /** * @ORM\Column(name="instagram_id", type="string", length=255, nullable=true) */ private $instagramId; - private $instagramAccessToken; + private $instagramAccessToken; /** * @ORM\Column(name="twitter_id", type="string", length=255, nullable=true) */ private $twitterId; - private $twitterAccessToken; + private $twitterAccessToken; /** * @ORM\Column(name="yahoo_id", type="string", length=255, nullable=true) */ private $yahooId; - private $yahooAccessToken; + private $yahooAccessToken; /** * User constructor. */ - public function __construct() { - if (NULL === $this->created) { - $this->created = new \DateTime('now'); - } - $this->updated = new \DateTime('now'); - parent::__construct(); + public function __construct() + { + $this->imageComment = new ArrayCollection(); + if (null === $this->created) { + $this->created = new \DateTime('now'); + } + $this->updated = new \DateTime('now'); + parent::__construct(); } - public function getComment() : ?string { - return $this->comment; - } - public function setComment(?string $comment) : User { - $this->comment = $comment; - return $this; - } + public function setImageComment($imageComment) + { + $this->imageComment = $imageComment; + + return $this; + } + + public function getImageComment() + { + return $this->imageComment; + } + + public function addImageComment(ImageComment $imageComment) + { + $imageComment->setUser($this); + $this->imageComment[] = $imageComment; + + return $this; + } + + public function removeImageComment(ImageComment $imageComment) + { + $imageComment->setUser(null); + $this->imageComment->removeElement($imageComment); + } + + public function getComment(): ?string + { + return $this->comment; + } + + public function setComment(?string $comment): User + { + $this->comment = $comment; + + return $this; + } + /** * @return mixed */ - public function getAmazonId() : ?string { - return $this->amazonId; + public function getAmazonId(): ?string + { + return $this->amazonId; } /** @@ -158,17 +198,19 @@ class User extends \FOS\UserBundle\Model\User { * * @return User */ - public function setAmazonId(?string $amazonId) : User { - $this->amazonId = $amazonId; + public function setAmazonId(?string $amazonId): User + { + $this->amazonId = $amazonId; - return $this; + return $this; } /** * @return string */ - public function getAmazonAccessToken() : ?string { - return $this->amazonAccessToken; + public function getAmazonAccessToken(): ?string + { + return $this->amazonAccessToken; } /** @@ -176,17 +218,19 @@ class User extends \FOS\UserBundle\Model\User { * * @return User */ - public function setAmazonAccessToken(?string $amazonAccessToken) : User { - $this->amazonAccessToken = $amazonAccessToken; + public function setAmazonAccessToken(?string $amazonAccessToken): User + { + $this->amazonAccessToken = $amazonAccessToken; - return $this; + return $this; } /** * @return string */ - public function getFacebookId() : ?string { - return $this->facebookId; + public function getFacebookId(): ?string + { + return $this->facebookId; } /** @@ -194,17 +238,19 @@ class User extends \FOS\UserBundle\Model\User { * * @return User */ - public function setFacebookId(string $facebookId) : User { - $this->facebookId = $facebookId; + public function setFacebookId(string $facebookId): User + { + $this->facebookId = $facebookId; - return $this; + return $this; } /** * @return string */ - public function getFacebookAccessToken() : ?string { - return $this->facebookAccessToken; + public function getFacebookAccessToken(): ?string + { + return $this->facebookAccessToken; } /** @@ -212,17 +258,19 @@ class User extends \FOS\UserBundle\Model\User { * * @return User */ - public function setFacebookAccessToken(?string $facebookAccessToken) : User { - $this->facebookAccessToken = $facebookAccessToken; + public function setFacebookAccessToken(?string $facebookAccessToken): User + { + $this->facebookAccessToken = $facebookAccessToken; - return $this; + return $this; } /** * @return string */ - public function getGoogleId() : ?string { - return $this->googleId; + public function getGoogleId(): ?string + { + return $this->googleId; } /** @@ -230,17 +278,19 @@ class User extends \FOS\UserBundle\Model\User { * * @return User */ - public function setGoogleId(?string $googleId) : User { - $this->googleId = $googleId; + public function setGoogleId(?string $googleId): User + { + $this->googleId = $googleId; - return $this; + return $this; } /** * @return string */ - public function getGoogleAccessToken() : ?string { - return $this->googleAccessToken; + public function getGoogleAccessToken(): ?string + { + return $this->googleAccessToken; } /** @@ -248,17 +298,19 @@ class User extends \FOS\UserBundle\Model\User { * * @return User */ - public function setGoogleAccessToken(?string $googleAccessToken) : User { - $this->googleAccessToken = $googleAccessToken; + public function setGoogleAccessToken(?string $googleAccessToken): User + { + $this->googleAccessToken = $googleAccessToken; - return $this; + return $this; } /** * @return string */ - public function getInstagramId() : ?string{ - return $this->instagramId; + public function getInstagramId(): ?string + { + return $this->instagramId; } /** @@ -266,17 +318,19 @@ class User extends \FOS\UserBundle\Model\User { * * @return User */ - public function setInstagramId(?string $instagramId) : User { - $this->instagramId = $instagramId; + public function setInstagramId(?string $instagramId): User + { + $this->instagramId = $instagramId; - return $this; + return $this; } /** * @return mixed */ - public function getInstagramAccessToken() : ?string { - return $this->instagramAccessToken; + public function getInstagramAccessToken(): ?string + { + return $this->instagramAccessToken; } /** @@ -284,17 +338,19 @@ class User extends \FOS\UserBundle\Model\User { * * @return User */ - public function setInstagramAccessToken(?string $instagramAccessToken) : User { - $this->instagramAccessToken = $instagramAccessToken; + public function setInstagramAccessToken(?string $instagramAccessToken): User + { + $this->instagramAccessToken = $instagramAccessToken; - return $this; + return $this; } /** * @return string */ - public function getTwitterId() : ?string { - return $this->twitterId; + public function getTwitterId(): ?string + { + return $this->twitterId; } /** @@ -302,17 +358,19 @@ class User extends \FOS\UserBundle\Model\User { * * @return User */ - public function setTwitterId(?string $twitterId) : User { - $this->twitterId = $twitterId; + public function setTwitterId(?string $twitterId): User + { + $this->twitterId = $twitterId; - return $this; + return $this; } /** * @return mixed */ - public function getTwitterAccessToken() { - return $this->twitterAccessToken; + public function getTwitterAccessToken() + { + return $this->twitterAccessToken; } /** @@ -320,18 +378,19 @@ class User extends \FOS\UserBundle\Model\User { * * @return User */ - public function setTwitterAccessToken(?string $twitterAccessToken) : User { - $this->twitterAccessToken = $twitterAccessToken; + public function setTwitterAccessToken(?string $twitterAccessToken): User + { + $this->twitterAccessToken = $twitterAccessToken; - return $this; + return $this; } - /** * @return string */ - public function getYahooId() : ?string { - return $this->yahooId; + public function getYahooId(): ?string + { + return $this->yahooId; } /** @@ -339,17 +398,19 @@ class User extends \FOS\UserBundle\Model\User { * * @return User */ - public function setYahooId(?string $yahooId) : User { - $this->yahooId = $yahooId; + public function setYahooId(?string $yahooId): User + { + $this->yahooId = $yahooId; - return $this; + return $this; } /** * @return string */ - public function getYahooAccessToken() : ?string { - return $this->yahooAccessToken; + public function getYahooAccessToken(): ?string + { + return $this->yahooAccessToken; } /** @@ -357,10 +418,11 @@ class User extends \FOS\UserBundle\Model\User { * * @return User */ - public function setYahooAccessToken(?string $yahooAccessToken): User { - $this->yahooAccessToken = $yahooAccessToken; + public function setYahooAccessToken(?string $yahooAccessToken): User + { + $this->yahooAccessToken = $yahooAccessToken; - return $this; + return $this; } /** @@ -368,8 +430,9 @@ class User extends \FOS\UserBundle\Model\User { * * @return string */ - public function getName(): ?string { - return $this->name; + public function getName(): ?string + { + return $this->name; } /** @@ -379,31 +442,33 @@ class User extends \FOS\UserBundle\Model\User { * * @return User */ - public function setName(string $name): User { - $this->name = $name; + public function setName(string $name): User + { + $this->name = $name; - return $this; + return $this; } - /** + /** * @param string $plainPassword * * @return User */ - public function setPlainPassword($plainPassword): User { - $this->plainPassword = $plainPassword; + public function setPlainPassword($plainPassword): User + { + $this->plainPassword = $plainPassword; - return $this; + return $this; } - /** * Get created. * * @return \DateTime */ - public function getCreated(): ?\DateTime { - return $this->created; + public function getCreated(): ?\DateTime + { + return $this->created; } /** @@ -413,10 +478,11 @@ class User extends \FOS\UserBundle\Model\User { * * @return User */ - public function setCreated(?\DateTime $created): User { - $this->created = $created; + public function setCreated(?\DateTime $created): User + { + $this->created = $created; - return $this; + return $this; } /** @@ -424,8 +490,9 @@ class User extends \FOS\UserBundle\Model\User { * * @return \DateTime */ - public function getUpdated(): ?\DateTime { - return $this->updated; + public function getUpdated(): ?\DateTime + { + return $this->updated; } /** @@ -435,10 +502,11 @@ class User extends \FOS\UserBundle\Model\User { * * @return User */ - public function setUpdated(?\DateTime $updated): User { - $this->updated = $updated; + public function setUpdated(?\DateTime $updated): User + { + $this->updated = $updated; - return $this; + return $this; } /** @@ -446,8 +514,9 @@ class User extends \FOS\UserBundle\Model\User { * * @return Rsvp */ - public function getRsvp(): ?Rsvp { - return $this->rsvp; + public function getRsvp(): ?Rsvp + { + return $this->rsvp; } /** @@ -457,47 +526,48 @@ class User extends \FOS\UserBundle\Model\User { * * @return User */ - public function setRsvp(Rsvp $rsvp = NULL) : User { - $this->rsvp = $rsvp; + public function setRsvp(Rsvp $rsvp = null): User + { + $this->rsvp = $rsvp; - return $this; + return $this; } /** - * Add image + * Add image. * * @param \Sikofitt\DoughnutWeddingBundle\Entity\Image $image * * @return User */ - public function addImage(Image $image): User { - $image->setUser($this); + public function addImage(Image $image): User + { + $image->setUser($this); - $this->images[] = $image; + $this->images[] = $image; - return $this; + return $this; } /** - * Remove image + * Remove image. * * @param \Sikofitt\DoughnutWeddingBundle\Entity\Image $image - * - * @return Void */ - public function removeImage(Image $image): void { - $image->setUser(NULL); + public function removeImage(Image $image): void + { + $image->setUser(null); - $this->images->removeElement($image); + $this->images->removeElement($image); } /** - * Get images + * Get images. * * @return \Doctrine\Common\Collections\Collection */ - public function getImages() { - - return $this->images; + public function getImages() + { + return $this->images; } } diff --git a/src/Sikofitt/DoughnutWeddingBundle/EventListener/CheckThatEmailAndUserNameExistOnResetRequest.php b/src/Sikofitt/DoughnutWeddingBundle/EventListener/CheckThatEmailAndUserNameExistOnResetRequest.php index 127d1fa..1d8209a 100644 --- a/src/Sikofitt/DoughnutWeddingBundle/EventListener/CheckThatEmailAndUserNameExistOnResetRequest.php +++ b/src/Sikofitt/DoughnutWeddingBundle/EventListener/CheckThatEmailAndUserNameExistOnResetRequest.php @@ -1,26 +1,32 @@ . */ namespace Sikofitt\DoughnutWeddingBundle\EventListener; - -use FOS\UserBundle\Event\FormEvent; use FOS\UserBundle\Event\GetResponseUserEvent; -use FOS\UserBundle\FOSUserEvents; use Symfony\Bridge\Twig\TwigEngine; use Symfony\Component\HttpFoundation\RedirectResponse; -use Symfony\Component\HttpFoundation\Response; -use Symfony\Component\HttpKernel\Event\GetResponseEvent; use Symfony\Component\Routing\Generator\UrlGeneratorInterface; class CheckThatEmailAndUserNameExistOnResetRequest { - private $router; private $twig; @@ -30,14 +36,12 @@ class CheckThatEmailAndUserNameExistOnResetRequest $this->twig = $twig; } - public function onFosuserResettingSendemailInitialize(GetResponseUserEvent $event) { - - if(null === $event->getUser()) { + public function onFosuserResettingSendemailInitialize(GetResponseUserEvent $event) + { + if (null === $event->getUser()) { $email = $event->getRequest()->request->get('username'); - $event->getRequest()->getSession()->getFlashBag()->add('error',sprintf('Invalid email %s.', $email)); + $event->getRequest()->getSession()->getFlashBag()->add('error', sprintf('Invalid email %s.', $email)); $event->setResponse(new RedirectResponse($this->router->generate('fos_user_resetting_request'))); } } - - -} \ No newline at end of file +} diff --git a/src/Sikofitt/DoughnutWeddingBundle/EventListener/NeedToAuthenticateListenerEvent.php b/src/Sikofitt/DoughnutWeddingBundle/EventListener/NeedToAuthenticateListenerEvent.php index dc2f472..0879b48 100644 --- a/src/Sikofitt/DoughnutWeddingBundle/EventListener/NeedToAuthenticateListenerEvent.php +++ b/src/Sikofitt/DoughnutWeddingBundle/EventListener/NeedToAuthenticateListenerEvent.php @@ -1,9 +1,25 @@ . + */ namespace Sikofitt\DoughnutWeddingBundle\EventListener; - use Symfony\Component\HttpKernel\Event\FilterResponseEvent; /** @@ -13,7 +29,6 @@ use Symfony\Component\HttpKernel\Event\FilterResponseEvent; */ class NeedToAuthenticateListenerEvent { - /** * Adds a flash message for login redirects. * @@ -21,29 +36,31 @@ class NeedToAuthenticateListenerEvent */ public function onKernelResponse(FilterResponseEvent $event): void { - if ( - true === $event - ->getResponse() - ->headers - ->has('location') && - false !== strpos($event->getResponse()->headers->get('location'), - '/login') && - true === $event - ->getRequest() - ->getSession() - ->has('_security.secured_area.target_path') - ) { - $targetPath = $event - ->getRequest() - ->getSession() - ->get('_security.secured_area.target_path'); - $message = sprintf('You need to login to view %s', $targetPath); - $event - ->getRequest() - ->getSession() - ->getFlashBag() - ->add('warning', $message); - } + if (null !== $event->getRequest()->getUser()) { + if ( + true === $event + ->getResponse() + ->headers + ->has('location') && + false !== strpos($event->getResponse()->headers->get('location'), + '/login') && + true === $event + ->getRequest() + ->getSession() + ->has('_security.secured_area.target_path') + ) { + $targetPath = $event + ->getRequest() + ->getSession() + ->get('_security.secured_area.target_path'); + $message = sprintf('You need to login to view %s', $targetPath); + $event + ->getRequest() + ->getSession() + ->getFlashBag() + ->add('warning', $message); + } + } } -} \ No newline at end of file +} diff --git a/src/Sikofitt/DoughnutWeddingBundle/EventListener/RedirectFromHwiConnectPageEvent.php b/src/Sikofitt/DoughnutWeddingBundle/EventListener/RedirectFromHwiConnectPageEvent.php new file mode 100644 index 0000000..9779f52 --- /dev/null +++ b/src/Sikofitt/DoughnutWeddingBundle/EventListener/RedirectFromHwiConnectPageEvent.php @@ -0,0 +1,74 @@ +. + */ + +namespace Sikofitt\DoughnutWeddingBundle\EventListener; + +use Symfony\Component\DependencyInjection\ContainerInterface; +use Symfony\Component\HttpFoundation\RedirectResponse; +use Symfony\Component\HttpKernel\Event\GetResponseEvent; +use Symfony\Component\Routing\Generator\UrlGeneratorInterface; + +/** + * Event listener to redirect /connect to /login. + * + * Class RedirectFromHwiConnectPageEvent + */ +class RedirectFromHwiConnectPageEvent +{ + /** + * @var \Symfony\Component\Routing\Generator\UrlGeneratorInterface + */ + private $router; + + /** + * @var \Symfony\Component\DependencyInjection\ContainerInterface + */ + private $container; + + /** + * RedirectFromHwiConnectPageEvent constructor. + * + * @param \Symfony\Component\Routing\Generator\UrlGeneratorInterface $router + * @param \Symfony\Component\DependencyInjection\ContainerInterface $container + */ + public function __construct(UrlGeneratorInterface $router, ContainerInterface $container) + { + $this->router = $router; + $this->container = $container; + } + + /** + * Since there doesn't seem to be an option to prevent this. + * Redirect users to the /login page if they hit /connect. + * + * @param \Symfony\Component\HttpKernel\Event\GetResponseEvent $event + */ + public function onKernelRequest(GetResponseEvent $event): void + {/* + $uri = $this->container->get('request_stack')->getCurrentRequest()->getRequestUri(); + $loginUri = $this->router->generate('fos_user_security_login'); + $connectRoute = $this->router->generate('hwi_oauth_connect'); + + if(0 === (int) strcmp($uri, $connectRoute)) { + $event->setResponse(new RedirectResponse($loginUri, 301)); + } +*/ + } +} diff --git a/src/Sikofitt/DoughnutWeddingBundle/EventListener/RedirectOnUserRegisterListener.php b/src/Sikofitt/DoughnutWeddingBundle/EventListener/RedirectOnUserRegisterListener.php index 0daeeae..35a2489 100644 --- a/src/Sikofitt/DoughnutWeddingBundle/EventListener/RedirectOnUserRegisterListener.php +++ b/src/Sikofitt/DoughnutWeddingBundle/EventListener/RedirectOnUserRegisterListener.php @@ -1,52 +1,109 @@ . */ namespace Sikofitt\DoughnutWeddingBundle\EventListener; - use FOS\UserBundle\Event\FilterUserResponseEvent; -use FOS\UserBundle\Event\FormEvent; -use FOS\UserBundle\FOSUserEvents; -use Symfony\Bridge\Twig\TwigEngine; +use HWI\Bundle\OAuthBundle\Security\Core\Authentication\Token\OAuthToken; use Symfony\Component\DependencyInjection\ContainerInterface; use Symfony\Component\HttpFoundation\RedirectResponse; -use Symfony\Component\Routing\Generator\UrlGeneratorInterface; +use Symfony\Component\Security\Core\User\UserInterface; +use Symfony\Component\Security\Http\Event\InteractiveLoginEvent; +/** + * Class RedirectOnUserRegisterListener. + */ class RedirectOnUserRegisterListener { - + /** + * @var \Symfony\Component\DependencyInjection\ContainerInterface + */ private $container; + /** + * RedirectOnUserRegisterListener constructor. + * + * @param \Symfony\Component\DependencyInjection\ContainerInterface $container + */ public function __construct(ContainerInterface $container) { $this->container = $container; } - public function onFosuserRegistrationCompleted(FilterUserResponseEvent $event) { - + /** + * @param \FOS\UserBundle\Event\FilterUserResponseEvent $event + * + * @return \Symfony\Component\HttpFoundation\RedirectResponse + */ + public function onFosuserRegistrationCompleted(FilterUserResponseEvent $event): ?RedirectResponse + { $user = $event->getUser(); + $this->sendRegistrationEmail($user, 'the Default Sign up form'); + $url = $this + ->container + ->get('router') + ->generate('sikofitt_doughnutwedding_default_index'); + + return new RedirectResponse($url); + } + + /** + * Sends an email if the user has registered with a OAuth + * Unfortunately HWIOAuthBundle does not have events, and does not call + * the FOSUserBundle register events if using the bridge, so we have to + * do it here in the InteractiveLoginEvent listener because it's the only + * event HWIOAuthBundle calls. + * + * @param \Symfony\Component\Security\Http\Event\InteractiveLoginEvent $event + */ + public function onSecurityInteractivelogin(InteractiveLoginEvent $event): void + { + // Match the registration path so we don't call this on all logins. + if (preg_match('/(connect\/registration\/\d+)/', $event->getRequest()->getRequestUri())) { + $user = $event->getAuthenticationToken()->getUser(); + $resourceOwnerName = null; + if ($event->getAuthenticationToken() instanceof OAuthToken) { + /** @var OAuthToken $token */ + $token = $event->getAuthenticationToken(); + $resourceOwnerName = $token->getResourceOwnerName(); + } + $this->sendRegistrationEmail($user, $resourceOwnerName); + } + } + + /** + * @param \Symfony\Component\Security\Core\User\UserInterface $user + * @param null|string $resourceOwner + */ + public function sendRegistrationEmail(UserInterface $user, string $resourceOwner = null): void + { $message = new \Swift_Message('[Doughnut Wedding] User registered'); - $body = $this->container->get('twig')->render('user_registered.txt.twig.html.twig', ['user' => $user]); + $body = $this->container->get('twig')->render('user_registered.txt.twig.html.twig', ['user' => $user, 'resourceOwner' => $resourceOwner]); $message ->setFrom(['no-reply@doughnutwedding.com' => '[Doughnut Wedding]']) ->setTo([ - 'katrina.a.johnson@gmail.com' => 'Katrina Johnson', - 'sikofitt@gmail.com' => 'R. Eric Wheeler' + $this->container->getParameter('katrina.email') => 'Katrina Johnson', + $this->container->getParameter('eric.email') => 'R. Eric Wheeler', ])->setBody($body); - $this->container->get('swiftmailer.mailer')->send($message); - $url = $this->container->get('router')->generate('sikofitt_doughnutwedding_default_index'); - return new RedirectResponse($url); - } - public function onKernelRequest(FormEvent $event) - { - $url = $this->router->generate('sikofitt_doughnutwedding_default_index'); - $event->setResponse(new RedirectResponse($url)); + $this->container->get('swiftmailer.mailer')->send($message); } -} \ No newline at end of file +} diff --git a/src/Sikofitt/DoughnutWeddingBundle/EventListener/UserRedirectOnLoggedInListener.php b/src/Sikofitt/DoughnutWeddingBundle/EventListener/UserRedirectOnLoggedInListener.php index 896c859..56659e8 100644 --- a/src/Sikofitt/DoughnutWeddingBundle/EventListener/UserRedirectOnLoggedInListener.php +++ b/src/Sikofitt/DoughnutWeddingBundle/EventListener/UserRedirectOnLoggedInListener.php @@ -62,7 +62,6 @@ class UserRedirectOnLoggedInListener */ public function onKernelRequest(GetResponseEvent $event): void { - $token = $this->tokenStorage->getToken(); if (null !== $token) { @@ -90,7 +89,6 @@ class UserRedirectOnLoggedInListener */ private function shouldRedirectRoute(array $routeInformation): bool { - return true === in_array( $routeInformation['_route'], $this->getRedirectRoutes(), @@ -107,9 +105,8 @@ class UserRedirectOnLoggedInListener return [ 'fos_user_security_login', 'fos_user_registration_confirmed', - 'hwi_oauth_connect', 'fos_user_resetting_request', - 'fos_user_registration_register' + 'fos_user_registration_register', ]; } } diff --git a/src/Sikofitt/DoughnutWeddingBundle/Factory/GoogleCloudStorageServiceFactory.php b/src/Sikofitt/DoughnutWeddingBundle/Factory/GoogleCloudStorageServiceFactory.php index 220a44a..36bedf1 100644 --- a/src/Sikofitt/DoughnutWeddingBundle/Factory/GoogleCloudStorageServiceFactory.php +++ b/src/Sikofitt/DoughnutWeddingBundle/Factory/GoogleCloudStorageServiceFactory.php @@ -1,51 +1,65 @@ . + */ + namespace Sikofitt\DoughnutWeddingBundle\Factory; -use Gaufrette\Exception\FileNotFound; use Google\Auth\Credentials\ServiceAccountCredentials; use Google_Service_Storage; -class GoogleCloudStorageServiceFactory { - /** +class GoogleCloudStorageServiceFactory +{ + /** * @param string $credentialFile * @param string $clientId * @param string $applicationName * - * @return \Google_Service_Storage * @throws \ErrorException * @throws \InvalidArgumentException + * + * @return \Google_Service_Storage */ - public static function createGoogleCloudService(string $credentialFile, string $clientId, string $applicationName) : \Google_Service_Storage + public static function createGoogleCloudService(string $credentialFile, string $clientId, string $applicationName): \Google_Service_Storage { - if(false === file_exists($credentialFile)) { - throw new \ErrorException(sprintf('File %s does not exist.', $credentialFile)); - } - if(false === is_readable($credentialFile)) { - throw new \ErrorException(sprintf('File %s is not readable. Check permissions.', $credentialFile)); - } + if (false === file_exists($credentialFile)) { + throw new \ErrorException(sprintf('File %s does not exist.', $credentialFile)); + } + if (false === is_readable($credentialFile)) { + throw new \ErrorException(sprintf('File %s is not readable. Check permissions.', $credentialFile)); + } - $jsonStr = file_get_contents($credentialFile); - if( null === $credentials = json_decode($jsonStr, true)) { - throw new \ErrorException('Could not decode google json credentials'); - } + $jsonStr = file_get_contents($credentialFile); + if (null === $credentials = json_decode($jsonStr, true)) { + throw new \ErrorException('Could not decode google json credentials'); + } - $client = new \Google_Client(); - $client->setClientId($clientId); - $client->setApplicationName($applicationName); + $client = new \Google_Client(); + $client->setClientId($clientId); + $client->setApplicationName($applicationName); - - $cred = ServiceAccountCredentials::makeCredentials( + $cred = ServiceAccountCredentials::makeCredentials( Google_Service_Storage::DEVSTORAGE_FULL_CONTROL, $credentials ); - $token = $cred->fetchAuthToken(); - $client->setAccessToken($token); + $token = $cred->fetchAuthToken(); + $client->setAccessToken($token); - - - - return new \Google_Service_Storage($client); + return new \Google_Service_Storage($client); } - -} \ No newline at end of file +} diff --git a/src/Sikofitt/DoughnutWeddingBundle/Form/ChangePasswordFormType.php b/src/Sikofitt/DoughnutWeddingBundle/Form/ChangePasswordFormType.php index 8b7286b..83dedfa 100644 --- a/src/Sikofitt/DoughnutWeddingBundle/Form/ChangePasswordFormType.php +++ b/src/Sikofitt/DoughnutWeddingBundle/Form/ChangePasswordFormType.php @@ -1,24 +1,37 @@ . */ namespace Sikofitt\DoughnutWeddingBundle\Form; - use Symfony\Component\Form\AbstractType; use Symfony\Component\Form\FormBuilderInterface; -class ChangePasswordFormType extends AbstractType { +class ChangePasswordFormType extends AbstractType +{ + public function buildForm(FormBuilderInterface $builder, array $options) + { + $builder->remove('current_password'); + } - public function buildForm(FormBuilderInterface $builder, array $options) { - $builder->remove('current_password'); - } - - public function getParent() { - return \FOS\UserBundle\Form\Type\ChangePasswordFormType::class; - } -} \ No newline at end of file + public function getParent() + { + return \FOS\UserBundle\Form\Type\ChangePasswordFormType::class; + } +} diff --git a/src/Sikofitt/DoughnutWeddingBundle/Form/ContactFormType.php b/src/Sikofitt/DoughnutWeddingBundle/Form/ContactFormType.php index 713f27d..9ff8ab8 100644 --- a/src/Sikofitt/DoughnutWeddingBundle/Form/ContactFormType.php +++ b/src/Sikofitt/DoughnutWeddingBundle/Form/ContactFormType.php @@ -1,10 +1,27 @@ -. + */ namespace Sikofitt\DoughnutWeddingBundle\Form; - -use EWZ\Bundle\RecaptchaBundle\Form\Type\EWZRecaptchaType; -use ReCaptcha\ReCaptcha; use Sikofitt\DoughnutWeddingBundle\Entity\Contact; use Symfony\Component\Form\AbstractType; use Symfony\Component\Form\Extension\Core\Type\EmailType; @@ -17,24 +34,25 @@ use Symfony\Component\Validator\Constraints\Email; use Symfony\Component\Validator\Constraints\Length; use Symfony\Component\Validator\Constraints\NotBlank; use Symfony\Component\Validator\Constraints\NotNull; -use EWZ\Bundle\RecaptchaBundle\Validator\Constraints\IsTrue as RecaptchaTrue; -/** - * Class ContactFormType - */ -class ContactFormType extends AbstractType { - /** - * @inheritdoc +/** + * Class ContactFormType. + */ +class ContactFormType extends AbstractType +{ + /** + * {@inheritdoc} */ - public function buildForm(FormBuilderInterface $builder, array $options) : void { - $builder + public function buildForm(FormBuilderInterface $builder, array $options): void + { + $builder ->add('name', TextType::class, [ 'label_attr' => [ 'class' => 'uk-form-label uk-visible@m', ], 'label' => 'Name', 'attr' => [ - 'class' => 'uk-input uk-form-large uk-margin-small-bottom', + 'class' => 'uk-padding-small uk-input uk-form-large uk-margin-small-bottom', 'placeholder' => 'Enter your name', ], 'required' => true, @@ -42,8 +60,8 @@ class ContactFormType extends AbstractType { 'constraints' => [ new NotBlank(), new NotNull(), - new Length(['max' => 255, 'min' => 5]) - ] + new Length(['max' => 255, 'min' => 5]), + ], ]) ->add('email', EmailType::class, [ 'label_attr' => [ @@ -51,7 +69,7 @@ class ContactFormType extends AbstractType { ], 'label' => 'Email (Not required)', 'attr' => [ - 'class' => 'uk-input uk-form-large uk-margin-small-bottom', + 'class' => 'uk-padding-small uk-input uk-form-large uk-margin-small-bottom', 'placeholder' => 'Email address (not required)', 'autocomplete' => 'off', 'autocorrect' => 'off', @@ -65,8 +83,8 @@ class ContactFormType extends AbstractType { 'checkMX' => true, 'checkHost' => true, 'strict' => true, - ]) - ] + ]), + ], ]) ->add('subject', TextType::class, [ 'label_attr' => [ @@ -74,16 +92,16 @@ class ContactFormType extends AbstractType { ], 'label' => 'Subject', 'attr' => [ - 'class' => 'uk-input uk-form-large uk-margin-small-bottom', - 'placeholder' => 'Enter a subject for our comment.', + 'class' => 'uk-padding-small uk-input uk-form-large uk-margin-small-bottom', + 'placeholder' => 'Enter a subject for your comment.', ], 'required' => true, 'trim' => true, 'constraints' => [ new NotBlank(), new NotNull(), - new Length(['max' => 255, 'min' => 5]) - ] + new Length(['max' => 255, 'min' => 5]), + ], ]) ->add('comment', TextareaType::class, [ 'label_attr' => [ @@ -93,36 +111,38 @@ class ContactFormType extends AbstractType { 'attr' => [ 'rows' => 4, 'class' => 'uk-padding-small uk-textarea uk-form-large uk-margin-medium-bottom', - 'placeholder' => 'Enter your Comment', + 'placeholder' => 'Enter your comment', ], 'required' => true, 'constraints' => [ new NotBlank(), new NotNull(), - ] + ], ]) ->add('submit', SubmitType::class, [ 'label' => 'Send', 'attr' => [ - 'class' => 'uk-button uk-button-primary uk-button-large uk-width-1-1@s uk-width-1-3@m' - ] + 'class' => 'uk-button uk-button-primary uk-button-large uk-width-1-1', + ], ]); } /** - * @inheritdoc + * {@inheritdoc} * * @throws \Symfony\Component\OptionsResolver\Exception\AccessException */ - public function configureOptions(OptionsResolver $resolver) : void { - $resolver->setDefault('data_class', Contact::class); - $resolver->setDefault('attr', ['class' => 'uk-form uk-form-horizontal']); + public function configureOptions(OptionsResolver $resolver): void + { + $resolver->setDefault('data_class', Contact::class); + $resolver->setDefault('attr', ['class' => 'uk-form uk-form-horizontal']); } /** - * @inheritdoc + * {@inheritdoc} */ - public function getBlockPrefix() : ?string { - return 'sikofitt_doughnut_wedding_contact'; + public function getBlockPrefix(): ?string + { + return 'sikofitt_doughnut_wedding_contact'; } -} \ No newline at end of file +} diff --git a/src/Sikofitt/DoughnutWeddingBundle/Form/GalleryUploadType.php b/src/Sikofitt/DoughnutWeddingBundle/Form/GalleryUploadType.php index 8d2094a..5bc32db 100644 --- a/src/Sikofitt/DoughnutWeddingBundle/Form/GalleryUploadType.php +++ b/src/Sikofitt/DoughnutWeddingBundle/Form/GalleryUploadType.php @@ -1,31 +1,80 @@ . */ namespace Sikofitt\DoughnutWeddingBundle\Form; - use Symfony\Component\Form\AbstractType; +use Symfony\Component\Form\Extension\Core\Type\CollectionType; +use Symfony\Component\Form\Extension\Core\Type\TextareaType; +use Symfony\Component\Form\Extension\Core\Type\TextType; use Symfony\Component\Form\FormBuilderInterface; use Vich\UploaderBundle\Form\Type\VichImageType; -class GalleryUploadType extends AbstractType { - - public function buildForm(FormBuilderInterface $builder, array $options) { - $builder->add('imageFile', VichImageType::class, [ +class GalleryUploadType extends AbstractType +{ + public function buildForm(FormBuilderInterface $builder, array $options) + { + $builder->add('imageFile', VichImageType::class, [ 'label_attr' => [ - 'class' => 'uk-form-label' + 'class' => 'uk-form-label uk-hidden', ], 'attr' => [ - 'class' => '' - ] + 'class' => 'uk-padding-small', + ], ]) - ->add('description') - ->add('tags') - ->add('category'); - } -} \ No newline at end of file + ->add('description', TextareaType::class, [ + 'required' => false, + 'label' => 'Description of image.', + 'attr' => [ + 'rows' => 4, + 'class' => 'uk-textarea uk-form-large uk-padding-small', + ], + 'label_attr' => [ + 'class' => 'uk-form-label', + ], + ]) + ->add('tags', CollectionType::class, [ + 'required' => false, + 'entry_type' => TextType::class, + 'entry_options' => [ + 'attr' => [ + 'class' => 'uk-input uk-form-large uk-width-medium', + ], + ], + 'allow_add' => true, + 'allow_delete' => true, + 'label_attr' => [ + 'class' => 'uk-form-label', + ], + 'attr' => [ + 'class' => 'uk-input uk-form-large uk-padding-small', + ], + ]) + ->add('category', TextType::class, [ + 'required' => false, + 'label_attr' => [ + 'class' => 'uk-form-label', + ], + 'attr' => [ + 'class' => 'uk-input uk-form-large uk-padding-small', + ], + ]); + } +} diff --git a/src/Sikofitt/DoughnutWeddingBundle/Form/ProfileEditType.php b/src/Sikofitt/DoughnutWeddingBundle/Form/ProfileEditType.php index 0e34ee2..5eb8740 100644 --- a/src/Sikofitt/DoughnutWeddingBundle/Form/ProfileEditType.php +++ b/src/Sikofitt/DoughnutWeddingBundle/Form/ProfileEditType.php @@ -1,18 +1,27 @@ . */ namespace Sikofitt\DoughnutWeddingBundle\Form; - -use Symfony\Component\Form\FormEvent; use FOS\UserBundle\Form\Type\ProfileFormType; use FOS\UserBundle\Model\UserManager; -use HWI\Bundle\OAuthBundle\OAuth\Response\PathUserResponse; use Sikofitt\DoughnutWeddingBundle\Entity\Rsvp; use Symfony\Component\Form\AbstractType; use Symfony\Component\Form\CallbackTransformer; @@ -20,17 +29,19 @@ use Symfony\Component\Form\Extension\Core\Type\EmailType; use Symfony\Component\Form\Extension\Core\Type\IntegerType; use Symfony\Component\Form\Extension\Core\Type\TextType; use Symfony\Component\Form\FormBuilderInterface; +use Symfony\Component\Form\FormEvent; use Symfony\Component\Form\FormEvents; -use Symfony\Component\OptionsResolver\OptionsResolver; class ProfileEditType extends AbstractType { -private $userManager; - public function __construct(UserManager $userManager) { - $this->userManager = $userManager; - } + private $userManager; - public function buildForm(FormBuilderInterface $builder, array $options) + public function __construct(UserManager $userManager) + { + $this->userManager = $userManager; + } + + public function buildForm(FormBuilderInterface $builder, array $options) { $emailOptions = $builder->get('email')->getOptions(); @@ -66,12 +77,11 @@ private $userManager; ], ]); - $builder->addEventListener(FormEvents::SUBMIT, function(FormEvent $event) { - - $user = $event->getData(); - $user->setUsername($user->getEmail()); - $this->userManager->updateCanonicalFields($user); - }); + $builder->addEventListener(FormEvents::SUBMIT, function (FormEvent $event) { + $user = $event->getData(); + $user->setUsername($user->getEmail()); + $this->userManager->updateCanonicalFields($user); + }); $builder->get('rsvp') ->addModelTransformer(new CallbackTransformer( function (?Rsvp $rsvp) { @@ -94,4 +104,4 @@ private $userManager; { return ProfileFormType::class; } -} \ No newline at end of file +} diff --git a/src/Sikofitt/DoughnutWeddingBundle/Form/RegistrationType.php b/src/Sikofitt/DoughnutWeddingBundle/Form/RegistrationType.php index 4984906..d8a0132 100644 --- a/src/Sikofitt/DoughnutWeddingBundle/Form/RegistrationType.php +++ b/src/Sikofitt/DoughnutWeddingBundle/Form/RegistrationType.php @@ -20,21 +20,17 @@ namespace Sikofitt\DoughnutWeddingBundle\Form; -use HWI\Bundle\OAuthBundle\OAuth\Response\PathUserResponse; -use Symfony\Component\Form\Extension\Core\Type\NumberType; -use Symfony\Component\Form\Extension\Core\Type\TextareaType; -use Symfony\Component\Form\FormEvent; use FOS\UserBundle\Form\Type\RegistrationFormType; use FOS\UserBundle\Model\UserManager; +use HWI\Bundle\OAuthBundle\OAuth\Response\PathUserResponse; use Sikofitt\DoughnutWeddingBundle\Entity\Rsvp; -use Sikofitt\DoughnutWeddingBundle\Entity\User; use Symfony\Component\Form\AbstractType; use Symfony\Component\Form\CallbackTransformer; -use Symfony\Component\Form\Extension\Core\Type\CheckboxType; -use Symfony\Component\Form\Extension\Core\Type\ChoiceType; -use Symfony\Component\Form\Extension\Core\Type\IntegerType; +use Symfony\Component\Form\Extension\Core\Type\NumberType; +use Symfony\Component\Form\Extension\Core\Type\TextareaType; use Symfony\Component\Form\Extension\Core\Type\TextType; use Symfony\Component\Form\FormBuilderInterface; +use Symfony\Component\Form\FormEvent; use Symfony\Component\Form\FormEvents; use Symfony\Component\Form\FormInterface; use Symfony\Component\Form\FormView; @@ -73,13 +69,12 @@ class RegistrationType extends AbstractType 'attr' => [ 'rows' => 5, 'class' => 'uk-textarea uk-form-large uk-padding-small', - 'placeholder' => 'Anything you would like to share with the Bride and Groom?' - ] + 'placeholder' => 'Anything you would like to share with the Bride and Groom?', + ], ]) ->remove('username'); - $builder->addEventListener(FormEvents::SUBMIT, function(FormEvent $event) { - + $builder->addEventListener(FormEvents::SUBMIT, function (FormEvent $event) { $user = $event->getData(); $user->setUsername($user->getEmail()); $this->userManager->updateCanonicalFields($user); diff --git a/src/Sikofitt/DoughnutWeddingBundle/Pager/View/UIkitTemplate.php b/src/Sikofitt/DoughnutWeddingBundle/Pager/View/UIkitTemplate.php new file mode 100644 index 0000000..882224c --- /dev/null +++ b/src/Sikofitt/DoughnutWeddingBundle/Pager/View/UIkitTemplate.php @@ -0,0 +1,174 @@ +. + */ + +namespace Sikofitt\DoughnutWeddingBundle\Pager\View; + +use Pagerfanta\View\Template\Template; + +class UIkitTemplate extends Template +{ + protected static $defaultOptions = [ + 'prev_message' => '← Previous', + 'next_message' => 'Next →', + 'dots_message' => '…', + 'active_suffix' => '', + 'css_container_class' => 'uk-pagination uk-flex-center', + 'css_prev_class' => 'prev', + 'css_next_class' => 'next', + 'css_disabled_class' => 'disabled', + 'css_dots_class' => 'disabled', + 'css_active_class' => 'active', + 'rel_previous' => 'prev', + 'rel_next' => 'next', + ]; + + /** + * Renders the container for the pagination. + * + * The %pages% placeholder will be replaced by the rendering of pages + * + * @return string + */ + public function container() + { + return sprintf('
        %s
      ', static::$defaultOptions['css_container_class'], '%pages%'); + } + + /** + * Renders a given page. + * + * @param int $page + * + * @return string + */ + public function page($page) + { + if (1 === (int) $page) { + return '
    • '.$page.'
    • '; + } + + return '
    • '.$page.'
    • '; + } + + /** + * Renders a given page with a specified text. + * + * @param int $page + * @param string $text + * + * @return string + */ + public function pageWithText($page, $text) + { + return $this->page($page); + } + + /** + * Renders the disabled state of the previous page. + * + * @return string + */ + public function previousDisabled() + { + return ''; + } + + /** + * Renders the enabled state of the previous page. + * + * @param int $page + * + * @return string + */ + public function previousEnabled($page) + { + if (1 === (int) $page) { + return '
    • Previous
    • '; + } + + return '
    • Previous
    • '; + } + + /** + * Renders the disabled state of the next page. + * + * @return string + */ + public function nextDisabled() + { + return ''; + } + + /** + * Renders the enabled state of the next page. + * + * @param int $page + * + * @return string + */ + public function nextEnabled($page) + { + return '
    • Next
    • '; + } + + /** + * Renders the first page. + * + * @return string + */ + public function first() + { + return ''; + } + + /** + * Renders the last page. + * + * @param int $page + * + * @return string + */ + public function last($page) + { + return ''; + } + + /** + * Renders the current page. + * + * @param int $page + * + * @return string + */ + public function current($page) + { + return '
    • '.$page.'
    • '; + } + + /** + * Renders the separator between pages. + * + * @return string + */ + public function separator() + { + return '
    • ...
    • '; + } +} diff --git a/src/Sikofitt/DoughnutWeddingBundle/Repository/ContactRepository.php b/src/Sikofitt/DoughnutWeddingBundle/Repository/ContactRepository.php index f5cd007..3e20998 100644 --- a/src/Sikofitt/DoughnutWeddingBundle/Repository/ContactRepository.php +++ b/src/Sikofitt/DoughnutWeddingBundle/Repository/ContactRepository.php @@ -1,9 +1,27 @@ . + */ + namespace Sikofitt\DoughnutWeddingBundle\Repository; /** - * ContactRepository + * ContactRepository. * * This class was generated by the Doctrine ORM. Add your own custom * repository methods below. diff --git a/src/Sikofitt/DoughnutWeddingBundle/Repository/ImageCategoryRepository.php b/src/Sikofitt/DoughnutWeddingBundle/Repository/ImageCategoryRepository.php index 6425cd2..fb9411a 100644 --- a/src/Sikofitt/DoughnutWeddingBundle/Repository/ImageCategoryRepository.php +++ b/src/Sikofitt/DoughnutWeddingBundle/Repository/ImageCategoryRepository.php @@ -1,9 +1,27 @@ . + */ + namespace Sikofitt\DoughnutWeddingBundle\Repository; /** - * ImageCategoryRepository + * ImageCategoryRepository. * * This class was generated by the Doctrine ORM. Add your own custom * repository methods below. diff --git a/src/Sikofitt/DoughnutWeddingBundle/Repository/ImageCommentRepository.php b/src/Sikofitt/DoughnutWeddingBundle/Repository/ImageCommentRepository.php index 543abb2..24ae634 100644 --- a/src/Sikofitt/DoughnutWeddingBundle/Repository/ImageCommentRepository.php +++ b/src/Sikofitt/DoughnutWeddingBundle/Repository/ImageCommentRepository.php @@ -1,9 +1,27 @@ . + */ + namespace Sikofitt\DoughnutWeddingBundle\Repository; /** - * ImageCommentRepository + * ImageCommentRepository. * * This class was generated by the Doctrine ORM. Add your own custom * repository methods below. diff --git a/src/Sikofitt/DoughnutWeddingBundle/Repository/ImageRepository.php b/src/Sikofitt/DoughnutWeddingBundle/Repository/ImageRepository.php index 6d4556e..f135f55 100644 --- a/src/Sikofitt/DoughnutWeddingBundle/Repository/ImageRepository.php +++ b/src/Sikofitt/DoughnutWeddingBundle/Repository/ImageRepository.php @@ -1,13 +1,72 @@ . + */ + namespace Sikofitt\DoughnutWeddingBundle\Repository; +use Doctrine\ORM\EntityRepository; +use Sikofitt\DoughnutWeddingBundle\Entity\Image; + /** - * ImageRepository + * ImageRepository. * * This class was generated by the Doctrine ORM. Add your own custom * repository methods below. */ -class ImageRepository extends \Doctrine\ORM\EntityRepository +class ImageRepository extends EntityRepository { + /** + * @param string $tag + * + * @return array + */ + public function findImageByTag(string $tag): array + { + $images = $this->getEntityManager() + ->createQueryBuilder() + ->select('i') + ->from(Image::class, 'i') + ->where('i.tags LIKE :tag') + ->setParameter('tag', '%'.$tag.'%') + ->getQuery()->getResult(); + /** + * @var int $key + * @var Image $image + */ + foreach ($images as $key => $image) { + if (false === in_array($tag, $image->getTags(), true)) { + unset($images[$key]); + } + } + + return $images; + } + + public function findImageByCategory(string $category): array + { + return $this + ->getEntityManager() + ->createQueryBuilder() + ->select('i') + ->from(Image::class, 'i') + ->where('i.category =:category') + ->setParameter('category', $category) + ->getQuery()->getResult(); + } } diff --git a/src/Sikofitt/DoughnutWeddingBundle/Repository/ImageTagRepository.php b/src/Sikofitt/DoughnutWeddingBundle/Repository/ImageTagRepository.php index 01d240f..b66d1e2 100644 --- a/src/Sikofitt/DoughnutWeddingBundle/Repository/ImageTagRepository.php +++ b/src/Sikofitt/DoughnutWeddingBundle/Repository/ImageTagRepository.php @@ -1,9 +1,27 @@ . + */ + namespace Sikofitt\DoughnutWeddingBundle\Repository; /** - * ImageTagRepository + * ImageTagRepository. * * This class was generated by the Doctrine ORM. Add your own custom * repository methods below. diff --git a/src/Sikofitt/DoughnutWeddingBundle/Resources/views/Image/index.html.twig b/src/Sikofitt/DoughnutWeddingBundle/Resources/views/Image/index.html.twig index 99478e6..268ae5c 100644 --- a/src/Sikofitt/DoughnutWeddingBundle/Resources/views/Image/index.html.twig +++ b/src/Sikofitt/DoughnutWeddingBundle/Resources/views/Image/index.html.twig @@ -1,8 +1,151 @@ {% extends "::base.html.twig" %} -{% block title %}Gallery{% endblock %} +{% block title %}{% if category is defined %}{{ category|capitalize }} | {% elseif tag is defined %}{{ tag|capitalize }} | {% endif %}Gallery{% endblock %} {% block body %} -

      Gallery

      +

      Gallery

      +

      + {% if category is defined %} + Viewing images from the category {{ category|capitalize }} + {% elseif tag is defined %} + Viewing images tagged with {{ tag|capitalize }} + {% endif %} +

      +
      + {% if images is not null and images is not empty %} + {% for image in images %} + + {% set imageUrl = bucket ~ '/gallery/' ~ vich_uploader_asset(image, 'imageFile')|trim('/', 'left') %} +
      + + + +
      + {% endfor %} + {% else %} +

      + There are currently no images{% if category is defined %} for category {{ category }}{% elseif tag is defined %} for tag {{ tag }}{% endif %}!

      + {% if is_granted('IS_AUTHENTICATED_FULLY') %} +

      + Why don't you upload one? +

      + {% else %} +

      + If you login or register you can upload one! +

      + {% endif %} + {% endif %} + +
      + {% if pager.count > 12 %} + {{ pagerfanta(pager, 'default', { 'omitFirstPage': true}) }} + {% endif %} {% endblock %} +{% block javascripts %} + +{% endblock javascripts %} \ No newline at end of file diff --git a/src/Sikofitt/DoughnutWeddingBundle/Resources/views/Image/upload.html.twig b/src/Sikofitt/DoughnutWeddingBundle/Resources/views/Image/upload.html.twig index 58f2d30..3def15e 100644 --- a/src/Sikofitt/DoughnutWeddingBundle/Resources/views/Image/upload.html.twig +++ b/src/Sikofitt/DoughnutWeddingBundle/Resources/views/Image/upload.html.twig @@ -1,18 +1,70 @@ {% extends "::base.html.twig" %} -{% block title %}Gallery Upload{% endblock %} - +{% block title %}Gallery Upload{% endblock title %} {% block body %} +

      Upload an Image to the Gallery

      {{ form_start(form, {'attr': { 'class': 'uk-form uk-form-horizontal'}}) }} - {{ form_label(form.imageFile, null, {'label_attr':{'class':'uk-hidden'}}) }} + {{ form_label(form.imageFile) }}
      + {{ form_errors(form.imageFile) }} {{ form_widget(form.imageFile) }} -
      - + {{ form_label(form.description) }} +
      + {{ form_errors(form.description) }} + {{ form_widget(form.description) }} +
      + {{ form_label(form.category) }} +
      + {{ form_errors(form.category) }} + {{ form_widget(form.category) }} +
      + {{ form_label(form.tags) }} +
      +
        + {% for tagField in form.tags %} +
      • + {{ form_errors(tagField) }} + {{ form_widget(tagField) }} +
      • + {% endfor %} + {% do form.tags.setRendered %} +
      + Add Tag +
      + + + {{ form_rest(form) }} {{ form_end(form) }} -{% endblock %} +{% endblock body %} +{% block javascripts %} + +{% endblock javascripts %} \ No newline at end of file diff --git a/src/Sikofitt/DoughnutWeddingBundle/Resources/views/Image/view_image.html.twig b/src/Sikofitt/DoughnutWeddingBundle/Resources/views/Image/view_image.html.twig new file mode 100644 index 0000000..dc87871 --- /dev/null +++ b/src/Sikofitt/DoughnutWeddingBundle/Resources/views/Image/view_image.html.twig @@ -0,0 +1,123 @@ +{% extends 'base.html.twig' %} + +{% block body %} + {% set imageUrl = bucket ~ '/gallery/' ~ vich_uploader_asset(image, 'imageFile')|trim('/', 'left') %} + +
      + + + +
      + {{ image.description }} +
      + +
      + +