stable-rails 0.0.5 → 0.0.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
| @@ -1,5 +1,5 @@ | |
| 1 1 | 
             
            module StableHelper
         | 
| 2 | 
            -
             | 
| 2 | 
            +
             | 
| 3 3 | 
             
            	def stable(options = {})
         | 
| 4 4 | 
             
            		@builder = STableBuilder.new(self, '/stable/stable')
         | 
| 5 5 | 
             
            		@builder.table(options) do
         | 
| @@ -64,20 +64,20 @@ class STableBuilder | |
| 64 64 | 
             
            	end
         | 
| 65 65 |  | 
| 66 66 | 
             
            	def table(options)
         | 
| 67 | 
            -
            		@options = options.reverse_merge!({ fixed_rows: 1 })
         | 
| 67 | 
            +
            		@options = options.reverse_merge!({ fixed_rows: 1, fixed_columns: 1 })
         | 
| 68 68 | 
             
            		html_options = options.clone
         | 
| 69 69 | 
             
            		html_options.delete :fixed_rows
         | 
| 70 70 |  | 
| 71 71 | 
             
            		yield
         | 
| 72 72 |  | 
| 73 | 
            -
            		@context.haml_concat @context.render(:partial => @partial_view, | 
| 74 | 
            -
            			:locals => { | 
| 75 | 
            -
            				:data => @data, | 
| 73 | 
            +
            		@context.haml_concat @context.render(:partial => @partial_view,
         | 
| 74 | 
            +
            			:locals => {
         | 
| 75 | 
            +
            				:data => @data,
         | 
| 76 76 | 
             
            				:options => @options,
         | 
| 77 77 | 
             
            				:html_options => html_options,
         | 
| 78 78 | 
             
            				:row_wrapper_html_options => @row_wrapper_html_options
         | 
| 79 79 | 
             
            			}
         | 
| 80 | 
            -
            		) | 
| 80 | 
            +
            		)
         | 
| 81 81 | 
             
            	end
         | 
| 82 82 |  | 
| 83 83 | 
             
            	def tr(html_options)
         | 
| @@ -96,7 +96,7 @@ class STableBuilder | |
| 96 96 | 
             
            		if @col_index >= @column_html_options.size
         | 
| 97 97 | 
             
            			@column_html_options << {}
         | 
| 98 98 | 
             
            		end
         | 
| 99 | 
            -
             | 
| 99 | 
            +
             | 
| 100 100 | 
             
            		# if html_options define style for column, override it
         | 
| 101 101 | 
             
            		if c = html_options.delete(:column)
         | 
| 102 102 | 
             
            			@column_html_options[@col_index] = c
         | 
| @@ -9,23 +9,25 @@ | |
| 9 9 | 
             
                    .t-header
         | 
| 10 10 | 
             
                      - (0..options[:fixed_rows]-1).each do |index|
         | 
| 11 11 | 
             
                        .t-row{row_wrapper_html_options[index]}
         | 
| 12 | 
            -
                           | 
| 13 | 
            -
                             | 
| 12 | 
            +
                          - (0..options[:fixed_columns]-1).each do |cell_index|
         | 
| 13 | 
            +
                            %div{data[index][cell_index][:html_options]}
         | 
| 14 | 
            +
                              = data[index][cell_index][:value]
         | 
| 14 15 | 
             
                    .t-body.vertical
         | 
| 15 16 | 
             
                      - data.enum_drop_with_index(options[:fixed_rows]) do |row, index|
         | 
| 16 17 | 
             
                        .t-row{row_wrapper_html_options[index]}
         | 
| 17 | 
            -
                           | 
| 18 | 
            -
                             | 
| 18 | 
            +
                          - (0..options[:fixed_columns]-1).each do |cell_index|
         | 
| 19 | 
            +
                            %div{row[cell_index][:html_options]}
         | 
| 20 | 
            +
                              = row[cell_index][:value]
         | 
| 19 21 | 
             
                  .c-right
         | 
| 20 22 | 
             
                    .t-header.horizontal
         | 
| 21 23 | 
             
                      - (0..options[:fixed_rows]-1).each do |index|
         | 
| 22 24 | 
             
                        .t-row{row_wrapper_html_options[index]}
         | 
| 23 | 
            -
                          - data[index].enum_drop( | 
| 25 | 
            +
                          - data[index].enum_drop(options[:fixed_columns]) do |cell|
         | 
| 24 26 | 
             
                            %div{cell[:html_options]}
         | 
| 25 27 | 
             
                              = cell[:value]
         | 
| 26 28 | 
             
                    .t-body.vertical.horizontal
         | 
| 27 29 | 
             
                      - data.enum_drop_with_index(options[:fixed_rows]) do |row, index|
         | 
| 28 30 | 
             
                        .t-row{row_wrapper_html_options[index]}
         | 
| 29 | 
            -
                          - row.enum_drop( | 
| 31 | 
            +
                          - row.enum_drop(options[:fixed_columns]) do |cell|
         | 
| 30 32 | 
             
                            %div{cell[:html_options]}
         | 
| 31 33 | 
             
                              = cell[:value]
         | 
    
        data/lib/stable-rails/version.rb
    CHANGED
    
    
    
        metadata
    CHANGED
    
    | @@ -1,7 +1,7 @@ | |
| 1 1 | 
             
            --- !ruby/object:Gem::Specification
         | 
| 2 2 | 
             
            name: stable-rails
         | 
| 3 3 | 
             
            version: !ruby/object:Gem::Version
         | 
| 4 | 
            -
              version: 0.0. | 
| 4 | 
            +
              version: 0.0.6
         | 
| 5 5 | 
             
              prerelease: 
         | 
| 6 6 | 
             
            platform: ruby
         | 
| 7 7 | 
             
            authors:
         | 
| @@ -10,7 +10,7 @@ authors: | |
| 10 10 | 
             
            autorequire: 
         | 
| 11 11 | 
             
            bindir: bin
         | 
| 12 12 | 
             
            cert_chain: []
         | 
| 13 | 
            -
            date: 2013- | 
| 13 | 
            +
            date: 2013-07-11 00:00:00.000000000 Z
         | 
| 14 14 | 
             
            dependencies:
         | 
| 15 15 | 
             
            - !ruby/object:Gem::Dependency
         | 
| 16 16 | 
             
              name: haml-rails
         | 
| @@ -110,7 +110,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement | |
| 110 110 | 
             
                  version: '0'
         | 
| 111 111 | 
             
            requirements: []
         | 
| 112 112 | 
             
            rubyforge_project: 
         | 
| 113 | 
            -
            rubygems_version: 1.8. | 
| 113 | 
            +
            rubygems_version: 1.8.23
         | 
| 114 114 | 
             
            signing_key: 
         | 
| 115 115 | 
             
            specification_version: 3
         | 
| 116 116 | 
             
            summary: Rails gem that allows to easily include scrollable tables.
         |