cebdfb35d7
- store and redirect urls without protocol - update README - increment counter with SQL COALESCE - add linksHelper - update tests
15 lines
1.0 KiB
Plaintext
15 lines
1.0 KiB
Plaintext
<%= form_with model: Link.new, url: links_path(@link), data: { action: 'ajax:success->links#onCreateLinkSuccess ajax:error->links#onCreateLinkError' } do |f| %>
|
|
<div class="col-span-3 sm:col-span-2">
|
|
<label for="company_website" class="text-lg leading-6 font-medium text-gray-900">
|
|
URL Shortener
|
|
</label>
|
|
<div class="mt-4 flex rounded-md shadow-sm">
|
|
<%= f.text_field :url, pattern: '(https?:\/\/)?(www\.)?([a-zA-Z0-9_-]+\.)+[a-zA-Z]{2,}(\.[a-zA-Z]{2,})?([\/?#][^\s]*)?', data: { target: "links.url" }, placeholder: "https://google.com", class: "focus:ring-indigo-500 focus:border-indigo-500 flex-1 block w-full rounded-none rounded-md sm:text-sm border-gray-300" %>
|
|
</div>
|
|
</div>
|
|
|
|
<div class="py-3 text-right">
|
|
<%= f.submit "Shorten", class: "inline-flex w-full sm:w-auto justify-center py-2 px-4 border border-transparent shadow-sm text-sm font-medium rounded-md text-white bg-indigo-600 hover:bg-indigo-700 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-indigo-500" %>
|
|
</div>
|
|
<% end %>
|