Finished Registration

This commit is contained in:
R. Eric Wheeler 2017-04-16 16:55:58 -07:00
parent bd716544b0
commit 7a98daf886
30 changed files with 468 additions and 161 deletions

3
.gitignore vendored
View File

@ -1,5 +1,5 @@
/app/config/parameters.yml /app/config/parameters.yml
/build/ /build/dist/
/phpunit.xml /phpunit.xml
/var/* /var/*
!/var/cache !/var/cache
@ -16,6 +16,7 @@
/web/bundles/ /web/bundles/
/web/js/ /web/js/
/web/css/ /web/css/
/web/images/
*~ *~
/lib /lib
.idea .idea

View File

@ -17,7 +17,8 @@ module.exports = function (grunt) {
src: [ src: [
'./vendor/bower/jquery/dist/jquery.js', './vendor/bower/jquery/dist/jquery.js',
'./vendor/bower/uikit/dist/js/uikit.js', './vendor/bower/uikit/dist/js/uikit.js',
'./vendor/bower/uikit/dist/js/uikit-icons.js' './vendor/bower/uikit/dist/js/uikit-icons.js',
'./vendor/bower/select2/dist/js/select2.full.min.js'
], ],
dest: 'build/dist/js/vendor.min.js' dest: 'build/dist/js/vendor.min.js'
} }
@ -97,6 +98,18 @@ module.exports = function (grunt) {
cwd: './vendor/bower/uikit/dist/images', cwd: './vendor/bower/uikit/dist/images',
src: ['**'], src: ['**'],
dest: 'web/images' dest: 'web/images'
},
{
expand:true,
cwd: './vendor/bower/select2/dist/css',
src: ['select2.min.css'],
dest: 'web/css'
},
{
expand: true,
cwd: 'build/images',
src: ['*'],
dest: 'web/images'
} }
] ]
} }

View File

@ -1,5 +1,5 @@
{% extends "@FOSUser/layout.html.twig" %} {% extends "base.html.twig" %}
{% block fos_user_content %} {% block body %}
{% include "@FOSUser/Registration/register_content.html.twig" %} {% include "@FOSUser/Registration/register_content.html.twig" %}
{% endblock fos_user_content %} {% endblock body %}

View File

@ -1,8 +1,83 @@
{% trans_default_domain 'FOSUserBundle' %} {% trans_default_domain 'FOSUserBundle' %}
<div class="uk-width-1-1">
{{ form_start(form, {'method': 'post', 'action': path('fos_user_registration_register'), 'attr': {'class': 'fos_user_registration_register'}}) }} {{ form_errors(form) }}
{{ form_widget(form) }} </div>
<div> {{ form_start(form, {'method': 'post', 'action': path('fos_user_registration_register'), 'attr': {'class': 'fos_user_registration_register uk-form'}}) }}
<input type="submit" value="{{ 'registration.submit'|trans }}" /> <fieldset class="uk-fieldset">
<legend class="uk-legend">
Register account
</legend>
<div class="uk-margin">
<div hidden>{{ form_label(form.email) }}</div>
<div class="uk-form-controls uk-form-controls-text">
{{ form_widget(form.email, { 'attr': {'placeholder':'Email address', 'class':'uk-input uk-form-large uk-padding-small'} }) }}
</div>
</div> </div>
<div class="uk-margin">
<div hidden>{{ form_label(form.username, 'Username', { 'label_attr':{'class':'uk-form-label'}}) }}</div>
<div class="uk-form-controls uk-form-controls-text">
{{ form_widget(form.username, { 'attr': {'placeholder':'Username', 'class':'uk-input uk-form-large uk-padding-small'} }) }}
</div>
</div>
<div class="uk-margin">
<div hidden>{{ form_label(form.first_name, 'First name', { 'label_attr':{'class':'uk-form-label'}}) }}</div>
<div class="uk-form-controls uk-form-controls-text">
{{ form_widget(form.first_name, { 'attr': {'placeholder':'First name', 'class':'uk-input uk-form-large uk-padding-small'} }) }}
</div>
</div>
<div class="uk-margin">
<div hidden>{{ form_label(form.last_name, 'Last name', { 'label_attr':{'class':'uk-form-label'}}) }}</div>
<div class="uk-form-controls uk-form-controls-text">
{{ form_widget(form.last_name, { 'attr': {'placeholder':'Last name', 'class':'uk-input uk-input uk-form-large uk-padding-small'} }) }}
</div>
</div>
<div class="uk-margin uk-grid" uk-grid>
<div class="uk-width-2-3">
{{ form_label(form.familyside) }}
</div>
<div class="uk-width-1-3">
<div class="uk-form-controls uk-form-controls-text">
{{ form_widget(form.familyside) }}
</div>
</div>
</div>
<div class="uk-margin uk-grid" uk-grid>
<div class="uk-width-3-4 uk-width-2-3@m">
{{ form_label(form.family) }}
</div>
<div class="uk-width-1-4@s uk-width-1-4 uk-width-1-3@m uk-form-controls">
{{ form_widget(form.family, { 'attr': {'class':'uk-checkbox'} }) }}
</div>
</div>
<div class="uk-margin">
<div hidden>{{ form_label(form.rsvp) }}</div>
<div class="uk-form-controls uk-form-controls-text">
{{ form_widget(form.rsvp) }}
</div>
<div class="uk-margin">
<div hidden>{{ form_label(form.plainPassword.first, 'Password', { 'label_attr':{'class':'uk-form-label'}}) }}</div>
<div class="uk-form-controls uk-form-controls-text">
{{ form_widget(form.plainPassword.first, { 'attr': {'placeholder':'Password', 'class':'uk-input uk-form-large uk-padding-small'} }) }}
</div>
</>
<div class="uk-margin">
<div hidden>{{ form_label(form.plainPassword.second, 'Repeat ', { 'label_attr':{'class':'uk-form-label'}}) }}</div>
<div class="uk-form-controls uk-form-controls-text">
{{ form_widget(form.plainPassword.second, { 'attr': {'placeholder':'Repeat Password', 'class':'uk-input uk-form-large uk-padding-small'} }) }}
</div>
</div>
<div class="uk-margin uk-grid" uk-grid>
<div class="uk-form-controls uk-width-1-2">
<input type="submit" value="{{ 'registration.submit'|trans }}" class="uk-button uk-button-primary uk-button-large" />
</div>
<div class="uk-form-controls-text uk-text-muted uk-margin-small-top uk-width-1-2">
<div class="uk-text-large uk-visible@m">Already have an account? Login <a href="{{ path('fos_user_security_login') }}">here</a>.</div>
<div class="uk-hidden@m uk-padding-small uk-padding-remove-vertical">Already have an account? Login <a href="{{ path('fos_user_security_login') }}">here</a>.</div>
</div>
</div>
</fieldset>
{{ form_end(form) }} {{ form_end(form) }}

View File

@ -8,6 +8,7 @@
<title>Title</title> <title>Title</title>
<meta name="viewport" id="viewport" content="width=device-width,minimum-scale=1.0,maximum-scale=10.0,initial-scale=1.0"> <meta name="viewport" id="viewport" content="width=device-width,minimum-scale=1.0,maximum-scale=10.0,initial-scale=1.0">
<link rel="stylesheet" type="text/css" href="{{ asset('css/doughnutwedding.min.css') }}" /> <link rel="stylesheet" type="text/css" href="{{ asset('css/doughnutwedding.min.css') }}" />
<link rel="stylesheet" type="text/css" href="{{ asset('css/select2.min.css') }}" />
<script src="{{ asset('js/vendor.min.js') }}" type="text/javascript"></script> <script src="{{ asset('js/vendor.min.js') }}" type="text/javascript"></script>
<script src="{{ asset('js/doughnutwedding.min.js') }}" type="text/javascript"></script> <script src="{{ asset('js/doughnutwedding.min.js') }}" type="text/javascript"></script>
</head> </head>
@ -17,6 +18,8 @@
<div class="uk-container-small uk-container uk-margin-large-top uk-margin-large-bottom"> <div class="uk-container-small uk-container uk-margin-large-top uk-margin-large-bottom">
{% include 'flash_messages.html.twig' %} {% include 'flash_messages.html.twig' %}
{% block body %}{% endblock %} {% block body %}{% endblock %}
{% include "social_login.html.twig" %}
{% block footer %}{% endblock %}
</div> </div>
</body> </body>
</html> </html>

View File

@ -1,76 +1,19 @@
{% extends 'base.html.twig' %} {% extends 'base.html.twig' %}
{% block body %} {% block body %}
<div id="wrapper"> <div class="uk-child-width-1-3@s uk-grid-small" uk-grid>
<div id="container"> <div>
<div id="welcome"> <div class="uk-background-cover uk-margin-small-bottom uk-height-small uk-card uk-card-default uk-card-body uk-flex uk-flex-center uk-flex-middle" style="background-image:url(http://placekitten.com/g/500/500);">
<h1><span>Welcome to</span> Symfony {{ constant('Symfony\\Component\\HttpKernel\\Kernel::VERSION') }}</h1>
</div> </div>
<div class="uk-height-small uk-card uk-card-default uk-card-body uk-flex uk-flex-center uk-flex-middle">Small2</div>
<div id="status"> </div>
<p> <div>
<svg id="icon-status" width="1792" height="1792" viewBox="0 0 1792 1792" xmlns="http://www.w3.org/2000/svg"><path d="M1671 566q0 40-28 68l-724 724-136 136q-28 28-68 28t-68-28l-136-136-362-362q-28-28-28-68t28-68l136-136q28-28 68-28t68 28l294 295 656-657q28-28 68-28t68 28l136 136q28 28 28 68z" fill="#759E1A"/></svg> <div class="uk-height-medium uk-card uk-card-default uk-card-body uk-flex uk-flex-center uk-flex-middle">Medium</div>
</div>
Your application is now ready. You can start working on it at: <div>
<code>{{ base_dir }}</code> <div class="uk-height-large uk-card uk-card-default uk-card-body uk-flex uk-flex-center uk-flex-middle">Large</div>
</p>
</div>
<div id="next">
<h2>What's next?</h2>
<p>
<svg id="icon-book" version="1.1" xmlns="http://www.w3.org/2000/svg" x="0px" y="0px" viewBox="-12.5 9 64 64" enable-background="new -12.5 9 64 64" xml:space="preserve">
<path fill="#AAA" d="M6.8,40.8c2.4,0.8,4.5-0.7,4.9-2.5c0.2-1.2-0.3-2.1-1.3-3.2l-0.8-0.8c-0.4-0.5-0.6-1.3-0.2-1.9
c0.4-0.5,0.9-0.8,1.8-0.5c1.3,0.4,1.9,1.3,2.9,2.2c-0.4,1.4-0.7,2.9-0.9,4.2l-0.2,1c-0.7,4-1.3,6.2-2.7,7.5
c-0.3,0.3-0.7,0.5-1.3,0.6c-0.3,0-0.4-0.3-0.4-0.3c0-0.3,0.2-0.3,0.3-0.4c0.2-0.1,0.5-0.3,0.4-0.8c0-0.7-0.6-1.3-1.3-1.3
c-0.6,0-1.4,0.6-1.4,1.7s1,1.9,2.4,1.8c0.8,0,2.5-0.3,4.2-2.5c2-2.5,2.5-5.4,2.9-7.4l0.5-2.8c0.3,0,0.5,0.1,0.8,0.1
c2.4,0.1,3.7-1.3,3.7-2.3c0-0.6-0.3-1.2-0.9-1.2c-0.4,0-0.8,0.3-1,0.8c-0.1,0.6,0.8,1.1,0.1,1.5c-0.5,0.3-1.4,0.6-2.7,0.4l0.3-1.3
c0.5-2.6,1-5.7,3.2-5.8c0.2,0,0.8,0,0.8,0.4c0,0.2,0,0.2-0.2,0.5c-0.2,0.3-0.3,0.4-0.2,0.7c0,0.7,0.5,1.1,1.2,1.1
c0.9,0,1.2-1,1.2-1.4c0-1.2-1.2-1.8-2.6-1.8c-1.5,0.1-2.8,0.9-3.7,2.1c-1.1,1.3-1.8,2.9-2.3,4.5c-0.9-0.8-1.6-1.8-3.1-2.3
c-1.1-0.7-2.3-0.5-3.4,0.3c-0.5,0.4-0.8,1-1,1.6c-0.4,1.5,0.4,2.9,0.8,3.4l0.9,1c0.2,0.2,0.6,0.8,0.4,1.5c-0.3,0.8-1.2,1.3-2.1,1
c-0.4-0.2-1-0.5-0.9-0.9c0.1-0.2,0.2-0.3,0.3-0.5s0.1-0.3,0.1-0.3c0.2-0.6-0.1-1.4-0.7-1.6c-0.6-0.2-1.2,0-1.3,0.8
C4.3,38.4,4.7,40,6.8,40.8z M46.1,20.9c0-4.2-3.2-7.5-7.1-7.5h-3.8C34.8,10.8,32.7,9,30.2,9L-2.3,9.1c-2.8,0.1-4.9,2.4-4.9,5.4
L-7,58.6c0,4.8,8.1,13.9,11.6,14.1l34.7-0.1c3.9,0,7-3.4,7-7.6L46.1,20.9z M-0.3,36.4c0-8.6,6.5-15.6,14.5-15.6
c8,0,14.5,7,14.5,15.6S22.1,52,14.2,52C6.1,52-0.3,45-0.3,36.4z M42.1,65.1c0,1.8-1.5,3.1-3.1,3.1H4.6c-0.7,0-3-1.8-4.5-4.4h30.4
c2.8,0,5-2.4,5-5.4V17.9h3.7c1.6,0,2.9,1.4,2.9,3.1V65.1L42.1,65.1z"/>
</svg>
Read the documentation to learn
<a href="http://symfony.com/doc/{{ constant('Symfony\\Component\\HttpKernel\\Kernel::VERSION')[:3] }}/page_creation.html">
How to create your first page in Symfony
</a>
</p>
</div>
</div> </div>
</div> </div>
{% endblock %}
{% block stylesheets %}
<style>
body { background: #F5F5F5; font: 18px/1.5 sans-serif; }
h1, h2 { line-height: 1.2; margin: 0 0 .5em; }
h1 { font-size: 36px; }
h2 { font-size: 21px; margin-bottom: 1em; }
p { margin: 0 0 1em 0; }
a { color: #0000F0; }
a:hover { text-decoration: none; }
code { background: #F5F5F5; max-width: 100px; padding: 2px 6px; word-wrap: break-word; }
#wrapper { background: #FFF; margin: 1em auto; max-width: 800px; width: 95%; }
#container { padding: 2em; }
#welcome, #status { margin-bottom: 2em; }
#welcome h1 span { display: block; font-size: 75%; }
#icon-status, #icon-book { float: left; height: 64px; margin-right: 1em; margin-top: -4px; width: 64px; }
#icon-book { display: none; }
@media (min-width: 768px) {
#wrapper { width: 80%; margin: 2em auto; }
#icon-book { display: inline-block; }
#status a, #next a { display: block; }
@-webkit-keyframes fade-in { 0% { opacity: 0; } 100% { opacity: 1; } }
@keyframes fade-in { 0% { opacity: 0; } 100% { opacity: 1; } }
.sf-toolbar { opacity: 0; -webkit-animation: fade-in 1s .2s forwards; animation: fade-in 1s .2s forwards;}
}
</style>
{% endblock %} {% endblock %}

View File

@ -1,10 +0,0 @@
{% extends 'base.html.twig' %}
{% block body %}
{% endblock %}
{% block stylesheets %}
{% endblock %}

View File

@ -0,0 +1,17 @@
{% if(is_granted('IS_AUTHENTICATED_ANONYMOUSLY') and hide_social is not defined ) %}
<div class="uk-width-1-1 uk-padding-small uk-align-center">
<h4 class="uk-heading-line uk-text-center"><span><a href="{{ url('fos_user_security_login') }}" title="Login">Login</a></span></h4>
<ul class="uk-iconnav uk-grid uk-child-width-1-6" uk-grid>
<li>
<a class="uk-text-center uk-login uk-login-facebook" href="{{ url("hwi_oauth_service_redirect", {service: "facebook"}) }}" uk-icon="icon: facebook; ratio:1.5"></a>
</li>
<li><a class="uk-text-center uk-login uk-login-google" href="{{ url("hwi_oauth_service_redirect", {service: "google"}) }}" uk-icon="icon: google; ratio:1.5"></a></li>
<li><a class="uk-text-center uk-login uk-login-twitter" href="{{ url("hwi_oauth_service_redirect", {service: "twitter"}) }}" uk-icon="icon: twitter; ratio:1.5"></a></li>
<li><a href="{{ url("hwi_oauth_service_redirect", {service: "yahoo"}) }}" class="uk-icon-image uk-align-center uk-login uk-login-yahoo"><img height="30" width="30" src="{{ asset('images/yahoo.svg') }}" uk-svg></a></li>
<li><a href="{{ url("hwi_oauth_service_redirect", {service: "amazon"}) }}" class="uk-icon-image uk-align-center uk-login uk-login-amazon"><img height="30" width="30" src="{{ asset('images/amazon.svg') }}" uk-svg></a></li>
<li><a class="uk-text-center uk-login uk-login-instagram" href="{{ url("hwi_oauth_service_redirect", {service: "instagram"}) }}" uk-icon="icon: instagram; ratio:1.5"></a></li>
</ul>
</div>
{% endif %}

View File

@ -185,3 +185,5 @@ fos_user:
form: form:
type: Sikofitt\DoughnutWeddingBundle\Form\RegistrationType type: Sikofitt\DoughnutWeddingBundle\Form\RegistrationType
sikofitt_doughnut_wedding:
max_rsvps: ~

View File

@ -1,33 +1,51 @@
hwi_oauth_redirect: hwi_oauth_redirect:
resource: "@HWIOAuthBundle/Resources/config/routing/redirect.xml" resource: "@HWIOAuthBundle/Resources/config/routing/redirect.xml"
prefix: /user/connect prefix: /connect
hwi_oauth_connect: hwi_oauth_connect:
resource: "@HWIOAuthBundle/Resources/config/routing/connect.xml" resource: "@HWIOAuthBundle/Resources/config/routing/connect.xml"
prefix: /user/connect prefix: /connect
hwi_oauth_login: hwi_oauth_login:
resource: "@HWIOAuthBundle/Resources/config/routing/login.xml" resource: "@HWIOAuthBundle/Resources/config/routing/login.xml"
prefix: /user/oauth prefix: /login/oauth
facebook_login: facebook_login:
path: /user/login/callback/facebook path: /login/callback/facebook
google_login: google_login:
path: /user/login/callback/google path: /login/callback/google
twitter_login: twitter_login:
path: /user/login/callback/twitter path: /login/callback/twitter
windows_login: windows_login:
path: /user/login/callback/windows path: /login/callback/windows
instagram_login: instagram_login:
path: /user/login/callback/instagram path: /login/callback/instagram
amazon_login: amazon_login:
path: /user/login/callback/amazon path: /login/callback/amazon
yahoo_login: yahoo_login:
path: /user/login/callback/yahoo path: /login/callback/yahoo
fos_user: os_user_security:
resource: "@FOSUserBundle/Resources/config/routing/all.xml" resource: "@FOSUserBundle/Resources/config/routing/security.xml"
prefix: /user #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
sikofitt_doughnut_wedding: sikofitt_doughnut_wedding:
resource: "@SikofittDoughnutWeddingBundle/Controller/" resource: "@SikofittDoughnutWeddingBundle/Controller/"

View File

@ -5,13 +5,9 @@ security:
FOS\UserBundle\Model\UserInterface: FOS\UserBundle\Model\UserInterface:
algorithm: bcrypt algorithm: bcrypt
cost: 14 cost: 14
# http://symfony.com/doc/current/security.html#b-configuring-how-users-are-loaded
providers: providers:
#in_memory:
# memory: ~
fos_userbundle: fos_userbundle:
id: fos_user.user_provider.username id: fos_user.user_provider.username_email
#id: fos_user.user_manager
firewalls: firewalls:
# disables authentication for assets and the profiler, adapt it according to your needs # disables authentication for assets and the profiler, adapt it according to your needs
dev: dev:
@ -21,40 +17,31 @@ security:
pattern: ^/ pattern: ^/
form_login: form_login:
provider: fos_userbundle provider: fos_userbundle
login_path: /user/connect/ login_path: /login
check_path: /login/login_check check_path: /login_check
logout: logout:
path: /user/logout path: /logout
target: / target: /
anonymous: true anonymous: true
oauth: oauth:
resource_owners: resource_owners:
facebook: /user/login/callback/facebook facebook: /login/callback/facebook
google: /user/login/callback/google google: /login/callback/google
twitter: /user/login/callback/twitter twitter: /login/callback/twitter
windows: /user/login/callback/windows windows: /login/callback/windows
instagram: /user/login/callback/instagram instagram: /login/callback/instagram
amazon: /user/login/callback/amazon amazon: /login/callback/amazon
yahoo: /user/login/callback/yahoo yahoo: /login/callback/yahoo
login_path: /user/oauth login_path: /login
use_forward: false use_forward: false
failure_path: /user/oauth failure_path: /login
oauth_user_provider: oauth_user_provider:
service: hwi_oauth.user.provider.fosub_bridge service: hwi_oauth.user.provider.fosub_bridge
#oauth_user_provider:
# service: my.oauth_aware.user_provider.service
main:
anonymous: ~
# activate different ways to authenticate
# http://symfony.com/doc/current/security.html#a-configuring-how-your-users-will-authenticate
#http_basic: ~
# http://symfony.com/doc/current/cookbook/security/form_login_setup.html
#form_login: ~
access_control: access_control:
- { path: ^/user/login$, role: IS_AUTHENTICATED_ANONYMOUSLY } - { path: ^/login$, role: IS_AUTHENTICATED_ANONYMOUSLY }
- { path: ^/user/register, role: IS_AUTHENTICATED_ANONYMOUSLY } - { path: ^/register, role: IS_AUTHENTICATED_ANONYMOUSLY }
- { path: ^/user/resetting, role: IS_AUTHENTICATED_ANONYMOUSLY } - { path: ^/resetting, role: IS_AUTHENTICATED_ANONYMOUSLY }
- { path: ^/user, role: ROLE_USER }
- { path: ^/gallery/upload, role: ROLE_USER }
- { path: ^/gallery, role: IS_AUTHENTICATED_ANONYMOUSLY }
- { path: ^/admin/, role: ROLE_ADMIN } - { path: ^/admin/, role: ROLE_ADMIN }

View File

@ -22,6 +22,7 @@
"dependencies": { "dependencies": {
"uikit": "3", "uikit": "3",
"jquery": "^3.1.1", "jquery": "^3.1.1",
"parsleyjs": "^2.7.0" "parsleyjs": "^2.7.0",
"select2": "^4.0.3"
} }
} }

34
build/images/amazon.svg Normal file

File diff suppressed because one or more lines are too long

After

Width:  |  Height:  |  Size: 15 KiB

3
build/images/yahoo.svg Normal file

File diff suppressed because one or more lines are too long

After

Width:  |  Height:  |  Size: 5.7 KiB

View File

@ -1,3 +1,13 @@
jQuery.ready(function($) { jQuery(document).ready(function($) {
if(null !== document.querySelector('select') && document.querySelector('select').length > 0) {
var selectPlaceholder = 'Choose an option.';
if(document.querySelector('select').hasAttribute('placeholder')) {
selectPlaceholder = document.querySelector('select').getAttribute('placeholder');
}
jQuery('select').prepend('<option/>').select2({
placeholder: selectPlaceholder,
minimumResultsForSearch: Infinity,
theme: 'default'
});
}
}); });

View File

@ -1,4 +1,5 @@
FROM php:7.1-fpm-alpine #FROM php:7.1-fpm-alpine
FROM php-7.1.4-fpm-alpine
ENV PHPIZE_DEPS \ ENV PHPIZE_DEPS \
autoconf \ autoconf \

View File

@ -4,6 +4,8 @@ namespace Sikofitt\DoughnutWeddingBundle\Controller;
use Symfony\Bundle\FrameworkBundle\Controller\Controller; use Symfony\Bundle\FrameworkBundle\Controller\Controller;
use Sensio\Bundle\FrameworkExtraBundle\Configuration\Route; use Sensio\Bundle\FrameworkExtraBundle\Configuration\Route;
use Symfony\Component\DependencyInjection\ContainerAwareInterface;
use Symfony\Component\DependencyInjection\ContainerInterface;
use Symfony\Component\HttpFoundation\Response; use Symfony\Component\HttpFoundation\Response;
use Symfony\Component\HttpFoundation\Request; use Symfony\Component\HttpFoundation\Request;
@ -12,7 +14,8 @@ use Symfony\Component\HttpFoundation\Request;
*/ */
class DefaultController extends Controller class DefaultController extends Controller
{ {
/**
/**
* @Route("/") * @Route("/")
* *
* @param Request $request * @param Request $request
@ -20,15 +23,11 @@ class DefaultController extends Controller
*/ */
public function indexAction(Request $request) public function indexAction(Request $request)
{ {
if(null === $user = $request->getUser()) { $parameters = [];
return $this->render('default/index.html.twig', array( if(null !== $this->getUser()) {
'base_dir' => $this->get('kernel')->getRootDir(), $parameters['hide_social'] = true;
)); }
} return $this->render('default/index.html.twig', $parameters);
return $this->render('default/index_user.html.twig', array(
'base_dir' => $this->get('kernel')->getRootDir(),
));
} }
} }

