DCod3rBoy
Joined 4/10/2017
DCod3rBoy said almost 8 years ago on User Notifications :
If its not too much to ask. Can you please make a similar video for **activity_notification** gem? Its almost identical to this one, but it may be more optimized. https://github.com/simukappu/activity_notification

DCod3rBoy said over 5 years ago on Hotwire :
Any idea why the form isn't resetting for Turbo after being submitted?? I tested my stimulus controller with a counter button and it has no issue...

reset_form_controller.js

import {Controller} from 'stimulus'

export default class extends Controller {
    static targets = ["button"]
    reset() {
        this.element.reset()
        this.buttonTarget.disabled = false
    }
}

new.html.erb

<%= turbo_frame_tag "new_conversation_conversation_comment", target: "_top" do %>
<%= form_with(model: [@conversation_comment.conversation, @conversation_comment], html: {class: 'form-inline'}, data: {controller: "reset_form", action: "turbo:submit-end->reset_form#reset"}) do |form| %>
 
  <div class="mt-1">
    <%= button_tag(type: :submit, class: 'btn btn-primary btn-sm', style: 'float: right; height: 36px !important; border-radius: 0px !important;') do %>
      Send
    <% end %>
  </div>
  <div style="overflow: hidden;">
    <%= form.text_field :content, placeholder: 'Type your message....', style: 'width: 100% !important; border-radius: 0 !important;' %>
  </div>
<% end %>

<script>
    $(document).ready(function () {
        $("#conversation_comment_content").emojioneArea({
            pickerPosition: "top",
            filtersPosition: "bottom",
            tones: false,
            autocomplete: false,
            inline: true,
            hidePickerOnBlur: false
        });
    });
</script>
<% end %>

conversation - show action.

<div class="col-6">
  <% if @conversation.present? %>
    <%= turbo_stream_from @conversation %>
    <div class="chat-room">
      <%= turbo_frame_tag "conversation" do %>
      <div class="text-center chat-room-title">
        <h5 class="text-light-charcoal"><%= @conversation.title %></h5>
      </div>
      <% end %>
      <div id="conversation_comments">
        <%= render @conversation.conversation_comments %>
      </div>
      <div class="chat-box">
        <%= turbo_frame_tag 'new_conversation_conversation_comment', src: new_conversation_conversation_comment_path(@conversation), target: "_top" %>
      </div>
    </div>
  <% end %>
</div>




DCod3rBoy said over 5 years ago on Hotwire :
This jquery plugin is actually laying on top of the form input itself....But, I don't know exactly how to deal with removing the content inside of it, within a Turbo environment.

<input placeholder="Type your message...." id="conversation_comment_content_1" style="width: 100% !important; border-radius: 0px !important; display: none;" type="text" name="conversation_comment[content]">

<div class="emojionearea emojionearea-inline" role="application">
<div class="emojionearea-editor" contenteditable="true" placeholder="Type your message...." tabindex="0" dir="ltr" spellcheck="false" autocomplete="off" autocorrect="off" autocapitalize="off">No</div>
<div class="emojionearea-button" title="Use the TAB key to insert emoji faster">
<div class="emojionearea-button-open">
</div>
<div class="emojionearea-button-close">
</div>
</div>



DCod3rBoy said over 5 years ago on Hotwire :
I saw that someone else had a similar issue with the emojionearea picker....But, then I tried without it -- there is something wrong with the reset_form controller data-attribute. Its simply not working with turbo itself....I have turbo as a require statement in my webpack application.js. Its working without issue....but the link between turbo and stimulus, are not.

data: {controller: "reset_form", action: "turbo:submit-end->reset_form#reset}

DCod3rBoy said over 5 years ago on Hotwire :
I even added a console log to the reset() function......doesn't show up in the console at all.