para-acl 0.2.0.a → 0.3.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 7247c40349650b922ab484aa17f4b6147f345819
4
- data.tar.gz: 568f9572af8b918f2989a5c61a3cfb0447aba148
3
+ metadata.gz: 6831e21dedb07eaaa49215ebbbacd35cacdbabb5
4
+ data.tar.gz: 7cbc10e24b9a67e20cf2bf2e22b6c46c809e0e09
5
5
  SHA512:
6
- metadata.gz: 8c2f9809fe55b65e1065cf3cdac5d8690ddfdc418a41b1e503520b31bc50f40bb87226bd0c12914be5a1cd1bdbd19f27657aeac7d517dd33ee753080c4559147
7
- data.tar.gz: f943c36fe06b38c145b6a71e101cd1bb28ea1aab6cbd13bed832fbcef2f9cb7a39774b101c32acd3327f6e31fc74bacd97f0fd3d73adbc6d75ac8fdf74a24b20
6
+ metadata.gz: 89aafe69c9079f39e77e6f7055218053dcf0658dbeda4154a757d853416f2e904a52f5709185263983b914ff2b5acba6c890d57e7808e0b52404d766b286d965
7
+ data.tar.gz: 73db47e95840e6576e51b9d7293fb3b6b78b9307f4b0069006ee90924f7674c1eb328853c5c8b2e82038a193eef112f4e1a0c1e7106311656eb998e53dc5d827
@@ -1,4 +1,4 @@
1
- class AclRolesComponent < Para::Component::Crud
1
+ class AclRolesComponent < Para::Component::Base
2
2
  register :acl_roles, self
3
3
 
4
4
  def resources
@@ -8,4 +8,8 @@ class AclRolesComponent < Para::Component::Crud
8
8
  def model_type
9
9
  '::Para::Acl::Role'
10
10
  end
11
+
12
+ def model
13
+ @model ||= model_type.constantize
14
+ end
11
15
  end
@@ -1,7 +1,7 @@
1
- module Admin
2
- module Para
3
- module Acl
4
- class RolesComponentController < ::Para::Admin::ComponentController
1
+ module Para
2
+ module Acl
3
+ module Admin
4
+ class AclRolesComponentController < ::Para::Admin::ComponentController
5
5
  def show
6
6
  @components_roles = ::Para::Acl::ComponentRolesCollection.new
7
7
  end
@@ -0,0 +1,9 @@
1
+ module Para
2
+ module Acl
3
+ module Admin
4
+ class RolesController < ::Para::Admin::ResourcesController
5
+ resource :role, class: 'Para::Acl::Role'
6
+ end
7
+ end
8
+ end
9
+ end
@@ -1,9 +1,5 @@
1
1
  module AclRolesComponentDecorator
2
- include Para::Component::CrudDecorator
3
-
4
- def path(options = {})
5
- find_path([:admin, self], options)
6
- end
2
+ include Para::Component::BaseDecorator
7
3
 
8
4
  def name
9
5
  I18n.t('admin.acl_roles.name')
@@ -1,4 +1,4 @@
1
- = para_form_for(resource) do |form|
1
+ = para_form_for(resource, url: @component.relation_path(:role, id: resource.id)) do |form|
2
2
  = form.tabs do |tabs|
3
3
  = tabs.tab :role do
4
4
  = form.input :name
@@ -8,7 +8,7 @@
8
8
  - if resource.persisted?
9
9
  = tabs.tab :destroy_role do
10
10
  = form.input :id, label: t('para.shared.destroy') do
11
- = link_to @component.relation_path(resource), method: :delete, class: 'btn btn-danger', data: { confirm: t('admin.acl_roles.destroy', role: resource.name) } do
11
+ = link_to @component.relation_path(:role, id: resource.id), method: :delete, class: 'btn btn-danger', data: { confirm: t('admin.acl_roles.destroy', role: resource.name) } do
12
12
  = fa_icon 'times'
13
13
  = t('para.shared.destroy')
14
14
 