View File

@ -0,0 +1,56 @@
<?php
namespace Sikofitt\DoughnutWeddingBundle\Controller;
use Symfony\Bundle\FrameworkBundle\Controller\Controller;
use Sensio\Bundle\FrameworkExtraBundle\Configuration\Route;
/**
* Class ImageController
*
* @package Sikofitt\DoughnutWeddingBundle\Controller
* @Route("/gallery")
*/
class ImageController extends Controller
{
/**
* @Route("/")
*/
public function indexAction()
{
return $this->render('SikofittDoughnutWeddingBundle:Image:index.html.twig', array(
// ...
));
}
/**
* @Route("/upload")
*/
public function uploadAction()
{
return $this->render('SikofittDoughnutWeddingBundle:Image:upload.html.twig', array(
// ...
));
}
/**
* @Route("/tag")
*/
public function tagAction()
{
return $this->render('SikofittDoughnutWeddingBundle:Image:tag.html.twig', array(
// ...
));
}
/**
* @Route("/category")
*/
public function categoryAction()
{
return $this->render('SikofittDoughnutWeddingBundle:Image:category.html.twig', array(
// ...
));
}
}

View File

@ -32,6 +32,7 @@ use Symfony\Component\HttpFoundation\StreamedResponse;
/** /**
* Class UserController. * Class UserController.
*/ */
class UserController extends Controller class UserController extends Controller
{ {

View File

@ -14,12 +14,21 @@ class Configuration implements ConfigurationInterface
{ {
/** /**
* {@inheritdoc} * {@inheritdoc}
* @throws \RuntimeException
*/ */
public function getConfigTreeBuilder() public function getConfigTreeBuilder()
{ {
$treeBuilder = new TreeBuilder(); $treeBuilder = new TreeBuilder();
$rootNode = $treeBuilder->root('sikofitt_doughnut_wedding'); $rootNode = $treeBuilder->root('sikofitt_doughnut_wedding');
$rootNode
->children()
->scalarNode('max_rsvps')
->isRequired()
->validate()
->ifEmpty()->then(function() {return 40;})
->ifNull()->then(function() { return 40;})
->end()
->end();
// Here you should define the parameters that are allowed to // Here you should define the parameters that are allowed to
// configure your bundle. See the documentation linked above for // configure your bundle. See the documentation linked above for
// more information on that topic. // more information on that topic.

View File

@ -24,5 +24,6 @@ class SikofittDoughnutWeddingExtension extends Extension
$loader = new Loader\YamlFileLoader($container, new FileLocator(__DIR__.'/../Resources/config')); $loader = new Loader\YamlFileLoader($container, new FileLocator(__DIR__.'/../Resources/config'));
$loader->load('services.yml'); $loader->load('services.yml');
$container->setParameter('wedding_max_rsvps', $config['max_rsvps']);
} }
} }

View File

@ -42,7 +42,7 @@ class Rsvp
private $id; private $id;
/** /**
* @var int * @var \Sikofitt\DoughnutWeddingBundle\Entity\User
* @ORM\OneToOne(targetEntity="Sikofitt\DoughnutWeddingBundle\Entity\User", mappedBy="rsvp", cascade={"persist"}) * @ORM\OneToOne(targetEntity="Sikofitt\DoughnutWeddingBundle\Entity\User", mappedBy="rsvp", cascade={"persist"})
*/ */
private $user; private $user;
@ -59,13 +59,13 @@ class Rsvp
* @var \DateTime * @var \DateTime
* @ORM\Column(name="created", type="datetime") * @ORM\Column(name="created", type="datetime")
*/ */
private $created = null; private $created;
/** /**
* @var \DateTime * @var \DateTime
* @ORM\Column(name="updated", type="datetime") * @ORM\Column(name="updated", type="datetime")
*/ */
private $updated = null; private $updated;
public function __construct() public function __construct()
{ {
@ -160,11 +160,11 @@ class Rsvp
/** /**
* Set user. * Set user.
* *
* @param \Sikofitt\App\Entity\User $user * @param User $user
* *
* @return Rsvp * @return Rsvp
*/ */
public function setUser(\Sikofitt\App\Entity\User $user = null) public function setUser(User $user = null)
{ {
$this->user = $user; $this->user = $user;
@ -174,7 +174,7 @@ class Rsvp
/** /**
* Get user. * Get user.
* *
* @return \Sikofitt\App\Entity\User * @return User
*/ */
public function getUser() public function getUser()
{ {

View File

@ -3,26 +3,101 @@
namespace Sikofitt\DoughnutWeddingBundle\Form; namespace Sikofitt\DoughnutWeddingBundle\Form;
use FOS\UserBundle\Form\Type\RegistrationFormType; use FOS\UserBundle\Form\Type\RegistrationFormType;
use Sikofitt\DoughnutWeddingBundle\Entity\Rsvp;
use Sikofitt\DoughnutWeddingBundle\Entity\User;
use Symfony\Component\Form\AbstractType; 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\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\FormBuilderInterface;
use Symfony\Component\Form\FormInterface;
use Symfony\Component\Form\FormView;
use Symfony\Component\OptionsResolver\OptionsResolver; use Symfony\Component\OptionsResolver\OptionsResolver;
class RegistrationType extends AbstractType class RegistrationType extends AbstractType
{ {
public function buildForm(FormBuilderInterface $builder, array $options) public function buildForm(FormBuilderInterface $builder, array $options)
{ {
$builder->add('first_name')
->add('last_name');
$builder->add('first_name', TextType::class)
->add('last_name', TextType::class)
->add('familyside', ChoiceType::class, [
'choices' => [
User::ERIC_SIDE => User::ERIC_SIDE,
User::KATRINA_SIDE => User::KATRINA_SIDE,
],
'attr' => [
'class' => 'uk-select uk-form-large uk-box-shadow-hover-small',
'style' => 'padding-left:16px;',
],
'label' => 'Who are you coming for?',
'label_attr' => [
'class' => 'uk-form-label uk-text-primary',
'style' => 'font-size:1.25rem; margin-left:15px;'
],
])
->add('family', CheckboxType::class, [
'label' => 'Are you an immediate family member?',
'required' => false,
'attr' => [
'class' => 'uk-checkbox uk-box-shadow-hover-small',
],
'label_attr' => [
'class' => 'uk-form-label uk-text-primary',
'style' => 'font-size:1.25rem; margin-left:15px;'
],
])
->add('rsvp', IntegerType::class, [
'attr' => [
'class' => 'uk-input uk-form-large uk-padding-small uk-box-shadow-hover-small',
'placeholder' => 'Number of Guests (including yourself)',
],
'label' => 'Number of guests? (including yourself)',
'label_attr' => [
'class' => 'uk-form-label uk-text-primary',
],
]);
$builder->get('rsvp')
->addModelTransformer(new CallbackTransformer(
function (?Rsvp $rsvp) {
if (null === $rsvp) {
return $rsvp;
}
return $rsvp->getGuests();
},
function (Int $rsvpInt) {
$rsvp = new Rsvp();
$rsvp->setGuests($rsvpInt);
return $rsvp;
}
));
} }
public function configureOptions(OptionsResolver $resolver) public function configureOptions(OptionsResolver $resolver)
{ {
$resolver->setDefault('attr', ['class' => 'uk-form uk-form-horizontal']);
} }
public function getParent() { public function getParent() {
return RegistrationFormType::class; return RegistrationFormType::class;
} }
public function finishView(
FormView $view,
FormInterface $form,
array $options
) {
$view->children['email']->vars['attr']['class'] = 'uk-input';
$view->children['email']->vars['label_attr']['class'] = 'uk-form-label';
}
public function getBlockPrefix() public function getBlockPrefix()
{ {
return 'sikofitt_doughnut_wedding_bundle_registration_type'; return 'sikofitt_doughnut_wedding_bundle_registration_type';

View File

@ -83,7 +83,7 @@ class RsvpType extends AbstractType
]) ])
->add('rsvp', IntegerType::class, [ ->add('rsvp', IntegerType::class, [
'attr' => [ 'attr' => [
'class' => 'uk-input uk-form-large uk-padding-small uk-form-width-medium uk-box-shadow-hover-small', 'class' => 'uk-input uk-form-large uk-padding-small',
'placeholder' => 'Number of Guests (including yourself)', 'placeholder' => 'Number of Guests (including yourself)',
], ],
'label' => 'Number of guests? (including yourself)', 'label' => 'Number of guests? (including yourself)',
@ -93,6 +93,7 @@ class RsvpType extends AbstractType
]) ])
->add('familyside', ChoiceType::class, [ ->add('familyside', ChoiceType::class, [
'choices' => [ 'choices' => [
User::ERIC_SIDE => User::ERIC_SIDE, User::ERIC_SIDE => User::ERIC_SIDE,
User::KATRINA_SIDE => User::KATRINA_SIDE, User::KATRINA_SIDE => User::KATRINA_SIDE,
], ],
@ -106,13 +107,15 @@ class RsvpType extends AbstractType
], ],
]) ])
->add('family', CheckboxType::class, [ ->add('family', CheckboxType::class, [
'label' => 'Are you an immediate family member?', 'label' => 'Are you a family member?',
'required' => false, 'required' => false,
'attr' => [ 'attr' => [
'class' => 'uk-checkbox uk-box-shadow-hover-small', 'class' => 'uk-checkbox uk-box-shadow-hover-small',
'style' => 'padding-left:16px;'
], ],
'label_attr' => [ 'label_attr' => [
'class' => 'uk-margin-right', 'class' => 'uk-form-label uk-text-primary',
], ],
]); ]);
$builder->get('rsvp') $builder->get('rsvp')

View File

@ -0,0 +1,7 @@
{% extends "::base.html.twig" %}
{% block title %}SikofittDoughnutWeddingBundle:Image:category{% endblock %}
{% block body %}
<h1>Welcome to the Image:category page</h1>
{% endblock %}

View File

@ -0,0 +1,7 @@
{% extends "::base.html.twig" %}
{% block title %}SikofittDoughnutWeddingBundle:Image:index{% endblock %}
{% block body %}
<h1>Welcome to the Image:index page</h1>
{% endblock %}

View File

@ -0,0 +1,7 @@
{% extends "::base.html.twig" %}
{% block title %}SikofittDoughnutWeddingBundle:Image:tag{% endblock %}
{% block body %}
<h1>Welcome to the Image:tag page</h1>
{% endblock %}

View File

@ -0,0 +1,7 @@
{% extends "::base.html.twig" %}
{% block title %}SikofittDoughnutWeddingBundle:Image:upload{% endblock %}
{% block body %}
<h1>Welcome to the Image:upload page</h1>
{% endblock %}

View File

@ -0,0 +1,37 @@
<?php
namespace Sikofitt\DoughnutWeddingBundle\Tests\Controller;
use Symfony\Bundle\FrameworkBundle\Test\WebTestCase;
class ImageControllerTest extends WebTestCase
{
public function testIndex()
{
$client = static::createClient();
$crawler = $client->request('GET', '/');
}
public function testUpload()
{
$client = static::createClient();
$crawler = $client->request('GET', '/upload');
}
public function testTag()
{
$client = static::createClient();
$crawler = $client->request('GET', '/tag');
}
public function testCategory()
{
$client = static::createClient();
$crawler = $client->request('GET', '/category');
}
}