display a mixin source in a modal dialog.

This commit is contained in:
Chris Eppstein 2010-01-23 01:09:59 -08:00
parent 5964d8d4ec
commit 559aebf9ab
6 changed files with 24 additions and 2 deletions

View File

@ -15,6 +15,16 @@
%h2 Mixins
- mixins(@item).each do |mixin|
%h3.mixin= mixin_signature mixin
%a.view-source{:href=>"#", :onclick => "$('#mixin-source-#{mixin.name}').dialog('open'); return false;"} View Source
%h3.mixin{:id=>"mixin-#{mixin.name}"}
%a.permalink{:href => "#mixin-#{mixin.name}"}= mixin_signature mixin
.source-documentation= format_doc(mixin.comment)
- render 'dialog', :title => "Source for +#{mixin.name}", :id => "mixin-source-#{mixin.name}" do
%pre.source-code.sass= mixin.to_sass
- content_for :footer do
:javascript
$(function(){
$('.ui-dialog').dialog({hide: true, modal: true, autoOpen: false, width: 400});
});

View File

@ -1,4 +1,5 @@
@import blueprint/reset
@import compass/utilities
@import blueprint
@ -23,9 +24,15 @@ body.reference
border: 3px solid #aaa
padding: 0.75em
margin-bottom: 0
a.permalink
+hover-link
+link-colors("inherit", "inherit")
.source-documentation
background-color: #eee
border: 3px solid #aaa
border-top-width: 0
padding: 0.75em
a.view-source
float: right
margin: 1.25em

View File

@ -22,3 +22,4 @@
%li
%a{ :href => "http://nanoc.stoneship.org/manual/" }
Tutorial
#footer= @item[:content_for_footer]

View File

@ -0,0 +1 @@
.ui-dialog{:style => "display: none;", :id => @id, :title => @title}= yield

View File

@ -0,0 +1 @@
--- {}

View File

@ -2,6 +2,8 @@
# before nanoc starts compiling.
include Nanoc3::Helpers::LinkTo
include Nanoc3::Helpers::Capturing
include Nanoc3::Helpers::Rendering
def body_class(item)
(item[:classnames] || []).join(" ")