Commit 2906d82b authored by dm141569's avatar dm141569 Committed by BZ

Add Meetup detail view

parent ad6c1a05
html, body {
}
#attend {
display: none;
}
/**
* Sportmeetup FH Module
*/
var SPORTMEETUPFH = SPORTMEETUPFH || {};
SPORTMEETUPFH.Main = (function() {
'use strict';
/** Private */
var x;
var data = null;
function test() {
console.debug(this);
/**
* Details for a Meetup
* and possibility to attent
*/
function attend() {
var currentEvent = data[ $(this).data('event-date') ][ $(this).data('event-array-id') ];
var header = $(document.createElement('header'));
var h1 = $(document.createElement('h1'));
console.debug(currentEvent);
$('.sport').text(currentEvent.sport);
$('.name').text(currentEvent.name);
$('.date').text(currentEvent.date);
$('.time').text(currentEvent.time);
$('.meeting-place').text(currentEvent.meeting_place);
$('#events').fadeOut('slow', function() {
$('#attend').fadeIn('slow');
});
return false;
}
/**
* Back Button for attend view
*/
function backButton(e) {
$('#attend').fadeOut('slow', function() {
$('#events').fadeIn('slow');
});
return false;
}
......@@ -15,8 +47,16 @@ SPORTMEETUPFH.Main = (function() {
/** Public */
return {
/**
* Initialize
* Load data and call event listener setup
*/
init: function() {
$.get('/', function(data) {
// Loading...
$.get('/', function(d) {
data = d;
$.each(data, function(key, value) {
var section = $(document.createElement('section'));
var header = $(document.createElement('header'));
......@@ -26,25 +66,39 @@ SPORTMEETUPFH.Main = (function() {
header.append(h1);
section.append(header);
$('main').append(section);
$('#events').append(section);
$.each(value, function(k, v) {
var div = $(document.createElement('div'));
$(div).data('event-array-id', k);
$(div).data('event-date', v.date);
$(div).append(v.name);
$(div).append(v.sport);
$(div).append(v.time);
$(div).bind('click', test);
$(div).bind('click', attend);
$('main').append(div);
$(section).append(div);
});
});
// Loading done.
});
this.initListeners();
},
/**
* Setup up event listeners
*/
initListeners: function() {
$('#back').bind('click', backButton);
}
}
}());
/** On document ready... */
$(function() {
$('html').removeClass('no-js');
......
......@@ -14,7 +14,26 @@
</header>
<main role="main">
Hello
<section id="events">
</section>
<section id="attend" data-to="0">
<header>
<h1></h1>
</header>
<div class="content">
Sport: <span class="sport"></span>
Meetup erstellt von <span class="name"></span>
Treffpunkt um am <span class="date"></span> um <span class="time"></span> Uhr.
Wo: <span class="meeting-place"></span>
Notizen: <span class="notes"></span>
</div>
<footer>
<a href="/" title="Back" id="back">&lt; Zurück</a>
</footer>
</section>
</main>
<footer>
......
Markdown is supported
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