Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

rm autopublish, add loading spinner, add TODO section

  • Loading branch information...
commit afd8789bf263d9e8782cac78e1f91ed4acc52461 1 parent 3a86af8
@dandv authored
View
1  .meteor/packages
@@ -3,7 +3,6 @@
# 'meteor add' and 'meteor remove' will edit this file for you,
# but you can also edit it by hand.
-autopublish
insecure
preserve-inputs
jquery
View
6 README.md
@@ -12,3 +12,9 @@ Meteorite will take care of installing the `jquery-rating` dependency.
## Author
[Dan Dascalescu](http://wiki.dandascalescu.com)
+
+
+## TODO
+
+* Update existing ratings
+* Disallow rating the same thing more than once
View
4 jquery-rateit-demo.html
@@ -11,11 +11,15 @@
<div class="rateit" id="add-rating"></div>
<button id="add-button">Add rating</button>
<hr/>
+ {{#if ratingsLoaded}}
<ul>
{{#each ratings}}
<li>{{> rating}}</li>
{{/each}}
</ul>
+ {{else}}
+ <img src="http://upload.wikimedia.org/wikipedia/commons/2/2e/24px-spinner-black.gif">
+ {{/if}}
</template>
<template name="rating">
View
13 jquery-rateit-demo.js
@@ -21,6 +21,16 @@ if (Meteor.isClient) {
});
}
});
+
+ Meteor.subscribe('ratings', function onComplete() {
+ Session.set('ratingsLoaded', true);
+ });
+
+ Template.ratingboard.ratingsLoaded = function () {
+ return Session.get('ratingsLoaded');
+ };
+
+
}
if (Meteor.isServer) {
@@ -31,4 +41,7 @@ if (Meteor.isServer) {
Ratings.insert({what: 'php', rating: 2});
}
});
+ Meteor.publish("ratings", function () {
+ return Ratings.find({});
+ });
}
Please sign in to comment.
Something went wrong with that request. Please try again.