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.
@@ -3,7 +3,7 @@ class Admix::SettingsDatagrid
3
3
  include Datagrid
4
4
 
5
5
  scope do
6
- Setting.desc(:name)
6
+ Setting
7
7
  end
8
8
 
9
9
  filter :name, :string
@@ -1,19 +1,11 @@
1
- class Setting
2
- include Mongoid::Document
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.find_by(key: 'app_title', activated: true).value
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.find_by(key: 'app_email', activated: true).value
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.find_by(key: 'admix_logo', activated: true)
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.find_by(key: 'link_twitter', activated: true).value
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.find_by(key: 'link_facebook', activated: true).value
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.find_by(key: 'albums_watermark', activated: true)
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.find_by(key: 'albums_title', activated: true).value
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
- # Choose what kind of storage to use for this uploader:
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
@@ -0,0 +1,13 @@
1
+ class CreateSettings < ActiveRecord::Migration
2
+ def change
3
+ create_table :settings do |t|
4
+ t.string :name
5
+ t.string :key
6
+ t.string :value
7
+ t.boolean :activated
8
+ t.boolean :system
9
+
10
+ t.timestamps
11
+ end
12
+ end
13
+ end
@@ -0,0 +1,5 @@
1
+ class AddImageToSetting < ActiveRecord::Migration
2
+ def change
3
+ add_column :settings, :image, :string
4
+ end
5
+ end
@@ -1,5 +1,10 @@
1
1
  module MixRailsSettings
2
2
  class Engine < ::Rails::Engine
3
+
4
+ config.generators do |g|
5
+ g.test_framework :rspec
6
+ g.integration_tool :rspec
7
+ end
3
8
 
4
9
  initializer "settings.default_settings" do |app|
5
10
 
@@ -1,7 +1,7 @@
1
1
  module MixRailsSettings
2
2
  module VERSION #:nodoc:
3
3
  MAJOR = 0
4
- MINOR = 22
4
+ MINOR = 23
5
5
  TINY = 0
6
6
  PRE = nil
7
7
 
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.22.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-06 00:00:00.000000000 Z
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: -4399716911145312350
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: -4399716911145312350
83
+ hash: 1974863421853086140
82
84
  requirements: []
83
85
  rubyforge_project:
84
86
  rubygems_version: 1.8.24