seems_rateable 1.0.2 → 1.0.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +8 -8
- data/.gitignore +2 -0
- data/README.md +16 -4
- data/lib/seems_rateable/helpers.rb +4 -3
- data/lib/seems_rateable/record.rb +2 -2
- data/lib/seems_rateable/version.rb +1 -1
- metadata +2 -4
- data/.project +0 -18
- data/.rvmrc +0 -0
checksums.yaml
CHANGED
@@ -1,15 +1,15 @@
|
|
1
1
|
---
|
2
2
|
!binary "U0hBMQ==":
|
3
3
|
metadata.gz: !binary |-
|
4
|
-
|
4
|
+
NzFiYjRmZWFiY2RmOTJhY2ZhNzRhMGNjNGU2YTM3ZDFiYzY2ZjBkYg==
|
5
5
|
data.tar.gz: !binary |-
|
6
|
-
|
6
|
+
ZDY1ZDJhNDI0NDY3MDQ4NjBlZWJmYTQ1YTIzNThjMTgwZWEyODdkMQ==
|
7
7
|
!binary "U0hBNTEy":
|
8
8
|
metadata.gz: !binary |-
|
9
|
-
|
10
|
-
|
11
|
-
|
9
|
+
NmQ2NjA3NDM0NzY0ODkyYmZmYzZjMWM2ZDZlNTg2MWM3MGRlMDA5MzJiNWVi
|
10
|
+
MDgwZDkwNDJjMjJhNjBjZjljY2IwN2MyOTE3OTQxMTBiODkyYTM1ZDhjNDlm
|
11
|
+
N2RiMzRjNTcyN2MxMzg4ODQ3ZmU4NDM1ODYwYzA2MmZmMDc0MGM=
|
12
12
|
data.tar.gz: !binary |-
|
13
|
-
|
14
|
-
|
15
|
-
|
13
|
+
NGNlZGE5MmExNDcyNzIzZmUwOWJmODZhMWVkODNjOTdhM2VmNDc2YmNkMmRm
|
14
|
+
MjZkNmFlOTFjOGMwMWM3YjE2ZjY0MzQ2ZGY3ZGNiZDMwMGEzNjdlZTQ4ODcz
|
15
|
+
MjgzYWUyNjg1OGIyNzcxMzhiN2YzNWZhNzU3MWU0ZjJkYzg1ZWY=
|
data/.gitignore
CHANGED
data/README.md
CHANGED
@@ -1,8 +1,14 @@
|
|
1
1
|
# SeemsRateable
|
2
2
|
|
3
|
-
|
3
|
+
Star rating gem for Rails application using jQuery plugin jRating
|
4
4
|
|
5
|
-
##
|
5
|
+
## Demo
|
6
|
+
|
7
|
+
<a href="http://rateable.herokuapp.com/">Demo</a> application, requires to sign up before rating
|
8
|
+
|
9
|
+
## Instructions
|
10
|
+
|
11
|
+
### Installation
|
6
12
|
|
7
13
|
Add this line to your application's Gemfile:
|
8
14
|
|
@@ -16,9 +22,15 @@ Or install it yourself as:
|
|
16
22
|
|
17
23
|
$ gem install seems_rateable
|
18
24
|
|
19
|
-
|
25
|
+
### Generation
|
26
|
+
|
27
|
+
$ rails g seems_rateable User
|
28
|
+
|
29
|
+
Generator takes one argument which is name of an existing user model e.g User, Client, Player ... <br>
|
30
|
+
The generator creates necessary model, controller and asset files. It also creates route and migration files that are already migrated
|
31
|
+
|
32
|
+
###
|
20
33
|
|
21
|
-
TODO: Write usage instructions here
|
22
34
|
|
23
35
|
## Contributing
|
24
36
|
|
@@ -1,16 +1,17 @@
|
|
1
1
|
module Helpers
|
2
2
|
def seems_rateable_style
|
3
|
-
stylesheet_link_tag
|
3
|
+
stylesheet_link_tag "rateable/jRating.jquery"
|
4
4
|
end
|
5
5
|
|
6
|
-
def rating_for(obj, opts={:dimension => nil, :static => false})
|
6
|
+
def rating_for(obj, opts={:dimension => nil, :static => false, :id => nil})
|
7
7
|
begin
|
8
8
|
kls = opts[:dimension].nil? ? obj.average : obj.average(opts[:dimension])
|
9
9
|
avg = kls ? kls.avg : 0
|
10
10
|
content_tag :div, "", "data-average" => avg,
|
11
|
+
:id => opts[:id],
|
11
12
|
:class => "rateable#{opts[:static] ? " jDisabled" : nil}#{current_user ? nil : " jDisabled"}",
|
12
13
|
"data-id" => obj.id, "data-kls" => obj.class.name,
|
13
|
-
"data-dimension" => opts[:dimension]
|
14
|
+
"data-dimension" => opts[:dimension]
|
14
15
|
rescue StandardError => error
|
15
16
|
eval "raise 'Rateable object #{obj.inspect} does not exist'"
|
16
17
|
end
|
@@ -56,11 +56,11 @@ module SeemsRateable
|
|
56
56
|
else
|
57
57
|
self.send "#{dimension}_average"
|
58
58
|
end
|
59
|
-
|
59
|
+
end
|
60
60
|
|
61
61
|
def permission(user_id, dimension=nil)
|
62
62
|
#record = connection.select_one("SELECT id FROM rates WHERE rateable_id=#{self.id} and rateable_type='#{self.class.name}' and rater_id=#{user_id} and dimension#{dimension ? "='#{dimension.to_s}'" : " IS NULL"}")
|
63
|
-
record = Rate.where(:rateable_id => self.id, :rateable_type => self.class.name, :rater_id => user_id, :dimension => dimension)
|
63
|
+
record = Rate.where(:rateable_id => self.id, :rateable_type => self.class.name, :rater_id => user_id, :dimension => dimension)
|
64
64
|
record ? false : true
|
65
65
|
end
|
66
66
|
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: seems_rateable
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.
|
4
|
+
version: 1.0.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Peter Toth
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2013-04-
|
11
|
+
date: 2013-04-15 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|
@@ -60,8 +60,6 @@ extensions: []
|
|
60
60
|
extra_rdoc_files: []
|
61
61
|
files:
|
62
62
|
- .gitignore
|
63
|
-
- .project
|
64
|
-
- .rvmrc
|
65
63
|
- Gemfile
|
66
64
|
- LICENSE.txt
|
67
65
|
- README.md
|
data/.project
DELETED
@@ -1,18 +0,0 @@
|
|
1
|
-
<?xml version="1.0" encoding="UTF-8"?>
|
2
|
-
<projectDescription>
|
3
|
-
<name>seems_rateable</name>
|
4
|
-
<comment></comment>
|
5
|
-
<projects>
|
6
|
-
</projects>
|
7
|
-
<buildSpec>
|
8
|
-
<buildCommand>
|
9
|
-
<name>com.aptana.ide.core.unifiedBuilder</name>
|
10
|
-
<arguments>
|
11
|
-
</arguments>
|
12
|
-
</buildCommand>
|
13
|
-
</buildSpec>
|
14
|
-
<natures>
|
15
|
-
<nature>org.radrails.rails.core.railsnature</nature>
|
16
|
-
<nature>com.aptana.ruby.core.rubynature</nature>
|
17
|
-
</natures>
|
18
|
-
</projectDescription>
|
data/.rvmrc
DELETED
File without changes
|