qui-index-table 0.0.4 → 0.0.6
Sign up to get free protection for your applications and to get access to all the features.
- data/Rakefile +1 -1
- data/lib/qui-index-table-main-helper.rb +18 -9
- metadata +9 -4
data/Rakefile
CHANGED
@@ -9,7 +9,7 @@ begin
|
|
9
9
|
gemspec.email = "marcin@saepia.net"
|
10
10
|
gemspec.homepage = "http://q.saepia.net"
|
11
11
|
gemspec.authors = ["Marcin Lewandowski"]
|
12
|
-
gemspec.version = "0.0.
|
12
|
+
gemspec.version = "0.0.6"
|
13
13
|
gemspec.files = Rake::FileList.new [ "MIT-LICENSE", "Rakefile", "public/stylesheets/qui/*", "lib/*", "rails/*", "README.rdoc" ]
|
14
14
|
end
|
15
15
|
rescue LoadError
|
@@ -6,8 +6,7 @@ module QUI
|
|
6
6
|
raise RuntimeError, "@index_table_count must be integer" unless @index_table_count.is_a? Fixnum
|
7
7
|
|
8
8
|
options[:headers] ||= []
|
9
|
-
|
10
|
-
options[:id] ||= default_id
|
9
|
+
options[:id] ||= "index_table_#{@index_table_count}"
|
11
10
|
|
12
11
|
concat pagination(data) if data.is_a? WillPaginate::Collection if defined?(WillPaginate) and defined?(pagination)
|
13
12
|
|
@@ -18,22 +17,32 @@ module QUI
|
|
18
17
|
h = { nil => { :width => :oneicon } } if h == :oneicon or h == :check
|
19
18
|
|
20
19
|
if h.is_a? Symbol
|
21
|
-
|
22
20
|
# If first character of column identifier is a dot, we assume it's attribute name.
|
23
21
|
# Try to lookup i18n translation.
|
24
|
-
if not data.nil? and data.respond_to?(:first) and h.to_s[0] == 46
|
22
|
+
if not data.nil? and data.respond_to?(:first) and h.to_s[0] == 46
|
25
23
|
# If there's no records, we would try to assume class name from controller name.
|
26
|
-
# Of course if it's not overriden by :
|
24
|
+
# Of course if it's not overriden by :class_name option.
|
27
25
|
|
28
|
-
if options[:
|
29
|
-
|
26
|
+
if options[:class_name] and options[:class_name].respond_to? :ancestors and options[:class_name].ancestors.include? ActiveRecord::Base
|
27
|
+
logger.info "1"
|
28
|
+
klass = options[:class_name]
|
29
|
+
|
30
30
|
elsif data.first.nil?
|
31
|
+
logger.info "2"
|
31
32
|
klass = controller.class.to_s.demodulize.gsub("Controller", "").singularize.constantize
|
32
|
-
|
33
|
+
elsif data.first.class.respond_to? :human_attribute_name
|
34
|
+
logger.info "3"
|
35
|
+
|
33
36
|
klass = data.first.class
|
34
37
|
end
|
35
38
|
|
36
|
-
|
39
|
+
logger.info klass.inspect
|
40
|
+
|
41
|
+
if klass
|
42
|
+
concat content_tag(:th, klass.human_attribute_name(h.to_s[1..-1]))
|
43
|
+
else
|
44
|
+
concat content_tag(:th, t(h))
|
45
|
+
end
|
37
46
|
else
|
38
47
|
concat content_tag(:th, t(h))
|
39
48
|
end
|
metadata
CHANGED
@@ -1,12 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: qui-index-table
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
+
hash: 19
|
4
5
|
prerelease: false
|
5
6
|
segments:
|
6
7
|
- 0
|
7
8
|
- 0
|
8
|
-
-
|
9
|
-
version: 0.0.
|
9
|
+
- 6
|
10
|
+
version: 0.0.6
|
10
11
|
platform: ruby
|
11
12
|
authors:
|
12
13
|
- Marcin Lewandowski
|
@@ -14,7 +15,7 @@ autorequire:
|
|
14
15
|
bindir: bin
|
15
16
|
cert_chain: []
|
16
17
|
|
17
|
-
date: 2010-08-
|
18
|
+
date: 2010-08-10 00:00:00 +02:00
|
18
19
|
default_executable:
|
19
20
|
dependencies: []
|
20
21
|
|
@@ -44,23 +45,27 @@ rdoc_options:
|
|
44
45
|
require_paths:
|
45
46
|
- lib
|
46
47
|
required_ruby_version: !ruby/object:Gem::Requirement
|
48
|
+
none: false
|
47
49
|
requirements:
|
48
50
|
- - ">="
|
49
51
|
- !ruby/object:Gem::Version
|
52
|
+
hash: 3
|
50
53
|
segments:
|
51
54
|
- 0
|
52
55
|
version: "0"
|
53
56
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
57
|
+
none: false
|
54
58
|
requirements:
|
55
59
|
- - ">="
|
56
60
|
- !ruby/object:Gem::Version
|
61
|
+
hash: 3
|
57
62
|
segments:
|
58
63
|
- 0
|
59
64
|
version: "0"
|
60
65
|
requirements: []
|
61
66
|
|
62
67
|
rubyforge_project:
|
63
|
-
rubygems_version: 1.3.
|
68
|
+
rubygems_version: 1.3.7
|
64
69
|
signing_key:
|
65
70
|
specification_version: 3
|
66
71
|
summary: "qUI: rails helpers for generating index tables"
|