mix-rails-settings 0.23.1 → 0.24.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 64e0885ca48f98616b2b72885de5d90462802ab7
4
+ data.tar.gz: f724bbf3d30d322a9057e3d816eca70fd0710e24
5
+ SHA512:
6
+ metadata.gz: 8f383a57b86d3fa3ffac2d81e03b033bc7574848f66f6da167aa2e971756d90b3eb4688a386aa243080eec138cf4249f6af5fde23cfb552be5a05cdb1505ad3d
7
+ data.tar.gz: bcb8e38fbd1c41135fee75065d9e6dcd9841dbfbbee02ca60e6f168ead237fb6d19f8e11c9426fb8a8ca180eaf7dc2e7a29946172a40e48de2d3ea9ced80bda7
@@ -43,6 +43,14 @@ class Setting < ActiveRecord::Base
43
43
  end
44
44
  end
45
45
 
46
+ def self.link_instagram
47
+ begin
48
+ Setting.where(key: 'link_instagram', activated: true).first.value
49
+ rescue
50
+ false
51
+ end
52
+ end
53
+
46
54
  def self.albums_watermark
47
55
  begin
48
56
  Setting.where(key: 'albums_watermark', activated: true).first
@@ -0,0 +1,9 @@
1
+ - admix_tab 'Configuração' do |t|
2
+ - t.tab_content do
3
+ = f.input :name, label: t('settings.fields.name'), as: 'string', input_html: {class: 'span12'}
4
+ = f.input :key, label: t('settings.fields.key'), as: 'string', input_html: {class: 'span12'}
5
+ = f.input :value, label: t('settings.fields.value'), as: 'text', input_html: {class: 'span12'}
6
+ = f.input :image, label: t('settings.fields.image'), as: 'file', input_html: {class: 'span12'}
7
+
8
+ - content_for :form_options do
9
+ = f.input :activated, label: t('settings.fields.activated'), as: 'boolean'
@@ -0,0 +1,16 @@
1
+ - grid.column name: input_label(:defaults, :name), attribute: 'name' do |obj|
2
+ - obj.name
3
+ - grid.column name: input_label(:defaults, :key), attribute: 'key' do |obj|
4
+ - obj.key
5
+ - grid.column name: input_label(:defaults, :value), attribute: 'value' do |obj|
6
+ - obj.value
7
+
8
+ - grid.column name: input_label(:defaults, :image) do |obj|
9
+ - if obj.image.url
10
+ - image_tag(obj.image.url)
11
+ - else
12
+ - '--'
13
+
14
+ - grid.column name: input_label(:defaults, :activated), attribute: 'activated' do |obj|
15
+ - obj.activated ? 'Sim' : 'Não'
16
+ - column_actions(grid)
@@ -31,23 +31,14 @@ module MixRailsSettings
31
31
  config.action_mailer.raise_delivery_errors = true
32
32
 
33
33
  end
34
-
35
- def navigation
36
- if defined? Admix
37
- Admix::Navigation::NavBar.post_menu do
38
- Admix::Navigation::NavBar.find(:general) do |menu|
39
- menu.submenu do |submenu|
40
- submenu.key = :settings
41
- submenu.title = I18n.t 'settings.settings'
42
- submenu.url = 'admix_settings_url'
43
-
44
- submenu.instance_eval do
45
- def can_render?(current_user)
46
- current_user.has_role?(:admin)
47
- end
48
- end
49
-
50
- end
34
+
35
+ initializer "mix-rails-settings.setup_menu", after: "admix.setup_menu" do
36
+ ActiveMenu::get('admix-nav') do |nav|
37
+ nav.get(:general) do |general|
38
+ general.child :settings do |settings|
39
+ settings.text Proc.new {t('settings.settings')}
40
+ settings.href Proc.new {admix_settings_url}
41
+ settings.visible Proc.new {current_user.has_role? :admin}
51
42
  end
52
43
  end
53
44
  end
@@ -1,8 +1,8 @@
1
1
  module MixRailsSettings
2
2
  module VERSION #:nodoc:
3
3
  MAJOR = 0
4
- MINOR = 23
5
- TINY = 1
4
+ MINOR = 24
5
+ TINY = 0
6
6
  PRE = nil
7
7
 
