From bbb924fcfb70a547758134946846559dc291031b Mon Sep 17 00:00:00 2001 From: Andreas Stephanides Date: Sun, 2 Aug 2015 16:03:01 +0200 Subject: [PATCH] AutoCommit Son Aug 2 16:03:01 CEST 2015 --- app/views/comments/_comment.html.erb | 2 +- app/views/comments/_comments_block.html.erb | 10 +++++----- app/views/comments/hide.js.erb | 2 +- app/views/comments/index.js.erb | 2 +- config/routes.rb | 16 ++++++++++------ 5 files changed, 18 insertions(+), 14 deletions(-) diff --git a/app/views/comments/_comment.html.erb b/app/views/comments/_comment.html.erb index faac3f4..5d71753 100644 --- a/app/views/comments/_comment.html.erb +++ b/app/views/comments/_comment.html.erb @@ -6,7 +6,7 @@ <%= (!comment.anonym) ? comment.user.try(:email) : "Anonym" %> (<%= I18n.l(comment.created_at) %>) - <%= link_to ffi1_icon("remove9"), comment, method: :delete, data: { confirm: 'Are you sure?' }, remote: true %>: + <%= link_to ffi1_icon("remove9"), comment_path(comment), method: :delete, data: { confirm: 'Are you sure?' }, remote: true %>:

<%= comment.text %> <% if can?(:comment, comment.commentable) %> diff --git a/app/views/comments/_comments_block.html.erb b/app/views/comments/_comments_block.html.erb index 6b88bb1..861328d 100644 --- a/app/views/comments/_comments_block.html.erb +++ b/app/views/comments/_comments_block.html.erb @@ -3,9 +3,9 @@

">
<% unless comments_block.comments.roots.empty? %> - -
- <%= render partial:"comments/comments", object: comments_block.comments.order(:created_at).roots.reverse_order if params[:show_comments] %><%# can? fehlt!%> -
- + +
+ <%= render partial:"comments/comments", object: comments_block.comments.order(:created_at).roots.reverse_order if params[:show_comments] %><%# can? fehlt!%> +
+ <% end %> diff --git a/app/views/comments/hide.js.erb b/app/views/comments/hide.js.erb index 35ec342..02b34a5 100644 --- a/app/views/comments/hide.js.erb +++ b/app/views/comments/hide.js.erb @@ -1,3 +1,3 @@ $("#<%= Comment.wrapid_for(@commentable) %>").html("<%= escape_javascript "" %>") -$("#<%= Comment.switchshowid_for(@commentable) %>").replaceWith("<%= escape_javascript link_to "Comments...", comments_path(commentable_type: @commentable.class.to_s, commentable_id: @commentable.id) %>") +$("#<%= Comment.switchshowid_for(@commentable) %>").replaceWith("<%= escape_javascript link_to "Comments...", comments_path(commentable_type: @commentable.class.to_s.gsub("::","_"), commentable_id: @commentable.id), remote: true, id: Comment.switchshowid_for( @commentable) %>") diff --git a/app/views/comments/index.js.erb b/app/views/comments/index.js.erb index 13d7356..2bc3ead 100644 --- a/app/views/comments/index.js.erb +++ b/app/views/comments/index.js.erb @@ -1,2 +1,2 @@ $("#<%= Comment.wrapid_for(@commentable) %>").html("<%= escape_javascript render partial:"comments/comments", object: @comments %>") -$("#<%= Comment.switchshowid_for(@commentable) %>").attr("href","<%= escape_javascript hide_comments_path(commentable_type: @commentable.class.to_s, commentable_id: @commentable.id) %>") + $("#<%= Comment.switchshowid_for(@commentable) %>").replaceWith("<%= escape_javascript link_to "Ausblenden", hide_comments_path(params: {commentable_type: @commentable.class.to_s.gsub("::","_"), commentable_id: @commentable.id}), remote: true , id: Comment.switchshowid_for( @commentable) %>") diff --git a/config/routes.rb b/config/routes.rb index 241a301..a51a3ad 100755 --- a/config/routes.rb +++ b/config/routes.rb @@ -1,5 +1,14 @@ Fetsite::Application.routes.draw do - resources :comments + resources :comments, except: [:show] do + collection do + get 'hide' + end + end + + resources :comments, contstraints: {id: /[0-9]+/}, only: :show + + + namespace :survey do resources :questions do @@ -161,11 +170,6 @@ end end end - resources :comments do - collection do - get 'hide' - end - end resources :home, :only=>[:index] do get :search, :on => :collection collection do