decidim-participatory_processes 0.8.3 → 0.8.4

Sign up to get free protection for your applications and to get access to all the features.
Files changed (20) hide show
  1. checksums.yaml +4 -4
  2. data/app/controllers/decidim/participatory_processes/admin/concerns/participatory_process_admin.rb +12 -3
  3. data/app/controllers/decidim/participatory_processes/admin/participatory_processes_controller.rb +8 -1
  4. data/app/controllers/decidim/participatory_processes/participatory_process_steps_controller.rb +12 -7
  5. data/app/controllers/decidim/participatory_processes/participatory_processes_controller.rb +12 -7
  6. data/app/helpers/decidim/participatory_processes/participatory_process_helper.rb +1 -1
  7. data/app/views/decidim/participatory_process_steps/_participatory_process_step.html.erb +1 -1
  8. data/app/views/decidim/participatory_processes/participatory_process_steps/_timeline.html.erb +1 -1
  9. data/app/views/decidim/participatory_processes/participatory_processes/_statistics.html.erb +1 -1
  10. data/app/views/decidim/participatory_processes/participatory_processes/show.html.erb +27 -27
  11. data/app/views/layouts/decidim/_process_header.html.erb +10 -10
  12. data/app/views/layouts/decidim/_process_header_steps.html.erb +3 -3
  13. data/app/views/layouts/decidim/admin/participatory_process.html.erb +18 -18
  14. data/app/views/layouts/decidim/participatory_process.html.erb +4 -4
  15. data/lib/decidim/participatory_processes/participatory_space.rb +11 -2
  16. data/lib/decidim/participatory_processes/version.rb +1 -1
  17. metadata +8 -11
  18. data/app/controllers/concerns/decidim/participatory_processes/admin/participatory_process_context.rb +0 -21
  19. data/app/controllers/concerns/decidim/participatory_processes/needs_participatory_process.rb +0 -54
  20. data/app/controllers/concerns/decidim/participatory_processes/participatory_process_context.rb +0 -27
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: cbe2a58eda97cb9b19d2401bea9c6901760d0df4
4
- data.tar.gz: 3ee35753bce801e43fb470316d74350e60dcfd48
3
+ metadata.gz: 8c445e5c40610e2abaa330924ed46b5b5ebeb46a
4
+ data.tar.gz: 51ae4c255237951f19d1a0456361a594d5e5cb2c
5
5
  SHA512:
6
- metadata.gz: c1d9d9f4d256aecac593dde0084f088fd06c5c8437a6fbdbb762c1fff07d4cc785f2e10348dedf2a769d65b75b5d96e7f42a84aaf3c4c00b1339ca60b3e34799
7
- data.tar.gz: 1a1d842893e8b0059cc55b3a045a59bca005a65b73b64a03800191b3531072256f6d9fe7b5d305e8ee7ac1e3eadc209fc31b83734843664b2e01d904e75528de
6
+ metadata.gz: 3d0e2181a9bc060dc94889101958b00c82d904ba29404972e4b54e5039387a9c6a605168ce7cd2f784be63f951191043a64ef6eb90c9bfcfa37fc3d9e7ca4a5c
7
+ data.tar.gz: 36632affaef3539c1a99d1d135ca0a0eebec4336447ed9aa4009f88fbcf322088f4cc571bc9f2bc3fa1029a6ed8f48acf1c5e4782935e7171587bbd15e12dec4
@@ -13,11 +13,20 @@ module Decidim
13
13
  extend ActiveSupport::Concern
14
14
 
15
15
  included do
16
- include NeedsParticipatoryProcess
16
+ include Decidim::Admin::ParticipatorySpaceAdminContext
17
+ helper_method :current_participatory_process
18
+ participatory_space_admin_layout
17
19
 
18
- layout "decidim/admin/participatory_process"
20
+ def organization_processes
21
+ @organization_processes ||= OrganizationParticipatoryProcesses.new(current_organization).query
22
+ end
19
23
 
20
- alias_method :current_participatory_space, :current_participatory_process
24
+ def current_participatory_space
25
+ request.env["current_participatory_space"] ||
26
+ organization_processes.find_by!(slug: params[:participatory_process_slug] || params[:slug])
27
+ end
28
+
29
+ alias_method :current_participatory_process, :current_participatory_space
21
30
  end
