aboutsummaryrefslogtreecommitdiffstats
path: root/view/js/ratings.js
diff options
context:
space:
mode:
authorfriendica <info@friendica.com>2015-02-05 19:38:43 -0800
committerfriendica <info@friendica.com>2015-02-05 19:38:43 -0800
commit4b348d248975ba07ba9cea62f51eb52d6afb5645 (patch)
treefc60c2d05958c2a458ac72b03e1e7ddffce0c41b /view/js/ratings.js
parentaafed50a0ea8a8d7091572473dcb8e4fb8cd4602 (diff)
parentb948fbaeda84f4358722222b4a2d5555ef10b82e (diff)
downloadvolse-hubzilla-4b348d248975ba07ba9cea62f51eb52d6afb5645.tar.gz
volse-hubzilla-4b348d248975ba07ba9cea62f51eb52d6afb5645.tar.bz2
volse-hubzilla-4b348d248975ba07ba9cea62f51eb52d6afb5645.zip
Merge branch 'master' into tres
Conflicts: view/css/mod_events.css view/theme/redbasic/css/style.css
Diffstat (limited to 'view/js/ratings.js')
-rw-r--r--view/js/ratings.js34
1 files changed, 34 insertions, 0 deletions
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 = '<form id="ratings_form" action="prate" method="post"><input type="hidden" name="target" value="'+hash+'" /><div class="rating-desc">'+aStr['rating_desc']+'</div><input id="dir-rating-range" class="directory-slider" type="text" value="'+ratingVal+'" name="rating" style="display: none;" /><div class="rating-text-label">'+aStr['rating_text']+'<input type="text" name="rating_text" class="directory-rating-text" value="'+ratingText+'" /><br /><input name="submit" class="directory-rating-submit" type="submit" value="'+aStr['submit']+'" onclick="postRatings(); return false;"></form><div class="clear"></div><script>$("#dir-rating-range").jRange({ from: -10, to: 10, step: 1, showLabels: false, showScale: true, scale : [ "-10","-5","0","5","10" ], onstatechange: function(v) { $("#dir-rating-range").val(v); } });</script>';
+
+ $.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');
+}
+