typus 3.1.7 → 3.1.8

Sign up to get free protection for your applications and to get access to all the features.
@@ -4,6 +4,21 @@ CHANGELOG
4
4
  3.1.8 (unreleased)
5
5
  ------------------
6
6
 
7
+ * [CHANGED] CSV generation is now performed in memory so we play nice
8
+ with Heroku.
9
+
10
+ * [CHANGED] We now can export XML, CSV and JSON without restriction. If
11
+ fields are not defined for a format, defaults will be used.
12
+
13
+ * [CHANGED] Updated Kaminari to `0.13.0` so we are now Rails `3.2.0`
14
+ compatible.
15
+
16
+ * [CHANGED] We now also load configuration files from "lib/<plugin>/config"
17
+ as this is marked as deprecated in Rails 3.2.0.
18
+
19
+ * [CHANGED] Updated Gems for the dummy application. This fixes deprecation
20
+ warnings and keeps the plugin up to date.
21
+
7
22
  Changes: <https://github.com/fesplugas/typus/compare/v3.1.7...master>
8
23
 
9
24
 
data/Gemfile CHANGED
@@ -8,8 +8,8 @@ gemspec
8
8
  # Gems used only for assets and not required
9
9
  # in production environments by default.
10
10
  group :assets do
11
- gem 'sass-rails', '~> 3.1.5'
12
- gem 'coffee-rails', '~> 3.1.1'
11
+ gem 'sass-rails', '~> 3.2.3'
12
+ gem 'coffee-rails', '~> 3.2.1'
13
13
  gem 'uglifier', '>= 1.0.3'
14
14
  end
15
15
 
@@ -31,29 +31,29 @@ end
31
31
  # And this stuff needed for the demo application.
32
32
  gem "acts_as_list"
33
33
  gem "acts_as_tree"
34
- gem "factory_girl_rails", "~> 1.4.0"
34
+ gem "factory_girl_rails", "~> 1.6.0"
35
35
  gem "rails-permalink", "~> 1.0.0"
36
- gem "rails-trash", "~> 1.1.2"
36
+ gem "rails-trash", "~> 2.0.0"
37
37
 
38
38
  # For some reason I also need to define the `jquery-rails` gem here.
39
39
  gem "jquery-rails"
40
40
 
41
41
  # Rich Text Editor
42
- gem "ckeditor-rails", "0.0.2"
42
+ gem "ckeditor-rails", "~> 0.0.3"
43
43
 
44
44
  # Alternative authentication
45
- gem "devise", "~> 1.5.2"
45
+ gem "devise", "~> 2.0.0"
46
46
 
47
47
  # Asset Management with Dragonfly
48
- gem "dragonfly", "~> 0.9.8"
48
+ gem "dragonfly", "~> 0.9.10"
49
49
  gem "rack-cache", :require => "rack/cache"
50
50
 
51
51
  # Asset Management with Paperclip
52
- gem "paperclip", "~> 2.4.5"
52
+ gem "paperclip", "~> 2.5.2"
53
53
 
54
54
  # MongoDB
55
- gem "mongoid", "~> 2.3.4"
56
- gem "bson_ext", "~> 1.5.1"
55
+ gem "mongoid", "~> 2.4.3"
56
+ gem "bson_ext", "~> 1.5.2"
57
57
 
58
58
  group :test do
59
59
  gem "shoulda-context", "~> 1.0.0"
data/README.md CHANGED
@@ -23,7 +23,7 @@ You can try a demo [here][typus_demo].
23
23
  - Internationalized interface ([See available translations][typus_locales])
24
24
  - Customizable and extensible templates.
25
25
  - Integrated [paperclip][paperclip] and [dragonfly][dragonfly] attachments viewer.
26
- - Works with `Rails 3.1.X`.
26
+ - Works with `Rails 3.1.X` and `Rails 3.2.X`.
27
27
 
28
28
  ## Installing
29
29
 
@@ -2,9 +2,7 @@ class Admin::AccountController < Admin::BaseController
2
2
 
3
3
  layout 'admin/session'
4
4
 
5
- skip_before_filter :reload_config_and_roles
6
- skip_before_filter :authenticate
7
- skip_before_filter :set_locale
5
+ skip_before_filter :reload_config_and_roles, :authenticate, :set_locale
8
6
 
9
7
  before_filter :sign_in?, :except => [:forgot_password, :send_password, :show]
10
8
  before_filter :new?, :only => [:forgot_password, :send_password]
@@ -2,12 +2,9 @@ class Admin::BaseController < ActionController::Base
2
2
 
3
3
  include Typus::Authentication::const_get(Typus.authentication.to_s.classify)
4
4
 
5
- before_filter :reload_config_and_roles
6
- before_filter :authenticate
7
- before_filter :set_locale
5
+ before_filter :reload_config_and_roles, :authenticate, :set_locale
8
6
 
9
- helper_method :admin_user
10
- helper_method :current_role
7
+ helper_method :admin_user, :current_role
11
8
 
12
9
  protected
13
10
 
@@ -27,7 +27,9 @@ class Admin::ResourcesController < Admin::BaseController
27
27
  generate_html
28
28
  end
29
29
 
30
- %w(json xml csv).each { |f| format.send(f) { send("generate_#{f}") } }
30
+ format.csv { generate_csv }
31
+ format.json { export(:json) }
32
+ format.xml { export(:xml) }
31
33
  end
