decidim-admin 0.1.0 → 0.2.0

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.

Files changed (130) hide show
  1. checksums.yaml +4 -4
  2. data/Rakefile +1 -0
  3. data/app/assets/stylesheets/decidim/admin/application.scss.erb +6 -0
  4. data/app/assets/stylesheets/decidim/admin/extra/_action-icon.scss +1 -0
  5. data/app/assets/stylesheets/decidim/admin/extra/_dropdown_inverted.scss +38 -0
  6. data/app/commands/decidim/admin/activate_participatory_process_step.rb +1 -0
  7. data/app/commands/decidim/admin/copy_participatory_process.rb +113 -0
  8. data/app/commands/decidim/admin/create_attachment.rb +1 -0
  9. data/app/commands/decidim/admin/create_category.rb +1 -0
  10. data/app/commands/decidim/admin/create_feature.rb +1 -0
  11. data/app/commands/decidim/admin/create_newsletter.rb +1 -0
  12. data/app/commands/decidim/admin/create_participatory_process.rb +1 -0
  13. data/app/commands/decidim/admin/create_participatory_process_admin.rb +1 -0
  14. data/app/commands/decidim/admin/create_participatory_process_group.rb +1 -0
  15. data/app/commands/decidim/admin/create_participatory_process_step.rb +1 -0
  16. data/app/commands/decidim/admin/create_scope.rb +1 -0
  17. data/app/commands/decidim/admin/create_static_page.rb +1 -0
  18. data/app/commands/decidim/admin/deactivate_participatory_process_step.rb +1 -0
  19. data/app/commands/decidim/admin/deliver_newsletter.rb +1 -0
  20. data/app/commands/decidim/admin/destroy_category.rb +1 -0
  21. data/app/commands/decidim/admin/destroy_feature.rb +1 -0
  22. data/app/commands/decidim/admin/destroy_participatory_process_step.rb +1 -0
  23. data/app/commands/decidim/admin/hide_resource.rb +1 -0
  24. data/app/commands/decidim/admin/publish_participatory_process.rb +1 -0
  25. data/app/commands/decidim/admin/reject_user_group.rb +33 -0
  26. data/app/commands/decidim/admin/reorder_participatory_process_steps.rb +1 -0
  27. data/app/commands/decidim/admin/unpublish_participatory_process.rb +1 -0
  28. data/app/commands/decidim/admin/unreport_resource.rb +1 -0
  29. data/app/commands/decidim/admin/update_attachment.rb +1 -0
  30. data/app/commands/decidim/admin/update_category.rb +1 -0
  31. data/app/commands/decidim/admin/update_feature.rb +1 -0
  32. data/app/commands/decidim/admin/update_feature_permissions.rb +1 -0
  33. data/app/commands/decidim/admin/update_newsletter.rb +1 -0
  34. data/app/commands/decidim/admin/update_organization.rb +1 -0
  35. data/app/commands/decidim/admin/update_participatory_process.rb +1 -0
  36. data/app/commands/decidim/admin/update_participatory_process_admin.rb +1 -0
  37. data/app/commands/decidim/admin/update_participatory_process_group.rb +1 -0
  38. data/app/commands/decidim/admin/update_participatory_process_step.rb +1 -0
  39. data/app/commands/decidim/admin/update_scope.rb +1 -0
  40. data/app/commands/decidim/admin/update_static_page.rb +1 -0
  41. data/app/commands/decidim/admin/update_user_groups.rb +44 -0
  42. data/app/commands/decidim/admin/verify_user_group.rb +32 -0
  43. data/app/constraints/decidim/admin/organization_dashboard_constraint.rb +1 -0
  44. data/app/controllers/decidim/admin/application_controller.rb +2 -2
  45. data/app/controllers/decidim/admin/categories_controller.rb +1 -0
  46. data/app/controllers/decidim/admin/concerns/has_attachments.rb +1 -0
  47. data/app/controllers/decidim/admin/concerns/participatory_process_admin.rb +1 -0
  48. data/app/controllers/decidim/admin/dashboard_controller.rb +1 -0
  49. data/app/controllers/decidim/admin/exports_controller.rb +39 -0
  50. data/app/controllers/decidim/admin/feature_permissions_controller.rb +1 -0
  51. data/app/controllers/decidim/admin/features/base_controller.rb +3 -0
  52. data/app/controllers/decidim/admin/features_controller.rb +1 -0
  53. data/app/controllers/decidim/admin/moderations_controller.rb +1 -0
  54. data/app/controllers/decidim/admin/organization_controller.rb +1 -0
  55. data/app/controllers/decidim/admin/participatory_process_attachments_controller.rb +1 -0
  56. data/app/controllers/decidim/admin/participatory_process_copies_controller.rb +47 -0
  57. data/app/controllers/decidim/admin/participatory_process_groups_controller.rb +1 -0
  58. data/app/controllers/decidim/admin/participatory_process_publications_controller.rb +1 -0
  59. data/app/controllers/decidim/admin/participatory_process_step_activations_controller.rb +1 -0
  60. data/app/controllers/decidim/admin/participatory_process_step_ordering_controller.rb +1 -0
  61. data/app/controllers/decidim/admin/participatory_process_steps_controller.rb +1 -0
  62. data/app/controllers/decidim/admin/participatory_process_user_roles_controller.rb +1 -0
  63. data/app/controllers/decidim/admin/participatory_processes_controller.rb +5 -0
  64. data/app/controllers/decidim/admin/scopes_controller.rb +1 -0
  65. data/app/controllers/decidim/admin/static_pages_controller.rb +1 -0
  66. data/app/controllers/decidim/admin/user_groups_controller.rb +32 -4
  67. data/app/controllers/decidim/admin/users_controller.rb +1 -0
  68. data/app/forms/decidim/admin/attachment_form.rb +1 -0
  69. data/app/forms/decidim/admin/category_form.rb +1 -0
  70. data/app/forms/decidim/admin/feature_form.rb +1 -0
  71. data/app/forms/decidim/admin/newsletter_form.rb +1 -0
  72. data/app/forms/decidim/admin/organization_form.rb +1 -0
  73. data/app/forms/decidim/admin/participatory_process_copy_form.rb +34 -0
  74. data/app/forms/decidim/admin/participatory_process_form.rb +1 -0
  75. data/app/forms/decidim/admin/participatory_process_group_form.rb +1 -0
  76. data/app/forms/decidim/admin/participatory_process_step_form.rb +1 -0
  77. data/app/forms/decidim/admin/participatory_process_user_role_form.rb +1 -0
  78. data/app/forms/decidim/admin/permission_form.rb +1 -0
  79. data/app/forms/decidim/admin/permissions_form.rb +1 -0
  80. data/app/forms/decidim/admin/scope_form.rb +1 -0
  81. data/app/forms/decidim/admin/static_page_form.rb +1 -0
  82. data/app/helpers/decidim/admin/application_helper.rb +1 -8
  83. data/app/helpers/decidim/admin/attributes_display_helper.rb +1 -0
  84. data/app/helpers/decidim/admin/exports_helper.rb +18 -0
  85. data/app/helpers/decidim/admin/feature_settings_helper.rb +1 -0
  86. data/app/helpers/decidim/admin/icon_link_helper.rb +1 -0
  87. data/app/helpers/decidim/admin/menu_helper.rb +18 -0
  88. data/app/helpers/decidim/admin/process_groups_for_select_helper.rb +1 -0
  89. data/app/helpers/decidim/admin/processes_for_select_helper.rb +1 -0
  90. data/app/jobs/decidim/admin/application_job.rb +1 -0
  91. data/app/jobs/decidim/admin/newsletter_delivery_job.rb +1 -0
  92. data/app/jobs/decidim/admin/newsletter_job.rb +1 -0
  93. data/app/mailers/decidim/admin/application_mailer.rb +1 -0
  94. data/app/models/decidim/admin/abilities/admin_user.rb +2 -1
  95. data/app/models/decidim/admin/abilities/base.rb +1 -0
  96. data/app/models/decidim/admin/abilities/collaborator_user.rb +1 -0
  97. data/app/models/decidim/admin/abilities/participatory_process_admin.rb +1 -0
  98. data/app/models/decidim/admin/application_record.rb +1 -0
  99. data/app/models/decidim/admin/participatory_process_user_role.rb +3 -2
  100. data/app/queries/decidim/admin/manageable_participatory_processes_for_user.rb +1 -0
  101. data/app/queries/decidim/admin/process_admin_roles_for_process.rb +1 -0
  102. data/app/queries/decidim/admin/process_admins.rb +1 -0
  103. data/app/queries/decidim/admin/user_groups_evaluation.rb +54 -0
  104. data/app/views/decidim/admin/exports/_dropdown.html.erb +10 -0
  105. data/app/views/decidim/admin/participatory_process_copies/_form.html.erb +38 -0
  106. data/app/views/decidim/admin/participatory_process_copies/new.html.erb +7 -0
  107. data/app/views/decidim/admin/participatory_processes/index.html.erb +2 -0
  108. data/app/views/decidim/admin/scopes/new.html.erb +0 -1
  109. data/app/views/decidim/admin/user_groups/index.html.erb +67 -5
  110. data/app/views/layouts/decidim/admin/_application.html.erb +1 -1
  111. data/app/views/layouts/decidim/admin/_title_bar.html.erb +1 -1
  112. data/config/i18n-tasks.yml +6 -6
  113. data/config/locales/ca.yml +36 -2
  114. data/config/locales/en.yml +36 -2
  115. data/config/locales/es.yml +37 -3
  116. data/config/locales/eu.yml +41 -3
  117. data/config/locales/fi.yml +0 -3
  118. data/config/locales/fr.yml +0 -3
  119. data/config/routes.rb +4 -0
  120. data/db/seeds.rb +1 -0
  121. data/lib/decidim/admin.rb +1 -0
  122. data/lib/decidim/admin/engine.rb +51 -0
  123. data/lib/decidim/admin/features.rb +1 -0
  124. data/lib/decidim/admin/test/factories.rb +1 -0
  125. data/lib/decidim/admin/test/manage_attachments_examples.rb +1 -0
  126. metadata +21 -24
  127. data/app/assets/stylesheets/decidim/admin/application.scss +0 -2
  128. data/app/assets/stylesheets/decidim/admin/extra/_sidebar.scss +0 -102
  129. data/app/views/layouts/decidim/admin/_language_chooser.html.erb +0 -14
  130. data/app/views/layouts/decidim/admin/_main_nav.html.erb +0 -11