@@ -9,7 +9,8 @@
9
9
  = para_form_for @components_roles, url: @component.path, as: :components_roles do |form|
10
10
  = panel do |panel|
11
11
  = panel.header do
12
- = add_button_for(@component, :resources, @component.model)
12
+ = icon_link_to t('para.shared.add'), @component.relation_path(:role, action: :new), icon: 'plus', class: 'btn btn-primary add-button'
13
+
13
14
 
14
15
  = resources_table(component: @component, model: @component.model, actions: false) do |table|
15
16
  = table.header do
@@ -17,7 +18,7 @@
17
18
 
18
19
  - @components_roles.roles.each do |role|
19
20
  = table.header_for do
20
- = link_to @component.relation_path(role, action: :edit) do
21
+ = link_to @component.relation_path(:role, id: role.id, action: :edit) do
21
22
  = role.name
22
23
  = fa_icon 'pencil'
23
24
 
@@ -4,13 +4,10 @@ module Para
4
4
  extend ActiveSupport::Concern
5
5
 
6
6
  included do
7
- before_destroy :clean_role_components
8
- end
9
-
10
- private
11
-
12
- def clean_role_components
13
- ::Para::Acl::RoleComponent.where(component: self).destroy_all
7
+ has_many :role_components, class_name: 'Para::Acl::RoleComponent',
8
+ foreign_key: :component_id,
9
+ dependent: :destroy
10
+ has_many :roles, through: :role_components
14
11
  end
15
12
  end
16
13
  end
@@ -3,9 +3,9 @@ module Para
3
3
  class Routes < Para::Plugins::Routes
4
4
  def draw
5
5
  plugin :acl do
6
- component :roles, path: :roles
7
- crud_component :roles, path: :roles
8
- patch "roles/:component_id" => "roles_component#update"
6
+ component :acl_roles, path: :roles, actions: [:show, :update] do
7
+ resources :roles
8
+ end
9
9
  end
10
10
  end
11
11
  end
@@ -1,5 +1,5 @@
1
1
  module Para
2
2
  module Acl
3
- VERSION = "0.2.0.a"
3
+ VERSION = "0.3.0"
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: para-acl
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.0.a
4
+ version: 0.3.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Valentin Ballestrino
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-08-07 00:00:00.000000000 Z
11
+ date: 2016-09-27 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: para
@@ -92,14 +92,14 @@ files:
92
92
  - README.md
93
93
  - Rakefile
94
94
  - app/components/acl_roles_component.rb
95
- - app/controllers/admin/para/acl/role_resources_controller.rb
96
- - app/controllers/admin/para/acl/roles_component_controller.rb
95
+ - app/controllers/para/acl/admin/acl_roles_component_controller.rb
96
+ - app/controllers/para/acl/admin/roles_controller.rb
97
97
  - app/decorators/acl_roles_component_decorator.rb
98
98
  - app/models/para/acl/role.rb
99
99
  - app/models/para/acl/role_component.rb
100
100
  - app/models/para/acl/user_role.rb
101
101
  - app/views/admin/para/acl/roles/_form.html.haml
102
- - app/views/admin/para/acl/roles_component/show.html.haml
102
+ - app/views/para/acl/admin/acl_roles_component/show.html.haml
103
103
  - bin/rails
104
104
  - config/locales/fr.yml
105
105
  - db/migrate/20151215160816_create_para_acl_roles.rb
@@ -138,9 +138,9 @@ required_ruby_version: !ruby/object:Gem::Requirement
138
138
  version: '0'
139
139
  required_rubygems_version: !ruby/object:Gem::Requirement
140
140
  requirements:
141
- - - ">"
141
+ - - ">="
142
142
  - !ruby/object:Gem::Version
143
- version: 1.3.1
143
+ version: '0'
144
144
  requirements: []
145
145
  rubyforge_project:
146
146
  rubygems_version: 2.5.1
@@ -1,8 +0,0 @@
1
- module Admin
2
- module Para
3
- module Acl
4
- class RoleResourcesController < ::Para::Admin::CrudResourcesController
5
- end
6
- end
7
- end
8
- end