Browse Source

Update docs

master
Jack Lukic 9 years ago
parent
commit
b2ca3d470b
  1. 30
      server/documents/behaviors/api.html.eco
  2. 26
      server/documents/hotfix.html.eco
  3. 5
      server/documents/modules/popup.html.eco
  4. 4
      server/documents/modules/search.html.eco
  5. 2
      server/documents/modules/slider.html.eco
  6. 8
      server/files/javascript/api.js
  7. 3
      server/partials/ui-css.html.eco
  8. 1
      server/partials/ui-javascript.html.eco

30
server/documents/behaviors/api.html.eco

@ -70,8 +70,8 @@ type : 'UI Behavior'
</div>
<div class="no example">
<h4 class="ui header">Tools for Mocking</h4>
<p>New powerful callbacks like <a href="#mocking-responses"><code>mockResponse</code></a> and <a href="##using-custom-backends"><code>mockResponseAsync</code></a> let you asynchronously mock responses and trigger the same callbacks as your API.</p>
<h4 class="ui header">Tools for Third-Party Integrations & Mocking</h4>
<p>New powerful callbacks like <a href="#fulfilling-responses"><code>response</code></a> and <a href="#using-custom-backends"><code>responseAsync</code></a> let you asynchronously mock responses and trigger the same callbacks as your API.</p>
</div>
@ -210,7 +210,7 @@ type : 'UI Behavior'
<h4 class="ui header">Specifying DOM Events</h4>
<p>If you need to override what action an API event occurs on you can use the <code>on</code> parameter.</p>
<div class="ui message">
API requests for the following demos have been faked using API's <code>mockResponse</code> to avoid rate throttling from public APIs. No actual data is returned.
API requests for the following demos have been faked using API's <code>response</code> setting to avoid rate throttling from public APIs. No actual data is returned.
</div>
<div class="code" data-demo="true">
$('.follow.button')
@ -798,12 +798,12 @@ type : 'UI Behavior'
<h2 class="ui dividing header">Advanced Use</h2>
<div class="no sync mocked example">
<h4 class="ui header">Mocking Responses</h4>
<p>In <code>2.0</code> API includes two new parameter <code>mockResponse</code> and <code>mockResponseAsync</code> which allows you to specify a string, or as a sync or aync function for returning an API response</p>
<h4 class="ui header">Fulfilling Responses</h4>
<p>In <code>2.0</code> API includes two new parameter <code>response</code> and <code>responseAsync</code> which allows you to specify a string, or as a sync or aync function for returning an API response. (These were previously <code>mockResponse</code> and <code>mockResponseAsync</code>.)</p>
<div class="code" data-type="javascript" data-demo="true">
$('.sync.mocked .button')
.api({
mockResponse: {
response: {
success: true
}
})
@ -826,7 +826,7 @@ type : 'UI Behavior'
<div class="code" data-type="javascript" data-demo="true">
$('.async.mocked .button')
.api({
mockResponseAsync: function(settings, callback) {
responseAsync: function(settings, callback) {
var response = {
success: true
};
@ -1078,17 +1078,29 @@ type : 'UI Behavior'
<td></td>
</tr>
<tr>
<td>mockResponse</td>
<td>response</td>
<td>false</td>
<td>Can be set to a javascript object which will be returned automatically instead of requesting JSON from server </td>
<td>{} or false</td>
</tr>
<tr>
<td>mockResponseAsync(settings, callback)</td>
<td>responseAsync(settings, callback)</td>
<td>false</td>
<td>When specified, this function can be used to retrieve content from a server and return it asynchronously <b>instead of</b> a standard AJAX call. The callback function should return the server response.</td>
<td>function or false</td>
</tr>
<tr>
<td>mockResponse</td>
<td>false</td>
<td>Alias of <code>response</code></td>
<td></td>
</tr>
<tr>
<td>mockResponseAsync</td>
<td>false</td>
<td>Alias of <code>responseAsync</code></td>
<td></td>
</tr>
<tr>
<td>method</td>
<td>get</td>

26
server/documents/hotfix.html.eco

@ -7,20 +7,28 @@ title : 'Test Page'
type : 'Library'
---
<div class="ui container">
<select class="ui search dropdown">
<%- @partial('examples/single/state-options') %>
</select>
</div>
<h1 id="hello">Hello</h1>
<div class="ui popup">POPUP</div>
<h1 id="result"></h1>
<div class="ui button">Update</div>
</body>
<!-- TEST JS HERE !-->
<script>
$(document)
.ready(function(){
$('.ui.search.dropdown').dropdown();
$('#hello').popup({
on: 'click'
});
function update() {
var v = $('#hello').popup('is visible');
$('#result').html(v.toString());
}
update();
$('.button').click(update);
})
;
</script>
@ -30,4 +38,4 @@ $(document)
body > .ui.container:first-child {
margin-top: 5em;
}
</style>
</style>

5
server/documents/modules/popup.html.eco

@ -692,11 +692,6 @@ themes : ['Default']
<td>10</td>
<td>Number of iterations before giving up search for popup position when a popup cannot fit on screen</td>
</tr>
<tr>
<td>inverted</td>
<td>false</td>
<td>Invert text and background colors</td>
</tr>
</tbody>
</table>

4
server/documents/modules/search.html.eco

@ -108,6 +108,8 @@ type : 'UI Module'
</div>
</div>
<!-- Coming in 2.2
<div class="local example">
<h4 class="ui header">Selection</h4>
<p>A search can used inside a form to store a selection</p>
@ -130,7 +132,7 @@ type : 'UI Module'
})
;
</div>
</div>
</div> -->
<div class="another local example">
<div class="ui search selection">

2
server/documents/modules/slider.html.eco

@ -2,7 +2,7 @@
layout : 'default'
css : 'slider'
element : 'slider'
elementType : 'module'
elementType : 'Draft'
standalone : true
title : 'Slider'

8
server/files/javascript/api.js

@ -13,7 +13,7 @@ semantic.api = {};
// ready event
semantic.api.ready = function() {
$.fn.api.settings.mockResponseAsync = function(settings, callback) {
$.fn.api.settings.responseAsync = function(settings, callback) {
setTimeout(function() {
callback({
"success": "true"
@ -27,8 +27,8 @@ semantic.api.ready = function() {
type : 'category',
minCharacters : 3,
apiSettings : {
mockResponseAsync: false,
onFailure: function() {
responseAsync : false,
onFailure : function() {
$(this).search('display message', '<b>Hold off a few minutes</b> <div class="ui divider"></div> GitHub rate limit exceeded for anonymous search.');
},
onResponse: function(githubResponse) {
@ -97,4 +97,4 @@ semantic.api.ready = function() {
// attach ready event
$(document)
.ready(semantic.api.ready)
;
;

3
server/partials/ui-css.html.eco

@ -46,10 +46,9 @@
<link rel="stylesheet" type="text/css" class="ui" href="/dist/components/search.css">
<link rel="stylesheet" type="text/css" class="ui" href="/dist/components/shape.css">
<link rel="stylesheet" type="text/css" class="ui" href="/dist/components/sidebar.css">
<link rel="stylesheet" type="text/css" class="ui" href="/dist/components/slider.css">
<link rel="stylesheet" type="text/css" class="ui" href="/dist/components/sticky.css">
<link rel="stylesheet" type="text/css" class="ui" href="/dist/components/tab.css">
<link rel="stylesheet" type="text/css" class="ui" href="/dist/components/transition.css">
<% else: %>
<link rel="stylesheet" type="text/css" class="ui" href="/dist/semantic.min.css">
<% end %>
<% end %>

1
server/partials/ui-javascript.html.eco

@ -14,7 +14,6 @@
<script src="/dist/components/rating.js"></script>
<script src="/dist/components/search.js"></script>
<script src="/dist/components/shape.js"></script>
<script src="/dist/components/slider.js"></script>
<script src="/dist/components/sidebar.js"></script>
<script src="/dist/components/site.js"></script>
<script src="/dist/components/state.js"></script>

Loading…
Cancel
Save