cm-admin 0.7.3 → 0.7.6
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.
- checksums.yaml +4 -4
- data/Gemfile.lock +12 -8
- data/README.md +1 -1
- data/app/controllers/cm_admin/application_controller.rb +1 -2
- data/app/controllers/cm_admin/resource_controller.rb +194 -0
- data/app/javascript/packs/cm_admin/application.js +2 -0
- data/app/views/cm_admin/main/_actions_dropdown.html.slim +52 -0
- data/app/views/cm_admin/main/_associated_table.html.slim +2 -35
- data/app/views/cm_admin/main/_table.html.slim +3 -27
- data/cm_admin.gemspec +4 -3
- data/lib/cm_admin/model.rb +13 -67
- data/lib/cm_admin/models/action.rb +10 -0
- data/lib/cm_admin/version.rb +1 -1
- data/lib/cm_admin/view_helpers/action_dropdown_helper.rb +21 -0
- data/lib/cm_admin/view_helpers/field_display_helper.rb +2 -2
- data/lib/cm_admin/view_helpers/page_info_helper.rb +2 -0
- data/lib/cm_admin/view_helpers.rb +6 -3
- data/lib/generators/cm_admin/add_authentication_generator.rb +31 -0
- data/lib/generators/cm_admin/templates/application_controller.rb +8 -0
- data/lib/generators/cm_admin/templates/authentication.rb +14 -0
- data/lib/generators/cm_admin/templates/cm_admin_initializer.rb +2 -0
- data/lib/generators/cm_admin/templates/current.rb +9 -0
- data/package-lock.json +19910 -0
- data/package.json +1 -0
- data/yarn.lock +1164 -1147
- metadata +42 -21
- data/lib/cm_admin/models/controller_method.rb +0 -94
@@ -2,12 +2,15 @@ module CmAdmin
|
|
2
2
|
module ViewHelpers
|
3
3
|
Dir[File.expand_path("view_helpers", __dir__) + "/*.rb"].each { |f| require f }
|
4
4
|
|
5
|
-
include
|
6
|
-
include NavigationHelper
|
7
|
-
include FormHelper
|
5
|
+
include ActionDropdownHelper
|
8
6
|
include FieldDisplayHelper
|
9
7
|
include FilterHelper
|
8
|
+
include FormHelper
|
10
9
|
include ManageColumnPopupHelper
|
10
|
+
include NavigationHelper
|
11
|
+
include PageInfoHelper
|
12
|
+
|
13
|
+
# Included Rails view helper
|
11
14
|
include ActionView::Helpers::FormTagHelper
|
12
15
|
include ActionView::Helpers::TagHelper
|
13
16
|
|
@@ -0,0 +1,31 @@
|
|
1
|
+
require 'rails/generators'
|
2
|
+
|
3
|
+
module CmAdmin
|
4
|
+
module Generators
|
5
|
+
class AddAuthenticationGenerator < Rails::Generators::Base
|
6
|
+
source_root File.expand_path('templates', __dir__)
|
7
|
+
|
8
|
+
# This generator is used to add authentication, if no auth system is present.
|
9
|
+
# Adds authentication through devise and sets up the current user.
|
10
|
+
def add_authentication
|
11
|
+
gem "devise"
|
12
|
+
generate "devise:install"
|
13
|
+
model_name = ask("What would you like the user model to be called? [user]")
|
14
|
+
generate "devise", model_name
|
15
|
+
rake "db:migrate"
|
16
|
+
copy_file 'application_controller.rb', 'app/controllers/cm_admin/application_controller.rb'
|
17
|
+
gsub_file 'app/controllers/cm_admin/application_controller.rb', 'authenticate_user', "authenticate_#{model_name}"
|
18
|
+
copy_file 'authentication.rb', 'app/controllers/concerns/authentication.rb'
|
19
|
+
gsub_file 'app/controllers/concerns/authentication.rb', 'current_user', "current_#{model_name}"
|
20
|
+
copy_file 'current.rb', 'app/models/current.rb'
|
21
|
+
inject_into_file "app/models/#{model_name.underscore}.rb", before: "end\n" do <<-'RUBY'
|
22
|
+
# Remove this once role is setup and mentioned in zcm_admin.rb
|
23
|
+
def super_admin?
|
24
|
+
true
|
25
|
+
end
|
26
|
+
RUBY
|
27
|
+
end
|
28
|
+
end
|
29
|
+
end
|
30
|
+
end
|
31
|
+
end
|