1
0
mirror of https://github.com/ToxicCrack/PrintABrick.git synced 2025-05-20 06:00:08 -07:00

Fix coding style

This commit is contained in:
David Hübner 2017-05-05 21:09:28 +02:00
parent 25bdbad8df
commit 9f91778632
24 changed files with 183 additions and 56 deletions

View File

@ -11,3 +11,17 @@ $(document).ready(function () {
});
})
});
$(document).ajaxComplete(function () {
$('.image.load img')
.visibility({
type : 'image',
transition : 'fade in',
duration : 1000
})
;
$('.ui.rating')
.rating("disable")
;
});

View File

@ -1,6 +1,6 @@
$(document).bind('ready ajaxComplete', function(){
$(document).ready(function(){
$('.ui.dropdown')
.dropdown()
.dropdown('restore defaults')
;
$('.image.load img')
@ -33,4 +33,8 @@ $(document).bind('ready ajaxComplete', function(){
inline: true
})
;
$('.ui.modal')
.modal('attach events', '.ui.open-modal.button', 'show')
;
});

View File

@ -1,4 +1,4 @@
$alpha = 0.7;
$alpha: 0.7;
$colors: (
-1: #0033B2,
@ -137,3 +137,9 @@ $colors: (
1007: #8E5597,
9999: #05131D,
);
@each $number, $color in $colors {
.color-#{$number} {
border-bottom: 2px solid $color;
}
}

View File

@ -1,5 +1,25 @@
.default-theme {
.ui.main {
padding-top: 40px;
min-height: calc(100% - 67px);
}
.ui.masthead {
position: relative;
.header {
margin-bottom: 0;
}
.breadcrumb {
right: 0;
top: 0;
position: absolute;
padding: 20px 0;
}
}
.ui.fixed + .ui.grid {
border-radius: 0;
border: 0;
@ -56,3 +76,7 @@
.ui.text.right {
text-align: right;
}
.ui.segment.vertical.noborder {
border-bottom: 0;
}

View File

@ -0,0 +1,14 @@
.model-meta {
background: #E0E1E2;
text-align: center;
.quantity {
font-weight: 700;
color: #444444;
}
.number {
margin: 0.2em;
display: inline-block;
color: #000000;
}
}

View File

@ -8,6 +8,14 @@
height: 100%;
}
.modelviewer-wrapper {
position: absolute;
top: 0;
bottom: 0;
margin-top: 26%;
width: 100%;
}
.modelviewer-buttons {
text-align: right;
position: absolute;

View File

@ -0,0 +1,17 @@
.ui.comments {
max-width: 1200px
}
.ratings {
dl dt {
font-size: 1.2em;
margin-bottom: 0.5em;
}
dl dd {
margin-bottom: 1em;
}
}
.ui.comments .comment > .ratings ~ .content {
}

View File

@ -2,3 +2,7 @@
@import "main";
@import "modelviewer";
@import "model";
@import "colors";
@import "reviews";

View File

@ -6,7 +6,6 @@ set:
parts: Count of parts
minifigs: Minifig count
rating: Rating
download: Download
models:
text: |
This set inventory has been obtained from Rebrickable.
@ -19,3 +18,25 @@ set:
The table below lists all instructions for this set that have been available at <a href="http://service.lego.com/en-gb/buildinginstructions" title="LEGO Customer Service" rel="nofollow">LEGO Customer Services</a>. Those that are no longer listed there may still be available to download.
'NA' or 'V39' indicates the US/Canadian version. 'IN' or 'V29' indicates the international version.
download:
title: Download - %set%
sorted:
title: Multi-Color
text:
unsorted:
title: Uni-Color
text:
warning:
title:
text: Models of some parts could not be found in LDraw library
page:
model.index: Browse models
filter:
model:
search: Search Model
category: Category

View File

@ -1,7 +1,6 @@
{% extends 'html.html.twig' %}
{% import 'macros/elements.html.twig' as elements %}
{% import 'macros/blocks.html.twig' as blocks %}
{% block body %}
<div class="ui fixed inverted menu">
@ -23,7 +22,8 @@
<div class="ui main">
<div class="ui container">
<div class="ui masthead vertical segment">
<div class="introduction">
<h1 class="ui header">{% block header %}{% endblock %}</h1>
<div class="ui small breadcrumb">
{% for breadcrumb_item in knp_menu_get_breadcrumbs_array(knp_menu_get_current_item('mainMenu')) %}
{% if not loop.last %}
@ -34,8 +34,6 @@
{% endif %}
{% endfor %}
</div>
<h1 class="ui header">{% block header %}{% endblock %}</h1>
</div>
</div>
<div class="ui vertical segment content">
{% for label, flashes in app.session.flashbag.all %}
@ -53,8 +51,8 @@
{% endblock page %}
<div class="ui black inverted vertical footer segment stripe">
{% block footer %}
<div class="ui center aligned container">
<div class="ui aligned container">
<p>LEGO®, the LEGO logo, the Minifigure, and the Brick and Knob configurations are trademarks of the LEGO Group of Companies which does not sponsor, authorize, or endorse this site.</p>
</div>
{% endblock %}
</div>

View File

@ -1,6 +1,7 @@
{% extends 'base.html.twig' %}
{% block page %}
<div class="ui main">
<div class="ui grid massive message vertical">
<div class="ui container">
<div class="row">
@ -10,5 +11,6 @@
</div>
</div>
</div>
</div>
{% endblock %}

View File

@ -10,7 +10,6 @@
{% for set in sets %}
<div class="column">
<a href="{{ url('set_detail', {'number': set.number}) }}">
<img class="ui bordered image medium" src="{{ set.number|setImage|imagine_filter('rebrickable_set_min') }}">
<p>{{ set.number }} - {{ set.name }}</p>
</a>
</div>

View File

@ -14,3 +14,11 @@ web_profiler:
swiftmailer:
disable_delivery: true
doctrine:
dbal:
default_connection: default
connections:
default:
driver: pdo_sqlite
path: "%kernel.cache_dir%/test.db"

View File

@ -11,6 +11,6 @@ services:
app.twig_extension:
class: AppBundle\Twig\AppExtension
public: false
arguments: ['@api.manager.rebrickable', '@app.transformer.format']
arguments: ['@app.transformer.format']
tags:
- { name: twig.extension }

View File

@ -12,8 +12,6 @@ use AppBundle\Api\Client\Brickset\Entity\Year;
use AppBundle\Api\Exception\ApiException;
use AppBundle\Api\Exception\AuthenticationFailedException;
use AppBundle\Api\Exception\CallFailedException;
use AppBundle\Api\Exception\EmptyResponseException;
use Symfony\Component\Debug\Exception\ContextErrorException;
class Brickset extends \SoapClient
{
@ -83,11 +81,11 @@ class Brickset extends \SoapClient
$result = $this->__soapCall($method, [$parameters]);
if(property_exists($result, $method.'Result')) {
if (property_exists($result, $method.'Result')) {
return $result->{$method.'Result'};
} else {
return null;
}
return null;
} catch (\SoapFault $e) {
throw new CallFailedException(ApiException::BRICKSET);
} catch (\Exception $e) {
@ -96,8 +94,9 @@ class Brickset extends \SoapClient
}
}
private function getArrayResult($response, $method) {
if($response && $result = $response->{$method}) {
private function getArrayResult($response, $method)
{
if ($response && $result = $response->{$method}) {
return is_array($result) ? $result : [$result];
}

View File

@ -3,11 +3,9 @@
namespace AppBundle\Controller\Brickset;
use AppBundle\Api\Exception\ApiException;
use AppBundle\Api\Exception\EmptyResponseException;
use AppBundle\Entity\Rebrickable\Set;
use Sensio\Bundle\FrameworkExtraBundle\Configuration\Method;
use Sensio\Bundle\FrameworkExtraBundle\Configuration\Route;
use Symfony\Bundle\FrameworkBundle\Controller\Controller;
use Sensio\Bundle\FrameworkExtraBundle\Configuration\Method;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\HttpFoundation\Response;

View File

@ -17,7 +17,7 @@ use Symfony\Component\HttpFoundation\Request;
class SearchController extends Controller
{
/**
* @Route("/", name="search_result")
* @Route("/", name="search_results")
*/
public function searchAction(Request $request)
{

View File

@ -23,7 +23,10 @@ class CategoryFilterType extends AbstractType
$builder->add('id', Filters\ChoiceFilterType::class, [
'choices' => $this->categoryRepository->findAll(),
'choice_label' => 'name',
'label' => 'filter.part.category',
'label' => 'filter.model.category',
// 'attr' => [
// 'class' => 'ui dropdown search selection'
// ]
]);
}

View File

@ -16,7 +16,7 @@ class ModelFilterType extends AbstractType
{
$builder->add('search', Filters\TextFilterType::class, [
'apply_filter' => [$this, 'modelSearchCallback'],
'label' => 'filter.part.search',
'label' => 'filter.model.search',
]);
$builder->add('category', CategoryFilterType::class, [
@ -30,7 +30,7 @@ class ModelFilterType extends AbstractType
public function getBlockPrefix()
{
return 'model_filter';
return 'filter';
}
public function configureOptions(OptionsResolver $resolver)
@ -43,14 +43,16 @@ class ModelFilterType extends AbstractType
public function modelSearchCallback(QueryInterface $filterQuery, $field, $values)
{
if (empty($values['value'])) {
if (empty($values['value']) || $values['value'] === '') {
return null;
}
$expr = $filterQuery->getExpr();
// expression that represent the condition
$expression = $filterQuery->getExpr()->orX(
$filterQuery->getExpr()->like('model.number', ':value'),
$filterQuery->getExpr()->like('model.name', ':value')
$expression = $expr->orX(
$expr->like('model.number', ':value'),
$expr->like('model.name', ':value')
//TODO filter by keywords
);

View File

@ -29,7 +29,7 @@ class SetFilterType extends AbstractType
$builder->add('theme', ThemeFilterType::class, [
'add_shared' => function (FilterBuilderExecuterInterface $builderExecuter) {
$builderExecuter->addOnce($builderExecuter->getAlias().'.theme', 'c', function (QueryBuilder $filterBuilder, $alias, $joinAlias, $expr) {
$builderExecuter->addOnce($builderExecuter->getAlias().'.theme', 't', function (QueryBuilder $filterBuilder, $alias, $joinAlias, $expr) {
$filterBuilder->leftJoin($alias.'.theme', $joinAlias);
});
},

View File

@ -21,7 +21,7 @@ class ThemeFilterType extends AbstractType
public function buildForm(FormBuilderInterface $builder, array $options)
{
$builder->add('id', Filters\ChoiceFilterType::class, [
'choices' => $this->themeRepository->findAll(),
'choices' => $this->themeRepository->findAllMain(),
'choice_label' => function ($theme, $currentChoiceKey) {
if ($parent = $theme->getParent()) {
if ($parentParent = $parent->getParent()) {
@ -38,6 +38,9 @@ class ThemeFilterType extends AbstractType
return $theme->getName();
},
'label' => 'filter.set.theme',
// 'attr' => [
// 'class' => 'ui dropdown search selection'
// ]
]);
}

View File

@ -28,24 +28,26 @@ class Builder
public function mainMenu(array $options)
{
$request = $this->requestStack->getCurrentRequest();
$menu = $this->factory->createItem('root');
$menu->addChild('Home', [
$menu = $this->factory->createItem('root', [
'route' => 'homepage',
]);
$menu->addChild('Models', [
$menu->addChild('homepage', [
'route' => 'homepage',
]);
$models = $menu->addChild('Models', [
'route' => 'model_index',
]);
$models->addChild('Colors', [
'route' => 'color_index',
]);
$menu->addChild('Sets', [
'route' => 'set_index',
]);
$menu->addChild('Colors', [
'route' => 'color_index',
]);
return $menu;
}
}

View File

@ -9,6 +9,7 @@ class FormatTransformer
*
* @param $bytes
* @param int $precision
*
* @return string
*/
public function bytesToSize($bytes, $precision = 2)