@@ -1,4 +1,5 @@
1
1
  # frozen_string_literal: true
2
+
2
3
  module Decidim
3
4
  module Admin
4
5
  # A form object used to create participatory processes from the admin
@@ -1,4 +1,5 @@
1
1
  # frozen_string_literal: true
2
+
2
3
  module Decidim
3
4
  module Admin
4
5
  # A form object used to create participatory process groups from the admin
@@ -1,4 +1,5 @@
1
1
  # frozen_string_literal: true
2
+
2
3
  module Decidim
3
4
  module Admin
4
5
  # A form object used to create participatory processes steps from the admin
@@ -1,4 +1,5 @@
1
1
  # frozen_string_literal: true
2
+
2
3
  module Decidim
3
4
  module Admin
4
5
  # A form object used to create participatory process user roles from the
@@ -1,4 +1,5 @@
1
1
  # frozen_string_literal: true
2
+
2
3
  module Decidim
3
4
  module Admin
4
5
  # This form handles permissions for a particular action in the admin panel.
@@ -1,4 +1,5 @@
1
1
  # frozen_string_literal: true
2
+
2
3
  module Decidim
3
4
  module Admin
4
5
  # This form handles a set of forms related to handling permissions
@@ -1,4 +1,5 @@
1
1
  # frozen_string_literal: true
