Skip to content

Commit

Permalink
Show source of commands
Browse files Browse the repository at this point in the history
  • Loading branch information
koraktor committed Nov 24, 2010
1 parent 33ca45d commit b086708
Show file tree
Hide file tree
Showing 5 changed files with 41 additions and 1 deletion.
6 changes: 6 additions & 0 deletions templates/default/command_details/html/setup.rb
@@ -0,0 +1,6 @@
# This code is free software; you can redistribute it and/or modify it under
# the terms of the new BSD License.
#
# Copyright (c) 2010, Sebastian Staudt

include T('default/method_details/html')
4 changes: 3 additions & 1 deletion templates/default/command_details/setup.rb
Expand Up @@ -3,6 +3,8 @@
# #
# Copyright (c) 2010, Sebastian Staudt # Copyright (c) 2010, Sebastian Staudt


include T('default/method_details')

def init def init
sections :header, [:command_signature, T('docstring')] sections :header, [:command_signature, T('docstring'), :source]
end end
21 changes: 21 additions & 0 deletions templates/default/fulldoc/html/js/rubikon.js
@@ -0,0 +1,21 @@
/**
* This code is free software; you can redistribute it and/or modify it under
* the terms of the new BSD License.
*
* Copyright (c) 2010, Sebastian Staudt
*/

function createCommandSourceLinks() {
$('.command_details .source_code').
before("<span class='showSource'>[<a href='#' class='toggleCommandSource'>View source</a>]</span>");
$('.toggleCommandSource').toggle(function() {
$(this).parent().next().slideDown(100);
$(this).text("Hide source");
},
function() {
$(this).parent().next().slideUp(100);
$(this).text("View source");
});
}

$(createCommandSourceLinks);
9 changes: 9 additions & 0 deletions templates/default/fulldoc/html/setup.rb
@@ -0,0 +1,9 @@
# This code is free software; you can redistribute it and/or modify it under
# the terms of the new BSD License.
#
# Copyright (c) 2010, Sebastian Staudt

def generate_assets
asset('js/rubikon.js', file('js/rubikon.js', true))
super
end
2 changes: 2 additions & 0 deletions templates/default/layout/html/headers.erb
@@ -0,0 +1,2 @@
<%= superb(:headers) %>
<script type="text/javascript" charset="utf-8" src="<%= url_for("js/rubikon.js") %>"></script>

0 comments on commit b086708

Please sign in to comment.