- available_users = User.admins.to_a + User.managers.to_a - available_users.uniq! #rails_admin_comments_wrapper = stylesheet_link_tag 'rails_admin/rails_admin_comments' = javascript_include_tag 'rails_admin/rails_admin_comments' #rails_admin_comments - url = comments_path(model_name: @abstract_model, id: @object.id) .controls - @comments.each do |c| .comment_block - edit_form_id = "comment_#{c.id}_edit".freeze p - creator = c.creator - if creator - model_name = creator.class.to_param.gsub("::", "~").underscore.freeze = link_to creator.name_for_rails_admin_comments, show_path(model_name: model_name, id: creator._id), class: "creator_link" span.created_at= Russian::strftime c.c_at, "%d.%m.%Y в %H:%M:%S" span.updated_at= " (изм. #{Russian::strftime c.u_at, "%d.%m.%Y в %H:%M:%S"})".freeze if Russian::strftime c.u_at - if creator == current_user or (current_user.respond_to?(:admin?) and current_user.admin?) = link_to 'изменить'.freeze, "##{edit_form_id}".freeze, class: 'comment_edit_form_link'.freeze = " | " = link_to 'удалить'.freeze, "##{edit_form_id}".freeze, class: 'comment_delete_form_link'.freeze p.content_block= c.content p .comment_edit_form.hidden{id=edit_form_id.freeze} - if @comment and @comment._id == c._id - c = @comment - unless @message.blank? p== @message - @comment = @message = nil = form_for c, url: url, method: :post do |f| - if current_user.admin? p= f.collection_check_boxes :visible_for_user_ids, available_users, :id, :name_for_rails_admin_comments p= f.hidden_field :id p= f.text_area :content p= f.submit br hr - @comment ||= RailsAdminComments::Comment.new p - unless @message.blank? p== @message = form_for @comment, url: url, method: :post do |f| - if current_user.admin? - if @comment.visible_for_users.blank? - @comment.visible_for_users << available_users.select { |u| u.roles.include?("admin")} p= f.collection_check_boxes :visible_for_user_ids, available_users, :id, :email p= f.text_area :content p= f.submit