Skip to content

Commit

Permalink
Bring live to live (#192)
Browse files Browse the repository at this point in the history
* fix route of poster in project dashboard

* Upgraded Symfony packages to v2.8.30 (last working version)

* Fix call to render method since it was renamed

(cherry picked from commit 5d93afa)

* add composer.lock

* restore a early die if misconfiguration

* Updated Dockerfile to use an Ubuntu image that's not deprecated (#181)

* Updated Dockerfile to use an Ubuntu image that's not deprecated

* Removed Docker image based on date in favour of one that won't change

* fix/composer lock (#185)

* Fix call to render method since it was renamed

(cherry picked from commit 5d93afa)

* remove lock to force deploy

Co-authored-by: Carlos Alberto Martínez Gadea <carlosmartinezgadea@gmail.com>

* Twitter card meta description fix

* change projects to be shown in map when a matcher is selected to use node configuration if available

* improve filters in discover and fix ajax query

(cherry picked from commit 0432ebb325b99d68c42e300493fca974a6142c0f)

* fix use of query parameters when they are not being used

* fix project filters in discover and use of inner joins in project get list function

* Add matcher completed status

* Fix icons size

Co-authored-by: Carlos Alberto Martínez Gadea <carlosmartinezgadea@gmail.com>
Co-authored-by: Ivan Vergés <ivan@platoniq.net>
Co-authored-by: Javier <javicarrillo83@gmail.com>
Co-authored-by: Javier Carrillo <javier@goteo.org>
  • Loading branch information
5 people committed Jul 20, 2021
1 parent 62893fc commit b15012f
Show file tree
Hide file tree
Showing 17 changed files with 275 additions and 72 deletions.
2 changes: 1 addition & 1 deletion Resources/templates/responsive/blog/post.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
$this->layout('blog/layout', [
'bodyClass' => 'blog',
'title' => $this->post->title,
'meta_description' => $this->post->title
'meta_description' => $this->post->subtitle ? $this->post->subtitle : $this->post->title
]);

$this->section('blog-content');
Expand Down
Original file line number Diff line number Diff line change
@@ -1,37 +1,37 @@
<ul class="project-filters list-inline center-block text-center">
<?php $this->section('project-filters-item-0') ?>
<li class="<?= $this->filter === 'promoted' ? 'active' : ''?>" data-status="promoted">
<a href="<?= $this->link ?>/discover/promoted"><?= $this->text('home-projects-team-favourites') ?></a>
<a href="<?= $this->link ?>/discover/promoted?<?= $this->get_querystring() ?>" ><?= $this->text('home-projects-team-favourites') ?></a>
</li>
<?php $this->stop() ?>
<?php $this->section('project-filters-item-1') ?>
<li class="<?= $this->filter === 'outdated' ? 'active' : ''?>" data-status="outdated">
<a href="<?= $this->link ?>/discover/outdated"><?= $this->text('home-projects-outdate') ?></a>
<a href="<?= $this->link ?>/discover/outdated?<?= $this->get_querystring() ?>" ><?= $this->text('home-projects-outdate') ?></a>
</li>
<?php $this->stop() ?>
<?php $this->section('project-filters-item-2') ?>
<li class="<?= $this->filter === 'recent' ? 'active' : ''?>" data-status="recent">
<a href="<?= $this->link ?>/discover/recent"><?= $this->text('discover-group-recent-header') ?></a>
<a href="<?= $this->link ?>/discover/recent?<?= $this->get_querystring() ?>" ><?= $this->text('discover-group-recent-header') ?></a>
</li>
<?php $this->stop() ?>
<?php $this->section('project-filters-item-3') ?>
<li class="<?= $this->filter === 'popular' ? 'active' : ''?>" data-status="popular">
<a href="<?= $this->link ?>/discover/popular"><?= $this->text('discover-group-popular-header') ?></a>
<a href="<?= $this->link ?>/discover/popular?<?= $this->get_querystring() ?>" ><?= $this->text('discover-group-popular-header') ?></a>
</li>
<?php $this->stop() ?>
<?php $this->section('project-filters-item-4') ?>
<li class="<?= $this->filter === 'succeeded' ? 'active' : ''?>" data-status="succeeded">
<a href="<?= $this->link ?>/discover/succeeded"><?= $this->text('discover-group-success-header') ?></a>
<a href="<?= $this->link ?>/discover/succeeded?<?= $this->get_querystring() ?>" ><?= $this->text('discover-group-success-header') ?></a>
</li>
<?php $this->stop() ?>
<?php $this->section('project-filters-item-5') ?>
<li class="<?= $this->filter === 'fulfilled' ? 'active' : ''?>" data-status="fulfilled">
<a href="<?= $this->link ?>/discover/fulfilled"><?= $this->text('regular-success_mark') ?></a>
<a href="<?= $this->link ?>/discover/fulfilled?<?= $this->get_querystring() ?>" ><?= $this->text('regular-success_mark') ?></a>
</li>
<?php $this->stop() ?>
<?php $this->section('project-filters-item-6') ?>
<li class="<?= $this->filter === 'archived' ? 'active' : ''?>" data-status="archived">
<a href="<?= $this->link ?>/discover/archived"><?= $this->text('discover-group-archive-header') ?></a>
<a href="<?= $this->link ?>/discover/archived?<?= $this->get_querystring() ?>" ><?= $this->text('discover-group-archive-header') ?></a>
</li>
<?php $this->stop() ?>
</ul>
62 changes: 29 additions & 33 deletions Resources/templates/responsive/discover/partials/search_box.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,43 +2,39 @@
<div class="checkbox text-danger"><label><input type="checkbox" id="include-in-review" name="review"<?= $this->get_query('review') === '1' ? ' checked="checked"' : '' ?>> <?= $this->text('discover-include-review-projects') ?></label></div>
<?php endif ?>

<div class="row">
<div class="col-xs-12 col-sm-4">
<form class="form-search" method="get" action="">
<div class="form-group">
<label for="search-q"><?= $this->text('discover-by-keyword') ?></label>
<div class="input-group">
<input id="search-q" type="text" name="q" class="search-query form-control" placeholder="<?= $this->text('discover-searcher-button') ?>" value="<?= strip_tags($this->get_query('q')) ?>">
<div class="input-group-btn"><button type="submit" class="btn btn-cyan" title="<?= $this->text('regular-search') ?>"><i class="fa fa-search"></i></button></div>
<form class="form-search" method="get" action="">
<div class="row">
<div class="col-xs-12 col-sm-4">
<div class="form-group">
<label for="search-q"><?= $this->text('discover-by-keyword') ?></label>
<div class="input-group">
<input id="search-q" type="text" name="q" class="search-query form-control" placeholder="<?= $this->text('discover-searcher-button') ?>" value="<?= strip_tags($this->get_query('q')) ?>">
<div class="input-group-btn"><button type="submit" class="btn btn-cyan" title="<?= $this->text('regular-search') ?>"><i class="fa fa-search"></i></button></div>
</div>
</div>
</div>
</form>
</div>
</div>

<div class="col-xs-12 col-sm-4">
<form class="form-search" method="get" action="">
<div class="form-group">
<label for="search-location"><?= $this->text('discover-near-by') ?></label>
<div class="input-group">
<input id="search-location" type="text" name="location" class="search-query form-control geo-autocomplete" data-geocoder-filter="(regions)" data-geocoder-populate-latitude="#search-latitude" data-geocoder-populate-longitude="#search-longitude" placeholder="<?= $this->text('discover-any-city') ?>" value="<?= strip_tags($this->get_query('location')) ?>">
<div class="input-group-btn"><button type="submit" class="btn btn-cyan" title="<?= $this->text('regular-search') ?>"><i class="fa fa-search"></i></button>
</div>
</div>
</div>
<input type="hidden" id="search-latitude" name="latitude" value="<?= strip_tags($this->get_query('latitude')) ?>">
<input type="hidden" id="search-longitude" name="longitude" value="<?= strip_tags($this->get_query('longitude')) ?>">
</form>
</div>
<div class="col-xs-12 col-sm-4">
<div class="form-group">
<label for="search-location"><?= $this->text('discover-near-by') ?></label>
<div class="input-group">
<input id="search-location" type="text" name="location" class="search-query form-control geo-autocomplete" data-geocoder-filter="(regions)" data-geocoder-populate-latitude="#search-latitude" data-geocoder-populate-longitude="#search-longitude" placeholder="<?= $this->text('discover-any-city') ?>" value="<?= strip_tags($this->get_query('location')) ?>">
<div class="input-group-btn"><button type="submit" class="btn btn-cyan" title="<?= $this->text('regular-search') ?>"><i class="fa fa-search"></i></button>
</div>
</div>
</div>
<input type="hidden" id="search-latitude" name="latitude" value="<?= strip_tags($this->get_query('latitude')) ?>">
<input type="hidden" id="search-longitude" name="longitude" value="<?= strip_tags($this->get_query('longitude')) ?>">
</div>

<div class="col-xs-12 col-sm-4">
<form class="form-search" method="get" action="">
<div class="form-group">
<label for="search-category"><?= $this->text('discover-searcher-bycategory-header') ?></label>
<?= $this->html('select', ['name' => 'category', 'value' => $this->get_query('category'), 'options' => ['' => ''] + $this->raw('categories'), 'attribs' => ['id' => 'search-category', 'class' => 'form-control']]) ?>
</div>
</form>
<div class="col-xs-12 col-sm-4">
<div class="form-group">
<label for="search-category"><?= $this->text('discover-searcher-bycategory-header') ?></label>
<?= $this->html('select', ['name' => 'category', 'value' => $this->get_query('category'), 'options' => ['' => ''] + $this->raw('categories'), 'attribs' => ['id' => 'search-category', 'class' => 'form-control']]) ?>
</div>
</div>
</div>
</div>
</form>
<div class="row">
<div class="col-xs-12">
<?= $this->insert('discover/partials/projects_nav', ['link' => $this->link]) ?>
Expand Down
1 change: 1 addition & 0 deletions Resources/templates/responsive/map/map_canvas.php
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@
<?php endif; ?>
data-tile-layer='<?= $this->map->getTileLayer() ?>'
data-channel='<?= $this->map->getChannel() ?>'
data-matcher='<?= $this->map->getMatcher() ?>'
data-geojson='<?= $this->map->getGeoJSON() ?>'
data-zoom='<?= $this->map->getZoom() ?>'
data-center='<?= json_encode($this->map->getCenter()) ?>'
Expand Down
29 changes: 24 additions & 5 deletions Resources/templates/responsive/project/partials/main_extra.php
Original file line number Diff line number Diff line change
Expand Up @@ -216,14 +216,33 @@
<?= $matcher->name ?>
</div>
<div class="progress">
<div class="progress-bar" role="progressbar" aria-valuenow="<?= $progress ?>" aria-valuemin="0" aria-valuemax="100" style="width:<?= $progress ?>%">
<div class="progress-bar <?= $progress==100 ? 'progress-completed' : '' ?> " role="progressbar" aria-valuenow="<?= $progress ?>" aria-valuemin="0" aria-valuemax="100" style="width:<?= $progress ?>%">
</div>
</div>
<div class="matcher-amount">

<?= $this->text('matcher-amount-project', ['%AMOUNT%' => amount_format($matcher_amount), '%PROJECT_AMOUNT%' => amount_format($max_project)] ) ?>
</div>
</strong>
<?php if($progress==100): ?>

<div class="matcher-amount">
<span class="completed">
<i class="fa fa-check-circle"></i>
<?= $this->text('matcher-label-completed') ?>
</span>
<span class="figure">
<?= '('.amount_format($matcher_amount).')' ?>
</span>

</div>

<?php else: ?>

<div class="matcher-amount">

<?= $this->text('matcher-amount-project', ['%AMOUNT%' => amount_format($matcher_amount), '%PROJECT_AMOUNT%' => amount_format($max_project)] ) ?>

</div>

<?php endif; ?>

</div>
</div>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -187,14 +187,35 @@
<?= $matcher->name ?>
</div>
<div class="progress">
<div class="progress-bar" role="progressbar" aria-valuenow="<?= $progress ?>" aria-valuemin="0" aria-valuemax="100" style="width:<?= $progress ?>%">
<div class="progress-bar <?= $progress==100 ? 'progress-completed' : '' ?>" role="progressbar" aria-valuenow="<?= $progress ?>" aria-valuemin="0" aria-valuemax="100" style="width:<?= $progress ?>%">
</div>
</div>
<div class="matcher-amount">

<?= $this->text('matcher-amount-project', ['%AMOUNT%' => amount_format($matcher_amount), '%PROJECT_AMOUNT%' => amount_format($max_project)] ) ?>
<?php if($progress==100): ?>

<div class="matcher-amount">
<span class="completed">
<i class="fa fa-check-circle"></i>
<?= $this->text('matcher-label-completed') ?>
</span>
<span class="figure">
<?= '('.amount_format($matcher_amount).')' ?>
</span>

</div>

<?php else: ?>

<div class="matcher-amount">

<?= $this->text('matcher-amount-project', ['%AMOUNT%' => amount_format($matcher_amount), '%PROJECT_AMOUNT%' => amount_format($max_project)] ) ?>

</div>

<?php endif; ?>

</div>
</strong>
</div>
</div>

Expand Down
4 changes: 2 additions & 2 deletions public/assets/js/discover/discover.js
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ $(function(){
$last.after('<div class="loading-container">' + goteo.texts['regular-loading'] + '</div>');

// console.log('end reached, loading more. total', total, 'query', query);
$.getJSON(window.location.pathname + '/ajax', query, function(result) {
$.getJSON('/discover/ajax', query, function(result) {
total = result.total;
query.limit = result.limit;
result.items.forEach(function(html, index) {
Expand All @@ -78,7 +78,7 @@ $(function(){
});

// Auto submit select in search bar
$('#main').on('change', 'form.form-search select', function(e) {
$('input,select').on('change', function(e) {
e.preventDefault();
$(this).closest('form').submit();
});
Expand Down
42 changes: 42 additions & 0 deletions public/assets/js/map/map.js
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ $(function(){
// }).addTo(map);

var channel = $('#map').data('channel');
var matcher = $('#map').data('matcher');
var geojson = $('#map').data('geojson');
var zoom = $('#map').data('zoom');
var center = $('#map').data('center');
Expand Down Expand Up @@ -132,4 +133,45 @@ $(function(){
});
});
}

if (matcher) {
$.ajax({
url: '/api/map/matcher/' + matcher,
type: 'GET'
}).done(function(data) {
var latlngs = [];
var projects = data.projects;
var project_markers = L.markerClusterGroup();
projects.forEach(function(project){

if (project.project_location.latitude && project.project_location.longitude) {
latlngs.push([project.project_location.latitude, project.project_location.longitude]);
project_markers.addLayer(L.marker([project.project_location.latitude,
project.project_location.longitude], { icon: projectIcon }).bindPopup(project.popup, { width: 340 }));
}
});

if (latlngs.length) {
var latLngBounds = L.latLngBounds(latlngs);
// map.fitBounds(latLngBounds);
}

if (projects.length) {
map.addLayer(project_markers);
$('#button-projects-hide').removeClass('hidden');
}

$('#button-projects-activate').click(function() {
map.addLayer(project_markers);
$('#button-projects-hide').removeClass('hidden');
$(this).addClass('hidden');
});

$('#button-projects-hide').click(function() {
map.removeLayer(project_markers);
$('#button-projects-activate').removeClass('hidden');
$(this).addClass('hidden');
});
});
}
});
20 changes: 19 additions & 1 deletion public/assets/sass/project.scss
Original file line number Diff line number Diff line change
Expand Up @@ -468,6 +468,9 @@ div.matcher-info {
.progress-bar {
background-color: #149290;
}
.progress-completed{
background-color: #70BB34;
}
margin-top: 5px;
width: 100%;
background-color: #D5D5D5;
Expand All @@ -476,12 +479,27 @@ div.matcher-info {
border-radius: 5px;
margin-bottom: 5px;
}

.matcher-name{
font-size:14px
font-size:16px
}

.matcher-amount{
font-weight: normal !important;
.completed{
color: #70BB34;
text-transform: uppercase;
font-size: 14px;
.fa{
font-size: 22px;
vertical-align: bottom;
}
}
.figure{
font-size: 14px;
}
}

}
}
}
Expand Down
47 changes: 47 additions & 0 deletions src/Goteo/Controller/Api/MapsApiController.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,13 @@
use Symfony\Component\HttpFoundation\Request;
use Goteo\Application\Exception\ControllerAccessDeniedException;
use Goteo\Application\Exception\ControllerException;
use Goteo\Application\Exception\ModelNotFoundException;
use Goteo\Application\Config;
use Goteo\Model\Image;
use Goteo\Model\Project;
use Goteo\Model\Call;
use Goteo\Model\Node;
use Goteo\Model\Matcher;
use Goteo\Model\Project\ProjectLocation;

use Goteo\Application\View;
Expand Down Expand Up @@ -89,4 +91,49 @@ public function channelAction($cid = null, Request $request) {

}

public function matcherAction($mid = null, Request $request) {

$list_projects = [];

if ($mid) {
try {
$matcher = Matcher::get($mid);
$projects = $matcher->getListProjects('active');
} catch (ModelNotFoundException $e) {
Message::error($e->getMessage());
}

try {
$channel = Node::get($mid);
$conf = $channel->getConfig();

if ($conf['projects']) {
$total = Project::getList($conf['projects'], $mid, 0, 0, true);
$projects = Project::getList($conf['projects'], $mid, 0, $total);
} else {
$total = Project::getList(['node' => $channel->id], $mid, 0, 0, true);
$projects = Project::getList(['node' => $channel->id], $mid, 0, $total);
}
} catch (ModelNotFoundException $e) {}

foreach($projects as $project) {
$ob = ['id' => $project->id,
'name' => $project->name,
'amount' => $project->amount,
'invested' => $project->invested,
'num_investors' => $project->num_investors,
'image' => Image::get($project->image)->getLink(120,120),
'project_location' => ProjectLocation::get($project->id),
'popup' => View::render('map/partials/project_popup.php', array('project' => $project))];
$list_projects[] = $ob;
}
}

return $this->jsonResponse([
'projects' => $list_projects
]);


}

}
Loading

0 comments on commit b15012f

Please sign in to comment.