announcement-test/app/views/admin/announcements/_form_link.html.erb

38 lines
1.5 KiB
Plaintext
Raw Permalink Normal View History

2014-05-01 08:41:00 +00:00
<div class="input-prepend input-append start-line">
2022-11-18 12:34:44 +00:00
<% url_id = "#{f.object_name.gsub(/[\[\]]+/, '_')}url" %>
2014-05-01 08:41:00 +00:00
<span class="add-on icons-link" title="<%= t(:url) %>"></span>
2022-11-18 12:34:44 +00:00
<%= f.text_field :url, class: "input-large", placeholder: t(:url), id: url_id %>
2014-05-01 08:41:00 +00:00
<span class="add-on icons-pencil" title="<%= t(:url_alt) %>"></span>
<span class="tab-content">
2014-05-16 09:02:54 +00:00
<% @site_in_use_locales.each_with_index do |locale, i| %>
2014-05-01 08:41:00 +00:00
<span class="tab-pane fade <%= ( i == 0 ) ? "in active" : '' %> <%= locale %>">
<%= f.fields_for :title_translations do |f| %>
<%= f.text_field locale, :class => "input-large", placeholder: t(:url_alt), :value => (form_link.title_translations[locale] rescue nil) %>
<% end %>
</span>
<% end %>
</span>
<% if form_link.new_record? %>
<span class="delete_link add-on btn" title="<%= t(:delete_) %>">
<a class="icon-trash"></a>
</span>
<% else %>
<span class="remove_existing_record add-on btn" title="<%= t(:remove) %>">
<%= f.hidden_field :id %>
<a class="icon-remove"></a>
<%= f.hidden_field :_destroy, :value => nil, :class => 'should_destroy' %>
</span>
<% end %>
2022-11-18 12:34:44 +00:00
<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>
2014-05-01 08:41:00 +00:00
</div>