aboutsummaryrefslogtreecommitdiffstats
path: root/view
diff options
context:
space:
mode:
authorfriendica <info@friendica.com>2015-02-03 21:19:29 -0800
committerfriendica <info@friendica.com>2015-02-03 21:19:29 -0800
commit4ead2cd79d3c7e5c29a11785a3ceefef6d3ba93f (patch)
treeb2f366402f79f162471b8285ffbea76dd8f44960 /view
parent86771547e6d04d046d3beeabb8e4486a59a7fcc6 (diff)
downloadvolse-hubzilla-4ead2cd79d3c7e5c29a11785a3ceefef6d3ba93f.tar.gz
volse-hubzilla-4ead2cd79d3c7e5c29a11785a3ceefef6d3ba93f.tar.bz2
volse-hubzilla-4ead2cd79d3c7e5c29a11785a3ceefef6d3ba93f.zip
final cleanup on ratings feature
Diffstat (limited to 'view')
-rw-r--r--view/css/mod_directory.css2
-rw-r--r--view/css/mod_events.css5
-rw-r--r--view/js/mod_directory.js28
-rw-r--r--view/theme/redbasic/css/style.css5
-rwxr-xr-xview/tpl/direntry.tpl2
-rwxr-xr-xview/tpl/js_strings.tpl1
6 files changed, 33 insertions, 10 deletions
diff --git a/view/css/mod_directory.css b/view/css/mod_directory.css
index d4cf23b39..c562764ea 100644
--- a/view/css/mod_directory.css
+++ b/view/css/mod_directory.css
@@ -15,7 +15,7 @@
padding: 15px;
}
-.rating-text {
+.rating-text-label {
margin-top: 30px;
}
diff --git a/view/css/mod_events.css b/view/css/mod_events.css
index 0aef13aa6..ba4ec9b61 100644
--- a/view/css/mod_events.css
+++ b/view/css/mod_events.css
@@ -10,8 +10,3 @@
margin-top: 15px;
width: 400px;
}
-
-.required {
- color: #ff0000;
- font-size: 1.2rem;
-} \ No newline at end of file
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 = '<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="0" name="rating" style="display: none;" /><div class="rating-text">'+aStr['rating_text']+'<input type="text" name="rating-text" class="directory-rating-text" /><br /><input name="submit" class="directory-rating-submit" type="submit" value="submit" ></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>';
+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');
+}
$(document).ready(function() {
collapseHeight();
diff --git a/view/theme/redbasic/css/style.css b/view/theme/redbasic/css/style.css
index cebc516da..cb58b6e11 100644
--- a/view/theme/redbasic/css/style.css
+++ b/view/theme/redbasic/css/style.css
@@ -1185,9 +1185,12 @@ nav .acpopup {
.required {
- color: #FF0000;
+ color: #ff0000;
+ font-size: 1.8rem;
+ margin-left: 5px;
}
+
#event-start-text, #event-finish-text {
margin-top: 10px;
margin-bottom: 5px;
diff --git a/view/tpl/direntry.tpl b/view/tpl/direntry.tpl
index 1b84bca56..b0a1084e8 100755
--- a/view/tpl/direntry.tpl
+++ b/view/tpl/direntry.tpl
@@ -17,7 +17,7 @@
{{if $entry.viewrate}}
<div id="dir-rating-wrapper-{{$entry.id}}" class="directory-rating" >{{if $entry.total_ratings}}<a href="ratings/{{$entry.hash}}"><button class="btn btn-default">{{$entry.total_ratings}}</button></a>{{/if}}
-{{if $entry.canrate}}<button class="btn btn-default" onclick="doRatings('{{$entry.hash}}'); return false;" ><i class="icon-pencil"></i></button>{{/if}}
+{{if $entry.canrate}}<button class="btn btn-default" onclick="doRatings('{{$entry.hash}}'); return false;" ><i class="icon-pencil"></i></button><span class="required" id="edited-{{$entry.hash}}" style="display: none;" >*</span>{{/if}}
</div>
{{/if}}
{{if $entry.public_forum}}
diff --git a/view/tpl/js_strings.tpl b/view/tpl/js_strings.tpl
index 9cfd84cf8..4eb9ae844 100755
--- a/view/tpl/js_strings.tpl
+++ b/view/tpl/js_strings.tpl
@@ -19,6 +19,7 @@
'rating_desc' : "{{$rating_desc}}",
'rating_val' : "{{$rating_val}}",
'rating_text' : "{{$rating_text}}",
+ 'submit' : "{{$submit}}",
't01' : "{{$t01}}",
't02' : "{{$t02}}",