Changing display of page title depending on edit/create state

This commit is contained in:
Eston Bond
2010-11-08 14:48:04 -08:00
parent 46104dcb83
commit 34b75c2a60
7 changed files with 41 additions and 6 deletions
+6 -2
View File
@@ -77,13 +77,17 @@
} }
/* @control function-bar */ /* @control function-bar */
#gollum-editor #gollum-editor-function-bar { #gollum-editor #gollum-editor-function-bar {
border-bottom: 1px solid #ddd; border-bottom: 1px solid #ddd;
overflow: hidden; overflow: hidden;
padding: 0.6em 0 1.1em 0; padding: 0 0 1.1em 0;
display: none; display: none;
} }
#gollum-editor-title-field + #gollum-editor-function-bar {
margin-top: 0.6em;
}
#gollum-editor #gollum-editor-function-bar.active { #gollum-editor #gollum-editor-function-bar.active {
display: block; display: block;
} }
@@ -37,6 +37,11 @@
if ( EditorHas.editSummaryMarkup() ) { if ( EditorHas.editSummaryMarkup() ) {
Placeholder.add( $('#gollum-editor-edit-summary input') ) Placeholder.add( $('#gollum-editor-edit-summary input') )
$('#gollum-editor form[name="gollum-editor"]').submit(function( e ) {
e.preventDefault();
Placeholder.clearAll();
$(this).submit();
});
} }
if ( EditorHas.collapsibleInputs() ) { if ( EditorHas.collapsibleInputs() ) {
@@ -1,10 +1,15 @@
<div id="gollum-editor"> <div id="gollum-editor">
<form name="gollum-editor" action="/create/{{escaped_name}}" method="post"> <form name="gollum-editor" action="/create/{{escaped_name}}" method="post">
<fieldset id="gollum-editor-fields"> <fieldset id="gollum-editor-fields">
{{#show_title}}
<div id="gollum-editor-title-field" class="singleline"> <div id="gollum-editor-title-field" class="singleline">
<label for="page" class="jaws">Page Title</label> <label for="page" class="jaws">Page Title</label>
<input type="text" name="page" id="gollum-editor-page-title" value="{{page_name}}"> <input type="text" name="page" id="gollum-editor-page-title" value="{{page_name}}">
</div> </div>
{{/show_title}}
{{#hidden_title}}
<input type="hidden" name="page" id="gollum-editor-page-title" value="{{page_name}}">
{{/hidden_title}}
<div id="gollum-editor-function-bar"> <div id="gollum-editor-function-bar">
<a href="#" id="function-bold" class="function-button"> <a href="#" id="function-bold" class="function-button">
<span>Bold</span></a> <span>Bold</span></a>
@@ -4,7 +4,7 @@
<ul class="actions"> <ul class="actions">
<li class="minibutton"><a href="/{{escaped_name}}" <li class="minibutton"><a href="/{{escaped_name}}"
class="action-view-page">View Page</a></li> class="action-view-page">View Page</a></li>
<li class="minibutton"><a href="/edit/{escaped_name}}" <li class="minibutton"><a href="/edit/{{escaped_name}}"
class="action-edit-page">Edit Page</a></li> class="action-edit-page">Edit Page</a></li>
</ul> </ul>
</div> </div>
+8
View File
@@ -8,6 +8,14 @@ module Precious
def title def title
"Create a new page" "Create a new page"
end end
def show_title
true
end
def hidden_title
false
end
def page_name def page_name
@name.gsub('-', ' ') @name.gsub('-', ' ')
+15 -2
View File
@@ -5,9 +5,22 @@ module Precious
attr_reader :page, :content attr_reader :page, :content
def title def page_name
"Editing #{@page.title}" @name.gsub('-', ' ')
end end
def edit_title
false
end
def hidden_title
true
end
def title
"#{@page.title}"
end
end end
end end
end end
+1 -1
View File
@@ -4,7 +4,7 @@ module Precious
attr_reader :page, :page_num attr_reader :page, :page_num
def title def title
"History of #{@page.title}" @page.title
end end
def versions def versions