Commit bdfcf56f authored by Mindiell's avatar Mindiell
Browse files

Playing with contact list and random contact + 'sales pitch' is replaced with 'argumentation'

parent ed84b17a
...@@ -55,7 +55,7 @@ class Api { ...@@ -55,7 +55,7 @@ class Api {
// Asking for arguments by language // Asking for arguments by language
static function get_arguments($language='en') { static function get_arguments($language='en') {
$json = Api::get("campaigns/" . CAMPAIGN_ID . "/arguments/" . $language); $json = Api::get("campaigns/" . CAMPAIGN_ID . "/arguments");
return json_decode($json, true); return json_decode($json, true);
} }
......
...@@ -7,9 +7,11 @@ class Main extends Controller { ...@@ -7,9 +7,11 @@ class Main extends Controller {
*/ */
function home($f3,$args) { function home($f3,$args) {
// Select a random contact // Select a random contact
//TODO: use weight for random
$rand_id = rand(0, count($f3->get('contacts'))-1); $rand_id = rand(0, count($f3->get('contacts'))-1);
$contacts = $f3->get('contacts'); $contacts = $f3->get('contacts');
$f3->set('contact', $contacts[$rand_id]); $f3->set('contact', $contacts[$rand_id]);
$f3->set('random', rand(0, 2));
$f3->set('block_content','home.html'); $f3->set('block_content','home.html');
} }
...@@ -76,12 +78,16 @@ class Main extends Controller { ...@@ -76,12 +78,16 @@ class Main extends Controller {
function contactslist($f3, $args) { function contactslist($f3, $args) {
$contacts = Api::get_contacts(); $contacts = Api::get_contacts();
$f3->set('contacts', $contacts); $f3->set('contacts', $contacts);
$f3->set('random', 2);
$f3->set('block_content', 'contactslist.html'); $f3->set('block_content', 'contactslist.html');
} }
function salespitch($f3, $args) { function argumentation($f3, $args) {
$f3->set('block_content', 'salespitch.html'); $arguments = Api::get_arguments();
$f3->set('arguments', $arguments);
$f3->set('block_content', 'argumentation.html');
} }
}; };
...@@ -5,7 +5,7 @@ GET|POST @feedback:/feedback=Main->feedbackform ...@@ -5,7 +5,7 @@ GET|POST @feedback:/feedback=Main->feedbackform
GET|POST @call:/call/@id=Main->call GET|POST @call:/call/@id=Main->call
GET @contactslist:/contactslist=Main->contactslist GET @contactslist:/contactslist=Main->contactslist
POST @feedbacksip:/feedbacksip=Main->feedbacksip POST @feedbacksip:/feedbacksip=Main->feedbacksip
GET @salespitch:/salespitch=Main->salespitch GET @argumentation:/argumentation=Main->argumentation
; Fake REST API ; Fake REST API
GET /restapi/campaigns/@id=RestApi->campaign GET /restapi/campaigns/@id=RestApi->campaign
......
...@@ -93,7 +93,7 @@ padding: 0; ...@@ -93,7 +93,7 @@ padding: 0;
#toolbar li { #toolbar li {
display: inline-block; display: inline-block;
background-color: #ccc; background-color: #ccc;
padding: .5em; padding: .5em 1em;
} }
......
<section>
<repeat group="{{ @arguments }}" value="{{ @argument }}">
<h3>{{ @argument.title }}</h3>
<p>{{ @argument.text }}</p>
</repeat>
</section>
...@@ -4,7 +4,7 @@ ...@@ -4,7 +4,7 @@
<div class="col-sm-12"> <div class="col-sm-12">
<!-- image à gauche --> <!-- image à gauche -->
<div class="col-md-2 col-sm-4 hidden-xs"> <div class="col-md-2 col-sm-4 hidden-xs">
<img class= "img-responsive img-circle" src="http://www.europarl.europa.eu/mepphoto/0.jpg" width="140px" alt="mep"> <img class= "img-responsive img-circle" src="static/img/base{{ @random }}.jpg" width="140px" alt="mep">
<!-- infos --> <!-- infos -->
<div class="visible-sm-block"> <div class="visible-sm-block">
<address style="margin-top:1em;"> <address style="margin-top:1em;">
...@@ -30,7 +30,7 @@ ...@@ -30,7 +30,7 @@
<br class="visible-xs-block"> <br class="visible-xs-block">
<button type="button" class="btn btn-default" title="{{ _("Call now") }}" data-toggle="modal" data-target="#CallModal"><span class="glyphicon glyphicon-earphone"></span></button> <button type="button" class="btn btn-default" title="{{ _("Call now") }}" data-toggle="modal" data-target="#CallModal"><span class="glyphicon glyphicon-earphone"></span></button>
<a type="button" class="btn btn-info" title="{{ _("Get more info...") }}" href="https://memopol.lqdn.fr/europe/parliament/deputy/AmeliaAndersdotter/"><span class="glyphicon glyphicon-info-sign"></span></a> <a type="button" class="btn btn-info" title="{{ _("Get more info...") }}" href="#"><span class="glyphicon glyphicon-info-sign"></span></a>
<a type="button" class="btn btn-default visible-xs-inline-block" title="{{ _("Choose someone else") }}" href="#"><span class="glyphicon glyphicon-refresh"></span></a> <a type="button" class="btn btn-default visible-xs-inline-block" title="{{ _("Choose someone else") }}" href="#"><span class="glyphicon glyphicon-refresh"></span></a>
</p> </p>
</div> </div>
...@@ -44,7 +44,7 @@ ...@@ -44,7 +44,7 @@
<repeat group="{{ @contact.groups }}" value="{{ @group }}"> <repeat group="{{ @contact.groups }}" value="{{ @group }}">
<check if="{{ @group.type!='Committee' }}"> <check if="{{ @group.type!='Committee' }}">
<dt>{{ @group.type }}:</dt> <dt>{{ @group.type }}:</dt>
<dd><a href="https://memopol.lqdn.fr/europe/parliament/group/{{ @group.name }}/">{{ @group.name }}</a></dd> <dd><a href="#">{{ @group.name }}</a></dd>
</check> </check>
</repeat> </repeat>
</dl> </dl>
...@@ -80,10 +80,10 @@ ...@@ -80,10 +80,10 @@
<!-- random --> <!-- random -->
<div class="text-center"> <div class="text-center">
<form class="form-inline" role="form"> <form class="form-inline" role="form">
<div class="form-group hidden-xs"> <!-- <div class="form-group hidden-xs">
<label class="" for="country">Pays : </label> <label class="" for="country">Pays : </label>
<select class="form-control" name="country" id="country" onchange="$('#selcountry').submit()"><option value="">-- Toute l'Europe -- </select> <select class="form-control" name="country" id="country" onchange="$('#selcountry').submit()"><option value="">-- Toute l'Europe -- </select>
</div><!-- /form-group --> </div> --><!-- /form-group -->
<button type="submit" class="btn btn-default hidden-xs" title="Choisir un autre député"><span class="glyphicon glyphicon-refresh"></span></button> <button type="submit" class="btn btn-default hidden-xs" title="Choisir un autre député"><span class="glyphicon glyphicon-refresh"></span></button>
</form> </form>
</div> </div>
......
<!-- contacts list --> <!-- contacts list -->
<section id="contact_list"> <section id="contact_list">
<!--
TODO: Pagination des contacts
-->
<repeat group="{{ @contacts }}" value="{{ @contact }}"> <repeat group="{{ @contacts }}" value="{{ @contact }}">
<include href="contact.html" /> <include href="contact.html" />
</repeat> </repeat>
......
<section>
<p>{{ _("To do...") }}</p>
</section>
...@@ -3,7 +3,7 @@ ...@@ -3,7 +3,7 @@
<ul> <ul>
<li><a href="{{ @ALIASES.home }}">{{ _("Random Contact") }}</a></li> <li><a href="{{ @ALIASES.home }}">{{ _("Random Contact") }}</a></li>
<li><a href="{{ @ALIASES.contactslist }}">{{ _("Contacts list") }}</a></li> <li><a href="{{ @ALIASES.contactslist }}">{{ _("Contacts list") }}</a></li>
<li><a href="{{ @ALIASES.salespitch }}">{{ _("Sales pitch") }}</a></li> <li><a href="{{ @ALIASES.argumentation }}">{{ _("Argumentation") }}</a></li>
</ul> </ul>
</section> </section>
<!-- toolbar page --> <!-- toolbar page -->
Supports Markdown
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