From 1c95a87632ea0031b82571e2f67c696bd6b8a9a5 Mon Sep 17 00:00:00 2001 From: Aurelijus Banelis Date: Sun, 10 Nov 2019 20:30:53 +0200 Subject: [PATCH 1/6] Fix documentation: GitHub actions instead of TravisCI --- README.md | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/README.md b/README.md index 92eb535f2..86d5cadc7 100644 --- a/README.md +++ b/README.md @@ -13,8 +13,7 @@ visais reikalingais failais ir įrankiais darbui: - Paprastas pavyzdys (Controller, Template, CSS) - Įdiegtas bootstrap - Asset'ų buildinimas (encore, yarn, sass) -- Travis CI template - +- GitHub actions (CI) pavyzdys # Paleidimo instrukcija From 958c805d7a0f738d84331d755b501954688ac3aa Mon Sep 17 00:00:00 2001 From: Dominykas Date: Wed, 13 Nov 2019 10:19:54 +0200 Subject: [PATCH 2/6] Data fetched from json & displayed on twig --- public/students.json | 181 ++++++++++++++++++++++++++++++ src/Controller/HomeController.php | 10 +- templates/home/index.html.twig | 55 ++++++++- 3 files changed, 241 insertions(+), 5 deletions(-) create mode 100644 public/students.json diff --git a/public/students.json b/public/students.json new file mode 100644 index 000000000..c06cff4d5 --- /dev/null +++ b/public/students.json @@ -0,0 +1,181 @@ +{ + "team1": { + "name": "Team1", + "mentors": [ + "Mantas" + ], + "students": [ + "Tadas", + "Gytis", + "Ričardas" + ] + }, + "baltichalatai": { + "name": "BaltiChalatai", + "mentors": [ + "Lukas" + ], + "students": [ + "Vytas", + "Lukas", + "Diana" + ] + }, + "nnizer": { + "name": "ePacientas", + "mentors": [ + "Tadas" + ], + "students": [ + "Kornelijus", + "Dominykas", + "Miglė" + ] + }, + "activegen": { + "name": "ActiveGen", + "mentors": [ + "Arnoldas" + ], + "students": [ + "Andrius", + "Nojus", + "Martynas", + "Edvinas" + ] + }, + "mms": { + "name": "Membership-management-system", + "mentors": [ + "Mindaugas" + ], + "students": [ + "Erika", + "Rokas", + "Valentinas", + "Eligijus" + ] + }, + "pamainos": { + "name": "NFQ pamainu sistema", + "mentors": [ + "Paulius" + ], + "students": [ + "Liudas", + "Justina", + "Andrius" + ] + }, + "receptai": { + "name": "Receptai", + "mentors": [ + "Mantas" + ], + "students": [ + "Arnoldas", + "Arentas", + "Tautvydas" + ] + }, + "pulse": { + "name": "NFQ pulse", + "mentors": [ + "Lorenas" + ], + "students": [ + "Arvydas", + "Titas", + "Kristijonas", + "Andrius" + ] + }, + "lita": { + "name": "NFQ Petro atrankos problema akademijai", + "mentors": [ + "Paulius" + ], + "students": [ + "Kristina", + "Indrė", + "Dmitri" + ] + }, + "myfleet": { + "name": "MyFleet", + "mentors": [ + "Laurynas" + ], + "students": [ + "Artūras", + "Ignas", + "Jonas" + ] + }, + "career": { + "name": "NFQ Career Criteria Assessment", + "mentors": [ + "Erikas" + ], + "students": [ + "Matas", + "Andrius", + "Ainis" + ] + }, + "carparking": { + "name": "NFQ Car parking", + "mentors": [ + "Andrejus" + ], + "students": [ + "Kęstas", + "Lukas", + "Lukas" + ] + }, + "podcast": { + "name": "Krepšinio podcastai", + "mentors": [ + "Eligijus" + ], + "students": [ + "Edvardas", + "Nerijus", + "Kazimieras" + ] + }, + "Barakas": { + "name": "barakas", + "mentors": [ + "Armandas" + ], + "students": [ + "Raimondas", + "Mantas", + "Tomas" + ] + }, + "devcollab": { + "name": "Education sharing platform", + "mentors": [ + "Viktoras" + ], + "students": [ + "Karolis", + "Arnas", + "Evaldas", + "Algirdas" + ] + }, + "hacker'is po .mySubdomain &project=123": { + "name": "' OR 1 -- DROP DATABASE", + "mentors": [ + "Ponas Programišius" + ], + "students": [ + "Aurelijus", + "Ir jo \"geras\" draug'as" + ] + } +} \ No newline at end of file diff --git a/src/Controller/HomeController.php b/src/Controller/HomeController.php index 90484f11f..f257c4513 100644 --- a/src/Controller/HomeController.php +++ b/src/Controller/HomeController.php @@ -3,17 +3,23 @@ namespace App\Controller; use Symfony\Bundle\FrameworkBundle\Controller\AbstractController; +use Symfony\Component\HttpKernel\KernelInterface; use Symfony\Component\Routing\Annotation\Route; class HomeController extends AbstractController { /** * @Route("/", name="home") + * @param KernelInterface $request + * @return \Symfony\Component\HttpFoundation\Response */ - public function index() + public function index(KernelInterface $request) { + $file = file_get_contents($request->getProjectDir() . '/public/students.json'); + $data = json_decode($file, true); + return $this->render('home/index.html.twig', [ - 'someVariable' => 'NFQ Akademija', + 'data' => $data, ]); } } diff --git a/templates/home/index.html.twig b/templates/home/index.html.twig index b1bd0115c..7c999f0b3 100644 --- a/templates/home/index.html.twig +++ b/templates/home/index.html.twig @@ -1,7 +1,56 @@ {% extends 'base.html.twig' %} -{% block title %}{{ someVariable }}{% endblock %} +{% block title %}Projektai{% endblock %} {% block body %} -
{{ someVariable }}
-{% endblock %} + + +
+
+
+ +
+
+ +
+ +
+
+ + + +{% endblock %} \ No newline at end of file From ab68d33d145968ebd863a9c1d3474b2b8901f99e Mon Sep 17 00:00:00 2001 From: Dominykas Date: Wed, 13 Nov 2019 13:19:42 +0200 Subject: [PATCH 3/6] Added student controller & paths on twig --- src/Controller/HomeController.php | 3 ++- src/Controller/StudentController.php | 27 +++++++++++++++++++++++ templates/home/index.html.twig | 8 +++---- templates/student/index.html.twig | 33 ++++++++++++++++++++++++++++ 4 files changed, 66 insertions(+), 5 deletions(-) create mode 100644 src/Controller/StudentController.php create mode 100644 templates/student/index.html.twig diff --git a/src/Controller/HomeController.php b/src/Controller/HomeController.php index f257c4513..01a673317 100644 --- a/src/Controller/HomeController.php +++ b/src/Controller/HomeController.php @@ -3,6 +3,7 @@ namespace App\Controller; use Symfony\Bundle\FrameworkBundle\Controller\AbstractController; +use Symfony\Component\HttpFoundation\Response; use Symfony\Component\HttpKernel\KernelInterface; use Symfony\Component\Routing\Annotation\Route; @@ -11,7 +12,7 @@ class HomeController extends AbstractController /** * @Route("/", name="home") * @param KernelInterface $request - * @return \Symfony\Component\HttpFoundation\Response + * @return Response */ public function index(KernelInterface $request) { diff --git a/src/Controller/StudentController.php b/src/Controller/StudentController.php new file mode 100644 index 000000000..f22505b73 --- /dev/null +++ b/src/Controller/StudentController.php @@ -0,0 +1,27 @@ +get('name'); + $project = $request->get('project'); + return $this->render('student/index.html.twig', [ + 'name' => $name, + 'project' => $project, + 'isChosen' => $name === "Dominykas" ? true : false, + ]); + } +} diff --git a/templates/home/index.html.twig b/templates/home/index.html.twig index 7c999f0b3..360bf9194 100644 --- a/templates/home/index.html.twig +++ b/templates/home/index.html.twig @@ -5,10 +5,10 @@ {% block body %}
  • Studentai
  • - {% for team in data %} + {% for key, team in data %} {% for student in team.students %}
  • - {{ student }} + {{ student }} ( Mentorius {{ team.mentors[0] }} ) @@ -36,11 +36,11 @@

    {{ team.name }}

    diff --git a/templates/student/index.html.twig b/templates/student/index.html.twig new file mode 100644 index 000000000..ede222d4c --- /dev/null +++ b/templates/student/index.html.twig @@ -0,0 +1,33 @@ +{% extends 'base.html.twig' %} + +{% block title %}Vertinimas{% endblock %} + +{% block body %} +
    + + + + + + + + + + + +
    ProjektasStudentas
    {{ project }}{{ name }}
    + {% if isChosen %} + + {% else %} + + {% endif %} +
    + + +{% endblock %} From cafcedc3207311cbc66227ca08b141030beea15a Mon Sep 17 00:00:00 2001 From: Dominykas Date: Wed, 13 Nov 2019 13:34:45 +0200 Subject: [PATCH 4/6] SASS update --- assets/css/app.scss | 4 +++- templates/home/index.html.twig | 4 ++-- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/assets/css/app.scss b/assets/css/app.scss index f955fad8f..8e938974b 100644 --- a/assets/css/app.scss +++ b/assets/css/app.scss @@ -1,5 +1,7 @@ // customize some Bootstrap variables -$primary: darken(#428bca, 20%); + +$body-bg: #ff6b00; +$link-color: #245682; // the ~ allows you to reference things in node_modules @import "~bootstrap/scss/bootstrap"; diff --git a/templates/home/index.html.twig b/templates/home/index.html.twig index 360bf9194..17e2e991f 100644 --- a/templates/home/index.html.twig +++ b/templates/home/index.html.twig @@ -36,7 +36,7 @@

    {{ team.name }}

