mix-rails-settings 0.22.0 → 0.23.0
Sign up to get free protection for your applications and to get access to all the features.
- data/app/models/admix/settings_datagrid.rb +1 -1
- data/app/models/setting.rb +11 -18
- data/app/uploaders/settings/image_uploader.rb +2 -3
- data/db/migrate/20130206201915_create_settings.rb +13 -0
- data/db/migrate/20130206212203_add_image_to_setting.rb +5 -0
- data/lib/mix-rails-settings/engine.rb +5 -0
- data/lib/mix-rails-settings/version.rb +1 -1
- metadata +6 -4
data/app/models/setting.rb
CHANGED
@@ -1,19 +1,11 @@
|
|
1
|
-
class Setting
|
2
|
-
|
3
|
-
|
4
|
-
field :name, type: String
|
5
|
-
field :key, type: String
|
6
|
-
field :value
|
7
|
-
field :activated, type: Boolean
|
8
|
-
field :system, type: Boolean, default: false
|
9
|
-
|
10
|
-
validates_uniqueness_of :key
|
1
|
+
class Setting < ActiveRecord::Base
|
2
|
+
attr_accessible :activated, :key, :name, :system, :value, :image, :image_cache
|
11
3
|
|
12
4
|
mount_uploader :image, Settings::ImageUploader
|
13
|
-
|
5
|
+
|
14
6
|
def self.app_title
|
15
7
|
begin
|
16
|
-
Setting.
|
8
|
+
Setting.where(key: 'app_title', activated: true).first.value
|
17
9
|
rescue
|
18
10
|
false
|
19
11
|
end
|
@@ -21,7 +13,7 @@ class Setting
|
|
21
13
|
|
22
14
|
def self.app_email
|
23
15
|
begin
|
24
|
-
Setting.
|
16
|
+
Setting.where(key: 'app_email', activated: true).first.value
|
25
17
|
rescue
|
26
18
|
false
|
27
19
|
end
|
@@ -29,7 +21,7 @@ class Setting
|
|
29
21
|
|
30
22
|
def self.admix_logo
|
31
23
|
begin
|
32
|
-
Setting.
|
24
|
+
Setting.where(key: 'admix_logo', activated: true).first
|
33
25
|
rescue
|
34
26
|
false
|
35
27
|
end
|
@@ -37,7 +29,7 @@ class Setting
|
|
37
29
|
|
38
30
|
def self.link_twitter
|
39
31
|
begin
|
40
|
-
Setting.
|
32
|
+
Setting.where(key: 'link_twitter', activated: true).first.value
|
41
33
|
rescue
|
42
34
|
false
|
43
35
|
end
|
@@ -45,7 +37,7 @@ class Setting
|
|
45
37
|
|
46
38
|
def self.link_facebook
|
47
39
|
begin
|
48
|
-
Setting.
|
40
|
+
Setting.where(key: 'link_facebook', activated: true).first.value
|
49
41
|
rescue
|
50
42
|
false
|
51
43
|
end
|
@@ -53,7 +45,7 @@ class Setting
|
|
53
45
|
|
54
46
|
def self.albums_watermark
|
55
47
|
begin
|
56
|
-
Setting.
|
48
|
+
Setting.where(key: 'albums_watermark', activated: true).first
|
57
49
|
rescue
|
58
50
|
false
|
59
51
|
end
|
@@ -61,10 +53,11 @@ class Setting
|
|
61
53
|
|
62
54
|
def self.albums_title
|
63
55
|
begin
|
64
|
-
Setting.
|
56
|
+
Setting.where(key: 'albums_title', activated: true).first.value
|
65
57
|
rescue
|
66
58
|
false
|
67
59
|
end
|
68
60
|
end
|
69
61
|
|
62
|
+
|
70
63
|
end
|
@@ -11,14 +11,13 @@ class Settings::ImageUploader < CarrierWave::Uploader::Base
|
|
11
11
|
include Sprockets::Helpers::RailsHelper
|
12
12
|
include Sprockets::Helpers::IsolatedHelper
|
13
13
|
|
14
|
-
|
15
|
-
storage :grid_fs
|
14
|
+
|
16
15
|
# storage :fog
|
17
16
|
|
18
17
|
# Override the directory where uploaded files will be stored.
|
19
18
|
# This is a sensible default for uploaders that are meant to be mounted:
|
20
19
|
def store_dir
|
21
|
-
"uploads/#{model.class.to_s.underscore}/#{mounted_as}/#{model.id}"
|
20
|
+
"system/uploads/#{model.class.to_s.underscore}/#{mounted_as}/#{model.id}"
|
22
21
|
end
|
23
22
|
|
24
23
|
def cache_dir
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: mix-rails-settings
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.23.0
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -10,7 +10,7 @@ authors:
|
|
10
10
|
autorequire:
|
11
11
|
bindir: bin
|
12
12
|
cert_chain: []
|
13
|
-
date: 2013-02-
|
13
|
+
date: 2013-02-08 00:00:00.000000000 Z
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
16
16
|
name: rails
|
@@ -48,6 +48,8 @@ files:
|
|
48
48
|
- config/locales/settings.pt-BR.yml
|
49
49
|
- config/locales/settings.en.yml
|
50
50
|
- config/routes.rb
|
51
|
+
- db/migrate/20130206201915_create_settings.rb
|
52
|
+
- db/migrate/20130206212203_add_image_to_setting.rb
|
51
53
|
- lib/tasks/settings_tasks.rake
|
52
54
|
- lib/mix-rails-settings/version.rb
|
53
55
|
- lib/mix-rails-settings/engine.rb
|
@@ -69,7 +71,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
69
71
|
version: '0'
|
70
72
|
segments:
|
71
73
|
- 0
|
72
|
-
hash:
|
74
|
+
hash: 1974863421853086140
|
73
75
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
74
76
|
none: false
|
75
77
|
requirements:
|
@@ -78,7 +80,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
78
80
|
version: '0'
|
79
81
|
segments:
|
80
82
|
- 0
|
81
|
-
hash:
|
83
|
+
hash: 1974863421853086140
|
82
84
|
requirements: []
|
83
85
|
rubyforge_project:
|
84
86
|
rubygems_version: 1.8.24
|