This commit is contained in:
BoHung Chiu 2022-11-18 20:34:44 +08:00
parent 2b0f915f35
commit 5982ade025
1 changed files with 12 additions and 1 deletions

View File

@ -1,6 +1,7 @@
<div class="input-prepend input-append start-line">
<% url_id = "#{f.object_name.gsub(/[\[\]]+/, '_')}url" %>
<span class="add-on icons-link" title="<%= t(:url) %>"></span>
<%= f.text_field :url, class: "input-large", placeholder: t(:url) %>
<%= f.text_field :url, class: "input-large", placeholder: t(:url), id: url_id %>
<span class="add-on icons-pencil" title="<%= t(:url_alt) %>"></span>
<span class="tab-content">
<% @site_in_use_locales.each_with_index do |locale, i| %>
@ -23,4 +24,14 @@
<%= f.hidden_field :_destroy, :value => nil, :class => 'should_destroy' %>
</span>
<% end %>
<script type="text/javascript">
$('#<%=url_id%>').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);
});
</script>
</div>