2
+
2
3
  module Decidim
3
4
  module Admin
4
5
  # A form object to create or update scopes.
@@ -1,4 +1,5 @@
1
1
  # frozen_string_literal: true
2
+
2
3
  module Decidim
3
4
  module Admin
4
5
  # A form object to create or update pages.
@@ -1,4 +1,5 @@
1
1
  # frozen_string_literal: true
2
+
2
3
  module Decidim
3
4
  module Admin
4
5
  # Custom helpers, scoped to the admin panel.
@@ -15,14 +16,6 @@ module Decidim
15
16
  current_organization.name
16
17
  end
17
18
 
18
- def admin_menu_item_to(name, url, options = {})
19
- content_tag :li, class: options[:active_class] || active_link_to_class(url, active: options[:active], class_active: "is-active") do
20
- active_link_to url, active: options[:active], class_active: "is-active" do
21
- icon(options[:icon_name] || name) + I18n.t("menu.#{name}", scope: "decidim.admin")
22
- end
23
- end
24
- end
25
-
26
19
  def foundation_datepicker_locale_tag
27
20
  if I18n.locale != :en
28
21
  javascript_include_tag "datepicker-locales/foundation-datepicker.#{I18n.locale}.js"
@@ -1,4 +1,5 @@
1
1
  # frozen_string_literal: true
