Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added rerating options and fixed two bugs #47

Closed
wants to merge 7 commits into from

Conversation

ElvinEfendi
Copy link

Fixed bugs:

  • readOnly option was not set properly
  • In rating_for helper disable_after_rate option was being true even if you set options[:disable_after_rate] = false

Rerating functionality:
Now developers can toggle between allowing rerating and no allowing but sending flag while calling letsrate_rateable method

Added documentation for using allow_rerating flag

@yozzz
Copy link

yozzz commented Oct 4, 2013

Hi, can you say me please, how can I set readonly option for specific rating_for field and make that user can rate only ones?

@ElvinEfendi
Copy link
Author

Hi, @yozzz. If you are using my fork you can do it as follow:
rating_for @your_object, "dimension", {disable_after_rate: false}

@yozzz
Copy link

yozzz commented Oct 4, 2013

Sorry for question... you have two main folders generators and letsrate. From generators/letsrate/templates I copied two files as letsrate.js.coffee.erb and rater_controller.rb. In main folder letsrate you have files as helpers.rb, model.rb and version.rb , where I should put it with file letsrate.rb that requires them? After installing gem I don't see similar files.
Thank you for understanding! :)

@ElvinEfendi
Copy link
Author

@yozzz you do not need to copy any file. Just install the gem as follow and use the helper in a way I mentioned above:
gem 'letsrate', git: "https://github.com/ElvinEfendi/letsrate.git"

@yozzz
Copy link

yozzz commented Oct 6, 2013

Thought I can't install gem from fork repository, thanks. After command rails g letsrate user getting:
/home/yoz/.rvm/gems/ruby-1.9.3-p448/gems/activesupport-3.2.13/lib/active_support/depend
encies.rb:251:in `require': /home/yoz/.rvm/gems/ruby-1.9.3-p448/bundler/gems/letsrate-b
ce8544a4d49/lib/letsrate/model.rb:62: syntax error, unexpected tLABEL (SyntaxError)
def letsrate_rateable(*dimensions, allow_rerating: false)

@ElvinEfendi
Copy link
Author

@yozzz The changes I made mistakenly was only Ruby 2.0 compatible - I had used keyword arguments. I've just corrected it and now it should work with Ruby 1.9.* as well. You can reinstall and check it again.

@yozzz
Copy link

yozzz commented Oct 6, 2013

I will try it thank you! Is there some way in this gem output stars that
start count from one, I mean first star active by default?

@muratguzel
Copy link
Owner

Hi .. For a long time, I have not enough time to mange this gem. But nowadays I'm available. You can check this issue 2-3 days later. Thanks ...

@ericaBradford
Copy link

@ElvinEfendi In your generator file you have copy_file 'letsrate.js.cofee.erb', 'app/assets/javascripts/letsrate.js.coffee.erb'. Coffee is mispelled, causing issues.

@ElvinEfendi
Copy link
Author

@ericaBradford it seems like the issues I've targeted with this pull requests are already fixed without merging anyway.

@ElvinEfendi ElvinEfendi closed this May 7, 2014
@ericaBradford
Copy link

@ElvinEfendi How do we change data-disable-after-rate? I can't seem to find how to fix it...

@ElvinEfendi
Copy link
Author

@ericaBradford when calling rating_for or rating_for_user method just set disable_after_rate: true

check the helper methods' implementation for more info: https://github.com/muratguzel/letsrate/blob/master/lib/letsrate/helpers.rb

@ericaBradford
Copy link

@ElvinEfendi Thank you!!!

@ericaBradford
Copy link

@ElvinEfendi I don't know why, but it isn't working...
<%= rating_for @recipe, "Rating", :disable_after_rate => false %>
Am I doing something wrong? I'm trying to make recipes reratable, so I'm pretty sure it's supposed to be set false

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants