Sha256: 2e21edf27392d038de5c3a78191814d4224f747dc65471883b411a47385d520b

Contents?: true

Size: 1.61 KB

Versions: 15

Compression:

Stored size: 1.61 KB

Contents

<% content_for :page_scripts do %>

function insert(link) {
	parent.insert_content(link);	
	parent.close_assets('link');
}

function get_link(force_new_page) {
		l = "<a ";
		if (force_new_page || $('input[name=target]').is(':checked')) {
			l += "target='_blank' ";
		}
		l += "href='";
		u = $('input[name=url]').val();
		if (u.indexOf('/')!=0) {
			protocol_pos = u.indexOf('://');
			if (protocol_pos<0) {
				u = "http://" + u;
			}
		}
		l += u;
		l += "' ";
		l += 'title="';
		l += $('input[name=title]').val();
		l += '" >';
		l += $('input[name=link]').val();
		l += "</a>";
		return l;
	}
	
	function insert_link() {
		insert(get_link(false));
	}
	
	$(document).ready(function() {
		$('input[name=link],input[name=url],input[name=title]').observe_field(0.2, function() {
			$('#selected_link').html(get_link(true));
		});
	});
	
<% end %>

<div id="asset_link">
	
	<div>Link: <%= text_field_tag :link, "", {:style=>"width: 300px;"} %>
		<div class="popup_hint">The text of the link (i.e. the words on which the user will click)</div>
	</div>
	
	<div>URL: <%= text_field_tag :url, "", {:style=>"width: 300px;"} %>
		<div class="popup_hint">A full URL such as http://www.google.com or a local path /info/contact-us</div>
	</div>
	
	
	<div>Open in new page: <%= check_box_tag :target, "_blank" %></div>
	
	<div>Title: <%= text_field_tag :title, "" %>
			<div class="popup_hint">Text that will appear when a user hovers over the link</div>
	</div>

	<div>Test Link: <span id="selected_link"></span>
		<div class="popup_hint">Will open in a new window</div>
	</div>
	
		
	<p><%= button_to_function "Insert", "insert_link();" %></p>
	

</div>

Version data entries

15 entries across 15 versions & 1 rubygems

Version Path
kit_cms-2.3.22 app/views/assets/manager/_link.html.erb
kit_cms-2.3.20 app/views/assets/manager/_link.html.erb
kit_cms-2.3.19 app/views/assets/manager/_link.html.erb
kit_cms-2.3.18 app/views/assets/manager/_link.html.erb
kit_cms-2.3.17 app/views/assets/manager/_link.html.erb
kit_cms-2.3.16 app/views/assets/manager/_link.html.erb
kit_cms-2.3.15 app/views/assets/manager/_link.html.erb
kit_cms-2.3.14 app/views/assets/manager/_link.html.erb
kit_cms-2.3.13 app/views/assets/manager/_link.html.erb
kit_cms-2.3.11 app/views/assets/manager/_link.html.erb
kit_cms-2.3.10 app/views/assets/manager/_link.html.erb
kit_cms-2.3.9 app/views/assets/manager/_link.html.erb
kit_cms-2.3.8 app/views/assets/manager/_link.html.erb
kit_cms-2.3.7 app/views/assets/manager/_link.html.erb
kit_cms-2.3.6 app/views/assets/manager/_link.html.erb