rails-settings-ui 0.0.1 → 0.0.2

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 23b3fb25f9bb4d3f397e71a0e65358869ca63f2b
4
+ data.tar.gz: 6ed56614f5e2f6eea5d97c4414d14f9ee2580ad2
5
+ SHA512:
6
+ metadata.gz: da0612bdb5060da129a2092c55d71e861ae8eebae4fa819d8dcfd670ea83d84c425c95fababd39c29c71b3ef613035257d0a7c08963a53a3bf5ae606f36c1a05
7
+ data.tar.gz: 407a41786a292a92209256efecba8603353d5418dba7dcce8c9e73e11bfa6afb3153fd00aec2e1b755420c21aaf4f7179142f9d74ec588a6108fe6ebd50d9900
data/README.md CHANGED
@@ -1,7 +1,9 @@
1
1
  Rails settings UI
2
2
  ================================
3
3
 
4
- A Rails Engine to manage your application settings. Includes validation. Compatible with Rails 3.
4
+ [![Gem Version](https://badge.fury.io/rb/rails-settings-ui.png)](http://badge.fury.io/rb/rails-settings-ui)
5
+
6
+ A Rails Engine to manage your application settings. Includes validation. Compatible with Rails 4.
5
7
  It compatible with [rails-settings-cached](https://github.com/huacnlee/rails-settings-cached) gem. Untested, but should work with rails-settings gem.
6
8
 
7
9
  Preview:
@@ -53,7 +55,7 @@ You can localize:
53
55
  name: 'Launch mode'
54
56
  ```
55
57
 
56
- * Checkbox or select options labels for array options, eg:
58
+ * Checkbox options labels for array options, eg:
57
59
 
58
60
  ```yaml
59
61
  settings:
@@ -64,6 +66,17 @@ You can localize:
64
66
  manual: 'Manual mode'
65
67
  ```
66
68
 
69
+ * Select options labels and values(it's required for selects), eg:
70
+
71
+ ```yaml
72
+ settings:
73
+ attributes:
74
+ buy_mode:
75
+ labels:
76
+ auto: 'Auto buy' # 'auto' is option value, 'Auto buy' is option label
77
+ manual: 'Manual buy'
78
+ ```
79
+
67
80
  * Help blocks for settings, eg:
68
81
 
69
82
  ```yaml
@@ -17,8 +17,7 @@ class RailsSettingsUi::SettingsController < RailsSettingsUi::ApplicationControll
17
17
  private
18
18
 
19
19
  def collection
20
- I18n.locale = :en
21
- all_settings = Settings.defaults.merge(Settings.all)
20
+ all_settings = Settings.defaults.merge(Settings.get_all)
22
21
  all_settings_without_ignored = all_settings.reject{ |name, description| RailsSettingsUi.ignored_settings.include?(name.to_sym) }
23
22
  @settings = Hash[all_settings_without_ignored]
24
23
  end
@@ -42,16 +42,16 @@ module RailsSettingsUi::SettingsHelper
42
42
  requires_cast
43
43
  end
44
44
 
45
- def setting_field(setting_name, setting_value)
45
+ def setting_field(setting_name, setting_value, all_settings)
46
46
  if RailsSettingsUi.settings_displayed_as_select_tag.include?(setting_name.to_sym)
47
- default_setting_values = Settings.defaults[setting_name.to_s].map do |setting_value|
48
- [I18n.t("settings.attributes.#{setting_name}.labels.#{setting_value}", default: setting_value.to_s), setting_value]
47
+ default_setting_values = I18n.t("settings.attributes.#{setting_name}.labels", default: {}).map do |label, value|
48
+ [label, value]
49
49
  end
50
50
  select_tag("settings[#{setting_name.to_s}]", options_for_select(default_setting_values, setting_value))
51
51
  elsif setting_value.is_a?(Array)
52
52
  field = ""
53
53
  Settings.defaults[setting_name.to_sym].each do |value|
54
- field << check_box_tag("settings[#{setting_name.to_s}][#{value.to_s}]", nil, Settings.defaults.merge(Settings.all)[setting_name.to_s].include?(value), style: "margin: 0 10px;")
54
+ field << check_box_tag("settings[#{setting_name.to_s}][#{value.to_s}]", nil, all_settings[setting_name.to_s].include?(value), style: "margin: 0 10px;")
55
55
  field << label_tag("settings[#{setting_name.to_s}][#{value.to_s}]", I18n.t("settings.attributes.#{setting_name}.labels.#{value}", default: value.to_s), style: "display: inline-block;")
56
56
  end
57
57
  return field.html_safe
@@ -18,7 +18,7 @@
18
18
  %td
19
19
  - setting_with_error = @casted_settings && @casted_settings[:errors].include?(name)
20
20
  %div{class: "control-group #{ setting_with_error ? 'error' : ''}"}
21
- = setting_field(name, value)
21
+ = setting_field(name, value, @settings)
22
22
  - if setting_with_error
23
23
  %span.help-inline= @casted_settings[:errors][name]
24
24
 
@@ -1,3 +1,3 @@
1
1
  module RailsSettingsUi
2
- VERSION = '0.0.1'
2
+ VERSION = '0.0.2'
3
3
  end
metadata CHANGED
@@ -1,78 +1,69 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rails-settings-ui
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.1
5
- prerelease:
4
+ version: 0.0.2
6
5
  platform: ruby
7
6
  authors:
8
7
  - Andrey Morskov
9
8
  autorequire:
10
9
  bindir: bin
11
10
  cert_chain: []
12
- date: 2013-10-07 00:00:00.000000000 Z
11
+ date: 2014-03-20 00:00:00.000000000 Z
13
12
  dependencies:
14
13
  - !ruby/object:Gem::Dependency
15
14
  name: rails
16
15
  requirement: !ruby/object:Gem::Requirement
17
- none: false
18
16
  requirements:
19
- - - ~>
17
+ - - ">="
20
18
  - !ruby/object:Gem::Version
21
- version: '3.1'
19
+ version: '3.0'
22
20
  type: :runtime
23
21
  prerelease: false
24
22
  version_requirements: !ruby/object:Gem::Requirement
25
- none: false
26
23
  requirements:
27
- - - ~>
24
+ - - ">="
28
25
  - !ruby/object:Gem::Version
29
- version: '3.1'
26
+ version: '3.0'
30
27
  - !ruby/object:Gem::Dependency
31
28
  name: i18n
32
29
  requirement: !ruby/object:Gem::Requirement
33
- none: false
34
30
  requirements:
35
- - - ! '>='
31
+ - - ">="
36
32
  - !ruby/object:Gem::Version
37
33
  version: '0'
38
34
  type: :runtime
39
35
  prerelease: false
40
36
  version_requirements: !ruby/object:Gem::Requirement
41
- none: false
42
37
  requirements:
43
- - - ! '>='
38
+ - - ">="
44
39
  - !ruby/object:Gem::Version
45
40
  version: '0'
46
41
  - !ruby/object:Gem::Dependency
47
42
  name: haml-rails
48
43
  requirement: !ruby/object:Gem::Requirement
49
- none: false
50
44
  requirements:
51
- - - ! '>='
45
+ - - ">="
52
46
  - !ruby/object:Gem::Version
53
47
  version: '0'
54
48
  type: :runtime
55
49
  prerelease: false
56
50
  version_requirements: !ruby/object:Gem::Requirement
57
- none: false
58
51
  requirements:
59
- - - ! '>='
52
+ - - ">="
60
53
  - !ruby/object:Gem::Version
61
54
  version: '0'
62
55
  - !ruby/object:Gem::Dependency
63
56
  name: twitter-bootstrap-rails
64
57
  requirement: !ruby/object:Gem::Requirement
65
- none: false
66
58
  requirements:
67
- - - ! '>='
59
+ - - ">="
68
60
  - !ruby/object:Gem::Version
69
61
  version: '0'
70
62
  type: :runtime
71
63
  prerelease: false
72
64
  version_requirements: !ruby/object:Gem::Requirement
73
- none: false
74
65
  requirements:
75
- - - ! '>='
66
+ - - ">="
76
67
  - !ruby/object:Gem::Version
77
68
  version: '0'
78
69
  description: User interface for manage settings with rails-settings gem
@@ -81,6 +72,10 @@ executables: []
81
72
  extensions: []
82
73
  extra_rdoc_files: []
83
74
  files:
75
+ - Gemfile
76
+ - MIT-LICENSE
77
+ - README.md
78
+ - Rakefile
84
79
  - app/assets/stylesheets/rails_settings_ui/application.css.scss
85
80
  - app/assets/stylesheets/rails_settings_ui/bootstrap_and_overrides.css.less
86
81
  - app/controllers/rails_settings_ui/application_controller.rb
@@ -88,42 +83,37 @@ files:
88
83
  - app/helpers/rails_settings_ui/settings_helper.rb
89
84
  - app/views/layouts/rails_settings_ui/application.html.haml
90
85
  - app/views/rails_settings_ui/settings/index.html.haml
91
- - lib/generators/rails_settings_ui/install_generator.rb
92
- - lib/rails-settings-ui/engine.rb
93
- - lib/rails-settings-ui/main_app_route_delegator.rb
94
- - lib/rails-settings-ui/version.rb
95
- - lib/rails-settings-ui.rb
96
86
  - config/initializers/rails_settings_ui.rb
97
87
  - config/locales/en.yml
98
88
  - config/locales/ru.yml
99
89
  - config/routes.rb
100
- - MIT-LICENSE
101
- - Rakefile
102
- - Gemfile
103
- - README.md
90
+ - lib/generators/rails_settings_ui/install_generator.rb
91
+ - lib/rails-settings-ui.rb
92
+ - lib/rails-settings-ui/engine.rb
93
+ - lib/rails-settings-ui/main_app_route_delegator.rb
94
+ - lib/rails-settings-ui/version.rb
104
95
  homepage: https://github.com/accessd/rails-settings-ui
105
96
  licenses:
106
97
  - MIT
98
+ metadata: {}
107
99
  post_install_message:
108
100
  rdoc_options: []
109
101
  require_paths:
110
102
  - lib
111
103
  required_ruby_version: !ruby/object:Gem::Requirement
112
- none: false
113
104
  requirements:
114
- - - ! '>='
105
+ - - ">="
115
106
  - !ruby/object:Gem::Version
116
107
  version: '0'
117
108
  required_rubygems_version: !ruby/object:Gem::Requirement
118
- none: false
119
109
  requirements:
120
- - - ! '>='
110
+ - - ">="
121
111
  - !ruby/object:Gem::Version
122
112
  version: '0'
123
113
  requirements: []
124
114
  rubyforge_project:
125
- rubygems_version: 1.8.23
115
+ rubygems_version: 2.2.2
126
116
  signing_key:
127
- specification_version: 3
117
+ specification_version: 4
128
118
  summary: User interface for manage settings (rails engine)
129
119
  test_files: []