mirror of
https://github.com/jquery/jquery-ui.git
synced 2026-02-04 20:45:09 -05:00
integrating documentation into demo files, first draft; run Ant targets docs-download and docs-process to generate the files
This commit is contained in:
@@ -205,3 +205,61 @@ div.demo-description {
|
||||
|
||||
#demo-link { font-size:11px; padding-top: 6px; clear: both; overflow: hidden; }
|
||||
#demo-link a span.ui-icon { float:left; margin-right:3px; }
|
||||
|
||||
#widget-docs { margin:20px 0 0; }
|
||||
|
||||
#widget-docs h2, #widget-docs h3, #widget-docs h4, #widget-docs p, #widget-docs ul, #widget-docs code { margin:0; padding:0; }
|
||||
#widget-docs code { display:block; color:#444; font-size:.9em; margin:0 0 1em; }
|
||||
#widget-docs code strong { color:#000; }
|
||||
#widget-docs p { margin:0 3em 1.2em 0; }
|
||||
#widget-docs p.intro { font-size:13px; color:#666; line-height:1.3; }
|
||||
#widget-docs ul { list-style-type: none; }
|
||||
|
||||
#widget-docs h2 { font-size:16px; margin:1.2em 0 .5em; }
|
||||
#widget-docs h3 { font-size:14px; color:#e6820E; margin:1.5em 0 .5em; }
|
||||
.normal #widget-docs h4 { font-size:12px; color:#000; border:0; margin:0 0 .5em; }
|
||||
|
||||
#docs-overview-main { width:400px; }
|
||||
#docs-overview-sidebar { float:right; width:200px; }
|
||||
#docs-overview-sidebar a span { color:#666; }
|
||||
#widget-docs #docs-overview-main p { margin-right:0; }
|
||||
#widget-docs #docs-overview-sidebar h4 { padding-left:0; }
|
||||
|
||||
.docs-list-header { float:left; width:100%; margin:10px 0 0; border-bottom:1px solid #eee; }
|
||||
#widget-docs .docs-list-header h2 { float:left; margin:0; }
|
||||
#widget-docs .docs-list-header p { float:right; margin:5px 0; font-size:11px; }
|
||||
|
||||
.docs-list { float:left; width:100%; padding:0 0 10px; }
|
||||
.docs-list .param-header { float:left; clear:left; width:100%; padding:8px 0; border-top:1px solid #eee; }
|
||||
#widget-docs .param-header h3, #widget-docs .param-header p { margin:0; float:left; }
|
||||
#widget-docs .param-header h3 { width:50%; }
|
||||
#widget-docs .param-header h3 span { background: url(images/demo-spindown-closed.gif) no-repeat left; padding-left:13px; }
|
||||
#widget-docs .param-open .param-header h3 span { background: url(images/demo-spindown-open.gif) no-repeat left; }
|
||||
#widget-docs .param-header p { width:24%; }
|
||||
#widget-docs .param-header p.param-type span { background: url(images/icon-docs-info.gif) no-repeat left; cursor:pointer; border-bottom:1px dashed #ccc; padding-left:15px; }
|
||||
|
||||
.param-details { padding-left:13px; }
|
||||
.param-args { margin:0 0 1.5em; border-top:1px dotted #ccc;}
|
||||
.param-args td { padding:3px 30px 3px 5px; border-bottom:1px dotted #ccc; }
|
||||
|
||||
|
||||
/* overrides for ui-tab styles */
|
||||
#widget-docs ul.ui-tabs-nav { padding:0 0 0 8px; }
|
||||
#widget-docs .ui-tabs-nav li { margin:5px 5px 0 0; }
|
||||
|
||||
#widget-docs .ui-tabs-nav li a:link,
|
||||
#widget-docs .ui-tabs-nav li a:visited,
|
||||
#widget-docs .ui-tabs-nav li a:hover,
|
||||
#widget-docs .ui-tabs-nav li a:active { font-size:14px; padding:4px 1.2em 3px; color:#fff; }
|
||||
|
||||
#widget-docs .ui-tabs-nav li.ui-tabs-selected a:link,
|
||||
#widget-docs .ui-tabs-nav li.ui-tabs-selected a:visited,
|
||||
#widget-docs .ui-tabs-nav li.ui-tabs-selected a:hover,
|
||||
#widget-docs .ui-tabs-nav li.ui-tabs-selected a:active { color:#e6820E; }
|
||||
|
||||
#widget-docs .ui-tabs-panel { padding:20px 9px; font-size:12px; line-height:1.4; color:#000; }
|
||||
|
||||
#widget-docs .ui-widget-content a:link,
|
||||
#widget-docs .ui-widget-content a:visited { color:#1b75bb; text-decoration:none; }
|
||||
#widget-docs .ui-widget-content a:hover,
|
||||
#widget-docs .ui-widget-content a:active { color:#0b559b; }
|
||||
BIN
demos/images/icon-docs-info.gif
Normal file
BIN
demos/images/icon-docs-info.gif
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 214 B |
@@ -162,8 +162,28 @@
|
||||
$('#demo-frame').empty().html(data);
|
||||
$('#demo-link a').attr('href', path);
|
||||
updateDemoNotes();
|
||||
|
||||
});
|
||||
if (/default.html$/.test(path)) {
|
||||
$.get("../documentation/" + path.match(/demos\/(.+)\//)[1] + ".html", function(html) {
|
||||
$("#demo-notes").after(html);
|
||||
$("#widget-docs").tabs();
|
||||
$(".param-header").click(function() {
|
||||
$(this).parent().toggleClass("param-open").end().next().toggle();
|
||||
});
|
||||
$(".docs-list-header").each(function() {
|
||||
var header = $(this);
|
||||
var details = header.next().find(".param-details").hide();
|
||||
$("a:first", header).click(function() {
|
||||
details.show().parent().addClass("param-open");
|
||||
return false;
|
||||
});
|
||||
$("a:last", header).click(function() {
|
||||
details.hide().parent().removeClass("param-open");
|
||||
return false;
|
||||
});
|
||||
});
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
function updateDemoNotes() {
|
||||
|
||||
@@ -218,4 +218,31 @@
|
||||
<delete dir="dist" />
|
||||
</target>
|
||||
|
||||
</project>
|
||||
<target name="docs-download">
|
||||
<property name="url" value="http://www.exfer.net/jquery/createjQueryXMLDocs.py?start=UI/" />
|
||||
<get src="${url}Accordion" dest="accordion.xml" />
|
||||
<get src="${url}Datepicker" dest="datepicker.xml" />
|
||||
<get src="${url}Dialog" dest="dialog.xml" />
|
||||
<get src="${url}Draggable" dest="draggable.xml" />
|
||||
<get src="${url}Droppable" dest="droppable.xml" />
|
||||
<get src="${url}Progressbar" dest="progressbar.xml" />
|
||||
<get src="${url}Resizable" dest="resizable.xml" />
|
||||
<get src="${url}Selectable" dest="selectable.xml" />
|
||||
<get src="${url}Slider" dest="slider.xml" />
|
||||
<get src="${url}Sortable" dest="sortable.xml" />
|
||||
<get src="${url}Tabs" dest="tabs.xml" />
|
||||
</target>
|
||||
|
||||
<!--depends="download-docs"-->
|
||||
<target name="docs-process" >
|
||||
<property name="docs.dir" value="${ui.dir}/documentation" />
|
||||
<delete dir="${docs.dir}" />
|
||||
<mkdir dir="${docs.dir}" />
|
||||
<xslt includes="*.xml,accordion.xml" excludes="build.xml" destdir="${docs.dir}" style="build/style.xsl" />
|
||||
</target>
|
||||
|
||||
<target name="docs-clean">
|
||||
<delete file="*.xml" exclude="build.xml" />
|
||||
</target>
|
||||
|
||||
</project>
|
||||
|
||||
274
release/build/style.xsl
Normal file
274
release/build/style.xsl
Normal file
@@ -0,0 +1,274 @@
|
||||
<?xml version="1.0" encoding="ISO-8859-1"?>
|
||||
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
|
||||
<xsl:output method="html" />
|
||||
|
||||
<xsl:template name="ref">
|
||||
<xsl:text>link-</xsl:text>
|
||||
<xsl:value-of select="translate(@name, '$.|', '')"/>
|
||||
<xsl:text>-</xsl:text>
|
||||
<xsl:for-each select="params">
|
||||
<xsl:value-of select="translate(@name, '<>|$.', '')" />
|
||||
</xsl:for-each>
|
||||
</xsl:template>
|
||||
|
||||
<xsl:template name="href">
|
||||
<xsl:attribute name="href">
|
||||
<xsl:text>#</xsl:text>
|
||||
<xsl:call-template name="ref" />
|
||||
</xsl:attribute>
|
||||
</xsl:template>
|
||||
|
||||
<xsl:template name="id">
|
||||
<xsl:attribute name="id">
|
||||
<xsl:call-template name="ref" />
|
||||
</xsl:attribute>
|
||||
</xsl:template>
|
||||
|
||||
<xsl:template name="return">
|
||||
<xsl:attribute name="title">
|
||||
<xsl:choose>
|
||||
<xsl:when test="@return='jQuery'">A jQuery object.</xsl:when>
|
||||
<xsl:when test="@return='Boolean'">true or false.</xsl:when>
|
||||
<xsl:when test="@return='Object'">A simple Javascript object..</xsl:when>
|
||||
<xsl:when test="@return='String'">A string of characters.</xsl:when>
|
||||
<xsl:when test="@return='Number'">A valid numeric.</xsl:when>
|
||||
<xsl:when test="@return='String|Number'">A string of characters or a number.</xsl:when>
|
||||
<xsl:when test="@return='Element'">The Javascript object representation of a DOM Element.</xsl:when>
|
||||
<xsl:when test="@return='Element|Array<Element>'">One or more DOM Elements (a single one or an array).</xsl:when>
|
||||
<xsl:when test="@return='Map'">A Javascript object that contains key/value pairs in the form of properties and values.</xsl:when>
|
||||
<xsl:when test="@return='Array<Element>'">An Array of DOM Elements.</xsl:when>
|
||||
<xsl:when test="@return='Array<String>'">An Array of strings.</xsl:when>
|
||||
<xsl:when test="@return='Function'">A reference to a Javascript function.</xsl:when>
|
||||
<xsl:when test="@return='XMLHttpRequest'">An XMLHttpRequest object (referencing a HTTP request).</xsl:when>
|
||||
</xsl:choose>
|
||||
</xsl:attribute>
|
||||
<xsl:value-of select="@return"/>
|
||||
</xsl:template>
|
||||
|
||||
<xsl:template name="type">
|
||||
<xsl:attribute name="title">
|
||||
<xsl:choose>
|
||||
<xsl:when test="@type='jQuery'">A jQuery object.</xsl:when>
|
||||
<xsl:when test="@type='Boolean'">true or false.</xsl:when>
|
||||
<xsl:when test="@type='Object'">A simple Javascript object..</xsl:when>
|
||||
<xsl:when test="@type='String'">A string of characters.</xsl:when>
|
||||
<xsl:when test="@type='Number'">A valid numeric.</xsl:when>
|
||||
<xsl:when test="@type='String|Number'">A string of characters or a number.</xsl:when>
|
||||
<xsl:when test="@type='Element'">The Javascript object representation of a DOM Element.</xsl:when>
|
||||
<xsl:when test="@type='Element|Array<Element>'">One or more DOM Elements (a single one or an array).</xsl:when>
|
||||
<xsl:when test="@type='Map'">A Javascript object that contains key/value pairs in the form of properties and values.</xsl:when>
|
||||
<xsl:when test="@type='Array<Element>'">An Array of DOM Elements.</xsl:when>
|
||||
<xsl:when test="@type='Array<String>'">An Array of strings.</xsl:when>
|
||||
<xsl:when test="@type='Function'">A reference to a Javascript function.</xsl:when>
|
||||
<xsl:when test="@type='XMLHttpRequest'">An XMLHttpRequest object (referencing a HTTP request).</xsl:when>
|
||||
</xsl:choose>
|
||||
</xsl:attribute>
|
||||
<xsl:value-of select="@type"/>
|
||||
</xsl:template>
|
||||
|
||||
<xsl:template name="break">
|
||||
<xsl:param name="text" select="." />
|
||||
<xsl:choose>
|
||||
<xsl:when test="contains($text, '

')">
|
||||
<xsl:value-of select="substring-before($text, '

')" />
|
||||
<br /><br />
|
||||
<xsl:call-template name="break">
|
||||
<xsl:with-param name="text" select="substring-after($text, '

')" />
|
||||
</xsl:call-template>
|
||||
</xsl:when>
|
||||
<xsl:otherwise>
|
||||
<xsl:value-of select="$text" />
|
||||
</xsl:otherwise>
|
||||
</xsl:choose>
|
||||
</xsl:template>
|
||||
|
||||
<xsl:template name="option">
|
||||
<div class="param">
|
||||
<div class="param-header">
|
||||
<h3><span><xsl:value-of select="@name"/></span></h3>
|
||||
<p class="param-type"><span><xsl:call-template name="type" /></span></p>
|
||||
<p class="param-default">Default: <xsl:value-of select="@default"/></p>
|
||||
</div>
|
||||
<div class="param-details">
|
||||
<p><xsl:value-of select="desc"/></p>
|
||||
<!--
|
||||
<h4>Code sample:</h4>
|
||||
<code>
|
||||
Here be code samples once added to the exporter script.<br />
|
||||
$("#dialog").dialog({<br />
|
||||
  buttons: {<br />
|
||||
    'Delete all items in recycle bin': function() {<br />
|
||||
      $(this).dialog('close');<br />
|
||||
    },<br />
|
||||
    Cancel: function() {<br />
|
||||
      $(this).dialog('close');<br />
|
||||
    }<br />
|
||||
  }<br />
|
||||
});
|
||||
</code>
|
||||
-->
|
||||
</div>
|
||||
</div>
|
||||
</xsl:template>
|
||||
|
||||
<xsl:template match="/*">
|
||||
<div id="widget-docs">
|
||||
<ul>
|
||||
<li><a href="#docs-overview"><span>Overview</span></a></li>
|
||||
<li><a href="#docs-options"><span>Options</span></a></li>
|
||||
<li><a href="#docs-methods"><span>Methods</span></a></li>
|
||||
<li><a href="#docs-theming"><span>Theming</span></a></li>
|
||||
</ul>
|
||||
|
||||
<!-- TAB 1 -->
|
||||
<div id="docs-overview">
|
||||
<div id="docs-overview-sidebar">
|
||||
<h4>Dependencies:</h4>
|
||||
<ul>
|
||||
<li><a href="#">ui.core.js</a></li>
|
||||
<li><a href="#">ui.draggable.js <span>(Optional)</span></a></li>
|
||||
<li><a href="#">ui.resizable.js <span>(Optional)</span></a></li>
|
||||
</ul>
|
||||
</div>
|
||||
<div id="docs-overview-main">
|
||||
<p>
|
||||
<xsl:for-each select="//function[1]/desc">
|
||||
<xsl:call-template name="break" />
|
||||
</xsl:for-each>
|
||||
</p>
|
||||
<p>
|
||||
<xsl:for-each select="//function[1]/longdesc">
|
||||
<xsl:call-template name="break" />
|
||||
</xsl:for-each>
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- TAB 2 -->
|
||||
<div id="docs-options">
|
||||
<p class="intro"><xsl:value-of select="//function[1]/params/desc"/></p>
|
||||
|
||||
<div class="docs-list-header clearfix">
|
||||
<h2>Property options</h2>
|
||||
<p><a href="#">Show details</a> | <a href="#">Hide details</a></p>
|
||||
</div>
|
||||
|
||||
<div class="docs-list clearfix">
|
||||
<xsl:for-each select="//function[1]/option[not(starts-with(@type, 'function'))]">
|
||||
<xsl:call-template name="option"/>
|
||||
</xsl:for-each>
|
||||
</div><!-- /property options -->
|
||||
|
||||
<div class="docs-list-header clearfix">
|
||||
<h2>Event options</h2>
|
||||
<p><a href="#">Show details</a> | <a href="#">Hide details</a></p>
|
||||
</div>
|
||||
|
||||
<div class="docs-list clearfix">
|
||||
<xsl:for-each select="//function[1]/option[starts-with(@type, 'function')]">
|
||||
<xsl:call-template name="option"/>
|
||||
</xsl:for-each>
|
||||
</div><!-- /event options -->
|
||||
</div>
|
||||
|
||||
<!-- TAB 3 -->
|
||||
<div id="docs-methods">
|
||||
<p class="intro">A brief description of methods and their uses goes here so their use is clearly explained and any caveats can be mentioned up front.</p>
|
||||
|
||||
<div class="docs-list-header clearfix">
|
||||
<h2>Methods</h2>
|
||||
<p><a href="#">Show details</a> | <a href="#">Hide details</a></p>
|
||||
</div>
|
||||
|
||||
<div class="docs-list clearfix">
|
||||
<xsl:for-each select="//function[position() != 1]">
|
||||
<div class="param">
|
||||
<div class="param-header">
|
||||
<h3><span><xsl:value-of select="//function[1]/@name"/>( <xsl:value-of select="params[1]/@name"/>
|
||||
<xsl:for-each select="params[position() != 1]">
|
||||
<xsl:text>, </xsl:text><xsl:value-of select="@name"/>
|
||||
</xsl:for-each>
|
||||
)</span></h3>
|
||||
<p class="param-type">Returns: <span><xsl:call-template name="return" /></span></p>
|
||||
</div>
|
||||
<div class="param-details">
|
||||
<p><xsl:value-of select="desc"/></p>
|
||||
<p><xsl:value-of select="longdesc"/></p>
|
||||
<h4>Arguments:</h4>
|
||||
<table class="param-args" summary="Arguments for this method" cellspacing="0">
|
||||
<tbody>
|
||||
<xsl:for-each select="params[position() != 1]">
|
||||
<tr>
|
||||
<td><xsl:value-of select="@name"/></td>
|
||||
<td><xsl:value-of select="@type"/></td>
|
||||
<td><xsl:value-of select="."/></td>
|
||||
</tr>
|
||||
</xsl:for-each>
|
||||
</tbody>
|
||||
</table>
|
||||
|
||||
<h4>Code sample:</h4>
|
||||
<xsl:for-each select="example">
|
||||
<p><xsl:value-of select="desc"/></p>
|
||||
<code>
|
||||
<xsl:value-of select="code"/>
|
||||
</code>
|
||||
</xsl:for-each>
|
||||
</div>
|
||||
</div>
|
||||
</xsl:for-each>
|
||||
|
||||
</div><!-- /methods -->
|
||||
</div>
|
||||
|
||||
<!-- TAB 4 -->
|
||||
<div id="docs-theming">
|
||||
<p class="intro">ui.dialog uses the jQuery UI CSS styles framework for all major components, e.g. for the titlebar, the resize handle, etc., some of which are borrowed from ui.resizable.</p>
|
||||
|
||||
<h3>Sample code with CSS classes</h3>
|
||||
|
||||
<p>Use the classes highlighted in bold to customize the dialog:</p>
|
||||
|
||||
<!-- Remove all framework classes (those from ui.core.css and ui.theme.css) from the markup sample, and highlight all remaining widget classes in bold (<strong>).
|
||||
We decided to omit framework classes to avoid confusion and focus the user on the classes that are necessary for customizing the widget. I've bolded a few for illustration,
|
||||
but in the working code ALL of them should be bolded. -->
|
||||
|
||||
<code>
|
||||
<div class="<strong>ui-dialog</strong>" role="dialog" aria-labelledby="ui-dialog-title-1"><br />
|
||||
  <div class="<strong>ui-dialog-titlebar</strong>"><br />
|
||||
    <span class="<strong>ui-dialog-title</strong>" id="ui-dialog-title-1">Dialog Title</span><br />
|
||||
    <a href="#" class="<strong>ui-dialog-titlebar-close</strong>" role="button" title="Close"><br />
|
||||
    <span class="<strong>ui-icon ui-icon-closethick</strong>">Close</span></a><br />
|
||||
  </div><br />
|
||||
  <div class="<strong>ui-dialog-content</strong>" style="height: 13em;"><br />
|
||||
    <p>Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt</p><br />
|
||||
  </div><br />
|
||||
  <div class="<strong>ui-dialog-buttonpane</strong>"><br />
|
||||
    <button class="ui-state-default ui-priority-primary ui-corner-all">Primary</button><br />
|
||||
    <button class="ui-state-default ui-priority-secondary ui-corner-all">Secondary</button><br />
|
||||
    <button class="ui-state-default ui-state-disabled ui-corner-all">Disabled</button><br />
|
||||
  </div><br />
|
||||
  <div class="ui-resizable-n ui-resizable-handle"></div><br />
|
||||
  <div class="ui-resizable-s ui-resizable-handle"></div><br />
|
||||
  <div class="ui-resizable-e ui-resizable-handle"></div><br />
|
||||
  <div class="ui-resizable-w ui-resizable-handle"></div><br />
|
||||
  <div class="ui-resizable-ne ui-resizable-handle"></div><br />
|
||||
  <div class="ui-resizable-se ui-resizable-handle ui-icon ui-icon-grip-diagonal-se"></div><br />
|
||||
  <div class="ui-resizable-sw ui-resizable-handle"></div><br />
|
||||
  <div class="ui-resizable-nw ui-resizable-handle"></div><br />
|
||||
</div>
|
||||
</code>
|
||||
|
||||
<h3>See also</h3>
|
||||
<ul>
|
||||
<li><a href="#">UI/Resizables plugin documentation</a></li>
|
||||
<li><a href="#">How to create a custom theme</a></li>
|
||||
<li><a href="#">jQuery UI CSS Framework documentation</a></li>
|
||||
<li><a href="#">ThemeRoller: Create your own custom theme</a></li>
|
||||
</ul>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</xsl:template>
|
||||
|
||||
</xsl:stylesheet>
|
||||
Reference in New Issue
Block a user