rails-settings-ui 0.2.1 → 0.3.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +18 -3
- data/app/helpers/rails_settings_ui/settings_helper.rb +6 -6
- data/app/views/layouts/rails_settings_ui/application.html.haml +5 -6
- data/app/views/rails_settings_ui/settings/index.html.haml +6 -6
- data/lib/rails-settings-ui/engine.rb +0 -4
- data/lib/rails-settings-ui/version.rb +1 -1
- metadata +8 -8
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 6d3a038194e89a8a7763fe2006fe8b94a29fbb16
|
4
|
+
data.tar.gz: 72815478e3fd16400fca0df170a1677958b2a211
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 4ee0a49062d8163ed58825f9a37f86bc9a0624dc7cb65f1ab64f57eb45d12df104aae2a44da016c3e51097a9adac770f57b44bebcb020db273bb88ded1b21666
|
7
|
+
data.tar.gz: a9427ec7b832c29951567f7a679b44389db06894f395184ae59b8c773448a4ce4b0aa50c6ac3bd6948f40f470bb123a1621e59d6f0fbacb676ea1c86e4842e56
|
data/README.md
CHANGED
@@ -16,11 +16,23 @@ How to
|
|
16
16
|
|
17
17
|
Add to Gemfile
|
18
18
|
|
19
|
-
|
19
|
+
if you use bootstrap 2
|
20
|
+
|
21
|
+
gem 'rails-settings-ui', '~> 0.2.0'
|
22
|
+
|
23
|
+
for bootstrap 3
|
24
|
+
|
25
|
+
gem 'rails-settings-ui', '~> 0.3.0'
|
26
|
+
|
27
|
+
then add
|
28
|
+
|
20
29
|
gem 'rails-settings-cached'
|
21
|
-
|
30
|
+
|
31
|
+
or
|
32
|
+
|
22
33
|
gem 'rails-settings'
|
23
|
-
|
34
|
+
|
35
|
+
or your fork of rails-settings.
|
24
36
|
|
25
37
|
Setup:
|
26
38
|
|
@@ -103,6 +115,9 @@ To validation work is required the default settings in the proper format, eg:
|
|
103
115
|
|
104
116
|
Views
|
105
117
|
-------------
|
118
|
+
|
119
|
+
You can render all rails-settings-ui views inside your app layout (for nice looking you will need include bootstrap, eg: `@import 'bootstrap';` in your applications.css.scss):
|
120
|
+
|
106
121
|
Rails.application.config.to_prepare do
|
107
122
|
# Use admin layout:
|
108
123
|
RailsSettingsUi::ApplicationController.module_eval do
|
@@ -9,7 +9,7 @@ module RailsSettingsUi::SettingsHelper
|
|
9
9
|
elsif [TrueClass, FalseClass].include?(setting_value.class)
|
10
10
|
checkbox_field(setting_name, setting_value)
|
11
11
|
else
|
12
|
-
text_field(setting_name, setting_value)
|
12
|
+
text_field(setting_name, setting_value, class: 'form-control')
|
13
13
|
end
|
14
14
|
end
|
15
15
|
|
@@ -17,7 +17,7 @@ module RailsSettingsUi::SettingsHelper
|
|
17
17
|
default_setting_values = I18n.t("settings.attributes.#{setting_name}.labels", default: {}).map do |label, value|
|
18
18
|
[label, value]
|
19
19
|
end
|
20
|
-
select_tag("settings[#{setting_name.to_s}]", options_for_select(default_setting_values, setting_value))
|
20
|
+
select_tag("settings[#{setting_name.to_s}]", options_for_select(default_setting_values, setting_value), class: 'form-control')
|
21
21
|
end
|
22
22
|
|
23
23
|
def checkboxes_group_field(setting_name, all_settings)
|
@@ -33,11 +33,11 @@ module RailsSettingsUi::SettingsHelper
|
|
33
33
|
check_box_tag("settings[#{setting_name.to_s}]", nil, setting_value).html_safe
|
34
34
|
end
|
35
35
|
|
36
|
-
def text_field(setting_name, setting_value)
|
36
|
+
def text_field(setting_name, setting_value, options = {})
|
37
37
|
field = if setting_value.to_s.size > 30
|
38
|
-
text_area_tag("settings[#{setting_name}]", setting_value.to_s, rows: 10)
|
38
|
+
text_area_tag("settings[#{setting_name}]", setting_value.to_s, options.merge(rows: 10))
|
39
39
|
else
|
40
|
-
text_field_tag("settings[#{setting_name}]", setting_value.to_s)
|
40
|
+
text_field_tag("settings[#{setting_name}]", setting_value.to_s, options)
|
41
41
|
end
|
42
42
|
|
43
43
|
help_block_content = I18n.t("settings.attributes.#{setting_name}.help_block", default: '')
|
@@ -45,6 +45,6 @@ module RailsSettingsUi::SettingsHelper
|
|
45
45
|
end
|
46
46
|
|
47
47
|
def message_for_default_value_missing
|
48
|
-
content_tag(:span, I18n.t("settings.errors.default_missing"), class: "label label-
|
48
|
+
content_tag(:span, I18n.t("settings.errors.default_missing"), class: "label label-warning")
|
49
49
|
end
|
50
50
|
end
|
@@ -8,11 +8,10 @@
|
|
8
8
|
= stylesheet_link_tag "rails_settings_ui/application"
|
9
9
|
= csrf_meta_tags
|
10
10
|
%body
|
11
|
-
.
|
12
|
-
.navbar-
|
11
|
+
.container
|
12
|
+
.navbar.navbar-default
|
13
13
|
.container-fluid
|
14
|
-
|
15
|
-
|
16
|
-
.row
|
17
|
-
.content= yield
|
14
|
+
.navbar-header
|
15
|
+
%a.navbar-brand{href: "/"} Rails settings ui
|
16
|
+
.row= yield
|
18
17
|
%footer
|
@@ -1,10 +1,10 @@
|
|
1
|
-
%
|
1
|
+
%ol.breadcrumb
|
2
2
|
%li.active= t('settings.index.title')
|
3
3
|
|
4
4
|
- if @casted_settings && @casted_settings[:errors].any?
|
5
|
-
.alert.alert-
|
5
|
+
.alert.alert-danger= t('settings.index.settings_include_errors')
|
6
6
|
|
7
|
-
= form_tag [:update_all], method: :put, class: 'form
|
7
|
+
= form_tag [:update_all], method: :put, class: 'form' do
|
8
8
|
%table.table.table-striped
|
9
9
|
%thead
|
10
10
|
%tr
|
@@ -17,9 +17,9 @@
|
|
17
17
|
%td= I18n.t("settings.attributes.#{name}.name")
|
18
18
|
%td.setting-value
|
19
19
|
- setting_with_error = @casted_settings && @casted_settings[:errors].include?(name)
|
20
|
-
%div{class: "
|
20
|
+
%div{class: "form-group #{ setting_with_error ? 'has-error' : ''}"}
|
21
21
|
= setting_field(name, value, @settings)
|
22
22
|
- if setting_with_error
|
23
|
-
%span.help-
|
23
|
+
%span.help-block= @casted_settings[:errors][name]
|
24
24
|
|
25
|
-
= submit_tag t('settings.index.save_all'), class: 'btn btn-
|
25
|
+
= submit_tag t('settings.index.save_all'), class: 'btn btn-primary btn-lg'
|
@@ -7,10 +7,6 @@ module ::RailsSettingsUi
|
|
7
7
|
class Engine < Rails::Engine
|
8
8
|
isolate_namespace RailsSettingsUi
|
9
9
|
|
10
|
-
initializer "assets_precompile" do |app|
|
11
|
-
app.config.assets.precompile += %w( glyphicons-halflings.png glyphicons-halflings-white.png)
|
12
|
-
end
|
13
|
-
|
14
10
|
config.generators do |g|
|
15
11
|
g.test_framework :rspec, fixture: false
|
16
12
|
g.fixture_replacement :factory_girl, dir: 'spec/factories'
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rails-settings-ui
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.3.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Andrey Morskov
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-07-
|
11
|
+
date: 2014-07-29 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|
@@ -56,30 +56,30 @@ dependencies:
|
|
56
56
|
name: sass-rails
|
57
57
|
requirement: !ruby/object:Gem::Requirement
|
58
58
|
requirements:
|
59
|
-
- - "
|
59
|
+
- - "~>"
|
60
60
|
- !ruby/object:Gem::Version
|
61
|
-
version:
|
61
|
+
version: 4.0.0
|
62
62
|
type: :runtime
|
63
63
|
prerelease: false
|
64
64
|
version_requirements: !ruby/object:Gem::Requirement
|
65
65
|
requirements:
|
66
|
-
- - "
|
66
|
+
- - "~>"
|
67
67
|
- !ruby/object:Gem::Version
|
68
|
-
version:
|
68
|
+
version: 4.0.0
|
69
69
|
- !ruby/object:Gem::Dependency
|
70
70
|
name: bootstrap-sass
|
71
71
|
requirement: !ruby/object:Gem::Requirement
|
72
72
|
requirements:
|
73
73
|
- - "~>"
|
74
74
|
- !ruby/object:Gem::Version
|
75
|
-
version:
|
75
|
+
version: 3.2.0
|
76
76
|
type: :runtime
|
77
77
|
prerelease: false
|
78
78
|
version_requirements: !ruby/object:Gem::Requirement
|
79
79
|
requirements:
|
80
80
|
- - "~>"
|
81
81
|
- !ruby/object:Gem::Version
|
82
|
-
version:
|
82
|
+
version: 3.2.0
|
83
83
|
- !ruby/object:Gem::Dependency
|
84
84
|
name: rspec-rails
|
85
85
|
requirement: !ruby/object:Gem::Requirement
|