{% endblock %} \ No newline at end of file From 5de997a1ecda27800eb4dd96d6df85a8d9bc8d25 Mon Sep 17 00:00:00 2001 From: Dominykas Date: Wed, 13 Nov 2019 13:45:04 +0200 Subject: [PATCH 5/6] Moved name check from Controller to Twig --- src/Controller/StudentController.php | 3 +-- templates/student/index.html.twig | 2 +- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/src/Controller/StudentController.php b/src/Controller/StudentController.php index f22505b73..0b67e79b0 100644 --- a/src/Controller/StudentController.php +++ b/src/Controller/StudentController.php @@ -20,8 +20,7 @@ public function index(Request $request): Response $project = $request->get('project'); return $this->render('student/index.html.twig', [ 'name' => $name, - 'project' => $project, - 'isChosen' => $name === "Dominykas" ? true : false, + 'project' => $project ]); } } diff --git a/templates/student/index.html.twig b/templates/student/index.html.twig index ede222d4c..e3238ab0e 100644 --- a/templates/student/index.html.twig +++ b/templates/student/index.html.twig @@ -16,7 +16,7 @@ - {% if isChosen %} + {% if name == 'Dominykas' %} From f457bda2b942c5131e9444a12280fd2d71ec3f1e Mon Sep 17 00:00:00 2001 From: Dominykas Date: Wed, 13 Nov 2019 14:34:14 +0200 Subject: [PATCH 6/6] URL encoding --- config/routes.yaml | 2 ++ templates/home/index.html.twig | 6 +++--- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/config/routes.yaml b/config/routes.yaml index c3283aa2e..cc33a3440 100644 --- a/config/routes.yaml +++ b/config/routes.yaml @@ -1,3 +1,5 @@ #index: # path: / # controller: App\Controller\DefaultController::index + + diff --git a/templates/home/index.html.twig b/templates/home/index.html.twig index 17e2e991f..a401a1254 100644 --- a/templates/home/index.html.twig +++ b/templates/home/index.html.twig @@ -36,11 +36,11 @@

{{ team.name }}