2
+
2
3
  module Decidim
3
4
  module Admin
4
5
  # Custom helpers, scoped to the admin panel.
@@ -0,0 +1,18 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Decidim
4
+ module Admin
5
+ module ExportsHelper
6
+ # Renders an export dropdown for the provided feature, including an item
7
+ # for each exportable artifact and format.
8
+ #
9
+ # feature - The feature to render the export dropdown for. Defaults to the
10
+ # current feature.
11
+ #
12
+ # Returns a rendered dropdown.
13
+ def export_dropdown(feature = current_feature)
14
+ render partial: "decidim/admin/exports/dropdown", locals: { feature: feature }
15
+ end
16
+ end
17
+ end
18
+ end
@@ -1,4 +1,5 @@
1
1
  # frozen_string_literal: true
2
+
2
3
  module Decidim
3
4
  module Admin
4
5
  # This class contains helpers needed in order for feature settings to
@@ -1,4 +1,5 @@
1
1
  # frozen_string_literal: true
2
+
2
3
  module Decidim
3
4
  module Admin
4
5
  module IconLinkHelper
@@ -0,0 +1,18 @@
1
+ # encoding: utf-8
2
+ # frozen_string_literal: true
3
+
4
+ module Decidim
5
+ module Admin
6
+ # This module includes helpers to manage menus in admin layout
7
+ module MenuHelper
8
+ # Public: Returns the main menu presenter object
9
+ def main_menu
10
+ @main_menu ||= MenuPresenter.new(
11
+ :admin_menu,
12
+ self,
13
+ active_class: "is-active"
14
+ )
15
+ end
16
+ end
17
+ end
18
+ end
@@ -1,4 +1,5 @@
1
1
  # frozen_string_literal: true
2
+
2
3
  module Decidim
3
4
  module Admin
4
5
  # This class contains helpers needed to format ParticipatoryProcessGroups
@@ -1,4 +1,5 @@
1
1
  # frozen_string_literal: true
2
+
2
3
  module Decidim
3
4
  module Admin
4
5
  # This class contains helpers needed to format ParticipatoryProcesses
@@ -1,4 +1,5 @@
1
1
  # frozen_string_literal: true
2
+
2
3
  module Decidim
3
4
  module Admin
4
5
  # Custom ApplicationJob scoped to the admin panel.
@@ -1,4 +1,5 @@
1
1
  # frozen_string_literal: true
2
+
2
3
  module Decidim
3
4
  module Admin
4
5
  # Custom ApplicationJob scoped to the admin panel.
@@ -1,4 +1,5 @@
1
1
  # frozen_string_literal: true
2
+
2
3
  module Decidim
3
4
  module Admin
4
5
  # Custom ApplicationJob scoped to the admin panel.
@@ -1,4 +1,5 @@
1
1
  # frozen_string_literal: true
2
+
2
3
  module Decidim
3
4
  module Admin
4
5
  # Custom application mailer, scoped to the admin mailer.
@@ -1,4 +1,5 @@
1
1
  # frozen_string_literal: true
