padrino-admin 0.9.10 → 0.9.11
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/README.rdoc +1 -1
- data/Rakefile +4 -53
- data/lib/padrino-admin/access_control.rb +11 -21
- data/lib/padrino-admin/generators/admin_app.rb +1 -1
- data/lib/padrino-admin/generators/orm.rb +5 -5
- data/lib/padrino-admin/generators/templates/account/activerecord.rb.tt +3 -1
- data/lib/padrino-admin/generators/templates/account/couchrest.rb.tt +13 -6
- data/lib/padrino-admin/generators/templates/account/datamapper.rb.tt +22 -19
- data/lib/padrino-admin/generators/templates/account/mongoid.rb.tt +4 -2
- data/lib/padrino-admin/generators/templates/account/mongomapper.rb.tt +3 -1
- data/lib/padrino-admin/generators/templates/account/sequel.rb.tt +9 -6
- data/lib/padrino-admin/generators/templates/app/app.rb +23 -25
- data/lib/padrino-admin/generators/templates/app/controllers/base.rb +1 -1
- data/lib/padrino-admin/helpers/authentication_helpers.rb +2 -2
- data/lib/padrino-admin/locale/admin/cz.yml +16 -0
- data/lib/padrino-admin/locale/admin/es.yml +16 -0
- data/lib/padrino-admin/locale/admin/tr.yml +16 -0
- data/lib/padrino-admin/locale/admin/uk.yml +16 -0
- data/lib/padrino-admin/locale/orm/cz.yml +26 -0
- data/lib/padrino-admin/locale/orm/da.yml +9 -9
- data/lib/padrino-admin/locale/orm/de.yml +15 -15
- data/lib/padrino-admin/locale/orm/en.yml +9 -9
- data/lib/padrino-admin/locale/orm/es.yml +26 -0
- data/lib/padrino-admin/locale/orm/fr.yml +9 -9
- data/lib/padrino-admin/locale/orm/it.yml +9 -9
- data/lib/padrino-admin/locale/orm/pt_br.yml +9 -9
- data/lib/padrino-admin/locale/orm/ru.yml +9 -9
- data/lib/padrino-admin/locale/orm/tr.yml +26 -0
- data/lib/padrino-admin/locale/orm/uk.yml +26 -0
- data/lib/padrino-admin.rb +2 -7
- data/padrino-admin.gemspec +17 -128
- data/test/fixtures/data_mapper.rb +11 -9
- data/test/generators/test_admin_app_generator.rb +1 -1
- data/test/generators/test_admin_page_generator.rb +2 -2
- data/test/helper.rb +4 -4
- data/test/test_admin_application.rb +8 -8
- metadata +79 -42
data/README.rdoc
CHANGED
|
@@ -49,7 +49,7 @@ For an ecommerce website, usually certain actions require permissions and authen
|
|
|
49
49
|
by the admin access control features:
|
|
50
50
|
|
|
51
51
|
class EcommerceSite < Padrino::Application
|
|
52
|
-
|
|
52
|
+
register Padrino::Admin::AccessControl
|
|
53
53
|
enable :store_location
|
|
54
54
|
set :login_page, "/login"
|
|
55
55
|
|
data/Rakefile
CHANGED
|
@@ -1,54 +1,5 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
require File.expand_path("../../padrino-core/lib/padrino-core/version.rb", __FILE__)
|
|
4
|
-
|
|
5
|
-
begin
|
|
6
|
-
require 'jeweler'
|
|
7
|
-
Jeweler::Tasks.new do |gem|
|
|
8
|
-
gem.name = "padrino-admin"
|
|
9
|
-
gem.summary = "Admin Dashboard for Padrino"
|
|
10
|
-
gem.description = "Admin View for Padrino applications"
|
|
11
|
-
gem.email = "padrinorb@gmail.com"
|
|
12
|
-
gem.homepage = "http://github.com/padrino/padrino-framework/tree/master/padrino-admin"
|
|
13
|
-
gem.authors = ["Padrino Team", "Nathan Esquenazi", "Davide D'Agostino", "Arthur Chiu"]
|
|
14
|
-
gem.rubyforge_project = 'padrino-admin'
|
|
15
|
-
gem.version = Padrino.version
|
|
16
|
-
gem.add_runtime_dependency "padrino-core", "= #{Padrino.version}"
|
|
17
|
-
gem.add_runtime_dependency "padrino-gen", "= #{Padrino.version}"
|
|
18
|
-
gem.add_runtime_dependency "padrino-helpers", "= #{Padrino.version}"
|
|
19
|
-
gem.add_development_dependency "haml", ">= 2.2.1"
|
|
20
|
-
gem.add_development_dependency "shoulda", ">= 0"
|
|
21
|
-
gem.add_development_dependency "mocha", ">= 0.9.7"
|
|
22
|
-
gem.add_development_dependency "rack-test", ">= 0.5.0"
|
|
23
|
-
gem.add_development_dependency "webrat", ">= 0.5.1"
|
|
24
|
-
# gem is a Gem::Specification... see http://www.rubygems.org/read/chapter/20 for additional settings
|
|
25
|
-
end
|
|
26
|
-
Jeweler::GemcutterTasks.new
|
|
27
|
-
Jeweler::RubyforgeTasks.new { |r| r.doc_task = :none }
|
|
28
|
-
rescue LoadError
|
|
29
|
-
puts "Jeweler (or a dependency) not available. Install it with: sudo gem install jeweler"
|
|
30
|
-
end
|
|
31
|
-
|
|
32
|
-
require 'rake/testtask'
|
|
33
|
-
Rake::TestTask.new(:test) do |test|
|
|
34
|
-
test.libs << 'test'
|
|
1
|
+
# coding:utf-8
|
|
2
|
+
RAKE_ROOT = __FILE__
|
|
35
3
|
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
end
|
|
39
|
-
|
|
40
|
-
begin
|
|
41
|
-
require 'rcov/rcovtask'
|
|
42
|
-
Rcov::RcovTask.new do |rcov|
|
|
43
|
-
rcov.libs << 'test'
|
|
44
|
-
rcov.pattern = 'test/**/test_*.rb'
|
|
45
|
-
rcov.verbose = true
|
|
46
|
-
rcov.rcov_opts << ['--exclude /Gems/1.8/gems/,padrino-core,padrino-cache,padrino-gen,padrino-helpers,padrino-mailer']
|
|
47
|
-
end
|
|
48
|
-
rescue LoadError
|
|
49
|
-
task :rcov do
|
|
50
|
-
abort "RCov is not available. In order to run rcov, you must: sudo gem install relevance-rcov"
|
|
51
|
-
end
|
|
52
|
-
end
|
|
53
|
-
|
|
54
|
-
task :default => :test
|
|
4
|
+
require 'rubygems'
|
|
5
|
+
require File.expand_path(File.dirname(__FILE__) + '/../gem_rake_helper')
|
|
@@ -9,34 +9,24 @@ module Padrino
|
|
|
9
9
|
##
|
|
10
10
|
# Method used by Padrino::Application when we register the extension
|
|
11
11
|
#
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
def inherited(base)
|
|
22
|
-
unless base.respond_to?(:access_control)
|
|
23
|
-
base.send(:cattr_accessor, :access_control)
|
|
24
|
-
base.send(:access_control=, Padrino::Admin::AccessControl::Base.new)
|
|
25
|
-
end
|
|
26
|
-
super(base)
|
|
27
|
-
base.class_eval { class << self; alias_method_chain :reload!, :access_control; end }
|
|
28
|
-
end
|
|
29
|
-
|
|
30
|
-
def reload_with_access_control!
|
|
31
|
-
self.access_control = Padrino::Admin::AccessControl::Base.new
|
|
32
|
-
reload_without_access_control!
|
|
12
|
+
class << self
|
|
13
|
+
def registered(app)
|
|
14
|
+
app.set :session_id, "_padrino_#{File.basename(Padrino.root)}_#{app.app_name}".to_sym
|
|
15
|
+
app.enable :sessions
|
|
16
|
+
app.helpers Padrino::Admin::Helpers::AuthenticationHelpers
|
|
17
|
+
app.helpers Padrino::Admin::Helpers::ViewHelpers
|
|
18
|
+
app.before { login_required }
|
|
19
|
+
app.send(:cattr_accessor, :access_control)
|
|
20
|
+
app.send(:access_control=, Padrino::Admin::AccessControl::Base.new)
|
|
33
21
|
end
|
|
22
|
+
alias :included :registered
|
|
34
23
|
end
|
|
35
24
|
|
|
36
25
|
class Base
|
|
37
26
|
def initialize #:nodoc:
|
|
38
27
|
@roles, @authorizations, @project_modules = [], [], []
|
|
39
28
|
end
|
|
29
|
+
|
|
40
30
|
##
|
|
41
31
|
# We map project modules for a given role or roles
|
|
42
32
|
#
|
|
@@ -9,7 +9,7 @@ module Padrino
|
|
|
9
9
|
# Define the source template root and themes
|
|
10
10
|
def self.source_root; File.expand_path(File.dirname(__FILE__)); end
|
|
11
11
|
def self.banner; "padrino-gen admin"; end
|
|
12
|
-
def self.themes; Dir[File.dirname(__FILE__) + "/templates/assets/stylesheets/themes/*"].map { |t| File.basename(t) }; end
|
|
12
|
+
def self.themes; Dir[File.dirname(__FILE__) + "/templates/assets/stylesheets/themes/*"].map { |t| File.basename(t) }.sort; end
|
|
13
13
|
|
|
14
14
|
# Include related modules
|
|
15
15
|
include Thor::Actions
|
|
@@ -33,11 +33,11 @@ module Padrino
|
|
|
33
33
|
def columns
|
|
34
34
|
@columns ||= case orm
|
|
35
35
|
when :activerecord then @klass.columns
|
|
36
|
-
when :datamapper then @klass.properties
|
|
36
|
+
when :datamapper then @klass.properties.map { |p| Column.new(p.name, p.primitive || p.type) }
|
|
37
37
|
when :couchrest then @klass.properties
|
|
38
38
|
when :mongoid then @klass.fields.values
|
|
39
39
|
when :mongomapper then @klass.keys.values.reject { |key| key.name == "_id" } # On MongoMapper keys are an hash
|
|
40
|
-
when :sequel then @klass.db_schema.map { |k,v| Column.new(k, v[:type]) }
|
|
40
|
+
when :sequel then @klass.db_schema.map { |k,v| v[:type] = :text if v[:db_type] =~ /^text/i; Column.new(k, v[:type]) }
|
|
41
41
|
else raise OrmError, "Adapter #{orm} is not yet supported!"
|
|
42
42
|
end
|
|
43
43
|
end
|
|
@@ -59,7 +59,7 @@ module Padrino
|
|
|
59
59
|
case orm
|
|
60
60
|
when :activerecord, :mongomapper, :mongoid then "#{klass_name}.find(#{params})"
|
|
61
61
|
when :datamapper, :couchrest then "#{klass_name}.get(#{params})"
|
|
62
|
-
when :sequel then "#{klass_name}
|
|
62
|
+
when :sequel then "#{klass_name}[#{params}]"
|
|
63
63
|
else raise OrmError, "Adapter #{orm} is not yet supported!"
|
|
64
64
|
end
|
|
65
65
|
end
|
|
@@ -83,7 +83,7 @@ module Padrino
|
|
|
83
83
|
case orm
|
|
84
84
|
when :activerecord, :mongomapper, :mongoid, :couchrest then "@#{name_singular}.update_attributes(#{params})"
|
|
85
85
|
when :datamapper then "@#{name_singular}.update(#{params})"
|
|
86
|
-
when :sequel then "
|
|
86
|
+
when :sequel then "@#{name_singular}.modified! && @#{name_singular}.update(#{params})"
|
|
87
87
|
else raise OrmError, "Adapter #{orm} is not yet supported!"
|
|
88
88
|
end
|
|
89
89
|
end
|
|
@@ -94,4 +94,4 @@ module Padrino
|
|
|
94
94
|
end # Orm
|
|
95
95
|
end # Generators
|
|
96
96
|
end # Admin
|
|
97
|
-
end # Padrino
|
|
97
|
+
end # Padrino
|
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
require 'digest/sha1'
|
|
2
|
+
|
|
1
3
|
class Account < ActiveRecord::Base
|
|
2
4
|
attr_accessor :password
|
|
3
5
|
|
|
@@ -24,7 +26,7 @@ class Account < ActiveRecord::Base
|
|
|
24
26
|
end
|
|
25
27
|
|
|
26
28
|
##
|
|
27
|
-
# This method is used
|
|
29
|
+
# This method is used to retrieve the original password.
|
|
28
30
|
#
|
|
29
31
|
def password_clean
|
|
30
32
|
crypted_password.decrypt(salt)
|
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
require 'digest/sha1'
|
|
2
|
+
|
|
1
3
|
class Account < CouchRest::ExtendedDocument
|
|
2
4
|
include CouchRest::Validation
|
|
3
5
|
use_database COUCHDB
|
|
@@ -40,14 +42,14 @@ class Account < CouchRest::ExtendedDocument
|
|
|
40
42
|
end
|
|
41
43
|
|
|
42
44
|
##
|
|
43
|
-
# This method is used
|
|
45
|
+
# This method is used to retrieve the original password.
|
|
44
46
|
#
|
|
45
47
|
def password_clean
|
|
46
48
|
crypted_password.decrypt(salt)
|
|
47
49
|
end
|
|
48
50
|
|
|
49
51
|
##
|
|
50
|
-
# This method is used
|
|
52
|
+
# This method is used to retrieve the first record by id without raise errors if not found.
|
|
51
53
|
#
|
|
52
54
|
def self.find_by_id(id)
|
|
53
55
|
id_array = self.by_id :key => id
|
|
@@ -57,7 +59,7 @@ class Account < CouchRest::ExtendedDocument
|
|
|
57
59
|
private
|
|
58
60
|
def generate_password
|
|
59
61
|
return if password.blank?
|
|
60
|
-
self.salt = Digest::SHA1.hexdigest("--#{Time.now.to_s}--#{email}--") if
|
|
62
|
+
self.salt = Digest::SHA1.hexdigest("--#{Time.now.to_s}--#{email}--") if self.salt.blank?
|
|
61
63
|
self.crypted_password = password.encrypt(self.salt)
|
|
62
64
|
end
|
|
63
65
|
|
|
@@ -66,8 +68,13 @@ class Account < CouchRest::ExtendedDocument
|
|
|
66
68
|
end
|
|
67
69
|
|
|
68
70
|
def email_is_unique
|
|
69
|
-
Account.by_email(:key => self.email, :limit => 1)
|
|
70
|
-
|
|
71
|
-
|
|
71
|
+
account = Account.by_email(:key => self.email, :limit => 1)
|
|
72
|
+
return true if account.empty? # didn't find email in the database
|
|
73
|
+
account = account[0]
|
|
74
|
+
if self.has_key?("_id")
|
|
75
|
+
# there is an id, make sure updates are being applied to same account
|
|
76
|
+
return true if self["_id"] == account["_id"]
|
|
77
|
+
end
|
|
78
|
+
[false, "Email has already been taken"]
|
|
72
79
|
end
|
|
73
80
|
end
|
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
require 'digest/sha1'
|
|
2
|
+
|
|
1
3
|
class Account
|
|
2
4
|
include DataMapper::Resource
|
|
3
5
|
include DataMapper::Validate
|
|
@@ -13,18 +15,15 @@ class Account
|
|
|
13
15
|
property :role, String
|
|
14
16
|
|
|
15
17
|
# Validations
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
# Callbacks
|
|
27
|
-
before :save, :generate_password
|
|
18
|
+
validates_presence_of :email, :role
|
|
19
|
+
validates_presence_of :password, :if => :password_required
|
|
20
|
+
validates_presence_of :password_confirmation, :if => :password_required
|
|
21
|
+
validates_length_of :password, :min => 4, :max => 40, :if => :password_required
|
|
22
|
+
validates_confirmation_of :password, :if => :password_required
|
|
23
|
+
validates_length_of :email, :min => 3, :max => 100
|
|
24
|
+
validates_uniqueness_of :email, :case_sensitive => false
|
|
25
|
+
validates_format_of :email, :with => :email_address
|
|
26
|
+
validates_format_of :role, :with => /[A-Za-z]/
|
|
28
27
|
|
|
29
28
|
##
|
|
30
29
|
# This method is for authentication purpose
|
|
@@ -35,25 +34,29 @@ class Account
|
|
|
35
34
|
end
|
|
36
35
|
|
|
37
36
|
##
|
|
38
|
-
# This method is used
|
|
37
|
+
# This method is used by AuthenticationHelper
|
|
39
38
|
#
|
|
40
39
|
def self.find_by_id(id)
|
|
41
40
|
get(id) rescue nil
|
|
42
41
|
end
|
|
43
42
|
|
|
44
43
|
##
|
|
45
|
-
# This method is used
|
|
44
|
+
# This method is used to retrieve the original password.
|
|
46
45
|
#
|
|
47
46
|
def password_clean
|
|
48
47
|
crypted_password.decrypt(salt)
|
|
49
48
|
end
|
|
50
49
|
|
|
50
|
+
###
|
|
51
|
+
# Password setter generates salt and crypted_password
|
|
52
|
+
#
|
|
53
|
+
def password=(val)
|
|
54
|
+
return if val.blank?
|
|
55
|
+
attribute_set(:salt, Digest::SHA1.hexdigest("--#{Time.now.to_s}--#{email}--")) if new?
|
|
56
|
+
attribute_set(:crypted_password, val.encrypt(self.salt))
|
|
57
|
+
end
|
|
58
|
+
|
|
51
59
|
private
|
|
52
|
-
def generate_password
|
|
53
|
-
return if password.blank?
|
|
54
|
-
self.salt = Digest::SHA1.hexdigest("--#{Time.now.to_s}--#{email}--") if new?
|
|
55
|
-
self.crypted_password = password.encrypt(self.salt)
|
|
56
|
-
end
|
|
57
60
|
|
|
58
61
|
def password_required
|
|
59
62
|
crypted_password.blank? || !password.blank?
|
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
require 'digest/sha1'
|
|
2
|
+
|
|
1
3
|
class Account
|
|
2
4
|
include Mongoid::Document
|
|
3
5
|
attr_accessor :password
|
|
@@ -33,14 +35,14 @@ class Account
|
|
|
33
35
|
end
|
|
34
36
|
|
|
35
37
|
##
|
|
36
|
-
# This method is used
|
|
38
|
+
# This method is used by AuthenticationHelper
|
|
37
39
|
#
|
|
38
40
|
def self.find_by_id(id)
|
|
39
41
|
find(id) rescue nil
|
|
40
42
|
end
|
|
41
43
|
|
|
42
44
|
##
|
|
43
|
-
# This method is used
|
|
45
|
+
# This method is used to retrieve the original password.
|
|
44
46
|
#
|
|
45
47
|
def password_clean
|
|
46
48
|
crypted_password.decrypt(salt)
|
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
require 'digest/sha1'
|
|
2
|
+
|
|
1
3
|
class Account
|
|
2
4
|
include MongoMapper::Document
|
|
3
5
|
attr_accessor :password
|
|
@@ -33,7 +35,7 @@ class Account
|
|
|
33
35
|
end
|
|
34
36
|
|
|
35
37
|
##
|
|
36
|
-
# This method is used
|
|
38
|
+
# This method is used to retrieve the original password.
|
|
37
39
|
#
|
|
38
40
|
def password_clean
|
|
39
41
|
crypted_password.decrypt(salt)
|
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
require 'digest/sha1'
|
|
2
|
+
|
|
1
3
|
class Account < ::Sequel::Model
|
|
2
4
|
|
|
3
5
|
plugin :validation_helpers
|
|
@@ -31,20 +33,21 @@ class Account < ::Sequel::Model
|
|
|
31
33
|
end
|
|
32
34
|
|
|
33
35
|
##
|
|
34
|
-
#
|
|
36
|
+
# Replace AR method
|
|
35
37
|
#
|
|
36
|
-
def
|
|
37
|
-
|
|
38
|
+
def self.find_by_id(id)
|
|
39
|
+
self[id] rescue nil
|
|
38
40
|
end
|
|
39
41
|
|
|
40
42
|
##
|
|
41
|
-
#
|
|
43
|
+
# This method is used to retrieve the original password.
|
|
42
44
|
#
|
|
43
|
-
def
|
|
44
|
-
|
|
45
|
+
def password_clean
|
|
46
|
+
crypted_password.decrypt(salt)
|
|
45
47
|
end
|
|
46
48
|
|
|
47
49
|
private
|
|
50
|
+
|
|
48
51
|
def generate_password
|
|
49
52
|
return if password.blank?
|
|
50
53
|
self.salt = Digest::SHA1.hexdigest("--#{Time.now.to_s}--#{email}--") if new?
|
|
@@ -1,31 +1,29 @@
|
|
|
1
1
|
class Admin < Padrino::Application
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
#
|
|
6
|
-
# set :raise_errors, true # Show exceptions (default for development)
|
|
7
|
-
# set :public, "foo/bar" # Location for static assets (default root/public)
|
|
8
|
-
# set :reload, false # Reload application files (default in development)
|
|
9
|
-
# set :default_builder, "foo" # Set a custom form builder (default 'StandardFormBuilder')
|
|
10
|
-
# set :locale_path, "bar" # Set path for I18n translations (default your_app/locales)
|
|
11
|
-
# enable :sessions # Disabled by default
|
|
12
|
-
# disable :flash # Disables rack-flash (enabled by default if sessions)
|
|
13
|
-
# disable :padrino_helpers # Disables padrino markup helpers (enabled by default if present)
|
|
14
|
-
# disable :padrino_mailer # Disables padrino mailer (enabled by default if present)
|
|
15
|
-
# enable :authentication # Enable padrino-admin authentication (disabled by default)
|
|
16
|
-
# layout :my_layout # Layout can be in views/layouts/foo.ext or views/foo.ext (default :application)
|
|
17
|
-
#
|
|
18
|
-
enable :authentication
|
|
19
|
-
disable :store_location
|
|
20
|
-
set :login_page, "/admin/sessions/new"
|
|
2
|
+
register Padrino::Mailer
|
|
3
|
+
register Padrino::Helpers
|
|
4
|
+
register Padrino::Admin::AccessControl
|
|
21
5
|
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
6
|
+
##
|
|
7
|
+
# Application configuration options
|
|
8
|
+
#
|
|
9
|
+
# set :raise_errors, true # Show exceptions (default for development)
|
|
10
|
+
# set :public, "foo/bar" # Location for static assets (default root/public)
|
|
11
|
+
# set :reload, false # Reload application files (default in development)
|
|
12
|
+
# set :default_builder, "foo" # Set a custom form builder (default 'StandardFormBuilder')
|
|
13
|
+
# set :locale_path, "bar" # Set path for I18n translations (default your_app/locales)
|
|
14
|
+
# enable :sessions # Disabled by default
|
|
15
|
+
# disable :flash # Disables rack-flash (enabled by default if sessions)
|
|
16
|
+
# layout :my_layout # Layout can be in views/layouts/foo.ext or views/foo.ext (default :application)
|
|
17
|
+
#
|
|
26
18
|
|
|
27
|
-
|
|
28
|
-
|
|
19
|
+
set :login_page, "/admin/sessions/new"
|
|
20
|
+
disable :store_location
|
|
29
21
|
|
|
22
|
+
access_control.roles_for :any do |role|
|
|
23
|
+
role.protect "/"
|
|
24
|
+
role.allow "/sessions"
|
|
25
|
+
end
|
|
26
|
+
|
|
27
|
+
access_control.roles_for :admin do |role|
|
|
30
28
|
end
|
|
31
29
|
end
|
|
@@ -94,9 +94,9 @@ module Padrino
|
|
|
94
94
|
end
|
|
95
95
|
|
|
96
96
|
def login_from_session
|
|
97
|
-
Account.find_by_id(session[
|
|
97
|
+
Account.find_by_id(session[settings.session_id]) if defined?(Account)
|
|
98
98
|
end
|
|
99
99
|
end # AuthenticationHelpers
|
|
100
100
|
end # Helpers
|
|
101
101
|
end # Admin
|
|
102
|
-
end # Padrino
|
|
102
|
+
end # Padrino
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
en:
|
|
2
|
+
padrino:
|
|
3
|
+
admin:
|
|
4
|
+
save: Uložit
|
|
5
|
+
cancel: Storno
|
|
6
|
+
list: Výpis
|
|
7
|
+
edit: Editovat
|
|
8
|
+
new: Nový
|
|
9
|
+
show: Ukázat
|
|
10
|
+
delete: Smazat
|
|
11
|
+
confirm: Jste si jist/-a?
|
|
12
|
+
created_at: Vytvořen
|
|
13
|
+
all: Všichni
|
|
14
|
+
profile: Profil
|
|
15
|
+
settings: Nastavení
|
|
16
|
+
logout: Odhlásit
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
es:
|
|
2
|
+
padrino:
|
|
3
|
+
admin:
|
|
4
|
+
save: Guardar
|
|
5
|
+
cancel: Cancelar
|
|
6
|
+
list: Listar
|
|
7
|
+
edit: Editar
|
|
8
|
+
new: Nuevo
|
|
9
|
+
show: Mostrar
|
|
10
|
+
delete: Eliminar
|
|
11
|
+
confirm: ¿Estás seguro?
|
|
12
|
+
created_at: Creado el
|
|
13
|
+
all: Todos
|
|
14
|
+
profile: Perfil
|
|
15
|
+
settings: Configuración
|
|
16
|
+
logout: Cerrar sesión
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
tr:
|
|
2
|
+
padrino:
|
|
3
|
+
admin:
|
|
4
|
+
save: Kaydet
|
|
5
|
+
cancel: Vazgeç
|
|
6
|
+
list: Liste
|
|
7
|
+
edit: Değiştir
|
|
8
|
+
new: Yeni
|
|
9
|
+
show: Göster
|
|
10
|
+
delete: Sil
|
|
11
|
+
confirm: emin misiniz?
|
|
12
|
+
created_at: Oluşturuldu
|
|
13
|
+
all: Hepsi
|
|
14
|
+
profile: Profil
|
|
15
|
+
settings: Ayarlar
|
|
16
|
+
logout: Çıkış
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
uk:
|
|
2
|
+
padrino:
|
|
3
|
+
admin:
|
|
4
|
+
save: Зберегти
|
|
5
|
+
cancel: Скасувати
|
|
6
|
+
list: Список
|
|
7
|
+
edit: Змінити
|
|
8
|
+
new: Додати
|
|
9
|
+
show: Показати
|
|
10
|
+
delete: Видалити
|
|
11
|
+
confirm: Ви впевнені?
|
|
12
|
+
created_at: Додано
|
|
13
|
+
all: Всі
|
|
14
|
+
profile: Профіль
|
|
15
|
+
settings: Налаштування
|
|
16
|
+
logout: Вихід
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
en:
|
|
2
|
+
activemodel: &activemodel
|
|
3
|
+
errors:
|
|
4
|
+
messages:
|
|
5
|
+
inclusion: "není v seznamu povolených hodnot"
|
|
6
|
+
exclusion: "je vyhrazeno pro jiný účel"
|
|
7
|
+
invalid: "není platná hodnota"
|
|
8
|
+
confirmation: "nebylo potvrzeno"
|
|
9
|
+
accepted: "musí být potvrzeno"
|
|
10
|
+
empty: "nesmí být prázdný/é"
|
|
11
|
+
blank: "je povinná položka"
|
|
12
|
+
too_long: "je příliš dlouhá/ý (max. {{count}} znaků)"
|
|
13
|
+
too_short: "je příliš krátký/á (min. {{count}} znaků)"
|
|
14
|
+
wrong_length: "nemá správnou délku (očekáváno {{count}} znaků)"
|
|
15
|
+
taken: "již databáze obsahuje"
|
|
16
|
+
not_a_number: "není číslo"
|
|
17
|
+
greater_than: "musí být větší než {{count}}"
|
|
18
|
+
greater_than_or_equal_to: "musí být větší nebo rovno {{count}}"
|
|
19
|
+
equal_to: "musí být rovno {{count}}"
|
|
20
|
+
less_than: "musí být méně než {{count}}"
|
|
21
|
+
less_than_or_equal_to: "musí být méně nebo rovno {{count}}"
|
|
22
|
+
odd: "musí být liché číslo"
|
|
23
|
+
even: "musí být sudé číslo"
|
|
24
|
+
record_invalid: "Následující pole obsahují chybně vyplněné údaje: {{errors}}"
|
|
25
|
+
content_type: "nepodporovaný formát souboru"
|
|
26
|
+
activerecord: *activemodel
|
|
@@ -9,18 +9,18 @@ da:
|
|
|
9
9
|
accepted: "skal accepteres"
|
|
10
10
|
empty: "må ikke være tom"
|
|
11
11
|
blank: "må ikke være blank"
|
|
12
|
-
too_long: "er for lang (maksimum er {
|
|
13
|
-
too_short: "er for kort (minimum er {
|
|
14
|
-
wrong_length: "har ikke den rigtige længde (skal være på {
|
|
12
|
+
too_long: "er for lang (maksimum er %{count} tegn)"
|
|
13
|
+
too_short: "er for kort (minimum er %{count} tegn)"
|
|
14
|
+
wrong_length: "har ikke den rigtige længde (skal være på %{count} tegn)"
|
|
15
15
|
taken: "er allerede i brug"
|
|
16
16
|
not_a_number: "er ikke et tal"
|
|
17
|
-
greater_than: "skal være større end {
|
|
18
|
-
greater_than_or_equal_to: "skal være større end eller lig {
|
|
19
|
-
equal_to: "skal være lig {
|
|
20
|
-
less_than: "skal være mindre end {
|
|
21
|
-
less_than_or_equal_to: "skal være mindre end eller lig {
|
|
17
|
+
greater_than: "skal være større end %{count}"
|
|
18
|
+
greater_than_or_equal_to: "skal være større end eller lig %{count}"
|
|
19
|
+
equal_to: "skal være lig %{count}"
|
|
20
|
+
less_than: "skal være mindre end %{count}"
|
|
21
|
+
less_than_or_equal_to: "skal være mindre end eller lig %{count}"
|
|
22
22
|
odd: "skal være ulige"
|
|
23
23
|
even: "skal være lige"
|
|
24
|
-
record_invalid: "Valideringsfejl: {
|
|
24
|
+
record_invalid: "Valideringsfejl: %{errors}"
|
|
25
25
|
content_type: "fileformatet er ikke understøttet"
|
|
26
26
|
activerecord: *activemodel
|
|
@@ -4,23 +4,23 @@ de:
|
|
|
4
4
|
messages:
|
|
5
5
|
inclusion: "ist nicht in der Liste enthalten"
|
|
6
6
|
exclusion: "ist reserviert"
|
|
7
|
-
invalid: "ist
|
|
8
|
-
confirmation: "entspricht nicht der
|
|
7
|
+
invalid: "ist ungültig"
|
|
8
|
+
confirmation: "entspricht nicht der Bestätigung"
|
|
9
9
|
accepted: "muss akzeptiert werden"
|
|
10
10
|
empty: "Darf nicht leer sein"
|
|
11
|
-
blank: "Darf nicht nur Leerzeichen
|
|
12
|
-
too_long: "ist zu lang (Maximum ist {
|
|
13
|
-
too_short: "ist zu kurz (Minimum ist {
|
|
14
|
-
wrong_length: "
|
|
15
|
-
taken: "
|
|
16
|
-
not_a_number: "ist
|
|
17
|
-
greater_than: "muss
|
|
18
|
-
greater_than_or_equal_to: "muss
|
|
19
|
-
equal_to: "muss gleich
|
|
20
|
-
less_than: "muss weniger
|
|
21
|
-
less_than_or_equal_to: "muss weniger oder gleich
|
|
11
|
+
blank: "Darf nicht nur Leerzeichen enthalten"
|
|
12
|
+
too_long: "ist zu lang (Maximum ist %{count} Zeichen)"
|
|
13
|
+
too_short: "ist zu kurz (Minimum ist %{count} Zeichen)"
|
|
14
|
+
wrong_length: "hat eine ungültige Länge (soll %{count} Zeichen sein)"
|
|
15
|
+
taken: "ist schon vergeben"
|
|
16
|
+
not_a_number: "ist keine Nummer"
|
|
17
|
+
greater_than: "muss größer als %{count} sein"
|
|
18
|
+
greater_than_or_equal_to: "muss größer oder gleich %{count} sein"
|
|
19
|
+
equal_to: "muss gleich %{count} sein"
|
|
20
|
+
less_than: "muss weniger als %{count} sein"
|
|
21
|
+
less_than_or_equal_to: "muss weniger oder gleich %{count} sein"
|
|
22
22
|
odd: "muss ungerade sein"
|
|
23
23
|
even: "muss gerade sein"
|
|
24
|
-
record_invalid: "Validierung schlug fehl: {
|
|
25
|
-
content_type: "Datei-Format wird nicht
|
|
24
|
+
record_invalid: "Validierung schlug fehl: %{errors}"
|
|
25
|
+
content_type: "Datei-Format wird nicht unterstützt"
|
|
26
26
|
activerecord: *activemodel
|
|
@@ -9,18 +9,18 @@ en:
|
|
|
9
9
|
accepted: "must be accepted"
|
|
10
10
|
empty: "can't be empty"
|
|
11
11
|
blank: "can't be blank"
|
|
12
|
-
too_long: "is too long (maximum is {
|
|
13
|
-
too_short: "is too short (minimum is {
|
|
14
|
-
wrong_length: "is the wrong length (should be {
|
|
12
|
+
too_long: "is too long (maximum is %{count} characters)"
|
|
13
|
+
too_short: "is too short (minimum is %{count} characters)"
|
|
14
|
+
wrong_length: "is the wrong length (should be %{count} characters)"
|
|
15
15
|
taken: "has already been taken"
|
|
16
16
|
not_a_number: "is not a number"
|
|
17
|
-
greater_than: "must be greater than {
|
|
18
|
-
greater_than_or_equal_to: "must be greater than or equal to {
|
|
19
|
-
equal_to: "must be equal to {
|
|
20
|
-
less_than: "must be less than {
|
|
21
|
-
less_than_or_equal_to: "must be less than or equal to {
|
|
17
|
+
greater_than: "must be greater than %{count}"
|
|
18
|
+
greater_than_or_equal_to: "must be greater than or equal to %{count}"
|
|
19
|
+
equal_to: "must be equal to %{count}"
|
|
20
|
+
less_than: "must be less than %{count}"
|
|
21
|
+
less_than_or_equal_to: "must be less than or equal to %{count}"
|
|
22
22
|
odd: "must be odd"
|
|
23
23
|
even: "must be even"
|
|
24
|
-
record_invalid: "Validation failed: {
|
|
24
|
+
record_invalid: "Validation failed: %{errors}"
|
|
25
25
|
content_type: "file format not supported"
|
|
26
26
|
activerecord: *activemodel
|