draiken / opinio Goto Github PK
View Code? Open in Web Editor NEWA rails 3 comments engine
License: MIT License
A rails 3 comments engine
License: MIT License
How to display user Avatar next to comment. ?
Hi there,
I'm quite new to rails, and even if I got your engine working, I can't figure out how to enable the delete method (I guess I didn't understand your explanation) and the reply feature (I'v uncommented it in the initializer, but it still doesn't work, or I receive NoMethod Error on the methods in it).
Could you be more specific about how to enable these?
My commentable model is Project.
Many thanks (for your awesome engine as well!),
Laetitia
Please go through this blog
http://www.tweetegy.com/2013/04/create-nested-comments-in-rails-using-ancestry-gem/
Or maybe just wrap them in a div so I can display: none on them?
Thanks :)
Pete
Luiz, thanks a lot for building this, I really appreciate it.
Within one of my views, I am trying to output the comments count per post:
<%= post.comments.size %>
This is only yeilding the number of parent comments. It is not including the replies. How do I get the total number of comments per post, including the replies? Where is this gem storing the comment replies?? How do I search through the replies from my rails console?
Also, how do I get the JavaScript to automatically hide the reply link for any reply comment, right now you have to refresh the page for the reply link to disappear under a second level/reply comment.
Greetings,
Thanks so much for an awesome gem. I'm hung up on customizing the destroy conditions however. Would you be able to expand on this section of the documentation at bit (perhaps with an example)? Do you intend for the comment_destroy_conditions code block to go in an overrided comments controller's delete action?
Any additional information would be greatly appreciated to show the context in which this code block should live.
Thanks!
Do you have any demo sites using opinio?
I think this would be useful on the README.
Hi, I'm sorry this suppose to be really easy ... but I can't figure it out. (doh) I have the 'devise' for user reg and aut. Opinio has nicely cached the users' id from devise. How can I show usernames next to comments instead of id? I have username field in the users tab.
In the v0.6 branch Gemfile-rails-3.0.x and Gemfile-rails-3.1.x files are not present.
This prevent bundler fron installing the gem.
Can you fix it? I am looking forward to test on that branch.
regards
A user cancels his account, how do I set up dependent destroy scenario with comments?
Is it possible to change the redirect_to
action used when a comment is successfully created?
Given two problems:
/admin
)show
Hi there,
Opinio seems really cool and I'm about to use it but I'm using https://github.com/rails/strong_parameters in my project and Opinio doesn't seem to handle it.
I wanted to do it and to propose a pull request but I don't really understand how gems and Gemfile are handled in this project.
We have to Gemfiles for rails 3.0 and 3.1, but what about rails 3.2 ?
I've probably missed something, could you explain what's the process to participate to this project.
How difficult would this be to implement? If you could just write out what you'd do, I'd love to try. Just not sure if it's an issue with the models being structured how they are, or..
Thanks for a great gem :)
whether the opinio support mongodb?
opinio/lib/opinio/opinio_model/validations.rb
validates :owner, :presence => true, :associated => true
Using just :presence => true
on the owner checks the table to see if it exists, at least while using Rails 3.2.19 and testing it in the console. Trying to use an owner_id that doesn't exist will fail validation.
Using :associated => true
makes it more difficult to add a new required field. For example, a phone number is now required, but forcing existing users to immediately provide one so their user record is considered valid and they can comment again is probably overkill.
Perhaps this has changed in Rails? I've read conflicting questions / answers on the topic ...
Hi, I added 2 minor features that was usefull to me, it's on my fork https://github.com/fred/opinio/tree/fred
The features I added:
if you are interested I can send pull request.
and sorry, not rspec tests :D
thanks for the awesome plugin.
Hello.
At first, thanks for this plugin.
I did a little contribution: possibility to generate haml views https://github.com/eicca/opinio/commit/75692f6b207e5f035e5c9f6874598b41aba0b72f
I think this is not the best solution, since views twice copied in the project. Sorry, but I have not enough skill in the development of gems.
Can you suggest a better way to do this?
And I also wanted to make a bootstraped version. Does this make sense?
I have a nested resource, and whenever comments are made, they store properly, but both reply and delete buttons are always available to all users (e.g., another user sees the delete button for other users' comments, and a user sees a reply button for his own comments, as well as reply buttons for replies).
Any idea where to start looking for a fix?
Hi,
I think it could be could to be able to add a counter cache for opinio_subjectum
, I've tried to add belongs_to :my_model, counter_cache: true
in comments.rb, but to no avail.
Any idea is welcome!
We are using render_comments @articles
in our view to show the comments. And we have added the paginate comments
to show the pagination links. The pagination adds ?page=N
to the URL and which loads the same page with the partial.
I checked the helper (lib/opinio/controllers/helpers.rb) and found that the render_comments method passing comments value as object.comments.page(1).limit(limit)
. Here the page value is hard coded to 1, so it won't load the other pages. Can you please help me with a solution?
Thanks!
It seems like users are not really linked to their own comment, and I don't know how to fix it.
Started DELETE "/comments/109?locale=fr" for 127.0.0.1 at 2013-05-16 20:33:08 +0200
Processing by Opinio::CommentsController#destroy as JS
Parameters: {"locale"=>"fr", "id"=>"109"}
Comment Load (0.7ms) SELECT "comments".* FROM "comments" WHERE "comments"."id" = $1 LIMIT 1 [["id", "109"]]
User Load (0.6ms) SELECT "users".* FROM "users" WHERE "users"."id" = 2 LIMIT 1
CACHE (0.0ms) SELECT "users".* FROM "users" WHERE "users"."id" = 2 LIMIT 1
user #User:0x007fde499f3100 tried to remove a comment from another user 2
Rendered text template (0.0ms)
Completed 401 Unauthorized in 33ms (Views: 25.9ms | ActiveRecord: 1.3ms)
Would you have an idea of where I'm missing something? It seems that those two problems have the same origin...
Many thanks again for your time!
Hi,
When I customize the destroy action:
comment_destroy_conditions do |comment|
(comment.owner == current_user) && !current_user.suspended?
end
The server return an http error 500:
Started DELETE "/comments/9" for 127.0.0.1 at 2011-12-20 16:04:55 +0100
Processing by Opinio::CommentsController#destroy as JS
Parameters: {"id"=>"9"}
Comment Load (0.4ms) SELECT "comments".* FROM "comments" WHERE "comments"."id" = $1 LIMIT 1 [["id", "9"]]
User Load (0.8ms) SELECT "users".* FROM "users" WHERE "users"."id" = 2 LIMIT 1
CACHE (0.0ms) SELECT "users".* FROM "users" WHERE "users"."id" = 2 LIMIT 1
Completed 500 Internal Server Error in 277ms
NoMethodError (undefined method `warning' for #<ActiveSupport::BufferedLogger:0x00000104fa8ea8>):
lib/middleware/flash_session_cookie_middleware.rb:16:in `call'
Rendered /Users/francois/.rvm/gems/ruby-1.9.2-p290@witineo/gems/actionpack-3.1.1/lib/action_dispatch/middleware/templates/rescues/_trace.erb (2.3ms)
Rendered /Users/francois/.rvm/gems/ruby-1.9.2-p290@witineo/gems/actionpack-3.1.1/lib/action_dispatch/middleware/templates/rescues/_request_and_response.erb (1.9ms)
Rendered /Users/francois/.rvm/gems/ruby-1.9.2-p290@witineo/gems/actionpack-3.1.1/lib/action_dispatch/middleware/templates/rescues/diagnostics.erb within rescues/layout (7.8ms)
Any ideas ?
I have an app with mountable engine which called menu_with_pages.
Also app has opinio.
gem 'menu_with_pages', :path => "vendor/engines/menu_with_pages"
gem 'opinio'
Also I have model Page from engine:
#coding: utf-8
require "#{MenuWithPages.models_dir}/page"
module MenuWithPages
class Page
opinio_subjectum
end
end
# routes.rb
...
opinio_model
mount MenuWithPages::Engine, :at => "/", :as => "menu_with_pages"
resources 'menu_with_pages/pages' do
opinio # ERROR!
end
At this case I've got an error:
Invalid route name: 'menu_with_pages/page_comments'
Ok. I solve this by writing:
get "/pages/:page_id/comments(/:page)" => "menu_with_pages/opinio/comments#index", :as => page_comments
In my page show view:
= comments_for @page
But I always get this :
ActionView::Template::Error (undefined method `comments_path' for #<#<Class:0x000000049daa90>:0x00000003c8a0c0>):
1: <div id="new_comment">
2: <% if send(Opinio.current_user_method) %>
3: <h3><%= t('opinio.messages.add_comment') %></h3>
4: <%= form_for Comment.new, :remote => false do |f| %>
5: <p>
6: <%= f.text_area :body %>
7: </p>
I think this error provided because i have engines in my app.
And it can be solved by using
main_app.comments_path
But I think it's not good solution.
I get undefined method `num_pages' after installing opinio. Solution?
Hello.
How can i restrict commenting on some resource using CanCan?
Is there anyway to disable pagination? I can't seem to override it with my own controller, and there's no pagination option within the the initializer.
Is it only possible to paginate one set of comments at a time? I have many items commentable in a news feed. I am already using page params on home/index for something else. Any other options for pagination of multiple sets of comments?
Hello,
Does opinio support custom views for displaying comments ?
Thanks,
I have multiple items to comment on a single page. Every UL renders as #comments. Is this fixable? This results in all new comments appending to the first item. Messages about deletion end up here as well.
How to add more data field? I wanna add some data field with the comment.
Quick question: how do you deal with nested commentable? Because right now, it seems like the comments_controller returns to the commentable_path.
Hi, I have a budget
model which is opinio_subjectum
.
How would you touch the model when a comment is created or destroyed?
So far, I'm doing a not so clean (I think)
@comment.commentable.touch
in my views, but I suppose there is another way.
any insight?
thanks, p.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.