Skip to content

improved mobile view resolves #16, calendar api closes #12, closes #15 #17

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Oct 11, 2014
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 5 additions & 12 deletions _includes/events.html
Original file line number Diff line number Diff line change
@@ -1,12 +1,5 @@
<ul class="event-list">
{% for post in site.categories.events order:asc %}
<li class="event">
<h4 class="event-title">{{ post.title }}</h4>
<ul class="event-info">
<li><i class="fa fa-calendar-o"></i>{{ post.date | date: "%b %-d %Y"}}
{% if post.time %}<li><i class="fa fa-clock-o"></i>{{ post.time }}{% endif %}
<li><i class="fa fa-map-marker"></i>{{ post.location }}
</ul>
</li>
{% endfor %}
</ul>
<div id="event-list-cta">
<div class="center">
<img class="loader" src="assets/css/loader.gif" />
</div>
</div>
3 changes: 3 additions & 0 deletions _includes/foot.html
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,7 @@
</div>
</footer>
<script type="text/javascript" src="//cdnjs.cloudflare.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<script type="text/javascript" src="//cdnjs.cloudflare.com/ajax/libs/moment.js/2.8.3/moment.min.js"></script>
<script type="text/javascript" src="/assets/scripts/main.js"></script>
<script>function GAPILoad(){Events.init();}</script>
<script src="https://apis.google.com/js/client.js?onload=GAPILoad"></script>
76 changes: 68 additions & 8 deletions _sass/main.sass
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
// general colors
$yellow : #FEE375
$white : #FFFFFF
$grey-light : #888888
$grey-med : #505050
$grey-dark : #444444
// logo colors
Expand Down Expand Up @@ -102,7 +103,7 @@ a
background: url('coderit_background.png') center center fixed
font-size: 1.25em
height: 100%
min-height: 200px
min-height: 350px
padding: 60px 0 80px
text-align: center
.logo
Expand Down Expand Up @@ -159,9 +160,15 @@ a
color: $orange-light
text-align: center

.loader
max-width: 80px
margin-top: 50%
opacity: 0.6
tranform: translateY(-50%)
// SECTIONS
.section
padding: 90px 0
padding-bottom: 90px
padding-top: 90px
.title
margin-bottom: 110px

Expand Down Expand Up @@ -206,11 +213,15 @@ a
margin: 0 auto
text-align: justify
width: 50%
.event-list

#event-list-cta
margin: 0 auto 15px
width: 65%
#event-list
list-style: none
margin: 0 auto
padding-left: 0
width: 50%
.event-page
display: none
.event
color: $blue-light
margin-bottom: 10px
Expand All @@ -223,6 +234,19 @@ a
padding: 0
.fa
margin-right: 10px
.event-page-nav
background: $grey-light
@include border-radius (4px)
cursor: pointer
display: inline-block
height: 15px
margin-right: 10px
width: 15px
&:hover
background: $blue
&.active
background: $orange-light


#committees
.committee
Expand Down Expand Up @@ -288,7 +312,7 @@ a
padding-top: 25px


@media screen and (max-width: 798px)
@media screen and (max-width: 768px)
body
font-size: 14px
.grid-cta
Expand All @@ -299,16 +323,52 @@ a
padding-right: 0
width: 100% !important

.section
padding-bottom: 15px
padding-top: 15px
.title
margin-bottom: 25px
#about
.badge-cta
margin-bottom: 40px
.badge-icon
font-size: 3em
height: 100px
width: 100px
.badge-name
margin: 0

#events
padding-bottom: 20px
padding-top: 20px
.inner
padding: 20px 10px
p
width: auto
.event-list
width: 100%
#event-list
width: 100%

#committees
.committee
display: block !important
margin-left: 0
text-align: left !important
transform: none !important
width: 100% !important
.committee-info
margin-left: 0 !important
width: 100% !important

@media screen and (max-width: 400px)

#contact
.grid-cta
width: auto

#events
.container
background: $white
.inner
padding: 10px 3px
#event-list-cta
width: auto
Binary file added assets/css/loader.gif
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
94 changes: 78 additions & 16 deletions assets/css/main.css
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ a {
background: url("coderit_background.png") center center fixed;
font-size: 1.25em;
height: 100%;
min-height: 200px;
min-height: 350px;
padding: 60px 0 80px;
text-align: center; }
.banner.welcome .logo {
Expand Down Expand Up @@ -136,8 +136,15 @@ a {
color: #f3852a;
text-align: center; }

.loader {
max-width: 80px;
margin-top: 50%;
opacity: 0.6;
tranform: translateY(-50%); }

.section {
padding: 90px 0; }
padding-bottom: 90px;
padding-top: 90px; }
.section .title {
margin-bottom: 110px; }

Expand Down Expand Up @@ -185,24 +192,45 @@ a {
text-align: justify;
width: 50%; }

.event-list {
#event-list-cta {
margin: 0 auto 15px;
width: 65%; }

#event-list {
list-style: none;
margin: 0 auto;
padding-left: 0;
width: 50%; }
.event-list .event {
padding-left: 0; }
#event-list .event-page {
display: none; }
#event-list .event {
color: #194774;
margin-bottom: 10px; }
.event-list .event-title {
#event-list .event-title {
font-size: 1.125em;
margin: 0 0 5px; }
.event-list .event-info {
#event-list .event-info {
font-size: 0.875em;
list-style: none;
padding: 0; }
.event-list .event-info .fa {
#event-list .event-info .fa {
margin-right: 10px; }

.event-page-nav {
background: #888888;
-webkit-border-radius: 4px;
-moz-border-radius: 4px;
-ms-border-radius: 4px;
-o-border-radius: 4px;
border-radius: 4px;
cursor: pointer;
display: inline-block;
height: 15px;
margin-right: 10px;
width: 15px; }
.event-page-nav:hover {
background: #384859; }
.event-page-nav.active {
background: #f3852a; }

#committees .committee {
box-sizing: border-box;
display: inline-block;
Expand Down Expand Up @@ -268,7 +296,7 @@ a {
margin-top: 0;
padding-top: 25px; }

@media screen and (max-width: 798px) {
@media screen and (max-width: 768px) {
body {
font-size: 14px; }

Expand All @@ -279,15 +307,49 @@ a {
padding-right: 0;
width: 100% !important; }

.section {
padding-bottom: 15px;
padding-top: 15px; }
.section .title {
margin-bottom: 25px; }

#about .badge-cta {
margin-bottom: 40px; }
#about .badge-cta .badge-icon {
font-size: 3em;
height: 100px;
width: 100px; }
#about .badge-cta .badge-name {
margin: 0; }

#events .inner {
padding: 20px 10px; }
#events p {
#events {
padding-bottom: 20px;
padding-top: 20px; }
#events .inner {
padding: 20px 10px; }
#events p {
width: auto; }

#event-list {
width: 100%; }

#committees .committee {
display: block !important;
margin-left: 0;
text-align: left !important;
transform: none !important;
width: 100% !important; }
#committees .committee-info {
margin-left: 0 !important;
width: 100% !important; } }
@media screen and (max-width: 400px) {
#contact .grid-cta {
width: auto; }

.event-list {
width: 100%; } }
#events .container {
background: white; }
#events .inner {
padding: 10px 3px; }

#event-list-cta {
width: auto; } }
77 changes: 76 additions & 1 deletion assets/scripts/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,4 +9,79 @@ $(document).ready(function () {
}, 1000);
});

});
});

var Events = {
init : function () {
gapi.client.setApiKey('AIzaSyDTyYHxMN8sAUCystSZWuXXgCZfxpSI_kw');
gapi.client.request({
'path' : '/calendar/v3/calendars/coderit.public@gmail.com/events',
'callback' : Events.displayEvents,
'orderBy' : 'startTime',
'singleEvents' : true
});
},
showEventPage : function (id) {
$('.event-page').hide();
$('.event-page[data-event-page=' + id + ']').show();
},
changeEventPage : function (e) {
var $target = $(e.target);
Events.showEventPage($target.data('event-page-id'));
$('.event-page-nav').removeClass('active');
$target.addClass('active');
},
displayEvents : function (response) {
if (response.items.length === 0) {
$('#event-list-cta').html('<h4>There are no upcoming events.</h4>');
return false;
}

// sort events by date
var events = response.items.sort(function (a ,b) {
if (a.start.dateTime !== undefined)
a.start.date = a.start.dateTime;
if (b.start.dateTime !== undefined)
b.start.date = b.start.dateTime;
return new Date(a.start.date) - new Date(b.start.date);
});
var count = 0;
var numPages = 1;
var html = '<ul id="event-list">';
// print each event
response.items.forEach(function(event) {
if (count === 0) {
html += '<div class="event-page" data-event-page="'+ numPages +'">';
}
html += '<li class="event">';
html += '<h4 class="event-title">' + event.summary + '</h4>';
html += '<ul class="event-info">';
date = moment(event.start.date);
html += '<li><i class="fa fa-calendar-o"></i>' + date.format('MMM D \'YY') + '</li>';
// print out time if set
html += (event.start.dateTime === undefined)?'':'<li><i class="fa fa-clock-o"></i>' + date.format('h:mm A') + '</li>';
html += (event.location === undefined)?'':'<li><i class="fa fa-map-marker"></i>' + event.location + '</li>';
html += '</ul>';
html += '</li>';
count++;
if (count === 4) {
html += '</div>';
count = 0;
numPages++;
}
});
html += '</ul>';

if (numPages > 1) {
for (var i = 1; i <= numPages; i++) {
html += '<span data-event-page-id="'+ i +'" class="event-page-nav';
html += (i === 1)?' active':'';
html += '">&nbsp;</span>';
}
}
$('#event-list-cta').html(html);
Events.showEventPage(1);
$('.event-page-nav').on('click', Events.changeEventPage);
$('#event-list').css('minHeight', $('#event-list').height());
}
}