From 929feecd44042c87a01eba24ffe065850ee06637 Mon Sep 17 00:00:00 2001 From: Chris Eppstein Date: Sun, 25 Apr 2010 02:55:23 -0700 Subject: [PATCH] inline source code instead of a popup. --- doc-src/content/stylesheets/_reference.scss | 17 +++++++++++++++-- doc-src/layouts/dialog.haml | 1 - doc-src/layouts/partials/reference/mixins.haml | 18 +++++++++--------- doc-src/lib/stylesheets.rb | 12 ------------ 4 files changed, 24 insertions(+), 24 deletions(-) delete mode 100644 doc-src/layouts/dialog.haml diff --git a/doc-src/content/stylesheets/_reference.scss b/doc-src/content/stylesheets/_reference.scss index 2e07cf5a..f3f98dfd 100644 --- a/doc-src/content/stylesheets/_reference.scss +++ b/doc-src/content/stylesheets/_reference.scss @@ -32,12 +32,25 @@ body.reference { margin-right: 15px; } dt:not(:first-child) { margin-top: 1em; } } - a.view-source { + span.view-source { float: right; - margin: 1.25em; } + margin: 1.25em; + } span.color + span.swatch { margin: 0 3px 3px; border: 1px solid #333333; width: 1em; height: 1em; @include inline-block; } .color-snippet { width: 100px; height: 20px; @include border-radius(3px); } a.help { font-size: 75%; } + .mixin-source { + pre { + @include transition; + @include transparent; + display: none; + } + pre.shown { + display: block; + @include opaque; + } + } + } body.docs { diff --git a/doc-src/layouts/dialog.haml b/doc-src/layouts/dialog.haml deleted file mode 100644 index 41c63d22..00000000 --- a/doc-src/layouts/dialog.haml +++ /dev/null @@ -1 +0,0 @@ -.ui-dialog{(@html || {}).merge(:style => "display: none;")}= yield diff --git a/doc-src/layouts/partials/reference/mixins.haml b/doc-src/layouts/partials/reference/mixins.haml index 810566c4..f56d5d68 100644 --- a/doc-src/layouts/partials/reference/mixins.haml +++ b/doc-src/layouts/partials/reference/mixins.haml @@ -2,9 +2,16 @@ %h2 Mixins - mixin_defs.each do |mixin| - %a.view-source{:href=>"#", :onclick => "$('#mixin-source-#{mixin.name}').dialog('open'); return false;"} View Source + %span.view-source + View Source: + %a.view-source{:href=>"#", :onclick => "$('#mixin-#{mixin.name}-source .scss').removeClass('shown');$('#mixin-#{mixin.name}-source .sass').addClass('shown'); return false;"} Sass + \| + %a.view-source{:href=>"#", :onclick => "$('#mixin-#{mixin.name}-source .sass').removeClass('shown');$('#mixin-#{mixin.name}-source .scss').addClass('shown'); return false;"} SCSS %h3.mixin{:id=>"mixin-#{mixin.name}"} - %a.permalink{:href => "#mixin-#{mixin.name}"}= mixin_signature mixin + %a.permalink{:href => "#mixin-#{mixin.name}"}= mixin_signature(mixin) + .mixin-source{:id=>"mixin-#{mixin.name}-source"} + %pre.sass= mixin.to_sass + %pre.scss= mixin.to_scss .source-documentation = format_doc(mixin.comment) @@ -14,10 +21,3 @@ %dt= link_to example.item[:title], example - if example.item[:description] %dd= example.item[:description] - = mixin_source_dialog(mixin) do - %pre.source-code.sass= mixin.to_sass - - :javascript - $(function(){ - $('.ui-dialog.mixin').dialog({hide: true, modal: true, autoOpen: false, width: 400}); - }); diff --git a/doc-src/lib/stylesheets.rb b/doc-src/lib/stylesheets.rb index 5c3c898a..c2df6354 100644 --- a/doc-src/lib/stylesheets.rb +++ b/doc-src/lib/stylesheets.rb @@ -167,18 +167,6 @@ def examples(item, mixin = nil) end examples.map{|i| i.reps.find{|r| r.name == :default}} end - - -def mixin_source_dialog(mixin, &block) - vars = { - :html => { - :id => "mixin-source-#{mixin.name}", - :class => "mixin", - :title => "Source for +#{mixin.name}" - } - } - render 'dialog', vars, &block -end def format_doc(docstring) if docstring