2008-12-15 20:19:22 +01:00
|
|
|
<%-
|
2010-05-26 07:27:49 +02:00
|
|
|
@title = "Editing #{@page.name.escapeHTML}".html_safe
|
2007-01-22 14:43:50 +01:00
|
|
|
@content_width = 720
|
|
|
|
@hide_navigation = true
|
2008-12-15 20:19:22 +01:00
|
|
|
-%>
|
2007-01-22 14:43:50 +01:00
|
|
|
|
|
|
|
<div id="MarkupHelp">
|
2009-12-17 17:29:51 +01:00
|
|
|
<%= render(:file => "#{@web.markup}_help") -%>
|
|
|
|
<%= render(:file => 'wiki_words_help') unless @web.brackets_only? -%>
|
2007-01-22 14:43:50 +01:00
|
|
|
</div>
|
|
|
|
|
2007-05-11 18:47:38 +02:00
|
|
|
<% form_tag({ :action => 'save', :web => @web.address, :id => @page.name },
|
2007-01-22 15:36:51 +01:00
|
|
|
{ 'id' => 'editForm', 'method' => 'post', 'onsubmit' => 'cleanAuthorName()',
|
2007-05-11 18:47:38 +02:00
|
|
|
'accept-charset' => 'utf-8' }) do %>
|
2009-06-05 07:39:12 +02:00
|
|
|
<div>
|
|
|
|
<textarea name="content" id="content" rows="24" cols="60"><%= h(flash[:content] ||
|
2009-09-07 23:02:36 +02:00
|
|
|
(params['content'] ? params['content'] : @page.content).purify) %></textarea>
|
2009-06-03 05:17:15 +02:00
|
|
|
<% if @page_name != 'HomePage' -%>
|
|
|
|
<p>
|
|
|
|
<%= check_box_tag :alter_title, value = "1", checked=false,
|
|
|
|
'onchange' => "toggleVisibility();" %> <label for="alter_title">Change page name.</label><br/>
|
|
|
|
<span id="title_change" style="display:none"><label for="new_name">New name:</label> <%= text_field_tag :new_name, h(@page.name.purify),
|
|
|
|
:onblur => "addRedirect();" %></span>
|
|
|
|
</p>
|
|
|
|
<% else -%>
|
|
|
|
<%= hidden_field_tag 'new_name', @page_name %>
|
|
|
|
<% end%>
|
2007-01-22 14:43:50 +01:00
|
|
|
<div id="editFormButtons">
|
|
|
|
<input type="submit" value="Submit" accesskey="s"/> as
|
2008-12-17 07:07:21 +01:00
|
|
|
<%= text_field_tag :author, h(@author.purify),
|
2007-01-22 14:43:50 +01:00
|
|
|
:onfocus => "this.value == 'AnonymousCoward' ? this.value = '' : true;",
|
|
|
|
:onblur => "this.value == '' ? this.value = 'AnonymousCoward' : true" %>
|
|
|
|
|
|
|
|
|
<span>
|
|
|
|
<%= link_to('Cancel', {:web => @web.address, :action => 'cancel_edit', :id => @page.name},
|
|
|
|
{:accesskey => 'c'}) %>
|
2007-02-18 08:48:32 +01:00
|
|
|
<span class="unlock">(unlocks page)</span>
|
2007-01-22 14:43:50 +01:00
|
|
|
</span>
|
|
|
|
</div>
|
2007-03-03 01:46:40 +01:00
|
|
|
</div>
|
2008-12-15 20:19:22 +01:00
|
|
|
<%- end -%>
|
2007-01-22 14:43:50 +01:00
|
|
|
|
|
|
|
<script type="text/javascript">
|
2009-06-06 00:45:57 +02:00
|
|
|
<!--//--><![CDATA[//><!--
|
2009-06-03 05:17:15 +02:00
|
|
|
function toggleVisibility() {
|
|
|
|
var span = document.getElementById('title_change');
|
|
|
|
if (span.style.display =='inline') {
|
|
|
|
span.style.display ='none';
|
2009-06-21 07:39:24 +02:00
|
|
|
document.getElementById('new_name').value = "<%= escape_javascript(@page.name) %>";
|
2009-06-03 05:17:15 +02:00
|
|
|
var content = document.getElementById('content').value
|
2009-07-02 18:02:05 +02:00
|
|
|
document.getElementById('content').value = content.replace(/\[\[!redirects <%= Regexp.escape(@page.name).gsub('/', '\\/') %>\]\]\n/, '')
|
2009-06-03 05:17:15 +02:00
|
|
|
}
|
|
|
|
else
|
|
|
|
span.style.display ='inline'
|
|
|
|
}
|
|
|
|
|
|
|
|
function addRedirect(){
|
2010-01-07 15:12:22 +01:00
|
|
|
var e = document.getElementById('new_name').value;
|
|
|
|
if ( e != "<%= escape_javascript(@page.name) %>" && e != '') {
|
2009-06-03 05:17:15 +02:00
|
|
|
var content = document.getElementById('content');
|
2009-06-21 07:39:24 +02:00
|
|
|
content.value = '[[!redirects <%= escape_javascript(@page.name) %>]]\n' + content.value
|
2009-06-03 05:17:15 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2007-01-22 14:43:50 +01:00
|
|
|
function cleanAuthorName() {
|
|
|
|
if (document.getElementById('authorName').value == "") {
|
|
|
|
document.getElementById('authorName').value = 'AnonymousCoward';
|
|
|
|
}
|
|
|
|
}
|
2009-06-03 05:17:15 +02:00
|
|
|
|
2007-01-22 14:43:50 +01:00
|
|
|
document.forms["editForm"].elements["content"].focus();
|
2011-02-19 06:36:23 +01:00
|
|
|
<%- if [:markdownMML, :markdownPNG, :markdown].include?(@web.markup) -%>
|
2010-02-06 04:36:35 +01:00
|
|
|
setupSVGedit('<%= compute_public_path("editor/svg-editor.html", "svg-edit").split(/\?/)[0] %>');
|
2011-02-19 06:36:23 +01:00
|
|
|
<%- unless @page.categories.include?('S5-slideshow') -%>
|
2010-03-29 16:27:14 +02:00
|
|
|
addS5button('<%= @page.name.escapeHTML %>');
|
2010-01-29 06:37:10 +01:00
|
|
|
<%- end -%>
|
2011-02-19 06:36:23 +01:00
|
|
|
<%- end -%>
|
2009-06-06 00:45:57 +02:00
|
|
|
//--><!]]>
|
2007-01-22 14:43:50 +01:00
|
|
|
</script>
|