mirror of
https://github.com/ToxicCrack/PrintABrick.git
synced 2025-05-17 12:50:08 -07:00
Cleanup
This commit is contained in:
parent
69aaca9740
commit
5fb396d62f
@ -82,14 +82,7 @@
|
|||||||
{% endfor %}
|
{% endfor %}
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
{#<div class="ui grid stackable">#}
|
|
||||||
{#<div class="right floated right aligned four wide column">#}
|
|
||||||
|
|
||||||
{#</div>#}
|
|
||||||
{#<div class="left floated left aligned twelve wide column">#}
|
|
||||||
<h1 class="ui header">{% block header %}{% endblock %}</h1>
|
<h1 class="ui header">{% block header %}{% endblock %}</h1>
|
||||||
{#</div>#}
|
|
||||||
{#</div>#}
|
|
||||||
|
|
||||||
{% for label, flashes in app.session.flashbag.all %}
|
{% for label, flashes in app.session.flashbag.all %}
|
||||||
{% for flash in flashes %}
|
{% for flash in flashes %}
|
||||||
|
@ -20,33 +20,35 @@
|
|||||||
{% block content %}
|
{% block content %}
|
||||||
<div class="ui segment vertical secondary">
|
<div class="ui segment vertical secondary">
|
||||||
<div class="ui container stackable grid divided">
|
<div class="ui container stackable grid divided">
|
||||||
<div class="column four wide">
|
<div class="column four wide">
|
||||||
<div class="segment basic ui filter">
|
<div class="segment basic ui filter">
|
||||||
<h3 class="header dividing ui">{{ 'model.filter.title' | trans }}</h3>
|
<h3 class="header dividing ui">{{ 'model.filter.title' | trans }}</h3>
|
||||||
{{ form_start(form) }}
|
{{ form_start(form) }}
|
||||||
<div class="field">
|
<div class="field">
|
||||||
{{ form_label(form.query) }}
|
{{ form_label(form.query) }}
|
||||||
<div class="ui icon input">
|
<div class="ui icon input">
|
||||||
{{ form_widget(form.query) }}
|
{{ form_widget(form.query) }}
|
||||||
<i class="search icon"></i>
|
<i class="search icon"></i>
|
||||||
</div>
|
|
||||||
</div>
|
</div>
|
||||||
{{ form_row(form.category) }}
|
|
||||||
<div class="field">
|
|
||||||
<input class="ui fluid submit green button" type="submit" value="{{ 'form.search.submit' | trans }}"/>
|
|
||||||
</div>
|
|
||||||
{{ form_end(form) }}
|
|
||||||
</div>
|
</div>
|
||||||
|
{{ form_row(form.category) }}
|
||||||
|
<div class="field">
|
||||||
|
<input class="ui fluid submit green button" type="submit" value="{{ 'form.search.submit' | trans }}"/>
|
||||||
|
</div>
|
||||||
|
{{ form_end(form) }}
|
||||||
</div>
|
</div>
|
||||||
<div class="column twelve wide">
|
</div>
|
||||||
<div class="segment basic ui">
|
<div class="column twelve wide">
|
||||||
<div class="ui header segment vertical sort">
|
<div class="segment basic ui">
|
||||||
<div class="ui grid stackable">
|
<div class="ui header segment vertical sort">
|
||||||
|
<div class="ui grid stackable">
|
||||||
<div class="five wide column">
|
<div class="five wide column">
|
||||||
|
{% if models.paginationData['totalCount'] %}
|
||||||
<div class="ui text left floated menu">
|
<div class="ui text left floated menu">
|
||||||
<div class="header item">Showing</div>
|
<div class="header item">Showing</div>
|
||||||
<span class="item">{{ models.paginationData['firstItemNumber']~' - '~models.paginationData['lastItemNumber'] }} of {{ models.getTotalItemCount }} items</span>
|
<span class="item">{{ models.paginationData['firstItemNumber']~' - '~models.paginationData['lastItemNumber'] }} of {{ models.getTotalItemCount }} items</span>
|
||||||
</div>
|
</div>
|
||||||
|
{% endif %}
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="eleven wide column">
|
<div class="eleven wide column">
|
||||||
@ -56,22 +58,23 @@
|
|||||||
{{ knp_pagination_sortable(models, 'Name', 'm.name') }}
|
{{ knp_pagination_sortable(models, 'Name', 'm.name') }}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<div class="ui segment vertical">
|
|
||||||
<div class="ui six column doubling grid parts">
|
|
||||||
{% for model in models %}
|
|
||||||
{{ blocks.model(model) }}
|
|
||||||
{% else %}
|
|
||||||
{{ blocks.empty('empty.search.title' | trans )}}
|
|
||||||
{% endfor %}
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<div class="ui segment vertical right floated">
|
|
||||||
{{ knp_pagination_render(models) }}
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
<div class="ui segment vertical">
|
||||||
|
<div class="ui six column doubling grid parts">
|
||||||
|
{% for model in models %}
|
||||||
|
{{ blocks.model(model) }}
|
||||||
|
{% else %}
|
||||||
|
{{ blocks.empty('empty.search.title' | trans )}}
|
||||||
|
{% endfor %}
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="ui segment vertical right floated">
|
||||||
|
{{ knp_pagination_render(models) }}
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
|
@ -51,10 +51,12 @@
|
|||||||
<div class="ui header segment vertical sort">
|
<div class="ui header segment vertical sort">
|
||||||
<div class="ui grid stackable">
|
<div class="ui grid stackable">
|
||||||
<div class="five wide column">
|
<div class="five wide column">
|
||||||
<div class="ui text left floated menu">
|
{% if sets.paginationData['totalCount'] %}
|
||||||
<div class="header item">Showing</div>
|
<div class="ui text left floated menu">
|
||||||
<span class="item">{{ sets.paginationData['firstItemNumber']~' - '~sets.paginationData['lastItemNumber'] }} of {{ sets.getTotalItemCount }} items</span>
|
<div class="header item">Showing</div>
|
||||||
</div>
|
<span class="item">{{ sets.paginationData['firstItemNumber']~' - '~sets.paginationData['lastItemNumber'] }} of {{ sets.getTotalItemCount }} items</span>
|
||||||
|
</div>
|
||||||
|
{% endif %}
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="eleven wide column">
|
<div class="eleven wide column">
|
||||||
@ -67,6 +69,7 @@
|
|||||||
{{ knp_pagination_sortable(sets, 'Parts', ['s.partCount']) }}
|
{{ knp_pagination_sortable(sets, 'Parts', ['s.partCount']) }}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="ui segment vertical">
|
<div class="ui segment vertical">
|
||||||
|
@ -42,7 +42,7 @@ class BricksetClient
|
|||||||
/**
|
/**
|
||||||
* BricksetClient constructor.
|
* BricksetClient constructor.
|
||||||
*
|
*
|
||||||
* @param string $apikey Brickset API key
|
* @param string $apiKey Brickset API key
|
||||||
* @param array $options A array of config values
|
* @param array $options A array of config values
|
||||||
*
|
*
|
||||||
* @throws ApiException
|
* @throws ApiException
|
||||||
|
@ -98,5 +98,7 @@ class LoadLdrawCommand extends ContainerAwareCommand
|
|||||||
}
|
}
|
||||||
|
|
||||||
$this->release();
|
$this->release();
|
||||||
|
|
||||||
|
return 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -11,6 +11,9 @@ class AjaxController extends AbstractController
|
|||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
* @Route("/set_tab/{tab}", name="set_tab", requirements={"tab"=".+"})
|
* @Route("/set_tab/{tab}", name="set_tab", requirements={"tab"=".+"})
|
||||||
|
* @param Request $request
|
||||||
|
* @param $tab
|
||||||
|
* @return Response
|
||||||
*/
|
*/
|
||||||
public function setDefaultTabAction(Request $request, $tab)
|
public function setDefaultTabAction(Request $request, $tab)
|
||||||
{
|
{
|
||||||
|
@ -17,6 +17,8 @@ class ColorController extends AbstractController
|
|||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
* @Route("/", name="color_index")
|
* @Route("/", name="color_index")
|
||||||
|
* @param ColorService $colorService
|
||||||
|
* @return \Symfony\Component\HttpFoundation\Response
|
||||||
*/
|
*/
|
||||||
public function indexAction(ColorService $colorService)
|
public function indexAction(ColorService $colorService)
|
||||||
{
|
{
|
||||||
|
@ -135,8 +135,7 @@ class Color
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param Inventory_Part $part_building_kit
|
* @param Inventory_Part $inventoryPart
|
||||||
*
|
|
||||||
* @return Color
|
* @return Color
|
||||||
*/
|
*/
|
||||||
public function addPartInventoryPart(Inventory_Part $inventoryPart)
|
public function addPartInventoryPart(Inventory_Part $inventoryPart)
|
||||||
@ -147,7 +146,7 @@ class Color
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param Inventory_Part $part_building_kit
|
* @param Inventory_Part $inventoryPart
|
||||||
*
|
*
|
||||||
* @return Color
|
* @return Color
|
||||||
*/
|
*/
|
||||||
|
@ -166,6 +166,8 @@ class Model
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* @param string $name
|
* @param string $name
|
||||||
|
*
|
||||||
|
* @return Model
|
||||||
*/
|
*/
|
||||||
public function setName($name)
|
public function setName($name)
|
||||||
{
|
{
|
||||||
|
@ -48,20 +48,6 @@ class Inventory_Part
|
|||||||
*/
|
*/
|
||||||
protected $inventory;
|
protected $inventory;
|
||||||
|
|
||||||
/**
|
|
||||||
* Set count.
|
|
||||||
*
|
|
||||||
* @param int $count
|
|
||||||
*
|
|
||||||
* @return Inventory_Part
|
|
||||||
*/
|
|
||||||
public function setCount($count)
|
|
||||||
{
|
|
||||||
$this->count = $count;
|
|
||||||
|
|
||||||
return $this;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get count.
|
* Get count.
|
||||||
*
|
*
|
||||||
|
@ -68,6 +68,7 @@ class SetSearchType extends AbstractType
|
|||||||
'choice_label' => 'fullName',
|
'choice_label' => 'fullName',
|
||||||
'choice_translation_domain' => false,
|
'choice_translation_domain' => false,
|
||||||
'group_by' => function ($theme, $key, $index) {
|
'group_by' => function ($theme, $key, $index) {
|
||||||
|
/** @var Theme $theme */
|
||||||
$parent = $theme->getParent();
|
$parent = $theme->getParent();
|
||||||
|
|
||||||
return $parent ? $parent->getParent() ? $parent->getParent()->getName() : $parent->getName() : $theme->getName();
|
return $parent ? $parent->getParent() ? $parent->getParent()->getName() : $parent->getName() : $theme->getName();
|
||||||
|
@ -11,7 +11,7 @@ class ColorRepository extends BaseRepository
|
|||||||
{
|
{
|
||||||
public function findAllBySet(Set $set)
|
public function findAllBySet(Set $set)
|
||||||
{
|
{
|
||||||
$inventory = $this->getEntityManager()->getRepository(Inventory::class)->findNewestInventoryBySetNumber($set->getNumber());
|
$inventory = $this->getEntityManager()->getRepository(Inventory::class)->findNewestInventoryBySetNumber($set->getId());
|
||||||
|
|
||||||
$queryBuilder = $this->createQueryBuilder('color');
|
$queryBuilder = $this->createQueryBuilder('color');
|
||||||
|
|
||||||
|
@ -16,8 +16,10 @@ class SubpartRepository extends BaseRepository
|
|||||||
/**
|
/**
|
||||||
* Create new Subpart relation entity or retrieve one by foreign keys.
|
* Create new Subpart relation entity or retrieve one by foreign keys.
|
||||||
*
|
*
|
||||||
* @param $name
|
* @param $parent
|
||||||
*
|
* @param $child
|
||||||
|
* @param $count
|
||||||
|
* @param $colorId
|
||||||
* @return Subpart
|
* @return Subpart
|
||||||
*/
|
*/
|
||||||
public function getOrCreate($parent, $child, $count, $colorId)
|
public function getOrCreate($parent, $child, $count, $colorId)
|
||||||
@ -29,6 +31,7 @@ class SubpartRepository extends BaseRepository
|
|||||||
|
|
||||||
$colorRepository = $this->getEntityManager()->getRepository(Color::class);
|
$colorRepository = $this->getEntityManager()->getRepository(Color::class);
|
||||||
if (!($color = $colorRepository->find($colorId))) {
|
if (!($color = $colorRepository->find($colorId))) {
|
||||||
|
/** @var Color $color */
|
||||||
$color = $colorRepository->find(-1);
|
$color = $colorRepository->find(-1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -36,7 +36,7 @@ class SetRepository extends Repository
|
|||||||
|
|
||||||
$boolQuery->addMust($query);
|
$boolQuery->addMust($query);
|
||||||
} else {
|
} else {
|
||||||
$query = new \Elastica\Query\MatchAll();
|
$query = new Query\MatchAll();
|
||||||
$boolQuery->addMust($query);
|
$boolQuery->addMust($query);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -13,6 +13,7 @@ class ColorService
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* ColorService constructor.
|
* ColorService constructor.
|
||||||
|
* @param EntityManagerInterface $em
|
||||||
*/
|
*/
|
||||||
public function __construct(EntityManagerInterface $em)
|
public function __construct(EntityManagerInterface $em)
|
||||||
{
|
{
|
||||||
|
@ -12,7 +12,6 @@ use Psr\Log\LoggerInterface;
|
|||||||
use Symfony\Component\Asset\Exception\LogicException;
|
use Symfony\Component\Asset\Exception\LogicException;
|
||||||
use Symfony\Component\Console\Helper\ProgressBar;
|
use Symfony\Component\Console\Helper\ProgressBar;
|
||||||
use Symfony\Component\Console\Output\OutputInterface;
|
use Symfony\Component\Console\Output\OutputInterface;
|
||||||
use Symfony\Component\Debug\Exception\ContextErrorException;
|
|
||||||
|
|
||||||
abstract class BaseLoader
|
abstract class BaseLoader
|
||||||
{
|
{
|
||||||
@ -65,6 +64,7 @@ abstract class BaseLoader
|
|||||||
* Initialize new progress bar.
|
* Initialize new progress bar.
|
||||||
*
|
*
|
||||||
* @param $total
|
* @param $total
|
||||||
|
* @param string $format
|
||||||
*/
|
*/
|
||||||
protected function initProgressBar($total, $format = 'loader')
|
protected function initProgressBar($total, $format = 'loader')
|
||||||
{
|
{
|
||||||
|
@ -60,6 +60,7 @@ class ImageLoader extends BaseLoader
|
|||||||
// Get models without image
|
// Get models without image
|
||||||
$missing = [];
|
$missing = [];
|
||||||
$models = $this->em->getRepository(Model::class)->findAll();
|
$models = $this->em->getRepository(Model::class)->findAll();
|
||||||
|
/** @var Model $model */
|
||||||
foreach ($models as $model) {
|
foreach ($models as $model) {
|
||||||
if (!$this->mediaFilesystem->has('images'.DIRECTORY_SEPARATOR.'-1'.DIRECTORY_SEPARATOR.$model->getId().'.png')) {
|
if (!$this->mediaFilesystem->has('images'.DIRECTORY_SEPARATOR.'-1'.DIRECTORY_SEPARATOR.$model->getId().'.png')) {
|
||||||
$missing[] = $model;
|
$missing[] = $model;
|
||||||
|
@ -134,7 +134,7 @@ class ModelLoader extends BaseLoader
|
|||||||
try {
|
try {
|
||||||
$connection->beginTransaction();
|
$connection->beginTransaction();
|
||||||
|
|
||||||
$this->getFileContext($file);
|
$this->loadFileContext($file);
|
||||||
$this->loadModel($file);
|
$this->loadModel($file);
|
||||||
|
|
||||||
$connection->commit();
|
$connection->commit();
|
||||||
@ -206,6 +206,7 @@ class ModelLoader extends BaseLoader
|
|||||||
|
|
||||||
// Return model from database if rewrite is not enabled
|
// Return model from database if rewrite is not enabled
|
||||||
if (!$this->rewrite && $model = $modelRepository->find(basename($file, '.dat'))) {
|
if (!$this->rewrite && $model = $modelRepository->find(basename($file, '.dat'))) {
|
||||||
|
/** @var Model $model */
|
||||||
return $model;
|
return $model;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -329,7 +330,6 @@ class ModelLoader extends BaseLoader
|
|||||||
*
|
*
|
||||||
*
|
*
|
||||||
* @param $id
|
* @param $id
|
||||||
* @param Filesystem $context
|
|
||||||
*
|
*
|
||||||
* @return string
|
* @return string
|
||||||
*/
|
*/
|
||||||
@ -359,18 +359,14 @@ class ModelLoader extends BaseLoader
|
|||||||
* Get new filesystem context of current file.
|
* Get new filesystem context of current file.
|
||||||
*
|
*
|
||||||
* @param $file
|
* @param $file
|
||||||
*
|
|
||||||
* @return Filesystem
|
|
||||||
*/
|
*/
|
||||||
private function getFileContext($file)
|
private function loadFileContext($file)
|
||||||
{
|
{
|
||||||
try {
|
try {
|
||||||
$adapter = new Local(dirname($file));
|
$adapter = new Local(dirname($file));
|
||||||
$this->fileContext = new Filesystem($adapter);
|
$this->fileContext = new Filesystem($adapter);
|
||||||
} catch (Exception $exception) {
|
} catch (Exception $exception) {
|
||||||
$this->logger->error($exception->getMessage());
|
$this->logger->error($exception->getMessage());
|
||||||
|
|
||||||
return null;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -27,9 +27,9 @@ class LDModelParser
|
|||||||
*
|
*
|
||||||
* LDraw.org Standards: Official Library Header Specification (http://www.ldraw.org/article/398.html)
|
* LDraw.org Standards: Official Library Header Specification (http://www.ldraw.org/article/398.html)
|
||||||
*
|
*
|
||||||
* @throws ErrorParsingLineException
|
* @param $string
|
||||||
*
|
|
||||||
* @return array
|
* @return array
|
||||||
|
* @throws ErrorParsingLineException
|
||||||
*/
|
*/
|
||||||
public function parse($string)
|
public function parse($string)
|
||||||
{
|
{
|
||||||
|
Loading…
x
Reference in New Issue
Block a user