decidim-admin 0.8.3 → 0.8.4

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.

Potentially problematic release.


This version of decidim-admin might be problematic. Click here for more details.

checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: c0a14ae577b8ee55f1acd219a7c201705721ac0b
4
- data.tar.gz: cffdb14ae737f8f3f5a5f1b393700aa40e3c2110
3
+ metadata.gz: fce922e0089d9ed07326a1e94358d6ac0369e017
4
+ data.tar.gz: d0a2c99292b6107b85358a4903d67c321d3ab8cb
5
5
  SHA512:
6
- metadata.gz: '099c3142bad2c42410bf25b3638189d17d60a73e0db7f3d9c0b8f2d7f6bbb0a09039727c35d38f9e2d9ac85d902cff1e4c14c62496ce4e05dd58a4815cb35d9d'
7
- data.tar.gz: a0a2529a0834105d52116e479eee4c47d7382958179dfe9b963c44c07f20ba5b690cd12efe19a3606c4ecdd5af5dfc61415a1de1b11aaf9bd83d28bf9a5e472e
6
+ metadata.gz: d21005f8d249df1e0545514164aab9506f8b14b783ade310385cec5f605dd3a403099f8abb8dfa753e416346e3a4e071153db75207f747fca5a3e02e05ab7dac
7
+ data.tar.gz: 4da1945d5ebc6ca61de4dfdb3ccb02e008f0f6ec96de01b918ac2950de0b8dfa758d99d55556967d5d6f7f90f50d28e035912bdaab72dade8df32e30a6bd3685
@@ -0,0 +1,61 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Decidim
4
+ module Admin
5
+ # This module contains all the logic needed for a controller to render a participatory space
6
+ # public layout. modqule ParticipatorySpaceAdminContext
7
+ module ParticipatorySpaceAdminContext
8
+ extend ActiveSupport::Concern
9
+
10
+ class_methods do
11
+ # Public: Called on a controller, it sets up all the surrounding methods to render a
12
+ # participatory space's admin template. It expects the method `current_participatory_space`
13
+ # to be defined, from which it will extract the participatory manifest.
14
+ #
15
+ # options - A hash used to modify the behavior of the layout. :only: - An array of actions
16
+ # on which the layout will be applied.
17
+ #
18
+ # Returns nothing.
19
+ def participatory_space_admin_layout(options = {})
20
+ layout :layout, options
21
+ before_action :authorize_participatory_space, options
22
+ end
23
+ end
24
+
25
+ included do
26
+ include Decidim::NeedsOrganization
27
+ helper ParticipatorySpaceHelpers
28
+
29
+ helper_method :current_participatory_space
30
+ helper_method :current_participatory_space_manifest
31
+ helper_method :current_participatory_space_context
32
+
33
+ delegate :manifest, to: :current_participatory_space, prefix: true
34
+ end
35
+
36
+ private
37
+
38
+ def current_participatory_space_context
39
+ :admin
40
+ end
41
+
42
+ def current_participatory_space
43
+ raise NotImplementedError
44
+ end
45
+
46
+ def authorize_participatory_space
47
+ authorize! :read, current_participatory_space
48
+ end
49
+
50
+ def ability_context
51
+ super.merge(
52
+ current_participatory_space: current_participatory_space
53
+ )
54
+ end
55
+
56
+ def layout
57
+ current_participatory_space_manifest.context(current_participatory_space_context).layout
58
+ end
59
+ end
60
+ end
61
+ end
@@ -5,8 +5,9 @@ module Decidim
5
5
  # Controller that allows managing categories.
6
6
  #
7
7
  class CategoriesController < Decidim::Admin::ApplicationController
8
- helper_method :current_participatory_space
9
-
8
+ include ParticipatorySpaceAdminContext
9
+ participatory_space_admin_layout
10
+
10
11
  def index
11
12
  authorize! :read, Decidim::Category
12
13
  end
@@ -8,6 +8,9 @@ module Decidim
8
8
  class BaseController < Admin::ApplicationController
9
9
  skip_authorize_resource
10
10
  include Settings
