Commit 11c151b4 authored by okhin's avatar okhin

Let's get group types

parent a2c99ff6
Pipeline #739 failed with stage
......@@ -47,6 +47,12 @@ class Api {
return json_decode($json, true);
}
// //Asking for complete list of group types
static function get_group_types() {
$json = Api::get("campaigns/" . CAMPAIGN_ID . "/grouptypes");
return json_decode($json, true);
}
// Asking for complete list of feedback categories
static function get_feedback_categories() {
$json = Api::get("campaigns/" . CAMPAIGN_ID . "/categories");
......
......@@ -16,6 +16,13 @@ class Main extends Controller {
//TODO: use weight for random
$rand_id = rand(0, count($f3->get('contacts'))-1);
$contacts = $f3->get('contacts');
$groups = Api::get_groups();
$f3->set('groups', $groups);
$group_types = Api::get_group_types();
$f3->set('group_types', $group_types);
$f3->set('contact', $contacts[$rand_id]);
$f3->set('random', rand(0, 2));
$f3->set('block_content', 'home.html');
......
......@@ -42,7 +42,7 @@
<div>
<dl class="dl-horizontal hidden-xs" id="resume">
<repeat group="{{ @contact.groups }}" value="{{ @group }}">
<check if="{{ @group.type!='Committee' }}">
<check if="{{ @group.type!='committee' }}">
<dt>{{ @group.type }}:</dt>
<dd><a href="#">{{ @group.name }}</a></dd>
</check>
......@@ -55,7 +55,7 @@
<div>
<ul class="list-inline" id="committee">
<repeat group="{{ @contact.groups }}" value="{{ @group }}">
<check if="{{ @group.type=='Committee' }}">
<check if="{{ @group.type=='committee' }}">
<li><abbr title="{{ @group.name }}" class="initialism"><ahref="https://memopol.lqdn.fr/europe/parliament/committee/{{ @group.name }}/"><div class="well well-sm">{{ @group.name }}</div></a></abbr></li>
</check>
</repeat>
......@@ -90,7 +90,6 @@
<!-- /random -->
</div>
<!-- /droite -->
</div>
<!-- /row-->
</div>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment