<commit_before>-# -*- coding: utf-8 -*-
.chat_room_top= raw(call_hook(:chat_room_top, :room => @room))
.audio
 %audio{:src => "#{root_path}audio/sound.mp3", :id => :audio}
.yield
 %div.room-info
  %div
   .left
    %h3.title
     - if @room.user == current_user
      = on_the_spot_edit @room, :title
     - else
      = @room.title
   .right
    =image_tag("connection_fail.gif", :class => 'websocket-status', :alt => t(:websocket_status), :title => t(:websocket_status))
    - if logged?
     = form_tag({:controller => :room, :action => :delete, :id => @room}, {:onsubmit => "return confirm('#{t(:are_you_sure_you_want_to_delete_this_room)}');", :action => :post, :class => 'delete-form'}) do
      = image_submit_tag "room_delete.gif", :alt => t(:delete_this_room), :title => t(:delete_this_room)
   .clear
  - unless @room.user.nil?
   %div.room-owner
    = t(:room_created_by) + " "
    %img.profile{:src => @room.user.profile_image_url, :alt => @room.user.screen_name}
    = @room.user.name
  %div.room-date
   = t(:created_at) + " " + l(@room.created_at)
 %div{:id => 'read-more', :class => 'read-more' }
  read more
 .message-list
  - @messages.reverse_each do |message|
   = render :partial => 'message', :locals => { :message => message }
 - if logged?
  .input
   = form_for :chat, :url => {:controller => :chat, :action => :message, :room_id => @room.id }, :html => {:class => :inputarea} do |f|
    =text_area_tag :message, '', :class => :text, :autofocus=>true, :placeholder=> t('placeholder_message')
    =submit_tag t(:send), :class => 'submit red button large', :id => 'send'
.chat_room_bottom= raw(call_hook(:chat_room_bottom, :room => @room))

