Changeset 129

Show
Ignore:
Timestamp:
01/22/2007 21:45:18 (22 months ago)
Author:
lwu
Message:

Adapt a few CSS styles from Junebug to the tippy tippy tepee

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • trunk/examples/tippytippytepee/tepee.rb

    r128 r129  
    132132          body { 
    133133            font-family: verdana, arial, sans-serif; 
     134            min-width: 800px; 
     135            background:#d7d7d7; 
     136            text-align: center; 
     137          } 
     138          #doc { 
     139            width: 800px; 
     140            background:#ffffff; 
     141            margin-left: auto; 
     142            margin-right: auto; 
     143            text-align: left; 
    134144          } 
    135145          h1, h2, h3, h4, h5 { 
     
    141151        END 
    142152        body do 
    143           p do 
    144             small do 
    145               span "welcome to " ; a 'tepee', :href => "http://code.whytheluckystiff.net/svn/camping/trunk/examples/tepee.rb" 
    146               span '. go ' ;       a 'home',  :href => R(Show, 'home') 
    147               span '. list all ' ; a 'pages', :href => R(List) 
     153          div :id=>'doc' do 
     154            p do 
     155              small do 
     156                span "welcome to " ; a 'tepee', :href => "http://code.whytheluckystiff.net/svn/camping/trunk/examples/tepee.rb" 
     157                span '. go ' ;       a 'home',  :href => R(Show, 'home') 
     158                span '. list all ' ; a 'pages', :href => R(List) 
     159              end 
     160            end 
     161            div.content do 
     162              self << yield 
    148163            end 
    149164          end 
    150           div.content do 
    151             self << yield 
    152           end 
    153165        end 
    154166      end 
    155167    else 
    156168      self << yield 
     169    end 
     170  end 
     171 
     172  def _show_error(box) 
     173    if @boxx 
     174      line_no = (@boxx.to_s.scan(/(\d+)/).flatten[1] || "1").to_i - @line_zero - 1 
     175      b { div.error! @boxx } #.to_s.gsub(/.eval.:\d+:/, '') 
     176      pre.plain do 
     177        @version.body.split("\n").each_with_index do |line, index| 
     178          n = index+1 
     179          text = n.to_s + ': ' + CGI::escapeHTML(line) 
     180          self << div.highlight { text } if (n == line_no) 
     181          self << text if (n != line_no) 
     182        end 
     183      end 
     184    end 
     185  end 
     186 
     187  def _show_actions 
     188    small do  
     189      span.actions do  
     190        text "Version #{@version.version} " 
     191        text "(current) " if @version.version == @page.version 
     192        a '«older',   :href => R(Show, @version.title, @version.version-1) unless @version.version == 1  
     193        a 'newer»',   :href => R(Show, @version.title, @version.version+1) unless @version.version == @page.version  
     194        a 'current',  :href => R(Show, @version.title)                     unless @version.version == @page.version  
     195        a 'versions', :href => R(Versions, @page.title)  
     196      end 
    157197    end 
    158198  end 
     
    161201    m = _markup @version.body 
    162202    unless @no_layout 
     203      _button 'edit', R(Edit, @version.title, @version.version), { :style=>'float: right; margin: 0 0 5px 5px;', :accesskey => 'e' } if (@version.version == @page.version) 
     204 
    163205      h1 @page.title 
    164206      div { m } 
    165       if @boxx 
    166         line_no = (@boxx.to_s.scan(/(\d+)/).flatten[1] || "1").to_i - @line_zero - 1 
    167         b { div.error! @boxx } #.to_s.gsub(/.eval.:\d+:/, '') 
    168         pre.plain do 
    169           @version.body.split("\n").each_with_index do |line, index| 
    170             n = index+1 
    171             text = n.to_s + ': ' + CGI::escapeHTML(line) 
    172             self << div.highlight { text } if (n == line_no) 
    173             self << text if (n != line_no) 
    174           end 
    175         end 
    176       end 
    177       p.actions do  
    178         _button 'edit',      :href => R(Edit, @version.title, @version.version)  
    179         _button 'back',      :href => R(Show, @version.title, @version.version-1) unless @version.version == 1  
    180         _button 'next',      :href => R(Show, @version.title, @version.version+1) unless @version.version == @page.version  
    181         _button 'current',   :href => R(Show, @version.title)                     unless @version.version == @page.version  
    182         _button 'versions',  :href => R(Versions, @page.title)  
    183       end 
     207 
     208      _show_error(@boxx) 
     209      _button 'edit', R(Edit, @version.title, @version.version), { :style=>'float: right; margin: 5px 0 0 5px;' } if (@version.version == @page.version && @version.body && @version.body.size > 20) 
     210      p { _show_actions } 
    184211    else 
    185212      self << m 
     
    190217    h1 @page.title  
    191218    form :method => 'post', :action => R(Edit, @page.title) do 
     219      input :type => 'submit', :value=>'save'  
    192220      p do 
    193221        textarea @page.body, :name => 'post_body', :rows => 30, :cols => 100 
     
    195223      input :type => 'submit', :value=>'save'  
    196224    end 
    197     _button 'cancel', :href => R(Show, @page.title, @page.version)  
     225    _button 'cancel', R(Show, @page.title, @page.version)  
    198226    a 'syntax', :href => 'http://pub.cozmixng.org/~the-rwiki/?cmd=view;name=ERbMemo.en', :target=>'_blank' 
    199227  end 
     
    212240        li do 
    213241          span page.version 
    214           _button 'show',   :href => R(Show, page.title, page.version) 
    215           _button 'edit',   :href => R(Edit, page.title, page.version) 
     242          _button 'show', R(Show, page.title, page.version) 
     243          _button 'edit', R(Edit, page.title, page.version) 
    216244        end 
    217245      end 
     
    219247  end 
    220248 
    221   def _button(text, options={}) 
    222     form :method=>:get, :action=>options[:href] do 
    223       input :type=>'submit', :name=>'submit', :value=>text 
     249  def _button(text, href, options={}) 
     250    form :method=>:get, :action=>href do 
     251      opts = {:type=>'submit', :name=>'submit', :value=>text}.merge(options) 
     252      input.button opts 
    224253    end 
    225254  end 
     
    352381div#error { background-color: #FF0066; color: #FFFFFF !important; } 
    353382 
     383span.actions a { 
     384    margin-right: 10px; 
     385} 
     386 
     387/* WIKI CONTENT STYLES */ 
     388.content { 
     389    padding: 0px 25px 5px 25px; 
     390    min-height: 300px; 
     391} 
     392 
    354393button, input { margin: 3px; } 
    355394