Commit e2909f46 authored by Marc-Antoine Dupré's avatar Marc-Antoine Dupré
Browse files

Ajustements sur page détail campagne

parent de5e6891
...@@ -2,19 +2,6 @@ ...@@ -2,19 +2,6 @@
/* main color = #f2e732 */ /* main color = #f2e732 */
/* secondary color = #2c3e50 */ /* secondary color = #2c3e50 */
/*.campaign img {
display: inline-block;
width: 40%;
vertical-align: center;
}*/
/*.campaign .description {
width: 55%;
display: inline-block;
padding: 0;
}*/
#social-header{ #social-header{
display:none; display:none;
} }
...@@ -23,32 +10,25 @@ ...@@ -23,32 +10,25 @@
min-height:unset; min-height:unset;
} }
.campaign .fin-progress { .campaign-detail .campaign-progress {
display: inline-block; display: inline-block;
width: 100%; width: 100%;
padding: 1em;
}
.campaign .fin-progress > div {
margin-bottom: 0.8em;
}
.campaign .fin-progress > div:nth-of-type(1) {
display: flex;
}
.campaign .fin-progress > div:nth-of-type(1) > * {
flex: 1;
} }
.campaign .fin-progress .progress { .campaign-detail .progress {
margin: 0.5em 0;
border: solid 2px #2c3e50; border: solid 2px #2c3e50;
} }
.campaign .fin-progress .donations { .campaign-detail .donation-bar,
background-color: #f2e732; .campaign-detail .donation-label {
background-color: #ffc600;
color: #333333;
} }
.campaign .fin-progress .pledges { /* Counters a minimum width for low/empty progress bar defined in Bootstrap. */
background-color: #2c3e50; .campaign-detail .progress-bar[aria-valuenow="0"],
.campaign-detail .progress-bar[aria-valuenow="1"],
.campaign-detail .progress-bar[aria-valuenow="2"] {
min-width: 0
} }
...@@ -7,6 +7,8 @@ $rest_txt = (string)$rest . $currency_symbol; ...@@ -7,6 +7,8 @@ $rest_txt = (string)$rest . $currency_symbol;
$donations_txt = (string)$camp["donationNumber"] . $currency_symbol; $donations_txt = (string)$camp["donationNumber"] . $currency_symbol;
$pledges_txt = (string)$camp["pledgeNumber"] . $currency_symbol; $pledges_txt = (string)$camp["pledgeNumber"] . $currency_symbol;
$requested_text = (string)$camp["goal"] . $currency_symbol; $requested_text = (string)$camp["goal"] . $currency_symbol;
// Compute progress percentages
$donations_perc = round($camp["donationNumber"] / $camp["goal"] * 100); $donations_perc = round($camp["donationNumber"] / $camp["goal"] * 100);
$pledges_perc = ""; $pledges_perc = "";
if ($rest <= 0) { if ($rest <= 0) {
...@@ -14,24 +16,39 @@ if ($rest <= 0) { ...@@ -14,24 +16,39 @@ if ($rest <= 0) {
} else { } else {
$pledges_perc = round($camp["pledgeNumber"] / $camp["goal"] * 100); $pledges_perc = round($camp["pledgeNumber"] / $camp["goal"] * 100);
} }
// Clamp progress percentages
$min_perc = 2;
if ($donations_perc <= $min_perc) {
$donations_perc = $min_perc;
$pledges_perc = min($pledges_perc, 100 - $min_perc);
}
if ($pledges_perc <= $min_perc) {
$pledges_perc = $min_perc;
$donations_perc = min($donations_perc, 100 - $min_perc);
}
$donations_perc_txt = (string)$donations_perc; $donations_perc_txt = (string)$donations_perc;
$pledges_perc_txt = (string)$pledges_perc; $pledges_perc_txt = (string)$pledges_perc;
$eltId=key($element['parent']); $eltId=key($element['parent']);
$eltType= $element['parent'][$eltId]['type']; $eltType= $element['parent'][$eltId]['type'];
$eltName= $element['parent'][$eltId]['name']; $eltName= $element['parent'][$eltId]['name'];
?> ?>
<div class="campaign"> <div class="campaign-detail container">
<h1><?php echo $element["name"]?><br> <div class="row">
<small><?php echo $camp["nameCamp"]?></small> <div class="col-xs-12">
<span style="font-size:50%;text-transform: none;">Porté par <h1><?php echo $element["name"]?><br>
<a href="#page.type.<?php echo $eltType ?>.id.<?php echo $eltId ?>" <small><?php echo $camp["nameCamp"]?></small>
class="lbh" target="_blank"><?php echo $eltName ?></a> <span style="font-size:50%;text-transform: none;">Porté par
</span> <a href="#page.type.<?php echo $eltType ?>.id.<?php echo $eltId ?>"
</h1> class="lbh" target="_blank"><?php echo $eltName ?></a>
<div> </span>
</h1>
</div>
</div>
<div class="row">
<img class="img-responsive col-xs-12 col-sm-6 col-md-4" src="<?php echo $element["profilMediumImageUrl"]?>"> <img class="img-responsive col-xs-12 col-sm-6 col-md-4" src="<?php echo $element["profilMediumImageUrl"]?>">
<div class="description col-xs-12 col-sm-6 col-md-8"> <div class="description col-xs-12 col-sm-6 col-md-8">
<h2>Description de l'action</h2> <h2>Description de l'action</h2>
...@@ -39,23 +56,23 @@ $eltName= $element['parent'][$eltId]['name']; ...@@ -39,23 +56,23 @@ $eltName= $element['parent'][$eltId]['name'];
#description-de-la-campagne#//#description-de-la-campagne#//#description-de-la-campagne#// #description-de-la-campagne#//#description-de-la-campagne#//#description-de-la-campagne#//
#description-de-la-campagne#//#description-de-la-campagne#//#description-de-la-campagne#// #description-de-la-campagne#//#description-de-la-campagne#//#description-de-la-campagne#//
#description-de-la-campagne#//#description-de-la-campagne#//#description-de-la-campagne#</p> #description-de-la-campagne#//#description-de-la-campagne#//#description-de-la-campagne#</p>
<div class="fin-progress"> <div class="campaign-progress">
<div> <div class="text-right">
<strong>Dons : <?php echo $donations_txt ?></strong>
<strong>Reste à financer : <?php echo $rest_txt ?> / <?php echo $requested_text ?></strong> <strong>Reste à financer : <?php echo $rest_txt ?> / <?php echo $requested_text ?></strong>
</div> </div>
<div class="progress"> <div class="progress">
<div class="progress-bar donations" role="progressbar" <div class="progress-bar donation-bar" role="progressbar"
style="width: <?php echo $donations_perc_txt ?>%" style="width: <?php echo $donations_perc_txt ?>%"
aria-valuenow="<?php echo $donations_perc_txt ?>" aria-valuenow="<?php echo $donations_perc_txt ?>"
aria-valuemin="0" aria-valuemax="100"></div> aria-valuemin="0" aria-valuemax="100"></div>
<div class="progress-bar pledges" role="progressbar" <div class="progress-bar pledge-bar" role="progressbar"
style="width: <?php echo $pledges_perc_txt?>%" style="width: <?php echo $pledges_perc_txt?>%"
aria-valuenow="<?php echo$pledges_perc_txt ?>" aria-valuenow="<?php echo$pledges_perc_txt ?>"
aria-valuemin="0" aria-valuemax="100"></div> aria-valuemin="0" aria-valuemax="100"></div>
</div> </div>
<div> <div>
<strong>Promesses : <?php echo $pledges_txt ?></strong> <div><span class="label donation-label">Dons : <?php echo $donations_txt ?></span></div>
<div><span class="label pledge-label">Promesses : <?php echo $pledges_txt ?></span></div>
</div> </div>
</div> </div>
<div class="text-center"> <div class="text-center">
......
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