32
34
  end
33
35
 
@@ -198,12 +200,12 @@ class Admin::ResourcesController < Admin::BaseController
198
200
  def redirect_on_success
199
201
  path = params.dup.cleanup
200
202
 
201
- options = if params[:_save]
202
- { :action => nil, :id => nil }
203
- elsif params[:_addanother]
203
+ options = if params[:_addanother]
204
204
  { :action => 'new', :id => nil }
205
205
  elsif params[:_continue]
206
206
  { :action => 'edit', :id => @item.id }
207
+ else
208
+ { :action => nil, :id => nil }
207
209
  end
208
210
 
209
211
  message = params[:action].eql?('create') ? "%{model} successfully created." : "%{model} successfully updated."
@@ -1,7 +1,6 @@
1
1
  class Admin::SessionController < Admin::BaseController
2
2
 
3
- skip_before_filter :reload_config_and_roles
4
- skip_before_filter :authenticate
3
+ skip_before_filter :reload_config_and_roles, :authenticate
5
4
 
6
5
  before_filter :create_an_account?, :only => [:new, :create]
7
6
 
@@ -229,13 +229,15 @@ module Typus
229
229
  def model_configuration_files
230
230
  app = Typus.root.join("**", "*.yml")
231
231
  plugins = Rails.root.join("vendor", "plugins", "*", "config", "typus", "**", "*.yml")
232
- Dir[app, plugins].reject { |f| f.match(/_roles.yml/) }.sort
232
+ lib = Rails.root.join("lib", "*", "config", "typus", "**", "*.yml")
233
+ Dir[app, plugins, lib].reject { |f| f.match(/_roles.yml/) }.sort
233
234
  end
234
235
 
235
236
  def role_configuration_files
236
237
  app = Typus.root.join("**", "*_roles.yml")
237
238
  plugins = Rails.root.join("vendor", "plugins", "*", "config", "typus", "**", "*_roles.yml")
238
- Dir[app, plugins].sort
239
+ lib = Rails.root.join("lib", "*", "config", "typus", "**", "*_roles.yml")
240
+ Dir[app, plugins, lib].sort
239
241
  end
240
242
 
241
243
  def reload!
@@ -19,44 +19,29 @@ module Typus
19
19
  # to be able to process large amounts of data.
20
20
  #++
21
21
  def generate_csv
22
- if can_export?(:csv)
23
- fields = @resource.typus_fields_for(:csv)
24
-
25
- filename = Rails.root.join("tmp", "export-#{@resource.to_resource}-#{Time.zone.now.to_s(:number)}.csv")
26
-
27
- options = { :conditions => @conditions, :batch_size => 1000 }
28
-
29
- ::CSV.open(filename, 'w') do |csv|
30
- csv << fields.keys.map { |k| @resource.human_attribute_name(k) }
31
- @resource.find_in_batches(options) do |records|
32
- records.each do |record|
33
- csv << fields.map do |key, value|
34
- case value
35
- when :transversal
36
- a, b = key.split(".")
37
- record.send(a).send(b)
38
- when :belongs_to
39
- record.send(key).try(:to_label)
40
- else
41
- record.send(key)
42
- end
22
+ fields = @resource.typus_fields_for(:csv)
23
+ options = { :conditions => @conditions, :batch_size => 1000 }
24
+
25
+ data = ::CSV.generate do |csv|
26
+ csv << fields.keys.map { |k| @resource.human_attribute_name(k) }
27
+ @resource.find_in_batches(options) do |records|
28
+ records.each do |record|
29
+ csv << fields.map do |key, value|
30
+ case value
31
+ when :transversal
32
+ a, b = key.split(".")
33
+ record.send(a).send(b)
34
+ when :belongs_to
35
+ record.send(key).try(:to_label)
36
+ else
37
+ record.send(key)
43
38
  end
44
- end
39
+ end
45
40
  end
46
41
  end
47
-
48
- send_file filename
49
- else
50
- not_allowed
51
42
  end
52
- end
53
43
 
54
- def generate_json
55
- export(:json)
56
- end
57
-
58
- def generate_xml
59
- can_export?(:xml) ? export(:xml) : not_allowed
44
+ send_data data, :filename => "export-#{@resource.to_resource}-#{Time.zone.now.to_s(:number)}.csv"
60
45
  end
61
46
 
62
47
  def export(format)
@@ -69,10 +54,6 @@ module Typus
69
54
  render format => @items.send("to_#{format}", :methods => methods, :except => except)
70
55
  end
71
56
 
72
- def can_export?(format)
73
- @resource.typus_options_for(:export).extract_settings.include?(format.to_s)
74
- end
75
-
76
57
  end
77
58
  end
78
59
  end
@@ -31,7 +31,9 @@ module Typus
31
31
  render 'index'
32
32
  end
33
33
 
34
- %w(json xml csv).each { |f| format.send(f) { send("generate_#{f}") } }
34
+ format.csv { generate_csv }
35
+ format.json { export(:json) }
36
+ format.xml { export(:xml) }
35
37
  end
36
38
  end
37
39
 
@@ -1,3 +1,3 @@
1
1
  module Typus
2
- VERSION = "3.1.7"
2
+ VERSION = "3.1.8"
3
3
  end
