From 5cb2f55dbbe715219dd18c60345e341ed478a753 Mon Sep 17 00:00:00 2001 From: friendica Date: Tue, 3 Feb 2015 16:52:09 -0800 Subject: rating form work --- view/js/mod_directory.js | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'view/js') diff --git a/view/js/mod_directory.js b/view/js/mod_directory.js index 74c8b414d..60bfe98ba 100644 --- a/view/js/mod_directory.js +++ b/view/js/mod_directory.js @@ -3,9 +3,18 @@ function dirdetails(hash) { $.get('dirprofile' + '?f=&hash=' + hash, function( data ) { $.colorbox({ maxWidth: "50%", maxHeight: "75%", html: data }); }); +} + + +function doRatings(hash) { + + var html = '
'; + + $.colorbox({maxwidth: "50%", maxHeight: "50%", html: html }); } + $(document).ready(function() { collapseHeight(); }); \ No newline at end of file -- cgit v1.2.3 From 17ffe122b309610208d769f0e2b41f53fcf9d254 Mon Sep 17 00:00:00 2001 From: friendica Date: Tue, 3 Feb 2015 18:10:55 -0800 Subject: ratings - mopping up, most everything but directory sync implemented --- view/js/mod_directory.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'view/js') diff --git a/view/js/mod_directory.js b/view/js/mod_directory.js index 60bfe98ba..09b103352 100644 --- a/view/js/mod_directory.js +++ b/view/js/mod_directory.js @@ -8,9 +8,9 @@ function dirdetails(hash) { function doRatings(hash) { - var html = '
'; + var html = '
'+aStr['rating_desc']+'
'+aStr['rating_text']+'
'; - $.colorbox({maxwidth: "50%", maxHeight: "50%", html: html }); + $.colorbox({maxwidth: "50%", maxHeight: "50%", html: html, close: 'X' }); } -- cgit v1.2.3 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') 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 From 48a145a8ed341c1f28f941be2eaab053c172e3f1 Mon Sep 17 00:00:00 2001 From: friendica Date: Wed, 4 Feb 2015 15:52:12 -0800 Subject: add the required js file --- view/js/ratings.js | 34 ++++++++++++++++++++++++++++++++++ 1 file changed, 34 insertions(+) create mode 100644 view/js/ratings.js (limited to 'view/js') diff --git a/view/js/ratings.js b/view/js/ratings.js new file mode 100644 index 000000000..3d48ecca5 --- /dev/null +++ b/view/js/ratings.js @@ -0,0 +1,34 @@ + +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); +} + +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'); +} + -- cgit v1.2.3 From 68978ad1c08daeb55581b95b4328905df42c847b Mon Sep 17 00:00:00 2001 From: friendica Date: Thu, 5 Feb 2015 15:28:46 -0800 Subject: collapse overly-verbose ratings --- view/js/mod_ratings.js | 4 ++++ 1 file changed, 4 insertions(+) create mode 100644 view/js/mod_ratings.js (limited to 'view/js') diff --git a/view/js/mod_ratings.js b/view/js/mod_ratings.js new file mode 100644 index 000000000..0f7cab5e3 --- /dev/null +++ b/view/js/mod_ratings.js @@ -0,0 +1,4 @@ + +$(document).ready(function() { + collapseHeight(); +}); -- cgit v1.2.3