Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
tree: 06f186207f
Fetching contributors…

Cannot retrieve contributors at this time

306 lines (279 sloc) 9.869 kb
<% content_for :title, " - #{@function.namespace.name}/#{@function.name}" %>
<script type="text/javascript" charset="utf-8">
$(document).ready(function() {
CD.VarPage.init({
varId: <%= @function.id %>,
library: "<%= @function.library.name %>",
version: "<%= @function.library.version %>",
editExampleFormHTML: '<%= (render :partial => '/examples/edit_example_form').gsub("\n", "")%>',
editCommentFormHTML: '<%= (render :partial => '/comments/edit_comment_form').gsub("\n", "")%>',
})
})
</script>
<div class="container_16">
<div class="grid_3">
<%= render :partial => 'lib_nav', :locals => {:lib => @function.namespace.library} %>
<%= render :partial => '/lib_namespaces' %>
&nbsp;
</div>
<div class="grid_11">
<% if not @function.library.current %>
<div class="version_warning">
You're viewing version <%= @function.version %> of <%= @function.name %>.
The latest stable version of <%= @library.name %> is <%= Library.current_version_of(@library).version %>.
</div>
<% end %>
<a name="top"></a>
<div class="function_links">
<a href="#doc" class="scroll">doc</a>
<a href="#source" class="scroll">source</a>
<a href="#examples" class="scroll">examples</a>
<a href="#comments" class="scroll">comments</a>
</div>
<script type="text/javascript" charset="utf-8">
$(document).ready(function() {
$(".versions_nav").click(function() {
$(".versions_nav ul").toggle()
})
})
</script>
<div class="versions_nav">
<span>
<%= @function.version %>
<% if @function.library.current && params[:version] %>
permalink
<% end %>
<%= image_tag "arrow_down_16x16.png" %>
</span>
<ul>
<!-- <% if @function.stable_version %>
<li>
<%= link_to 'stable', @function.stable_version.link_opts, :class => 'stable' %>
</li>
<% end %> -->
<% Function.versions_of(@function).each do |f| %>
<%
classes = []
if @function.version == f.version then classes << "selected" end
if f.library.current then classes << "stable" end
%>
<li>
<% if @function.library.version == f.library.version && f.library.current && !params[:version]%>
<%= link_to f.library.version + " permalink", f.link_opts(false), :class => classes.join(' ') %>
<% else %>
<%= link_to f.library.version, f.link_opts, :class => classes.join(' ') %>
<% end %>
</li>
<% end %>
</ul>
<!-- <a href="/v/<%= @function.id %>">short link to this var</a> -->
</div>
<div class="clear"></div>
<div class="function_header">
<h1>
<%= @function.name %>
</h1>
<h2>
<span class="ns">
<%= link_to @function.namespace.name, :controller => "main",
:action => "ns",
:lib => @function.library.url_friendly_name,
:ns => @function.namespace.name,
:version => @function.library.version %>
</span>
</h2>
<div class="clear"></div>
</div>
<% if @function.arglists.size > 0 %>
<div class="usage">
<ul>
<% @function.arglists.each do |a| %>
<li>(<%= (@function.name + " " + a[1..-2]).strip %>)</li>
<% end %>
</ul>
</div>
<% end %>
<% if @function.doc %>
<div class="doc">
<a class="internal_nav scroll" href="#doc" name="doc"></a>
<div class="content"><%= @function.doc.gsub("\n", "<br />") if @function.doc %></div>
<div class="copyright_license">
<%= @library.copyright %>
<%= (@library.license || "See <a href='#{@library.site_url}'>#{@library.site_url}</a> for copyright and license details.")%>
</div>
</div>
<% end %>
<div class="examples">
<h3>
<a class="internal_nav scroll" href="#examples" name="examples">
<span id="examples_count"><%= @function.all_versions_examples.size %></span> <span id="examples_desc">Example<% if @function.all_versions_examples.size != 1 then %>s<% end %></span>
</a>
<a class="top scroll" href="#top">top</a>
</h3>
<% if @function.all_versions_examples.size == 0 %>
<ul id="var_examples">
</ul>
<% else %>
<ul id="var_examples">
<% @function.all_versions_examples.each do |e| %>
<li>
<%= render :partial => '/examples/example', :locals => {:e => e} %>
</li>
<% end %>
</ul>
<% end %>
<% if current_user_session %>
<div id="new_example" class="example">
<% form_for :example, @example do |f| %>
Example Content <span class="instructions">(code only, do not wrap in &lt;pre&gt; tags. See <a href="/examples_style_guide">style guide</a> for more information.)</span>
<div class="examples_license">
Examples submitted to clojuredocs will be licensed under the <a href="http://creativecommons.org/publicdomain/zero/1.0/">Creative Commons CC 0</a>.
</div>
<%= image_tag "ajax-loader.gif", :class => "ajax_loader" %>
<div class="clear"></div>
<%= f.text_area :body %>
<div style="text-align: right">
<a class="cancel" href="" style="float: left">Cancel</a>
<!-- <input class="preview_example" type="button" value="Preview" /> -->
<%= f.submit 'Add example' %>
</div>
<input type="hidden" name="isexample" value="true" />
<input type="hidden" name="var_id" value="<%= @function.id %>" />
<% end %>
<fieldset class="live_preview">
<legend>Live Preview</legend>
<div class="preview">
</div>
</fieldset>
</div>
<% end %>
<% if current_user_session %>
<a href="" id="add_new_example">Add an example.</a>
<% else %>
Log in to add / edit an example.
<% end %>
</div>
<div class="see_alsos">
<h3>See Also <a class="top scroll" href="#top">top</a></h3>
<ul>
<% @function.all_versions_see_alsos.each do |sa| %>
<li class="see_also_item" id="see_also_item_<%=sa.id%>">
<%= render :partial => "/see_also/see_also_content", :locals => {:sa => sa} %>
</li>
<% end %>
</ul>
<% if current_user_session %>
<div id="new_see_also">
<%= text_field_tag :var_name_search %>
</div>
<% else %>
Log in to add a see also.
<% end %>
<div class="clear"></div>
</div>
<div class="source">
<h3 style="margin: 0px; padding: 0px;">
<%= image_tag "plus_12x12.png", :id => "expand_source" %>
<%= image_tag "minus_12x12.png", :id => "collapse_source" %>
<a class="internal_nav scroll" href="#source" name="source">Source</a>
<% if @function.file %>
<span class="file">
<% if @library.source_base_url %>
<a href="<%= @function.library.source_base_url %>/master<%= @function.namespace.source_url %>#L<%= @function.line %>"><%= @function.file %>:<%= @function.line %></a>
<% else %>
<%= @function.file %>:<%= @function.line %>
<% end %>
</span>
<% end %>
<a class="top scroll" href="#top">top</a>
</h3>
<div class="source_content">
<pre class="brush: clojure"><%= @function.source %></pre>
<div class="copyright_license">
<%= @library.copyright %>
<%= (@library.license || "See <a href='#{@library.site_url}'>#{@library.site_url}</a> for copyright and license details.")%>
</div>
<div class="references">
Vars in <span class="ns"><%= @function.namespace.name %>/</span><%= @function.name %>:
<% @function.source_references.each do |f|%>
<span class="reference"><a href="<%= f.href %>"><%= f.name %></a></span>
<% end %>
</div>
<div class="used_in">
Used in <%= @function.used_in.size %> other vars
<% if @function.used_in.size < 20 %>
<% @function.used_in.each do |f| %>
<span class="reference"><a href="<%= f.href %>"><%= f.name %></a></span>
<% end %>
<% else %>
<a href="#" class="expand_used_in">(expand)</a>
<div class="used_in_expander">
<% @function.used_in.each do |f| %>
<span class="reference"><a href="<%= f.href %>"><%= f.name %></a></span>
<% end %>
</div>
<% end %>
</div>
</div>
</div>
<div class="comments">
<h3><a class="internal_nav scroll" href="#comments" name="comments">Comments</a> <a class="top scroll" href="#top">top</a></h3>
<% if @function.root_comments.size == 0 %>
<h4>
No comments for <em><%= @function.name %></em>.
<% if current_user_session %>
<a href="" id="add_comment">Add a comment</a>.
<% else %>
Log in to add a comment.
<% end %>
</h4>
<% else %>
<h4><%= @function.root_comments.size %> comment(s) for <em><%= @function.name %></em>.</h4>
<% end %>
<% @function.root_comments.each do |c| %>
<%= render :partial => '/comments/comment', :locals => {:c => c} %>
<% end %>
<% if @function.root_comments.size != 0 %>
<% if current_user_session %>
<h4><a href="" id="add_comment">Add a comment</a>.</h4>
<% else %>
Log in to add a comment.
<% end %>
<% end %>
<% if current_user_session %>
<div id="new_comment" class="comment">
<div class="author">
<img src="<%= grav_url_for(current_user.email, 25) %>" />
<span class="author_nickname">
<%= link_to current_user.login, :controller => 'user', :action => 'profile', :login => current_user.login %>
</span>
</div>
<div class="clear"></div>
<% form_for :comment, @comment do |f| %>
Example <span class="instructions">(markdown allowed, code in &lt;pre /&gt;)</span><br />
<%= f.text_area :body %>
<div style="text-align: right">
<a class="cancel" href="" style="float: left">Cancel</a>
<!-- <input class="preview_comment" type="button" value="Preview" /> -->
<%= f.submit 'Add comment'%>
</div>
<div class="copyright_license">
Comments submitted to clojuredocs will be licensed under the <a href="http://creativecommons.org/publicdomain/zero/1.0/">Creative Commons CC 0</a>.
</div>
<input type="hidden" name="iscomment" value="true">
<% end %>
<fieldset class="live_preview">
<legend>Live Preview</legend>
<div class="preview">
</div>
</fieldset>
</div>
<% end %>
<div class="hidden" id="preview_window">
</div>
</div>
</div>
<div class="grid_3">
&nbsp;
</div>
<div class="container_16">
Jump to Line
Something went wrong with that request. Please try again.