1

This is probably really simple, but how can I make this link_to

<%= link_to("Send " + @user.first_name + " a message" , @conversation) %>

into a button in an .inky file?

Note: here is how to make a button in an .inky file (I just don't know how to put the two together):

  <button class="large" href="#">Sign Up</button>

Attempts so far

I think this answer might help, but I still can't get code that works

I'm also trying something like link_to(raw(...), @conversation), but again I can't quite get it working

I also tried this, but the button doesn't appear and the link doesn't work

<% label = "Send " + @user.first_name + " a message" %>
<% raw_html = '<button class="large">' + label + '</button>' %>
<%= link_to(raw(raw_html), @conversation) %>
stevec
  • 41,291
  • 27
  • 223
  • 311

1 Answers1

1

I was really overthinking it. You don't need link_to at all, just give the url directly to the href attribute of the button tag. It's that simple

<button class="large" href="<%= conversation_url(@conversation) %>"><%= "Send " + @user.first_name + " a message" %></button>

enter image description here

stevec
  • 41,291
  • 27
  • 223
  • 311