typus 3.0.11.rc4 → 3.0.11.rc5

Sign up to get free protection for your applications and to get access to all the features.
@@ -17,7 +17,7 @@ module Admin
17
17
  count_items_to_relate = @model_to_relate.order(@model_to_relate.typus_order_by).count - @item.send(field).count
18
18
 
19
19
  if set_condition && !count_items_to_relate.zero?
20
- form = if Typus.autocomplete && (count_items_to_relate > Typus.autocomplete)
20
+ form = if Typus.autocomplete
21
21
  build_relate_form('admin/templates/relate_form_with_autocomplete')
22
22
  else
23
23
  @items_to_relate = @model_to_relate.order(@model_to_relate.typus_order_by) - @item.send(field)
@@ -50,7 +50,7 @@ module Admin
50
50
  count_items_to_relate = @model_to_relate.order(@model_to_relate.typus_order_by).count - @item.send(field).count
51
51
 
52
52
  if set_condition && !count_items_to_relate.zero?
53
- form = if Typus.autocomplete && (count_items_to_relate > Typus.autocomplete)
53
+ form = if Typus.autocomplete
54
54
  build_relate_form('admin/templates/relate_form_with_autocomplete')
55
55
  else
56
56
  @items_to_relate = @model_to_relate.order(@model_to_relate.typus_order_by) - @item.send(field)
@@ -161,21 +161,19 @@ module Admin
161
161
  message = link_to Typus::I18n.t("Add new"), options
162
162
  end
163
163
 
164
- # Set the template.
165
- template = if Typus.autocomplete && (related.respond_to?(:roots) || !(related.count > Typus.autocomplete))
166
- "admin/templates/belongs_to"
167
- else
168
- "admin/templates/belongs_to_with_autocomplete"
169
- end
170
-
171
- # Set the values.
172
- values = if related.respond_to?(:roots)
173
- expand_tree_into_select_field(related.roots, related_fk)
174
- elsif Typus.autocomplete && !(related.count > Typus.autocomplete)
175
- related.order(related.typus_order_by).map { |p| [p.to_label, p.id] }
176
- end
164
+ # By default the used template is ALWAYS `belongs_to` unless we have the
165
+ # `Typus.autocomplete` feature enabled.
166
+ template = Typus.autocomplete ? "belongs_to_with_autocomplete" : "belongs_to"
167
+
168
+ # If `Typus.autocomplete` is enabled we don't set the values as will be
169
+ # autocompleted.
170
+ if related.respond_to?(:roots)
171
+ values = expand_tree_into_select_field(related.roots, related_fk)
172
+ elsif !Typus.autocomplete
173
+ values = related.order(related.typus_order_by).map { |p| [p.to_label, p.id] }
174
+ end
177
175
 
178
- render template,
176
+ render "admin/templates/#{template}",
179
177
  :association => association,
180
178
  :resource => @resource,
181
179
  :attribute => attribute,
@@ -1,3 +1,3 @@
1
1
  module Typus
2
- VERSION = "3.0.11.rc4"
2
+ VERSION = "3.0.11.rc5"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: typus
3
3
  version: !ruby/object:Gem::Version
4
- version: 3.0.11.rc4
4
+ version: 3.0.11.rc5
5
5
  prerelease: 7
6
6
  platform: ruby
7
7
  authors:
@@ -9,12 +9,11 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2011-06-27 00:00:00.000000000 +02:00
13
- default_executable:
12
+ date: 2011-06-28 00:00:00.000000000Z
14
13
  dependencies:
15
14
  - !ruby/object:Gem::Dependency
16
15
  name: bcrypt-ruby
17
- requirement: &2154164760 !ruby/object:Gem::Requirement
16
+ requirement: &2153866820 !ruby/object:Gem::Requirement
18
17
  none: false
19
18
  requirements:
20
19
  - - ! '>='
@@ -22,10 +21,10 @@ dependencies:
22
21
  version: '0'
23
22
  type: :runtime
24
23
  prerelease: false
25
- version_requirements: *2154164760
24
+ version_requirements: *2153866820
26
25
  - !ruby/object:Gem::Dependency
27
26
  name: fastercsv
28
- requirement: &2154163540 !ruby/object:Gem::Requirement
27
+ requirement: &2153866300 !ruby/object:Gem::Requirement
29
28
  none: false
30
29
  requirements:
31
30
  - - ~>
@@ -33,10 +32,10 @@ dependencies:
33
32
  version: '1.5'
34
33
  type: :runtime
35
34
  prerelease: false
36
- version_requirements: *2154163540
35
+ version_requirements: *2153866300
37
36
  - !ruby/object:Gem::Dependency
38
37
  name: rails
39
- requirement: &2154162160 !ruby/object:Gem::Requirement
38
+ requirement: &2153865800 !ruby/object:Gem::Requirement
40
39
  none: false
41
40
  requirements:
42
41
  - - ~>
@@ -44,10 +43,10 @@ dependencies:
44
43
  version: 3.0.8
45
44
  type: :runtime
46
45
  prerelease: false
47
- version_requirements: *2154162160
46
+ version_requirements: *2153865800
48
47
  - !ruby/object:Gem::Dependency
49
48
  name: render_inheritable
50
- requirement: &2154161560 !ruby/object:Gem::Requirement
49
+ requirement: &2153865420 !ruby/object:Gem::Requirement
51
50
  none: false
52
51
  requirements:
53
52
  - - ! '>='
@@ -55,10 +54,10 @@ dependencies:
55
54
  version: '0'
56
55
  type: :runtime
57
56
  prerelease: false
58
- version_requirements: *2154161560
57
+ version_requirements: *2153865420
59
58
  - !ruby/object:Gem::Dependency
60
59
  name: will_paginate
61
- requirement: &2154160520 !ruby/object:Gem::Requirement
60
+ requirement: &2153864880 !ruby/object:Gem::Requirement
62
61
  none: false
63
62
  requirements:
64
63
  - - ~>
@@ -66,7 +65,7 @@ dependencies:
66
65
  version: 3.0.pre2
67
66
  type: :runtime
68
67
  prerelease: false
69
- version_requirements: *2154160520
68
+ version_requirements: *2153864880
70
69
  description: Ruby on Rails Admin Panel (Engine) to allow trusted users edit structured
71
70
  content.
72
71
  email:
@@ -481,7 +480,6 @@ files:
481
480
  - test/lib/typus_test.rb
482
481
  - test/test_helper.rb
483
482
  - typus.gemspec
484
- has_rdoc: true
485
483
  homepage: http://core.typuscms.com/
486
484
  licenses: []
487
485
  post_install_message:
@@ -502,7 +500,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
502
500
  version: 1.3.1
503
501
  requirements: []
504
502
  rubyforge_project: typus
505
- rubygems_version: 1.6.2
503
+ rubygems_version: 1.8.5
506
504
  signing_key:
507
505
  specification_version: 3
508
506
  summary: Effortless backend interface for Ruby on Rails applications. (Admin scaffold