<commit_before><%= coffee do %>
  $ ->

  $(".comment-add").click (event)->
    text = $('#s_comment_body').val()
    if text.length > 0
      $(@).css('pointer-events', 'none')
      $.ajax
        url: "<%= @idea.comment_add_url %>"
        type: "POST"
        data: { comment_body : text, authenticity_token: "<%= form_authenticity_token %>" }
        success: (data)->
          $("#idea-comments").html data
    event.preventDefault()

  $(".comment_delete").click (event)->
    $.ajax
      url: "<%= @idea.comment_delete_url %>"
      type: "POST"
      data: { comment : $(this).attr("id"), authenticity_token: "<%= form_authenticity_token %>" }
      success: (data)->
        $("#idea-comments").html data
    event.preventDefault()

  $(".comment .label a").colorbox({ fixed: true, width: "300px", height: "50%" })

<% end %>

  <div class="info-wrap">

    <div class="comments">
      <% @comments.each do |comment| %>
        <div class="comment">
          <div class="text">
            <% if comment.comment_deleted %>
            <%= I18n.t("opendata.labels.delete_comment") %>
            <% else %>
            <%= simple_format(h(comment.text)) %>
            <% end %>
          </div>
          <% if @comment_mode && [@idea.member_id, comment.member_id].include?(@cur_member.id) %>
          <%= link_to I18n.t("opendata.labels.delete"), "", class: "comment_delete", id: comment.id if comment.comment_deleted.nil? %>
          <% end %>

          <% if comment.member %>
          <%= link_to comment.member.name, "#{member_path}#{comment.member_id}" %>
          <% elsif comment.contact_group %>
          <%= comment.contact_group.full_name %>
          <% elsif comment.user.groups %>
          <%= comment.user.groups.first.name %>
          <% else %>
          <%= I18n.t("opendata.labels.guest_user") %>
          <% end %>

          <%= tryb{comment.updated.strftime("%Y年%1m月%1d日 %1H時%1M分")} %>
        </div>
      <% end %>
    </div>

    <% if @comment_mode %>
      <%= form_for :s, url: "", html: { class: "opendata-add-comment-form", method: :get } do |f| %>
        <dl class="comment-body">
          <dt>本文</dt>
          <dd><%= f.text_area :comment_body, maxlength: "400" %></dd>
        </dl>
        <%= link_to I18n.t("opendata.labels.add_comment"), "", class: "comment-add" %>
      <% end %>
    <% else %>
      <div class="invite"><%= I18n.t("opendata.labels.comment_invite_start") %><%= link_to I18n.t("opendata.labels.login"),"/mypage/login" %><%= I18n.t("opendata.labels.comment_invite_end") %></div>
    <% end %>

  </div><commit_msg>fix login path<commit_after><%= coffee do %>
  $ ->

  $(".comment-add").click (event)->
    text = $('#s_comment_body').val()
    if text.length > 0
      $(@).css('pointer-events', 'none')
      $.ajax
        url: "<%= @idea.comment_add_url %>"
        type: "POST"
        data: { comment_body : text, authenticity_token: "<%= form_authenticity_token %>" }
        success: (data)->
          $("#idea-comments").html data
    event.preventDefault()

  $(".comment_delete").click (event)->
    $.ajax
      url: "<%= @idea.comment_delete_url %>"
      type: "POST"
      data: { comment : $(this).attr("id"), authenticity_token: "<%= form_authenticity_token %>" }
      success: (data)->
        $("#idea-comments").html data
    event.preventDefault()

  $(".comment .label a").colorbox({ fixed: true, width: "300px", height: "50%" })

<% end %>

  <div class="info-wrap">

    <div class="comments">
      <% @comments.each do |comment| %>
        <div class="comment">
          <div class="text">
            <% if comment.comment_deleted %>
            <%= I18n.t("opendata.labels.delete_comment") %>
            <% else %>
            <%= simple_format(h(comment.text)) %>
            <% end %>
          </div>
          <% if @comment_mode && [@idea.member_id, comment.member_id].include?(@cur_member.id) %>
          <%= link_to I18n.t("opendata.labels.delete"), "", class: "comment_delete", id: comment.id if comment.comment_deleted.nil? %>
          <% end %>

          <% if comment.member %>
          <%= link_to comment.member.name, "#{member_path}#{comment.member_id}" %>
          <% elsif comment.contact_group %>
          <%= comment.contact_group.full_name %>
          <% elsif comment.user.groups %>
          <%= comment.user.groups.first.name %>
          <% else %>
          <%= I18n.t("opendata.labels.guest_user") %>
          <% end %>

          <%= tryb{comment.updated.strftime("%Y年%1m月%1d日 %1H時%1M分")} %>
        </div>
      <% end %>
    </div>

    <% if @comment_mode %>
      <%= form_for :s, url: "", html: { class: "opendata-add-comment-form", method: :get } do |f| %>
        <dl class="comment-body">
          <dt>本文</dt>
          <dd><%= f.text_area :comment_body, maxlength: "400" %></dd>
        </dl>
        <%= link_to I18n.t("opendata.labels.add_comment"), "", class: "comment-add" %>
      <% end %>
    <% else %>
      <div class="invite"><%= I18n.t("opendata.labels.comment_invite_start") %><%= link_to I18n.t("opendata.labels.login"),"#{member_login_path}login.html?ref=#{CGI.escape(@idea.url)}" %><%= I18n.t("opendata.labels.comment_invite_end") %></div>
    <% end %>

  </div>
{'fraction_non_alphanumeric': 0.20744985673352437, 'fraction_numerical': 0.010315186246418338, 'mean_word_length': 2.4311926605504586, 'pattern_counts': {'":': 0, '<': 107, '<?xml version=': 0, '>': 119, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '7657882', 'n_tokens_mistral': 1905, 'n_tokens_neox': 1735, 'n_words': 283}