@@ -28,7 +28,7 @@ Gem::Specification.new do |s|
28
28
 
29
29
  s.add_dependency "bcrypt-ruby", "~> 3.0.0"
30
30
  s.add_dependency "jquery-rails"
31
- s.add_dependency "kaminari", "~> 0.12.4"
31
+ s.add_dependency "kaminari", "~> 0.13.0"
32
32
  s.add_dependency "rails", ">= 3.1.3"
33
33
 
34
34
  # Development dependencies are defined in the `Gemfile`.
@@ -23,29 +23,32 @@
23
23
 
24
24
  /* @group Single Chosen */
25
25
  .chzn-container-single .chzn-single {
26
- background-color: #fff;
27
- background-image: -webkit-gradient(linear, left bottom, left top, color-stop(0, #eeeeee), color-stop(0.5, white));
28
- background-image: -webkit-linear-gradient(center bottom, #eeeeee 0%, white 50%);
29
- background-image: -moz-linear-gradient(center bottom, #eeeeee 0%, white 50%);
30
- background-image: -o-linear-gradient(top, #eeeeee 0%,#ffffff 50%);
31
- background-image: -ms-linear-gradient(top, #eeeeee 0%,#ffffff 50%);
26
+ background-color: #ffffff;
27
+ background-image: -webkit-gradient(linear, left bottom, left top, color-stop(0, #f4f4f4), color-stop(0.48, #eeeeee), color-stop(0.5, #f6f6f6), color-stop(0.8, #ffffff));
28
+ background-image: -webkit-linear-gradient(center bottom, #f4f4f4 0%, #eeeeee 48%, #f6f6f6 50%, #ffffff 80%);
29
+ background-image: -moz-linear-gradient(center bottom, #f4f4f4 0%, #eeeeee 48%, #f6f6f6 50%, #ffffff 80%);
30
+ background-image: -o-linear-gradient(top, #f4f4f4 0%, #eeeeee 48%, #f6f6f6 50%, #ffffff 80%);
31
+ background-image: -ms-linear-gradient(top, #f4f4f4 0%, #eeeeee 48%, #f6f6f6 50%, #ffffff 80%);
32
32
  filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#eeeeee', endColorstr='#ffffff',GradientType=0 );
33
- background-image: linear-gradient(top, #eeeeee 0%,#ffffff 50%);
34
- -webkit-border-radius: 4px;
35
- -moz-border-radius : 4px;
36
- border-radius : 4px;
33
+ background-image: linear-gradient(top, #f4f4f4 0%, #eeeeee 48%, #f6f6f6 50%, #ffffff 80%);
34
+ -webkit-border-radius: 5px;
35
+ -moz-border-radius : 5px;
36
+ border-radius : 5px;
37
37
  -moz-background-clip : padding;
38
38
  -webkit-background-clip: padding-box;
39
39
  background-clip : padding-box;
40
- border: 1px solid #aaa;
40
+ border: 1px solid #aaaaaa;
41
+ -webkit-box-shadow: 0 0 3px #ffffff inset, 0 1px 1px rgba(0,0,0,0.1);
42
+ -moz-box-shadow : 0 0 3px #ffffff inset, 0 1px 1px rgba(0,0,0,0.1);
43
+ box-shadow : 0 0 3px #ffffff inset, 0 1px 1px rgba(0,0,0,0.1);
41
44
  display: block;
42
45
  overflow: hidden;
43
46
  white-space: nowrap;
44
47
  position: relative;
45
- height: 26px;
46
- line-height: 26px;
48
+ height: 23px;
49
+ line-height: 23px;
47
50
  padding: 0 0 0 8px;
48
- color: #444;
51
+ color: #444444;
49
52
  text-decoration: none;
50
53
  }
51
54
  .chzn-container-single .chzn-single span {
@@ -61,7 +64,7 @@
61
64
  display: block;
62
65
  position: absolute;
63
66
  right: 26px;
64
- top: 8px;
67
+ top: 6px;
65
68
  width: 12px;
66
69
  height: 13px;
67
70
  font-size: 1px;
@@ -71,21 +74,6 @@
71
74
  background-position: right -11px;
72
75
  }
73
76
  .chzn-container-single .chzn-single div {
74
- -webkit-border-radius: 0 4px 4px 0;
75
- -moz-border-radius : 0 4px 4px 0;
76
- border-radius : 0 4px 4px 0;
77
- -moz-background-clip : padding;
78
- -webkit-background-clip: padding-box;
79
- background-clip : padding-box;
80
- background: #ccc;
81
- background-image: -webkit-gradient(linear, left bottom, left top, color-stop(0, #ccc), color-stop(0.6, #eee));
82
- background-image: -webkit-linear-gradient(center bottom, #ccc 0%, #eee 60%);
83
- background-image: -moz-linear-gradient(center bottom, #ccc 0%, #eee 60%);
84
- background-image: -o-linear-gradient(bottom, #ccc 0%, #eee 60%);
85
- background-image: -ms-linear-gradient(top, #cccccc 0%,#eeeeee 60%);
86
- filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#cccccc', endColorstr='#eeeeee',GradientType=0 );
87
- background-image: linear-gradient(top, #cccccc 0%,#eeeeee 60%);
88
- border-left: 1px solid #aaa;
89
77
  position: absolute;
90
78
  right: 0;
91
79
  top: 0;
@@ -94,7 +82,7 @@
94
82
  width: 18px;
95
83
  }
96
84
  .chzn-container-single .chzn-single div b {
97
- background: url('chosen-sprite.png') no-repeat 0 1px;
85
+ background: url('chosen-sprite.png') no-repeat 0 0;
98
86
  display: block;
99
87
  width: 100%;
100
88
  height: 100%;
@@ -104,6 +92,7 @@
104
92
  position: relative;
105
93
  margin: 0;
106
94
  white-space: nowrap;
95
+ z-index: 1010;
107
96
  }
108
97
  .chzn-container-single .chzn-search input {
109
98
  background: #fff url('chosen-sprite.png') no-repeat 100% -22px;
@@ -112,7 +101,6 @@
112
101
  background: url('chosen-sprite.png') no-repeat 100% -22px, -moz-linear-gradient(center bottom, white 85%, #eeeeee 99%);
113
102
  background: url('chosen-sprite.png') no-repeat 100% -22px, -o-linear-gradient(bottom, white 85%, #eeeeee 99%);
114
103
  background: url('chosen-sprite.png') no-repeat 100% -22px, -ms-linear-gradient(top, #ffffff 85%,#eeeeee 99%);
115
- background: url('chosen-sprite.png') no-repeat 100% -22px, -ms-linear-gradient(top, #ffffff 85%,#eeeeee 99%);
116
104
  background: url('chosen-sprite.png') no-repeat 100% -22px, linear-gradient(top, #ffffff 85%,#eeeeee 99%);
117
105
  margin: 1px 0;
118
106
  padding: 4px 20px 4px 5px;
@@ -143,9 +131,9 @@
143
131
  background-image: -webkit-linear-gradient(center bottom, white 85%, #eeeeee 99%);
144
132
  background-image: -moz-linear-gradient(center bottom, white 85%, #eeeeee 99%);
145
133
  background-image: -o-linear-gradient(bottom, white 85%, #eeeeee 99%);
146
- background-image: -ms-linear-gradient(top, #ffffff 85%,#eeeeee 99%);
134
+ background-image: -ms-linear-gradient(top, #ffffff 85%, #eeeeee 99%);
147
135
  filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#ffffff', endColorstr='#eeeeee',GradientType=0 );
148
- background-image: linear-gradient(top, #ffffff 85%,#eeeeee 99%);
136
+ background-image: linear-gradient(top, #ffffff 85%, #eeeeee 99%);
149
137
  border: 1px solid #aaa;
150
138
  margin: 0;
151
139
  padding: 0;
@@ -168,6 +156,9 @@
168
156
  color: #666;
169
157
  background: transparent !important;
170
158
  border: 0 !important;
159
+ font-family: sans-serif;
160
+ font-size: 100%;
161
+ height: 15px;
171
162
  padding: 5px;
172
163
  margin: 1px 0;
173
164
  outline: 0;
@@ -187,17 +178,20 @@
187
178
  -webkit-background-clip: padding-box;
188
179
  background-clip : padding-box;
189
180
  background-color: #e4e4e4;
190
- background-image: -webkit-gradient(linear, left bottom, left top, color-stop(0, #e4e4e4), color-stop(0.7, #eeeeee));
191
- background-image: -webkit-linear-gradient(center bottom, #e4e4e4 0%, #eeeeee 70%);
192
- background-image: -moz-linear-gradient(center bottom, #e4e4e4 0%, #eeeeee 70%);
193
- background-image: -o-linear-gradient(bottom, #e4e4e4 0%, #eeeeee 70%);
194
- background-image: -ms-linear-gradient(top, #e4e4e4 0%,#eeeeee 70%);
195
- filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#e4e4e4', endColorstr='#eeeeee',GradientType=0 );
196
- background-image: linear-gradient(top, #e4e4e4 0%,#eeeeee 70%);
181
+ background-image: -webkit-gradient(linear, left bottom, left top, color-stop(0, #eeeeee), color-stop(0.48, #e8e8e8), color-stop(0.5, #f0f0f0), color-stop(0.8, #f4f4f4));
182
+ background-image: -webkit-linear-gradient(center bottom, #eeeeee 0%, #e8e8e8 48%, #f0f0f0 50%, #f4f4f4 80%);
183
+ background-image: -moz-linear-gradient(center bottom, #eeeeee 0%, #e8e8e8 48%, #f0f0f0 50%, #f4f4f4 80%);
184
+ background-image: -o-linear-gradient(top, #eeeeee 0%, #e8e8e8 48%, #f0f0f0 50%, #f4f4f4 80%);
185
+ background-image: -ms-linear-gradient(top, #eeeeee 0%, #e8e8e8 48%, #f0f0f0 50%, #f4f4f4 80%);
186
+ filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#eeeeee', endColorstr='#f4f4f4',GradientType=0 );
187
+ background-image: linear-gradient(top, #eeeeee 0%, #e8e8e8 48%, #f0f0f0 50%, #f4f4f4 80%);
188
+ -webkit-box-shadow: 0 0 2px #ffffff inset, 0 1px 0 rgba(0,0,0,0.05);
189
+ -moz-box-shadow : 0 0 2px #ffffff inset, 0 1px 0 rgba(0,0,0,0.05);
190
+ box-shadow : 0 0 2px #ffffff inset, 0 1px 0 rgba(0,0,0,0.05);
197
191
  color: #333;
198
- border: 1px solid #b4b4b4;
192
+ border: 1px solid #aaaaaa;
199
193
  line-height: 13px;
200
- padding: 3px 19px 3px 6px;
194
+ padding: 3px 20px 3px 5px;
201
195
  margin: 3px 0 3px 5px;
202
196
  position: relative;
203
197
  }
@@ -228,7 +222,7 @@
228
222
  /* @group Results */
229
223
  .chzn-container .chzn-results {
230
224
  margin: 0 4px 4px 0;
231
- max-height: 190px;
225
+ max-height: 240px;
232
226
  padding: 0 0 0 4px;
233
227
  position: relative;
234
228
  overflow-x: hidden;
@@ -240,8 +234,8 @@
240
234
  }
241
235
  .chzn-container .chzn-results li {
242
236
  display: none;
243
- line-height: 80%;
244
- padding: 7px 7px 8px;
237
+ line-height: 15px;
238
+ padding: 5px 6px;
245
239
  margin: 0;
246
240
  list-style: none;
247
241
  }
@@ -250,7 +244,14 @@
250
244
  display: list-item;
251
245
  }
252
246
  .chzn-container .chzn-results .highlighted {
253
- background: #3875d7;
247
+ background-color: #3875d7;
248
+ background-image: -webkit-gradient(linear, left bottom, left top, color-stop(0.1, #2a62bc), color-stop(0.8, #3875d7));
249
+ background-image: -webkit-linear-gradient(center bottom, #2a62bc 10%, #3875d7 80%);
250
+ background-image: -moz-linear-gradient(center bottom, #2a62bc 10%, #3875d7 80%);
251
+ background-image: -o-linear-gradient(bottom, #2a62bc 10%, #3875d7 80%);
252
+ background-image: -ms-linear-gradient(top, #2a62bc 10%, #3875d7 80%);
253
+ filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#2a62bc', endColorstr='#3875d7',GradientType=0 );
254
+ background-image: linear-gradient(top, #2a62bc 10%, #3875d7 80%);
254
255
  color: #fff;
255
256
  }
256
257
  .chzn-container .chzn-results li em {
@@ -270,11 +271,34 @@
270
271
  font-weight: bold;
271
272
  }
272
273
  .chzn-container .chzn-results .group-option {
273
- padding-left: 20px;
274
+ padding-left: 15px;
274
275
  }
275
276
  .chzn-container-multi .chzn-drop .result-selected {
276
277
  display: none;
277
278
  }
279
+ .chzn-container .chzn-results-scroll {
280
+ background: white;
281
+ margin: 0px 4px;
282
+ position: absolute;
283
+ text-align: center;
284
+ width: 321px; /* This should by dynamic with js */
285
+ z-index: 1;
286
+ }
287
+ .chzn-container .chzn-results-scroll span {
288
+ display: inline-block;
289
+ height: 17px;
290
+ text-indent: -5000px;
291
+ width: 9px;
292
+ }
293
+ .chzn-container .chzn-results-scroll-down {
294
+ bottom: 0;
295
+ }
296
+ .chzn-container .chzn-results-scroll-down span {
297
+ background: url('chosen-sprite.png') no-repeat -4px -3px;
298
+ }
299
+ .chzn-container .chzn-results-scroll-up span {
300
+ background: url('chosen-sprite.png') no-repeat -22px -3px;
301
+ }
278
302
  /* @end */
279
303
 
280
304
  /* @group Active */
@@ -292,13 +316,13 @@
292
316
  -o-box-shadow : 0 1px 0 #fff inset;
293
317
  box-shadow : 0 1px 0 #fff inset;
294
318
  background-color: #eee;
295
- background-image: -webkit-gradient(linear, left bottom, left top, color-stop(0, white), color-stop(0.5, #eeeeee));
296
- background-image: -webkit-linear-gradient(center bottom, white 0%, #eeeeee 50%);
297
- background-image: -moz-linear-gradient(center bottom, white 0%, #eeeeee 50%);
298
- background-image: -o-linear-gradient(bottom, white 0%, #eeeeee 50%);
299
- background-image: -ms-linear-gradient(top, #ffffff 0%,#eeeeee 50%);
319
+ background-image: -webkit-gradient(linear, left bottom, left top, color-stop(0.2, white), color-stop(0.8, #eeeeee));
320
+ background-image: -webkit-linear-gradient(center bottom, white 20%, #eeeeee 80%);
321
+ background-image: -moz-linear-gradient(center bottom, white 20%, #eeeeee 80%);
322
+ background-image: -o-linear-gradient(bottom, white 20%, #eeeeee 80%);
323
+ background-image: -ms-linear-gradient(top, #ffffff 20%,#eeeeee 80%);
300
324
  filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#ffffff', endColorstr='#eeeeee',GradientType=0 );
301
- background-image: linear-gradient(top, #ffffff 0%,#eeeeee 50%);
325
+ background-image: linear-gradient(top, #ffffff 20%,#eeeeee 80%);
302
326
  -webkit-border-bottom-left-radius : 0;
303
327
  -webkit-border-bottom-right-radius: 0;
304
328
  -moz-border-radius-bottomleft : 0;
@@ -341,16 +365,15 @@
341
365
  .chzn-rtl { direction:rtl;text-align: right; }
342
366
  .chzn-rtl .chzn-single { padding-left: 0; padding-right: 8px; }
343
367
  .chzn-rtl .chzn-single span { margin-left: 26px; margin-right: 0; }
344
- .chzn-rtl .chzn-single div {
345
- left: 0; right: auto;
346
- border-left: none; border-right: 1px solid #aaaaaa;
347
- -webkit-border-radius: 4px 0 0 4px;
348
- -moz-border-radius : 4px 0 0 4px;
349
- border-radius : 4px 0 0 4px;
368
+
369
+ .chzn-rtl .chzn-single div { left: 3px; right: auto; }
370
+ .chzn-rtl .chzn-single abbr {
371
+ left: 26px;
372
+ right: auto;
350
373
  }
351
374
  .chzn-rtl .chzn-choices li { float: right; }
352
- .chzn-rtl .chzn-choices .search-choice { padding: 3px 6px 3px 19px; margin: 3px 5px 3px 0; }
353
- .chzn-rtl .chzn-choices .search-choice .search-choice-close { left: 5px; right: auto; background-position: right top;}
375
+ .chzn-rtl .chzn-choices .search-choice { padding: 3px 5px 3px 19px; margin: 3px 5px 3px 0; }
376
+ .chzn-rtl .chzn-choices .search-choice .search-choice-close { left: 4px; right: auto; background-position: right top;}
354
377
  .chzn-rtl.chzn-container-single .chzn-results { margin-left: 4px; margin-right: 0; padding-left: 0; padding-right: 4px; }
355
378
  .chzn-rtl .chzn-results .group-option { padding-left: 0; padding-right: 20px; }
356
379
  .chzn-rtl.chzn-container-active .chzn-single-with-drop div { border-right: none; }
@@ -361,8 +384,7 @@
361
384
  background: url('chosen-sprite.png') no-repeat -38px -22px, -moz-linear-gradient(center bottom, white 85%, #eeeeee 99%);
362
385
  background: url('chosen-sprite.png') no-repeat -38px -22px, -o-linear-gradient(bottom, white 85%, #eeeeee 99%);
363
386
  background: url('chosen-sprite.png') no-repeat -38px -22px, -ms-linear-gradient(top, #ffffff 85%,#eeeeee 99%);
364
- background: url('chosen-sprite.png') no-repeat -38px -22px, -ms-linear-gradient(top, #ffffff 85%,#eeeeee 99%);
365
387
  background: url('chosen-sprite.png') no-repeat -38px -22px, linear-gradient(top, #ffffff 85%,#eeeeee 99%);
366
388
  padding: 4px 5px 4px 20px;
367
389
  }
368
- /* @end */
390
+ /* @end */
@@ -1,7 +1,7 @@
1
1
  // Chosen, a Select Box Enhancer for jQuery and Protoype
2
2
  // by Patrick Filler for Harvest, http://getharvest.com
3
3
  //
4
- // Version 0.9.5
4
+ // Version 0.9.6
5
5
  // Full source at https://github.com/harvesthq/chosen
6
6
  // Copyright (c) 2011 Harvest http://getharvest.com
7
7
 
@@ -113,7 +113,7 @@
113
113
  this.results_showing = false;
114
114
  this.result_highlighted = null;
115
115
  this.result_single_selected = null;
116
- this.allow_single_deselect = (this.options.allow_single_deselect != null) && this.form_field.options[0].text === "" ? this.options.allow_single_deselect : false;
116
+ this.allow_single_deselect = (this.options.allow_single_deselect != null) && (this.form_field.options[0] != null) && this.form_field.options[0].text === "" ? this.options.allow_single_deselect : false;
117
117
  this.disable_search_threshold = this.options.disable_search_threshold || 0;
118
118
  this.choices = 0;
119
119
  return this.results_none_found = this.options.no_results_text || "No results match";
@@ -199,9 +199,9 @@
199
199
  break;
200
200
  case 27:
201
201
  if (this.results_showing) {
202
- return this.results_hide();
202
+ this.results_hide();
203
203
  }
204
- break;
204
+ return true;
205
205
  case 9:
206
206
  case 38:
207
207
  case 40:
@@ -247,7 +247,7 @@
247
247
  $ = jQuery;
248
248
  $.fn.extend({
249
249
  chosen: function(options) {
250
- if ($.browser === "msie" && ($.browser.version === "6.0" || $.browser.version === "7.0")) {
250
+ if ($.browser.msie && ($.browser.version === "6.0" || $.browser.version === "7.0")) {
251
251
  return this;
252
252
  }
253
253
  return $(this).each(function(input_field) {
@@ -288,9 +288,6 @@
288
288
  this.form_field_jq.hide().after(container_div);
289
289
  this.container = $('#' + this.container_id);
290
290
  this.container.addClass("chzn-container-" + (this.is_multiple ? "multi" : "single"));
291
- if (!this.is_multiple && this.form_field.options.length <= this.disable_search_threshold) {
292
- this.container.addClass("chzn-container-single-nosearch");
293
- }
294
291
  this.dropdown = this.container.find('div.chzn-drop').first();
295
292
  dd_top = this.container.height();
296
293
  dd_width = this.f_width - get_side_border_padding(this.dropdown);
@@ -314,7 +311,10 @@
314
311
  });
315
312
  }
316
313
  this.results_build();
317
- return this.set_tab_index();
314
+ this.set_tab_index();
315
+ return this.form_field_jq.trigger("liszt:ready", {
316
+ chosen: this
317
+ });
318
318
  };
319
319
  Chosen.prototype.register_observers = function() {
320
320
  this.container.mousedown(__bind(function(evt) {
@@ -357,20 +357,24 @@
357
357
  return this.search_field.focus(__bind(function(evt) {
358
358
  return this.input_focus(evt);
359
359
  }, this));
360
+ } else {
361
+ return this.container.click(__bind(function(evt) {
362
+ return evt.preventDefault();
363
+ }, this));
360
364
  }
361
365
  };
362
366
  Chosen.prototype.search_field_disabled = function() {
363
- this.is_disabled = this.form_field_jq.attr('disabled');
367
+ this.is_disabled = this.form_field_jq[0].disabled;
364
368
  if (this.is_disabled) {
365
369
  this.container.addClass('chzn-disabled');
366
- this.search_field.attr('disabled', true);
370
+ this.search_field[0].disabled = true;
367
371
  if (!this.is_multiple) {
368
372
  this.selected_item.unbind("focus", this.activate_action);
369
373
  }
370
374
  return this.close_field();
371
375
  } else {
372
376
  this.container.removeClass('chzn-disabled');
373
- this.search_field.attr('disabled', false);
377
+ this.search_field[0].disabled = false;
374
378
  if (!this.is_multiple) {
375
379
  return this.selected_item.bind("focus", this.activate_action);
376
380
  }
@@ -390,7 +394,7 @@
390
394
  }
391
395
  $(document).click(this.click_test_action);
392
396
  this.results_show();
393
- } else if (!this.is_multiple && evt && ($(evt.target) === this.selected_item || $(evt.target).parents("a.chzn-single").length)) {
397
+ } else if (!this.is_multiple && evt && (($(evt.target)[0] === this.selected_item[0]) || $(evt.target).parents("a.chzn-single").length)) {
394
398
  evt.preventDefault();
395
399
  this.results_toggle();
396
400
  }
@@ -442,8 +446,7 @@
442
446
  }
443
447
  };
444
448
  Chosen.prototype.results_build = function() {
445
- var content, data, startTime, _i, _len, _ref;
446
- startTime = new Date();
449
+ var content, data, _i, _len, _ref;
447
450
  this.parsing = true;
448
451
  this.results_data = root.SelectParser.select_to_array(this.form_field);
449
452
  if (this.is_multiple && this.choices > 0) {
@@ -451,6 +454,11 @@
451
454
  this.choices = 0;
452
455
  } else if (!this.is_multiple) {
453
456
  this.selected_item.find("span").text(this.default_text);
457
+ if (this.form_field.options.length <= this.disable_search_threshold) {
458
+ this.container.addClass("chzn-container-single-nosearch");
459
+ } else {
460
+ this.container.removeClass("chzn-container-single-nosearch");
461
+ }
454
462
  }
455
463
  content = '';
456
464
  _ref = this.results_data;
@@ -465,7 +473,7 @@
465
473
  } else if (data.selected && !this.is_multiple) {
466
474
  this.selected_item.find("span").text(data.text);
467
475
  if (this.allow_single_deselect) {
468
- this.selected_item.find("span").first().after("<abbr class=\"search-choice-close\"></abbr>");
476
+ this.single_deselect_control_build();
469
477
  }
470
478
  }
471
479
  }
@@ -644,7 +652,7 @@
644
652
  } else {
645
653
  this.selected_item.find("span").first().text(item.text);
646
654
  if (this.allow_single_deselect) {
647
- this.selected_item.find("span").first().after("<abbr class=\"search-choice-close\"></abbr>");
655
+ this.single_deselect_control_build();
648
656
  }
649
657
  }
650
658
  if (!(evt.metaKey && this.is_multiple)) {
@@ -673,9 +681,13 @@
673
681
  this.form_field_jq.trigger("change");
674
682
  return this.search_field_scale();
675
683
  };
684
+ Chosen.prototype.single_deselect_control_build = function() {
685
+ if (this.allow_single_deselect && this.selected_item.find("abbr").length < 1) {
686
+ return this.selected_item.find("span").first().after("<abbr class=\"search-choice-close\"></abbr>");
687
+ }
688
+ };
676
689
  Chosen.prototype.winnow_results = function() {
677
- var found, option, part, parts, regex, result_id, results, searchText, startTime, startpos, text, zregex, _i, _j, _len, _len2, _ref;
678
- startTime = new Date();
690
+ var found, option, part, parts, regex, result, result_id, results, searchText, startpos, text, zregex, _i, _j, _len, _len2, _ref;
679
691
  this.no_results_clear();
680
692
  results = 0;
681
693
  searchText = this.search_field.val() === this.default_text ? "" : $('<div/>').text($.trim(this.search_field.val())).html();
@@ -686,10 +698,11 @@
686
698
  option = _ref[_i];
687
699
  if (!option.disabled && !option.empty) {
688
700
  if (option.group) {
689
- $('#' + option.dom_id).hide();
701
+ $('#' + option.dom_id).css('display', 'none');
690
702
  } else if (!(this.is_multiple && option.selected)) {
691
703
  found = false;
692
704
  result_id = option.dom_id;
705
+ result = $("#" + result_id);
693
706
  if (regex.test(option.html)) {
694
707
  found = true;
695
708
  results += 1;
@@ -713,18 +726,16 @@
713
726
  } else {
714
727
  text = option.html;
715
728
  }
716
- if ($("#" + result_id).html !== text) {
717
- $("#" + result_id).html(text);
718
- }
719
- this.result_activate($("#" + result_id));
729
+ result.html(text);
730
+ this.result_activate(result);
720
731
  if (option.group_array_index != null) {
721
- $("#" + this.results_data[option.group_array_index].dom_id).show();
732
+ $("#" + this.results_data[option.group_array_index].dom_id).css('display', 'list-item');
722
733
  }
723
734
  } else {
724
735
  if (this.result_highlight && result_id === this.result_highlight.attr('id')) {
725
736
  this.result_clear_highlight();
726
737
  }
727
- this.result_deactivate($("#" + result_id));
738
+ this.result_deactivate(result);
728
739
  }
729
740
  }
730
741
  }
@@ -743,7 +754,7 @@
743
754
  for (_i = 0, _len = lis.length; _i < _len; _i++) {
744
755
  li = lis[_i];
745
756
  li = $(li);
746
- _results.push(li.hasClass("group-result") ? li.show() : !this.is_multiple || !li.hasClass("result-selected") ? this.result_activate(li) : void 0);
757
+ _results.push(li.hasClass("group-result") ? li.css('display', 'auto') : !this.is_multiple || !li.hasClass("result-selected") ? this.result_activate(li) : void 0);
747
758
  }
748
759
  return _results;
749
760
  };
@@ -826,6 +837,9 @@
826
837
  this.backstroke_length = this.search_field.val().length;
827
838
  break;
828
839
  case 9:
840
+ if (this.results_showing && !this.is_multiple) {
841
+ this.result_select(evt);
842
+ }
829
843
  this.mouse_on_container = false;
830
844
  break;
831
845
  case 13:
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.1.7
4
+ version: 3.1.8
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,11 +9,11 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2012-01-25 00:00:00.000000000 Z
12
+ date: 2012-02-05 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: bcrypt-ruby
16
- requirement: &70093502726560 !ruby/object:Gem::Requirement
16
+ requirement: &70159863686960 !ruby/object:Gem::Requirement
17
17
  none: false
18
18
  requirements:
19
19
  - - ~>
@@ -21,10 +21,10 @@ dependencies:
21
21
  version: 3.0.0
22
22
  type: :runtime
23
23
  prerelease: false
24
- version_requirements: *70093502726560
24
+ version_requirements: *70159863686960
25
25
  - !ruby/object:Gem::Dependency
26
26
  name: jquery-rails
27
- requirement: &70093502724380 !ruby/object:Gem::Requirement
27
+ requirement: &70159863684320 !ruby/object:Gem::Requirement
28
28
  none: false
29
29
  requirements:
30
30
  - - ! '>='
@@ -32,21 +32,21 @@ dependencies:
32
32
  version: '0'
33
33
  type: :runtime
34
34
  prerelease: false
35
- version_requirements: *70093502724380
35
+ version_requirements: *70159863684320
36
36
  - !ruby/object:Gem::Dependency
37
37
  name: kaminari
38
- requirement: &70093502721740 !ruby/object:Gem::Requirement
38
+ requirement: &70159863683580 !ruby/object:Gem::Requirement
39
39
  none: false
40
40
  requirements:
41
41
  - - ~>
42
42
  - !ruby/object:Gem::Version
43
- version: 0.12.4
43
+ version: 0.13.0
44
44
  type: :runtime
45
45
  prerelease: false
46
- version_requirements: *70093502721740
46
+ version_requirements: *70159863683580
47
47
  - !ruby/object:Gem::Dependency
48
48
  name: rails
49
- requirement: &70093502737120 !ruby/object:Gem::Requirement
49
+ requirement: &70159863682840 !ruby/object:Gem::Requirement
50
50
  none: false
51
51
  requirements:
52
52
  - - ! '>='
@@ -54,7 +54,7 @@ dependencies:
54
54
  version: 3.1.3
55
55
  type: :runtime
56
56
  prerelease: false
57
- version_requirements: *70093502737120
57
+ version_requirements: *70159863682840
58
58
  description: Ruby on Rails Admin Panel (Engine) to allow trusted users edit structured
59
59
  content.
60
60
  email:
@@ -333,7 +333,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
333
333
  version: '0'
334
334
  segments:
335
335
  - 0
336
- hash: 3514957204800588845
336
+ hash: -1439892809651849873
337
337
  required_rubygems_version: !ruby/object:Gem::Requirement
338
338
  none: false
339
339
  requirements:
@@ -342,10 +342,10 @@ required_rubygems_version: !ruby/object:Gem::Requirement
342
342
  version: '0'
343
343
  segments:
344
344
  - 0
345
- hash: 3514957204800588845
345
+ hash: -1439892809651849873
346
346
  requirements: []
347
347
  rubyforge_project: typus
348
- rubygems_version: 1.8.15
348
+ rubygems_version: 1.8.11
349
349
  signing_key:
350
350
  specification_version: 3
351
351
  summary: Effortless backend interface for Ruby on Rails applications. (Admin scaffold