= content_for :javascripts do
 = javascript_include_tag :on_the_spot
 = javascript_include_tag 'jquery.dropUploader'
 = javascript_include_tag 'jquery.readmore'
 = javascript_include_tag "jquery.websocket"
 = javascript_include_tag "jquery.multiline"
 = javascript_include_tag "jquery.onthespot"
 = javascript_include_tag "jquery.scrollTo-min"
 = javascript_include_tag "jquery.desktopnotify"
 :javascript
  $(function() {
    function autoScroll(){
      $(window).scrollTo( $(".message-list .message:last"), 500, { easing:'swing', queue:true, axis:'y' } );
    }

    // on the spot
    function onTheSpot(dom){
      // You can edit your own message
      if (dom.find('.screen-name').text() == "#{current_user.nil? ? '' : current_user.screen_name}") {
        var body = dom.find(".body");
        body.onTheSpot({
          url  : '#{url_for(:action => 'update_message_on_the_spot')}',
          data : body.attr("original")
        });
        dom.find(".edit").bind("click",function(){ body.trigger("onTheSpot::start"); });

        // show edit button
        dom.hover(function(e) {
          $(this).find('.edit-icons').fadeIn();
        },function(e){
          $(this).find('.edit-icons').fadeOut();
        });
      }
    }
    $(".message").each(function(_, e){
      onTheSpot( $(e) );
    });

    // make div.message from object
    function makeElement(message){
      var dom = $(message.view);
      onTheSpot(dom);
      return dom;
    }
    $(".message-list").webSocket({ makeElement : makeElement, room : #{@room.id} });

    // read more button
    $("#read-more").readMore({
      id : function(){ return $(".message").first().attr("target"); },
      container : ".message-list",
      content : ".message",
      url : "#{url_for(:action => :prev)}",
      indicator : #{image_tag('ajax-loader.gif').inspect}
    });
<commit_msg>削除ボタンを押したときの処理を追加 refs #411<commit_after>-# -*- coding: utf-8 -*-
.chat_room_top= raw(call_hook(:chat_room_top, :room => @room))
.audio
 %audio{:src => "#{root_path}audio/sound.mp3", :id => :audio}
.yield
 %div.room-info
  %div
   .left
    %h3.title
     - if @room.user == current_user
      = on_the_spot_edit @room, :title
     - else
      = @room.title
   .right
    =image_tag("connection_fail.gif", :class => 'websocket-status', :alt => t(:websocket_status), :title => t(:websocket_status))
    - if logged?
     = form_tag({:controller => :room, :action => :delete, :id => @room}, {:onsubmit => "return confirm('#{t(:are_you_sure_you_want_to_delete_this_room)}');", :action => :post, :class => 'delete-form'}) do
      = image_submit_tag "room_delete.gif", :alt => t(:delete_this_room), :title => t(:delete_this_room)
   .clear
  - unless @room.user.nil?
   %div.room-owner
    = t(:room_created_by) + " "
    %img.profile{:src => @room.user.profile_image_url, :alt => @room.user.screen_name}
    = @room.user.name
  %div.room-date
   = t(:created_at) + " " + l(@room.created_at)
 %div{:id => 'read-more', :class => 'read-more' }
  read more
 .message-list
  - @messages.reverse_each do |message|
   = render :partial => 'message', :locals => { :message => message }
 - if logged?
  .input
   = form_for :chat, :url => {:controller => :chat, :action => :message, :room_id => @room.id }, :html => {:class => :inputarea} do |f|
    =text_area_tag :message, '', :class => :text, :autofocus=>true, :placeholder=> t('placeholder_message')
    =submit_tag t(:send), :class => 'submit red button large', :id => 'send'
.chat_room_bottom= raw(call_hook(:chat_room_bottom, :room => @room))

= content_for :javascripts do
 = javascript_include_tag :on_the_spot
 = javascript_include_tag 'jquery.dropUploader'
 = javascript_include_tag 'jquery.readmore'
 = javascript_include_tag "jquery.websocket"
 = javascript_include_tag "jquery.multiline"
 = javascript_include_tag "jquery.onthespot"
 = javascript_include_tag "jquery.scrollTo-min"
 = javascript_include_tag "jquery.desktopnotify"
 :javascript
  $(function() {
    function autoScroll(){
      $(window).scrollTo( $(".message-list .message:last"), 500, { easing:'swing', queue:true, axis:'y' } );
    }

    // on the spot
    function onTheSpot(dom){
      // You can edit your own message
      if (dom.find('.screen-name').text() == "#{current_user.nil? ? '' : current_user.screen_name}") {
        var body = dom.find(".body");
        body.onTheSpot({
          url  : '#{url_for(:action => 'update_message_on_the_spot')}',
          data : body.attr("original")
        });
        dom.find(".edit").bind("click",function(){ body.trigger("onTheSpot::start"); });
        dom.find(".delete").bind("click",function(){
          if(confirm(#{t(:are_you_sure_you_want_to_delete_this_message).inspect})){
            // http://travisonrails.com/2009/05/20/rails-delete-requests-with-jquery
            var id = dom.attr("target");
            jQuery.post(
              '#{url_for(:controller=>'api/v1/message', :action=>'destroy')}' + '/../' + id,
              { 'id' : id, _method: 'delete' });
          }
        });

        // show edit button
        dom.hover(function(e) {
          $(this).find('.edit-icons').fadeIn();
        },function(e){
          $(this).find('.edit-icons').fadeOut();
        });
      }
    }
    $(".message").each(function(_, e){
      onTheSpot( $(e) );
    });

    // make div.message from object
    function makeElement(message){
      var dom = $(message.view);
      onTheSpot(dom);
      return dom;
    }
    $(".message-list").webSocket({ makeElement : makeElement, room : #{@room.id} });

    // read more button
    $("#read-more").readMore({
      id : function(){ return $(".message").first().attr("target"); },
      container : ".message-list",
      content : ".message",
      url : "#{url_for(:action => :prev)}",
      indicator : #{image_tag('ajax-loader.gif').inspect}
    });

{'fraction_non_alphanumeric': 0.19382321618743345, 'fraction_numerical': 0.003194888178913738, 'mean_word_length': 3.263904653802497, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 75, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 2, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1182224', 'n_tokens_mistral': 2589, 'n_tokens_neox': 2509, 'n_words': 460}