Added title field for create page

This commit is contained in:
Eston Bond
2010-11-04 16:27:53 -07:00
parent ca5bf8b31e
commit a1c6829cfc
7 changed files with 95 additions and 29 deletions
+40
View File
@@ -22,6 +22,46 @@
width: 100%; width: 100%;
} }
/* @control title */
#gollum-editor-title-field {
display: none;
}
#gollum-editor-title-field.active {
border-bottom: 1px solid #ddd;
display: block;
margin: 0 0 0.3em 0;
padding: 0 0 0.5em 0;
}
#gollum-editor-title-field label {
/* JAWS should see it, but you can't */
display: block;
height: 1px;
left: -5000px;
overflow: hidden;
position: absolute;
top: -5000px;
width: 1px;
}
#gollum-editor-title-field input {
background: #fff;
border: 1px solid #ddd;
color: #000;
font-size: 1.3em;
font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif;
font-weight: bold;
line-height: 1.8em;
margin: 0;
padding: 0.5em;
width: 40%;
}
#gollum-editor-title-field input.ph {
color: #999;
}
/* @control editor-view-tab */ /* @control editor-view-tab */
#gollum-editor #gollum-editor-type-switcher { #gollum-editor #gollum-editor-type-switcher {
display: none; display: none;
@@ -11,6 +11,7 @@
var DefaultOptions = { var DefaultOptions = {
MarkupType: 'markdown', MarkupType: 'markdown',
EditorMode: 'code', EditorMode: 'code',
NewFile: false,
HasFunctionBar: true, HasFunctionBar: true,
Debug: true Debug: true
}; };
@@ -26,10 +27,19 @@
ActiveOptions = $.extend( DefaultOptions, IncomingOptions ); ActiveOptions = $.extend( DefaultOptions, IncomingOptions );
debug('GollumEditor loading'); debug('GollumEditor loading');
if ( EditorHas.baseEditorMarkup() ) { if ( EditorHas.baseEditorMarkup() ) {
// Initialise the function bar by loading proper definitions
if ( ActiveOptions.NewFile ) {
$('#gollum-editor-title-field').addClass('active');
$('#gollum-editor-title-field input').focus(function() {
$(this)[0].select();
});
}
// Initialize the function bar by loading proper definitions
if ( EditorHas.functionBar() ) { if ( EditorHas.functionBar() ) {
var htmlSetMarkupLang = var htmlSetMarkupLang =
$('#gollum-editor-body').attr('data-markup-lang'); $('#gollum-editor-body').attr('data-markup-lang');
@@ -226,6 +236,10 @@
ff4Environment: function() { ff4Environment: function() {
var ua = new RegExp(/Firefox\/4.0b/); var ua = new RegExp(/Firefox\/4.0b/);
return ( ua.test( navigator.userAgent ) ); return ( ua.test( navigator.userAgent ) );
},
titleDisplayed: function() {
return ( ActiveOptions.NewFile );
} }
}; };
@@ -597,7 +611,3 @@
} }
// })(jQuery); // })(jQuery);
jQuery(document).ready(function() {
$.GollumEditor();
});
@@ -8,3 +8,8 @@
</div> </div>
</div> </div>
</div> </div>
<script type="text/javascript">
jQuery(document).ready(function() {
$.GollumEditor({ NewFile: true });
});
</script>
@@ -14,3 +14,8 @@
</div> </div>
</div> </div>
</div> </div>
<script type="text/javascript">
jQuery(document).ready(function() {
$.GollumEditor();
});
</script>
@@ -1,5 +1,9 @@
<div id="gollum-editor"> <div id="gollum-editor">
<form name="gollum-editor" action="#" method="post"> <form name="gollum-editor" action="/create/{{escaped_name}}" method="post">
<div id="gollum-editor-title-field">
<label for="page">Page Title</label>
<input type="text" name="page" id="gollum-editor-page-title" value="{{page_name}}">
</div>
<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>
@@ -32,8 +36,8 @@
</div> </div>
<fieldset id="gollum-editor-fields"> <fieldset id="gollum-editor-fields">
<textarea id="gollum-editor-body" <textarea id="gollum-editor-body"
data-markup-lang="markdown"></textarea> data-markup-lang="markdown" name="content">{{content}}</textarea>
<span class="aural"><br></span> <span class="br"><br></span>
<input type="submit" id="gollum-editor-submit" value="Save" title="Save current changes"> <input type="submit" id="gollum-editor-submit" value="Save" title="Save current changes">
</fieldset> </fieldset>
</form> </form>
@@ -5,11 +5,6 @@
<link rel="stylesheet" type="text/css" href="/css/gollum.css" media="all"> <link rel="stylesheet" type="text/css" href="/css/gollum.css" media="all">
<link rel="stylesheet" type="text/css" href="/css/editor.css" media="all"> <link rel="stylesheet" type="text/css" href="/css/editor.css" media="all">
<link rel="stylesheet" type="text/css" href="/css/template.css" media="all"> <link rel="stylesheet" type="text/css" href="/css/template.css" media="all">
<title>{{title}}</title>
</head>
<body>
{{{yield}}}
<script type="text/javascript" src="/javascript/jquery.js"></script> <script type="text/javascript" src="/javascript/jquery.js"></script>
<script type="text/javascript" src="/javascript/gollum.js"></script> <script type="text/javascript" src="/javascript/gollum.js"></script>
@@ -19,5 +14,12 @@
src="/javascript/gollum-editor/gollum.editor.js"></script> src="/javascript/gollum-editor/gollum.editor.js"></script>
<script type="text/javascript" <script type="text/javascript"
src="/javascript/gollum-editor/langs/markdown.js"></script> src="/javascript/gollum-editor/langs/markdown.js"></script>
<title>{{title}}</title>
</head>
<body>
{{{yield}}}
</body> </body>
</html> </html>
+9 -9
View File
@@ -1,9 +1,9 @@
Gollum Editor * Editor
- Style / Generate dialogs * Add sidebar field
- Def: Org * Add footer field
- Def: Pod * Add edit summary field
- Def: RDoc * Create rest of markup lang definitions
- Def: Restructured Text * Create Error Page
* Create Compare Revisions Page
Make function bar button sprite * Create Search Results Page
Roll scratch/ design into Mustache * Write Editor/Sidebar implementation notes for Rick