decidim-assemblies 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.
- checksums.yaml +4 -4
- data/app/controllers/decidim/assemblies/admin/assemblies_controller.rb +5 -2
- data/app/controllers/decidim/assemblies/admin/concerns/assembly_admin.rb +13 -3
- data/app/controllers/decidim/assemblies/assemblies_controller.rb +8 -7
- data/app/views/decidim/assemblies/assemblies/_statistics.html.erb +1 -1
- data/app/views/decidim/assemblies/assemblies/show.html.erb +21 -21
- data/app/views/layouts/decidim/_assembly_header.html.erb +9 -9
- data/app/views/layouts/decidim/assembly.html.erb +4 -4
- data/lib/decidim/assemblies/participatory_space.rb +9 -2
- data/lib/decidim/assemblies/version.rb +1 -1
- metadata +8 -10
- data/app/controllers/concerns/decidim/assemblies/assembly_context.rb +0 -25
- data/app/controllers/concerns/decidim/assemblies/needs_assembly.rb +0 -54
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 36bdde02af4051c46ec0dfe0fa5f01a80bb4c4ee
|
4
|
+
data.tar.gz: a761f3f9f2ec9a17707a5987559ba09ed766e6ad
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 67d0794a61829846d36a3d8fc3c3c5ce11f4acbf8c57f59ea78e90e0263c257eef2bd8c1b75df0e548b20e5b26c7b96535af9f4b053037a0fb597fcdf3fd0d00
|
7
|
+
data.tar.gz: e2c685cf545dd8890512dc11b9c699f9c1e741957844729e00c67cd82f71199e1694c7e121543786b6ae5f642eccd79fc4f080c55b9c1adcce5c489d427cad43
|
@@ -7,7 +7,6 @@ module Decidim
|
|
7
7
|
#
|
8
8
|
class AssembliesController < Decidim::Admin::ApplicationController
|
9
9
|
helper_method :current_assembly
|
10
|
-
|
11
10
|
layout "decidim/admin/assemblies"
|
12
11
|
|
13
12
|
def index
|
@@ -84,12 +83,16 @@ module Decidim
|
|
84
83
|
).first
|
85
84
|
end
|
86
85
|
|
86
|
+
def current_participatory_space
|
87
|
+
current_assembly
|
88
|
+
end
|
89
|
+
|
87
90
|
def collection
|
88
91
|
@collection ||= OrganizationAssemblies.new(current_user.organization).query
|
89
92
|
end
|
90
93
|
|
91
94
|
def ability_context
|
92
|
-
super.merge(
|
95
|
+
super.merge(current_participatory_space: current_assembly)
|
93
96
|
end
|
94
97
|
|
95
98
|
def assembly_params
|
@@ -13,12 +13,22 @@ module Decidim
|
|
13
13
|
extend ActiveSupport::Concern
|
14
14
|
|
15
15
|
included do
|
16
|
-
include
|
17
|
-
|
18
|
-
layout "decidim/admin/assembly"
|
16
|
+
include Decidim::Admin::ParticipatorySpaceAdminContext
|
17
|
+
participatory_space_admin_layout
|
19
18
|
|
19
|
+
helper_method :current_assembly
|
20
20
|
alias_method :current_participatory_space, :current_assembly
|
21
21
|
end
|
22
|
+
|
23
|
+
def current_assembly
|
24
|
+
@current_assembly ||= organization_assemblies.find_by!(
|
25
|
+
slug: params[:assembly_slug] || params[:slug]
|
26
|
+
)
|
27
|
+
end
|
28
|
+
|
29
|
+
def organization_assemblies
|
30
|
+
@organization_assemblies ||= OrganizationAssemblies.new(current_organization).query
|
31
|
+
end
|
22
32
|
end
|
23
33
|
end
|
24
34
|
end
|
@@ -5,9 +5,8 @@ module Decidim
|
|
5
5
|
# A controller that holds the logic to show Assemblies in a
|
6
6
|
# public layout.
|
7
7
|
class AssembliesController < Decidim::ApplicationController
|
8
|
-
|
9
|
-
|
10
|
-
before_action -> { extend NeedsAssembly }, only: [:show]
|
8
|
+
include ParticipatorySpaceContext
|
9
|
+
participatory_space_layout only: :show
|
11
10
|
|
12
11
|
helper Decidim::AttachmentsHelper
|
13
12
|
helper Decidim::IconHelper
|
@@ -22,12 +21,14 @@ module Decidim
|
|
22
21
|
authorize! :read, Assembly
|
23
22
|
end
|
24
23
|
|
25
|
-
def show
|
26
|
-
authorize! :read, current_assembly
|
27
|
-
end
|
24
|
+
def show; end
|
28
25
|
|
29
26
|
private
|
30
27
|
|
28
|
+
def current_participatory_space
|
29
|
+
@current_participatory_space ||= OrganizationAssemblies.new(current_organization).query.find_by(slug: params[:slug])
|
30
|
+
end
|
31
|
+
|
31
32
|
def published_assemblies
|
32
33
|
@published_assemblies ||= OrganizationPublishedAssemblies.new(current_organization)
|
33
34
|
end
|
@@ -43,7 +44,7 @@ module Decidim
|
|
43
44
|
end
|
44
45
|
|
45
46
|
def stats
|
46
|
-
@stats ||= AssemblyStatsPresenter.new(assembly:
|
47
|
+
@stats ||= AssemblyStatsPresenter.new(assembly: current_participatory_space)
|
47
48
|
end
|
48
49
|
end
|
49
50
|
end
|
@@ -1,6 +1,6 @@
|
|
1
1
|
<section class="extended" id="assembly-statistics" class="statistics">
|
2
2
|
<div class="row column">
|
3
|
-
<h4 class="section-heading"><%= t("statistics.headline", scope: "decidim.assemblies", assembly: translated_attribute(
|
3
|
+
<h4 class="section-heading"><%= t("statistics.headline", scope: "decidim.assemblies", assembly: translated_attribute(current_participatory_space.title)) %></h3>
|
4
4
|
</div>
|
5
5
|
<div class="row">
|
6
6
|
<div class="columns small-centered mediumlarge-12 large-12 process_stats">
|
@@ -1,8 +1,8 @@
|
|
1
1
|
<% add_decidim_meta_tags({
|
2
|
-
image_url:
|
3
|
-
description: translated_attribute(
|
4
|
-
title: translated_attribute(
|
5
|
-
url: assembly_url(
|
2
|
+
image_url: current_participatory_space.hero_image.url,
|
3
|
+
description: translated_attribute(current_participatory_space.short_description),
|
4
|
+
title: translated_attribute(current_participatory_space.title),
|
5
|
+
url: assembly_url(current_participatory_space),
|
6
6
|
twitter_handler: current_organization.twitter_handler
|
7
7
|
}) %>
|
8
8
|
|
@@ -11,61 +11,61 @@
|
|
11
11
|
<div class="columns medium-7 mediumlarge-8">
|
12
12
|
<div class="section">
|
13
13
|
<div class="lead">
|
14
|
-
<%= decidim_sanitize translated_attribute(
|
14
|
+
<%= decidim_sanitize translated_attribute(current_participatory_space.short_description) %>
|
15
15
|
</div>
|
16
|
-
<%= decidim_sanitize translated_attribute(
|
16
|
+
<%= decidim_sanitize translated_attribute(current_participatory_space.description) %>
|
17
17
|
</div>
|
18
|
-
<%= attachments_for
|
18
|
+
<%= attachments_for current_participatory_space %>
|
19
19
|
</div>
|
20
20
|
<div class="section columns medium-5 mediumlarge-4 large-3">
|
21
21
|
<div class="card extra definition-data">
|
22
|
-
<% if translated_attribute(
|
22
|
+
<% if translated_attribute(current_participatory_space.meta_scope).present? %>
|
23
23
|
<div class="definition-data__item scope">
|
24
24
|
<span class="definition-data__title"><%= t("assemblies.show.scope", scope: "decidim") %></span>
|
25
|
-
<%= translated_attribute(
|
25
|
+
<%= translated_attribute(current_participatory_space.meta_scope) %>
|
26
26
|
</div>
|
27
27
|
<% end %>
|
28
28
|
|
29
|
-
<% if translated_attribute(
|
29
|
+
<% if translated_attribute(current_participatory_space.developer_group).present? %>
|
30
30
|
<div class="definition-data__item developer-group">
|
31
31
|
<span class="definition-data__title"><%= t("assemblies.show.developer_group", scope: "decidim") %></span>
|
32
|
-
<%= translated_attribute(
|
32
|
+
<%= translated_attribute(current_participatory_space.developer_group) %>
|
33
33
|
</div>
|
34
34
|
<% end %>
|
35
35
|
|
36
|
-
<% if translated_attribute(
|
36
|
+
<% if translated_attribute(current_participatory_space.local_area).present? %>
|
37
37
|
<div class="definition-data__item local_area">
|
38
38
|
<span class="definition-data__title"><%= t("assemblies.show.local_area", scope: "decidim") %></span>
|
39
|
-
<%= translated_attribute(
|
39
|
+
<%= translated_attribute(current_participatory_space.local_area) %>
|
40
40
|
</div>
|
41
41
|
<% end %>
|
42
42
|
|
43
|
-
<% if translated_attribute(
|
43
|
+
<% if translated_attribute(current_participatory_space.target).present? %>
|
44
44
|
<div class="definition-data__item target">
|
45
45
|
<span class="definition-data__title"><%= t("assemblies.show.target", scope: "decidim") %></span>
|
46
|
-
<%= translated_attribute(
|
46
|
+
<%= translated_attribute(current_participatory_space.target) %>
|
47
47
|
</div>
|
48
48
|
<% end %>
|
49
49
|
|
50
|
-
<% if translated_attribute(
|
50
|
+
<% if translated_attribute(current_participatory_space.participatory_scope).present? %>
|
51
51
|
<div class="definition-data__item participatory_scope">
|
52
52
|
<span class="definition-data__title"><%= t("assemblies.show.participatory_scope", scope: "decidim") %></span>
|
53
|
-
<%= translated_attribute(
|
53
|
+
<%= translated_attribute(current_participatory_space.participatory_scope) %>
|
54
54
|
</div>
|
55
55
|
<% end %>
|
56
56
|
|
57
|
-
<% if translated_attribute(
|
57
|
+
<% if translated_attribute(current_participatory_space.participatory_structure).present? %>
|
58
58
|
<div class="definition-data__item participatory_structure">
|
59
59
|
<span class="definition-data__title"><%= t("assemblies.show.participatory_structure", scope: "decidim") %></span>
|
60
|
-
<%= translated_attribute(
|
60
|
+
<%= translated_attribute(current_participatory_space.participatory_structure) %>
|
61
61
|
</div>
|
62
62
|
<% end %>
|
63
63
|
</div>
|
64
64
|
<%= render partial: "decidim/shared/share_modal" %>
|
65
|
-
<%= embed_modal_for assembly_assembly_widget_url(
|
65
|
+
<%= embed_modal_for assembly_assembly_widget_url(current_participatory_space, format: :js) %>
|
66
66
|
</div>
|
67
67
|
</div>
|
68
|
-
<% if
|
68
|
+
<% if current_participatory_space.show_statistics? %>
|
69
69
|
<%= render partial: 'statistics' %>
|
70
70
|
<% end %>
|
71
71
|
</div>
|
@@ -1,27 +1,27 @@
|
|
1
1
|
<div class="process-header row column">
|
2
2
|
<div class="row column process-header__main"
|
3
|
-
style="background-image:url(<%=
|
3
|
+
style="background-image:url(<%= current_participatory_space.banner_image.url %>);">
|
4
4
|
<div class="process-header__container row">
|
5
5
|
<div class="columns mediumlarge-9 process-header__info">
|
6
6
|
<div>
|
7
7
|
<h1 class="text-highlight heading2">
|
8
|
-
<%= translated_attribute(
|
8
|
+
<%= translated_attribute(current_participatory_space.title) %>
|
9
9
|
</h1>
|
10
10
|
</div>
|
11
11
|
<div>
|
12
12
|
<h2 class="text-highlight heading-small">
|
13
|
-
<% if
|
13
|
+
<% if current_participatory_space.hashtag.present? %>
|
14
14
|
<span class="process-header__hashtag">
|
15
|
-
<%= link_to "##{
|
15
|
+
<%= link_to "##{current_participatory_space.hashtag}", "https://twitter.com/hashtag/#{current_participatory_space.hashtag}" %>
|
16
16
|
</span>
|
17
17
|
<% end %>
|
18
|
-
<%= translated_attribute(
|
18
|
+
<%= translated_attribute(current_participatory_space.subtitle) %>
|
19
19
|
</h2>
|
20
20
|
</div>
|
21
21
|
</div>
|
22
22
|
</div>
|
23
23
|
</div>
|
24
|
-
<% if
|
24
|
+
<% if current_participatory_space.features.any? %>
|
25
25
|
<div class="row column">
|
26
26
|
<div class="process-nav">
|
27
27
|
<button class="process-nav__trigger hide-for-medium" data-toggle="process-nav-content">
|
@@ -38,14 +38,14 @@
|
|
38
38
|
</button>
|
39
39
|
<div class="row column process-nav__content is-active" id="process-nav-content" data-toggler=".is-active">
|
40
40
|
<ul>
|
41
|
-
<li class="<%= "is-active" if is_active_link?(decidim_assemblies.assembly_path(
|
42
|
-
<%= active_link_to decidim_assemblies.assembly_path(
|
41
|
+
<li class="<%= "is-active" if is_active_link?(decidim_assemblies.assembly_path(current_participatory_space), :exclusive) %>">
|
42
|
+
<%= active_link_to decidim_assemblies.assembly_path(current_participatory_space), active: :exclusive, class: "process-nav__link", class_active: "is-active" do %>
|
43
43
|
<%= external_icon "decidim/assemblies/assembly.svg" %>
|
44
44
|
<%= t ".assembly_menu_item" %>
|
45
45
|
<% end %>
|
46
46
|
</li>
|
47
47
|
|
48
|
-
<%
|
48
|
+
<% current_participatory_space.features.each do |feature| %>
|
49
49
|
<% if feature.published? || feature == self.try(:current_feature) %>
|
50
50
|
<li class="<%= "is-active" if is_active_link?(main_feature_path(feature), :inclusive) %>">
|
51
51
|
<%= active_link_to main_feature_path(feature), class: "process-nav__link", active: :inclusive, class_active: "is-active" do %>
|
@@ -1,8 +1,8 @@
|
|
1
1
|
<% add_decidim_page_title(translated_attribute(current_feature.name)) if try(:current_feature) %>
|
2
|
-
<% add_decidim_page_title(translated_attribute(
|
2
|
+
<% add_decidim_page_title(translated_attribute(current_participatory_space.title)) %>
|
3
3
|
<% add_decidim_meta_tags(
|
4
|
-
image_url:
|
5
|
-
description: translated_attribute(
|
4
|
+
image_url: current_participatory_space.banner_image.url,
|
5
|
+
description: translated_attribute(current_participatory_space.short_description),
|
6
6
|
) %>
|
7
7
|
|
8
8
|
<%= render "layouts/decidim/application" do %>
|
@@ -23,4 +23,4 @@
|
|
23
23
|
<%= render "layouts/decidim/feature_authorization_modals" %>
|
24
24
|
<% end %>
|
25
25
|
|
26
|
-
<% provide :meta_image_url,
|
26
|
+
<% provide :meta_image_url, current_participatory_space.banner_image.url %>
|
@@ -1,11 +1,18 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
3
|
Decidim.register_participatory_space(:assemblies) do |participatory_space|
|
4
|
-
participatory_space.engine = Decidim::Assemblies::Engine
|
5
|
-
participatory_space.admin_engine = Decidim::Assemblies::AdminEngine
|
6
4
|
participatory_space.icon = "decidim/assemblies/icon.svg"
|
7
5
|
participatory_space.model_class_name = "Decidim::Assembly"
|
8
6
|
|
7
|
+
participatory_space.context(:public) do |context|
|
8
|
+
context.engine = Decidim::Assemblies::Engine
|
9
|
+
context.layout = "layouts/decidim/assembly"
|
10
|
+
end
|
11
|
+
|
12
|
+
participatory_space.context(:admin) do |context|
|
13
|
+
context.engine = Decidim::Assemblies::AdminEngine
|
14
|
+
end
|
15
|
+
|
9
16
|
participatory_space.seeds do
|
10
17
|
organization = Decidim::Organization.first
|
11
18
|
seeds_root = File.join(__dir__, "..", "..", "..", "db", "seeds")
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: decidim-assemblies
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.8.
|
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:
|
13
|
+
date: 2018-01-16 00:00:00.000000000 Z
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
16
16
|
name: decidim-core
|
@@ -18,42 +18,42 @@ dependencies:
|
|
18
18
|
requirements:
|
19
19
|
- - '='
|
20
20
|
- !ruby/object:Gem::Version
|
21
|
-
version: 0.8.
|
21
|
+
version: 0.8.4
|
22
22
|
type: :runtime
|
23
23
|
prerelease: false
|
24
24
|
version_requirements: !ruby/object:Gem::Requirement
|
25
25
|
requirements:
|
26
26
|
- - '='
|
27
27
|
- !ruby/object:Gem::Version
|
28
|
-
version: 0.8.
|
28
|
+
version: 0.8.4
|
29
29
|
- !ruby/object:Gem::Dependency
|
30
30
|
name: decidim-admin
|
31
31
|
requirement: !ruby/object:Gem::Requirement
|
32
32
|
requirements:
|
33
33
|
- - '='
|
34
34
|
- !ruby/object:Gem::Version
|
35
|
-
version: 0.8.
|
35
|
+
version: 0.8.4
|
36
36
|
type: :development
|
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.
|
42
|
+
version: 0.8.4
|
43
43
|
- !ruby/object:Gem::Dependency
|
44
44
|
name: decidim-dev
|
45
45
|
requirement: !ruby/object:Gem::Requirement
|
46
46
|
requirements:
|
47
47
|
- - '='
|
48
48
|
- !ruby/object:Gem::Version
|
49
|
-
version: 0.8.
|
49
|
+
version: 0.8.4
|
50
50
|
type: :development
|
51
51
|
prerelease: false
|
52
52
|
version_requirements: !ruby/object:Gem::Requirement
|
53
53
|
requirements:
|
54
54
|
- - '='
|
55
55
|
- !ruby/object:Gem::Version
|
56
|
-
version: 0.8.
|
56
|
+
version: 0.8.4
|
57
57
|
description: Assemblies plugin for decidim
|
58
58
|
email:
|
59
59
|
- josepjaume@gmail.com
|
@@ -77,8 +77,6 @@ files:
|
|
77
77
|
- app/constraints/decidim/assemblies/current_assembly.rb
|
78
78
|
- app/constraints/decidim/assemblies/current_feature.rb
|
79
79
|
- app/controllers/concerns/decidim/assemblies/admin/assembly_context.rb
|
80
|
-
- app/controllers/concerns/decidim/assemblies/assembly_context.rb
|
81
|
-
- app/controllers/concerns/decidim/assemblies/needs_assembly.rb
|
82
80
|
- app/controllers/decidim/assemblies/admin/application_controller.rb
|
83
81
|
- app/controllers/decidim/assemblies/admin/assemblies_controller.rb
|
84
82
|
- app/controllers/decidim/assemblies/admin/assembly_attachments_controller.rb
|
@@ -1,25 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
module Decidim
|
4
|
-
module Assemblies
|
5
|
-
# This module, when injected into a controller, ensures there's a
|
6
|
-
# Assembly available and deducts it from the context.
|
7
|
-
module AssemblyContext
|
8
|
-
def self.extended(base)
|
9
|
-
base.class_eval do
|
10
|
-
include NeedsAssembly
|
11
|
-
|
12
|
-
layout "layouts/decidim/assembly"
|
13
|
-
|
14
|
-
before_action do
|
15
|
-
authorize! :read, current_assembly
|
16
|
-
end
|
17
|
-
end
|
18
|
-
end
|
19
|
-
|
20
|
-
def ability_context
|
21
|
-
super.merge(current_assembly: current_assembly)
|
22
|
-
end
|
23
|
-
end
|
24
|
-
end
|
25
|
-
end
|
@@ -1,54 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
module Decidim
|
4
|
-
module Assemblies
|
5
|
-
# This module, when injected into a controller, ensures there's a
|
6
|
-
# Assembly available and deducts it from the context.
|
7
|
-
module NeedsAssembly
|
8
|
-
def self.enhance_controller(instance_or_module)
|
9
|
-
instance_or_module.class_eval do
|
10
|
-
helper_method :current_assembly
|
11
|
-
end
|
12
|
-
end
|
13
|
-
|
14
|
-
def self.extended(base)
|
15
|
-
base.extend Decidim::NeedsOrganization, InstanceMethods
|
16
|
-
|
17
|
-
enhance_controller(base)
|
18
|
-
end
|
19
|
-
|
20
|
-
def self.included(base)
|
21
|
-
base.include Decidim::NeedsOrganization, InstanceMethods
|
22
|
-
|
23
|
-
enhance_controller(base)
|
24
|
-
end
|
25
|
-
|
26
|
-
module InstanceMethods
|
27
|
-
# Public: Finds the current Assembly given this controller's
|
28
|
-
# context.
|
29
|
-
#
|
30
|
-
# Returns the current Assembly.
|
31
|
-
def current_assembly
|
32
|
-
@current_assembly ||= detect_assembly
|
33
|
-
end
|
34
|
-
|
35
|
-
alias current_participatory_space current_assembly
|
36
|
-
|
37
|
-
private
|
38
|
-
|
39
|
-
def ability_context
|
40
|
-
super.merge(current_assembly: current_assembly)
|
41
|
-
end
|
42
|
-
|
43
|
-
def detect_assembly
|
44
|
-
request.env["current_assembly"] ||
|
45
|
-
organization_assemblies.find_by!(slug: params[:assembly_slug] || params[:slug])
|
46
|
-
end
|
47
|
-
|
48
|
-
def organization_assemblies
|
49
|
-
@organization_assemblies ||= OrganizationAssemblies.new(current_organization).query
|
50
|
-
end
|
51
|
-
end
|
52
|
-
end
|
53
|
-
end
|
54
|
-
end
|