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/edit.html.erb

53 lines
1.6 KiB
Plaintext

<%= error_messages_for :page %>
<%= form_for :page, :action => url(:page, :id => @page.name.gsub(/ /, '_')) do -%>
<fieldset>
<legend>Update a page</legend>
<h3 style="margin-top: 10px;">Name</h3>
<p><img src="/images/emblem-readonly.png" alt="Read Only" /> <span style="vertical-align: top"><%= (@page.name) %></span></p>
<h3>Original Author</h3>
<p><img src="/images/emblem-readonly.png" alt="Read Only" /> <span style="vertical-align: top"><%= (@page.author.name) %></span></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>
<p><%= submit 'Update' %></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>