2
+
2
3
  module Decidim
3
4
  module Admin
4
5
  module Abilities
@@ -38,7 +39,7 @@ module Decidim
38
39
  user != user_to_destroy
39
40
  end
40
41
 
41
- can [:index, :verify], UserGroup
42
+ can [:index, :verify, :reject], UserGroup
42
43
  end
43
44
  end
44
45
  end
@@ -1,4 +1,5 @@
1
1
  # frozen_string_literal: true
2
+
2
3
  module Decidim
3
4
  module Admin
4
5
  module Abilities
@@ -1,4 +1,5 @@
1
1
  # frozen_string_literal: true
2
+
2
3
  module Decidim
3
4
  module Admin
4
5
  module Abilities
@@ -1,4 +1,5 @@
1
1
  # frozen_string_literal: true
2
+
2
3
  module Decidim
3
4
  module Admin
4
5
  module Abilities
@@ -1,4 +1,5 @@
1
1
  # frozen_string_literal: true
2
+
2
3
  module Decidim
3
4
  module Admin
4
5
  # Custom ApplicationRecord scoped to the Admin panel.
@@ -1,11 +1,12 @@
1
1
  # frozen_string_literal: true
2
+
2
3
  module Decidim
3
4
  module Admin
4
5
  # Defines a relation between a user and a participatory process, and what
5
6
  # kind of relation does the user has.
6
7
  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
8
+ belongs_to :user, foreign_key: "decidim_user_id", class_name: "Decidim::User"
9
+ belongs_to :participatory_process, foreign_key: "decidim_participatory_process_id", class_name: "Decidim::ParticipatoryProcess"
9
10
 
10
11
  ROLES = %w(admin collaborator).freeze
11
12
  validates :role, inclusion: { in: ROLES }, uniqueness: { scope: [:user, :participatory_process] }
@@ -1,4 +1,5 @@
1
1
  # frozen_string_literal: true
2
+
2
3
  module Decidim
3
4
  module Admin
4
5
  # A class used to find the ParticipatoryProcesses that the given user can
@@ -1,4 +1,5 @@
1
1
  # frozen_string_literal: true
2
+
2
3
  module Decidim
3
4
  module Admin
4
5
  # A class used to find the roles of the users that can manage a given
@@ -1,4 +1,5 @@
1
1
  # frozen_string_literal: true
2
+
2
3
  module Decidim
3
4
  module Admin
4
5
  # A class used to find the admins for a participatory process including
