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

50 lines
1.4 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_control :name, :size => 50 %></p>
<p><%= checkbox_control :published, :label => ' Published in blog?', :value => "1" %></p>
<h3>Department</h3>
<p><%= text_control :department, :size => 50 %></p>
<h3>Description</h3>
<p><%= text_area_control :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_control 'tag_names', :size => 30 -%></p>
<div id="tag_auto_complete" class="auto_complete"></div>
</p>
</fieldset>
<br />
<p><%= submit_button '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>