mirror of
https://github.com/ToxicCrack/PrintABrick.git
synced 2025-05-18 21:20:09 -07:00
Update controllers
This commit is contained in:
parent
a6a8f9cd8c
commit
3bd04a3b94
5
app/Resources/assets/js/style.js
Normal file
5
app/Resources/assets/js/style.js
Normal file
@ -0,0 +1,5 @@
|
||||
$(document).ready(function () {
|
||||
$('.ui.dropdown')
|
||||
.dropdown()
|
||||
;
|
||||
});
|
0
app/Resources/assets/style/_variables.scss
Normal file
0
app/Resources/assets/style/_variables.scss
Normal file
3
app/Resources/assets/style/main.scss
Normal file
3
app/Resources/assets/style/main.scss
Normal file
@ -0,0 +1,3 @@
|
||||
.ui.fixed + .ui.main {
|
||||
margin-top: 5em;
|
||||
}
|
4
app/Resources/assets/style/style.scss
Normal file
4
app/Resources/assets/style/style.scss
Normal file
@ -0,0 +1,4 @@
|
||||
@import "variables";
|
||||
|
||||
@import "main";
|
||||
|
@ -1,6 +1,6 @@
|
||||
{% extends 'base.html.twig' %}
|
||||
|
||||
{% block body %}
|
||||
{% block content %}
|
||||
|
||||
{% endblock %}
|
||||
|
||||
|
@ -1,20 +1,31 @@
|
||||
{% extends 'base.html.twig' %}
|
||||
|
||||
{% block body %}
|
||||
{% block content %}
|
||||
|
||||
{{ form_start(form) }}
|
||||
<div class="three fields">
|
||||
<div class="four fields">
|
||||
{{ form_row(form.theme) }}
|
||||
{{ form_row(form.subtheme) }}
|
||||
{{ form_row(form.years) }}
|
||||
<div class="field">
|
||||
<label>submit</label>
|
||||
<input type="submit" class="ui button">
|
||||
</div>
|
||||
</div>
|
||||
{{ form_end(form) }}
|
||||
|
||||
<ul>
|
||||
{% for set in sets %}
|
||||
<li><a href="{{ url('set_detail', {'id': set.number~'-'~set.numberVariant, 'name' : set.name|escape('url') }) }}">{{ set.LegoSetID }} - {{ set.name }}</a></li>
|
||||
{% endfor %}
|
||||
</ul>
|
||||
<div class="ui seven column grid">
|
||||
<div class="row">
|
||||
{% for set in sets %}
|
||||
<div class="column">
|
||||
<a href="{{ url('set_detail', {'number': set.number~'-'~set.numberVariant, 'name' : set.name|escape('url') }) }}">
|
||||
<img style="width: 100%" src="{{ set.largeThumbnailURL }}">
|
||||
<p>{{ set.LegoSetID }} - {{ set.name }}</p>
|
||||
</a>
|
||||
</div>
|
||||
{% endfor %}
|
||||
</div>
|
||||
</div>
|
||||
{% endblock %}
|
||||
|
||||
{% block javascripts %}
|
||||
|
@ -1,27 +1,27 @@
|
||||
{% extends 'base.html.twig' %}
|
||||
|
||||
{% block body %}
|
||||
{% block content %}
|
||||
|
||||
{{ dump(set) }}
|
||||
{{ dump(brset) }}
|
||||
|
||||
<h1>{{ brset.name }}</h1>
|
||||
<img src="{{ brset.imageURL }}">
|
||||
<h1>{{brset ? brset.name }}</h1>
|
||||
<img src="{{brset ? brset.imageURL }}">
|
||||
|
||||
{% if set is not null %}
|
||||
{% for inventory in set.inventories %}
|
||||
{#{% for inventory in set.inventories %}#}
|
||||
<h2>Parts</h2>
|
||||
<div style="display: flex; flex-wrap: wrap">
|
||||
{% for inventoryPart in inventory.inventoryParts %}
|
||||
{% for inventoryPart in inventoryParts %}
|
||||
<div style="height: 150px; width: 150px; padding: 5px; display: inline-block">
|
||||
<img src="https://rebrickable.com/media/parts/ldraw/{{ inventoryPart.color.id }}/{{ inventoryPart.part.id }}.png" style="max-height: 90%; max-width: 100%">
|
||||
<p><a style="color: #{{ inventoryPart.color.rgb }}" href="{{ url('part_detail', {id:inventoryPart.part.id}) }}"><strong>{{ inventoryPart.part.id }}</strong> {{ inventoryPart.quantity }}</a></p>
|
||||
<img src="https://rebrickable.com/media/parts/ldraw/{{inventoryPart ? inventoryPart.color.id }}/{{ inventoryPart.part.number }}.png" style="max-height: 90%; max-width: 100%">
|
||||
<p><a style="color: #{{ inventoryPart.color.rgb }}" href="{{ url('ldraw_part_show', {number:inventoryPart.part.number}) }}"><strong>{{ inventoryPart.part.number }}</strong> {{ inventoryPart.quantity }}</a></p>
|
||||
</div>
|
||||
{% endfor %}
|
||||
<div>
|
||||
{% else %}
|
||||
{#{% else %}#}
|
||||
|
||||
{% endfor %}
|
||||
{#{% endfor %}#}
|
||||
{% endif %}
|
||||
|
||||
{% endblock %}
|
@ -73,12 +73,9 @@ swiftmailer:
|
||||
spool: { type: memory }
|
||||
|
||||
knp_menu:
|
||||
# use "twig: false" to disable the Twig extension and the TwigRenderer
|
||||
twig:
|
||||
template: KnpMenuBundle::menu.html.twig
|
||||
# if true, enables the helper for PHP templates
|
||||
template: menu/knp_menu.html.twig
|
||||
templating: false
|
||||
# the renderer to use, list is also available by default
|
||||
default_renderer: twig
|
||||
|
||||
knp_paginator:
|
||||
@ -89,7 +86,7 @@ knp_paginator:
|
||||
sort_direction_name: direction # sort direction query parameter name
|
||||
distinct: true # ensure distinct results, useful when ORM queries are using GROUP BY statements
|
||||
template:
|
||||
pagination: KnpPaginatorBundle:Pagination:sliding.html.twig # sliding pagination controls template
|
||||
pagination: KnpPaginatorBundle:Pagination:semantic_ui_pagination.html.twig # sliding pagination controls template
|
||||
sortable: KnpPaginatorBundle:Pagination:sortable_link.html.twig # sort link template
|
||||
|
||||
oneup_flysystem:
|
||||
|
@ -32,7 +32,7 @@ class MediaController extends Controller
|
||||
// Create the disposition of the file
|
||||
$disposition = $response->headers->makeDisposition(
|
||||
ResponseHeaderBag::DISPOSITION_ATTACHMENT,
|
||||
$model->getId().'.stl'
|
||||
$model->getNumber().'.stl'
|
||||
);
|
||||
|
||||
$response->headers->set('Content-Disposition', $disposition);
|
||||
@ -43,7 +43,7 @@ class MediaController extends Controller
|
||||
}
|
||||
|
||||
/**
|
||||
* @Route("/part/{id}", name="part_image")
|
||||
* @Route("/part/{number}", name="part_image")
|
||||
*
|
||||
* @return Response
|
||||
*/
|
||||
@ -51,20 +51,20 @@ class MediaController extends Controller
|
||||
{
|
||||
$mediaFilesystem = $this->get('oneup_flysystem.media_filesystem');
|
||||
|
||||
if ($mediaFilesystem->has('ldraw'.DIRECTORY_SEPARATOR.'images'.DIRECTORY_SEPARATOR.$part->getId().'.png')) {
|
||||
$response = new BinaryFileResponse($mediaFilesystem->getAdapter()->getPathPrefix().DIRECTORY_SEPARATOR.'ldraw'.DIRECTORY_SEPARATOR.'images'.DIRECTORY_SEPARATOR.$part->getId().'.png');
|
||||
if ($mediaFilesystem->has('ldraw'.DIRECTORY_SEPARATOR.'images'.DIRECTORY_SEPARATOR.$part->getNumber().'.png')) {
|
||||
$response = new BinaryFileResponse($mediaFilesystem->getAdapter()->getPathPrefix().DIRECTORY_SEPARATOR.'ldraw'.DIRECTORY_SEPARATOR.'images'.DIRECTORY_SEPARATOR.$part->getNumber().'.png');
|
||||
$response->headers->set('Content-Type', 'image/png');
|
||||
|
||||
// Create the disposition of the file
|
||||
$disposition = $response->headers->makeDisposition(
|
||||
ResponseHeaderBag::DISPOSITION_ATTACHMENT,
|
||||
$part->getId().'png'
|
||||
$part->getNumber().'png'
|
||||
);
|
||||
|
||||
$response->headers->set('Content-Disposition', $disposition);
|
||||
|
||||
return $response;
|
||||
}
|
||||
throw new FileNotFoundException($part->getId().'png');
|
||||
throw new FileNotFoundException($part->getNumber().'png');
|
||||
}
|
||||
}
|
||||
|
@ -2,7 +2,11 @@
|
||||
|
||||
namespace AppBundle\Controller;
|
||||
|
||||
use AppBundle\Entity\Rebrickable\Color;
|
||||
use AppBundle\Entity\Rebrickable\Inventory_Part;
|
||||
use AppBundle\Entity\Rebrickable\Part;
|
||||
use AppBundle\Entity\Rebrickable\Set;
|
||||
use AppBundle\Entity\Rebrickable\Theme;
|
||||
use AppBundle\Form\FilterSetType;
|
||||
use Sensio\Bundle\FrameworkExtraBundle\Configuration\Route;
|
||||
use Symfony\Bundle\FrameworkBundle\Controller\Controller;
|
||||
@ -40,17 +44,25 @@ class SetController extends Controller
|
||||
}
|
||||
|
||||
/**
|
||||
* @Route("/detail/{id}_{name}", name="set_detail")
|
||||
* @Route("/detail/{number}_{name}", name="set_detail")
|
||||
*/
|
||||
public function detailAction(Request $request, $id, $name = null)
|
||||
public function detailAction(Request $request, $number, $name = null)
|
||||
{
|
||||
$brset = $this->get('manager.brickset')->getSetByNumber($id);
|
||||
$brset = $this->get('manager.brickset')->getSetByNumber($number);
|
||||
|
||||
$set = $this->get('doctrine.orm.default_entity_manager')->getRepository(Set::class)->find($id);
|
||||
$set = $this->get('doctrine.orm.default_entity_manager')->getRepository(Set::class)->find($number);
|
||||
|
||||
$em = $this->getDoctrine()->getManager();
|
||||
|
||||
$em->getRepository(Color::class)->findAll();
|
||||
|
||||
$em->getRepository(Theme::class)->findAll();
|
||||
|
||||
return $this->render('set/detail.html.twig', [
|
||||
'set' => $set,
|
||||
'brset' => $brset,
|
||||
'parts' => $em->getRepository(Part::class)->findAllBySetNumber($number),
|
||||
'inventoryParts' => $em->getRepository(Inventory_Part::class)->findAllBySetNumber($number),
|
||||
]);
|
||||
}
|
||||
}
|
||||
|
@ -8,7 +8,6 @@ use AppBundle\Api\Client\Brickset\Entity\Year;
|
||||
use AppBundle\Api\Manager\BricksetManager;
|
||||
use Symfony\Component\Form\AbstractType;
|
||||
use Symfony\Component\Form\Extension\Core\Type\ChoiceType;
|
||||
use Symfony\Component\Form\Extension\Core\Type\SubmitType;
|
||||
use Symfony\Component\Form\Form;
|
||||
use Symfony\Component\Form\FormBuilderInterface;
|
||||
use Symfony\Component\Form\FormEvent;
|
||||
@ -74,7 +73,5 @@ class FilterSetType extends AbstractType
|
||||
$formModifier($event->getForm()->getParent(), $theme);
|
||||
}
|
||||
);
|
||||
|
||||
$builder->add('submit', SubmitType::class);
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user