decidim-admin 0.0.1.alpha9 → 0.0.1
Sign up to get free protection for your applications and to get access to all the features.
Potentially problematic release.
This version of decidim-admin might be problematic. Click here for more details.
- checksums.yaml +4 -4
- data/README.md +33 -8
- data/Rakefile +0 -25
- data/app/assets/javascripts/decidim/admin/application.js.es6 +17 -10
- data/app/assets/javascripts/decidim/admin/sort_steps.js.es6 +20 -11
- data/app/assets/javascripts/decidim/admin/tab_focus.js.es6 +22 -0
- data/app/assets/stylesheets/decidim/admin/_forms.scss +10 -0
- data/app/assets/stylesheets/decidim/admin/_layout.scss +11 -0
- data/app/assets/stylesheets/decidim/admin/_tables.scss +4 -0
- data/app/assets/stylesheets/decidim/admin/application.scss +8 -2
- data/app/commands/decidim/admin/activate_participatory_process_step.rb +1 -1
- data/app/commands/decidim/admin/create_category.rb +44 -0
- data/app/commands/decidim/admin/create_feature.rb +48 -0
- data/app/commands/decidim/admin/create_participatory_process.rb +3 -6
- data/app/commands/decidim/admin/create_participatory_process_admin.rb +51 -0
- data/app/commands/decidim/admin/create_participatory_process_attachment.rb +44 -0
- data/app/commands/decidim/admin/create_participatory_process_step.rb +3 -3
- data/app/commands/decidim/admin/create_scope.rb +38 -0
- data/app/commands/decidim/admin/create_static_page.rb +40 -0
- data/app/commands/decidim/admin/destroy_category.rb +36 -0
- data/app/commands/decidim/admin/destroy_feature.rb +39 -0
- data/app/commands/decidim/admin/publish_participatory_process.rb +1 -1
- data/app/commands/decidim/admin/reorder_participatory_process_steps.rb +5 -2
- data/app/commands/decidim/admin/unpublish_participatory_process.rb +1 -1
- data/app/commands/decidim/admin/update_category.rb +48 -0
- data/app/commands/decidim/admin/update_organization.rb +49 -0
- data/app/commands/decidim/admin/update_participatory_process.rb +2 -2
- data/app/commands/decidim/admin/update_participatory_process_attachment.rb +49 -0
- data/app/commands/decidim/admin/update_participatory_process_step.rb +1 -1
- data/app/commands/decidim/admin/update_scope.rb +43 -0
- data/app/commands/decidim/admin/update_static_page.rb +45 -0
- data/app/constraints/decidim/admin/organization_dashboard_constraint.rb +5 -1
- data/app/controllers/decidim/admin/application_controller.rb +8 -0
- data/app/controllers/decidim/admin/categories_controller.rb +90 -0
- data/app/controllers/decidim/admin/concerns/participatory_process_admin.rb +31 -0
- data/app/controllers/decidim/admin/features_controller.rb +74 -0
- data/app/controllers/decidim/admin/organization_controller.rb +40 -0
- data/app/controllers/decidim/admin/participatory_process_attachments_controller.rb +84 -0
- data/app/controllers/decidim/admin/participatory_process_publications_controller.rb +2 -7
- data/app/controllers/decidim/admin/participatory_process_step_activations_controller.rb +6 -8
- data/app/controllers/decidim/admin/participatory_process_step_ordering_controller.rb +2 -4
- data/app/controllers/decidim/admin/participatory_process_steps_controller.rb +13 -11
- data/app/controllers/decidim/admin/participatory_process_user_roles_controller.rb +54 -0
- data/app/controllers/decidim/admin/participatory_processes_controller.rb +11 -6
- data/app/controllers/decidim/admin/scopes_controller.rb +79 -0
- data/app/controllers/decidim/admin/static_pages_controller.rb +94 -0
- data/app/forms/decidim/admin/category_form.rb +37 -0
- data/app/forms/decidim/admin/feature_form.rb +16 -0
- data/app/forms/decidim/admin/organization_form.rb +31 -0
- data/app/forms/decidim/admin/participatory_process_attachment_form.rb +19 -0
- data/app/forms/decidim/admin/participatory_process_form.rb +4 -7
- data/app/forms/decidim/admin/participatory_process_step_form.rb +12 -2
- data/app/forms/decidim/admin/participatory_process_user_role_form.rb +15 -0
- data/app/forms/decidim/admin/scope_form.rb +24 -0
- data/app/forms/decidim/admin/static_page_form.rb +30 -0
- data/app/helpers/decidim/admin/application_helper.rb +1 -0
- data/app/helpers/decidim/admin/aria_selected_link_to_helper.rb +28 -0
- data/app/helpers/decidim/admin/attributes_display_helper.rb +13 -5
- data/app/models/decidim/admin/abilities/admin_user.rb +34 -0
- data/app/models/decidim/admin/abilities/base.rb +19 -0
- data/app/models/decidim/admin/abilities/participatory_process_admin.rb +51 -0
- data/app/models/decidim/admin/participatory_process_user_role.rb +14 -0
- data/app/queries/decidim/admin/manageable_participatory_processes_for_user.rb +41 -0
- data/app/queries/decidim/admin/process_admin_roles_for_process.rb +35 -0
- data/app/views/decidim/admin/categories/_form.html.erb +12 -0
- data/app/views/decidim/admin/categories/edit.html.erb +9 -0
- data/app/views/decidim/admin/categories/index.html.erb +44 -0
- data/app/views/decidim/admin/categories/new.html.erb +9 -0
- data/app/views/decidim/admin/categories/show.html.erb +14 -0
- data/app/views/decidim/admin/features/_feature.html.erb +20 -0
- data/app/views/decidim/admin/features/_form.html.erb +3 -0
- data/app/views/decidim/admin/features/index.html.erb +23 -0
- data/app/views/decidim/admin/features/new.html.erb +9 -0
- data/app/views/decidim/admin/organization/_form.html.erb +23 -0
- data/app/views/decidim/admin/organization/edit.html.erb +11 -0
- data/app/views/decidim/admin/participatory_process_attachments/_form.html.erb +11 -0
- data/app/views/decidim/admin/participatory_process_attachments/edit.html.erb +9 -0
- data/app/views/decidim/admin/participatory_process_attachments/index.html.erb +37 -0
- data/app/views/decidim/admin/participatory_process_attachments/new.html.erb +9 -0
- data/app/views/decidim/admin/participatory_process_attachments/show.html.erb +25 -0
- data/app/views/decidim/admin/participatory_process_steps/_form.html.erb +2 -2
- data/app/views/decidim/admin/participatory_process_steps/edit.html.erb +1 -3
- data/app/views/decidim/admin/participatory_process_steps/{_table.html.erb → index.html.erb} +15 -11
- data/app/views/decidim/admin/participatory_process_steps/new.html.erb +1 -3
- data/app/views/decidim/admin/participatory_process_steps/show.html.erb +1 -4
- data/app/views/decidim/admin/participatory_process_user_roles/index.html.erb +34 -0
- data/app/views/decidim/admin/participatory_processes/_form.html.erb +2 -2
- data/app/views/decidim/admin/participatory_processes/edit.html.erb +13 -3
- data/app/views/decidim/admin/participatory_processes/index.html.erb +5 -14
- data/app/views/decidim/admin/participatory_processes/show.html.erb +19 -36
- data/app/views/decidim/admin/scopes/_form.html.erb +3 -0
- data/app/views/decidim/admin/scopes/edit.html.erb +11 -0
- data/app/views/decidim/admin/scopes/index.html.erb +38 -0
- data/app/views/decidim/admin/scopes/new.html.erb +11 -0
- data/app/views/decidim/admin/static_pages/_form.html.erb +13 -0
- data/app/views/decidim/admin/static_pages/edit.html.erb +11 -0
- data/app/views/decidim/admin/static_pages/index.html.erb +40 -0
- data/app/views/decidim/admin/static_pages/new.html.erb +11 -0
- data/app/views/decidim/admin/static_pages/show.html.erb +22 -0
- data/app/views/layouts/decidim/admin/_application.html.erb +40 -0
- data/app/views/layouts/decidim/admin/_sidebar.html.erb +5 -2
- data/app/views/layouts/decidim/admin/application.html.erb +3 -40
- data/app/views/layouts/decidim/admin/participatory_process.html.erb +54 -0
- data/config/i18n-tasks.yml +3 -2
- data/config/locales/ca.yml +138 -6
- data/config/locales/en.yml +191 -13
- data/config/locales/es.yml +139 -7
- data/config/routes.rb +23 -1
- data/db/migrate/20161102144648_add_admin_participatory_process_user_roles.rb +15 -0
- data/db/seeds.rb +21 -0
- data/lib/decidim/admin/engine.rb +10 -3
- data/lib/decidim/admin/features/base_controller.rb +33 -0
- data/lib/decidim/admin/features.rb +10 -0
- data/lib/decidim/admin.rb +1 -0
- data/vendor/assets/javascripts/html.sortable.js +691 -0
- metadata +98 -33
- data/LICENSE.txt +0 -619
- data/app/models/decidim/admin/abilities/admin.rb +0 -21
- data/vendor/assets/javascripts/html.sortable.min.js +0 -2
@@ -0,0 +1,28 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
module Decidim
|
3
|
+
module Admin
|
4
|
+
# Module to add the attribute `aria-selected` to links when they are
|
5
|
+
# pointing to the current path. Uses the `active_link_to` gem to calculate
|
6
|
+
# this.
|
7
|
+
#
|
8
|
+
module AriaSelectedLinkToHelper
|
9
|
+
# Adds the `aria-selected` attribute to a link when it's pointing to the
|
10
|
+
# current path. The API is the same than the `link_to` one, and uses this
|
11
|
+
# helper internally.
|
12
|
+
#
|
13
|
+
# text - a String with the link text
|
14
|
+
# link - Where the link should point to. Accepts the same value than
|
15
|
+
# `link_to` helper.
|
16
|
+
# options - An options Hash that will be passed to `link_to`.
|
17
|
+
def aria_selected_link_to(text, link, options = {})
|
18
|
+
link_to(
|
19
|
+
text,
|
20
|
+
link,
|
21
|
+
options.merge(
|
22
|
+
"aria-selected": is_active_link?(link, options[:aria_link_type] || :inclusive)
|
23
|
+
)
|
24
|
+
)
|
25
|
+
end
|
26
|
+
end
|
27
|
+
end
|
28
|
+
end
|
@@ -31,8 +31,8 @@ module Decidim
|
|
31
31
|
# attrs - a list of N attributes of the `record`.
|
32
32
|
def display_for(record, *attrs)
|
33
33
|
attrs.map do |attr|
|
34
|
-
if record.column_for_attribute(attr).type == :
|
35
|
-
|
34
|
+
if record.column_for_attribute(attr).type == :jsonb
|
35
|
+
display_available_locales(record).map do |locale|
|
36
36
|
display_label(record, attr, locale) + display_value(record, attr, locale)
|
37
37
|
end.reduce(:+)
|
38
38
|
else
|
@@ -51,12 +51,20 @@ module Decidim
|
|
51
51
|
|
52
52
|
# Private: Holds the logic to render the attribute value.
|
53
53
|
def display_value(record, attr, locale = nil)
|
54
|
-
|
55
|
-
|
56
|
-
|
54
|
+
if locale
|
55
|
+
return I18n.with_locale(locale) do
|
56
|
+
content_tag(:dd, translated_attribute(record.send(attr)).try(:html_safe))
|
57
|
+
end
|
58
|
+
end
|
57
59
|
|
58
60
|
content_tag(:dd, record.send(attr).try(:html_safe))
|
59
61
|
end
|
62
|
+
|
63
|
+
def display_available_locales(record)
|
64
|
+
return record.available_locales if record.respond_to?(:available_locales)
|
65
|
+
record.organization.available_locales if record.respond_to?(:organization)
|
66
|
+
current_organization.available_locales if respond_to?(:current_organization)
|
67
|
+
end
|
60
68
|
end
|
61
69
|
end
|
62
70
|
end
|
@@ -0,0 +1,34 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
module Decidim
|
3
|
+
module Admin
|
4
|
+
module Abilities
|
5
|
+
# Defines the abilities for a user in the admin section. Intended to be
|
6
|
+
# used with `cancancan`.
|
7
|
+
class AdminUser
|
8
|
+
include CanCan::Ability
|
9
|
+
|
10
|
+
def initialize(user)
|
11
|
+
return unless user
|
12
|
+
return unless user.role?(:admin)
|
13
|
+
|
14
|
+
can :manage, ParticipatoryProcess
|
15
|
+
can :manage, ParticipatoryProcessStep
|
16
|
+
can :manage, Category
|
17
|
+
can :manage, ParticipatoryProcessUserRole
|
18
|
+
can [:create, :update, :index, :new, :read], StaticPage
|
19
|
+
can [:update_slug, :destroy], [StaticPage, StaticPageForm] do |page|
|
20
|
+
!StaticPage.default?(page.slug)
|
21
|
+
end
|
22
|
+
can [:read, :update], Decidim::Organization do |organization|
|
23
|
+
organization == user.organization
|
24
|
+
end
|
25
|
+
|
26
|
+
can :manage, Feature
|
27
|
+
can :read, :admin_dashboard
|
28
|
+
can :manage, ParticipatoryProcessAttachment
|
29
|
+
can :manage, Scope
|
30
|
+
end
|
31
|
+
end
|
32
|
+
end
|
33
|
+
end
|
34
|
+
end
|
@@ -0,0 +1,19 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
module Decidim
|
3
|
+
module Admin
|
4
|
+
module Abilities
|
5
|
+
# Defines the abilities for a user in the admin section. Intended to be
|
6
|
+
# used with `cancancan`. Extended by both the base `Decidim::Ability`
|
7
|
+
# class and other engine-only abilities, like the
|
8
|
+
# `ParticipatoryProcessAdmin` ability class.
|
9
|
+
class Base
|
10
|
+
include CanCan::Ability
|
11
|
+
|
12
|
+
def initialize(user)
|
13
|
+
merge ::Decidim::Ability.new(user)
|
14
|
+
merge ParticipatoryProcessAdmin.new(user)
|
15
|
+
end
|
16
|
+
end
|
17
|
+
end
|
18
|
+
end
|
19
|
+
end
|
@@ -0,0 +1,51 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
module Decidim
|
3
|
+
module Admin
|
4
|
+
module Abilities
|
5
|
+
# Defines the abilities for a participatory process admin in the admin
|
6
|
+
# section. Intended to be used with `cancancan`. This is not intended to
|
7
|
+
# extend the base `Decidim::Ability` class, it should only be used in the
|
8
|
+
# Admin engine.
|
9
|
+
#
|
10
|
+
# This ability will not apply to organization admins.
|
11
|
+
class ParticipatoryProcessAdmin
|
12
|
+
include CanCan::Ability
|
13
|
+
|
14
|
+
def initialize(user)
|
15
|
+
return if user.role?(:admin)
|
16
|
+
participatory_processes = ManageableParticipatoryProcessesForUser.for(user)
|
17
|
+
return unless participatory_processes.any?
|
18
|
+
|
19
|
+
can :read, :admin_dashboard
|
20
|
+
|
21
|
+
can :manage, ParticipatoryProcess do |process|
|
22
|
+
participatory_processes.include?(process)
|
23
|
+
end
|
24
|
+
|
25
|
+
cannot :create, ParticipatoryProcess
|
26
|
+
cannot :destroy, ParticipatoryProcess
|
27
|
+
|
28
|
+
can :manage, ParticipatoryProcessUserRole do |role|
|
29
|
+
role.user != user
|
30
|
+
end
|
31
|
+
|
32
|
+
can :manage, ParticipatoryProcessAttachment do |step|
|
33
|
+
participatory_processes.include?(step.participatory_process)
|
34
|
+
end
|
35
|
+
|
36
|
+
can :manage, ParticipatoryProcessStep do |step|
|
37
|
+
participatory_processes.include?(step.participatory_process)
|
38
|
+
end
|
39
|
+
|
40
|
+
can :manage, Feature do |feature|
|
41
|
+
participatory_processes.include?(feature.participatory_process)
|
42
|
+
end
|
43
|
+
|
44
|
+
can :manage, Category do |category|
|
45
|
+
participatory_processes.include?(category.participatory_process)
|
46
|
+
end
|
47
|
+
end
|
48
|
+
end
|
49
|
+
end
|
50
|
+
end
|
51
|
+
end
|
@@ -0,0 +1,14 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
module Decidim
|
3
|
+
module Admin
|
4
|
+
# Defines a relation between a user and a participatory process, and what
|
5
|
+
# kind of relation does the user has.
|
6
|
+
class ParticipatoryProcessUserRole < ApplicationRecord
|
7
|
+
belongs_to :user, foreign_key: "decidim_user_id", class_name: Decidim::User
|
8
|
+
belongs_to :participatory_process, foreign_key: "decidim_participatory_process_id", class_name: Decidim::ParticipatoryProcess
|
9
|
+
|
10
|
+
ROLES = %w(admin).freeze
|
11
|
+
validates :role, inclusion: { in: ROLES }
|
12
|
+
end
|
13
|
+
end
|
14
|
+
end
|
@@ -0,0 +1,41 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
module Decidim
|
3
|
+
module Admin
|
4
|
+
# A class used to find the ParticipatoryProcesses that the given user can
|
5
|
+
# manage.
|
6
|
+
class ManageableParticipatoryProcessesForUser < Rectify::Query
|
7
|
+
# Syntactic sugar to initialize the class and return the queried objects.
|
8
|
+
#
|
9
|
+
# user - a User that needs to find which processes can manage
|
10
|
+
def self.for(user)
|
11
|
+
new(user).query
|
12
|
+
end
|
13
|
+
|
14
|
+
# Initializes the class.
|
15
|
+
#
|
16
|
+
# user - a User that needs to find which processes can manage
|
17
|
+
def initialize(user)
|
18
|
+
@user = user
|
19
|
+
end
|
20
|
+
|
21
|
+
# Finds the ParticipatoryProcesses that the given user can manage.
|
22
|
+
#
|
23
|
+
# Returns an ActiveRecord::Relation.
|
24
|
+
def query
|
25
|
+
return user.organization.participatory_processes if user.role?(:admin)
|
26
|
+
|
27
|
+
ParticipatoryProcess.where(id: process_ids)
|
28
|
+
end
|
29
|
+
|
30
|
+
private
|
31
|
+
|
32
|
+
attr_reader :user
|
33
|
+
|
34
|
+
def process_ids
|
35
|
+
ParticipatoryProcessUserRole
|
36
|
+
.where(user: user, role: :admin)
|
37
|
+
.pluck(:decidim_participatory_process_id)
|
38
|
+
end
|
39
|
+
end
|
40
|
+
end
|
41
|
+
end
|
@@ -0,0 +1,35 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
module Decidim
|
3
|
+
module Admin
|
4
|
+
# A class used to find the roles of the users that can manage a given
|
5
|
+
# participatory process in a process admin role (that is, processs that are
|
6
|
+
# not organization admins).
|
7
|
+
class ProcessAdminRolesForProcess < Rectify::Query
|
8
|
+
# Syntactic sugar to initialize the class and return the queried objects.
|
9
|
+
#
|
10
|
+
# process - a process that needs to find its process admins
|
11
|
+
def self.for(process)
|
12
|
+
new(process).query
|
13
|
+
end
|
14
|
+
|
15
|
+
# Initializes the class.
|
16
|
+
#
|
17
|
+
# process - a process that needs to find its process admins
|
18
|
+
def initialize(process)
|
19
|
+
@process = process
|
20
|
+
end
|
21
|
+
|
22
|
+
# Finds the UserRoles of the users that can manage the given process.
|
23
|
+
#
|
24
|
+
# Returns an ActiveRecord::Relation.
|
25
|
+
def query
|
26
|
+
ParticipatoryProcessUserRole
|
27
|
+
.where(participatory_process: process, role: :admin)
|
28
|
+
end
|
29
|
+
|
30
|
+
private
|
31
|
+
|
32
|
+
attr_reader :process
|
33
|
+
end
|
34
|
+
end
|
35
|
+
end
|
@@ -0,0 +1,12 @@
|
|
1
|
+
<div class="field">
|
2
|
+
<%= form.translated :text_field, :name, autofocus: true %>
|
3
|
+
</div>
|
4
|
+
|
5
|
+
<div class="field">
|
6
|
+
<%= form.translated :editor, :description %>
|
7
|
+
</div>
|
8
|
+
|
9
|
+
<div class="field">
|
10
|
+
<%= form.label :parent_id %>
|
11
|
+
<%= select :category, :parent_id, @form.parent_categories.collect { |c| [c.name[current_organization.default_locale], c.id] }, include_blank: true %>
|
12
|
+
</div>
|
@@ -0,0 +1,9 @@
|
|
1
|
+
<h3><%= t ".title" %></h3>
|
2
|
+
|
3
|
+
<%= form_for(@form, url: participatory_process_category_path(@category.participatory_process, @category)) do |f| %>
|
4
|
+
<%= render partial: 'form', object: f %>
|
5
|
+
|
6
|
+
<div class="actions">
|
7
|
+
<%= f.submit t(".update") %>
|
8
|
+
</div>
|
9
|
+
<% end %>
|
@@ -0,0 +1,44 @@
|
|
1
|
+
<section id="categories">
|
2
|
+
<h4><%= t(".categories_title", scope: "decidim.admin") %></h4>
|
3
|
+
|
4
|
+
<% if can? :create, Decidim::Category %>
|
5
|
+
<div class="actions title">
|
6
|
+
<%= link_to t("actions.new", scope: "decidim.admin", name: t("models.category.name", scope: "decidim.admin")), new_participatory_process_category_path(participatory_process), class: 'new' %>
|
7
|
+
</div>
|
8
|
+
<% end %>
|
9
|
+
|
10
|
+
<% if participatory_process.categories.any? %>
|
11
|
+
<table class="stack">
|
12
|
+
<thead>
|
13
|
+
<tr>
|
14
|
+
<th><%= t("models.category.fields.name", scope: "decidim.admin") %></th>
|
15
|
+
<th class="actions"><%= t("actions.title", scope: "decidim.admin") %></th>
|
16
|
+
</tr>
|
17
|
+
</thead>
|
18
|
+
<tbody>
|
19
|
+
<% participatory_process.categories.first_class.each do |category| %>
|
20
|
+
<tr>
|
21
|
+
<td>
|
22
|
+
<%= link_to translated_attribute(category.name), participatory_process_category_path(participatory_process, category) %><br />
|
23
|
+
</td>
|
24
|
+
<td class="actions">
|
25
|
+
<%= link_to t("actions.edit", scope: "decidim.admin"), edit_participatory_process_category_path(participatory_process, category) if can? :update, category %>
|
26
|
+
<%= link_to t("actions.destroy", scope: "decidim.admin"), participatory_process_category_path(participatory_process, category), method: :delete, class: "small alert button", data: { confirm: t("actions.confirm_destroy", scope: "decidim.admin") } if can? :destroy, category %>
|
27
|
+
</td>
|
28
|
+
</tr>
|
29
|
+
<% category.subcategories.each do |subcategory| %>
|
30
|
+
<tr class="subcategory">
|
31
|
+
<td>
|
32
|
+
<%= link_to translated_attribute(subcategory.name), participatory_process_category_path(participatory_process, subcategory) %><br />
|
33
|
+
</td>
|
34
|
+
<td class="actions">
|
35
|
+
<%= link_to t("actions.edit", scope: "decidim.admin"), edit_participatory_process_category_path(participatory_process, subcategory) if can? :update, subcategory %>
|
36
|
+
<%= link_to t("actions.destroy", scope: "decidim.admin"), participatory_process_category_path(participatory_process, subcategory), method: :delete, class: "small alert button", data: { confirm: t("actions.confirm_destroy", scope: "decidim.admin") } if can? :destroy, subcategory %>
|
37
|
+
</td>
|
38
|
+
</tr>
|
39
|
+
<% end %>
|
40
|
+
<% end %>
|
41
|
+
</tbody>
|
42
|
+
</table>
|
43
|
+
<% end %>
|
44
|
+
</section>
|
@@ -0,0 +1,14 @@
|
|
1
|
+
<h3><%= translated_attribute(@category.name) %></h3>
|
2
|
+
|
3
|
+
<div class="actions">
|
4
|
+
<hr />
|
5
|
+
<%= link_to t("decidim.admin.actions.edit"), ['edit', participatory_process, @category] if can? :update, @category %>
|
6
|
+
<%= link_to t("decidim.admin.actions.destroy"), [participatory_process, @category], method: :delete, class: "alert button", data: { confirm: t("decidim.admin.actions.confirm_destroy") } if can? :destroy, @category %>
|
7
|
+
</div>
|
8
|
+
|
9
|
+
<dl>
|
10
|
+
<%= display_for @category,
|
11
|
+
:name,
|
12
|
+
:description
|
13
|
+
%>
|
14
|
+
</dl>
|
@@ -0,0 +1,20 @@
|
|
1
|
+
<tr class="feature-<%= feature.id %>">
|
2
|
+
<td>
|
3
|
+
<%= link_to decidim.feature_path(participatory_process, feature), target: "_blank" do %>
|
4
|
+
<%= translated_attribute feature.name %>
|
5
|
+
<% end %>
|
6
|
+
</td>
|
7
|
+
<td>
|
8
|
+
<%= t "decidim.features.#{feature.manifest.name}.name" %>
|
9
|
+
</td>
|
10
|
+
<td class="actions">
|
11
|
+
|
12
|
+
<% if feature.manifest.admin_engine %>
|
13
|
+
<%= link_to manage_feature_path(participatory_process, feature), class: "button small" do %>
|
14
|
+
<%= t "actions.configure", scope: "decidim.admin" %>
|
15
|
+
<% end %>
|
16
|
+
<% end %>
|
17
|
+
|
18
|
+
<%= link_to t("actions.destroy", scope: "decidim.admin"), url_for(action: :destroy, id: feature, controller: "features"), method: :delete, class: "small alert button", data: { confirm: t("actions.confirm_destroy", scope: "decidim.admin") } if can? :destroy, feature %>
|
19
|
+
</td>
|
20
|
+
</tr>
|
@@ -0,0 +1,23 @@
|
|
1
|
+
<section id="features">
|
2
|
+
<div class="row">
|
3
|
+
<div class="columns">
|
4
|
+
<h3><%= t("features.title", scope: "decidim.admin") %></h3>
|
5
|
+
</div>
|
6
|
+
<div class="small-4 columns text-right">
|
7
|
+
<button class="dropdown button" data-toggle="add-feature-dropdown"><%= t "features.index.add", scope: "decidim.admin" %></button>
|
8
|
+
<div class="dropdown-pane" id="add-feature-dropdown" data-dropdown data-auto-focus="true" data-close-on-click="true">
|
9
|
+
<ul class="vertical menu add-features">
|
10
|
+
<% @manifests.each do |manifest| %>
|
11
|
+
<li><%= link_to t("#{manifest.name}.name", scope: "decidim.features"), new_participatory_process_feature_path(type: manifest.name), class: manifest.name %></li>
|
12
|
+
<% end %>
|
13
|
+
</ul>
|
14
|
+
</div>
|
15
|
+
</div>
|
16
|
+
</div>
|
17
|
+
|
18
|
+
<table>
|
19
|
+
<tbody>
|
20
|
+
<%= render partial: "feature", collection: @features %>
|
21
|
+
</tbody>
|
22
|
+
</table>
|
23
|
+
</section>
|
@@ -0,0 +1,9 @@
|
|
1
|
+
<h3><%= t ".title", name: t("#{manifest.name}.name", scope: "decidim.features") %></h3>
|
2
|
+
|
3
|
+
<%= form_for([participatory_process, @form], url: participatory_process_features_path(type: params[:type]), method: "post") do |form| %>
|
4
|
+
<%= render partial: 'form', object: form %>
|
5
|
+
|
6
|
+
<div class="actions">
|
7
|
+
<%= form.submit t(".add") %>
|
8
|
+
</div>
|
9
|
+
<% end %>
|
@@ -0,0 +1,23 @@
|
|
1
|
+
<div class="field">
|
2
|
+
<%= form.text_field :name %>
|
3
|
+
</div>
|
4
|
+
|
5
|
+
<div class="field">
|
6
|
+
<%= form.translated :editor, :description %>
|
7
|
+
</div>
|
8
|
+
|
9
|
+
<div class="field">
|
10
|
+
<%= form.translated :text_area, :welcome_text %>
|
11
|
+
</div>
|
12
|
+
|
13
|
+
<div class="field">
|
14
|
+
<%= form.collection_select :default_locale, localized_locales(current_organization.available_locales), :id, :name %>
|
15
|
+
</div>
|
16
|
+
|
17
|
+
<div class="field">
|
18
|
+
<%= form.file_field :homepage_image %>
|
19
|
+
</div>
|
20
|
+
|
21
|
+
<div class="field">
|
22
|
+
<%= form.file_field :logo %>
|
23
|
+
</div>
|
@@ -0,0 +1,11 @@
|
|
1
|
+
<div class="field">
|
2
|
+
<%= form.translated :text_field, :title, autofocus: true %>
|
3
|
+
</div>
|
4
|
+
|
5
|
+
<div class="field">
|
6
|
+
<%= form.translated :editor, :description, toolbar: :full, lines: 20 %>
|
7
|
+
</div>
|
8
|
+
|
9
|
+
<div class="field">
|
10
|
+
<%= form.file_field :file %>
|
11
|
+
</div>
|
@@ -0,0 +1,9 @@
|
|
1
|
+
<h3><%= t ".title" %></h3>
|
2
|
+
|
3
|
+
<%= form_for(@form, url: participatory_process_attachment_path(@participatory_process_attachment.participatory_process, @participatory_process_attachment)) do |f| %>
|
4
|
+
<%= render partial: 'form', object: f %>
|
5
|
+
|
6
|
+
<div class="actions">
|
7
|
+
<%= f.submit t(".update") %>
|
8
|
+
</div>
|
9
|
+
<% end %>
|
@@ -0,0 +1,37 @@
|
|
1
|
+
<section id="attachments">
|
2
|
+
<h4><%= t(".attachments_title", scope: "decidim.admin") %></h4>
|
3
|
+
|
4
|
+
<% if can? :create, Decidim::ParticipatoryProcessAttachment %>
|
5
|
+
<div class="actions title">
|
6
|
+
<%= link_to t("actions.new", scope: "decidim.admin", name: t("models.participatory_process_attachment.name", scope: "decidim.admin")), new_participatory_process_attachment_path(participatory_process), class: 'new' %>
|
7
|
+
</div>
|
8
|
+
<% end %>
|
9
|
+
|
10
|
+
<% if participatory_process.attachments.any? %>
|
11
|
+
<table class="stack">
|
12
|
+
<thead>
|
13
|
+
<tr>
|
14
|
+
<th><%= t("models.participatory_process_attachment.fields.title", scope: "decidim.admin") %></th>
|
15
|
+
<th><%= t("models.participatory_process_attachment.fields.content_type", scope: "decidim.admin") %></th>
|
16
|
+
<th class="actions"><%= t("actions.title", scope: "decidim.admin") %></th>
|
17
|
+
</tr>
|
18
|
+
</thead>
|
19
|
+
<tbody>
|
20
|
+
<% participatory_process.attachments.each do |attachment| %>
|
21
|
+
<tr data-id="<%= attachment.id %>">
|
22
|
+
<td>
|
23
|
+
<%= link_to translated_attribute(attachment.title), participatory_process_attachment_path(participatory_process, attachment) %><br />
|
24
|
+
</td>
|
25
|
+
<td>
|
26
|
+
<%= attachment.file_type %>
|
27
|
+
</td>
|
28
|
+
<td class="actions">
|
29
|
+
<%= link_to t("actions.edit", scope: "decidim.admin"), edit_participatory_process_attachment_path(participatory_process, attachment) if can? :update, attachment %>
|
30
|
+
<%= link_to t("actions.destroy", scope: "decidim.admin"), participatory_process_attachment_path(participatory_process, attachment), method: :delete, class: "small alert button", data: { confirm: t("actions.confirm_destroy", scope: "decidim.admin") } if can? :destroy, attachment %>
|
31
|
+
</td>
|
32
|
+
</tr>
|
33
|
+
<% end %>
|
34
|
+
</tbody>
|
35
|
+
</table>
|
36
|
+
<% end %>
|
37
|
+
</section>
|
@@ -0,0 +1,25 @@
|
|
1
|
+
<h3><%= translated_attribute(@participatory_process_attachment.title) %></h3>
|
2
|
+
|
3
|
+
<div class="actions">
|
4
|
+
<hr />
|
5
|
+
<%= link_to t("decidim.admin.actions.edit"), ['edit', @participatory_process_attachment] if can? :update, @participatory_process_attachment %>
|
6
|
+
<%= link_to t("decidim.admin.actions.destroy"), @participatory_process_attachment, method: :delete, class: "alert button", data: { confirm: t("decidim.admin.actions.confirm_destroy") } if can? :destroy, @participatory_process_attachment %>
|
7
|
+
</div>
|
8
|
+
|
9
|
+
<dl>
|
10
|
+
<%= display_for @participatory_process_attachment,
|
11
|
+
:title,
|
12
|
+
:description,
|
13
|
+
:file_type
|
14
|
+
%>
|
15
|
+
<dt><%= display_label(@participatory_process_attachment, :file_size) %></dt>
|
16
|
+
<dd><%= number_to_human_size(@participatory_process_attachment.file_size) %></dd>
|
17
|
+
<dt><%= display_label(@participatory_process_attachment, :file) %></dt>
|
18
|
+
<% if @participatory_process_attachment.photo? %>
|
19
|
+
<%= link_to @participatory_process_attachment.big_url do %>
|
20
|
+
<%= image_tag @participatory_process_attachment.thumbnail_url, class:"thumbnail", alt: strip_tags(translated_attribute(@participatory_process_attachment.description)) %>
|
21
|
+
<% end %>
|
22
|
+
<% else %>
|
23
|
+
<%= link_to @participatory_process_attachment.url, @participatory_process_attachment.file.original_file_name %>
|
24
|
+
<% end %>
|
25
|
+
</dl>
|
@@ -3,11 +3,11 @@
|
|
3
3
|
</div>
|
4
4
|
|
5
5
|
<div class="field">
|
6
|
-
<%= form.translated :
|
6
|
+
<%= form.translated :editor, :short_description %>
|
7
7
|
</div>
|
8
8
|
|
9
9
|
<div class="field">
|
10
|
-
<%= form.translated :
|
10
|
+
<%= form.translated :editor, :description, toolbar: :full, lines: 20 %>
|
11
11
|
</div>
|
12
12
|
|
13
13
|
<div class="field">
|
@@ -1,6 +1,4 @@
|
|
1
|
-
|
2
|
-
<h2><%= t ".title" %></h2>
|
3
|
-
<% end %>
|
1
|
+
<h3><%= t ".title" %></h3>
|
4
2
|
|
5
3
|
<%= form_for(@form, url: participatory_process_step_path(@participatory_process_step.participatory_process, @participatory_process_step)) do |f| %>
|
6
4
|
<%= render partial: 'form', object: f %>
|
@@ -3,11 +3,11 @@
|
|
3
3
|
|
4
4
|
<% if can? :create, Decidim::ParticipatoryProcessStep %>
|
5
5
|
<div class="actions title">
|
6
|
-
<%= link_to t("actions.new", scope: "decidim.admin", name: t("models.participatory_process_step.name", scope: "decidim.admin")), new_participatory_process_step_path(
|
6
|
+
<%= link_to t("actions.new", scope: "decidim.admin", name: t("models.participatory_process_step.name", scope: "decidim.admin")), new_participatory_process_step_path(participatory_process), class: 'new' %>
|
7
7
|
</div>
|
8
8
|
<% end %>
|
9
9
|
|
10
|
-
<% if
|
10
|
+
<% if participatory_process.steps.any? %>
|
11
11
|
<p><%= t(".steps_hint", scope: "decidim.admin") %></p>
|
12
12
|
<table class="stack">
|
13
13
|
<thead>
|
@@ -19,31 +19,35 @@
|
|
19
19
|
<th class="actions"><%= t("actions.title", scope: "decidim.admin") %></th>
|
20
20
|
</tr>
|
21
21
|
</thead>
|
22
|
-
<tbody class="sortable" data-sort-url="<%= ordering_participatory_process_steps_path(
|
23
|
-
<%
|
22
|
+
<tbody class="sortable" data-sort-url="<%= ordering_participatory_process_steps_path(participatory_process) %>">
|
23
|
+
<% participatory_process.steps.each do |step| %>
|
24
24
|
<tr data-id="<%= step.id %>">
|
25
25
|
<td>
|
26
|
-
<%= link_to translated_attribute(step.title), participatory_process_step_path(
|
26
|
+
<%= link_to translated_attribute(step.title), participatory_process_step_path(participatory_process, step) %><br />
|
27
27
|
</td>
|
28
28
|
<td>
|
29
|
-
|
29
|
+
<% if step.start_date %>
|
30
|
+
<%= l step.start_date.to_date, format: :long %>
|
31
|
+
<% end%>
|
30
32
|
</td>
|
31
33
|
<td>
|
32
|
-
|
34
|
+
<% if step.end_date %>
|
35
|
+
<%= l step.end_date.to_date, format: :long %>
|
36
|
+
<% end%>
|
33
37
|
</td>
|
34
38
|
<td>
|
35
39
|
<%= humanize_boolean step.active? %>
|
36
40
|
</td>
|
37
41
|
<td class="actions">
|
38
|
-
<%= link_to t("actions.edit", scope: "decidim.admin"), edit_participatory_process_step_path(
|
42
|
+
<%= link_to t("actions.edit", scope: "decidim.admin"), edit_participatory_process_step_path(participatory_process, step) if can? :update, step %>
|
39
43
|
<% if can? :activate, step %>
|
40
44
|
<% if step.active? %>
|
41
|
-
<%= link_to t("actions.deactivate", scope: "decidim.admin"), participatory_process_step_activate_path(
|
45
|
+
<%= link_to t("actions.deactivate", scope: "decidim.admin"), participatory_process_step_activate_path(participatory_process, step), method: :delete, class: "small button secondary" %>
|
42
46
|
<% else %>
|
43
|
-
<%= link_to t("actions.activate", scope: "decidim.admin"), participatory_process_step_activate_path(
|
47
|
+
<%= link_to t("actions.activate", scope: "decidim.admin"), participatory_process_step_activate_path(participatory_process, step), method: :post, class: "small button secondary" %>
|
44
48
|
<% end %>
|
45
49
|
<% end %>
|
46
|
-
<%= link_to t("actions.destroy", scope: "decidim.admin"), participatory_process_step_path(
|
50
|
+
<%= link_to t("actions.destroy", scope: "decidim.admin"), participatory_process_step_path(participatory_process, step), method: :delete, class: "small alert button", data: { confirm: t("actions.confirm_destroy", scope: "decidim.admin") } if can? :destroy, step %>
|
47
51
|
</td>
|
48
52
|
</tr>
|
49
53
|
<% end %>
|