mirror of
https://github.com/Sylius/Sylius.git
synced 2026-07-15 01:20:59 +00:00
Implement login screen and improve Gulpfile
This commit is contained in:
parent
37c1daa771
commit
5009463405
54 changed files with 883 additions and 113 deletions
1
.gitignore
vendored
1
.gitignore
vendored
|
|
@ -11,6 +11,7 @@
|
|||
/web/bundles
|
||||
/web/css
|
||||
/web/js
|
||||
/web/img
|
||||
/web/assets/compiled
|
||||
/web/media
|
||||
|
||||
|
|
|
|||
38
Gulpfile.js
38
Gulpfile.js
|
|
@ -5,7 +5,9 @@ var uglifycss = require('gulp-uglifycss');
|
|||
var concat = require('gulp-concat');
|
||||
var less = require('gulp-less');
|
||||
var sourcemaps = require('gulp-sourcemaps');
|
||||
var merge = require('merge-stream');
|
||||
var debug = require('gulp-debug');
|
||||
var livereload = require('gulp-livereload');
|
||||
|
||||
var env = process.env.GULP_ENV;
|
||||
|
||||
|
|
@ -20,8 +22,10 @@ var paths = {
|
|||
],
|
||||
css: [
|
||||
'node_modules/bootstrap/dist/css/bootstrap.min.css',
|
||||
'node_modules/admin-lte/dist/css/AdminLTE.min.css',
|
||||
'web/test/*'
|
||||
'node_modules/admin-lte/dist/css/AdminLTE.min.css'
|
||||
],
|
||||
'img': [
|
||||
'src/Sylius/Bundle/UiBundle/Resources/assets/img/**'
|
||||
]
|
||||
};
|
||||
|
||||
|
|
@ -34,28 +38,38 @@ gulp.task('js', function () {
|
|||
;
|
||||
});
|
||||
|
||||
gulp.task('less', function () {
|
||||
return gulp.src(paths.less)
|
||||
gulp.task('css', function() {
|
||||
var lessStream = gulp.src(paths.less)
|
||||
.pipe(less())
|
||||
.pipe(concat('less-compiled.css'))
|
||||
.pipe(sourcemaps.write('./'))
|
||||
.pipe(gulp.dest('web/test'))
|
||||
.pipe(concat('less-files.less'))
|
||||
;
|
||||
});
|
||||
|
||||
gulp.task('css', function () {
|
||||
return gulp.src(paths.css)
|
||||
var cssStream = gulp.src(paths.css)
|
||||
.pipe(concat('css-files.css'))
|
||||
;
|
||||
|
||||
return merge(lessStream, cssStream)
|
||||
.pipe(concat('style.css'))
|
||||
.pipe(gulpif('prod' === env, uglifycss()))
|
||||
.pipe(sourcemaps.write('./'))
|
||||
.pipe(gulp.dest('web/css'))
|
||||
.pipe(livereload())
|
||||
;
|
||||
});
|
||||
|
||||
gulp.task('img', function () {
|
||||
return gulp.src(paths.img)
|
||||
.pipe(sourcemaps.write('./'))
|
||||
.pipe(gulp.dest('web/img'))
|
||||
;
|
||||
});
|
||||
|
||||
gulp.task('watch', function() {
|
||||
livereload.listen();
|
||||
gulp.watch(paths.js, ['js']);
|
||||
gulp.watch(paths.less, ['less', 'css']);
|
||||
gulp.watch(paths.less, ['css']);
|
||||
gulp.watch(paths.css, ['css']);
|
||||
gulp.watch(paths.img, ['img']);
|
||||
});
|
||||
|
||||
gulp.task('default', ['watch', 'js', 'less', 'css']);
|
||||
gulp.task('default', ['watch', 'js', 'css', 'img']);
|
||||
|
|
|
|||
|
|
@ -33,10 +33,18 @@ $ wget http://getcomposer.org/composer.phar
|
|||
$ php composer.phar create-project sylius/sylius:v0.15.0
|
||||
$ cd sylius
|
||||
$ php app/console sylius:install
|
||||
$ php app/console server:run
|
||||
```
|
||||
|
||||
The install script will give you the option to run fixtures that make testing and development phases much easier.
|
||||
|
||||
If you want to try out new Sylius UI, please run the following commands:
|
||||
|
||||
```bash
|
||||
$ npm install
|
||||
$ gulp
|
||||
```
|
||||
|
||||
[Behat](http://behat.org) scenarios
|
||||
-----------------------------------
|
||||
|
||||
|
|
|
|||
|
|
@ -29,6 +29,7 @@ twig:
|
|||
- SyliusWebBundle:Common:forms.html.twig
|
||||
- SyliusResourceBundle::forms.html.twig
|
||||
- CmfMediaBundle:Form:fields.html.twig
|
||||
- bootstrap_3_layout.html.twig
|
||||
debug: %kernel.debug%
|
||||
strict_variables: %kernel.debug%
|
||||
paths:
|
||||
|
|
|
|||
|
|
@ -8,6 +8,23 @@ security:
|
|||
encoders:
|
||||
Sylius\Component\User\Model\UserInterface: sha512
|
||||
firewalls:
|
||||
admin:
|
||||
switch_user: true
|
||||
context: user
|
||||
pattern: /admin/.*
|
||||
form_login:
|
||||
provider: sylius_user_provider
|
||||
login_path: sylius_admin_login
|
||||
check_path: sylius_admin_login_check
|
||||
failure_path: sylius_admin_login
|
||||
default_target_path: sylius_admin_dashboard
|
||||
use_forward: false
|
||||
use_referer: true
|
||||
logout:
|
||||
path: sylius_admin_logout
|
||||
target: sylius_admin_login
|
||||
anonymous: true
|
||||
|
||||
administration:
|
||||
switch_user: true
|
||||
context: user
|
||||
|
|
@ -74,12 +91,15 @@ security:
|
|||
- { path: ^/connect.*, role: IS_AUTHENTICATED_ANONYMOUSLY }
|
||||
- { path: ^/register, role: IS_AUTHENTICATED_ANONYMOUSLY }
|
||||
- { path: ^/resetting, role: IS_AUTHENTICATED_ANONYMOUSLY }
|
||||
- { path: "/account.*", role: ROLE_USER }
|
||||
|
||||
- { path: ^/administration/login, role: IS_AUTHENTICATED_ANONYMOUSLY }
|
||||
- { path: ^/administration/login-check, role: IS_AUTHENTICATED_ANONYMOUSLY }
|
||||
- { path: "/administration.*", role: ROLE_ADMINISTRATION_ACCESS }
|
||||
|
||||
- { path: "/account.*", role: ROLE_USER }
|
||||
- { path: ^/admin/login, role: IS_AUTHENTICATED_ANONYMOUSLY }
|
||||
- { path: ^/admin/login-check, role: IS_AUTHENTICATED_ANONYMOUSLY }
|
||||
- { path: "/admin.*", role: ROLE_ADMINISTRATION_ACCESS }
|
||||
|
||||
- { path: ^/api, role: ROLE_API }
|
||||
|
||||
|
|
|
|||
|
|
@ -101,6 +101,7 @@
|
|||
"replace": {
|
||||
"sylius/addressing": "self.version",
|
||||
"sylius/addressing-bundle": "self.version",
|
||||
"sylius/admin-bundle": "self.version",
|
||||
"sylius/api-bundle": "self.version",
|
||||
"sylius/archetype": "self.version",
|
||||
"sylius/archetype-bundle": "self.version",
|
||||
|
|
@ -155,6 +156,7 @@
|
|||
"sylius/theme-bundle": "self.version",
|
||||
"sylius/translation": "self.version",
|
||||
"sylius/translation-bundle": "self.version",
|
||||
"sylius/ui-bundle": "self.version",
|
||||
"sylius/user": "self.version",
|
||||
"sylius/user-bundle": "self.version",
|
||||
"sylius/variation": "self.version",
|
||||
|
|
|
|||
19
package.json
19
package.json
|
|
@ -9,17 +9,16 @@
|
|||
"jquery": "^2.1.4"
|
||||
},
|
||||
"devDependencies": {
|
||||
"gulp-if": "^2.0.0",
|
||||
"gulp-concat": "^2.6.0",
|
||||
"gulp": "^3.9.0",
|
||||
"gulp-uglify": "^1.5.1",
|
||||
"gulp-sourcemaps": "^1.6.0",
|
||||
"gulp-uglifycss": "^1.0.5",
|
||||
"gulp-concat": "^2.6.0",
|
||||
"gulp-debug": "^2.1.2",
|
||||
"gulp-less": "^3.0.5"
|
||||
},
|
||||
"scripts": {
|
||||
"test": "echo \"Error: no test specified\" && exit 1"
|
||||
"gulp-if": "^2.0.0",
|
||||
"gulp-less": "^3.0.5",
|
||||
"gulp-livereload": "^3.8.1",
|
||||
"gulp-sourcemaps": "^1.6.0",
|
||||
"gulp-uglify": "^1.5.1",
|
||||
"gulp-uglifycss": "^1.0.5",
|
||||
"merge-stream": "^1.0.0"
|
||||
},
|
||||
"repository": {
|
||||
"type": "git",
|
||||
|
|
@ -30,5 +29,5 @@
|
|||
"bugs": {
|
||||
"url": "https://github.com/Sylius/Sylius/issues"
|
||||
},
|
||||
"homepage": "https://github.com/Sylius/Sylius#readme"
|
||||
"homepage": "http://sylius.org"
|
||||
}
|
||||
|
|
|
|||
|
|
@ -30,6 +30,7 @@ suites:
|
|||
Variation: { namespace: Sylius\Component\Variation, psr4_prefix: Sylius\Component\Variation, spec_path: src/Sylius/Component/Variation, src_path: src/Sylius/Component/Variation }
|
||||
|
||||
AddressingBundle: { namespace: Sylius\Bundle\AddressingBundle, psr4_prefix: Sylius\Bundle\AddressingBundle, spec_path: src/Sylius/Bundle/AddressingBundle, src_path: src/Sylius/Bundle/AddressingBundle }
|
||||
AdminBundle: { namespace: Sylius\Bundle\AdminBundle, psr4_prefix: Sylius\Bundle\AdminBundle, spec_path: src/Sylius/Bundle/AdminBundle, src_path: src/Sylius/Bundle/AdminBundle }
|
||||
ApiBundle: { namespace: Sylius\Bundle\ApiBundle, psr4_prefix: Sylius\Bundle\ApiBundle, spec_path: src/Sylius/Bundle/ApiBundle, src_path: src/Sylius/Bundle/ApiBundle }
|
||||
ArchetypeBundle: { namespace: Sylius\Bundle\ArchetypeBundle, psr4_prefix: Sylius\Bundle\ArchetypeBundle, spec_path: src/Sylius/Bundle/ArchetypeBundle, src_path: src/Sylius/Bundle/ArchetypeBundle }
|
||||
AttributeBundle: { namespace: Sylius\Bundle\AttributeBundle, psr4_prefix: Sylius\Bundle\AttributeBundle, spec_path: src/Sylius/Bundle/AttributeBundle, src_path: src/Sylius/Bundle/AttributeBundle }
|
||||
|
|
@ -62,6 +63,7 @@ suites:
|
|||
TaxonomyBundle: { namespace: Sylius\Bundle\TaxonomyBundle, psr4_prefix: Sylius\Bundle\TaxonomyBundle, spec_path: src/Sylius/Bundle/TaxonomyBundle, src_path: src/Sylius/Bundle/TaxonomyBundle }
|
||||
ThemeBundle: { namespace: Sylius\Bundle\ThemeBundle, psr4_prefix: Sylius\Bundle\ThemeBundle , spec_path: src/Sylius/Bundle/ThemeBundle, src_path: src/Sylius/Bundle/ThemeBundle }
|
||||
TranslationBundle: { namespace: Sylius\Bundle\TranslationBundle, psr4_prefix: Sylius\Bundle\TranslationBundle, spec_path: src/Sylius/Bundle/TranslationBundle, src_path: src/Sylius/Bundle/TranslationBundle }
|
||||
UiBundle: { namespace: Sylius\Bundle\UiBundle, psr4_prefix: Sylius\Bundle\UiBundle, spec_path: src/Sylius/Bundle/UiBundle, src_path: src/Sylius/Bundle/UiBundle }
|
||||
UserBundle: { namespace: Sylius\Bundle\UserBundle, psr4_prefix: Sylius\Bundle\UserBundle, spec_path: src/Sylius/Bundle/UserBundle, src_path: src/Sylius/Bundle/UserBundle }
|
||||
VariationBundle: { namespace: Sylius\Bundle\VariationBundle, psr4_prefix: Sylius\Bundle\VariationBundle, spec_path: src/Sylius/Bundle/VariationBundle, src_path: src/Sylius/Bundle/VariationBundle }
|
||||
|
||||
|
|
|
|||
5
src/Sylius/Bundle/AdminBundle/.gitignore
vendored
Normal file
5
src/Sylius/Bundle/AdminBundle/.gitignore
vendored
Normal file
|
|
@ -0,0 +1,5 @@
|
|||
vendor/
|
||||
bin/
|
||||
|
||||
composer.phar
|
||||
composer.lock
|
||||
13
src/Sylius/Bundle/AdminBundle/.travis.yml
Normal file
13
src/Sylius/Bundle/AdminBundle/.travis.yml
Normal file
|
|
@ -0,0 +1,13 @@
|
|||
language: php
|
||||
|
||||
php:
|
||||
- 5.5
|
||||
- 5.6
|
||||
- 7.0
|
||||
|
||||
before_script:
|
||||
- echo "memory_limit=2048M" >> ~/.phpenv/versions/$(phpenv version-name)/etc/conf.d/travis.ini
|
||||
- phpenv config-rm xdebug.ini || true
|
||||
- composer install --no-interaction --prefer-source
|
||||
|
||||
script: bin/phpspec run -fpretty --verbose
|
||||
7
src/Sylius/Bundle/AdminBundle/CHANGELOG.md
Normal file
7
src/Sylius/Bundle/AdminBundle/CHANGELOG.md
Normal file
|
|
@ -0,0 +1,7 @@
|
|||
CHANGELOG
|
||||
=========
|
||||
|
||||
### v0.17.0
|
||||
|
||||
* First development release.
|
||||
|
||||
|
|
@ -11,20 +11,34 @@
|
|||
|
||||
namespace Sylius\Bundle\AdminBundle\Controller;
|
||||
|
||||
use Symfony\Bundle\FrameworkBundle\Controller\Controller;
|
||||
use Symfony\Bundle\FrameworkBundle\Templating\EngineInterface;
|
||||
use Symfony\Component\HttpFoundation\Request;
|
||||
|
||||
/**
|
||||
* @author Paweł Jędrzejewski <pawel@sylius.org>
|
||||
*/
|
||||
class DashboardController extends Controller
|
||||
class DashboardController
|
||||
{
|
||||
/**
|
||||
* @param Request
|
||||
* @var EngineInterface
|
||||
*/
|
||||
private $templatingEngine;
|
||||
|
||||
/**
|
||||
* @param EngineInterface $templatingEngine
|
||||
*/
|
||||
public function __construct(EngineInterface $templatingEngine)
|
||||
{
|
||||
$this->templatingEngine = $templatingEngine;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param Request $request
|
||||
*
|
||||
* @return Response
|
||||
*/
|
||||
public function indexAction()
|
||||
public function indexAction(Request $request)
|
||||
{
|
||||
return $this->render('SyliusAdminBundle:Dashboard:index.html.twig');
|
||||
return $this->templatingEngine->renderResponse('SyliusAdminBundle:Dashboard:index.html.twig');
|
||||
}
|
||||
}
|
||||
|
|
|
|||
19
src/Sylius/Bundle/AdminBundle/LICENSE
Normal file
19
src/Sylius/Bundle/AdminBundle/LICENSE
Normal file
|
|
@ -0,0 +1,19 @@
|
|||
Copyright (c) 2011-2016 Paweł Jędrzejewski
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is furnished
|
||||
to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all
|
||||
copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
THE SOFTWARE.
|
||||
|
|
@ -19,7 +19,7 @@ use Sylius\Bundle\UiBundle\Menu\Event\MenuBuilderEvent;
|
|||
*/
|
||||
final class MainMenuBuilder extends AbstractAdminMenuBuilder
|
||||
{
|
||||
const EVENT_NAME = 'sylius.menu.main';
|
||||
const EVENT_NAME = 'sylius.menu.admin.main';
|
||||
|
||||
/**
|
||||
* @return ItemInterface
|
||||
|
|
@ -45,14 +45,6 @@ final class MainMenuBuilder extends AbstractAdminMenuBuilder
|
|||
->setLabel('sylius.menu.admin.main.configuration.header')
|
||||
;
|
||||
|
||||
if ($this->authorizationChecker->isGranted('sylius.tax_category.index')) {
|
||||
$child
|
||||
->addChild('tax_category_index', array('route' => 'sylius_admin_tax_category_index'))
|
||||
->setLabel('sylius.menu.admin.main.configuration.tax_category_index')
|
||||
->setLabelAttribute('icon', 'money')
|
||||
;
|
||||
}
|
||||
|
||||
if (!$child->hasChildren()) {
|
||||
$menu->removeChild('configuration');
|
||||
}
|
||||
|
|
|
|||
46
src/Sylius/Bundle/AdminBundle/README.md
Normal file
46
src/Sylius/Bundle/AdminBundle/README.md
Normal file
|
|
@ -0,0 +1,46 @@
|
|||
SyliusAdminBundle [](http://travis-ci.org/Sylius/SyliusAdminBundle)
|
||||
=================
|
||||
|
||||
This bundle contains the Sylius administration panel.
|
||||
|
||||
Sylius
|
||||
------
|
||||
|
||||

|
||||
|
||||
Sylius is an Open Source eCommerce solution built from decoupled components with powerful API and the highest quality code. [Read more on sylius.org](http://sylius.org).
|
||||
|
||||
Installation & Documentation
|
||||
----------------------------
|
||||
|
||||
For installation and usage examples please refer to the documentation available on [**docs.sylius.org**](http://docs.sylius.org).
|
||||
|
||||
Contributing
|
||||
------------
|
||||
|
||||
Extensive Contributing Guide can be found in [the official documentation](http://docs.sylius.org/en/latest/contributing/index.html).
|
||||
|
||||
Follow Sylius' Development
|
||||
--------------------------
|
||||
|
||||
If you want to keep up with the updates and latest features, follow us on the following channels:
|
||||
|
||||
* [Official Blog](https://sylius.org/blog)
|
||||
* [Sylius on Twitter](https://twitter.com/Sylius)
|
||||
* [Sylius on Facebook](https://facebook.com/SyliusEcommerce)
|
||||
|
||||
Reporting Bugs
|
||||
--------------
|
||||
|
||||
If you have found a bug, please create an issue on [the main repository](https://github.com/Sylius/Sylius/issues).
|
||||
|
||||
MIT License
|
||||
-----------
|
||||
|
||||
License can be found [here](https://github.com/Sylius/SyliusAdminBundle/blob/master/LICENSE).
|
||||
|
||||
Authors
|
||||
-------
|
||||
|
||||
The bundle was originally created by [Paweł Jędrzejewski](http://pjedrzejewski.com).
|
||||
See the list of [contributors](https://github.com/Sylius/SyliusAdminBundle/contributors).
|
||||
|
|
@ -22,9 +22,7 @@
|
|||
|
||||
<services>
|
||||
<service id="sylius.controller.admin.dashboard" class="%sylius.controller.admin.dashboard.class%">
|
||||
<call method="setContainer">
|
||||
<argument type="service" id="service_container" />
|
||||
</call>
|
||||
<argument type="service" id="templating" />
|
||||
</service>
|
||||
</services>
|
||||
|
||||
|
|
|
|||
|
|
@ -7,8 +7,20 @@ sylius_admin_root:
|
|||
|
||||
sylius_admin_dashboard:
|
||||
path: /dashboard
|
||||
defaults: { _controller: sylius.controller.admin.dashboard:indexAction }
|
||||
defaults:
|
||||
_controller: sylius.controller.admin.dashboard:indexAction
|
||||
|
||||
sylius_admin_tax_category:
|
||||
resource: @SyliusAdminBundle/Resources/config/routing/tax_category.yml
|
||||
prefix: /tax-categories
|
||||
sylius_admin_login:
|
||||
path: /login
|
||||
defaults:
|
||||
_controller: sylius.controller.security:loginAction
|
||||
_sylius:
|
||||
template: SyliusAdminBundle:Security:login.html.twig
|
||||
|
||||
sylius_admin_login_check:
|
||||
path: /login-check
|
||||
defaults:
|
||||
_controller: sylius.controller.security:checkAction
|
||||
|
||||
sylius_admin_logout:
|
||||
path: /logout
|
||||
|
|
|
|||
|
|
@ -1,10 +0,0 @@
|
|||
sylius_admin_tax_category_index:
|
||||
path: /
|
||||
methods: [GET]
|
||||
defaults:
|
||||
_controller: sylius.controller.tax_category:indexAction
|
||||
_sylius:
|
||||
template: SyliusAdminBundle:TaxCategory:index.html.twig
|
||||
sortable: true
|
||||
sorting:
|
||||
name: desc
|
||||
|
|
@ -4,4 +4,3 @@ sylius:
|
|||
main:
|
||||
configuration:
|
||||
header: Configuration
|
||||
tax_category_index: Tax categories
|
||||
|
|
|
|||
|
|
@ -7,5 +7,5 @@
|
|||
{% endblock %}
|
||||
|
||||
{% block content %}
|
||||
Hello!
|
||||
Hello!
|
||||
{% endblock %}
|
||||
|
|
|
|||
|
|
@ -0,0 +1,5 @@
|
|||
{% extends 'SyliusUiBundle::security.html.twig' %}
|
||||
|
||||
{% block content %}
|
||||
{% include 'SyliusUiBundle:Security:_login.html.twig' with {'action': path('sylius_admin_login_check')} %}
|
||||
{% endblock %}
|
||||
|
|
@ -1,12 +0,0 @@
|
|||
{% extends 'SyliusAdminBundle::layout.html.twig' %}
|
||||
|
||||
{% import 'SyliusUiBundle::button.html.twig' as button %}
|
||||
|
||||
{% block title %}{{ parent() }}{{ 'sylius.ui.tax_categories'|trans }}{% endblock %}
|
||||
|
||||
{% block header %}
|
||||
{{ 'sylius.ui.tax_categories'|trans }}
|
||||
{% endblock %}
|
||||
|
||||
{% block content %}
|
||||
{% endblock %}
|
||||
41
src/Sylius/Bundle/AdminBundle/composer.json
Normal file
41
src/Sylius/Bundle/AdminBundle/composer.json
Normal file
|
|
@ -0,0 +1,41 @@
|
|||
{
|
||||
"name": "sylius/admin-bundle",
|
||||
"type": "symfony-bundle",
|
||||
"description": "Sylius eCommerce administration panel component.",
|
||||
"keywords": ["shop", "ecommerce", "store", "webshop", "sylius", "ui", "admin interface", "admin", "backend"],
|
||||
"homepage": "http://sylius.org",
|
||||
"license": "MIT",
|
||||
"authors": [
|
||||
{
|
||||
"name": "Paweł Jędrzejewski",
|
||||
"homepage": "http://pjedrzejewski.com"
|
||||
},
|
||||
{
|
||||
"name": "Sylius project",
|
||||
"homepage": "http://sylius.org"
|
||||
},
|
||||
{
|
||||
"name": "Community contributions",
|
||||
"homepage": "http://github.com/Sylius/Sylius/contributors"
|
||||
}
|
||||
],
|
||||
"require": {
|
||||
"php": "^5.5.9|^7.0",
|
||||
|
||||
"sylius/ui-bundle": "^0.17.0",
|
||||
"sylius/core-bundle": "^0.17.0",
|
||||
"symfony/framework-bundle": "^2.7.7"
|
||||
},
|
||||
"config": {
|
||||
"bin-dir": "bin"
|
||||
},
|
||||
"autoload": {
|
||||
"psr-4": { "Sylius\\Bundle\\AdminBundle\\": "" }
|
||||
},
|
||||
"minimum-stability": "dev",
|
||||
"extra": {
|
||||
"branch-alias": {
|
||||
"dev-master": "0.17-dev"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,44 @@
|
|||
<?php
|
||||
|
||||
/*
|
||||
* This file is part of the Sylius package.
|
||||
*
|
||||
* (c) Paweł Jędrzejewski
|
||||
*
|
||||
* For the full copyright and license information, please view the LICENSE
|
||||
* file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
namespace spec\Sylius\Bundle\AdminBundle\Controller;
|
||||
|
||||
use Sylius\Bundle\AdminBundle\Controller\DashboardController;
|
||||
use PhpSpec\ObjectBehavior;
|
||||
use Prophecy\Argument;
|
||||
use Symfony\Bundle\FrameworkBundle\Templating\EngineInterface;
|
||||
use Symfony\Component\HttpFoundation\Request;
|
||||
use Symfony\Component\HttpFoundation\Response;
|
||||
|
||||
/**
|
||||
* @mixin DashboardController
|
||||
*
|
||||
* @author Paweł Jędrzejewski <pawel@sylius.org>
|
||||
*/
|
||||
class DashboardControllerSpec extends ObjectBehavior
|
||||
{
|
||||
function let(EngineInterface $templatingEngine)
|
||||
{
|
||||
$this->beConstructedWith($templatingEngine);
|
||||
}
|
||||
|
||||
function it_is_initializable()
|
||||
{
|
||||
$this->shouldHaveType('Sylius\Bundle\AdminBundle\Controller\DashboardController');
|
||||
}
|
||||
|
||||
function it_renders_dashboard(Request $request, EngineInterface $templatingEngine, Response $response)
|
||||
{
|
||||
$templatingEngine->renderResponse('SyliusAdminBundle:Dashboard:index.html.twig')->willReturn($response);
|
||||
|
||||
$this->indexAction($request)->shouldReturn($response);
|
||||
}
|
||||
}
|
||||
5
src/Sylius/Bundle/UiBundle/.gitignore
vendored
Normal file
5
src/Sylius/Bundle/UiBundle/.gitignore
vendored
Normal file
|
|
@ -0,0 +1,5 @@
|
|||
vendor/
|
||||
bin/
|
||||
|
||||
composer.phar
|
||||
composer.lock
|
||||
13
src/Sylius/Bundle/UiBundle/.travis.yml
Normal file
13
src/Sylius/Bundle/UiBundle/.travis.yml
Normal file
|
|
@ -0,0 +1,13 @@
|
|||
language: php
|
||||
|
||||
php:
|
||||
- 5.5
|
||||
- 5.6
|
||||
- 7.0
|
||||
|
||||
before_script:
|
||||
- echo "memory_limit=2048M" >> ~/.phpenv/versions/$(phpenv version-name)/etc/conf.d/travis.ini
|
||||
- phpenv config-rm xdebug.ini || true
|
||||
- composer install --no-interaction --prefer-source
|
||||
|
||||
script: bin/phpspec run -fpretty --verbose
|
||||
7
src/Sylius/Bundle/UiBundle/CHANGELOG.md
Normal file
7
src/Sylius/Bundle/UiBundle/CHANGELOG.md
Normal file
|
|
@ -0,0 +1,7 @@
|
|||
CHANGELOG
|
||||
=========
|
||||
|
||||
### v0.17.0
|
||||
|
||||
* First development release.
|
||||
|
||||
86
src/Sylius/Bundle/UiBundle/Controller/SecurityController.php
Normal file
86
src/Sylius/Bundle/UiBundle/Controller/SecurityController.php
Normal file
|
|
@ -0,0 +1,86 @@
|
|||
<?php
|
||||
|
||||
/*
|
||||
* This file is part of the Sylius package.
|
||||
*
|
||||
* (c) Paweł Jędrzejewski
|
||||
*
|
||||
* For the full copyright and license information, please view the LICENSE
|
||||
* file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
namespace Sylius\Bundle\UiBundle\Controller;
|
||||
|
||||
use Symfony\Bundle\FrameworkBundle\Controller\Controller;
|
||||
use Symfony\Bundle\FrameworkBundle\Templating\EngineInterface;
|
||||
use Symfony\Component\Form\FormFactoryInterface;
|
||||
use Symfony\Component\HttpFoundation\Request;
|
||||
use Symfony\Component\Security\Http\Authentication\AuthenticationUtils;
|
||||
|
||||
/**
|
||||
* @author Paweł Jędrzejewski <pawel@sylius.org>
|
||||
*/
|
||||
final class SecurityController
|
||||
{
|
||||
/**
|
||||
* @var AuthenticationUtils
|
||||
*/
|
||||
private $authenticationUtils;
|
||||
|
||||
/**
|
||||
* @var FormFactoryInterface
|
||||
*/
|
||||
private $formFactory;
|
||||
|
||||
/**
|
||||
* @var EngineInterface
|
||||
*/
|
||||
private $templatingEngine;
|
||||
|
||||
/**
|
||||
* @param AuthenticationUtils $authenticationUtils
|
||||
* @param FormFactoryInterface $formFactory
|
||||
* @param EngineInterface $templatingEngine
|
||||
*/
|
||||
public function __construct(AuthenticationUtils $authenticationUtils, FormFactoryInterface $formFactory, EngineInterface $templatingEngine)
|
||||
{
|
||||
$this->authenticationUtils = $authenticationUtils;
|
||||
$this->formFactory = $formFactory;
|
||||
$this->templatingEngine = $templatingEngine;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param Request $request
|
||||
*/
|
||||
public function loginAction(Request $request)
|
||||
{
|
||||
$lastError = $this->authenticationUtils->getLastAuthenticationError();
|
||||
$lastUsername = $this->authenticationUtils->getLastUsername();
|
||||
|
||||
$template = $request->attributes->get('_sylius[template]', 'SyliusUiBundle:Security:login.html.twig', true);
|
||||
$formType = $request->attributes->get('_sylius[form]', 'sylius_security_login', true);
|
||||
$form = $this->formFactory->createNamed('', $formType);
|
||||
|
||||
return $this->templatingEngine->renderResponse($template, array(
|
||||
'form' => $form->createView(),
|
||||
'last_username' => $lastUsername,
|
||||
'last_error' => $lastError,
|
||||
));
|
||||
}
|
||||
|
||||
/**
|
||||
* @param Request $request
|
||||
*/
|
||||
public function checkAction(Request $request)
|
||||
{
|
||||
throw new \RuntimeException('You must configure the check path to be handled by the firewall.');
|
||||
}
|
||||
|
||||
/**
|
||||
* @param Request $request
|
||||
*/
|
||||
public function logoutAction(Request $request)
|
||||
{
|
||||
throw new \RuntimeException('You must configure the logout path to be handled by the firewall.');
|
||||
}
|
||||
}
|
||||
|
|
@ -27,6 +27,8 @@ class SyliusUiExtension extends Extension
|
|||
public function load(array $config, ContainerBuilder $container)
|
||||
{
|
||||
$loader = new XmlFileLoader($container, new FileLocator(__DIR__.'/../Resources/config'));
|
||||
$loader->load('controller.xml');
|
||||
$loader->load('menu.xml');
|
||||
$loader->load('form.xml');
|
||||
}
|
||||
}
|
||||
|
|
|
|||
47
src/Sylius/Bundle/UiBundle/Form/Type/SecurityLoginType.php
Normal file
47
src/Sylius/Bundle/UiBundle/Form/Type/SecurityLoginType.php
Normal file
|
|
@ -0,0 +1,47 @@
|
|||
<?php
|
||||
|
||||
/*
|
||||
* This file is part of the Sylius package.
|
||||
*
|
||||
* (c) Paweł Jędrzejewski
|
||||
*
|
||||
* For the full copyright and license information, please view the LICENSE
|
||||
* file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
namespace Sylius\Bundle\UiBundle\Form\Type;
|
||||
|
||||
use Symfony\Component\Form\AbstractType;
|
||||
use Symfony\Component\Form\FormBuilderInterface;
|
||||
|
||||
/**
|
||||
* @author Paweł Jędrzejewski <pawel@sylius.org>
|
||||
*/
|
||||
class SecurityLoginType extends AbstractType
|
||||
{
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function buildForm(FormBuilderInterface $builder, array $options)
|
||||
{
|
||||
$builder
|
||||
->add('_username', 'text', array(
|
||||
'label' => 'sylius.form.login.username',
|
||||
))
|
||||
->add('_password', 'password', array(
|
||||
'label' => 'sylius.form.login.password',
|
||||
))
|
||||
->add('_remember_me', 'checkbox', array(
|
||||
'label' => 'sylius.form.login.remember_me',
|
||||
))
|
||||
;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function getName()
|
||||
{
|
||||
return 'sylius_security_login';
|
||||
}
|
||||
}
|
||||
19
src/Sylius/Bundle/UiBundle/LICENSE
Normal file
19
src/Sylius/Bundle/UiBundle/LICENSE
Normal file
|
|
@ -0,0 +1,19 @@
|
|||
Copyright (c) 2011-2016 Paweł Jędrzejewski
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is furnished
|
||||
to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all
|
||||
copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
THE SOFTWARE.
|
||||
45
src/Sylius/Bundle/UiBundle/README.md
Normal file
45
src/Sylius/Bundle/UiBundle/README.md
Normal file
|
|
@ -0,0 +1,45 @@
|
|||
SyliusUiBundle [](http://travis-ci.org/Sylius/SyliusUiBundle)
|
||||
==============
|
||||
|
||||
|
||||
Sylius
|
||||
------
|
||||
|
||||

|
||||
|
||||
Sylius is an Open Source eCommerce solution built from decoupled components with powerful API and the highest quality code. [Read more on sylius.org](http://sylius.org).
|
||||
|
||||
Installation & Documentation
|
||||
----------------------------
|
||||
|
||||
For installation and usage examples please refer to the documentation available on [**docs.sylius.org**](http://docs.sylius.org).
|
||||
|
||||
Contributing
|
||||
------------
|
||||
|
||||
Extensive Contributing Guide can be found in [the official documentation](http://docs.sylius.org/en/latest/contributing/index.html).
|
||||
|
||||
Follow Sylius' Development
|
||||
--------------------------
|
||||
|
||||
If you want to keep up with the updates and latest features, follow us on the following channels:
|
||||
|
||||
* [Official Blog](https://sylius.org/blog)
|
||||
* [Sylius on Twitter](https://twitter.com/Sylius)
|
||||
* [Sylius on Facebook](https://facebook.com/SyliusEcommerce)
|
||||
|
||||
Reporting Bugs
|
||||
--------------
|
||||
|
||||
If you have found a bug, please create an issue on [the main repository](https://github.com/Sylius/Sylius/issues).
|
||||
|
||||
MIT License
|
||||
-----------
|
||||
|
||||
License can be found [here](https://github.com/Sylius/SyliusUiBundle/blob/master/LICENSE).
|
||||
|
||||
Authors
|
||||
-------
|
||||
|
||||
The bundle was originally created by [Paweł Jędrzejewski](http://pjedrzejewski.com).
|
||||
See the list of [contributors](https://github.com/Sylius/SyliusUiBundle/contributors).
|
||||
BIN
src/Sylius/Bundle/UiBundle/Resources/assets/img/logo.png
Normal file
BIN
src/Sylius/Bundle/UiBundle/Resources/assets/img/logo.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 17 KiB |
|
|
@ -3,7 +3,7 @@
|
|||
@import "node_modules/admin-lte/build/less/mixins.less";
|
||||
@import "node_modules/admin-lte/build/less/variables.less";
|
||||
|
||||
@sylius: #1abb9c;
|
||||
@import "../variables.less";
|
||||
|
||||
.skin-sylius {
|
||||
a:link {
|
||||
|
|
@ -16,6 +16,18 @@
|
|||
color: lighten(@sylius, 5%);
|
||||
}
|
||||
|
||||
input:focus {
|
||||
border-color: @sylius;
|
||||
}
|
||||
|
||||
.btn-primary {
|
||||
background-color: @sylius;
|
||||
border-color: darken(@sylius, 5%);
|
||||
}
|
||||
.btn-primary:focus {
|
||||
background-color: darken(@sylius, 10%);
|
||||
}
|
||||
|
||||
.main-header {
|
||||
.navbar {
|
||||
.navbar-variant(@sylius; #fff);
|
||||
|
|
|
|||
|
|
@ -0,0 +1,5 @@
|
|||
@import "variables.less";
|
||||
|
||||
.login-logo-sylius {
|
||||
width: 360px;
|
||||
}
|
||||
|
|
@ -0,0 +1 @@
|
|||
@sylius: #1abb9c;
|
||||
31
src/Sylius/Bundle/UiBundle/Resources/config/controller.xml
Normal file
31
src/Sylius/Bundle/UiBundle/Resources/config/controller.xml
Normal file
|
|
@ -0,0 +1,31 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
|
||||
<!--
|
||||
|
||||
This file is part of the Sylius package.
|
||||
|
||||
(c) Paweł Jędrzejewski
|
||||
|
||||
For the full copyright and license information, please view the LICENSE
|
||||
file that was distributed with this source code.
|
||||
|
||||
-->
|
||||
|
||||
<container xmlns="http://symfony.com/schema/dic/services"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://symfony.com/schema/dic/services
|
||||
http://symfony.com/schema/dic/services/services-1.0.xsd">
|
||||
|
||||
<parameters>
|
||||
<parameter key="sylius.controller.security.class">Sylius\Bundle\UiBundle\Controller\SecurityController</parameter>
|
||||
</parameters>
|
||||
|
||||
<services>
|
||||
<service id="sylius.controller.security" class="%sylius.controller.security.class%">
|
||||
<argument type="service" id="security.authentication_utils" />
|
||||
<argument type="service" id="form.factory" />
|
||||
<argument type="service" id="templating" />
|
||||
</service>
|
||||
</services>
|
||||
|
||||
</container>
|
||||
29
src/Sylius/Bundle/UiBundle/Resources/config/form.xml
Normal file
29
src/Sylius/Bundle/UiBundle/Resources/config/form.xml
Normal file
|
|
@ -0,0 +1,29 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
|
||||
<!--
|
||||
|
||||
This file is part of the Sylius package.
|
||||
|
||||
(c) Paweł Jędrzejewski
|
||||
|
||||
For the full copyright and license information, please view the LICENSE
|
||||
file that was distributed with this source code.
|
||||
|
||||
-->
|
||||
|
||||
<container xmlns="http://symfony.com/schema/dic/services"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://symfony.com/schema/dic/services
|
||||
http://symfony.com/schema/dic/services/services-1.0.xsd">
|
||||
|
||||
<parameters>
|
||||
<parameter key="sylius.form.type.security_login.class">Sylius\Bundle\UiBundle\Form\Type\SecurityLoginType</parameter>
|
||||
</parameters>
|
||||
|
||||
<services>
|
||||
<service id="sylius.form.type.security_login" class="%sylius.form.type.security_login.class%">
|
||||
<tag name="form.type" alias="sylius_security_login" />
|
||||
</service>
|
||||
</services>
|
||||
|
||||
</container>
|
||||
|
|
@ -1,5 +1,11 @@
|
|||
sylius:
|
||||
form:
|
||||
login:
|
||||
username: Username
|
||||
password: Password
|
||||
remember_me: Remember me
|
||||
ui:
|
||||
sign_in: Sign in
|
||||
sign_out: Sign out
|
||||
dashboard: Dashboard
|
||||
tax_categories: Tax categories
|
||||
powered_by: Powered by
|
||||
|
|
|
|||
|
|
@ -0,0 +1,28 @@
|
|||
<div class="login-box">
|
||||
<div class="login-logo">
|
||||
<a href="http://sylius.org" target="_blank">
|
||||
<img src="{{ asset('img/logo.png') }}" alt="Sylius" class="login-logo-sylius" />
|
||||
</a>
|
||||
</div>
|
||||
<div class="login-box-body">
|
||||
{% if last_error %}
|
||||
<div class="alert alert-danger alert-dismissible">
|
||||
<button type="button" class="close" data-dismiss="alert" aria-hidden="true">×</button>
|
||||
{{ last_error.message }}
|
||||
</div>
|
||||
{% endif %}
|
||||
|
||||
<form action="{{ action|default('/') }}" method="post">
|
||||
{{ form_row(form._username, {'value': last_username|default('')}) }}
|
||||
{{ form_row(form._password) }}
|
||||
{{ form_row(form._remember_me) }}
|
||||
<div class="row">
|
||||
<div class="col-xs-8">
|
||||
</div>
|
||||
<div class="col-xs-4">
|
||||
<button type="submit" class="btn btn-primary btn-block btn-flat">{{ 'sylius.ui.sign_in'|trans }}</button>
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
|
|
@ -0,0 +1,5 @@
|
|||
{% extends 'SyliusUiBundle::security.html.twig' %}
|
||||
|
||||
{% block content %}
|
||||
{% include 'SyliusUiBundle:Security:_login.html.twig' %}
|
||||
{% endblock %}
|
||||
|
|
@ -0,0 +1 @@
|
|||
<script src="{{ asset('js/javascript.js') }}"></script>
|
||||
|
|
@ -0,0 +1,17 @@
|
|||
<div class="navbar-custom-menu">
|
||||
<ul class="nav navbar-nav">
|
||||
<li class="dropdown user user-menu">
|
||||
<a href="#" class="dropdown-toggle" data-toggle="dropdown">
|
||||
<i class="fa fa-user"></i>
|
||||
<span class="hidden-xs">{{ app.user.customer.firstName }} {{ app.user.customer.lastName }}</span>
|
||||
</a>
|
||||
<ul class="dropdown-menu">
|
||||
<li class="user-footer">
|
||||
<a href="{{ path('sylius_admin_logout') }}" class="btn btn-default btn-block btn-flat">
|
||||
<i class="fa fa-sign-out"></i> {{ 'sylius.ui.sign_out'|trans }}
|
||||
</a>
|
||||
</li>
|
||||
</ul>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
|
|
@ -0,0 +1,7 @@
|
|||
<link rel="stylesheet" href="{{ asset('css/style.css') }}">
|
||||
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/font-awesome/4.4.0/css/font-awesome.min.css">
|
||||
|
||||
<!--[if lt IE 9]>
|
||||
<script src="https://oss.maxcdn.com/html5shiv/3.7.3/html5shiv.min.js"></script>
|
||||
<script src="https://oss.maxcdn.com/respond/1.4.2/respond.min.js"></script>
|
||||
<![endif]-->
|
||||
|
|
@ -5,7 +5,7 @@
|
|||
<meta charset="utf-8">
|
||||
<meta http-equiv="X-UA-Compatible" content="IE=edge">
|
||||
|
||||
<title>{% block title %}Sylius UI{% endblock %}</title>
|
||||
<title>{% block title %}Sylius{% endblock %}</title>
|
||||
|
||||
<meta content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no" name="viewport">
|
||||
|
||||
|
|
@ -13,14 +13,7 @@
|
|||
{% endblock %}
|
||||
|
||||
{% block stylesheets %}
|
||||
<link rel="stylesheet" href="{{ asset('css/style.css') }}">
|
||||
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/font-awesome/4.4.0/css/font-awesome.min.css">
|
||||
<link rel="stylesheet" href="https://code.ionicframework.com/ionicons/2.0.1/css/ionicons.min.css">
|
||||
|
||||
<!--[if lt IE 9]>
|
||||
<script src="https://oss.maxcdn.com/html5shiv/3.7.3/html5shiv.min.js"></script>
|
||||
<script src="https://oss.maxcdn.com/respond/1.4.2/respond.min.js"></script>
|
||||
<![endif]-->
|
||||
{% include 'SyliusUiBundle::_stylesheets.html.twig' %}
|
||||
{% endblock %}
|
||||
</head>
|
||||
|
||||
|
|
@ -28,10 +21,10 @@
|
|||
<div class="wrapper">
|
||||
<header class="main-header">
|
||||
{% block logo %}
|
||||
<a href="#" class="logo">
|
||||
<span class="logo-mini"><b>S</b></span>
|
||||
<span class="logo-lg"><b>Sylius UI</b></span>
|
||||
</a>
|
||||
<a href="#" class="logo">
|
||||
<span class="logo-mini"><b>S</b></span>
|
||||
<span class="logo-lg"><b>Sylius UI</b></span>
|
||||
</a>
|
||||
{% endblock %}
|
||||
|
||||
<nav class="navbar navbar-static-top" role="navigation">
|
||||
|
|
@ -40,6 +33,7 @@
|
|||
</a>
|
||||
<div class="navbar-custom-menu">
|
||||
{% block toolbar %}
|
||||
{% include 'SyliusUiBundle::_profile.html.twig' %}
|
||||
{% endblock %}
|
||||
</div>
|
||||
</nav>
|
||||
|
|
@ -71,8 +65,7 @@
|
|||
</div>
|
||||
|
||||
{% block javascripts %}
|
||||
<script src="{{ asset('js/javascript.js') }}"></script>
|
||||
{% include 'SyliusUiBundle::_javascripts.html.twig' %}
|
||||
{% endblock %}
|
||||
|
||||
</body>
|
||||
</html>
|
||||
|
|
|
|||
|
|
@ -1,22 +0,0 @@
|
|||
{% macro generic(url, label, icon, class = 'default') %}
|
||||
<a href="{{ url }}" class="btn btn-flat btn-{{ class }}">
|
||||
{% if icon is not empty %}<i class="fa fa-{{ icon }}"></i> {% endif %}<span>{{ label|trans }}</span>
|
||||
</a>
|
||||
{% endmacro %}
|
||||
|
||||
{% macro add(url, label) %}
|
||||
{{ _self.generic(url, 'sylius.ui.add', 'plus-sign', 'success') }}
|
||||
{% endmacro %}
|
||||
|
||||
{% macro edit(url, label) %}
|
||||
{{ _self.generic(url, 'sylius.ui.edit', 'pencil') }}
|
||||
{% endmacro %}
|
||||
|
||||
{% macro delete(url, label) %}
|
||||
<form action="{{ url }}" method="post" novalidate>
|
||||
<input type="hidden" name="_method" value="DELETE">
|
||||
<button class="btn btn-flat btn-danger" type="submit">
|
||||
<i class="fa fa-trash"></i> <span>{{ label is empty ? 'sylius.ui.delete'|trans : label|trans }}</span>
|
||||
</button>
|
||||
</form>
|
||||
{% endmacro %}
|
||||
|
|
@ -0,0 +1,27 @@
|
|||
<!DOCTYPE html>
|
||||
|
||||
<html>
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<meta http-equiv="X-UA-Compatible" content="IE=edge">
|
||||
|
||||
<title>{% block title %}Sylius{% endblock %}</title>
|
||||
|
||||
<meta content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no" name="viewport">
|
||||
|
||||
{% block metatags %}
|
||||
{% endblock %}
|
||||
|
||||
{% block stylesheets %}
|
||||
{% include 'SyliusUiBundle::_stylesheets.html.twig' %}
|
||||
{% endblock %}
|
||||
</head>
|
||||
<body class="hold-transition login-page skin-sylius">
|
||||
{% block content %}
|
||||
{% endblock %}
|
||||
|
||||
{% block javascripts %}
|
||||
{% include 'SyliusUiBundle::_javascripts.html.twig' %}
|
||||
{% endblock %}
|
||||
</body>
|
||||
</html>
|
||||
40
src/Sylius/Bundle/UiBundle/composer.json
Normal file
40
src/Sylius/Bundle/UiBundle/composer.json
Normal file
|
|
@ -0,0 +1,40 @@
|
|||
{
|
||||
"name": "sylius/ui-bundle",
|
||||
"type": "symfony-bundle",
|
||||
"description": "Generic UI bundle for Sylius eCommerce components.",
|
||||
"keywords": ["shop", "ecommerce", "store", "webshop", "sylius", "ui", "user interface"],
|
||||
"homepage": "http://sylius.org",
|
||||
"license": "MIT",
|
||||
"authors": [
|
||||
{
|
||||
"name": "Paweł Jędrzejewski",
|
||||
"homepage": "http://pjedrzejewski.com"
|
||||
},
|
||||
{
|
||||
"name": "Sylius project",
|
||||
"homepage": "http://sylius.org"
|
||||
},
|
||||
{
|
||||
"name": "Community contributions",
|
||||
"homepage": "http://github.com/Sylius/Sylius/contributors"
|
||||
}
|
||||
],
|
||||
"require": {
|
||||
"php": "^5.5.9|^7.0",
|
||||
|
||||
"knplabs/knp-menu-bundle": "1.1.*",
|
||||
"symfony/framework-bundle": "^2.7.7"
|
||||
},
|
||||
"config": {
|
||||
"bin-dir": "bin"
|
||||
},
|
||||
"autoload": {
|
||||
"psr-4": { "Sylius\\Bundle\\UiBundle\\": "" }
|
||||
},
|
||||
"minimum-stability": "dev",
|
||||
"extra": {
|
||||
"branch-alias": {
|
||||
"dev-master": "0.17-dev"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,89 @@
|
|||
<?php
|
||||
|
||||
/*
|
||||
* This file is part of the Sylius package.
|
||||
*
|
||||
* (c) Paweł Jędrzejewski
|
||||
*
|
||||
* For the full copyright and license information, please view the LICENSE
|
||||
* file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
namespace spec\Sylius\Bundle\UiBundle\Controller;
|
||||
|
||||
use PhpSpec\ObjectBehavior;
|
||||
use Prophecy\Argument;
|
||||
use Sylius\Bundle\UiBundle\Controller\SecurityController;
|
||||
use Symfony\Bundle\FrameworkBundle\Controller\Controller;
|
||||
use Symfony\Bundle\FrameworkBundle\Templating\EngineInterface;
|
||||
use Symfony\Component\Form\Form;
|
||||
use Symfony\Component\Form\FormFactoryInterface;
|
||||
use Symfony\Component\Form\FormView;
|
||||
use Symfony\Component\HttpFoundation\ParameterBag;
|
||||
use Symfony\Component\HttpFoundation\Request;
|
||||
use Symfony\Component\HttpFoundation\Response;
|
||||
use Symfony\Component\Security\Http\Authentication\AuthenticationUtils;
|
||||
|
||||
/**
|
||||
* @mixin SecurityController
|
||||
*
|
||||
* @author Paweł Jędrzejewski <pawel@sylius.org>
|
||||
*/
|
||||
class SecurityControllerSpec extends ObjectBehavior
|
||||
{
|
||||
function let(AuthenticationUtils $authenticationUtils, FormFactoryInterface $formFactory, EngineInterface $templatingEngine)
|
||||
{
|
||||
$this->beConstructedWith($authenticationUtils, $formFactory, $templatingEngine);
|
||||
}
|
||||
|
||||
function it_is_initializable()
|
||||
{
|
||||
$this->shouldHaveType('Sylius\Bundle\UiBundle\Controller\SecurityController');
|
||||
}
|
||||
|
||||
function it_renders_login_form(
|
||||
Request $request,
|
||||
ParameterBag $requestAttributes,
|
||||
AuthenticationUtils $authenticationUtils,
|
||||
FormFactoryInterface $formFactory,
|
||||
Form $form,
|
||||
FormView $formView,
|
||||
EngineInterface $templatingEngine,
|
||||
Response $response
|
||||
) {
|
||||
$authenticationUtils->getLastAuthenticationError()->willReturn('Bad credentials.');
|
||||
$authenticationUtils->getLastUsername()->willReturn('john.doe');
|
||||
|
||||
$request->attributes = $requestAttributes;
|
||||
$requestAttributes->get('_sylius[template]', 'SyliusUiBundle:Security:login.html.twig', true)->willReturn('CustomTemplateName');
|
||||
$requestAttributes->get('_sylius[form]', 'sylius_security_login', true)->willReturn('custom_form_type');
|
||||
|
||||
$formFactory->createNamed('', 'custom_form_type')->willReturn($form);
|
||||
$form->createView()->willReturn($formView);
|
||||
|
||||
$templatingEngine
|
||||
->renderResponse('CustomTemplateName', array(
|
||||
'form' => $formView,
|
||||
'last_username' => 'john.doe',
|
||||
'last_error' => 'Bad credentials.',
|
||||
))
|
||||
->willReturn($response)
|
||||
;
|
||||
|
||||
$this->loginAction($request)->shouldReturn($response);
|
||||
}
|
||||
|
||||
function it_throws_an_exception_when_check_action_is_accessed(Request $request)
|
||||
{
|
||||
$this
|
||||
->shouldThrow(new \RuntimeException('You must configure the check path to be handled by the firewall.'))
|
||||
->during('checkAction', array($request));
|
||||
}
|
||||
|
||||
function it_throws_an_exception_when_logout_action_is_accessed(Request $request)
|
||||
{
|
||||
$this
|
||||
->shouldThrow(new \RuntimeException('You must configure the logout path to be handled by the firewall.'))
|
||||
->during('logoutAction', array($request));
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,56 @@
|
|||
<?php
|
||||
|
||||
/*
|
||||
* This file is part of the Sylius package.
|
||||
*
|
||||
* (c) Paweł Jędrzejewski
|
||||
*
|
||||
* For the full copyright and license information, please view the LICENSE
|
||||
* file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
namespace spec\Sylius\Bundle\UiBundle\Form\Type;
|
||||
|
||||
use PhpSpec\ObjectBehavior;
|
||||
use Prophecy\Argument;
|
||||
use Sylius\Bundle\UiBundle\Form\Type\SecurityLoginType;
|
||||
use Symfony\Component\Form\AbstractType;
|
||||
use Symfony\Component\Form\FormBuilderInterface;
|
||||
use Symfony\Component\Form\FormTypeInterface;
|
||||
|
||||
/**
|
||||
* @mixin SecurityLoginType
|
||||
*
|
||||
* @author Paweł Jędrzejewski <pawel@sylius.org>
|
||||
*/
|
||||
class SecurityLoginTypeSpec extends ObjectBehavior
|
||||
{
|
||||
function it_is_initializable()
|
||||
{
|
||||
$this->shouldHaveType('Sylius\Bundle\UiBundle\Form\Type\SecurityLoginType');
|
||||
}
|
||||
|
||||
function it_is_a_form_type()
|
||||
{
|
||||
$this->shouldImplement(FormTypeInterface::class);
|
||||
}
|
||||
|
||||
function it_extends_abstract_form_type()
|
||||
{
|
||||
$this->shouldHaveType(AbstractType::class);
|
||||
}
|
||||
|
||||
function it_builds_form_with_username_and_password_fields(FormBuilderInterface $builder)
|
||||
{
|
||||
$builder->add('_username', 'text', Argument::any())->shouldBeCalled()->willReturn($builder);
|
||||
$builder->add('_password', 'password', Argument::any())->shouldBeCalled()->willReturn($builder);
|
||||
$builder->add('_remember_me', 'checkbox', Argument::any())->shouldBeCalled()->willReturn($builder);
|
||||
|
||||
$this->buildForm($builder, array());
|
||||
}
|
||||
|
||||
function it_has_a_name()
|
||||
{
|
||||
$this->getName()->shouldReturn('sylius_security_login');
|
||||
}
|
||||
}
|
||||
|
|
@ -2,16 +2,16 @@ sylius_user_security_login:
|
|||
path: /login
|
||||
methods: [GET]
|
||||
defaults:
|
||||
_controller: sylius.controller.security:loginAction
|
||||
_controller: sylius.controller.user_security:loginAction
|
||||
|
||||
sylius_user_security_check:
|
||||
path: /login_check
|
||||
methods: [POST]
|
||||
defaults:
|
||||
_controller: sylius.controller.security:checkAction
|
||||
_controller: sylius.controller.user_security:checkAction
|
||||
|
||||
sylius_user_security_logout:
|
||||
path: /logout
|
||||
methods: [GET, POST]
|
||||
defaults:
|
||||
_controller: sylius.controller.security:logoutAction
|
||||
_controller: sylius.controller.user_security:logoutAction
|
||||
|
|
|
|||
|
|
@ -52,7 +52,7 @@
|
|||
<parameter key="sylius.listener.user_reloader.class">Sylius\Bundle\UserBundle\EventListener\UserReloaderListener</parameter>
|
||||
<parameter key="sylius.listener.user_mailer_listener.class">Sylius\Bundle\UserBundle\EventListener\MailerListener</parameter>
|
||||
|
||||
<parameter key="sylius.controller.security.class">Sylius\Bundle\UserBundle\Controller\SecurityController</parameter>
|
||||
<parameter key="sylius.controller.user_security.class">Sylius\Bundle\UserBundle\Controller\SecurityController</parameter>
|
||||
|
||||
<parameter key="sylius.user.validator.unique_registered_user.class">Sylius\Bundle\UserBundle\Validator\Constraints\RegisteredUserValidator</parameter>
|
||||
</parameters>
|
||||
|
|
@ -65,7 +65,7 @@
|
|||
</service>
|
||||
|
||||
<!-- Controllers -->
|
||||
<service id="sylius.controller.security" class="%sylius.controller.security.class%">
|
||||
<service id="sylius.controller.user_security" class="%sylius.controller.user_security.class%">
|
||||
<call method="setContainer">
|
||||
<argument type="service" id="service_container" />
|
||||
</call>
|
||||
|
|
|
|||
|
|
@ -19,7 +19,7 @@ sylius_user_security_login:
|
|||
path: /login
|
||||
methods: [GET]
|
||||
defaults:
|
||||
_controller: sylius.controller.security:loginAction
|
||||
_controller: sylius.controller.user_security:loginAction
|
||||
_sylius:
|
||||
template: SyliusWebBundle:Frontend/User:login.html.twig
|
||||
|
||||
|
|
|
|||
|
|
@ -23,4 +23,5 @@
|
|||
{{ pagination(tax_categories) }}
|
||||
{{ list(tax_categories) }}
|
||||
{{ pagination(tax_categories) }}
|
||||
|
||||
{% endblock %}
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue