This repository has been archived on 2020-05-27. You can view files and clone it, but cannot push or open issues/pull-requests.
tuxbliki/app/views/pages/new.html.erb

51 lines
1.3 KiB
Plaintext

<%= error_messages_for :page %>
<%= form_for :page, :action => url(:page) do %>
<fieldset>
<legend>Create a page</legend>
<h3 style="margin-top: 10px;">Name</h3>
<p><%= text_field :name, :size => 50 -%></p>
<p><label>Published in blog? <%= check_box :published -%></label></p>
<h3>Department</h3>
<p><%= text_field :department, :size => 50 -%></p>
<h3>Description</h3>
<p><%= text_area :description, :rows => 10, :cols => 70 -%></p>
<h3>Tags</h3>
<p>
<p><a href="#" onclick="$('page_tag_names').value = ''; return false;"><img src="/images/edit-clear.png" style="vertical-align: top;" /></a> <%= text_field :tag_names, :size => 30 -%></p>
<div id="tag_auto_complete" class="auto_complete"></div>
</p>
</fieldset>
<br />
<p><%= submit 'Create' %></p>
<% end =%>
<script type="text/javascript">
//<![CDATA[
new Ajax.Autocompleter(
'page_tag_names',
'tag_auto_complete',
'/tags/auto_complete',
{
paramName: 'id',
updateElement: function(tag_name)
{
var new_tag = tag_name.innerHTML.gsub(/\<[^>]+\>/, '');
var existing_tags = $('page_tag_names').value.gsub(/( |^)[^ ]+$/, '');
var plus_space = (existing_tags.length == 0 ? '' : ' ');
$('page_tag_names').value = existing_tags + plus_space + new_tag;
$('page_tag_names').focus();
}
}
);
//]]>
</script>