qm-acts-as-generic-controller 0.1.15 → 0.1.16

Sign up to get free protection for your applications and to get access to all the features.
data/Rakefile CHANGED
@@ -1,4 +1,5 @@
1
1
  require 'rake'
2
+ require 'rubygems'
2
3
 
3
4
  begin
4
5
  require 'jeweler'
@@ -9,7 +10,7 @@ begin
9
10
  gemspec.email = "marcin@saepia.net"
10
11
  gemspec.homepage = "http://q.saepia.net"
11
12
  gemspec.authors = ["Marcin Lewandowski"]
12
- gemspec.version = "0.1.15"
13
+ gemspec.version = "0.1.16"
13
14
  gemspec.files = Rake::FileList.new [ "MIT-LICENSE", "Rakefile", "lib/*", "app/views/generic_controller/*" ]
14
15
  gemspec.add_dependency "qui-common-helpers", ">= 0.0.8"
15
16
  gemspec.add_dependency "qui-index-table", ">= 0.0.8"
@@ -45,6 +45,7 @@
45
45
  <%- end -%>
46
46
 
47
47
  <%- tab_contents = {} -%>
48
+ <%- tab_headers = {} -%>
48
49
  <%- record.class.generic_field_associations.each do |k,v| -%>
49
50
  <%- if current_user.respond_to? "has_privileges?" -%>
50
51
  <%- has_privileges = current_user.has_privileges?(:class_name => v[:class_name], :generic_action => :index_any) -%>
@@ -62,11 +63,19 @@
62
63
 
63
64
  <%- end -%>
64
65
 
65
- <%= render :partial => "generic_controller/index_table", :locals => { :records => record.send(k), :class_name => v[:class_name] } %>
66
+ <%- if v[:class_name].respond_to? :limit_for_user -%>
67
+ <%- tab_headers[k] = t(:"#{section_prefix}tabs.#{table_name}.#{k}") + " (#{record.send(k).limit_for_user(current_user).count})" %>
68
+ <%= render :partial => "generic_controller/index_table", :locals => { :records => record.send(k).limit_for_user(current_user), :class_name => v[:class_name] } %>
69
+
70
+ <%- else -%>
71
+ <%- tab_headers[k] = t(:"#{section_prefix}tabs.#{table_name}.#{k}") + " (#{record.send(k).count})" %>
72
+ <%= render :partial => "generic_controller/index_table", :locals => { :records => record.send(k), :class_name => v[:class_name] } %>
73
+ <%- end -%>
74
+
66
75
  <%- end -%>
67
76
  <%- end -%>
68
77
  <%- end -%>
69
78
 
70
- <%= tabs :tabs => [ { :header => { :text => :"#{section_prefix}tabs.common.description" }, :body => { :text => description } } ] + record.class.generic_field_associations.collect{|k,v| { :header => { :text => t(:"#{section_prefix}tabs.#{table_name}.#{k}") + " (#{record.send(k).count})" }, :body => { :text => tab_contents[k] } } if tab_contents.has_key?(k) and (v[:kind] == :has_many or v[:kind] == :has_and_belongs_to_many) and v[:through] == false and (record.send(k).count > 0 or v[:generic_create]) }.compact -%>
79
+ <%= tabs :tabs => [ { :header => { :text => :"#{section_prefix}tabs.common.description" }, :body => { :text => description } } ] + record.class.generic_field_associations.collect{|k,v| { :header => { :text => tab_headers[k] }, :body => { :text => tab_contents[k] } } if tab_contents.has_key?(k) and (v[:kind] == :has_many or v[:kind] == :has_and_belongs_to_many) and v[:through] == false and (record.send(k).count > 0 or v[:generic_create]) }.compact -%>
71
80
 
72
81
 
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: qm-acts-as-generic-controller
3
3
  version: !ruby/object:Gem::Version
4
- hash: 5
4
+ hash: 59
5
5
  prerelease: false
6
6
  segments:
7
7
  - 0
8
8
  - 1
9
- - 15
10
- version: 0.1.15
9
+ - 16
10
+ version: 0.1.16
11
11
  platform: ruby
12
12
  authors:
13
13
  - Marcin Lewandowski
@@ -15,7 +15,7 @@ autorequire:
15
15
  bindir: bin
16
16
  cert_chain: []
17
17
 
18
- date: 2010-12-07 00:00:00 +01:00
18
+ date: 2011-01-07 00:00:00 +01:00
19
19
  default_executable:
20
20
  dependencies:
21
21
  - !ruby/object:Gem::Dependency
@@ -150,8 +150,8 @@ homepage: http://q.saepia.net
150
150
  licenses: []
151
151
 
152
152
  post_install_message:
153
- rdoc_options:
154
- - --charset=UTF-8
153
+ rdoc_options: []
154
+
155
155
  require_paths:
156
156
  - lib
157
157
  required_ruby_version: !ruby/object:Gem::Requirement