diff --git a/app/views/admin/web_resources/_form.html.erb b/app/views/admin/web_resources/_form.html.erb index 9625c70..e0c2d79 100644 --- a/app/views/admin/web_resources/_form.html.erb +++ b/app/views/admin/web_resources/_form.html.erb @@ -159,7 +159,7 @@
<%= f.fields_for :url_translations do |f| %> - <%= f.text_field locale, class: "input-block-level", placeholder: t(:url), value: (@link.url_translations[locale] rescue nil) %> + <%= f.text_field locale, class: "input-block-level url_input", placeholder: t(:url), value: (@link.url_translations[locale] rescue nil) %> <% end %>
@@ -244,6 +244,14 @@ filter.destroy(); } ); }); + $('.url_input').on('paste', function(e){ + var pastedData = e.originalEvent.clipboardData.getData('text'); + var _this = $(this); + pastedData = pastedData.replace(new RegExp('^http(s|)://' + window.location.host), ''); + window.setTimeout(function(){ + _this.val(pastedData); + }, 0); + }); }); \ No newline at end of file