refinerycms-settings 1.0.11 → 2.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/.gitignore +3 -0
- data/.rspec +3 -0
- data/.travis.yml +16 -0
- data/Gemfile +74 -0
- data/Rakefile +19 -0
- data/app/controllers/refinery/admin/settings_controller.rb +55 -0
- data/app/decorators/controllers/refinery/.gitkeep +0 -0
- data/app/decorators/models/refinery/.gitkeep +0 -0
- data/app/helpers/refinery/admin/settings_helper.rb +29 -0
- data/app/models/refinery/setting.rb +204 -0
- data/app/views/refinery/admin/settings/_actions.html.erb +8 -0
- data/app/views/refinery/admin/settings/_form.html.erb +54 -0
- data/app/views/refinery/admin/settings/_records.html.erb +21 -0
- data/app/views/refinery/admin/settings/_setting.html.erb +23 -0
- data/app/views/refinery/admin/settings/_settings.html.erb +4 -0
- data/app/views/refinery/admin/settings/edit.html.erb +1 -0
- data/app/views/{admin/refinery_settings → refinery/admin/settings}/index.html.erb +2 -2
- data/app/views/refinery/admin/settings/new.html.erb +1 -0
- data/config/locales/bg.yml +22 -40
- data/config/locales/cs.yml +22 -39
- data/config/locales/da.yml +22 -40
- data/config/locales/de.yml +26 -43
- data/config/locales/el.yml +22 -40
- data/config/locales/en.yml +22 -35
- data/config/locales/es.yml +31 -63
- data/config/locales/fi.yml +22 -40
- data/config/locales/fr.yml +22 -38
- data/config/locales/it.yml +20 -36
- data/config/locales/ja.yml +30 -0
- data/config/locales/ko.yml +29 -0
- data/config/locales/lolcat.yml +21 -37
- data/config/locales/lt.yml +23 -40
- data/config/locales/lv.yml +22 -40
- data/config/locales/nb.yml +22 -40
- data/config/locales/nl.yml +22 -40
- data/config/locales/pl.yml +23 -40
- data/config/locales/pt-BR.yml +22 -38
- data/config/locales/rs.yml +22 -40
- data/config/locales/ru.yml +22 -37
- data/config/locales/sk.yml +22 -40
- data/config/locales/sl.yml +21 -20
- data/config/locales/sv.yml +22 -39
- data/config/locales/vi.yml +23 -42
- data/config/locales/zh-CN.yml +22 -40
- data/config/locales/zh-TW.yml +22 -40
- data/config/routes.rb +3 -6
- data/db/migrate/20100913234710_create_refinerycms_settings_schema.rb +11 -19
- data/lib/refinery/generators/refinery/settings/settings_generator.rb +20 -0
- data/lib/refinery/settings/engine.rb +26 -0
- data/lib/refinery/settings.rb +22 -0
- data/lib/refinerycms-settings.rb +1 -32
- data/readme.md +46 -0
- data/refinerycms-settings.gemspec +7 -79
- data/script/rails +6 -0
- data/spec/factories/settings.rb +5 -0
- data/spec/models/refinery/setting_spec.rb +103 -0
- data/spec/requests/refinery/admin/settings_spec.rb +57 -0
- data/spec/spec_helper.rb +56 -0
- data/tasks/rspec.rake +4 -0
- metadata +87 -75
- data/app/controllers/admin/refinery_settings_controller.rb +0 -71
- data/app/helpers/refinery_settings_helper.rb +0 -25
- data/app/models/refinery_setting.rb +0 -206
- data/app/views/admin/refinery_settings/_actions.html.erb +0 -15
- data/app/views/admin/refinery_settings/_form.html.erb +0 -62
- data/app/views/admin/refinery_settings/_records.html.erb +0 -21
- data/app/views/admin/refinery_settings/_refinery_setting.html.erb +0 -23
- data/app/views/admin/refinery_settings/_refinery_settings.html.erb +0 -5
- data/app/views/admin/refinery_settings/edit.html.erb +0 -1
- data/app/views/admin/refinery_settings/new.html.erb +0 -1
- data/config/locales/jp.yml +0 -47
- data/db/migrate/20100926142529_add_value_type_to_refinery_settings.rb +0 -9
- data/features/manage_refinery_settings.feature +0 -5
- data/features/step_definitions/setting_steps.rb +0 -9
- data/features/support/paths.rb +0 -14
- data/lib/gemspec.rb +0 -37
- data/lib/generators/refinerycms_settings_generator.rb +0 -8
- data/spec/models/refinery_setting_spec.rb +0 -101
data/.gitignore
ADDED
data/.rspec
ADDED
data/.travis.yml
ADDED
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
before_script:
|
|
2
|
+
- "bundle exec rake refinery:testing:dummy_app > /dev/null"
|
|
3
|
+
script: "bundle exec rspec ./spec"
|
|
4
|
+
notifications:
|
|
5
|
+
email:
|
|
6
|
+
- parndt@gmail.com
|
|
7
|
+
- ugis.ozolss@gmail.com
|
|
8
|
+
env:
|
|
9
|
+
- DB=postgresql
|
|
10
|
+
- DB=mysql
|
|
11
|
+
rvm:
|
|
12
|
+
- 1.8.7
|
|
13
|
+
- 1.9.2
|
|
14
|
+
- 1.9.3
|
|
15
|
+
- rbx
|
|
16
|
+
- jruby
|
data/Gemfile
ADDED
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
source 'http://rubygems.org'
|
|
2
|
+
|
|
3
|
+
gemspec
|
|
4
|
+
|
|
5
|
+
gem 'friendly_id', :git => 'git://github.com/norman/friendly_id.git'
|
|
6
|
+
|
|
7
|
+
git 'git://github.com/resolve/refinerycms.git' do
|
|
8
|
+
gem 'refinerycms'
|
|
9
|
+
|
|
10
|
+
group :development, :test do
|
|
11
|
+
gem 'refinerycms-testing'
|
|
12
|
+
end
|
|
13
|
+
end
|
|
14
|
+
|
|
15
|
+
group :development, :test do
|
|
16
|
+
require 'rbconfig'
|
|
17
|
+
|
|
18
|
+
platforms :jruby do
|
|
19
|
+
gem 'activerecord-jdbcsqlite3-adapter'
|
|
20
|
+
gem 'activerecord-jdbcmysql-adapter'
|
|
21
|
+
gem 'activerecord-jdbcpostgresql-adapter'
|
|
22
|
+
gem 'jruby-openssl'
|
|
23
|
+
end
|
|
24
|
+
|
|
25
|
+
unless defined?(JRUBY_VERSION)
|
|
26
|
+
gem 'sqlite3'
|
|
27
|
+
gem 'mysql2'
|
|
28
|
+
gem 'pg'
|
|
29
|
+
end
|
|
30
|
+
|
|
31
|
+
platforms :mswin, :mingw do
|
|
32
|
+
gem 'win32console'
|
|
33
|
+
gem 'rb-fchange', '~> 0.0.5'
|
|
34
|
+
gem 'rb-notifu', '~> 0.0.4'
|
|
35
|
+
end
|
|
36
|
+
|
|
37
|
+
platforms :ruby do
|
|
38
|
+
gem 'spork', '0.9.0.rc9'
|
|
39
|
+
gem 'guard-spork'
|
|
40
|
+
|
|
41
|
+
unless ENV['TRAVIS']
|
|
42
|
+
if RbConfig::CONFIG['target_os'] =~ /darwin/i
|
|
43
|
+
gem 'rb-fsevent', '>= 0.3.9'
|
|
44
|
+
gem 'growl', '~> 1.0.3'
|
|
45
|
+
end
|
|
46
|
+
if RbConfig::CONFIG['target_os'] =~ /linux/i
|
|
47
|
+
gem 'rb-inotify', '>= 0.5.1'
|
|
48
|
+
gem 'libnotify', '~> 0.1.3'
|
|
49
|
+
gem 'therubyracer', '~> 0.9.9'
|
|
50
|
+
end
|
|
51
|
+
end
|
|
52
|
+
end
|
|
53
|
+
|
|
54
|
+
platforms :jruby do
|
|
55
|
+
unless ENV['TRAVIS']
|
|
56
|
+
if RbConfig::CONFIG['target_os'] =~ /darwin/i
|
|
57
|
+
gem 'growl', '~> 1.0.3'
|
|
58
|
+
end
|
|
59
|
+
if RbConfig::CONFIG['target_os'] =~ /linux/i
|
|
60
|
+
gem 'rb-inotify', '>= 0.5.1'
|
|
61
|
+
gem 'libnotify', '~> 0.1.3'
|
|
62
|
+
end
|
|
63
|
+
end
|
|
64
|
+
end
|
|
65
|
+
end
|
|
66
|
+
|
|
67
|
+
# Refinery/rails should pull in the proper versions of these
|
|
68
|
+
group :assets do
|
|
69
|
+
gem 'sass-rails'
|
|
70
|
+
gem 'coffee-rails'
|
|
71
|
+
gem 'uglifier'
|
|
72
|
+
end
|
|
73
|
+
|
|
74
|
+
gem 'jquery-rails'
|
data/Rakefile
ADDED
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
#!/usr/bin/env rake
|
|
2
|
+
begin
|
|
3
|
+
require 'bundler/setup'
|
|
4
|
+
rescue LoadError
|
|
5
|
+
puts 'You must `gem install bundler` and `bundle install` to run rake tasks'
|
|
6
|
+
end
|
|
7
|
+
|
|
8
|
+
ENGINE_PATH = File.dirname(__FILE__)
|
|
9
|
+
APP_RAKEFILE = File.expand_path("../spec/dummy/Rakefile", __FILE__)
|
|
10
|
+
|
|
11
|
+
if File.exists?(APP_RAKEFILE)
|
|
12
|
+
load 'rails/tasks/engine.rake'
|
|
13
|
+
end
|
|
14
|
+
|
|
15
|
+
require "refinerycms-testing"
|
|
16
|
+
Refinery::Testing::Railtie.load_tasks
|
|
17
|
+
Refinery::Testing::Railtie.load_dummy_tasks(ENGINE_PATH)
|
|
18
|
+
|
|
19
|
+
load File.expand_path('../tasks/rspec.rake', __FILE__)
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
module ::Refinery
|
|
2
|
+
module Admin
|
|
3
|
+
class SettingsController < ::Refinery::AdminController
|
|
4
|
+
|
|
5
|
+
helper "refinery/admin/settings"
|
|
6
|
+
|
|
7
|
+
crudify :'refinery/setting',
|
|
8
|
+
:order => "name ASC",
|
|
9
|
+
:redirect_to_url => :redirect_to_where?,
|
|
10
|
+
:xhr_paging => true
|
|
11
|
+
|
|
12
|
+
before_filter :sanitise_params, :only => [:create, :update]
|
|
13
|
+
|
|
14
|
+
def new
|
|
15
|
+
form_value_type = ((current_refinery_user.has_role?(:superuser) && params[:form_value_type]) || 'text_area')
|
|
16
|
+
@setting = ::Refinery::Setting.new(:form_value_type => form_value_type)
|
|
17
|
+
end
|
|
18
|
+
|
|
19
|
+
def edit
|
|
20
|
+
@setting = ::Refinery::Setting.find(params[:id])
|
|
21
|
+
|
|
22
|
+
render :layout => false if request.xhr?
|
|
23
|
+
end
|
|
24
|
+
|
|
25
|
+
protected
|
|
26
|
+
def find_all_settings
|
|
27
|
+
@settings = ::Refinery::Setting.order('name ASC')
|
|
28
|
+
|
|
29
|
+
unless current_refinery_user.has_role?(:superuser)
|
|
30
|
+
@settings = @settings.where("restricted <> ? ", true)
|
|
31
|
+
end
|
|
32
|
+
|
|
33
|
+
@settings
|
|
34
|
+
end
|
|
35
|
+
|
|
36
|
+
def search_all_settings
|
|
37
|
+
# search for settings that begin with keyword
|
|
38
|
+
term = "^" + params[:search].to_s.downcase.gsub(' ', '_')
|
|
39
|
+
|
|
40
|
+
# First find normal results, then weight them with the query.
|
|
41
|
+
@settings = find_all_settings.with_query(term)
|
|
42
|
+
end
|
|
43
|
+
|
|
44
|
+
private
|
|
45
|
+
def redirect_to_where?
|
|
46
|
+
(from_dialog? && session[:return_to].present?) ? session[:return_to] : refinery.admin_settings_path
|
|
47
|
+
end
|
|
48
|
+
|
|
49
|
+
# this fires before an update or create to remove any attempts to pass sensitive arguments.
|
|
50
|
+
def sanitise_params
|
|
51
|
+
params.delete(:scoping)
|
|
52
|
+
end
|
|
53
|
+
end
|
|
54
|
+
end
|
|
55
|
+
end
|
|
File without changes
|
|
File without changes
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
module ::Refinery
|
|
2
|
+
module Admin
|
|
3
|
+
module SettingsHelper
|
|
4
|
+
def form_value_type
|
|
5
|
+
@setting.form_value_type.presence || 'text_area'
|
|
6
|
+
end
|
|
7
|
+
|
|
8
|
+
def setting_title(f)
|
|
9
|
+
if @setting.form_value_type == 'check_box'
|
|
10
|
+
raw "<h3>#{@setting.name.to_s.titleize}?</h3>"
|
|
11
|
+
else
|
|
12
|
+
f.label :value
|
|
13
|
+
end
|
|
14
|
+
end
|
|
15
|
+
|
|
16
|
+
def setting_field(f, help)
|
|
17
|
+
case form_value_type
|
|
18
|
+
when 'check_box'
|
|
19
|
+
raw "#{f.check_box :value, :value => @setting.form_value}
|
|
20
|
+
#{f.label :value, help.presence || t('enabled', :scope => 'refinery.admin.settings.form'),
|
|
21
|
+
:class => 'stripped'}"
|
|
22
|
+
else
|
|
23
|
+
f.text_area :value, :value => @setting.form_value,
|
|
24
|
+
:class => 'widest', :rows => 5
|
|
25
|
+
end
|
|
26
|
+
end
|
|
27
|
+
end
|
|
28
|
+
end
|
|
29
|
+
end
|
|
@@ -0,0 +1,204 @@
|
|
|
1
|
+
module Refinery
|
|
2
|
+
class Setting < Refinery::Core::BaseModel
|
|
3
|
+
extend FriendlyId
|
|
4
|
+
friendly_id :name
|
|
5
|
+
|
|
6
|
+
FORM_VALUE_TYPES = [
|
|
7
|
+
['Multi-line', 'text_area'],
|
|
8
|
+
['Checkbox', 'check_box']
|
|
9
|
+
]
|
|
10
|
+
|
|
11
|
+
validates :name, :presence => true
|
|
12
|
+
|
|
13
|
+
serialize :value # stores into YAML format
|
|
14
|
+
|
|
15
|
+
# Docs for acts_as_indexed http://github.com/dougal/acts_as_indexed
|
|
16
|
+
acts_as_indexed :fields => [:name]
|
|
17
|
+
|
|
18
|
+
attr_accessible :name, :value, :destroyable,
|
|
19
|
+
:scoping, :restricted, :form_value_type
|
|
20
|
+
|
|
21
|
+
before_save do |setting|
|
|
22
|
+
setting.restricted = false if setting.restricted.nil?
|
|
23
|
+
end
|
|
24
|
+
|
|
25
|
+
after_save do |setting|
|
|
26
|
+
setting.class.rewrite_cache
|
|
27
|
+
end
|
|
28
|
+
|
|
29
|
+
class << self
|
|
30
|
+
# Number of settings to show per page when using will_paginate
|
|
31
|
+
def per_page
|
|
32
|
+
12
|
|
33
|
+
end
|
|
34
|
+
|
|
35
|
+
def ensure_cache_exists!
|
|
36
|
+
if (result = Rails.cache.read(cache_key, :multithread => true)).nil?
|
|
37
|
+
result = rewrite_cache
|
|
38
|
+
end
|
|
39
|
+
|
|
40
|
+
result
|
|
41
|
+
end
|
|
42
|
+
protected :ensure_cache_exists!
|
|
43
|
+
|
|
44
|
+
def cache_read(name = nil, scoping = nil)
|
|
45
|
+
result = ensure_cache_exists!
|
|
46
|
+
|
|
47
|
+
if name.present?
|
|
48
|
+
scoping = scoping.to_s if scoping.is_a?(Symbol)
|
|
49
|
+
result = result.detect do |rs|
|
|
50
|
+
rs[:name] == name.to_s.downcase.to_sym and rs[:scoping] == scoping
|
|
51
|
+
end
|
|
52
|
+
result = result[:value] if !result.nil? and result.keys.include?(:value)
|
|
53
|
+
end
|
|
54
|
+
|
|
55
|
+
result
|
|
56
|
+
end
|
|
57
|
+
|
|
58
|
+
def to_cache(settings)
|
|
59
|
+
settings.collect do |rs|
|
|
60
|
+
{
|
|
61
|
+
:name => rs.name.to_s.downcase.to_sym,
|
|
62
|
+
:value => rs.value,
|
|
63
|
+
:scoping => rs.scoping,
|
|
64
|
+
:destroyable => rs.destroyable
|
|
65
|
+
}
|
|
66
|
+
end
|
|
67
|
+
end
|
|
68
|
+
|
|
69
|
+
def rewrite_cache
|
|
70
|
+
# delete cache
|
|
71
|
+
Rails.cache.delete(cache_key, :multithread => true)
|
|
72
|
+
|
|
73
|
+
# generate new cache
|
|
74
|
+
result = (to_cache(all) if (table_exists? rescue false))
|
|
75
|
+
|
|
76
|
+
# write cache
|
|
77
|
+
Rails.cache.write(cache_key, result, :multithread => true)
|
|
78
|
+
|
|
79
|
+
# return cache, or lack thereof.
|
|
80
|
+
result ||= []
|
|
81
|
+
end
|
|
82
|
+
|
|
83
|
+
def cache_key
|
|
84
|
+
[Refinery::Core.base_cache_key, 'settings_cache'].join('_')
|
|
85
|
+
end
|
|
86
|
+
|
|
87
|
+
# find_or_set offers a convenient way to
|
|
88
|
+
def find_or_set(name, the_value, options={})
|
|
89
|
+
# Merge default options with supplied options.
|
|
90
|
+
options = {
|
|
91
|
+
:scoping => nil,
|
|
92
|
+
:restricted => false,
|
|
93
|
+
:form_value_type => 'text_area'
|
|
94
|
+
}.merge(options)
|
|
95
|
+
|
|
96
|
+
# try to find the setting first
|
|
97
|
+
value = get(name, :scoping => options[:scoping])
|
|
98
|
+
|
|
99
|
+
# if the setting's value is nil, store a new one using the existing functionality.
|
|
100
|
+
value = set(name, options.merge({:value => the_value})) if value.nil?
|
|
101
|
+
|
|
102
|
+
# Return what we found.
|
|
103
|
+
value
|
|
104
|
+
end
|
|
105
|
+
|
|
106
|
+
alias :get_or_set :find_or_set
|
|
107
|
+
|
|
108
|
+
# Retrieve the current value for the setting whose name is supplied.
|
|
109
|
+
def get(name, options = {})
|
|
110
|
+
options = {:scoping => nil}.update(options)
|
|
111
|
+
cache_read(name, options[:scoping])
|
|
112
|
+
end
|
|
113
|
+
|
|
114
|
+
alias :[] :get
|
|
115
|
+
|
|
116
|
+
def set(name, value)
|
|
117
|
+
return (value.is_a?(Hash) ? value[:value] : value) unless (table_exists? rescue false)
|
|
118
|
+
|
|
119
|
+
scoping = (value[:scoping] if value.is_a?(Hash) and value.has_key?(:scoping))
|
|
120
|
+
setting = find_or_initialize_by_name_and_scoping(name.to_s, scoping)
|
|
121
|
+
|
|
122
|
+
# you could also pass in {:value => 'something', :scoping => 'somewhere'}
|
|
123
|
+
unless value.is_a?(Hash) and value.has_key?(:value)
|
|
124
|
+
setting.value = value
|
|
125
|
+
else
|
|
126
|
+
# set the value last, so that the other attributes can transform it if required.
|
|
127
|
+
setting.form_value_type = value[:form_value_type] || 'text_area' if setting.respond_to?(:form_value_type)
|
|
128
|
+
setting.scoping = value[:scoping] if value.has_key?(:scoping)
|
|
129
|
+
setting.destroyable = value[:destroyable] if value.has_key?(:destroyable)
|
|
130
|
+
setting.value = value[:value]
|
|
131
|
+
end
|
|
132
|
+
|
|
133
|
+
# Save because we're in a setter method.
|
|
134
|
+
setting.save
|
|
135
|
+
|
|
136
|
+
# Return the value
|
|
137
|
+
setting.value
|
|
138
|
+
end
|
|
139
|
+
end
|
|
140
|
+
|
|
141
|
+
# prettier version of the name.
|
|
142
|
+
# site_name becomes Site Name
|
|
143
|
+
def title
|
|
144
|
+
result = name.to_s.titleize
|
|
145
|
+
result << " (#{scoping.titleize})" if scoping.is_a?(String)
|
|
146
|
+
result
|
|
147
|
+
end
|
|
148
|
+
|
|
149
|
+
# form_value is so that on the web interface we can display a sane value.
|
|
150
|
+
def form_value
|
|
151
|
+
unless self[:value].blank? or self[:value].is_a?(String)
|
|
152
|
+
YAML::dump(self[:value])
|
|
153
|
+
else
|
|
154
|
+
self[:value]
|
|
155
|
+
end
|
|
156
|
+
end
|
|
157
|
+
|
|
158
|
+
def value
|
|
159
|
+
replacements!(self[:value])
|
|
160
|
+
end
|
|
161
|
+
|
|
162
|
+
def value=(new_value)
|
|
163
|
+
# must convert "1" to true and "0" to false when supplied using 'check_box', unfortunately.
|
|
164
|
+
if ["1", "0"].include?(new_value) and form_value_type == 'check_box'
|
|
165
|
+
new_value = new_value == "1" ? true : false
|
|
166
|
+
end
|
|
167
|
+
|
|
168
|
+
# must convert to string if true or false supplied otherwise it becomes 0 or 1, unfortunately.
|
|
169
|
+
if [true, false].include?(new_value)
|
|
170
|
+
new_value = new_value.to_s
|
|
171
|
+
end
|
|
172
|
+
|
|
173
|
+
super
|
|
174
|
+
end
|
|
175
|
+
|
|
176
|
+
private
|
|
177
|
+
# Below is not very nice, but seems to be required. The problem is when Rails
|
|
178
|
+
# serialises a fields like booleans it doesn't retrieve it back out as a boolean
|
|
179
|
+
# it just returns a string. This code maps the two boolean values
|
|
180
|
+
# correctly so that a boolean is returned instead of a string.
|
|
181
|
+
REPLACEMENTS = {"true" => true, "false" => false}
|
|
182
|
+
|
|
183
|
+
def replacements!(current_value)
|
|
184
|
+
# This bit handles true and false so that true and false are actually returned
|
|
185
|
+
# not "0" and "1"
|
|
186
|
+
REPLACEMENTS.each do |current, new_value|
|
|
187
|
+
current_value = new_value if current_value == current
|
|
188
|
+
end
|
|
189
|
+
|
|
190
|
+
# converts the serialised value back to an integer
|
|
191
|
+
# if the value is an integer
|
|
192
|
+
begin
|
|
193
|
+
if current_value.to_i.to_s == current_value
|
|
194
|
+
current_value = current_value.to_i
|
|
195
|
+
end
|
|
196
|
+
rescue
|
|
197
|
+
current_value
|
|
198
|
+
end
|
|
199
|
+
|
|
200
|
+
current_value
|
|
201
|
+
end
|
|
202
|
+
|
|
203
|
+
end
|
|
204
|
+
end
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
<%= form_for [refinery, :admin, @setting] do |f| %>
|
|
2
|
+
|
|
3
|
+
<%= render '/refinery/admin/error_messages', :object => @setting, :include_object_name => true %>
|
|
4
|
+
|
|
5
|
+
<div class='field'>
|
|
6
|
+
<%= f.label :name %>
|
|
7
|
+
<% if action_name =~ /(new)|(create)/ %>
|
|
8
|
+
<%= f.text_field :name, :class => "larger widest" %>
|
|
9
|
+
<% else %>
|
|
10
|
+
<label class='stripped' for='setting_value'>
|
|
11
|
+
<%= @setting.title %>
|
|
12
|
+
</label>
|
|
13
|
+
<span class="preview">- (<%= @setting.name %>)</span>
|
|
14
|
+
<% end %>
|
|
15
|
+
<% if current_refinery_user.has_role?(:superuser) && @setting.new_record? %>
|
|
16
|
+
<div class='field'>
|
|
17
|
+
<%= f.label :form_value_type %>
|
|
18
|
+
<%= f.select :form_value_type, ::Refinery::Setting::FORM_VALUE_TYPES -%>
|
|
19
|
+
</div>
|
|
20
|
+
<% end %>
|
|
21
|
+
<% unless action_name =~ /(new)|(create)/ or (help = t(@setting.name, :scope => 'refinery.admin.settings.form.help', :default => '')).blank? or @setting.form_value_type == 'check_box' %>
|
|
22
|
+
<p>
|
|
23
|
+
<span><%= help %></span>
|
|
24
|
+
</p>
|
|
25
|
+
<% end %>
|
|
26
|
+
<% if current_refinery_user.has_role?(:superuser) %>
|
|
27
|
+
<span class='label_with_help'>
|
|
28
|
+
<%= f.label :restricted %>
|
|
29
|
+
<%= refinery_help_tag t('restricted', :scope => 'refinery.admin.settings.form.help') %>
|
|
30
|
+
</span>
|
|
31
|
+
<%= f.check_box :restricted %>
|
|
32
|
+
<%= f.label :restricted, t('.yes_make_this_setting_restricted'), :class => 'stripped' %>
|
|
33
|
+
<% end %>
|
|
34
|
+
</div>
|
|
35
|
+
<div class='field'>
|
|
36
|
+
<%= setting_title(f) %>
|
|
37
|
+
<%= setting_field(f, help) %>
|
|
38
|
+
</div>
|
|
39
|
+
|
|
40
|
+
<%= render '/refinery/admin/form_actions', :f => f,
|
|
41
|
+
:continue_editing => false,
|
|
42
|
+
:hide_cancel => from_dialog?,
|
|
43
|
+
:submit_button_title => t('.restart_may_be_in_order_html'),
|
|
44
|
+
:delete_title => t('delete', :scope => 'refinery.admin.settings'),
|
|
45
|
+
:delete_confirmation => t('message', :scope => 'refinery.admin.delete', :title => @setting.title),
|
|
46
|
+
:hide_delete => (@setting.new_record? or !@setting.destroyable or from_dialog?) %>
|
|
47
|
+
<% end -%>
|
|
48
|
+
<% content_for :javascripts do %>
|
|
49
|
+
<script>
|
|
50
|
+
$('#setting_form_value_type').change(function(e) {
|
|
51
|
+
window.location = location_url + ((location_url.indexOf("?") > -1 ? "&" : "?") + "form_value_type=" + $(this).val());
|
|
52
|
+
});
|
|
53
|
+
</script>
|
|
54
|
+
<% end if current_refinery_user.has_role?(:superuser) %>
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
<% if searching? %>
|
|
2
|
+
<h2>
|
|
3
|
+
<%= t('results_for', :scope => 'refinery.admin.search', :query => params[:search]) %>
|
|
4
|
+
</h2>
|
|
5
|
+
<% end %>
|
|
6
|
+
<div class='pagination_container'>
|
|
7
|
+
<% if @settings.any? %>
|
|
8
|
+
<%= render 'settings' %>
|
|
9
|
+
<% else %>
|
|
10
|
+
<p>
|
|
11
|
+
<% if searching? %>
|
|
12
|
+
<%= t('no_results', :scope => 'refinery.admin.search') %>
|
|
13
|
+
<% else %>
|
|
14
|
+
<strong>
|
|
15
|
+
<%= t('.empty_set') %>
|
|
16
|
+
<%= t('.create_first', :link => t('new', :scope => 'refinery.admin.settings.actions')) %>
|
|
17
|
+
</strong>
|
|
18
|
+
<% end %>
|
|
19
|
+
</p>
|
|
20
|
+
<% end %>
|
|
21
|
+
</div>
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
<li class='clearfix record <%= cycle("on", "on-hover") %>'>
|
|
2
|
+
<span class='title'>
|
|
3
|
+
<%= t(setting.name, :scope => 'refinery.admin.settings.form.title', :default => setting.title) %>
|
|
4
|
+
<span class="preview">- <%= truncate(setting.value.to_s, :length => 40) %></span>
|
|
5
|
+
</span>
|
|
6
|
+
<span class='actions'>
|
|
7
|
+
<%= link_to refinery_icon_tag('application_edit.png'),
|
|
8
|
+
refinery.edit_admin_setting_path(setting, :dialog => true, :width => 725, :height => 525),
|
|
9
|
+
:title => t('edit', :scope => 'refinery.admin.settings') %>
|
|
10
|
+
<%= link_to refinery_icon_tag('delete.png'),
|
|
11
|
+
refinery.admin_setting_path(setting),
|
|
12
|
+
:class => 'cancel confirm-delete',
|
|
13
|
+
:title => t('delete', :scope => 'refinery.admin.settings'),
|
|
14
|
+
:confirm => t('message', :scope => 'refinery.admin.delete', :title => setting.title),
|
|
15
|
+
:method => :delete if setting.destroyable %>
|
|
16
|
+
|
|
17
|
+
<% unless (help = t(setting.name, :scope => 'refinery.admin.settings.form.help', :default => '')).blank? %>
|
|
18
|
+
<%= link_to refinery_icon_tag('information.png'), '#',
|
|
19
|
+
:tooltip => help,
|
|
20
|
+
:class => 'information suppress' %>
|
|
21
|
+
<% end %>
|
|
22
|
+
</span>
|
|
23
|
+
</li>
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
<%= render 'form' %>
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
<%= render 'form' %>
|
data/config/locales/bg.yml
CHANGED
|
@@ -1,47 +1,29 @@
|
|
|
1
1
|
bg:
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
analytics_page_code: Този код активира проследяването на Google Analytics на Вашия сайт. Настройката е изключена ако се остави празна или се въведе стойност "UA-xxxxxx-x". При това положение не се правят повече обръщения към Google Analytics.
|
|
23
|
-
frontend_refinery_stylesheets_enabled: "По подразбиране в Refinery са включени стилове за CSS за Вашия уебсайт. Това не пречи да използвате и Ваши. Тази настройка разрешава или забранява стиловете за CSS по подразбиране."
|
|
24
|
-
image_dialogue_sizes: "Тази настройка се отнася до диалога за вмъкване на изображение. След като направите промени тук, се налага да актуализирате размера на малките изображения."
|
|
25
|
-
image_thumbnails: 'Ако промените тази настройка, се налага отново да генерирате Вашите изображения, чрез командата "rake images:regenerate" (или чрез "rake images:update", ако само сте добавяли още малки изображения). Иначе промяната ще се отрази само за изображенията, добавяни занапред.'
|
|
26
|
-
menu_hide_children: "Скриване на всички подстраници от менюто, дори и те да съществуват."
|
|
27
|
-
new_page_parts: Разрешаване добавянето на нови части от страници (секции за съдържание) при редактиране.
|
|
28
|
-
page_title: "Комплексна настройка, определяща заглавието на страница. Тук можете да въведете клас за CSS; различен етикет; да включите или изключите изписването на йерархията от страници и др."
|
|
29
|
-
pages_advanced_options_include_seo: Определяне дали настройките за оптимизация на търсачки да бъдат показвани в разширените настройки на дадена страница.
|
|
30
|
-
preferred_image_view: 'Чрез тази настройка се задава, как да бъдат преглеждани съществуващите изображения: като списък или като решетка. Това може да бъде указано и чрез бутон в секция "Изображения".'
|
|
31
|
-
refinery_enable_backend_reordering: Премахване на възможността за подреждане на добавките.
|
|
32
|
-
refinery_menu_cache_action_suffix: "Тази настройка указва ключа, който да бъде използван за кеширане на менюто на сайта. Ако използвате тема, тогава е най-добре да оставите стойността, която всяка тема задава по подразбиране."
|
|
33
|
-
show_contact_privacy_link: Скриване или показване на политиката за поверителност във формата за контакт.
|
|
34
|
-
site_name: "Тази настройка указва наименованието на Вашия уебсайт. То ще бъде показвано в заглавната част на страницата, в редактора на сайта и при някои теми в условията за ползване."
|
|
35
|
-
theme: "Въвеждане наименованието на темата, която да бъде използвана. При правилно въведена тема, тя ще бъде приложена веднага."
|
|
36
|
-
use_google_ajax_libraries: 'За използването на "Google AJAX CDN", задайте стойност "true".'
|
|
37
|
-
use_marketable_urls: 'Промяна на уеб адресите от "/pages/about" на "/about" и автоматично разрешаване на евентуални конфликти с останалите добавки.'
|
|
38
|
-
use_resource_caching: "Когато внедрявате системата е препоръчително да разрешите тази настройка. По този начин всички файлове с код за CSS и JavaScript ще бъдат обединени в по един файл. Така броя на заявките към Вашия уебсайт ще бъде намален и производителността ще се подобри. "
|
|
39
|
-
approximate_ascii: 'Въведете "true", ако в заглавието на страниците използвате символи за ударение или други диакритични знаци. Така символи, като: ā, č, ž, ще бъдат преобразувани съответно в: a, c, z. По този начин няма да се визуализират странни символи в лентата за адреси при някои браузъри.'
|
|
2
|
+
refinery:
|
|
3
|
+
plugins:
|
|
4
|
+
refinery_settings:
|
|
5
|
+
title: Настройки
|
|
6
|
+
description: Управление на настройките в Refinery
|
|
7
|
+
admin:
|
|
8
|
+
settings:
|
|
9
|
+
delete: Изтриване на тази настройка завинаги
|
|
10
|
+
edit: Редактиране на тази настройка
|
|
11
|
+
actions:
|
|
12
|
+
new: Добавяне на нова настройка
|
|
13
|
+
records:
|
|
14
|
+
empty_set: Все още няма настройки.
|
|
15
|
+
create_first: 'Натиснете "%{link}", за да въведете нова.'
|
|
16
|
+
form:
|
|
17
|
+
enabled: "Включване на тази настройка."
|
|
18
|
+
restart_may_be_in_order_html: "<strong>Моля, обърнете внимание</strong>, че е възможно да се наложи да рестартирате уебсайта, за да бъде приложена тази настройка."
|
|
19
|
+
yes_make_this_setting_restricted: "Ограничаване на тази настройка единствено до привилегировани потребители."
|
|
20
|
+
help:
|
|
21
|
+
restricted: По този начин единствено привилегированите потребители (като Вас) могат да преглеждат и редактират тази настройка.
|
|
40
22
|
activerecord:
|
|
41
23
|
models:
|
|
42
|
-
|
|
24
|
+
refinery/setting: настройка
|
|
43
25
|
attributes:
|
|
44
|
-
|
|
26
|
+
refinery/setting:
|
|
45
27
|
name: Наименование
|
|
46
28
|
value: Стойност
|
|
47
29
|
restricted: Ограничена
|