diff --git a/app/Resources/views/part/detail.html.twig b/app/Resources/views/part/detail.html.twig
new file mode 100644
index 0000000..71b303a
--- /dev/null
+++ b/app/Resources/views/part/detail.html.twig
@@ -0,0 +1,66 @@
+{% extends 'base.html.twig' %}
+
+{% import 'macros/blocks.html.twig' as blocks %}
+
+{% block header %}{{ part.name }}{% endblock %}
+
+{% block content %}
+
+
+
+
+
+ {{ blocks.partImage(part.id,'part_large') }}
+
+
+
+
+
+
+ {{ 'part.id' | trans }} | {{ part.id}} |
+
+
+ {{ 'part.name' | trans }} | {{ part.name}} |
+
+
+ {{ 'part.category' | trans }} | {{ part.category ? part.category.name }} |
+
+
+ {{ 'part.model' | trans }} |
+
+ {% if part.model %}
+ {{ part.model.id }}
+ {% endif %}
+ |
+
+ {% if apiPart %}
+
+ {{ 'part.alternates' | trans }} |
+
+ {% for alternate in apiPart.alternates %}
+ {{ alternate }}
+ {% endfor %}
+ |
+
+
+ {{ 'part.molds' | trans }} |
+
+ {% for mold in apiPart.molds %}
+ {{ mold }}
+ {% endfor %}
+ |
+
+
+ |
+ Rebrickable |
+
+ {% endif %}
+
+
+
{{ 'model.empty'|trans }}
+
+
+
+
+
+{% endblock %}
diff --git a/app/Resources/views/rebrickable/part/detail.html.twig b/app/Resources/views/rebrickable/part/detail.html.twig
deleted file mode 100644
index de7056f..0000000
--- a/app/Resources/views/rebrickable/part/detail.html.twig
+++ /dev/null
@@ -1,81 +0,0 @@
-{% extends 'base.html.twig' %}
-
-{% import 'macros/blocks.html.twig' as blocks %}
-
-{% block header %}{{ part.name }}{% endblock %}
-
-{% block content %}
-
-
-
- {{ blocks.partImage(part.id,'part_large') }}
-
-
-
-
-
-
- {{ 'part.id' | trans }} | {{ part.id}} |
-
-
- {{ 'part.name' | trans }} | {{ part.name}} |
-
-
- {{ 'part.category' | trans }} | {{ part.category ? part.category.name }} |
-
-
- {{ 'part.model' | trans }} |
-
- {% if part.model %}
- {{ part.model.id }}
- {% endif %}
- |
-
- {% if apiPart %}
-
- {{ 'part.alternates' | trans }} |
-
- {% for alternate in apiPart.alternates %}
- {{ alternate }}
- {% endfor %}
- |
-
-
- {{ 'part.molds' | trans }} |
-
- {% for mold in apiPart.molds %}
- {{ mold }}
- {% endfor %}
- |
-
-
- {{ 'part.prints' | trans }} |
-
- {% for mold in apiPart.prints %}
- {{ mold }}
- {% endfor %}
- |
-
-
- |
- Rebrickable |
-
- {% endif %}
-
-
-
-
-
- {##}
- {##}
-
- {#
#}
- {#{% for set in sets %}#}
- {#{{ blocks.set(set) }}#}
- {#{% endfor %}#}
- {#
#}
- {#
#}
-
-{% endblock %}
diff --git a/src/AppBundle/Controller/Rebrickable/PartController.php b/src/AppBundle/Controller/PartController.php
similarity index 71%
rename from src/AppBundle/Controller/Rebrickable/PartController.php
rename to src/AppBundle/Controller/PartController.php
index 870b481..1a9e142 100644
--- a/src/AppBundle/Controller/Rebrickable/PartController.php
+++ b/src/AppBundle/Controller/PartController.php
@@ -1,6 +1,6 @@
getDoctrine()->getManager();
-
$apiPart = null;
-
if ($part) {
+ if($model = $part->getModel()) {
+ $this->redirectToRoute('model_detail',['id' => $model->getId()]);
+ }
+
try {
$apiPart = $this->get('api.manager.rebrickable')->getPart($part->getId());
} catch (EmptyResponseException $e) {
@@ -35,12 +36,9 @@ class PartController extends Controller
$this->addFlash('error', $e->getMessage());
}
- $sets = $part != null ? $em->getRepository(Set::class)->findAllByPartNumber($part->getId()) : null;
-
- return $this->render('rebrickable/part/detail.html.twig', [
+ return $this->render('part/detail.html.twig', [
'part' => $part,
'apiPart' => $apiPart,
- 'sets' => $sets,
]);
}