Skip to content

Instantly share code, notes, and snippets.

Created December 19, 2011 13:40
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save anonymous/1497276 to your computer and use it in GitHub Desktop.
Save anonymous/1497276 to your computer and use it in GitHub Desktop.
Foswiki Blog
%JQREQUIRE{"wikiword"}%
<sticky><script type="text/javascript">%STARTSECTION{"js"}%
jQuery(document).ready(
function () {
/* Wikified topic name is built from #wordSourceSelector field and saved to #topicFieldSelector
when the HTML form #formSelector is submitted
*/
var wikifyOnSubmit = function (formSelector, wordSourceSelector, topicFieldSelector) {
jQuery(formSelector).submit(
function () {
var wikifiedTopicName;
wikifiedTopicName = jQuery.wikiword.wikify(jQuery(wordSourceSelector).val());
jQuery(topicFieldSelector).val(wikifiedTopicName);
}
);
};
wikifyOnSubmit('#Create', '#CreateLabel', '#CreateTopic');
}
);
%ENDSECTION{"js"}%</script></sticky>
<sticky>%STARTSECTION{"form"}%<form id='Create' action='%SCRIPTURLPATH{"edit"}%/%WEB%/'>
| Area: | <input id="CreateArea" type="text" name="TopicArea" size="20" /><br/> |
| Description: | <input id="CreateDescription" type="text" name="TopicDescription" size="100" /> |
| Version: | <input id="CreateVersion" type="text" name="TopicVersion" size="50" /> |
| %ICON{"newtopic"}% | <input type="submit" value='Create' /> |
<input id="CreateTopic" type="hidden" name="topic" />
<input type="hidden" name="templatetopic" value="BlogTemplate" />
<input type="hidden" name="TopicArea" value=TopicArea />
<input type="hidden" name="TopicDescription" value=TopicDescription />
<input type="hidden" name="TopicVersion" value=TopicVersion />
<input type="hidden" name="TopicState" value="Open" />
<input type="hidden" name="TopicAuthor" value="%WIKIUSERNAME%" />
<input type="hidden" name="TopicDate" value="%DATE%" />
</form>%ENDSECTION{"form"}%</sticky>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment