Sha256: 5ec2096a4be94a83970dc7860e3fa45fe7d1d779730c4c61423fed7d9028d9f9

Contents?: true

Size: 1.78 KB

Versions: 18

Compression:

Stored size: 1.78 KB

Contents

module BivouacSample::Views
  def toggle_sortable
    html do
      head do
        javascript_include_tag :defaults
        stylesheet_link_tag "coderay"
      end
      body do
        h1 "sortable / sortable_element"
        ul( :id => 'my_list' ) do
          li( "Google", :id => "li_1" )
          li( "Yahoo", :id => "li_2" )
          li( "Accoona", :id => "li_3" )
          li( "Ask.com", :id => "li_4" )
          li( "Baidu", :id => "li_5" )
          li( "Exalead", :id => "li_6" )
          li( "Voila", :id => "li_7" )
          li( "Lycos", :id => "li_8" )
        end
        
        div( :id => "sortable" ) do
          button_to_function "Rendre la liste triable" do |page|
            page.toggle "sortable", "unsortable", "result"
            page.sortable( 'my_list', :onChange => { 
              :update => 'result',
              :url => R(ToggleSortable)
            } )
          end
        end
        
        div( :id => "unsortable", :style => "display: none;" ) do
          button_to_function "Rendre la liste non triable" do |page|
            page.toggle "sortable", "unsortable", "result"
            page.unsortable( 'my_list' )
          end
        end
        
        div( :id => 'result', :style => "display: none;" )do; end
        
        hr
        p { span "Source du controller "; tt "app/controller/sortable_result.rb" }
        highlight_file( File.dirname( __FILE__ ) + "/../controllers/toggle_sortable.rb", :id => "source0")
        
        p { span "Source de la vue "; tt "app/views/toggle_sortable.rb" }
        highlight_file( __FILE__, :id => "source1" )
        
        p { span "Source de la vue "; tt "app/views/_sortable_result.rb" }
        highlight_file( File.dirname( __FILE__ ) + "/_sortable_result.rb", :id => "source2")
      end
    end
  end
end

Version data entries

18 entries across 18 versions & 1 rubygems

Version Path
bivouac-0.0.7 examples/bivouac_sample/app/views/toggle_sortable.rb
bivouac-0.1.1 examples/bivouac_sample/app/views/toggle_sortable.rb
bivouac-0.1.0 examples/bivouac_sample/app/views/toggle_sortable.rb
bivouac-0.0.8 examples/bivouac_sample/app/views/toggle_sortable.rb
bivouac-0.0.9 examples/bivouac_sample/app/views/toggle_sortable.rb
bivouac-0.1.2 examples/bivouac_sample/app/views/toggle_sortable.rb
bivouac-0.1.5 examples/bivouac_sample/app/views/toggle_sortable.rb
bivouac-0.1.4 examples/bivouac_sample/app/views/toggle_sortable.rb
bivouac-0.1.3 examples/bivouac_sample/app/views/toggle_sortable.rb
bivouac-0.1.6 examples/bivouac_sample/app/views/toggle_sortable.rb
bivouac-0.2.0 examples/bivouac_sample/app/views/toggle_sortable.rb
bivouac-0.2.1 examples/bivouac_sample/app/views/toggle_sortable.rb
bivouac-0.2.3 examples/bivouac_sample/app/views/toggle_sortable.rb
bivouac-0.2.2 examples/bivouac_sample/app/views/toggle_sortable.rb
bivouac-0.2.4 examples/bivouac_sample/app/views/toggle_sortable.rb
bivouac-0.2.5 examples/bivouac_sample/app/views/toggle_sortable.rb
bivouac-0.3.0 examples/bivouac_sample/app/views/toggle_sortable.rb
bivouac-0.4.0 examples/bivouac_sample/app/views/toggle_sortable.rb