padrino-admin 0.10.5 → 0.10.6.a
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/lib/padrino-admin/access_control.rb +1 -1
- data/lib/padrino-admin/generators/actions.rb +6 -6
- data/lib/padrino-admin/generators/admin_app.rb +7 -7
- data/lib/padrino-admin/generators/orm.rb +4 -3
- data/lib/padrino-admin/generators/templates/account/activerecord.rb.tt +1 -1
- data/lib/padrino-admin/generators/templates/account/couchrest.rb.tt +1 -1
- data/lib/padrino-admin/generators/templates/account/datamapper.rb.tt +1 -1
- data/lib/padrino-admin/generators/templates/account/mini_record.rb.tt +41 -0
- data/lib/padrino-admin/generators/templates/account/mongoid.rb.tt +1 -1
- data/lib/padrino-admin/generators/templates/account/mongomapper.rb.tt +1 -1
- data/lib/padrino-admin/generators/templates/account/seeds.rb.tt +2 -2
- data/lib/padrino-admin/generators/templates/account/sequel.rb.tt +1 -1
- data/lib/padrino-admin/generators/templates/app.rb.tt +12 -11
- data/lib/padrino-admin/generators/templates/erb/app/layouts/application.erb.tt +1 -1
- data/lib/padrino-admin/helpers/authentication_helpers.rb +7 -1
- data/lib/padrino-admin/locale/admin/fr.yml +3 -3
- data/test/generators/test_admin_app_generator.rb +5 -5
- data/test/generators/test_admin_page_generator.rb +5 -5
- metadata +36 -10
|
@@ -14,6 +14,7 @@ module Padrino
|
|
|
14
14
|
#
|
|
15
15
|
def registered(app)
|
|
16
16
|
app.set :session_id, "_padrino_#{File.basename(Padrino.root)}_#{app.app_name}".to_sym
|
|
17
|
+
app.set :admin_model, 'Account' unless app.respond_to?(:admin_model)
|
|
17
18
|
app.helpers Padrino::Admin::Helpers::AuthenticationHelpers
|
|
18
19
|
app.helpers Padrino::Admin::Helpers::ViewHelpers
|
|
19
20
|
app.before { login_required }
|
|
@@ -35,7 +36,6 @@ module Padrino
|
|
|
35
36
|
# We map project modules for a given role or roles
|
|
36
37
|
#
|
|
37
38
|
def roles_for(*roles, &block)
|
|
38
|
-
raise Padrino::Admin::AccessControlError, "You must define an Account Model!" unless defined?(Account)
|
|
39
39
|
raise Padrino::Admin::AccessControlError, "Role #{role} must be present and must be a symbol!" if roles.any? { |r| !r.kind_of?(Symbol) } || roles.empty?
|
|
40
40
|
raise Padrino::Admin::AccessControlError, "You can't merge :any with other roles" if roles.size > 1 && roles.any? { |r| r == :any }
|
|
41
41
|
|
|
@@ -27,7 +27,7 @@ module Padrino
|
|
|
27
27
|
# Tell us for now wich orm we support
|
|
28
28
|
#
|
|
29
29
|
def supported_orm
|
|
30
|
-
[:datamapper, :activerecord, :mongomapper, :mongoid, :couchrest, :sequel]
|
|
30
|
+
[:mini_record, :datamapper, :activerecord, :mongomapper, :mongoid, :couchrest, :sequel]
|
|
31
31
|
end
|
|
32
32
|
|
|
33
33
|
##
|
|
@@ -41,18 +41,18 @@ module Padrino
|
|
|
41
41
|
# Add access_control permission in our app.rb
|
|
42
42
|
#
|
|
43
43
|
def add_project_module(controller)
|
|
44
|
-
permission = " role.project_module :#{controller},
|
|
45
|
-
inject_into_file destination_root(
|
|
44
|
+
permission = " role.project_module :#{controller}, '/#{controller}'\n"
|
|
45
|
+
inject_into_file destination_root('/admin/app.rb'), permission, :after => "access_control.roles_for :admin do |role|\n"
|
|
46
46
|
end
|
|
47
47
|
|
|
48
48
|
##
|
|
49
49
|
# Remove from access_control permissions
|
|
50
50
|
#
|
|
51
51
|
def remove_project_module(controller)
|
|
52
|
-
path = destination_root(
|
|
53
|
-
say_status :replace,
|
|
52
|
+
path = destination_root('/admin/app.rb')
|
|
53
|
+
say_status :replace, 'admin/app.rb', :red
|
|
54
54
|
content = File.binread(path)
|
|
55
|
-
content.gsub!(/^\s+role\.project_module :#{controller},
|
|
55
|
+
content.gsub!(/^\s+role\.project_module :#{controller}, '\/#{controller}'\n/, '')
|
|
56
56
|
File.open(path, 'wb') { |f| f.write content }
|
|
57
57
|
end
|
|
58
58
|
end # Actions
|
|
@@ -28,6 +28,7 @@ module Padrino
|
|
|
28
28
|
class_option :destroy, :aliases => '-d', :default => false, :type => :boolean
|
|
29
29
|
class_option :theme, :desc => "Your admin theme: (#{self.themes.join(", ")})", :default => "default", :type => :string
|
|
30
30
|
class_option :renderer, :aliases => '-e', :desc => "Rendering engine (erb, haml)", :type => :string
|
|
31
|
+
class_option :admin_model, :aliases => '-m', :desc => "The name of model for access controlling", :default => 'Account', :type => :string
|
|
31
32
|
|
|
32
33
|
# Copies over the Padrino base admin application
|
|
33
34
|
def create_admin
|
|
@@ -60,7 +61,7 @@ module Padrino
|
|
|
60
61
|
append_file destination_root("config/apps.rb"), "\nPadrino.mount(\"Admin\").to(\"/admin\")"
|
|
61
62
|
|
|
62
63
|
account_params = [
|
|
63
|
-
|
|
64
|
+
options[:admin_model].underscore, "name:string", "surname:string", "email:string", "crypted_password:string", "role:string",
|
|
64
65
|
"-a=#{options[:app]}",
|
|
65
66
|
"-r=#{options[:root]}"
|
|
66
67
|
]
|
|
@@ -80,17 +81,16 @@ module Padrino
|
|
|
80
81
|
{ :name => :role, :field_type => :text_field }
|
|
81
82
|
]
|
|
82
83
|
|
|
83
|
-
admin_app = Padrino::Generators::AdminPage.new([
|
|
84
|
-
admin_app.default_orm = Padrino::Admin::Generators::Orm.new(:
|
|
84
|
+
admin_app = Padrino::Generators::AdminPage.new([options[:admin_model].underscore], :root => options[:root], :destroy => options[:destroy])
|
|
85
|
+
admin_app.default_orm = Padrino::Admin::Generators::Orm.new(options[:admin_model].underscore, orm, columns, column_fields)
|
|
85
86
|
admin_app.invoke_all
|
|
86
87
|
|
|
87
|
-
template "templates/account/#{orm}.rb.tt", destination_root(options[:app], "models", "
|
|
88
|
+
template "templates/account/#{orm}.rb.tt", destination_root(options[:app], "models", "#{options[:admin_model].underscore}.rb"), :force => true
|
|
88
89
|
|
|
89
90
|
if File.exist?(destination_root("db/seeds.rb"))
|
|
90
|
-
|
|
91
|
-
else
|
|
92
|
-
template "templates/account/seeds.rb.tt", destination_root("db/seeds.rb")
|
|
91
|
+
run "mv #{destination_root('db/seeds.rb')} #{destination_root('db/seeds.old')}"
|
|
93
92
|
end
|
|
93
|
+
template "templates/account/seeds.rb.tt", destination_root("db/seeds.rb")
|
|
94
94
|
|
|
95
95
|
empty_directory destination_root("admin/controllers")
|
|
96
96
|
empty_directory destination_root("admin/views")
|
|
@@ -15,7 +15,7 @@ module Padrino
|
|
|
15
15
|
|
|
16
16
|
def initialize(name, orm, columns=nil, column_fields=nil)
|
|
17
17
|
name = name.to_s
|
|
18
|
-
@klass_name = name.camelize
|
|
18
|
+
@klass_name = name.underscore.camelize
|
|
19
19
|
@klass = @klass_name.constantize rescue nil
|
|
20
20
|
@name_singular = name.underscore.gsub(/^.*\//, '') # convert submodules i.e. FooBar::Jank.all # => jank
|
|
21
21
|
@name_plural = @name_singular.pluralize
|
|
@@ -42,6 +42,7 @@ module Padrino
|
|
|
42
42
|
def columns
|
|
43
43
|
@columns ||= case orm
|
|
44
44
|
when :activerecord then @klass.columns
|
|
45
|
+
when :mini_record then @klass.columns
|
|
45
46
|
when :datamapper then @klass.properties.map { |p| dm_column(p) }
|
|
46
47
|
when :couchrest then @klass.properties
|
|
47
48
|
when :mongoid then @klass.fields.values
|
|
@@ -85,7 +86,7 @@ module Padrino
|
|
|
85
86
|
|
|
86
87
|
def find(params=nil)
|
|
87
88
|
case orm
|
|
88
|
-
when :activerecord, :mongomapper, :mongoid then "#{klass_name}.find(#{params})"
|
|
89
|
+
when :activerecord, :mini_record, :mongomapper, :mongoid then "#{klass_name}.find(#{params})"
|
|
89
90
|
when :datamapper, :couchrest then "#{klass_name}.get(#{params})"
|
|
90
91
|
when :sequel then "#{klass_name}[#{params}]"
|
|
91
92
|
else raise OrmError, "Adapter #{orm} is not yet supported!"
|
|
@@ -109,7 +110,7 @@ module Padrino
|
|
|
109
110
|
|
|
110
111
|
def update_attributes(params=nil)
|
|
111
112
|
case orm
|
|
112
|
-
when :activerecord, :mongomapper, :mongoid, :couchrest then "@#{name_singular}.update_attributes(#{params})"
|
|
113
|
+
when :activerecord, :mini_record, :mongomapper, :mongoid, :couchrest then "@#{name_singular}.update_attributes(#{params})"
|
|
113
114
|
when :datamapper then "@#{name_singular}.update(#{params})"
|
|
114
115
|
when :sequel then "@#{name_singular}.modified! && @#{name_singular}.update(#{params})"
|
|
115
116
|
else raise OrmError, "Adapter #{orm} is not yet supported!"
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
class <%= options[:admin_model].underscore.camelize %> < ActiveRecord::Base
|
|
2
|
+
attr_accessor :password, :password_confirmation
|
|
3
|
+
|
|
4
|
+
# Fields
|
|
5
|
+
field :name, :surname, :email, :crypted_password, :role
|
|
6
|
+
|
|
7
|
+
# Validations
|
|
8
|
+
validates_presence_of :email, :role
|
|
9
|
+
validates_presence_of :password, :if => :password_required
|
|
10
|
+
validates_presence_of :password_confirmation, :if => :password_required
|
|
11
|
+
validates_length_of :password, :within => 4..40, :if => :password_required
|
|
12
|
+
validates_confirmation_of :password, :if => :password_required
|
|
13
|
+
validates_length_of :email, :within => 3..100
|
|
14
|
+
validates_uniqueness_of :email, :case_sensitive => false
|
|
15
|
+
validates_format_of :email, :with => /\A([^@\s]+)@((?:[-a-z0-9]+\.)+[a-z]{2,})\Z/i
|
|
16
|
+
validates_format_of :role, :with => /[A-Za-z]/
|
|
17
|
+
|
|
18
|
+
# Callbacks
|
|
19
|
+
before_save :encrypt_password, :if => :password_required
|
|
20
|
+
|
|
21
|
+
##
|
|
22
|
+
# This method is for authentication purpose
|
|
23
|
+
#
|
|
24
|
+
def self.authenticate(email, password)
|
|
25
|
+
account = first(:conditions => { :email => email }) if email.present?
|
|
26
|
+
account && account.has_password?(password) ? account : nil
|
|
27
|
+
end
|
|
28
|
+
|
|
29
|
+
def has_password?(password)
|
|
30
|
+
::BCrypt::Password.new(crypted_password) == password
|
|
31
|
+
end
|
|
32
|
+
|
|
33
|
+
private
|
|
34
|
+
def encrypt_password
|
|
35
|
+
self.crypted_password = ::BCrypt::Password.create(password)
|
|
36
|
+
end
|
|
37
|
+
|
|
38
|
+
def password_required
|
|
39
|
+
crypted_password.blank? || password.present?
|
|
40
|
+
end
|
|
41
|
+
end
|
|
@@ -10,11 +10,11 @@ password = shell.ask "Tell me the password to use:"
|
|
|
10
10
|
|
|
11
11
|
shell.say ""
|
|
12
12
|
|
|
13
|
-
account =
|
|
13
|
+
account = <%= options[:admin_model].underscore.camelize %>.create(:email => email, :name => "Foo", :surname => "Bar", :password => password, :password_confirmation => password, :role => "admin")
|
|
14
14
|
|
|
15
15
|
if account.valid?
|
|
16
16
|
shell.say "================================================================="
|
|
17
|
-
shell.say "
|
|
17
|
+
shell.say "<%= options[:admin_model].underscore.camelize %> has been successfully created, now you can login with:"
|
|
18
18
|
shell.say "================================================================="
|
|
19
19
|
shell.say " email: #{email}"
|
|
20
20
|
shell.say " password: #{password}"
|
|
@@ -7,19 +7,20 @@ class Admin < Padrino::Application
|
|
|
7
7
|
##
|
|
8
8
|
# Application configuration options
|
|
9
9
|
#
|
|
10
|
-
# set :raise_errors, true
|
|
11
|
-
# set :dump_errors, true
|
|
12
|
-
# set :show_exceptions, true
|
|
13
|
-
# set :logging, true
|
|
14
|
-
# set :public_folder, "foo/bar"
|
|
15
|
-
# set :reload, false
|
|
16
|
-
# set :default_builder, "foo"
|
|
17
|
-
# set :locale_path, "bar"
|
|
18
|
-
# disable :sessions
|
|
19
|
-
# disable :flash
|
|
20
|
-
# layout :my_layout
|
|
10
|
+
# set :raise_errors, true # Raise exceptions (will stop application) (default for test)
|
|
11
|
+
# set :dump_errors, true # Exception backtraces are written to STDERR (default for production/development)
|
|
12
|
+
# set :show_exceptions, true # Shows a stack trace in browser (default for development)
|
|
13
|
+
# set :logging, true # Logging in STDOUT for development and file for production (default only for development)
|
|
14
|
+
# set :public_folder, "foo/bar" # Location for static assets (default root/public)
|
|
15
|
+
# set :reload, false # Reload application files (default in development)
|
|
16
|
+
# set :default_builder, "foo" # Set a custom form builder (default 'StandardFormBuilder')
|
|
17
|
+
# set :locale_path, "bar" # Set path for I18n translations (default your_app/locales)
|
|
18
|
+
# disable :sessions # Disabled sessions by default (enable if needed)
|
|
19
|
+
# disable :flash # Disables sinatra-flash (enabled by default if Sinatra::Flash is defined)
|
|
20
|
+
# layout :my_layout # Layout can be in views/layouts/foo.ext or views/foo.ext (default :application)
|
|
21
21
|
#
|
|
22
22
|
|
|
23
|
+
set :admin_model, '<%= options[:admin_model] %>'
|
|
23
24
|
set :login_page, "/admin/sessions/new"
|
|
24
25
|
|
|
25
26
|
enable :sessions
|
|
@@ -31,7 +31,7 @@
|
|
|
31
31
|
<%%= yield %>
|
|
32
32
|
<div id="footer">
|
|
33
33
|
<div class="block">
|
|
34
|
-
<p>Copyright © <%%= Time.now.year %> Your Site - Powered by <a href="
|
|
34
|
+
<p>Copyright © <%%= Time.now.year %> Your Site - Powered by <a href="https://github.com/padrino/padrino-framework" target="_blank">Padrino v.<%%= Padrino.version %>.</a></p>
|
|
35
35
|
</div>
|
|
36
36
|
</div>
|
|
37
37
|
</div>
|
|
@@ -96,7 +96,13 @@ module Padrino
|
|
|
96
96
|
end
|
|
97
97
|
|
|
98
98
|
def login_from_session
|
|
99
|
-
|
|
99
|
+
admin_model_obj.find_by_id(session[settings.session_id]) if admin_model_obj
|
|
100
|
+
end
|
|
101
|
+
|
|
102
|
+
def admin_model_obj
|
|
103
|
+
@_admin_model_obj ||= settings.admin_model.constantize
|
|
104
|
+
rescue NameError => e
|
|
105
|
+
raise Padrino::Admin::AccessControlError, "You must define an #{settings.admin_model} Model!"
|
|
100
106
|
end
|
|
101
107
|
end # AuthenticationHelpers
|
|
102
108
|
end # Helpers
|
|
@@ -4,11 +4,11 @@ fr:
|
|
|
4
4
|
save: Sauver
|
|
5
5
|
cancel: Annuler
|
|
6
6
|
list: Liste
|
|
7
|
-
edit:
|
|
7
|
+
edit: Éditer
|
|
8
8
|
new: Nouveau
|
|
9
9
|
show: Voir
|
|
10
|
-
delete:
|
|
11
|
-
confirm:
|
|
10
|
+
delete: Supprimer
|
|
11
|
+
confirm: Êtes-vous certain?
|
|
12
12
|
created_at: Créé à
|
|
13
13
|
all: Tous
|
|
14
14
|
profile: Profile
|
|
@@ -57,7 +57,7 @@ describe "AdminAppGenerator" do
|
|
|
57
57
|
assert_file_exists("#{@apptmp}/sample_project/db/migrate/001_create_accounts.rb")
|
|
58
58
|
assert_match_in_file 'Padrino.mount("Admin").to("/admin")', "#{@apptmp}/sample_project/config/apps.rb"
|
|
59
59
|
assert_match_in_file 'class Admin < Padrino::Application', "#{@apptmp}/sample_project/admin/app.rb"
|
|
60
|
-
assert_match_in_file 'role.project_module :accounts,
|
|
60
|
+
assert_match_in_file 'role.project_module :accounts, \'/accounts\'', "#{@apptmp}/sample_project/admin/app.rb"
|
|
61
61
|
assert_match_in_file 'button_to pat(:logout)', "#{@apptmp}/sample_project/admin/views/layouts/application.haml"
|
|
62
62
|
end
|
|
63
63
|
|
|
@@ -89,7 +89,7 @@ describe "AdminAppGenerator" do
|
|
|
89
89
|
assert_file_exists("#{@apptmp}/sample_project/db/migrate/001_create_accounts.rb")
|
|
90
90
|
assert_match_in_file 'Padrino.mount("Admin").to("/admin")', "#{@apptmp}/sample_project/config/apps.rb"
|
|
91
91
|
assert_match_in_file 'class Admin < Padrino::Application', "#{@apptmp}/sample_project/admin/app.rb"
|
|
92
|
-
assert_match_in_file 'role.project_module :accounts,
|
|
92
|
+
assert_match_in_file 'role.project_module :accounts, \'/accounts\'', "#{@apptmp}/sample_project/admin/app.rb"
|
|
93
93
|
assert_match_in_file 'button_to pat(:logout)', "#{@apptmp}/sample_project/admin/views/layouts/application.erb"
|
|
94
94
|
end
|
|
95
95
|
|
|
@@ -121,7 +121,7 @@ describe "AdminAppGenerator" do
|
|
|
121
121
|
assert_file_exists("#{@apptmp}/sample_project/db/migrate/001_create_accounts.rb")
|
|
122
122
|
assert_match_in_file 'Padrino.mount("Admin").to("/admin")', "#{@apptmp}/sample_project/config/apps.rb"
|
|
123
123
|
assert_match_in_file 'class Admin < Padrino::Application', "#{@apptmp}/sample_project/admin/app.rb"
|
|
124
|
-
assert_match_in_file 'role.project_module :accounts,
|
|
124
|
+
assert_match_in_file 'role.project_module :accounts, \'/accounts\'', "#{@apptmp}/sample_project/admin/app.rb"
|
|
125
125
|
assert_match_in_file 'button_to pat(:logout)', "#{@apptmp}/sample_project/admin/views/layouts/application.slim"
|
|
126
126
|
end
|
|
127
127
|
|
|
@@ -154,7 +154,7 @@ describe "AdminAppGenerator" do
|
|
|
154
154
|
assert_file_exists("#{@apptmp}/sample_project/db/migrate/001_create_accounts.rb")
|
|
155
155
|
assert_match_in_file 'Padrino.mount("Admin").to("/admin")', "#{@apptmp}/sample_project/config/apps.rb"
|
|
156
156
|
assert_match_in_file 'class Admin < Padrino::Application', "#{@apptmp}/sample_project/admin/app.rb"
|
|
157
|
-
assert_match_in_file 'role.project_module :accounts,
|
|
157
|
+
assert_match_in_file 'role.project_module :accounts, \'/accounts\'', "#{@apptmp}/sample_project/admin/app.rb"
|
|
158
158
|
assert_match_in_file 'button_to pat(:logout)', "#{@apptmp}/sample_project/admin/views/layouts/application.haml"
|
|
159
159
|
end
|
|
160
160
|
|
|
@@ -173,7 +173,7 @@ describe "AdminAppGenerator" do
|
|
|
173
173
|
generate(:admin_app, "--root=#{@apptmp}/sample_project")
|
|
174
174
|
end
|
|
175
175
|
|
|
176
|
-
|
|
176
|
+
assert_file_exists "#{@apptmp}/sample_project/db/seeds.old"
|
|
177
177
|
assert_match_in_file 'Account.create(', "#{@apptmp}/sample_project/db/seeds.rb"
|
|
178
178
|
end
|
|
179
179
|
|
|
@@ -51,7 +51,7 @@ describe "AdminPageGenerator" do
|
|
|
51
51
|
assert_match_in_file "label :#{field}", "#{@apptmp}/sample_project/admin/views/people/_form.haml"
|
|
52
52
|
assert_match_in_file "text_field :#{field}", "#{@apptmp}/sample_project/admin/views/people/_form.haml"
|
|
53
53
|
end
|
|
54
|
-
assert_match_in_file
|
|
54
|
+
assert_match_in_file "role.project_module :people, '/people'", "#{@apptmp}/sample_project/admin/app.rb"
|
|
55
55
|
assert_match_in_file "elsif Padrino.env == :development && params[:bypass]", "#{@apptmp}/sample_project/admin/controllers/sessions.rb"
|
|
56
56
|
assert_match_in_file "check_box_tag :bypass", "#{@apptmp}/sample_project/admin/views/sessions/new.haml"
|
|
57
57
|
end
|
|
@@ -75,7 +75,7 @@ describe "AdminPageGenerator" do
|
|
|
75
75
|
assert_match_in_file "label :#{field}", "#{@apptmp}/sample_project/admin/views/people/_form.erb"
|
|
76
76
|
assert_match_in_file "text_field :#{field}", "#{@apptmp}/sample_project/admin/views/people/_form.erb"
|
|
77
77
|
end
|
|
78
|
-
assert_match_in_file
|
|
78
|
+
assert_match_in_file "role.project_module :people, '/people'", "#{@apptmp}/sample_project/admin/app.rb"
|
|
79
79
|
assert_match_in_file "elsif Padrino.env == :development && params[:bypass]", "#{@apptmp}/sample_project/admin/controllers/sessions.rb"
|
|
80
80
|
assert_match_in_file "check_box_tag :bypass", "#{@apptmp}/sample_project/admin/views/sessions/new.erb"
|
|
81
81
|
end
|
|
@@ -94,7 +94,7 @@ describe "AdminPageGenerator" do
|
|
|
94
94
|
assert_match_in_file "label :#{field}", "#{@apptmp}/sample_project/admin/views/people/_form.slim"
|
|
95
95
|
assert_match_in_file "text_field :#{field}", "#{@apptmp}/sample_project/admin/views/people/_form.slim"
|
|
96
96
|
end
|
|
97
|
-
assert_match_in_file
|
|
97
|
+
assert_match_in_file "role.project_module :people, '/people'", "#{@apptmp}/sample_project/admin/app.rb"
|
|
98
98
|
assert_match_in_file "elsif Padrino.env == :development && params[:bypass]", "#{@apptmp}/sample_project/admin/controllers/sessions.rb"
|
|
99
99
|
assert_match_in_file "check_box_tag :bypass", "#{@apptmp}/sample_project/admin/views/sessions/new.slim"
|
|
100
100
|
end
|
|
@@ -115,7 +115,7 @@ describe "AdminPageGenerator" do
|
|
|
115
115
|
assert_match_in_file "label :#{field}", "#{@apptmp}/sample_project/admin/views/people/_form.haml"
|
|
116
116
|
assert_match_in_file "text_field :#{field}", "#{@apptmp}/sample_project/admin/views/people/_form.haml"
|
|
117
117
|
end
|
|
118
|
-
assert_match_in_file
|
|
118
|
+
assert_match_in_file "role.project_module :people, '/people'", "#{@apptmp}/sample_project/admin/app.rb"
|
|
119
119
|
# For Page
|
|
120
120
|
assert_file_exists "#{@apptmp}/sample_project/admin/controllers/pages.rb"
|
|
121
121
|
assert_file_exists "#{@apptmp}/sample_project/admin/views/pages/_form.haml"
|
|
@@ -126,7 +126,7 @@ describe "AdminPageGenerator" do
|
|
|
126
126
|
assert_match_in_file "label :#{field}", "#{@apptmp}/sample_project/admin/views/pages/_form.haml"
|
|
127
127
|
assert_match_in_file "text_field :#{field}", "#{@apptmp}/sample_project/admin/views/pages/_form.haml"
|
|
128
128
|
end
|
|
129
|
-
assert_match_in_file
|
|
129
|
+
assert_match_in_file "role.project_module :pages, '/pages'", "#{@apptmp}/sample_project/admin/app.rb"
|
|
130
130
|
end
|
|
131
131
|
end
|
|
132
132
|
end
|
metadata
CHANGED
|
@@ -1,8 +1,14 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: padrino-admin
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
|
|
5
|
-
|
|
4
|
+
hash: 98
|
|
5
|
+
prerelease: 7
|
|
6
|
+
segments:
|
|
7
|
+
- 0
|
|
8
|
+
- 10
|
|
9
|
+
- 6
|
|
10
|
+
- a
|
|
11
|
+
version: 0.10.6.a
|
|
6
12
|
platform: ruby
|
|
7
13
|
authors:
|
|
8
14
|
- Padrino Team
|
|
@@ -13,8 +19,7 @@ autorequire:
|
|
|
13
19
|
bindir: bin
|
|
14
20
|
cert_chain: []
|
|
15
21
|
|
|
16
|
-
date:
|
|
17
|
-
default_executable:
|
|
22
|
+
date: 2012-01-23 00:00:00 Z
|
|
18
23
|
dependencies:
|
|
19
24
|
- !ruby/object:Gem::Dependency
|
|
20
25
|
name: padrino-core
|
|
@@ -24,7 +29,13 @@ dependencies:
|
|
|
24
29
|
requirements:
|
|
25
30
|
- - "="
|
|
26
31
|
- !ruby/object:Gem::Version
|
|
27
|
-
|
|
32
|
+
hash: 98
|
|
33
|
+
segments:
|
|
34
|
+
- 0
|
|
35
|
+
- 10
|
|
36
|
+
- 6
|
|
37
|
+
- a
|
|
38
|
+
version: 0.10.6.a
|
|
28
39
|
type: :runtime
|
|
29
40
|
version_requirements: *id001
|
|
30
41
|
- !ruby/object:Gem::Dependency
|
|
@@ -35,7 +46,13 @@ dependencies:
|
|
|
35
46
|
requirements:
|
|
36
47
|
- - "="
|
|
37
48
|
- !ruby/object:Gem::Version
|
|
38
|
-
|
|
49
|
+
hash: 98
|
|
50
|
+
segments:
|
|
51
|
+
- 0
|
|
52
|
+
- 10
|
|
53
|
+
- 6
|
|
54
|
+
- a
|
|
55
|
+
version: 0.10.6.a
|
|
39
56
|
type: :runtime
|
|
40
57
|
version_requirements: *id002
|
|
41
58
|
description: Admin View for Padrino applications
|
|
@@ -62,6 +79,7 @@ files:
|
|
|
62
79
|
- lib/padrino-admin/generators/templates/account/activerecord.rb.tt
|
|
63
80
|
- lib/padrino-admin/generators/templates/account/couchrest.rb.tt
|
|
64
81
|
- lib/padrino-admin/generators/templates/account/datamapper.rb.tt
|
|
82
|
+
- lib/padrino-admin/generators/templates/account/mini_record.rb.tt
|
|
65
83
|
- lib/padrino-admin/generators/templates/account/mongoid.rb.tt
|
|
66
84
|
- lib/padrino-admin/generators/templates/account/mongomapper.rb.tt
|
|
67
85
|
- lib/padrino-admin/generators/templates/account/seeds.rb.tt
|
|
@@ -156,7 +174,6 @@ files:
|
|
|
156
174
|
- test/helper.rb
|
|
157
175
|
- test/test_admin_application.rb
|
|
158
176
|
- test/test_locale.rb
|
|
159
|
-
has_rdoc: true
|
|
160
177
|
homepage: http://www.padrinorb.com
|
|
161
178
|
licenses: []
|
|
162
179
|
|
|
@@ -170,17 +187,25 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
|
170
187
|
requirements:
|
|
171
188
|
- - ">="
|
|
172
189
|
- !ruby/object:Gem::Version
|
|
190
|
+
hash: 3
|
|
191
|
+
segments:
|
|
192
|
+
- 0
|
|
173
193
|
version: "0"
|
|
174
194
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
|
175
195
|
none: false
|
|
176
196
|
requirements:
|
|
177
|
-
- - "
|
|
197
|
+
- - ">"
|
|
178
198
|
- !ruby/object:Gem::Version
|
|
179
|
-
|
|
199
|
+
hash: 25
|
|
200
|
+
segments:
|
|
201
|
+
- 1
|
|
202
|
+
- 3
|
|
203
|
+
- 1
|
|
204
|
+
version: 1.3.1
|
|
180
205
|
requirements: []
|
|
181
206
|
|
|
182
207
|
rubyforge_project: padrino-admin
|
|
183
|
-
rubygems_version: 1.
|
|
208
|
+
rubygems_version: 1.8.15
|
|
184
209
|
signing_key:
|
|
185
210
|
specification_version: 3
|
|
186
211
|
summary: Admin Dashboard for Padrino
|
|
@@ -192,3 +217,4 @@ test_files:
|
|
|
192
217
|
- test/helper.rb
|
|
193
218
|
- test/test_admin_application.rb
|
|
194
219
|
- test/test_locale.rb
|
|
220
|
+
has_rdoc:
|