8
8
  STRING = [MAJOR, MINOR, TINY, PRE].compact.join('.')
metadata CHANGED
@@ -1,8 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: mix-rails-settings
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.23.1
5
- prerelease:
4
+ version: 0.24.0
6
5
  platform: ruby
7
6
  authors:
8
7
  - Sadjow Leão
@@ -10,12 +9,11 @@ authors:
10
9
  autorequire:
11
10
  bindir: bin
12
11
  cert_chain: []
13
- date: 2013-02-18 00:00:00.000000000 Z
12
+ date: 2013-03-12 00:00:00.000000000 Z
14
13
  dependencies:
15
14
  - !ruby/object:Gem::Dependency
16
15
  name: rails
17
16
  requirement: !ruby/object:Gem::Requirement
18
- none: false
19
17
  requirements:
20
18
  - - ~>
21
19
  - !ruby/object:Gem::Version
@@ -23,7 +21,6 @@ dependencies:
23
21
  type: :runtime
24
22
  prerelease: false
25
23
  version_requirements: !ruby/object:Gem::Requirement
26
- none: false
27
24
  requirements:
28
25
  - - ~>
29
26
  - !ruby/object:Gem::Version
@@ -41,10 +38,10 @@ files:
41
38
  - app/assets/stylesheets/settings.css
42
39
  - app/assets/stylesheets/scaffold.css
43
40
  - app/assets/javascripts/settings.js
44
- - app/models/admix/settings_datagrid.rb
45
41
  - app/models/setting.rb
46
42
  - app/views/admix/settings/_show.html.haml
47
- - app/views/admix/settings/_form_fields.html.haml
43
+ - app/views/admix/settings/_grid_columns.haml
44
+ - app/views/admix/settings/_form_config.haml
48
45
  - config/locales/settings.pt-BR.yml
49
46
  - config/locales/settings.en.yml
50
47
  - config/routes.rb
@@ -59,32 +56,25 @@ files:
59
56
  - README.rdoc
60
57
  homepage: https://github.com/mixinternet/mix-rails
61
58
  licenses: []
59
+ metadata: {}
62
60
  post_install_message:
63
61
  rdoc_options: []
64
62
  require_paths:
65
63
  - lib
66
64
  required_ruby_version: !ruby/object:Gem::Requirement
67
- none: false
68
65
  requirements:
69
- - - ! '>='
66
+ - - '>='
70
67
  - !ruby/object:Gem::Version
71
68
  version: '0'
72
- segments:
73
- - 0
74
- hash: 651767568164877652
75
69
  required_rubygems_version: !ruby/object:Gem::Requirement
76
- none: false
77
70
  requirements:
78
- - - ! '>='
71
+ - - '>='
79
72
  - !ruby/object:Gem::Version
80
73
  version: '0'
81
- segments:
82
- - 0
83
- hash: 651767568164877652
84
74
  requirements: []
85
75
  rubyforge_project:
86
- rubygems_version: 1.8.24
76
+ rubygems_version: 2.0.0
87
77
  signing_key:
88
- specification_version: 3
78
+ specification_version: 4
89
79
  summary: Settings module
90
80
  test_files: []
@@ -1,27 +0,0 @@
1
- class Admix::SettingsDatagrid
2
-
3
- include Datagrid
4
-
5
- scope do
6
- Setting
7
- end
8
-
9
- filter :name, :string
10
-
11
- column :name, header: I18n.t('settings.fields.name')
12
- column :key, header: I18n.t('settings.fields.key')
13
- column :value, header: I18n.t('settings.fields.value')
14
-
15
- column :image, header: I18n.t('settings.fields.image'), html: true do |post|
16
- if post.image?
17
- image_tag post.image.url
18
- else
19
- "--"
20
- end
21
- end
22
-
23
- column :activated, header: I18n.t('settings.fields.activated')
24
-
25
- include Admix::TableActions
26
-
27
- end
@@ -1,5 +0,0 @@
1
- = f.input :name, label: t('settings.fields.name'), as: 'string'
2
- = f.input :key, label: t('settings.fields.key'), as: 'string'
3
- = f.input :value, label: t('settings.fields.value'), as: 'text'
4
- = f.input :image, label: t('settings.fields.image'), as: :file
5
- = f.input :activated, label: t('settings.fields.activated'), as: 'boolean'