From 4ead2cd79d3c7e5c29a11785a3ceefef6d3ba93f Mon Sep 17 00:00:00 2001 From: friendica Date: Tue, 3 Feb 2015 21:19:29 -0800 Subject: final cleanup on ratings feature --- view/js/mod_directory.js | 28 ++++++++++++++++++++++++++-- 1 file changed, 26 insertions(+), 2 deletions(-) (limited to 'view/js/mod_directory.js') diff --git a/view/js/mod_directory.js b/view/js/mod_directory.js index 09b103352..87e4f92b5 100644 --- a/view/js/mod_directory.js +++ b/view/js/mod_directory.js @@ -6,14 +6,38 @@ function dirdetails(hash) { } +var ratingVal = 0; +var ratingText = ''; +var currentHash = ''; + +function fetchRatings(hash) { + $.get('prate/'+hash, function(data) { + if(typeof(data.rating) !== 'undefined') { + ratingVal = data.rating; + ratingText = data.rating_text; + } + buildRatingForm(hash); + }); +} + + function doRatings(hash) { + fetchRatings(hash); +} - var html = '
'+aStr['rating_desc']+'
'+aStr['rating_text']+'
'; +function buildRatingForm(hash) { + var html = '
'+aStr['rating_desc']+'
'+aStr['rating_text']+'
'; $.colorbox({maxwidth: "50%", maxHeight: "50%", html: html, close: 'X' }); - + currentHash = hash; } +function postRatings() { + $.post('prate',$('#ratings_form').serialize(),function(data) { + $.colorbox.remove(); + $('#edited-'+currentHash).show(); + },'json'); +} $(document).ready(function() { collapseHeight(); -- cgit v1.2.3