qui-index-table 0.0.3 → 0.0.4

Sign up to get free protection for your applications and to get access to all the features.
data/Rakefile ADDED
@@ -0,0 +1,17 @@
1
+ require 'rake'
2
+
3
+ begin
4
+ require 'jeweler'
5
+ Jeweler::Tasks.new do |gemspec|
6
+ gemspec.name = "qui-index-table"
7
+ gemspec.summary = "qUI: rails helpers for generating index tables"
8
+ gemspec.description = "qUI: rails helpers for generating index tables"
9
+ gemspec.email = "marcin@saepia.net"
10
+ gemspec.homepage = "http://q.saepia.net"
11
+ gemspec.authors = ["Marcin Lewandowski"]
12
+ gemspec.version = "0.0.4"
13
+ gemspec.files = Rake::FileList.new [ "MIT-LICENSE", "Rakefile", "public/stylesheets/qui/*", "lib/*", "rails/*", "README.rdoc" ]
14
+ end
15
+ rescue LoadError
16
+ puts "Jeweler not available. Install it with: sudo gem install jeweler"
17
+ end
@@ -14,8 +14,29 @@ module QUI
14
14
  concat "<table class=\"index\" id=\"#{options[:id]}\"><thead><tr>"
15
15
 
16
16
  options[:headers].each do |h|
17
+ # Make a substitution for macros :oneicon and :check. Not too pretty but simple.
18
+ h = { nil => { :width => :oneicon } } if h == :oneicon or h == :check
19
+
17
20
  if h.is_a? Symbol
18
- concat content_tag(:th, t(h))
21
+
22
+ # If first character of column identifier is a dot, we assume it's attribute name.
23
+ # Try to lookup i18n translation.
24
+ if not data.nil? and data.respond_to?(:first) and h.to_s[0] == 46
25
+ # If there's no records, we would try to assume class name from controller name.
26
+ # Of course if it's not overriden by :klass option.
27
+
28
+ if options[:klass]
29
+ klass = options[:klass]
30
+ elsif data.first.nil?
31
+ klass = controller.class.to_s.demodulize.gsub("Controller", "").singularize.constantize
32
+ else
33
+ klass = data.first.class
34
+ end
35
+
36
+ concat content_tag(:th, klass.human_attribute_name(h.to_s[1..-1]))
37
+ else
38
+ concat content_tag(:th, t(h))
39
+ end
19
40
  elsif h.is_a? Hash
20
41
  name = h.keys.first
21
42
  if name
metadata CHANGED
@@ -1,13 +1,12 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: qui-index-table
3
3
  version: !ruby/object:Gem::Version
4
- hash: 25
5
4
  prerelease: false
6
5
  segments:
7
6
  - 0
8
7
  - 0
9
- - 3
10
- version: 0.0.3
8
+ - 4
9
+ version: 0.0.4
11
10
  platform: ruby
12
11
  authors:
13
12
  - Marcin Lewandowski
@@ -15,12 +14,12 @@ autorequire:
15
14
  bindir: bin
16
15
  cert_chain: []
17
16
 
18
- date: 2010-07-25 00:00:00 +02:00
17
+ date: 2010-08-09 00:00:00 +02:00
19
18
  default_executable:
20
19
  dependencies: []
21
20
 
22
21
  description: "qUI: rails helpers for generating index tables"
23
- email: saepia@saepia.net
22
+ email: marcin@saepia.net
24
23
  executables: []
25
24
 
26
25
  extensions: []
@@ -29,11 +28,12 @@ extra_rdoc_files:
29
28
  - README.rdoc
30
29
  files:
31
30
  - MIT-LICENSE
31
+ - README.rdoc
32
+ - Rakefile
32
33
  - lib/qui-index-table-main-helper.rb
33
34
  - lib/qui-index-table.rb
34
35
  - public/stylesheets/qui/index-table.css
35
36
  - rails/init.rb
36
- - README.rdoc
37
37
  has_rdoc: true
38
38
  homepage: http://q.saepia.net
39
39
  licenses: []
@@ -44,27 +44,23 @@ rdoc_options:
44
44
  require_paths:
45
45
  - lib
46
46
  required_ruby_version: !ruby/object:Gem::Requirement
47
- none: false
48
47
  requirements:
49
48
  - - ">="
50
49
  - !ruby/object:Gem::Version
51
- hash: 3
52
50
  segments:
53
51
  - 0
54
52
  version: "0"
55
53
  required_rubygems_version: !ruby/object:Gem::Requirement
56
- none: false
57
54
  requirements:
58
55
  - - ">="
59
56
  - !ruby/object:Gem::Version
60
- hash: 3
61
57
  segments:
62
58
  - 0
63
59
  version: "0"
64
60
  requirements: []
65
61
 
66
62
  rubyforge_project:
67
- rubygems_version: 1.3.7
63
+ rubygems_version: 1.3.6
68
64
  signing_key:
69
65
  specification_version: 3
70
66
  summary: "qUI: rails helpers for generating index tables"