seems_rateable 1.0.2 → 1.0.3

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,15 +1,15 @@
1
1
  ---
2
2
  !binary "U0hBMQ==":
3
3
  metadata.gz: !binary |-
4
- MDIyYWVmMmNkMzAyNGI2MzcwNzdhZjdlNTA3ZWQ5MmFkNTcwNjgzOQ==
4
+ NzFiYjRmZWFiY2RmOTJhY2ZhNzRhMGNjNGU2YTM3ZDFiYzY2ZjBkYg==
5
5
  data.tar.gz: !binary |-
6
- NThmYmIwN2M1OWNiY2Y3OGM2MzIyNDUyYTI5MTZmNmQyZGM4Yzc2OA==
6
+ ZDY1ZDJhNDI0NDY3MDQ4NjBlZWJmYTQ1YTIzNThjMTgwZWEyODdkMQ==
7
7
  !binary "U0hBNTEy":
8
8
  metadata.gz: !binary |-
9
- ZjViZTcyMDJjYzU3MTc0ZjhiZmI0ZGQxMzc1ZDBjMjVmNzUzZTMzNmMxNTQ1
10
- YzA2ODYwNTlkMzVjMDQ4MzEwNGZmY2ViMjAxNTRhOTAyYWI5ZWU2YjFkMGE3
11
- YzNmZmZjYTRlMjJhMDEyYWIxN2NiZjkyMmQ1OGQyYzk0NGVmNTE=
9
+ NmQ2NjA3NDM0NzY0ODkyYmZmYzZjMWM2ZDZlNTg2MWM3MGRlMDA5MzJiNWVi
10
+ MDgwZDkwNDJjMjJhNjBjZjljY2IwN2MyOTE3OTQxMTBiODkyYTM1ZDhjNDlm
11
+ N2RiMzRjNTcyN2MxMzg4ODQ3ZmU4NDM1ODYwYzA2MmZmMDc0MGM=
12
12
  data.tar.gz: !binary |-
13
- NWUxNDc0Y2Q5YjhkNGU2YzcwNWQ1Mjk5NGVkOGMxMzA3YmNkOGExMTdmZTFm
14
- YTU4ODkzNmM2MmM4MjUyY2Q0ZTRlM2JhZThhODA3OTBjY2QwYmIxNGIxZWE2
15
- MmJjODZjMDhiYWU5OTdiOGJiYjllYWE3NzM3MGMwMDcyNGM0NDE=
13
+ NGNlZGE5MmExNDcyNzIzZmUwOWJmODZhMWVkODNjOTdhM2VmNDc2YmNkMmRm
14
+ MjZkNmFlOTFjOGMwMWM3YjE2ZjY0MzQ2ZGY3ZGNiZDMwMGEzNjdlZTQ4ODcz
15
+ MjgzYWUyNjg1OGIyNzcxMzhiN2YzNWZhNzU3MWU0ZjJkYzg1ZWY=
data/.gitignore CHANGED
@@ -15,3 +15,5 @@ spec/reports
15
15
  test/tmp
16
16
  test/version_tmp
17
17
  tmp
18
+ .project
19
+ .rvmrc
data/README.md CHANGED
@@ -1,8 +1,14 @@
1
1
  # SeemsRateable
2
2
 
3
- TODO: Write a gem description
3
+ Star rating gem for Rails application using jQuery plugin jRating
4
4
 
5
- ## Installation
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
- ## Usage
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 "rateable/jRating.jquery"
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]#, "data-size" => "small"
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
- end
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).first
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
 
@@ -1,3 +1,3 @@
1
1
  module SeemsRateable
2
- VERSION = "1.0.2"
2
+ VERSION = "1.0.3"
3
3
  end
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.2
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-14 00:00:00.000000000 Z
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