Threads for dickdavis

    1. 3

      Interesting, I haven’t experienced that problem yet, but my approach seems to slightly differ from yours. I’ve found that including the turbo_stream.* actions within the controller can get messy quick, so I’ve been putting them all in *.turbo_stream.erb templates. I wonder if refactoring the provided example to something like what I have below might work.

      The refactored controller action:

        # app/controllers/messages_controller.rb
        def create
          @message = Message.create!(params.require(:message).permit(:content))
      
          respond_to do |format|
            format.turbo_stream { render :create_success }
            format.html { redirect_to messages_url }
          end
        end
      

      The turbo stream action extracted to a template:

      <!-- app/views/messages/create_success.html.erb -->
      <%= turbo_stream.append :messages do %>
        <%= render partial: "messages/message", locals: { message: @message, user: current_user })
      <% end %>
      

      The message partial, adjusted to reference the user local instead of the current_user:

      <!-- app/views/messages/_message.html.erb -->
      <div id="<%= dom_id message %>">
        <span class="from">
          <% if message.user == user %>
            You
          <% else %>
            <%= message.user.name %>
          </span>:
        <%= message.content %>
      </div>
      

      The stimulus controller was an interesting hack, but probably not ideal as your codebase grows as it would result in a lot of one-off stimulus controllers that only serve as workarounds.

        1. 14

          Promoting tool that creates “beautiful” graphic without any showcase is at least weird.

          EDIT: Assuming that author uses this tool on their own blog it looks like that.

          1. 3

            I think it is more like that, given that the autor has mentioned the author of the original idea (???) in a tweet, and I have found this repo under that name. And the graphic seems pretty similar to the one shown in the original repo.

            But how did it all happen, is this copied or what… I do not have an idea…

            1. 1

              algoheader is a CLI frontend to the ascii-to-svg library that does a couple things that simplify/automate using that library. It’s listed in the dependencies, but I’ll update the README to feature that gem more prominently so that there’s no confusion.

            2. 1

              Haven’t had a chance to update my blog with any of the generated images yet, but I’ll be sure to add examples to the README.

              1. 1

                Nice, this seems to be a great idea. I’ve struggled to find a good instance to join, but this looks promising. I really like how the post rules state: “All top-level posts must be directly related to FOSS development.” I think this will serve to maintain a better signal-to-noise ratio. I sent my request to join to the operator.