Commits

Puria Nafisi Azizi committed 3b69613

Social enhancments and some interaction hints

Comments (0)

Files changed (4)

 .egg-info
 data
 .idea
+env

vogliomorire/controllers/root.py

 
     @expose('vogliomorire.templates.index')
     def index(self):
-        today = datetime.now().day
+        today = datetime.utcnow().replace(hour=0, minute=0, second=0, microsecond=0)
         n = DBSession.query(model.Hit).filter(model.Hit.date>=today).count()
         return dict(page='index', n=n)
 
     def hit(self):
         hit = model.Hit()
         DBSession.add(hit)
-        return dict(count=DBSession.query(model.Hit).filter(model.Hit.date>=datetime.now().day).count())
+        today = datetime.utcnow().replace(hour=0, minute=0, second=0, microsecond=0)
+        return dict(count=DBSession.query(model.Hit).filter(model.Hit.date>=today).count())
 
     @expose('vogliomorire.templates.login')
     def login(self, came_from=url('/')):

vogliomorire/public/css/style.css

 #index_container h1 { font-size: 100pt; }
 #index_container { width: 600px; margin: 20px auto; padding: 0 0 0 0; font-family: 'Permanent Marker', cursive; font-size: 40pt; text-align: center; }
 #index_social { width: 600px; height: 32px; }
-#index_social span { display: none; }
+#index_social ul span { display: none; }
 #index_social { float: left; width: 100%; }
 #index_social ul { float: right; }
 #index_social ul li { float: left; margin-left: 20px; }
 #index_social ul li a.twitter { background: url(../images/twitter32x32.png); width: 32px; height: 32px; display: block; }
 #index_social ul li a.facebook { background: url(../images/facebook32x32.png); width: 32px; height: 32px; display: block; }
+.twitter-share-button { float: left; }
+.fb-like { margin-left: -350px; }
 #index_header { width: 600px; padding-top: 60px; margin-bottom: 0px; }
+#index_header h6 {position:relative; left:-360px; -webkit-transform:  rotate(328deg);-moz-transform:  rotate(328deg);-o-transform:  rotate(328deg); writing-mode: lr-tb; color: #0094C2; }
 h2 { padding-top: 140px; margin-bottom: 0px; font-size: 20pt; font-weight: 400; color: #d1d3d4; }
 hr { color:#675d5c; background-color:#675d5c; height: 2px; border:none; }
 #index_footer { width: 600px; padding-top: 40px; font-size: 8pt; margin: 0px auto; }

vogliomorire/templates/index.html

 	<head>
 		<meta content="text/html; charset=UTF-8" http-equiv="content-type" py:if="False"/>
 		<title>Voglio Morire | .it</title>
+        <script src="http://d3js.org/d3.v2.js"></script>
 	</head>
 
 	<body>
+		<div id="fb-root"></div>
+
+		<script>(function(d, s, id) {
+			var js, fjs = d.getElementsByTagName(s)[0];
+			if (d.getElementById(id)) return;
+			js = d.createElement(s); js.id = id;
+			js.src = "//connect.facebook.net/en_US/all.js#xfbml=1";
+			fjs.parentNode.insertBefore(js, fjs);
+			}(document, 'script', 'facebook-jssdk'));
+		</script>
+
 		<script>
 			$(function() {
 				var message = "${n} persone come te oggi!";
 				jQuery("#vm").click(function(){
 					jQuery.get("/hit");
+					var h6 = jQuery('#index_header h6');
+					h6.hide().html("grazie ;(");
 					jQuery(this).addClass('animated hinge').delay(1900).fadeOut(10);
 					var h1 = jQuery("<h3>" + message + "</h3>");
 					jQuery(h1).hide();
-					jQuery("#index_header").prepend(h1)
-					jQuery(h1).fadeIn(2500);
+					jQuery("#index_header").prepend(h1);
+					jQuery(h1).fadeIn(2500, function(){
+						h6.fadeIn();
+					});
 				});
 			 });
 		</script>
 		<div id="index_container">
 			<div id="index_social">
 				<ul>
-					<li><a href="https://twitter.com/Voglio_Morire" onclick="window.open(this.href,'newwin'); return false;" class="twitter"><span>Twitter</span></a></li>
-					<li><a href="https://www.facebook.com/" onclick="window.open(this.href,'newwin'); return false;" class="facebook"><span>Facebook</span></a></li>
+					<li><a href="http://twitter.com/Voglio_Morire" onclick="window.open(this.href,'newwin'); return false;" class="twitter"><span>Twitter</span></a></li>
+					<li><a href="http://www.facebook.com/pages/Voglio-Morire/173290162781889" onclick="window.open(this.href,'newwin'); return false;" class="facebook"><span>Facebook</span></a></li>
 				</ul>
+				<a href="https://twitter.com/share" class="twitter-share-button" data-url="http://www.vogliomorire.it" data-via="voglio_morire" data-lang="it" data-hashtags="vogliomorire">Tweet</a>
+				<script>!function(d,s,id){var js,fjs=d.getElementsByTagName(s)[0];if(!d.getElementById(id)){js=d.createElement(s);js.id=id;js.src="//platform.twitter.com/widgets.js";fjs.parentNode.insertBefore(js,fjs);}}(document,"script","twitter-wjs");</script>
+				<div class="fb-like" data-href="http://www.vogliomorire.it" data-send="false" data-layout="button_count" data-width="80" data-show-faces="false"></div>
 			</div>
 
 			<div id="index_header" style="height: 256px">
 				<h1 id="vm">Voglio Morire</h1>
+				<h6>clicca qui &#8605;</h6>
 			</div>
 			<div id="index_content">
 				<h2>fatto con &#10084; da gente con passione</h2>