- content_for :page_scripts do function updated(id, moderated, visible) { var mod; var nmod; var vis; var vnmod; if (moderated==0) { mod = 'No'; nmod = 1; } else { mod = 'Yes'; nmod = 0; } if (visible==0) { vis = 'No'; vnmod = 1; } else { vis = 'Yes'; vnmod = 0; } $('#mod_link_' + id + ' a').text(mod).attr('href', '/admin/dashboard/user_comment/' + id + '?comment[is_moderated]='+nmod); $('#vis_link_' + id + ' a').text(vis).attr('href', '/admin/dashboard/user_comment/' + id + '?comment[is_visible]='+vnmod); } - content_for :main do %h1.user_icon User Comments .links = form_tag "/admin/dashboard/user_comments", :method=>:get do Moderated: = check_box_tag(:moderated, "1", params[:moderated]=="1") Unmoderated: = check_box_tag(:unmoderated, "1", params[:unmoderated]=="1" ) Visible: = check_box_tag(:visible, "1", params[:visible]=="1") Not visible: = check_box_tag(:invisible, "1", params[:invisible]=="1") = submit_tag "Show" %table.comments.loosen(style="margin: 10px 0;") %tr %th(width='300') URL %th(width='200') User %th Moderated %th Visible %th Delete - @comments.each do |comment| %tr(class="comment_#{comment.id}") %td = link_to comment.url, comment.url %td = link_to_if comment.user_id!=0, comment.user_email, "/admin/user/#{comment.user_id}" %td(id="mod_link_#{comment.id}") = icon_to comment.is_moderated? ? 'Yes' : 'No', "/admin/dashboard/user_comment/#{comment.id}?comment[is_moderated]=#{comment.is_moderated? ? 0 : 1}", false, :method=>:post, :remote=>true %td(id="vis_link_#{comment.id}") = icon_to comment.is_visible? ? 'Yes' : 'No', "/admin/dashboard/user_comment/#{comment.id}?comment[is_visible]=#{comment.is_visible? ? 0 : 1}", false, :method=>:post, :remote=>true %td(id="delete_link_#{comment.id}") = icon_to "Delete", "/admin/dashboard/user_comment/#{comment.id}?delete=1", false, :method=>:post, :remote=>true, :confirm=>"Are you sure?" %tr(class="comment_#{comment.id}") %td(colspan="5") .info Name: = comment.user_name .info Email: = comment.user_email .info URL: = link_to comment.user_url, comment.user_url %br = field_reveal(comment.body, 200) %hr