Revisions
-
gt-sdi revised this gist
Jan 5, 2013 . 3 changed files with 9 additions and 8 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -17,7 +17,10 @@ In your Gemfile: `accordion` method options : - `:accordion_id` : when you want more than one accordion on the same page. `pane` method options : - `:open` : when you want that pane to be open on load. ### Tabs helper: This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -14,14 +14,12 @@ class AccordionBuilder delegate :capture, :content_tag, :link_to, :to => :parent def initialize opts, parent @parent = parent @opts = opts end def pane title, options = {}, &block css_class = options[:open] ? 'in' : '' content_tag :div, :class => 'accordion-group' do heading = content_tag :div, :class => 'accordion-heading' do link_to title, "##{title.parameterize}_pane", :class => 'accordion-toggle', :'data-toggle' => 'collapse', This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -1,14 +1,14 @@ Gem::Specification.new do |s| s.name = 'bootstrap-components-helpers' s.summary = 'Accordion view helper for Twitter Bootstrap' s.description = 'A micro gem providing an accordion view helper that generates the proper markup for Twitter Bootstrap. Modified by Graham to specify open accordion pane right on pane' s.version = '0.0.2' s.platform = Gem::Platform::RUBY s.files = ['bootstrap-components-helpers.rb', 'accordion_helper.rb', 'tabs_helper.rb'] s.require_path = '.' s.authors = ['Ivan Schneider', 'Graham Torn'] s.email = '[email protected]' s.homepage = 'https://dbinsights.herokuapp.com' -
gt-sdi revised this gist
Dec 11, 2012 . 1 changed file with 1 addition and 1 deletion.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -4,7 +4,7 @@ Provides an `accordion` helper and a `tabs` helper In your Gemfile: gem 'bootstrap-components-helpers', :git => 'git://gist.github.com/4254678.git' ### Accordion helper: -
isc revised this gist
Mar 26, 2012 . 1 changed file with 12 additions and 12 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -11,7 +11,7 @@ def accordion opts = {} class AccordionBuilder attr_reader :parent delegate :capture, :content_tag, :link_to, :to => :parent def initialize opts, parent @first = true @@ -20,20 +20,20 @@ def initialize opts, parent end def pane title, &block css_class = (@first && @opts[:open]) ? 'in' : '' @first = false content_tag :div, :class => 'accordion-group' do heading = content_tag :div, :class => 'accordion-heading' do link_to title, "##{title.parameterize}_pane", :class => 'accordion-toggle', :'data-toggle' => 'collapse', :'data-parent' => "##{@opts[:accordion_id]}" end body = content_tag :div, :class => "accordion-body collapse #{css_class}", :id => "#{title.parameterize}_pane" do content_tag :div, :class => 'accordion-inner' do capture(&block) end end heading + body end end end end -
isc revised this gist
Mar 25, 2012 . 2 changed files with 7 additions and 4 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -16,8 +16,8 @@ In your Gemfile: `accordion` method options : - `:accordion_id` : when you want more than one accordion on the same page. - `:open` : when you want the first pane to be open on load. ### Tabs helper: @@ -29,4 +29,5 @@ In your Gemfile: `tabs` method options : - `:direction` : to control the positioning of the tabs. Valid values are `below`, `left`, `right` and `above` (default is `above`). - `:style` : `tabs` or `pills` (default is `tabs`). This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -2,9 +2,10 @@ module BootstrapComponentsHelpers module TabsHelper def tabs opts = {} opts[:direction] ||= 'above' opts[:style] ||= 'tabs' builder = TabsBuilder.new self yield builder tabs = content_tag(:ul, builder.pane_handles.join("\n").html_safe, :class => "nav nav-#{opts[:style]}") contents = content_tag(:div, builder.pane_contents.join("\n").html_safe, :class => 'tab-content') css_direction = "tabs-#{opts[:direction]}" unless opts[:direction] == 'above' content_tag :div, :class => "tabbable #{css_direction}" do @@ -39,6 +40,7 @@ def pane title, &block end end end end -
isc revised this gist
Mar 25, 2012 . 1 changed file with 1 addition and 1 deletion.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -5,7 +5,7 @@ Gem::Specification.new do |s| s.version = '0.0.1' s.platform = Gem::Platform::RUBY s.files = ['bootstrap-components-helpers.rb', 'accordion_helper.rb', 'tabs_helper.rb'] s.require_path = '.' s.author = 'Ivan Schneider' -
isc revised this gist
Mar 25, 2012 . 1 changed file with 2 additions and 3 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -2,7 +2,7 @@ module BootstrapComponentsHelpers module TabsHelper def tabs opts = {} opts[:direction] ||= 'above' builder = TabsBuilder.new self yield builder tabs = content_tag(:ul, builder.pane_handles.join("\n").html_safe, :class => 'nav nav-tabs') contents = content_tag(:div, builder.pane_contents.join("\n").html_safe, :class => 'tab-content') @@ -21,10 +21,9 @@ class TabsBuilder attr_reader :parent, :pane_contents, :pane_handles delegate :capture, :content_tag, :to => :parent def initialize parent @first = true @parent = parent @pane_handles = [] @pane_contents = [] end -
isc revised this gist
Mar 25, 2012 . 5 changed files with 108 additions and 46 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -1,10 +1,12 @@ ## Twitter Bootstrap Components Helper Provides an `accordion` helper and a `tabs` helper In your Gemfile: gem 'bootstrap-components-helpers', :git => 'git://gist.github.com/2117187.git' ### Accordion helper: = accordion do |accordion| = accordion.pane 'My first pane' do @@ -15,4 +17,16 @@ In your views: `accordion` method options : - `:accordion_id` : when you want more than one accordion on the same page - `:open` : when you want the first pane to be open on load ### Tabs helper: = tabs do |tabs| - tabs.pane 'My first pane' do = render partial: 'my_first_pane' - tabs.pane 'My second pane' do = render partial: 'my_second_pane' `tabs` method options : - `:direction` : to control the positioning of the tabs. Valid values are below, left, right and above (default). This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,42 @@ module BootstrapComponentsHelpers module AccordionHelper def accordion opts = {} opts[:accordion_id] ||= 'accordion' builder = AccordionBuilder.new opts, self content_tag :div, :class => 'accordion', :id => opts[:accordion_id] do yield builder end end class AccordionBuilder attr_reader :parent delegate :capture, :to => :parent def initialize opts, parent @first = true @parent = parent @opts = opts end def pane title, &block b = Builder::XmlMarkup.new b.div :class => 'accordion-group' do b.div :class => 'accordion-heading' do b.a title, :class => 'accordion-toggle', :'data-toggle' => 'collapse', :'data-parent' => "##{@opts[:accordion_id]}", :href => "##{title.parameterize}_pane" end css_class = (@first && @opts[:open]) ? 'in' : '' @first = false b.div :class => "accordion-body collapse #{css_class}", :id => "#{title.parameterize}_pane" do b.div :class => 'accordion-inner' do b << capture(&block) end end end.html_safe end end end end ActionView::Base.send :include, BootstrapComponentsHelpers::AccordionHelper This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -5,7 +5,7 @@ Gem::Specification.new do |s| s.version = '0.0.1' s.platform = Gem::Platform::RUBY s.files = ['bootstrap-components-helpers.rb', 'accordion-helper.rb', 'tabs-helper.rb'] s.require_path = '.' s.author = 'Ivan Schneider' This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -1,42 +1,2 @@ require 'accordion_helper' require 'tabs_helper' This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,46 @@ module BootstrapComponentsHelpers module TabsHelper def tabs opts = {} opts[:direction] ||= 'above' builder = TabsBuilder.new opts, self yield builder tabs = content_tag(:ul, builder.pane_handles.join("\n").html_safe, :class => 'nav nav-tabs') contents = content_tag(:div, builder.pane_contents.join("\n").html_safe, :class => 'tab-content') css_direction = "tabs-#{opts[:direction]}" unless opts[:direction] == 'above' content_tag :div, :class => "tabbable #{css_direction}" do if opts[:direction] == 'below' contents + tabs else tabs + contents end end end class TabsBuilder attr_reader :parent, :pane_contents, :pane_handles delegate :capture, :content_tag, :to => :parent def initialize opts, parent @first = true @parent = parent @opts = opts @pane_handles = [] @pane_contents = [] end def pane title, &block css_class, @first = 'active', false if @first link = content_tag(:a, title, :'data-toggle' => 'tab', :href => "##{title.parameterize}_tab") @pane_handles << content_tag(:li, link, :class => css_class) @pane_contents << (content_tag :div, :class => "tab-pane #{css_class}", :id => "#{title.parameterize}_tab" do capture(&block) end) nil end end end end ActionView::Base.send :include, BootstrapComponentsHelpers::TabsHelper -
isc renamed this gist
Mar 19, 2012 . 1 changed file with 0 additions and 0 deletions.There are no files selected for viewing
File renamed without changes. -
isc revised this gist
Mar 19, 2012 . 1 changed file with 13 additions and 1 deletion.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -1,6 +1,18 @@ # In your Gemfile: gem 'bootstrap-components-helpers', :git => 'git://gist.github.com/2117187.git' In your views: = accordion do |accordion| = accordion.pane 'My first pane' do = render partial: 'my_first_pane' = accordion.pane 'My second pane' do = render partial: 'my_second_pane' `accordion` method options : - `:accordion_id` : when you want more than one accordion on the same page - `:open` : when you want the first pane to be open on load -
isc revised this gist
Mar 19, 2012 . 3 changed files with 2 additions and 12 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -2,15 +2,5 @@ Description and usage: gem 'bootstrap-components-helpers', :git => 'git://gist.github.com/2117187.git' This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -5,7 +5,7 @@ Gem::Specification.new do |s| s.version = '0.0.1' s.platform = Gem::Platform::RUBY s.files = ['bootstrap-components-helpers.rb'] s.require_path = '.' s.author = 'Ivan Schneider' File renamed without changes. -
isc revised this gist
Mar 19, 2012 . 3 changed files with 75 additions and 1 deletion.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -1 +1,16 @@ # Description and usage: require '' .new # Running the tests Install the rspec gem gem install rspec Run the spec rspec _spec.rb This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,17 @@ Gem::Specification.new do |s| s.name = 'bootstrap-components-helpers' s.summary = 'Accordion view helper for Twitter Bootstrap' s.description = 'A micro gem providing an accordion view helper that generates the proper markup for Twitter Bootstrap' s.version = '0.0.1' s.platform = Gem::Platform::RUBY s.files = ['bootstrap_components_helpers.rb'] s.require_path = '.' s.author = 'Ivan Schneider' s.email = '[email protected]' s.homepage = 'https://dbinsights.herokuapp.com' # s.test_file = '_spec.rb' # s.add_development_dependency('rspec', ["~> 2.8"]) end This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,42 @@ module BootstrapComponentsHelpers module AccordionHelper def accordion opts = {} opts[:accordion_id] ||= 'accordion' builder = AccordionBuilder.new opts, self content_tag :div, :class => 'accordion', :id => opts[:accordion_id] do yield builder end end class AccordionBuilder attr_reader :parent delegate :capture, :to => :parent def initialize opts, parent @first = true @parent = parent @opts = opts end def pane title, &block b = Builder::XmlMarkup.new b.div :class => 'accordion-group' do b.div :class => 'accordion-heading' do b.a title, :class => 'accordion-toggle', :'data-toggle' => 'collapse', :'data-parent' => "##{@opts[:accordion_id]}", :href => "##{title.parameterize}_pane" end css_class = (@first && @opts[:open]) ? 'in' : '' @first = false b.div :class => "accordion-body collapse #{css_class}", :id => "#{title.parameterize}_pane" do b.div :class => 'accordion-inner' do b << capture(&block) end end end.html_safe end end end end ActionView::Base.send :include, BootstrapComponentsHelpers::AccordionHelper -
isc created this gist
Mar 19, 2012 .There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1 @@ Dummy content