When someone puts their email or url in the single input text field. The input will know which action to use whether to email or target blank the url. thanks
I’m not sure I fully understand the question. I’m assuming this is for Rails?
So you have a textfield where someone could enter either a URL or email address, and then based on what it is you want to generate the correct link?
You’d need to figure out a conditional that determines whether something is a URL or email address and then render it accordingly.
For example something like:
if @value.contains?(“@“)
mailto @value
else
linkto @value
end
This isn’t perfect because URLs could have @-signs in them, but you can use a method meant to check whether something is a correct URL/email. A simple Google search will return many results.
yes its for rails and yes i want to generate the correct link! right now i have two separate textfields --> it under one div <div>
<%= mail_to 'email', @post.email %>
or
Debugging:
github.com/pry/pry - Pry gem, an alternative to the IRB shell.
github.com/deivid-rodriguez/b… - Byebug gem, you can pinpoint where the bug is in that specific code
STYLES:
rubygems.org/gems/bulma-rails --> add styles to your page, similar to twitter bootstrap
rubygems.org/gems/font-awesom… --> font awesome in embedded Ruby! So good for links
github.com/kaminari/kaminari --> for pagination, lets you break down your collection of items to be broken down
GRITTER GEM rubygems.org/gems/gritter --> users will have notification if they something to the app like sign out, post a question, add an answer. That black box you see that pops up on the upper tight. WIP.chat has this 😄
FWIW, I don't use gritter
. It's just a standard Rails flash notice with some CSS. No Javascript needed.
yes its for rails and yes i want to generate the correct link! right now i have two separate textfields --> it under one div <div>
<%= mail_to 'email', @post.email %>
or
<%= link_to 'website', @post.email %> </div> . Ah okay I'll look into it. Thanks WIPGod!