padrino-admin 0.6.3 → 0.6.7
Sign up to get free protection for your applications and to get access to all the features.
- data/README.rdoc +16 -0
- data/VERSION +1 -1
- data/lib/padrino-admin.rb +24 -5
- data/lib/padrino-admin/access_control.rb +75 -29
- data/lib/padrino-admin/{ext_js/column_store.rb → column_store.rb} +31 -15
- data/lib/padrino-admin/config.rb +36 -0
- data/lib/padrino-admin/generators/actions.rb +62 -7
- data/lib/padrino-admin/generators/admin_app.rb +27 -26
- data/lib/padrino-admin/generators/admin_page.rb +20 -18
- data/lib/padrino-admin/generators/admin_uploader.rb +83 -0
- data/lib/padrino-admin/generators/app/app.rb.tt +1 -3
- data/lib/padrino-admin/generators/app/controllers/accounts.rb +1 -1
- data/lib/padrino-admin/generators/app/public/flash/swfupload.swf +0 -0
- data/lib/padrino-admin/generators/app/public/images/{backend → admin}/back.gif +0 -0
- data/lib/padrino-admin/generators/app/public/images/{backend → admin}/background.png +0 -0
- data/lib/padrino-admin/generators/app/public/images/{backend → admin}/bg-content.png +0 -0
- data/lib/padrino-admin/generators/app/public/images/{backend → admin}/bg-hd-slate.png +0 -0
- data/lib/padrino-admin/generators/app/public/images/{backend → admin}/bg-hd.png +0 -0
- data/lib/padrino-admin/generators/app/public/images/{backend → admin}/bg-intro.png +0 -0
- data/lib/padrino-admin/generators/app/public/images/{backend → admin}/bg-login.png +0 -0
- data/lib/padrino-admin/generators/app/public/images/{backend → admin}/bg-menu-slate.png +0 -0
- data/lib/padrino-admin/generators/app/public/images/{backend → admin}/bg-menu.png +0 -0
- data/lib/padrino-admin/generators/app/public/images/{backend → admin}/bg.png +0 -0
- data/lib/padrino-admin/generators/app/public/images/{backend → admin}/btn-login.png +0 -0
- data/lib/padrino-admin/generators/app/public/images/admin/cancel.gif +0 -0
- data/lib/padrino-admin/generators/app/public/images/{backend → admin}/categories.gif +0 -0
- data/lib/padrino-admin/generators/app/public/images/admin/close.gif +0 -0
- data/lib/padrino-admin/generators/app/public/images/admin/close.png +0 -0
- data/lib/padrino-admin/generators/app/public/images/{backend → admin}/delete.gif +0 -0
- data/lib/padrino-admin/generators/app/public/images/{backend → admin}/download.gif +0 -0
- data/lib/padrino-admin/generators/app/public/images/{backend → admin}/duplicate.gif +0 -0
- data/lib/padrino-admin/generators/app/public/images/{backend → admin}/edit.gif +0 -0
- data/lib/padrino-admin/generators/app/public/images/{backend → admin}/export.gif +0 -0
- data/lib/padrino-admin/generators/app/public/images/{backend → admin}/hd-bg.gif +0 -0
- data/lib/padrino-admin/generators/app/public/images/{backend → admin}/image.gif +0 -0
- data/lib/padrino-admin/generators/app/public/images/{backend → admin}/loader.gif +0 -0
- data/lib/padrino-admin/generators/app/public/images/{backend → admin}/logo-loader.png +0 -0
- data/lib/padrino-admin/generators/app/public/images/{backend → admin}/logo-small.png +0 -0
- data/lib/padrino-admin/generators/app/public/images/{backend → admin}/new.gif +0 -0
- data/lib/padrino-admin/generators/app/public/images/{backend → admin}/no-image.png +0 -0
- data/lib/padrino-admin/generators/app/public/images/{backend → admin}/preview.gif +0 -0
- data/lib/padrino-admin/generators/app/public/images/{backend → admin}/print.gif +0 -0
- data/lib/padrino-admin/generators/app/public/images/{backend → admin}/save.gif +0 -0
- data/lib/padrino-admin/generators/app/public/images/{backend → admin}/support.gif +0 -0
- data/lib/padrino-admin/generators/app/public/images/admin/up.gif +0 -0
- data/lib/padrino-admin/generators/app/public/javascripts/ext.js +4 -1
- data/lib/padrino-admin/generators/app/public/javascripts/swfupload.js +4 -0
- data/lib/padrino-admin/generators/app/public/stylesheets/admin.css +25 -43
- data/lib/padrino-admin/generators/app/public/stylesheets/login.css +3 -3
- data/lib/padrino-admin/generators/app/public/stylesheets/standard.css +53 -52
- data/lib/padrino-admin/generators/app/views/accounts/_form.haml +1 -0
- data/lib/padrino-admin/generators/app/views/base/index.haml +5 -7
- data/lib/padrino-admin/generators/app/views/javascripts/admin.js.erb +217 -297
- data/lib/padrino-admin/generators/app/views/sessions/new.haml +1 -1
- data/lib/padrino-admin/generators/templates/{controller.rb.tt → page/controller.rb.tt} +1 -1
- data/lib/padrino-admin/generators/templates/{db → page/db}/seeds.rb.tt +0 -0
- data/lib/padrino-admin/generators/templates/{views → page/views}/_form.haml.tt +0 -0
- data/lib/padrino-admin/generators/templates/{views → page/views}/edit.haml.tt +0 -0
- data/lib/padrino-admin/generators/templates/{views → page/views}/grid.js.erb.tt +1 -1
- data/lib/padrino-admin/generators/templates/{views → page/views}/new.haml.tt +0 -0
- data/lib/padrino-admin/generators/templates/{views → page/views}/store.jml.tt +0 -0
- data/lib/padrino-admin/generators/templates/uploader/controller.rb +24 -0
- data/lib/padrino-admin/generators/templates/uploader/lib/uploader.rb +54 -0
- data/lib/padrino-admin/generators/templates/uploader/views/grid.js.erb +56 -0
- data/lib/padrino-admin/generators/templates/uploader/views/store.jml +10 -0
- data/lib/padrino-admin/helpers/authentication.rb +30 -19
- data/lib/padrino-admin/helpers/view.rb +172 -35
- data/lib/padrino-admin/locale/admin/en.yml +1 -0
- data/lib/padrino-admin/middleware/flash_middleware.rb +36 -0
- data/lib/padrino-admin/orm.rb +33 -0
- data/lib/padrino-admin/orm/abstract.rb +94 -0
- data/lib/padrino-admin/{adapters/ar.rb → orm/activerecord.rb} +69 -36
- data/lib/padrino-admin/orm/datamapper.rb +214 -0
- data/lib/padrino-admin/{adapters/mm.rb → orm/mongomapper.rb} +36 -20
- data/lib/padrino-admin/utils/literal.rb +1 -1
- data/padrino-admin.gemspec +62 -51
- data/test/fixtures/active_record.rb +14 -2
- data/test/fixtures/data_mapper.rb +2 -1
- data/test/fixtures/mongo_mapper.rb +1 -1
- data/test/fixtures/test_column_store.jml +1 -0
- data/test/helper.rb +3 -2
- data/test/test_access_control.rb +1 -1
- data/test/test_active_record.rb +56 -1
- data/test/test_column_store.rb +56 -10
- data/test/test_data_mapper.rb +67 -1
- metadata +58 -47
- data/lib/padrino-admin/adapters.rb +0 -108
- data/lib/padrino-admin/adapters/dm.rb +0 -147
- data/lib/padrino-admin/ext_js/config.rb +0 -186
- data/test/fixtures/test_generic.jml +0 -7
- data/test/fixtures/test_javascript.jml +0 -81
@@ -0,0 +1,36 @@
|
|
1
|
+
require 'rubygems'
|
2
|
+
require 'yaml'
|
3
|
+
require 'erb'
|
4
|
+
require 'json/pure' unless defined?(JSON) || defined?(JSON::Pure)
|
5
|
+
|
6
|
+
module Padrino
|
7
|
+
module Admin
|
8
|
+
module Config
|
9
|
+
|
10
|
+
##
|
11
|
+
# This class it's used for JSON variables.
|
12
|
+
# Normally if we convert this { :function => "alert('Test')" } will be:
|
13
|
+
#
|
14
|
+
# { "function": "alert('Test')" }
|
15
|
+
#
|
16
|
+
# But if in our javascript need to "eval" this function is not possible because
|
17
|
+
# it's a string.
|
18
|
+
#
|
19
|
+
# Using Padrino::Config::Variable the result will be:
|
20
|
+
#
|
21
|
+
# { "function" : alert('Test') }
|
22
|
+
#
|
23
|
+
# Normally an ExtJs Variable can be handled with ExtJs Config like:
|
24
|
+
#
|
25
|
+
# function: !js alert('Test')
|
26
|
+
#
|
27
|
+
class Variable < String
|
28
|
+
yaml_as "tag:yaml.org,2002:js"
|
29
|
+
|
30
|
+
def to_json(*a) #:nodoc:
|
31
|
+
self
|
32
|
+
end
|
33
|
+
end # Variable
|
34
|
+
end # Config
|
35
|
+
end # Admin
|
36
|
+
end # Padrino
|
@@ -1,16 +1,71 @@
|
|
1
1
|
module Padrino
|
2
2
|
module Generators
|
3
3
|
module Actions
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
4
|
+
##
|
5
|
+
# Tell us if for our orm we need migrations
|
6
|
+
#
|
7
|
+
def skip_migrations
|
8
|
+
skip_migration = case orm
|
9
|
+
when :activerecord then false
|
10
|
+
when :sequel then false
|
11
|
+
else true
|
12
|
+
end
|
10
13
|
end
|
11
14
|
|
12
|
-
|
15
|
+
##
|
16
|
+
# Tell us which orm we are using
|
17
|
+
#
|
18
|
+
def orm
|
19
|
+
fetch_component_choice(:orm).to_sym rescue :datamapper
|
13
20
|
end
|
21
|
+
|
22
|
+
##
|
23
|
+
# Tell us for now wich orm we support
|
24
|
+
#
|
25
|
+
def supported_orm
|
26
|
+
[:datamapper, :activerecord]
|
27
|
+
end
|
28
|
+
|
29
|
+
##
|
30
|
+
# Add access_control permission in our app.rb
|
31
|
+
#
|
32
|
+
def add_access_control_permission(admin, controller)
|
33
|
+
permission = indent(6, access_control(controller))
|
34
|
+
if options[:destroy] || !File.read(destination_root("#{admin}/app.rb")).include?(permission)
|
35
|
+
inject_into_file destination_root("#{admin}/app.rb"), permission, :after => "access_control.roles_for :admin do |role, account|\n"
|
36
|
+
end
|
37
|
+
end
|
38
|
+
|
39
|
+
##
|
40
|
+
# Add a simple permission (allow/deny) to our app.rb
|
41
|
+
#
|
42
|
+
def add_permission(admin, permission)
|
43
|
+
if options[:destroy] || !File.read(destination_root("#{admin}/app.rb")).include?(permission)
|
44
|
+
inject_into_file destination_root("#{admin}/app.rb"), indent(6, "\n#{permission}\n"), :after => "access_control.roles_for :admin do |role, account|\n"
|
45
|
+
end
|
46
|
+
end
|
47
|
+
|
48
|
+
##
|
49
|
+
# Indent a content/string for the given spaces
|
50
|
+
#
|
51
|
+
def indent(count, content)
|
52
|
+
indent = ' ' * count
|
53
|
+
content.map { |line| line != "\n" ? indent+line : "\n" }.join
|
54
|
+
end
|
55
|
+
|
56
|
+
private
|
57
|
+
##
|
58
|
+
# For access control permissions
|
59
|
+
#
|
60
|
+
def access_control(controller)
|
61
|
+
(<<-RUBY).gsub(/ {12}/,'')
|
62
|
+
|
63
|
+
role.project_module :#{controller} do |project|
|
64
|
+
project.menu :list, "/admin/#{controller}.js"
|
65
|
+
project.menu :new, "/admin/#{controller}/new"
|
66
|
+
end
|
67
|
+
RUBY
|
68
|
+
end
|
14
69
|
end
|
15
70
|
end
|
16
71
|
end
|
@@ -8,58 +8,59 @@ module Padrino
|
|
8
8
|
|
9
9
|
# Define the source template root
|
10
10
|
def self.source_root; File.expand_path(File.dirname(__FILE__)); end
|
11
|
-
def self.banner; "padrino-gen
|
11
|
+
def self.banner; "padrino-gen admin"; end
|
12
12
|
|
13
13
|
# Include related modules
|
14
14
|
include Thor::Actions
|
15
15
|
include Padrino::Generators::Actions
|
16
16
|
|
17
|
-
desc "Description:\n\n\tpadrino-gen
|
17
|
+
desc "Description:\n\n\tpadrino-gen admin generates a new Padrino Admin"
|
18
18
|
|
19
|
-
class_option :root, :aliases => '-r', :default => ".", :type => :string
|
19
|
+
class_option :root, :desc => "The root destination", :aliases => '-r', :default => ".", :type => :string
|
20
20
|
class_option :path, :aliases => '-p', :type => :string, :default => "admin"
|
21
21
|
class_option :destroy, :aliases => '-d', :default => false, :type => :boolean
|
22
22
|
|
23
23
|
# Copies over the Padrino base admin application
|
24
24
|
def create_admin
|
25
|
-
|
25
|
+
self.destination_root = options[:root]
|
26
|
+
if in_app_root?
|
26
27
|
@app_path = options[:path]
|
27
|
-
@orm = fetch_component_choice(:orm, options[:root]).to_sym rescue :datamapper
|
28
|
-
supported_orm = [:datamapper, :activerecord]
|
29
|
-
skip_migration = case @orm
|
30
|
-
when :activerecord then false
|
31
|
-
when :sequel then false
|
32
|
-
else true
|
33
|
-
end
|
34
28
|
|
35
|
-
unless supported_orm.include?(
|
29
|
+
unless supported_orm.include?(orm)
|
36
30
|
say "<= A the moment we only support #{supported_orm.join(" or ")}. Sorry!"
|
37
31
|
raise SystemExit
|
38
32
|
end
|
39
33
|
|
40
34
|
self.behavior = :revoke if options[:destroy]
|
41
|
-
directory("app/",
|
35
|
+
directory("app/", destination_root(options[:path]))
|
42
36
|
|
43
37
|
Padrino::Generators::Model.dup.start([
|
44
38
|
"account", "name:string", "surname:string", "email:string", "crypted_password:string", "salt:string", "role:string",
|
45
|
-
"-r=#{options[:root]}", "-s=#{
|
39
|
+
"-r=#{options[:root]}", "-s=#{skip_migrations}", "-d=#{options[:destroy]}"
|
46
40
|
])
|
47
41
|
|
48
|
-
|
42
|
+
insert_into_gemfile("haml")
|
43
|
+
|
44
|
+
template "templates/page/db/seeds.rb.tt", destination_root("/db/seeds.rb")
|
49
45
|
|
50
|
-
if options[:destroy] || !File.read(
|
51
|
-
append_file
|
46
|
+
if options[:destroy] || !File.read(destination_root("config/apps.rb")).include?("Padrino.mount(\"Admin\").to(\"/#{@app_path}\")")
|
47
|
+
append_file destination_root("config/apps.rb"), "\nPadrino.mount(\"Admin\").to(\"/#{@app_path}\")"
|
52
48
|
end
|
53
|
-
|
49
|
+
|
54
50
|
unless options[:destroy]
|
55
|
-
say
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
51
|
+
say (<<-TEXT).gsub(/ {12}/,'')
|
52
|
+
|
53
|
+
-----------------------------------------------------------------
|
54
|
+
Your admin now is installed, now follow this steps:
|
55
|
+
|
56
|
+
- edit your config/database.rb
|
57
|
+
- run padrino rake -T and run db creation according to your orm
|
58
|
+
- run padrino rake seed
|
59
|
+
|
60
|
+
That's all
|
61
|
+
-----------------------------------------------------------------
|
62
|
+
|
63
|
+
TEXT
|
63
64
|
end
|
64
65
|
else
|
65
66
|
say "You are not at the root of a Padrino application! (config/boot.rb not found)" and exit unless in_app_root?
|
@@ -8,16 +8,16 @@ module Padrino
|
|
8
8
|
|
9
9
|
# Define the source template root
|
10
10
|
def self.source_root; File.expand_path(File.dirname(__FILE__)); end
|
11
|
-
def self.banner; "padrino-gen
|
11
|
+
def self.banner; "padrino-gen admin_page [Model]"; end
|
12
12
|
|
13
13
|
# Include related modules
|
14
14
|
include Thor::Actions
|
15
15
|
include Padrino::Generators::Actions
|
16
16
|
|
17
|
-
desc "Description:\n\n\tpadrino-gen
|
17
|
+
desc "Description:\n\n\tpadrino-gen admin_page YourModel"
|
18
18
|
argument :model, :desc => "The name of your model"
|
19
19
|
class_option :admin_path, :aliases => '-p', :type => :string, :default => "admin"
|
20
|
-
class_option :root, :aliases => '-r', :type => :string
|
20
|
+
class_option :root, :desc => "The root destination", :aliases => '-r', :type => :string
|
21
21
|
class_option :destroy, :aliases => '-d', :default => false, :type => :boolean
|
22
22
|
|
23
23
|
# Show help if no argv given
|
@@ -28,23 +28,25 @@ module Padrino
|
|
28
28
|
|
29
29
|
# Create controller for admin
|
30
30
|
def create_controller
|
31
|
-
|
32
|
-
|
33
|
-
@
|
34
|
-
@
|
35
|
-
@
|
31
|
+
self.destination_root = options[:root]
|
32
|
+
if in_app_root?
|
33
|
+
@model_name = model.classify
|
34
|
+
@model_klass = model.classify.constantize
|
35
|
+
@model_plural = model.underscore.pluralize
|
36
|
+
@model_singular = model.underscore
|
36
37
|
@app_root = File.join(options[:root] || '.', options[:admin_path])
|
37
38
|
self.behavior = :revoke if options[:destroy]
|
38
|
-
|
39
|
-
template "templates/
|
40
|
-
template "templates/views/
|
41
|
-
template "templates/views/
|
42
|
-
template "templates/views/
|
43
|
-
template "templates/views/
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
39
|
+
|
40
|
+
template "templates/page/controller.rb.tt", destination_root(options[:admin_path], "/controllers/#{@model_plural}.rb")
|
41
|
+
template "templates/page/views/_form.haml.tt", destination_root(options[:admin_path], "/views/#{@model_plural}/_form.haml")
|
42
|
+
template "templates/page/views/edit.haml.tt", destination_root(options[:admin_path], "/views/#{@model_plural}/edit.haml")
|
43
|
+
template "templates/page/views/grid.js.erb.tt", destination_root(options[:admin_path], "/views/#{@model_plural}/grid.js.erb")
|
44
|
+
template "templates/page/views/new.haml.tt", destination_root(options[:admin_path], "/views/#{@model_plural}/new.haml")
|
45
|
+
template "templates/page/views/store.jml.tt", destination_root(options[:admin_path], "/views/#{@model_plural}/store.jml")
|
46
|
+
|
47
|
+
add_access_control_permission(options[:admin_path], @model_plural)
|
48
|
+
include_component_module_for(:test)
|
49
|
+
generate_controller_test(model.downcase.pluralize)
|
48
50
|
else
|
49
51
|
say "You are not at the root of a Padrino application! (config/boot.rb not found)" and return unless in_app_root?
|
50
52
|
end
|
@@ -0,0 +1,83 @@
|
|
1
|
+
module Padrino
|
2
|
+
module Generators
|
3
|
+
|
4
|
+
class AdminUploader < Thor::Group
|
5
|
+
|
6
|
+
# Add this generator to our padrino-gen
|
7
|
+
Padrino::Generators.add_generator(:admin_uploader, self)
|
8
|
+
|
9
|
+
# Define the source template root
|
10
|
+
def self.source_root; File.expand_path(File.dirname(__FILE__)); end
|
11
|
+
def self.banner; "padrino-gen admin_uploader"; end
|
12
|
+
|
13
|
+
# Include related modules
|
14
|
+
include Thor::Actions
|
15
|
+
include Padrino::Generators::Actions
|
16
|
+
|
17
|
+
desc "Description:\n\n\tpadrino-gen admin_uploader Name"
|
18
|
+
class_option :admin_path, :desc => "Path where is stored your admin app", :aliases => '-p', :type => :string, :default => "admin"
|
19
|
+
class_option :root, :desc => "The root destination", :aliases => '-r', :type => :string, :default => "."
|
20
|
+
class_option :destroy, :desc => "Destroy the uploader", :aliases => '-d', :default => false, :type => :boolean
|
21
|
+
|
22
|
+
# Create controller for admin
|
23
|
+
def create_controller
|
24
|
+
self.destination_root = options[:root]
|
25
|
+
if in_app_root?
|
26
|
+
@app_root = File.join(options[:root], options[:admin_path])
|
27
|
+
self.behavior = :revoke if options[:destroy]
|
28
|
+
|
29
|
+
if options[:destroy] || !File.read(destination_root("GemFile")).include?("carrierwave")
|
30
|
+
append_file destination_root("Gemfile"), "\n\n# Uploader requirements\ngem 'carrierwave'"
|
31
|
+
end
|
32
|
+
|
33
|
+
copy_file "templates/uploader/controller.rb", destination_root(options[:admin_path], "/controllers/uploads.rb")
|
34
|
+
copy_file "templates/uploader/views/grid.js.erb", destination_root(options[:admin_path], "/views/uploads/grid.js.erb")
|
35
|
+
copy_file "templates/uploader/views/store.jml", destination_root(options[:admin_path], "/views/uploads/store.jml")
|
36
|
+
copy_file "templates/uploader/lib/uploader.rb", destination_root("lib", "uploader.rb")
|
37
|
+
|
38
|
+
Padrino::Generators::Model.dup.start([
|
39
|
+
"upload", "file:string", "created_at:datetime",
|
40
|
+
"-r=#{options[:root]}", "-s=#{skip_migrations}", "-d=#{options[:destroy]}"
|
41
|
+
])
|
42
|
+
|
43
|
+
inject_into_file destination_root("app", "models", "upload.rb"), :before => "end" do
|
44
|
+
(<<-RUBY).gsub(/ {14}/, ' ')
|
45
|
+
mount_uploader :file, Uploader
|
46
|
+
|
47
|
+
def size
|
48
|
+
file.size if file
|
49
|
+
end
|
50
|
+
|
51
|
+
def content_type
|
52
|
+
file.content_type if file
|
53
|
+
end
|
54
|
+
RUBY
|
55
|
+
end
|
56
|
+
|
57
|
+
# Only for datamapper
|
58
|
+
if orm == :datamapper
|
59
|
+
inject_into_file destination_root("app", "models", "upload.rb"), :after => "property :file, String" do
|
60
|
+
", :auto_validation => false"
|
61
|
+
end
|
62
|
+
end
|
63
|
+
|
64
|
+
add_permission(options[:admin_path], "role.project_module :uploads, \"/admin/uploads.js\"")
|
65
|
+
|
66
|
+
return if self.behavior == :revoke
|
67
|
+
|
68
|
+
say (<<-TEXT).gsub(/ {10}/,'')
|
69
|
+
|
70
|
+
-----------------------------------------------------
|
71
|
+
1) Run migrations
|
72
|
+
2) That's all!!
|
73
|
+
-----------------------------------------------------
|
74
|
+
|
75
|
+
TEXT
|
76
|
+
else
|
77
|
+
say "You are not at the root of a Padrino application! (config/boot.rb not found)" and return unless in_app_root?
|
78
|
+
end
|
79
|
+
end
|
80
|
+
end
|
81
|
+
|
82
|
+
end
|
83
|
+
end
|
@@ -9,7 +9,6 @@ class Admin < Padrino::Application
|
|
9
9
|
layout false
|
10
10
|
enable :authentication
|
11
11
|
disable :store_location
|
12
|
-
set :use_orm, <%= @orm.inspect %>
|
13
12
|
set :login_page, "/<%= @app_path %>/sessions/new"
|
14
13
|
|
15
14
|
access_control.roles_for :any do |role|
|
@@ -17,14 +16,13 @@ class Admin < Padrino::Application
|
|
17
16
|
end
|
18
17
|
|
19
18
|
access_control.roles_for :admin do |role, account|
|
19
|
+
|
20
20
|
role.allow "/"
|
21
21
|
|
22
22
|
role.project_module :accounts do |project|
|
23
23
|
project.menu :list, "/<%= @app_path %>/accounts.js"
|
24
24
|
project.menu :new, "/<%= @app_path %>/accounts/new"
|
25
25
|
end
|
26
|
-
|
27
|
-
# Put before other permissions [don't delete this line!!!]
|
28
26
|
end
|
29
27
|
|
30
28
|
end
|
@@ -32,6 +32,6 @@ Admin.controllers :accounts do
|
|
32
32
|
delete :destroy, :respond_to => :json do
|
33
33
|
accounts = Account.all(:conditions => { :id => params[:ids].split(",") })
|
34
34
|
errors = accounts.map { |account| I18n.t("admin.general.cantDelete", :record => account.id) unless account.destroy }.compact
|
35
|
-
|
35
|
+
render :success => errors.empty?, :msg => errors.join("<br />")
|
36
36
|
end
|
37
37
|
end
|
Binary file
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
Binary file
|
File without changes
|
Binary file
|
Binary file
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|