Skip to content

Commit 201dd95

Browse files
committed
Carregando meetups via ajax.
1 parent 727bcf6 commit 201dd95

File tree

5 files changed

+66
-151
lines changed

5 files changed

+66
-151
lines changed

_data/meetups.yml

-132
This file was deleted.

_includes/footer.html

+4
Original file line numberDiff line numberDiff line change
@@ -103,3 +103,7 @@
103103
<!-- start Main -->
104104
<script src=" {{ '/js/main.js' | prepend: site.baseurl | prepend: site.url }}"></script>
105105
<!-- end Main -->
106+
107+
{% for js in page.files_js %}
108+
<script src=" {{ js | prepend: site.baseurl | prepend: site.url }}"></script>
109+
{% endfor %}

img/ajax-loader.gif

723 Bytes
Loading

js/meetup.js

+46
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
$(function() {
2+
$.ajax({
3+
url: 'https://whera.com.br/phpsc/index.json',
4+
type: 'GET',
5+
success: callbackSuccess,
6+
error: function(e) {
7+
//called when there is an error
8+
//console.log(e.message);
9+
}
10+
});
11+
});
12+
13+
14+
function callbackSuccess(json) {
15+
$('#text-load').remove();
16+
17+
$.each(json, function (index, meetup) {
18+
var html = '';
19+
html += '<div class="col-lg-4">';
20+
html += '<div class="panel panel-default">';
21+
html += '<div class="panel-body">';
22+
html += '<h4 class="text-center">';
23+
html += '<i class="fa fa-users fa-4x col-md-12"></i>';
24+
html += '<a href="'+meetup.link+'" target="_blank">'+meetup.name+'</a>';
25+
html += '</h4>';
26+
html += '<b>Local:</b> '+meetup.venue+'<br>';
27+
html += '<b>Data:</b> '+meetup.date+'<br>';
28+
29+
if (meetup.status == 'past') {
30+
html += '<b>Participantes:</b> ' + meetup.members;
31+
}
32+
33+
html += '</div>';
34+
35+
if (meetup.status == 'upcoming') {
36+
html += '<div class="panel-footer">';
37+
html += '<a title="Junte-se a nós!" class="btn btn-block btn-primary" href="'+meetup.link+'" role="button">Junte-se a nós!</a>';
38+
html += '</div>';
39+
}
40+
html += '</div>';
41+
html += '</div>';
42+
43+
$('#meetups').append(html);
44+
});
45+
46+
}

reunioes.md

+16-19
Original file line numberDiff line numberDiff line change
@@ -2,25 +2,22 @@
22
layout: page
33
title: Reuniões
44
permalink: /reunioes/
5+
files_js:
6+
- /js/meetup.js
57
---
6-
As reuniões são sempre marcadas pelo nosso <a href="http://www.meetup.com/pt/PHPSC-Floripa/" target="_blank">Meetup</a>
7-
e são mensais, alternando entre <b>InCompany</b> e <b>PHPSC Pub</b>.
8-
8+
<div id="text-meetup" class="row">
9+
<div class="text-left col-md-10">
10+
As reuniões são sempre marcadas pelo nosso <a href="http://www.meetup.com/pt/PHPSC-Floripa/" target="_blank">Meetup</a>
11+
e são mensais, alternando entre <b>InCompany</b> e <b>PHPSC Pub</b>.
12+
</div>
13+
14+
<span id="text-load" class="col-md-2 text-right">
15+
<i>Carregando</i>
16+
<img alt="load" src="{{ '/img/ajax-loader.gif' | prepend: site.baseurl | prepend: site.url }}" />
17+
</span>
18+
<p class="clearfix"></p>
19+
</div>
920
<div class="row">
10-
{% for meetup in site.data.meetups reversed %}
11-
<div class="col-lg-4">
12-
<div class="panel panel-default">
13-
<div class="panel-body">
14-
<h4 class="text-center">
15-
<i class="fa fa-users fa-4x col-md-12"></i>
16-
<a href="{{ meetup.url }}" target="_blank">{{ meetup.titulo }}</a>
17-
</h4>
18-
19-
<b>Local:</b> {{ meetup.local }}<br>
20-
<b>Data:</b> {{ meetup.data }}<br>
21-
<b>Participantes:</b> {{ meetup.publico }}
22-
</div>
23-
</div>
24-
</div>
25-
{% endfor %}
21+
<div id="meetups">
22+
</div>
2623
</div>

0 commit comments

Comments
 (0)