sufia-models 3.6.0 → 3.6.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/app/models/concerns/sufia/user.rb +5 -8
- data/app/models/sufia/avatar_uploader.rb +22 -0
- data/app/models/sufia/avatar_validator.rb +8 -0
- data/lib/generators/sufia/models/templates/migrations/add_avatars_to_users.rb +8 -2
- data/lib/sufia/models/engine.rb +1 -1
- data/lib/sufia/models/version.rb +1 -1
- data/lib/sufia/models.rb +1 -1
- data/sufia-models.gemspec +2 -8
- metadata +11 -37
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: b91fa92969ab94424eb6e9233e404c26ac564568
|
4
|
+
data.tar.gz: 60b9e09af7c7dba110f6184b840070654de5d390
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e2737bec3c1758c69607aab903e4a4d29a793f8121c8a8ade9d0959c57353c818f6a2c17db8e09028397037819dc2078b9b6dfd5f38e9169b96ead0e1f02b762
|
7
|
+
data.tar.gz: 2e5941ee1cf398cfbba3c6b2714cbe79e72628f5f7dbbd6a3bc7816ef50a53717f723caeadd5c21e21a5522598ccef80cdd00c7e6ae81c26b1f358e209d7eec6
|
@@ -21,14 +21,11 @@ module Sufia::User
|
|
21
21
|
# Setup accessible (or protected) attributes for your model
|
22
22
|
deprecated_attr_accessible *permitted_attributes
|
23
23
|
|
24
|
-
|
25
|
-
|
26
|
-
validates :avatar, :attachment_content_type => { :content_type => /^image\/(jpg|jpeg|pjpeg|png|x-png|gif)$/ }, :if => Proc.new { |p| p.avatar.file? }
|
27
|
-
validates :avatar, :attachment_size => { :less_than => 2.megabytes }, :if => Proc.new { |p| p.avatar.file? }
|
28
|
-
|
24
|
+
mount_uploader :avatar, AvatarUploader, :mount_on => :avatar_file_name
|
25
|
+
validates_with AvatarValidator
|
29
26
|
end
|
30
27
|
|
31
|
-
# Format the json for select2 which requires just an id and a field called text.
|
28
|
+
# Format the json for select2 which requires just an id and a field called text.
|
32
29
|
# If we need an alternate format we should probably look at a json template gem
|
33
30
|
def as_json(opts = nil)
|
34
31
|
{id: user_key, text: display_name ? "#{display_name} (#{user_key})" : user_key}
|
@@ -76,8 +73,8 @@ module Sufia::User
|
|
76
73
|
module ClassMethods
|
77
74
|
|
78
75
|
def permitted_attributes
|
79
|
-
[:email, :login, :display_name, :address, :admin_area,
|
80
|
-
:department, :title, :office, :chat_id, :website, :affiliation,
|
76
|
+
[:email, :login, :display_name, :address, :admin_area,
|
77
|
+
:department, :title, :office, :chat_id, :website, :affiliation,
|
81
78
|
:telephone, :avatar, :group_list, :groups_last_update, :facebook_handle,
|
82
79
|
:twitter_handle, :googleplus_handle]
|
83
80
|
end
|
@@ -0,0 +1,22 @@
|
|
1
|
+
class Sufia::AvatarUploader < CarrierWave::Uploader::Base
|
2
|
+
include CarrierWave::MiniMagick
|
3
|
+
include CarrierWave::Compatibility::Paperclip
|
4
|
+
|
5
|
+
process convert: 'png'
|
6
|
+
|
7
|
+
version :medium do
|
8
|
+
process resize_to_limit: [300, 300]
|
9
|
+
end
|
10
|
+
|
11
|
+
version :thumb do
|
12
|
+
process resize_to_limit: [100, 100]
|
13
|
+
end
|
14
|
+
|
15
|
+
def default_url
|
16
|
+
"/assets/missing_#{version_name}.png"
|
17
|
+
end
|
18
|
+
|
19
|
+
def extension_white_list
|
20
|
+
%w(jpg jpeg png gif bmp tif tiff)
|
21
|
+
end
|
22
|
+
end
|
@@ -1,9 +1,15 @@
|
|
1
1
|
class AddAvatarsToUsers < ActiveRecord::Migration
|
2
2
|
def self.up
|
3
|
-
|
3
|
+
add_column :users, "avatar_file_name", :string
|
4
|
+
add_column :users, "avatar_content_type", :string
|
5
|
+
add_column :users, "avatar_file_size", :integer
|
6
|
+
add_column :users, "avatar_updated_at", :datetime
|
4
7
|
end
|
5
8
|
|
6
9
|
def self.down
|
7
|
-
|
10
|
+
remove_column :users, "avatar_file_name"
|
11
|
+
remove_column :users, "avatar_content_type"
|
12
|
+
remove_column :users, "avatar_file_size"
|
13
|
+
remove_column :users, "avatar_updated_at"
|
8
14
|
end
|
9
15
|
end
|
data/lib/sufia/models/engine.rb
CHANGED
@@ -22,7 +22,7 @@ module Sufia
|
|
22
22
|
config.fits_path = "fits.sh"
|
23
23
|
config.enable_contact_form_delivery = false
|
24
24
|
config.dropbox_api_key = nil
|
25
|
-
config.enable_local_ingest = nil
|
25
|
+
config.enable_local_ingest = nil
|
26
26
|
config.queue = Sufia::Resque::Queue
|
27
27
|
|
28
28
|
config.autoload_paths += %W(
|
data/lib/sufia/models/version.rb
CHANGED
data/lib/sufia/models.rb
CHANGED
data/sufia-models.gemspec
CHANGED
@@ -29,20 +29,14 @@ Gem::Specification.new do |spec|
|
|
29
29
|
spec.add_dependency 'rails', '> 4.0.0', '< 5.0'
|
30
30
|
spec.add_dependency 'activeresource' # No longer a dependency of rails 4.0
|
31
31
|
|
32
|
-
|
33
|
-
# Since hydra 6.1 isn't out yet, we'll just build it so that it's compatible
|
34
|
-
# without an explicit dependency
|
35
|
-
spec.add_dependency "active-fedora", "~> 6.7.0"
|
36
|
-
spec.add_dependency "blacklight", "~> 4.5.0"
|
37
|
-
spec.add_dependency "hydra-head", "~> 6.4.0"
|
38
|
-
|
32
|
+
spec.add_dependency "hydra", "6.1.0"
|
39
33
|
spec.add_dependency 'nest', '~> 1.1.1'
|
40
34
|
spec.add_dependency 'resque', '~> 1.23'
|
41
35
|
spec.add_dependency 'resque-pool', '0.3.0'
|
42
36
|
spec.add_dependency 'noid', '~> 0.6.6'
|
43
37
|
spec.add_dependency 'mailboxer', '~> 0.11.0'
|
44
38
|
spec.add_dependency 'acts_as_follower', '>= 0.1.1', '< 0.3'
|
45
|
-
spec.add_dependency '
|
39
|
+
spec.add_dependency 'carrierwave', '~> 0.9.0'
|
46
40
|
spec.add_dependency 'hydra-derivatives', '~> 0.0.5'
|
47
41
|
spec.add_dependency 'activerecord-import'
|
48
42
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: sufia-models
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 3.6.
|
4
|
+
version: 3.6.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Jeremy Friesen
|
@@ -73,47 +73,19 @@ dependencies:
|
|
73
73
|
- !ruby/object:Gem::Version
|
74
74
|
version: '0'
|
75
75
|
- !ruby/object:Gem::Dependency
|
76
|
-
name:
|
76
|
+
name: hydra
|
77
77
|
requirement: !ruby/object:Gem::Requirement
|
78
78
|
requirements:
|
79
|
-
- -
|
80
|
-
- !ruby/object:Gem::Version
|
81
|
-
version: 6.7.0
|
82
|
-
type: :runtime
|
83
|
-
prerelease: false
|
84
|
-
version_requirements: !ruby/object:Gem::Requirement
|
85
|
-
requirements:
|
86
|
-
- - ~>
|
87
|
-
- !ruby/object:Gem::Version
|
88
|
-
version: 6.7.0
|
89
|
-
- !ruby/object:Gem::Dependency
|
90
|
-
name: blacklight
|
91
|
-
requirement: !ruby/object:Gem::Requirement
|
92
|
-
requirements:
|
93
|
-
- - ~>
|
94
|
-
- !ruby/object:Gem::Version
|
95
|
-
version: 4.5.0
|
96
|
-
type: :runtime
|
97
|
-
prerelease: false
|
98
|
-
version_requirements: !ruby/object:Gem::Requirement
|
99
|
-
requirements:
|
100
|
-
- - ~>
|
101
|
-
- !ruby/object:Gem::Version
|
102
|
-
version: 4.5.0
|
103
|
-
- !ruby/object:Gem::Dependency
|
104
|
-
name: hydra-head
|
105
|
-
requirement: !ruby/object:Gem::Requirement
|
106
|
-
requirements:
|
107
|
-
- - ~>
|
79
|
+
- - '='
|
108
80
|
- !ruby/object:Gem::Version
|
109
|
-
version: 6.
|
81
|
+
version: 6.1.0
|
110
82
|
type: :runtime
|
111
83
|
prerelease: false
|
112
84
|
version_requirements: !ruby/object:Gem::Requirement
|
113
85
|
requirements:
|
114
|
-
- -
|
86
|
+
- - '='
|
115
87
|
- !ruby/object:Gem::Version
|
116
|
-
version: 6.
|
88
|
+
version: 6.1.0
|
117
89
|
- !ruby/object:Gem::Dependency
|
118
90
|
name: nest
|
119
91
|
requirement: !ruby/object:Gem::Requirement
|
@@ -205,19 +177,19 @@ dependencies:
|
|
205
177
|
- !ruby/object:Gem::Version
|
206
178
|
version: '0.3'
|
207
179
|
- !ruby/object:Gem::Dependency
|
208
|
-
name:
|
180
|
+
name: carrierwave
|
209
181
|
requirement: !ruby/object:Gem::Requirement
|
210
182
|
requirements:
|
211
183
|
- - ~>
|
212
184
|
- !ruby/object:Gem::Version
|
213
|
-
version:
|
185
|
+
version: 0.9.0
|
214
186
|
type: :runtime
|
215
187
|
prerelease: false
|
216
188
|
version_requirements: !ruby/object:Gem::Requirement
|
217
189
|
requirements:
|
218
190
|
- - ~>
|
219
191
|
- !ruby/object:Gem::Version
|
220
|
-
version:
|
192
|
+
version: 0.9.0
|
221
193
|
- !ruby/object:Gem::Dependency
|
222
194
|
name: hydra-derivatives
|
223
195
|
requirement: !ruby/object:Gem::Requirement
|
@@ -276,6 +248,8 @@ files:
|
|
276
248
|
- app/models/local_authority_entry.rb
|
277
249
|
- app/models/single_use_link.rb
|
278
250
|
- app/models/subject_local_authority_entry.rb
|
251
|
+
- app/models/sufia/avatar_uploader.rb
|
252
|
+
- app/models/sufia/avatar_validator.rb
|
279
253
|
- app/models/trophy.rb
|
280
254
|
- app/models/version_committer.rb
|
281
255
|
- config/locales/sufia.en.yml
|