Skip to content

Commit

Permalink
ordenando eventos e melhorando a comunicação visual de eventos que pa…
Browse files Browse the repository at this point in the history
…ssaram
  • Loading branch information
humrochagf committed Nov 4, 2016
1 parent 9cb5b26 commit 8c530d2
Show file tree
Hide file tree
Showing 3 changed files with 30 additions and 4 deletions.
4 changes: 3 additions & 1 deletion pelicanconf.py
Original file line number Diff line number Diff line change
Expand Up @@ -194,7 +194,8 @@
def date_hook(json_dict):
for (key, value) in json_dict.items():
try:
json_dict[key] = datetime.datetime.strptime(value, "%Y-%m-%d")
json_dict[key] = datetime.datetime.strptime(
value, "%Y-%m-%d").date()
except:
pass
return json_dict
Expand Down Expand Up @@ -226,6 +227,7 @@ def import_empresas(path):

# Configurações da página de eventos
EVENTOS = [json.load(open(fname, 'r'), object_hook=date_hook) for fname in glob.glob('content/eventos/*/*.json')]
EVENTOS = sorted(EVENTOS, key=lambda evento: evento['data'], reverse=True)

# Configurações da página de comunidades locais
COMUNIDADES_LOCAIS = [json.load(open(fname, 'r')) for fname in glob.glob('content/comunidades-locais/*.json')]
Expand Down
10 changes: 9 additions & 1 deletion themes/pybr/static/pybr/css/eventos.css
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@
}

.date-blue {
background-color: #3771a2;
background-color: #5088b7;
}

.date-yellow {
Expand All @@ -112,3 +112,11 @@
font-size: 24px;
line-height: 26px;
}

.past-event {
-webkit-filter: grayscale(1);
-moz-filter: grayscale(1);
-o-filter: grayscale(1);
-ms-filter: grayscale(1);
filter: grayscale(1);
}
20 changes: 18 additions & 2 deletions themes/pybr/templates/eventos.html
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
{% block post_content %}
{% set date_color = cycler('date-blue', 'date-yellow') %}
{% for evento in EVENTOS %}
<div class="row event">
<div class="row event" data-event-date="{{ evento.data }}">
<div class="col-xs-3 event-date {{ date_color.next() }}">
<p class="event-day">
{{ evento.data.day }}
Expand Down Expand Up @@ -45,11 +45,27 @@ <h2>
{% endfor %}
{% endblock %}


{% block aditional_scripts %}
<script>
// marcação de eventos passados
var today = new Date();
var events = $('.event');

today.setHours(0,0,0,0);

$.each(events, function(index, event) {
var date = new Date($(event).data('event-date'));
date.setHours(0,0,0,0);

if (date.getTime() < today.getTime())
$(event).addClass('past-event');
});
</script>

<script src="http://maps.googleapis.com/maps/api/js?sensor=false&dummy=.js"></script>

<script>
// mapas dos eventos
var maps = $('.map');

for (i = 0; i < maps.length; i++) {
Expand Down

1 comment on commit 8c530d2

@humrochagf
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

retativo a issue #98

Please sign in to comment.