22
31
  end
23
32
  end
@@ -6,6 +6,9 @@ module Decidim
6
6
  # Controller that allows managing participatory processes.
7
7
  #
8
8
  class ParticipatoryProcessesController < Decidim::Admin::ApplicationController
9
+ include Decidim::Admin::ParticipatorySpaceAdminContext
10
+ participatory_space_admin_layout only: [:edit]
11
+
9
12
  helper ProcessGroupsForSelectHelper
10
13
 
11
14
  helper_method :current_participatory_process
@@ -80,6 +83,10 @@ module Decidim
80
83
 
81
84
  private
82
85
 
86
+ def current_participatory_space
87
+ current_participatory_process
88
+ end
89
+
83
90
  def current_participatory_process
84
91
  @current_participatory_process ||= collection.where(slug: params[:slug]).or(
85
92
  collection.where(id: params[:slug])
@@ -91,7 +98,7 @@ module Decidim
91
98
  end
92
99
 
93
100
  def ability_context
94
- super.merge(current_participatory_process: current_participatory_process)
101
+ super.merge(current_participatory_space: current_participatory_process)
95
102
  end
96
103
 
97
104
  def participatory_process_params
@@ -5,15 +5,20 @@ module Decidim
5
5
  # A controller that holds the logic to show ParticipatoryProcessSteps in a
6
6
  # public layout.
7
7
  class ParticipatoryProcessStepsController < Decidim::ApplicationController
8
- helper_method :participatory_process, :current_participatory_process
9
- layout "layouts/decidim/participatory_process", only: [:index]
10
- include NeedsParticipatoryProcess
11
-
12
- helper ParticipatoryProcessHelper
13
- helper Decidim::IconHelper
8
+ include ParticipatorySpaceContext
9
+ participatory_space_layout only: :index
14
10
 
15
11
  def index
16
- authorize! :read, ParticipatoryProcess
12
+ end
13
+
14
+ private
15
+
16
+ def organization_participatory_processes
17
+ @organization_participatory_processes ||= OrganizationParticipatoryProcesses.new(current_organization).query
18
+ end
19
+
20
+ def current_participatory_space
21
+ @current_participatory_space ||= organization_participatory_processes.find_by(slug: params[:participatory_process_slug])
17
22
  end
18
23
  end
19
24
  end
@@ -5,9 +5,8 @@ module Decidim
5
5
  # A controller that holds the logic to show ParticipatoryProcesses in a
6
6
  # public layout.
7
7
  class ParticipatoryProcessesController < Decidim::ApplicationController
8
- layout "layouts/decidim/participatory_process", only: [:show]
9
-
10
- before_action -> { extend NeedsParticipatoryProcess }, only: [:show]
8
+ include ParticipatorySpaceContext
9
+ participatory_space_layout only: :show
11
10
 
12
11
  helper Decidim::AttachmentsHelper
13
12
  helper Decidim::IconHelper
@@ -25,12 +24,18 @@ module Decidim
25
24
  authorize! :read, ParticipatoryProcessGroup
26
25
  end
27
26
 
28
- def show
29
- authorize! :read, current_participatory_process
30
- end
27
+ def show; end
31
28
 
32
29
  private
33
30
 
31
+ def organization_participatory_processes
32
+ @organization_participatory_processes ||= OrganizationParticipatoryProcesses.new(current_organization).query
33
+ end
34
+
35
+ def current_participatory_space
36
+ @current_participatory_space ||= organization_participatory_processes.find_by(slug: params[:slug])
37
+ end
38
+
34
39
  def published_processes
35
40
  @published_processes ||= OrganizationPublishedParticipatoryProcesses.new(current_organization)
36
41
  end
@@ -56,7 +61,7 @@ module Decidim
56
61
  end
57
62
 
58
63
  def stats
59
- @stats ||= ParticipatoryProcessStatsPresenter.new(participatory_process: current_participatory_process)
64
+ @stats ||= ParticipatoryProcessStatsPresenter.new(participatory_process: current_participatory_space)
60
65
  end
61
66
 
62
67
  def filter
@@ -10,7 +10,7 @@ module Decidim
10
10
  # participatory_process_step - The step to format to
11
11
  #
12
12
  # Returns a String with the formatted dates.
13
- def participatory_process_step_dates(participatory_process_step)
13
+ def step_dates(participatory_process_step)
14
14
  dates = [participatory_process_step.start_date, participatory_process_step.end_date]
15
15
  dates.map { |date| date ? localize(date.to_date, format: :default) : "?" }.join(" - ")
16
16
  end
@@ -5,7 +5,7 @@
5
5
  <div class="timeline__info">
6
6
  <div class="timeline__header">
7
7
  <span class="timeline__date text-small">
8
- <%= participatory_process_step_dates(participatory_process_step) %>
8
+ <%= participatory_space_helpers.step_dates(participatory_process_step) %>
9
9
  </span>
10
10
  <h6 class="timeline__title heading6"><%= translated_attribute(participatory_process_step.title) %></h6>
11
11
  </div>
@@ -1,6 +1,6 @@
1
1
  <ol class="timeline">
2
2
  <% past_step = true %>
3
- <% current_participatory_process.steps.each do |step| %>
3
+ <% current_participatory_space.steps.each do |step| %>
4
4
  <%= render step, step_status_class: step_class(step, past_step) %>
5
5
  <% past_step = false if step.active? %>
6
6
  <% end %>
@@ -1,6 +1,6 @@
1
1
  <section class="extended" id="participatory_process-statistics" class="statistics">
2
2
  <div class="row column">
3
- <h4 class="section-heading"><%= t("statistics.headline", scope: "decidim.participatory_processes", participatory_process: translated_attribute(current_participatory_process.title)) %></h3>
3
+ <h4 class="section-heading"><%= t("statistics.headline", scope: "decidim.participatory_processes", participatory_process: 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,13 +1,13 @@
1
1
  <% add_decidim_meta_tags({
2
- image_url: current_participatory_process.hero_image.url,
3
- description: translated_attribute(current_participatory_process.short_description),
4
- title: translated_attribute(current_participatory_process.title),
5
- url: participatory_process_url(current_participatory_process),
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: participatory_process_url(current_participatory_space),
6
6
  twitter_handler: current_organization.twitter_handler
7
7
  }) %>
8
8
 
9
- <% if translated_attribute(current_participatory_process.announcement).present? %>
10
- <%= render partial: "decidim/shared/announcement", locals: { announcement: current_participatory_process.announcement } %>
9
+ <% if translated_attribute(current_participatory_space.announcement).present? %>
10
+ <%= render partial: "decidim/shared/announcement", locals: { announcement: current_participatory_space.announcement } %>
11
11
  <% end %>
12
12
 
13
13
  <div class="row column">
@@ -15,75 +15,75 @@
15
15
  <div class="columns medium-7 mediumlarge-8">
16
16
  <div class="section">
17
17
  <div class="lead">
18
- <%= decidim_sanitize translated_attribute(current_participatory_process.short_description) %>
18
+ <%= decidim_sanitize translated_attribute(current_participatory_space.short_description) %>
19
19
  </div>
20
- <%= decidim_sanitize translated_attribute(current_participatory_process.description) %>
20
+ <%= decidim_sanitize translated_attribute(current_participatory_space.description) %>
21
21
  </div>
22
- <%= attachments_for current_participatory_process %>
22
+ <%= attachments_for current_participatory_space %>
23
23
  </div>
24
24
  <div class="section columns medium-5 mediumlarge-4 large-3">
25
25
  <div class="card extra definition-data">
26
- <% if translated_attribute(current_participatory_process.participatory_scope).present? %>
26
+ <% if translated_attribute(current_participatory_space.participatory_scope).present? %>
27
27
  <div class="definition-data__item participatory_scope">
28
28
  <span class="definition-data__title"><%= t("participatory_processes.show.participatory_scope", scope: "decidim") %></span>
29
- <%= translated_attribute(current_participatory_process.participatory_scope) %>
29
+ <%= translated_attribute(current_participatory_space.participatory_scope) %>
30
30
  </div>
31
31
  <% end %>
32
32
 
33
- <% if translated_attribute(current_participatory_process.target).present? %>
33
+ <% if translated_attribute(current_participatory_space.target).present? %>
34
34
  <div class="definition-data__item target">
35
35
  <span class="definition-data__title"><%= t("participatory_processes.show.target", scope: "decidim") %></span>
36
- <%= translated_attribute(current_participatory_process.target) %>
36
+ <%= translated_attribute(current_participatory_space.target) %>
37
37
  </div>
38
38
  <% end %>
39
39
 
40
- <% if translated_attribute(current_participatory_process.participatory_structure).present? %>
40
+ <% if translated_attribute(current_participatory_space.participatory_structure).present? %>
41
41
  <div class="definition-data__item participatory_structure">
42
42
  <span class="definition-data__title"><%= t("participatory_processes.show.participatory_structure", scope: "decidim") %></span>
43
- <%= translated_attribute(current_participatory_process.participatory_structure) %>
43
+ <%= translated_attribute(current_participatory_space.participatory_structure) %>
44
44
  </div>
45
45
  <% end %>
46
46
 
47
- <% if translated_attribute(current_participatory_process.meta_scope).present? %>
47
+ <% if translated_attribute(current_participatory_space.meta_scope).present? %>
48
48
  <div class="definition-data__item scope">
49
49
  <span class="definition-data__title"><%= t("participatory_processes.show.scope", scope: "decidim") %></span>
50
- <%= translated_attribute(current_participatory_process.meta_scope) %>
50
+ <%= translated_attribute(current_participatory_space.meta_scope) %>
51
51
  </div>
52
52
  <% end %>
53
53
 
54
- <% if translated_attribute(current_participatory_process.local_area).present? %>
54
+ <% if translated_attribute(current_participatory_space.local_area).present? %>
55
55
  <div class="definition-data__item local_area">
56
56
  <span class="definition-data__title"><%= t("participatory_processes.show.local_area", scope: "decidim") %></span>
57
- <%= translated_attribute(current_participatory_process.local_area) %>
57
+ <%= translated_attribute(current_participatory_space.local_area) %>
58
58
  </div>
59
59
  <% end %>
60
60
 
61
- <% if translated_attribute(current_participatory_process.developer_group).present? %>
61
+ <% if translated_attribute(current_participatory_space.developer_group).present? %>
62
62
  <div class="definition-data__item developer-group">
63
63
  <span class="definition-data__title"><%= t("participatory_processes.show.developer_group", scope: "decidim") %></span>
64
- <%= translated_attribute(current_participatory_process.developer_group) %>
64
+ <%= translated_attribute(current_participatory_space.developer_group) %>
65
65
  </div>
66
66
  <% end %>
67
67
 
68
- <% if current_participatory_process.start_date.present? %>
68
+ <% if current_participatory_space.start_date.present? %>
69
69
  <div class="definition-data__item start-date">
70
70
  <span class="definition-data__title"><%= t("participatory_processes.show.start_date", scope: "decidim") %></span>
71
- <%== l(current_participatory_process.start_date, format: :long) %>
71
+ <%== l(current_participatory_space.start_date, format: :long) %>
72
72
  </div>
73
73
  <% end %>
74
74
 
75
- <% if current_participatory_process.end_date.present? %>
75
+ <% if current_participatory_space.end_date.present? %>
76
76
  <div class="definition-data__item end-date">
77
77
  <span class="definition-data__title"><%= t("participatory_processes.show.end_date", scope: "decidim") %></span>
78
- <%== l(current_participatory_process.end_date, format: :long) %>
78
+ <%== l(current_participatory_space.end_date, format: :long) %>
79
79
  </div>
80
80
  <% end %>
81
81
  </div>
82
82
  <%= render partial: "decidim/shared/share_modal" %>
83
- <%= embed_modal_for participatory_process_participatory_process_widget_url(current_participatory_process, format: :js) %>
83
+ <%= embed_modal_for participatory_process_participatory_process_widget_url(current_participatory_space, format: :js) %>
84
84
  </div>
85
85
  </div>
86
- <% if current_participatory_process.show_statistics? %>
86
+ <% if current_participatory_space.show_statistics? %>
87
87
  <%= render partial: 'statistics' %>
88
88
  <% end %>
89
89
  </div>
@@ -1,28 +1,28 @@
1
1
  <div class="process-header row column">
2
2
  <div class="row column process-header__main"
3
- style="background-image:url(<%= current_participatory_process.banner_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(current_participatory_process.title) %>
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 current_participatory_process.hashtag.present? %>
13
+ <% if current_participatory_space.hashtag.present? %>
14
14
  <span class="process-header__hashtag">
15
- <%= link_to "##{current_participatory_process.hashtag}", "https://twitter.com/hashtag/#{current_participatory_process.hashtag}" %>
15
+ <%= link_to "##{current_participatory_space.hashtag}", "https://twitter.com/hashtag/#{current_participatory_space.hashtag}" %>
16
16
  </span>
17
17
  <% end %>
18
- <%= translated_attribute(current_participatory_process.subtitle) %>
18
+ <%= translated_attribute(current_participatory_space.subtitle) %>
19
19
  </h2>
20
20
  </div>
21
21
  </div>
22
- <%= render partial: "layouts/decidim/process_header_steps", locals: { participatory_process: current_participatory_process } %>
22
+ <%= render partial: "layouts/decidim/process_header_steps", locals: { participatory_process: current_participatory_space } %>
23
23
  </div>
24
24
  </div>
25
- <% if current_participatory_process.features.any? %>
25
+ <% if current_participatory_space.features.any? %>
26
26
  <div class="row column">
27
27
  <div class="process-nav">
28
28
  <button class="process-nav__trigger hide-for-medium" data-toggle="process-nav-content">
@@ -39,14 +39,14 @@
39
39
  </button>
40
40
  <div class="row column process-nav__content is-active" id="process-nav-content" data-toggler=".is-active">
41
41
  <ul>
42
- <li class="<%= "is-active" if is_active_link?(decidim_participatory_processes.participatory_process_path(current_participatory_process), :exclusive) %>">
43
- <%= active_link_to decidim_participatory_processes.participatory_process_path(current_participatory_process), active: :exclusive, class: "process-nav__link", class_active: "is-active" do %>
42
+ <li class="<%= "is-active" if is_active_link?(decidim_participatory_processes.participatory_process_path(current_participatory_space), :exclusive) %>">
43
+ <%= active_link_to decidim_participatory_processes.participatory_process_path(current_participatory_space), active: :exclusive, class: "process-nav__link", class_active: "is-active" do %>
44
44
  <%= external_icon "decidim/participatory_processes/process.svg" %>
45
45
  <%= t ".process_menu_item" %>
46
46
  <% end %>
47
47
  </li>
48
48
 
49
- <% current_participatory_process.features.each do |feature| %>
49
+ <% current_participatory_space.features.each do |feature| %>
50
50
  <% if feature.published? || feature == self.try(:current_feature) %>
51
51
  <li class="<%= "is-active" if is_active_link?(main_feature_path(feature), :inclusive) %>">
52
52
  <%= active_link_to main_feature_path(feature), class: "process-nav__link", active: :inclusive, class_active: "is-active" do %>
@@ -13,15 +13,15 @@
13
13
  <% past_step = false if step.active? %>
14
14
  <% end %>
15
15
  </ol>
16
- <span class="phase-current"><%= t(".step", current: (participatory_process.active_step.position + 1), total: current_participatory_process.steps.count) %></span>
16
+ <span class="phase-current"><%= t(".step", current: (participatory_process.active_step.position + 1), total: current_participatory_space.steps.count) %></span>
17
17
  </div>
18
18
  <div>
19
19
  <span class="phase-title"><%= translated_attribute participatory_process.active_step.title %></span>
20
20
  <span class="phase-date">
21
- <%= participatory_process_step_dates participatory_process.active_step %>
21
+ <%= participatory_space_helpers.step_dates participatory_process.active_step %>
22
22
  </span>
23
23
  </div>
24
- <%= link_to t('.view_steps'), decidim_participatory_processes.participatory_process_participatory_process_steps_path(current_participatory_process), class: "button tiny hollow" %>
24
+ <%= link_to t('.view_steps'), decidim_participatory_processes.participatory_process_participatory_process_steps_path(current_participatory_space), class: "button tiny hollow" %>
25
25
  </div>
26
26
  </div>
27
27
  <% end %>
@@ -1,23 +1,23 @@
1
1
  <% content_for :secondary_nav do %>
2
2
  <div class="secondary-nav secondary-nav--subnav">
3
3
  <ul>
4
- <% if can? :update, current_participatory_process %>
5
- <li <% if is_active_link?(decidim_admin_participatory_processes.edit_participatory_process_path(current_participatory_process)) %> class="is-active" <% end %>>
6
- <%= aria_selected_link_to t("info", scope: "decidim.admin.menu.participatory_processes_submenu"), decidim_admin_participatory_processes.edit_participatory_process_path(current_participatory_process) %>
4
+ <% if can? :update, current_participatory_space %>
5
+ <li <% if is_active_link?(decidim_admin_participatory_processes.edit_participatory_process_path(current_participatory_space)) %> class="is-active" <% end %>>
6
+ <%= aria_selected_link_to t("info", scope: "decidim.admin.menu.participatory_processes_submenu"), decidim_admin_participatory_processes.edit_participatory_process_path(current_participatory_space) %>
7
7
  </li>
8
8
  <% end %>
9
9
  <% if can? :read, Decidim::ParticipatoryProcessStep %>
10
- <li <% if is_active_link?(decidim_admin_participatory_processes.participatory_process_steps_path(current_participatory_process)) %> class="is-active" <% end %>>
11
- <%= aria_selected_link_to t("steps", scope: "decidim.admin.menu.participatory_processes_submenu"), decidim_admin_participatory_processes.participatory_process_steps_path(current_participatory_process) %>
10
+ <li <% if is_active_link?(decidim_admin_participatory_processes.participatory_process_steps_path(current_participatory_space)) %> class="is-active" <% end %>>
11
+ <%= aria_selected_link_to t("steps", scope: "decidim.admin.menu.participatory_processes_submenu"), decidim_admin_participatory_processes.participatory_process_steps_path(current_participatory_space) %>
12
12
  </li>
13
13
  <% end %>
14
14
  <% if can? :read, Decidim::Feature %>
15
- <li <% if is_active_link?(decidim_admin_participatory_processes.features_path(current_participatory_process)) %> class="is-active" <% end %>>
16
- <%= aria_selected_link_to t("features", scope: "decidim.admin.menu.participatory_processes_submenu"), decidim_admin_participatory_processes.features_path(current_participatory_process) %>
15
+ <li <% if is_active_link?(decidim_admin_participatory_processes.features_path(current_participatory_space)) %> class="is-active" <% end %>>
16
+ <%= aria_selected_link_to t("features", scope: "decidim.admin.menu.participatory_processes_submenu"), decidim_admin_participatory_processes.features_path(current_participatory_space) %>
17
17
  <ul>
18
- <% current_participatory_process.features.each do |feature| %>
18
+ <% current_participatory_space.features.each do |feature| %>
19
19
  <% if feature.manifest.admin_engine %>
20
- <li <% if is_active_link?(manage_feature_path(feature)) || is_active_link?(decidim_admin_participatory_processes.edit_feature_path(current_participatory_process, feature)) || is_active_link?(decidim_admin_participatory_processes.edit_feature_permissions_path(current_participatory_process, feature)) %> class="is-active" <% end %>>
20
+ <li <% if is_active_link?(manage_feature_path(feature)) || is_active_link?(decidim_admin_participatory_processes.edit_feature_path(current_participatory_space, feature)) || is_active_link?(decidim_admin_participatory_processes.edit_feature_permissions_path(current_participatory_space, feature)) %> class="is-active" <% end %>>
21
21
  <%= link_to manage_feature_path(feature) do %>
22
22
  <%= translated_attribute feature.name %>
23
23
  <% if feature.primary_stat.present? %>
@@ -31,23 +31,23 @@
31
31
  </li>
32
32
  <% end %>
33
33
  <% if can? :read, Decidim::Category %>
34
- <li <% if is_active_link?(decidim_admin_participatory_processes.categories_path(current_participatory_process)) %> class="is-active" <% end %>>
35
- <%= aria_selected_link_to t("categories", scope: "decidim.admin.menu.participatory_processes_submenu"), decidim_admin_participatory_processes.categories_path(current_participatory_process) %>
34
+ <li <% if is_active_link?(decidim_admin_participatory_processes.categories_path(current_participatory_space)) %> class="is-active" <% end %>>
35
+ <%= aria_selected_link_to t("categories", scope: "decidim.admin.menu.participatory_processes_submenu"), decidim_admin_participatory_processes.categories_path(current_participatory_space) %>
36
36
  </li>
37
37
  <% end %>
38
38
  <% if can? :read, Decidim::Attachment %>
39
- <li <% if is_active_link?(decidim_admin_participatory_processes.participatory_process_attachments_path(current_participatory_process)) %> class="is-active" <% end %>>
40
- <%= aria_selected_link_to t("attachments", scope: "decidim.admin.menu.participatory_processes_submenu"), decidim_admin_participatory_processes.participatory_process_attachments_path(current_participatory_process) %>
39
+ <li <% if is_active_link?(decidim_admin_participatory_processes.participatory_process_attachments_path(current_participatory_space)) %> class="is-active" <% end %>>
40
+ <%= aria_selected_link_to t("attachments", scope: "decidim.admin.menu.participatory_processes_submenu"), decidim_admin_participatory_processes.participatory_process_attachments_path(current_participatory_space) %>
41
41
  </li>
42
42
  <% end %>
43
43
  <% if can? :read, Decidim::ParticipatoryProcessUserRole %>
44
- <li <% if is_active_link?(decidim_admin_participatory_processes.participatory_process_user_roles_path(current_participatory_process)) %> class="is-active" <% end %>>
45
- <%= aria_selected_link_to t("process_admins", scope: "decidim.admin.menu.participatory_processes_submenu"), decidim_admin_participatory_processes.participatory_process_user_roles_path(current_participatory_process) %>
44
+ <li <% if is_active_link?(decidim_admin_participatory_processes.participatory_process_user_roles_path(current_participatory_space)) %> class="is-active" <% end %>>
45
+ <%= aria_selected_link_to t("process_admins", scope: "decidim.admin.menu.participatory_processes_submenu"), decidim_admin_participatory_processes.participatory_process_user_roles_path(current_participatory_space) %>
46
46
  </li>
47
47
  <% end %>
48
48
  <% if can? :read, Decidim::Moderation %>
49
- <li <% if is_active_link?(decidim_admin_participatory_processes.moderations_path(current_participatory_process)) %> class="is-active" <% end %>>
50
- <%= aria_selected_link_to t("moderations", scope: "decidim.admin.menu.participatory_processes_submenu"), decidim_admin_participatory_processes.moderations_path(current_participatory_process) %>
49
+ <li <% if is_active_link?(decidim_admin_participatory_processes.moderations_path(current_participatory_space)) %> class="is-active" <% end %>>
50
+ <%= aria_selected_link_to t("moderations", scope: "decidim.admin.menu.participatory_processes_submenu"), decidim_admin_participatory_processes.moderations_path(current_participatory_space) %>
51
51
  </li>
52
52
  <% end %>
53
53
  </ul>
@@ -57,7 +57,7 @@
57
57
  <%= render "layouts/decidim/admin/application" do %>
58
58
  <div class="process-title">
59
59
  <div class="process-title-content">
60
- <%= translated_attribute(current_participatory_process.title) %>
60
+ <%= translated_attribute(current_participatory_space.title) %>
61
61
  </div>
62
62
  </div>
63
63
  <%= yield %>
@@ -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(current_participatory_process.title)) %>
2
+ <% add_decidim_page_title(translated_attribute(current_participatory_space.title)) %>
3
3
  <% add_decidim_meta_tags(
4
- image_url: current_participatory_process.banner_image.url,
5
- description: translated_attribute(current_participatory_process.short_description),
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, current_participatory_process.banner_image.url %>
26
+ <% provide :meta_image_url, current_participatory_space.banner_image.url %>
@@ -1,11 +1,20 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  Decidim.register_participatory_space(:participatory_processes) do |participatory_space|
4
- participatory_space.engine = Decidim::ParticipatoryProcesses::Engine
5
- participatory_space.admin_engine = Decidim::ParticipatoryProcesses::AdminEngine
6
4
  participatory_space.icon = "decidim/participatory_processes/icon.svg"
7
5
  participatory_space.model_class_name = "Decidim::ParticipatoryProcess"
8
6
 
7
+ participatory_space.context(:public) do |context|
8
+ context.engine = Decidim::ParticipatoryProcesses::Engine
9
+ context.layout = "layouts/decidim/participatory_process"
10
+ context.helper = "Decidim::ParticipatoryProcesses::ParticipatoryProcessHelper"
11
+ end
12
+
13
+ participatory_space.context(:admin) do |context|
14
+ context.engine = Decidim::ParticipatoryProcesses::AdminEngine
15
+ context.layout = "layouts/decidim/admin/participatory_process"
16
+ end
17
+
9
18
  participatory_space.seeds do
10
19
  organization = Decidim::Organization.first
11
20
  seeds_root = File.join(__dir__, "..", "..", "..", "db", "seeds")
@@ -4,7 +4,7 @@ module Decidim
4
4
  # This holds the decidim-participatory_processes version.
5
5
  module ParticipatoryProcesses
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-participatory_processes
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: decidim-core
@@ -18,42 +18,42 @@ dependencies:
18
18
  requirements:
19
19
  - - '='
20
20
  - !ruby/object:Gem::Version
21
- version: 0.8.3
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.3
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.3
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.3
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.3
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.3
56
+ version: 0.8.4
57
57
  description: Participatory Processes plugin for decidim
58
58
  email:
59
59
  - josepjaume@gmail.com
@@ -87,9 +87,6 @@ files:
87
87
  - app/commands/decidim/participatory_processes/admin/update_participatory_process_step.rb
88
88
  - app/constraints/decidim/participatory_processes/current_feature.rb
89
89
  - app/constraints/decidim/participatory_processes/current_participatory_process.rb
90
- - app/controllers/concerns/decidim/participatory_processes/admin/participatory_process_context.rb
91
- - app/controllers/concerns/decidim/participatory_processes/needs_participatory_process.rb
92
- - app/controllers/concerns/decidim/participatory_processes/participatory_process_context.rb
93
90
  - app/controllers/decidim/participatory_processes/admin/application_controller.rb
94
91
  - app/controllers/decidim/participatory_processes/admin/categories_controller.rb
95
92
  - app/controllers/decidim/participatory_processes/admin/concerns/participatory_process_admin.rb
@@ -1,21 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- module Decidim
4
- module ParticipatoryProcesses
5
- module Admin
6
- # This module, when injected into a controller, ensures there's a
7
- # Participatory Process available and deducts it from the context.
8
- module ParticipatoryProcessContext
9
- def self.extended(base)
10
- base.class_eval do
11
- include Concerns::ParticipatoryProcessAdmin
12
-
13
- delegate :active_step, to: :current_participatory_process, prefix: false
14
-
15
- alias_method :current_participatory_process, :current_participatory_space
16
- end
17
- end
18
- end
19
- end
20
- end
21
- end
@@ -1,54 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- module Decidim
4
- module ParticipatoryProcesses
5
- # This module, when injected into a controller, ensures there's a
6
- # Participatory Process available and deducts it from the context.
7
- module NeedsParticipatoryProcess
8
- def self.enhance_controller(instance_or_module)
9
- instance_or_module.class_eval do
10
- helper_method :current_participatory_process
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 Participatory Process given this controller's
28
- # context.
29
- #
30
- # Returns the current ParticipatoryProcess.
31
- def current_participatory_process
32
- @current_participatory_process ||= detect_participatory_process
33
- end
34
-
35
- alias current_participatory_space current_participatory_process
36
-
37
- private
38
-
39
- def ability_context
40
- super.merge(current_participatory_process: current_participatory_process)
41
- end
42
-
43
- def detect_participatory_process
44
- request.env["current_participatory_process"] ||
45
- organization_processes.find_by!(slug: params[:participatory_process_slug] || params[:slug])
46
- end
47
-
48
- def organization_processes
49
- @organization_processes ||= OrganizationParticipatoryProcesses.new(current_organization).query
50
- end
51
- end
52
- end
53
- end
54
- end
@@ -1,27 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- module Decidim
4
- module ParticipatoryProcesses
5
- # This module, when injected into a controller, ensures there's a
6
- # Participatory Process available and deducts it from the context.
7
- module ParticipatoryProcessContext
8
- def self.extended(base)
9
- base.class_eval do
10
- include NeedsParticipatoryProcess
11
-
12
- layout "layouts/decidim/participatory_process"
13
-
14
- helper ParticipatoryProcessHelper
15
-
16
- before_action do
17
- authorize! :read, current_participatory_process
18
- end
19
- end
20
- end
21
-
22
- def ability_context
23
- super.merge(current_participatory_process: current_participatory_process)
24
- end
25
- end
26
- end
27
- end