@@ -0,0 +1,54 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Decidim
4
+ module Admin
5
+ # A class used to find the ParticipatoryProcesses that the given user can
6
+ # manage.
7
+ class UserGroupsEvaluation < Rectify::Query
8
+ # Syntactic sugar to initialize the class and return the queried objects.
9
+ #
10
+ # user - a User Group that needs to be listed.
11
+ def self.for(user_groups, q = nil, state = nil)
12
+ new(user_groups, q, state).query
13
+ end
14
+
15
+ # Initializes the class.
16
+ #
17
+ # user_group - a User groups that need to be lsited
18
+ def initialize(user_groups, q = nil, state = nil)
19
+ @user_groups = user_groups
20
+ @q = q
21
+ @state = state
22
+ end
23
+
24
+ # List the User groups by the diferents filters.
25
+ def query
26
+ @user_groups = filter_by_search(@user_groups)
27
+ @user_groups = filter_by_state(@user_groups)
28
+ @user_groups
29
+ end
30
+
31
+ private
32
+
33
+ attr_reader :user_group
34
+
35
+ def filter_by_search(user_groups)
36
+ return user_groups if @q.blank?
37
+ user_groups.where("LOWER(name) LIKE LOWER('%#{@q}%')")
38
+ end
39
+
40
+ def filter_by_state(user_groups)
41
+ case @state
42
+ when "verified"
43
+ user_groups.where.not(verified_at: nil)
44
+ when "rejected"
45
+ user_groups.where.not(rejected_at: nil)
46
+ when "pending"
47
+ user_groups.where(verified_at: nil, rejected_at: nil)
48
+ else
49
+ user_groups
50
+ end
51
+ end
52
+ end
53
+ end
54
+ end
@@ -0,0 +1,10 @@
1
+ <button class="exports dropdown tiny button button--simple" data-toggle="export-dropdown"><%= t "actions.export", scope: "decidim.admin" %></button>
2
+ <div class="dropdown-pane" id="export-dropdown" data-dropdown data-auto-focus="true" data-close-on-click="true">
3
+ <ul class="vertical menu add-features">
4
+ <% feature.manifest.export_manifests.each do |manifest| %>
5
+ <% %w{csv json}.each do |format| %>
6
+ <li class="exports--format--<%= format %> exports--<%= manifest.name %>"><%= link_to t("decidim.admin.exports.export_as", name: t("decidim.#{feature.manifest.name}.admin.exports.#{manifest.name}"), export_format: format.upcase), decidim_admin.participatory_process_feature_exports_path(feature_id: feature, participatory_process_id: feature.participatory_process, format: format, id: manifest.name), method: :post %></li>
7
+ <% end %>
8
+ <% end %>
9
+ </ul>
10
+ </div>
@@ -0,0 +1,38 @@
1
+ <div class="card" id="processes">
2
+ <div class="card-divider">
3
+ <h2 class="card-title"><%= title %></h2>
4
+ </div>
5
+
6
+ <div class="card-section">
7
+ <div class="row column">
8
+ <div class="row">
9
+ <div class="column xlarge-8">
10
+ <%= form.translated :text_field, :title, autofocus: true %>
11
+ </div>
12
+ <div class="column xlarge-4">
13
+ <%= form.text_field :slug %>
14
+ </div>
15
+ </div>
16
+ <div class="card">
17
+ <div class="card-divider">
18
+ <legend><%= select %></legend>
19
+ </div>
20
+ <div class="card-section">
21
+ <div class="row">
22
+ <div class="columns xlarge-3">
23
+ <%= form.check_box :copy_steps %>
24
+ </div>
25
+
26
+ <div class="columns xlarge-3">
27
+ <%= form.check_box :copy_categories %>
28
+ </div>
29
+
30
+ <div class="columns xlarge-6">
31
+ <%= form.check_box :copy_features %>
32
+ </div>
33
+ </div>
34
+ </div>
35
+ </div>
36
+ </div>
37
+ </div>
38
+ </div>
@@ -0,0 +1,7 @@
1
+ <%= decidim_form_for(@form, url: participatory_process_copies_path(participatory_process), method: :post, html: { class: "form copy_participatory_process" }) do |f| %>
2
+ <%= render partial: 'form', object: f, locals: { title: t('.title'), select: t('.select')} %>
3
+
4
+ <div class="button--double form-general-submit">
5
+ <%= f.submit t(".copy") %>
6
+ </div>
7
+ <% end %>
@@ -37,6 +37,8 @@
37
37
  <% end %>
38
38
  </td>
39
39
  <td class="table-list__actions">
40
+ <%= icon_link_to "clipboard", new_participatory_process_copy_path(process), t("actions.duplicate", scope: "decidim.admin"), class: "action-icon--copy" %>
41
+
40
42
  <% if can? :update, process %>
41
43
  <%= icon_link_to "pencil", edit_participatory_process_path(process), t("actions.configure", scope: "decidim.admin"), class: "action-icon--new" %>
42
44
  <% end %>
@@ -1,4 +1,3 @@
1
-
2
1
  <%= decidim_form_for(@form) do |f| %>
3
2
  <div class="card">
4
3
  <div class="card-divider">
@@ -1,4 +1,42 @@
1
- <div class="card">
1
+ <div class="filters row">
2
+ <div class="column medium-3">
3
+ <span class="dropdown-menu-inverted_label"><%= t(".filter_by") %> :</span>
4
+ <ul class="dropdown menu dropdown-inverted" data-dropdown-menu data-close-on-click-inside="false">
5
+ <li class="is-dropdown-submenu-parent">
6
+ <a href="#">
7
+ <% if @state.present? %>
8
+ <%= t(".filter.#{@state}") %>
9
+ <% else %>
10
+ <%= t(".filter.all") %>
11
+ <% end %>
12
+ </a>
13
+ <ul class="menu is-dropdown-submenu">
14
+ <li><%= link_to t(".filter.pending"), url_for(state: "pending", q: @query) %></li>
15
+ <li><%= link_to t(".filter.rejected"), url_for(state: "rejected", q: @query) %></li>
16
+ <li><%= link_to t(".filter.verified"), url_for(state: "verified", q: @query) %></li>
17
+ <li><%= link_to t(".filter.all"), url_for(q: @query) %></li>
18
+ </ul>
19
+ </li>
20
+ </ul>
21
+ </div>
22
+ <div class="column medium-4">
23
+ <%= form_tag "", method: :get do %>
24
+ <div class="filters__search">
25
+ <div class="input-group">
26
+ <%= search_field_tag :q, @query,label: false, class: "input-group-field", placeholder: t('.search') %>
27
+ <%= hidden_field_tag :state, @state %>
28
+ <div class="input-group-button">
29
+ <button type="submit" class="button button--muted">
30
+ <%= icon "magnifying-glass", aria_label: t('.search') %>
31
+ </button>
32
+ </div>
33
+ </div>
34
+ </div>
35
+ <% end %>
36
+ </div>
37
+ </div>
38
+
39
+ <div class="card" id='user-groups'>
2
40
  <div class="card-divider">
3
41
  <h2 class="card-title"><%= t "decidim.admin.titles.user_groups" %></h2>
4
42
  </div>
@@ -12,7 +50,8 @@
12
50
  <th><%= t("models.user_group.fields.phone", scope: "decidim.admin") %></th>
13
51
  <th><%= t("models.user_group.fields.users_count", scope: "decidim.admin") %></th>
14
52
  <th><%= t("models.user_group.fields.created_at", scope: "decidim.admin") %></th>
15
- <th></th>
53
+ <th><%= t("models.user_group.fields.state", scope: "decidim.admin") %></th>
54
+ <th><%= t("models.user_group.fields.actions", scope: "decidim.admin") %></th>
16
55
  </tr>
17
56
  </thead>
18
57
  <tbody>
@@ -23,9 +62,32 @@
23
62
  <td><%= user_group.phone %></td>
24
63
  <td><%= user_group.users.size %></td>
25
64
  <td><%= l user_group.created_at, format: :short %></td>
26
- <td class="text-right">
27
- <% if can?(:verify, user_group) && !user_group.verified? %>
28
- <%= link_to t("actions.verify", scope: "decidim.admin"), decidim_admin.verify_user_group_path(user_group), method: :put, class: "button tiny" %>
65
+ <td>
66
+ <% if user_group.verified? %>
67
+ <%= t(".state.verified") %>
68
+ <% end %>
69
+ <% if user_group.rejected? %>
70
+ <%= t(".state.rejected") %>
71
+ <% end %>
72
+ <% if user_group.pending?%>
73
+ <%= t(".state.pending") %>
74
+ <% end %>
75
+ </td>
76
+ <td class="table-list__actions">
77
+ <% if can?(:verify, user_group) %>
78
+ <% if !user_group.verified? %>
79
+ <%= icon_link_to "circle-check", decidim_admin.verify_user_group_path(user_group), t("actions.verify", scope: "decidim.admin"), method: :put, class: "action-icon--verify" %>
80
+ <% else %>
81
+ <%= icon "circle-check", class: "action-icon action-icon--disabled" %>
82
+ <% end %>
83
+ <% end %>
84
+
85
+ <% if can?(:reject, user_group) %>
86
+ <% if !user_group.rejected? %>
87
+ <%= icon_link_to "circle-x", decidim_admin.reject_user_group_path(user_group), t("actions.reject", scope: "decidim.admin"), method: :put, class: "action-icon--reject" %>
88
+ <% else %>
89
+ <%= icon "circle-x", class: "action-icon action-icon--disabled" %>
90
+ <% end %>
29
91
  <% end %>
30
92
  </td>
31
93
  </tr>