Skip to content

Commit

Permalink
Added GA
Browse files Browse the repository at this point in the history
  • Loading branch information
Blazej Bucko committed Mar 19, 2012
1 parent 9d4051b commit 955b55f
Show file tree
Hide file tree
Showing 5 changed files with 59 additions and 13 deletions.
2 changes: 1 addition & 1 deletion src/main/webapp/WEB-INF/appengine-web.xml
@@ -1,7 +1,7 @@
<appengine-web-app xmlns="http://appengine.google.com/ns/1.0"> <appengine-web-app xmlns="http://appengine.google.com/ns/1.0">
<application>confi-dev</application> <application>confi-dev</application>


<version>13</version> <version>14</version>


<system-properties> <system-properties>
<property name="file.encoding" value="UTF-8"/> <property name="file.encoding" value="UTF-8"/>
Expand Down
11 changes: 10 additions & 1 deletion src/main/webapp/WEB-INF/groovy/WelcomeController.groovy
Expand Up @@ -14,7 +14,16 @@ if (!(cacheKey in memcache)) {
} }


final nextTalks = Talk.search(filter: ["from >=": now], sort: ["from", "title"], limit: 5) final nextTalks = Talk.search(filter: ["from >=": now], sort: ["from", "title"], limit: 5)
final nowTalking = memcache[cacheKey].findAll {Talk talk -> talk.from <= now && talk.to > now } def nowTalking

try {
nowTalking = memcache[cacheKey].findAll {Talk talk -> talk.from <= now && talk.to > now }
} catch (Exception ex) {
log.info("Exception occured while retrieving stuff from memcache")
memcache[cacheKey] = Talk.search(filter: ["from >=": today, "from <": tomorrow], sort: ["from", "title"])
nowTalking = memcache[cacheKey].findAll {Talk talk -> talk.from <= now && talk.to > now }
}



request.nowTalking = nowTalking request.nowTalking = nowTalking
request.nextTalks = nextTalks request.nextTalks = nextTalks
Expand Down
7 changes: 4 additions & 3 deletions src/main/webapp/WEB-INF/views/index.gtpl
Expand Up @@ -28,9 +28,10 @@
<a href="/talk/${talk.id}"> <a href="/talk/${talk.id}">
<h3>${talk.title}</h3> <h3>${talk.title}</h3>


<p><strong>${talk.presenter.fullName}</strong></p> <p>

${talk.from.format("HH:mm")} - ${talk.to.format("HH:mm")} in <strong>${talk.room}</strong>
<p>${talk.from.format("HH:mm")} - ${talk.to.format("HH:mm")} :: <strong>${talk.room}</strong></p> <span class="ui-li-aside"><strong>${talk.presenter.fullName}</strong></span>
</p>
</a> </a>
</li> </li>
<% } <% }
Expand Down
42 changes: 39 additions & 3 deletions src/main/webapp/WEB-INF/views/layouts/mobile.jsp
Expand Up @@ -14,6 +14,25 @@
<link rel="stylesheet" href="http://code.jquery.com/mobile/1.0/jquery.mobile-1.0.min.css"/> <link rel="stylesheet" href="http://code.jquery.com/mobile/1.0/jquery.mobile-1.0.min.css"/>
<link rel="stylesheet" type="text/css" href="/css/main.css"/> <link rel="stylesheet" type="text/css" href="/css/main.css"/>
<decorator:head/> <decorator:head/>

<script type="text/javascript">
var _gaq = _gaq || [];
(function () {
var ga = document.createElement('script');
ga.type = 'text/javascript';
ga.async = true;
ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
var s = document.getElementsByTagName('script')[0];
s.parentNode.insertBefore(ga, s);
})();
$(document).bind('mobileinit', function () {
$.mobile.touchOverflowEnabled = true;
});
</script>
</head> </head>
<body> <body>
<div data-role="page"> <div data-role="page">
Expand All @@ -29,12 +48,29 @@
<div data-role="navbar"> <div data-role="navbar">
<ul> <ul>
<c:set var="pageType"><decorator:getProperty property="meta.pageType"/></c:set> <c:set var="pageType"><decorator:getProperty property="meta.pageType"/></c:set>
<li><a <c:if test="${pageType eq 'talks'}">class="ui-btn-active"</c:if> data-icon="info" href="/talks">Talks</a></li> <li><a
<li><a <c:if test="${pageType eq 'home'}">class="ui-btn-active"</c:if> data-icon="grid" href="/">Home</a></li> <c:if test="${pageType eq 'talks'}">class="ui-btn-active"</c:if> data-icon="info" href="/talks">Talks</a></li>
<li><a <c:if test="${pageType eq 'presenters'}">class="ui-btn-active"</c:if> data-icon="star" href="/presenters">Presenters</a></li> <li><a
<c:if test="${pageType eq 'home'}">class="ui-btn-active"</c:if> data-icon="grid" href="/">Home</a></li>
<li><a
<c:if test="${pageType eq 'presenters'}">class="ui-btn-active"</c:if> data-icon="star" href="/presenters">Presenters</a></li>
</ul> </ul>
</div> </div>
</div> </div>
</div> </div>
<script type="text/javascript">
$('[data-role=page]').live('pageshow', function (event, ui) {
try {
_gaq.push(['_setAccount', 'UA-30154633-1']);
hash = location.hash;
if (hash) {
_gaq.push(['_trackPageview', hash.substr(1)]);
} else {
_gaq.push(['_trackPageview']);
}
} catch (err) {
}
});
</script>
</body> </body>
</html> </html>
10 changes: 5 additions & 5 deletions src/main/webapp/WEB-INF/views/talks.gtpl
Expand Up @@ -14,15 +14,15 @@
} else { %> } else { %>
<ul data-role="listview" data-theme="g" data-filter="true"> <ul data-role="listview" data-theme="g" data-filter="true">
<% request.talks.today.each {hour, talks -> %> <% request.talks.today.each {hour, talks -> %>
<li data-role="list-divider">Today:: ${hour}</li> <li data-role="list-divider">${new Date().format("DD-MM")} :: ${hour}</li>
<% talks.each {talk -> %> <% talks.each {talk -> %>
<li> <li>
<a href="/talk/${talk.id}"> <a href="/talk/${talk.id}">
<h3>${talk.title}</h3> <h3>${talk.title}</h3>

<p>
<p><strong>${talk.presenter.fullName}</strong></p> ${talk.from.format("HH:mm")} - ${talk.to.format("HH:mm")} in <strong>${talk.room}</strong>

<span class="ui-li-aside"><strong>${talk.presenter.fullName}</strong></span>
<p>${talk.from.format("HH:mm")} - ${talk.to.format("HH:mm")} :: <strong>${talk.room}</strong></p> </p>
</a> </a>
</li> </li>
<% } <% }
Expand Down

0 comments on commit 955b55f

Please sign in to comment.