Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 1 addition & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
4 changes: 3 additions & 1 deletion assets/css/app.scss
Original file line number Diff line number Diff line change
@@ -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";
Expand Down
2 changes: 2 additions & 0 deletions config/routes.yaml
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
#index:
# path: /
# controller: App\Controller\DefaultController::index


181 changes: 181 additions & 0 deletions public/students.json
Original file line number Diff line number Diff line change
@@ -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"
]
},
"hack<b>er</b>'is po .mySubdomain &project=123": {
"name": "' OR 1 -- DROP DATABASE",
"mentors": [
"<b>Ponas</b> Programišius"
],
"students": [
"Aurelijus",
"<b>Ir</b> jo \"geras\" draug'as"
]
}
}
11 changes: 9 additions & 2 deletions src/Controller/HomeController.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,17 +3,24 @@
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;

class HomeController extends AbstractController
{
/**
* @Route("/", name="home")
* @param KernelInterface $request
* @return Response
*/
public function index()
public function index(KernelInterface $request)
Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍 Šaunu, kad naudoji KernelInterface – tada ramiau galima judinti PHP failus tarp skirtingų katalogų

{
$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,
]);
}
}
26 changes: 26 additions & 0 deletions src/Controller/StudentController.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
<?php

namespace App\Controller;

use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\HttpFoundation\Response;
use Symfony\Component\Routing\Annotation\Route;

class StudentController extends AbstractController
{
/**
* @Route("/student", name="student")
* @param Request $request
* @return Response
*/
public function index(Request $request): Response
{
$name = $request->get('name');
$project = $request->get('project');
return $this->render('student/index.html.twig', [
'name' => $name,
'project' => $project
]);
}
}
55 changes: 52 additions & 3 deletions templates/home/index.html.twig
Original file line number Diff line number Diff line change
@@ -1,7 +1,56 @@
{% extends 'base.html.twig' %}

{% block title %}{{ someVariable }}{% endblock %}
{% block title %}Projektai{% endblock %}

{% block body %}
<div class="nfq-academy">{{ someVariable }}</div>
{% endblock %}
<ul class="list-group m-4">
<li class="list-group-item list-group-item-info">Studentai</li>
{% for key, team in data %}
{% for student in team.students %}
<li class="list-group-item">
<a href="{{ path('student', {name: student, project: key})|escape }}">{{ student }}</a>
Copy link
Owner Author

@aurelijusb aurelijusb Dec 3, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Symfony'je Twig'as standartinškai yra įjungęs autoescape

Suggested change
<a href="{{ path('student', {name: student, project: key})|escape }}">{{ student }}</a>
<a href="{{ path('student', {name: student, project: key}) }}">{{ student }}</a>

(
<span class="badge">Mentorius</span> {{ team.mentors[0] }}
)
</li>
{% endfor %}
{% endfor %}
</ul>

<div class="m-4">
<form action="/student" method="get">
Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reikėtų įprasti visur naudoti path. Nes ateityje bus sunku visus hard-coded variantus sugaudyti

<div class="input-group">
<input name="name" type="text" class="form-control" placeholder="Studentas"/>
</div>
<div class="input-group">
<input name="project" type="text" class="form-control" placeholder="Projektas"/>
</div>
<button type="submit" class="btn btn-success">Sužinoti vertinimą</button>
</form>
</div>

<ul class="list-group m-4">
<li class="list-group-item list-group-item-info">Projektai</li>
{% for key, team in data %}
<li class="list-group-item">
<h3>{{ team.name }}</h3>
<div class="panel panel-default">
<div>
<a target="_blank" href=https://github.com/nfqakademija/{{ key|url_encode}}">github.com/nfqakademija/{{ key }}</a>
<span class="badge">GitHub</span>
</div>
<div>
<a target="_blank" href="http://{{ key|url_encode }}.projektai.nfqakademija.lt/">{{ key }}.projektai.nfqakademija.lt/</a>
<span class="badge">Web</span>
</div>
<div>
<pre>ssh {{ key }}@deploy.nfqakademija.lt -p 2222</pre>
</div>
</div>
</li>
{% endfor %}
</ul>
<div class="m-4">
<a class="text-light" href="students.json">Duomenų failas</a>
</div>
{% endblock %}
33 changes: 33 additions & 0 deletions templates/student/index.html.twig
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
{% extends 'base.html.twig' %}

{% block title %}Vertinimas{% endblock %}

{% block body %}
<div class="bg-light m-4">
<table class="table">
<tbody>
<tr>
<th scope="row">Projektas</th>
<th scope="row">Studentas</th>
</tr>
<tr>
<td>{{ project }}</td>
<td>{{ name }}</td>
</tr>
</tbody>
</table>
{% if name == 'Dominykas' %}
<div class="alert alert-success" role="alert">
Dešimt balų
</div>
{% else %}
<div class="alert alert-warning" role="alert">
Gal pasiseks kitą kartą
</div>
{% endif %}
</div>

<div class="m-4">
<a class="text-light" href="{{ path('home') }}">Visi studentai</a>
</div>
{% endblock %}