11
+
12
+ include Decidim::Admin::ParticipatorySpaceAdminContext
13
+ participatory_space_admin_layout
11
14
 
12
15
  helper Decidim::ResourceHelper
13
16
  helper Decidim::Admin::ExportsHelper
@@ -16,10 +19,6 @@ module Decidim
16
19
  :current_participatory_space,
17
20
  :parent_path
18
21
 
19
- before_action do
20
- extend current_participatory_space.admin_extension_module
21
- end
22
-
23
22
  before_action except: [:index, :show] do
24
23
  authorize! :manage, current_feature
25
24
  end
@@ -7,7 +7,7 @@ Decidim::Admin::Engine.routes.draw do
7
7
  end
8
8
 
9
9
  Decidim.participatory_space_manifests.each do |manifest|
10
- mount manifest.admin_engine, at: "/", as: "decidim_admin_#{manifest.name}"
10
+ mount manifest.context(:admin).engine, at: "/", as: "decidim_admin_#{manifest.name}"
11
11
  end
12
12
 
13
13
  resources :static_pages
@@ -4,7 +4,7 @@ module Decidim
4
4
  # This holds the decidim-admin version.
5
5
  module Admin
6
6
  def self.version
7
- "0.8.3"
7
+ "0.8.4"
8
8
  end
9
9
  end
10
10
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: decidim-admin
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.8.3
4
+ version: 0.8.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Josep Jaume Rey Peroy
@@ -10,7 +10,7 @@ authors:
10
10
  autorequire:
11
11
  bindir: bin
12
12
  cert_chain: []
13
- date: 2017-12-15 00:00:00.000000000 Z
13
+ date: 2018-01-16 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: active_link_to
@@ -32,14 +32,14 @@ dependencies:
32
32
  requirements:
33
33
  - - '='
34
34
  - !ruby/object:Gem::Version
35
- version: 0.8.3
35
+ version: 0.8.4
36
36
  type: :runtime
37
37
  prerelease: false
38
38
  version_requirements: !ruby/object:Gem::Requirement
39
39
  requirements:
40
40
  - - '='
41
41
  - !ruby/object:Gem::Version
42
- version: 0.8.3
42
+ version: 0.8.4
43
43
  - !ruby/object:Gem::Dependency
44
44
  name: devise
45
45
  requirement: !ruby/object:Gem::Requirement
@@ -130,28 +130,28 @@ dependencies:
130
130
  requirements:
131
131
  - - '='
132
132
  - !ruby/object:Gem::Version
133
- version: 0.8.3
133
+ version: 0.8.4
134
134
  type: :development
135
135
  prerelease: false
136
136
  version_requirements: !ruby/object:Gem::Requirement
137
137
  requirements:
138
138
  - - '='
139
139
  - !ruby/object:Gem::Version
140
- version: 0.8.3
140
+ version: 0.8.4
141
141
  - !ruby/object:Gem::Dependency
142
142
  name: decidim-participatory_processes
143
143
  requirement: !ruby/object:Gem::Requirement
144
144
  requirements:
145
145
  - - '='
146
146
  - !ruby/object:Gem::Version
147
- version: 0.8.3
147
+ version: 0.8.4
148
148
  type: :development
149
149
  prerelease: false
150
150
  version_requirements: !ruby/object:Gem::Requirement
151
151
  requirements:
152
152
  - - '='
153
153
  - !ruby/object:Gem::Version
154
- version: 0.8.3
154
+ version: 0.8.4
155
155
  description: Organization administration to manage a single organization.
156
156
  email:
157
157
  - josepjaume@gmail.com
@@ -265,6 +265,7 @@ files:
265
265
  - app/commands/decidim/admin/update_user_groups.rb
266
266
  - app/commands/decidim/admin/verify_user_group.rb
267
267
  - app/constraints/decidim/admin/organization_dashboard_constraint.rb
268
+ - app/controllers/concerns/decidim/admin/participatory_space_admin_context.rb
268
269
  - app/controllers/decidim/admin/application_controller.rb
269
270
  - app/controllers/decidim/admin/authorization_workflows_controller.rb
270
271
  - app/controllers/decidim/admin/categories_controller.rb