decidim-sortitions 0.27.4 → 0.28.0.rc5

Sign up to get free protection for your applications and to get access to all the features.
Files changed (84) hide show
  1. checksums.yaml +4 -4
  2. data/app/cells/decidim/sortitions/sortition_cell.rb +1 -1
  3. data/app/cells/decidim/sortitions/sortition_l_cell.rb +26 -0
  4. data/app/cells/decidim/sortitions/sortition_metadata_cell.rb +66 -0
  5. data/app/commands/decidim/sortitions/admin/create_sortition.rb +2 -2
  6. data/app/commands/decidim/sortitions/admin/destroy_sortition.rb +1 -1
  7. data/app/commands/decidim/sortitions/admin/update_sortition.rb +1 -1
  8. data/app/controllers/decidim/sortitions/admin/sortitions_controller.rb +11 -11
  9. data/app/controllers/decidim/sortitions/sortitions_controller.rb +0 -1
  10. data/app/helpers/decidim/sortitions/admin/sortitions_helper.rb +1 -0
  11. data/app/helpers/decidim/sortitions/sortitions_helper.rb +25 -1
  12. data/app/models/decidim/sortitions/sortition.rb +3 -3
  13. data/app/packs/entrypoints/decidim_sortitions.js +3 -0
  14. data/app/packs/stylesheets/sortitions.scss +31 -0
  15. data/app/presenters/decidim/sortitions/admin_log/sortition_presenter.rb +2 -2
  16. data/app/queries/decidim/sortitions/admin/participatory_space_proposal_components.rb +1 -1
  17. data/app/views/decidim/sortitions/admin/sortitions/_form.html.erb +29 -31
  18. data/app/views/decidim/sortitions/admin/sortitions/confirm_destroy.html.erb +24 -15
  19. data/app/views/decidim/sortitions/admin/sortitions/edit.html.erb +26 -22
  20. data/app/views/decidim/sortitions/admin/sortitions/index.html.erb +47 -54
  21. data/app/views/decidim/sortitions/admin/sortitions/new.html.erb +16 -10
  22. data/app/views/decidim/sortitions/admin/sortitions/show.html.erb +42 -46
  23. data/app/views/decidim/sortitions/sortitions/_proposal.html.erb +1 -1
  24. data/app/views/decidim/sortitions/sortitions/_results_count.html.erb +3 -3
  25. data/app/views/decidim/sortitions/sortitions/_sortitions.html.erb +10 -11
  26. data/app/views/decidim/sortitions/sortitions/_tags.html.erb +0 -1
  27. data/app/views/decidim/sortitions/sortitions/index.html.erb +14 -17
  28. data/app/views/decidim/sortitions/sortitions/index.js.erb +0 -5
  29. data/app/views/decidim/sortitions/sortitions/show.html.erb +123 -118
  30. data/config/environment.rb +3 -0
  31. data/config/locales/ar.yml +2 -24
  32. data/config/locales/ca.yml +9 -20
  33. data/config/locales/cs.yml +8 -23
  34. data/config/locales/de.yml +10 -21
  35. data/config/locales/el.yml +6 -19
  36. data/config/locales/en.yml +14 -25
  37. data/config/locales/es-MX.yml +9 -20
  38. data/config/locales/es-PY.yml +9 -20
  39. data/config/locales/es.yml +9 -20
  40. data/config/locales/eu.yml +27 -34
  41. data/config/locales/fi-plain.yml +7 -20
  42. data/config/locales/fi.yml +10 -23
  43. data/config/locales/fr-CA.yml +7 -20
  44. data/config/locales/fr.yml +10 -21
  45. data/config/locales/ga-IE.yml +0 -6
  46. data/config/locales/gl.yml +2 -22
  47. data/config/locales/hu.yml +2 -22
  48. data/config/locales/id-ID.yml +2 -19
  49. data/config/locales/is-IS.yml +2 -18
  50. data/config/locales/it.yml +2 -21
  51. data/config/locales/ja.yml +7 -19
  52. data/config/locales/lt.yml +6 -22
  53. data/config/locales/lv.yml +2 -22
  54. data/config/locales/nl.yml +2 -21
  55. data/config/locales/no.yml +2 -21
  56. data/config/locales/pl.yml +2 -23
  57. data/config/locales/pt-BR.yml +2 -22
  58. data/config/locales/pt.yml +2 -21
  59. data/config/locales/ro-RO.yml +5 -21
  60. data/config/locales/ru.yml +2 -22
  61. data/config/locales/sk.yml +2 -23
  62. data/config/locales/sq-AL.yml +1 -0
  63. data/config/locales/sr-CS.yml +0 -6
  64. data/config/locales/sv.yml +2 -21
  65. data/config/locales/th-TH.yml +1 -0
  66. data/config/locales/tr-TR.yml +3 -21
  67. data/config/locales/uk.yml +2 -22
  68. data/config/locales/zh-CN.yml +2 -20
  69. data/config/locales/zh-TW.yml +5 -18
  70. data/lib/decidim/sortitions/component.rb +6 -8
  71. data/lib/decidim/sortitions/engine.rb +8 -3
  72. data/lib/decidim/sortitions/seeds.rb +24 -0
  73. data/lib/decidim/sortitions/test/factories.rb +2 -1
  74. data/lib/decidim/sortitions/version.rb +1 -1
  75. metadata +29 -27
  76. data/app/cells/decidim/sortitions/sortition_m/data.erb +0 -15
  77. data/app/cells/decidim/sortitions/sortition_m/footer.erb +0 -13
  78. data/app/cells/decidim/sortitions/sortition_m_cell.rb +0 -55
  79. data/app/controllers/decidim/sortitions/widgets_controller.rb +0 -20
  80. data/app/packs/stylesheets/decidim/sortitions/_sortitions.scss +0 -49
  81. data/app/views/decidim/sortitions/sortition_widgets/show.html.erb +0 -4
  82. data/app/views/decidim/sortitions/sortitions/_filters.html.erb +0 -39
  83. data/app/views/decidim/sortitions/sortitions/_filters_small_view.html.erb +0 -18
  84. data/app/views/decidim/sortitions/sortitions/_sortitions_count.html.erb +0 -1
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 074e2509c41ebe41cf98ac0492fe2dedab356bf835858a155fb50d7dcc4f9785
4
- data.tar.gz: 8a64a92fd78a6790744bedbe39c5194068a71a96e33a11ae3ade1ede5f9239e7
3
+ metadata.gz: b752bd537322391e9eef685c8b24df7db576e68da1724ad333d9f12f8660da02
4
+ data.tar.gz: 64f3be1146e837aa0d63d9de6ccb403f12ba5e001bc7ba5f95c4d02f5395cc9d
5
5
  SHA512:
6
- metadata.gz: 37a6cb3e8ed1bfdddba0405fb78965cc40d7858ad632a065678cec74f026f83b8a15b804abe6dcd4bd639c797ec6ae0e7df8d68ba413395b9a723613699c1c93
7
- data.tar.gz: 74c61a532bf9688ba8608e0e1ec608bb4409e7ce65e1dd0ec3ed23a35d1e1f9b78dadb4dd73928799d0057006ccfa55acdc69f3b92b22ceceb3159db67da3b88
6
+ metadata.gz: 16d549e378742e762d96cc60e68e73171b44869ad7fced9a837b7063c033cf168caef0983278a710686edfaad7dff72bfb552747ee6879b243c5cbaca89e5325
7
+ data.tar.gz: 39552eb7e17285cc6c666a42b4385a9ef5ff800007bb32067f94be3524c6e7ff2d3f1ad308f1f515962c269fa129a3ccb7b7ea3e24741d0f5754103a03940377
@@ -14,7 +14,7 @@ module Decidim
14
14
  private
15
15
 
16
16
  def card_size
17
- "decidim/sortitions/sortition_m"
17
+ "decidim/sortitions/sortition_l"
18
18
  end
19
19
  end
20
20
  end
@@ -0,0 +1,26 @@
1
+ # frozen_string_literal: true
2
+
3
+ require "cell/partial"
4
+
5
+ module Decidim
6
+ module Sortitions
7
+ # This cell renders a sortition with its L-size card.
8
+ class SortitionLCell < Decidim::CardLCell
9
+ include Decidim::Sortitions::Engine.routes.url_helpers
10
+
11
+ private
12
+
13
+ def has_author?
14
+ false
15
+ end
16
+
17
+ def has_state?
18
+ true
19
+ end
20
+
21
+ def metadata_cell
22
+ "decidim/sortitions/sortition_metadata"
23
+ end
24
+ end
25
+ end
26
+ end
@@ -0,0 +1,66 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Decidim
4
+ module Sortitions
5
+ # This cell renders the assembly metadata for l card
6
+ class SortitionMetadataCell < Decidim::CardMetadataCell
7
+ include Decidim::Sortitions::SortitionsHelper
8
+
9
+ delegate :state, to: :model
10
+
11
+ def initialize(*)
12
+ super
13
+
14
+ @items.prepend(*sortition_items)
15
+ end
16
+
17
+ def sortition_items
18
+ [count_item, seed_item, badge_item]
19
+ end
20
+
21
+ def count_item
22
+ {
23
+ text: data_with_text(proposals_count, t("decidim.sortitions.sortitions.sortition.selected_proposals", count: proposals_count)),
24
+ icon: "chat-new-line"
25
+ }
26
+ end
27
+
28
+ def seed_item
29
+ {
30
+ text: data_with_text(model.seed, t("random_seed", scope: "decidim.sortitions.sortitions.sortition")),
31
+ icon: "seedling-line"
32
+ }
33
+ end
34
+
35
+ def badge_item
36
+ {
37
+ text: content_tag(:span, class: "label #{state_classes}") { badge_name }
38
+ }
39
+ end
40
+
41
+ def has_badge?
42
+ false
43
+ end
44
+
45
+ def badge_name
46
+ return t("filters.cancelled", scope: "decidim.sortitions.sortitions") if model.cancelled?
47
+
48
+ t("filters.active", scope: "decidim.sortitions.sortitions")
49
+ end
50
+
51
+ def data_with_text(data, text)
52
+ "#{content_tag(:strong) { data }}#{content_tag(:span) { text }}".html_safe
53
+ end
54
+
55
+ def state_classes
56
+ return "alert" if model.cancelled?
57
+
58
+ "success"
59
+ end
60
+
61
+ def proposals_count
62
+ @proposals_count = model.proposals.count
63
+ end
64
+ end
65
+ end
66
+ end
@@ -15,7 +15,7 @@ module Decidim
15
15
  # Executes the command. Broadcasts these events:
16
16
  #
17
17
  # - :ok when everything is valid.
18
- # - :invalid if the form wasn't valid and we couldn't proceed.
18
+ # - :invalid if the form was not valid and we could not proceed.
19
19
  #
20
20
  # Returns nothing.
21
21
  def call
@@ -49,7 +49,7 @@ module Decidim
49
49
  additional_info: form.additional_info,
50
50
  selected_proposals: [],
51
51
  candidate_proposals: [],
52
- category: category
52
+ category:
53
53
  )
54
54
  end
55
55
 
@@ -15,7 +15,7 @@ module Decidim
15
15
  # Executes the command. Broadcasts these events:
16
16
  #
17
17
  # - :ok when everything is valid.
18
- # - :invalid if the form wasn't valid and we couldn't proceed.
18
+ # - :invalid if the form was not valid and we could not proceed.
19
19
  #
20
20
  # Returns nothing.
21
21
  def call
@@ -15,7 +15,7 @@ module Decidim
15
15
  # Executes the command. Broadcasts these events:
16
16
  #
17
17
  # - :ok when everything is valid.
18
- # - :invalid if the form wasn't valid and we couldn't proceed.
18
+ # - :invalid if the form was not valid and we could not proceed.
19
19
  #
20
20
  # Returns nothing.
21
21
  def call
@@ -12,19 +12,19 @@ module Decidim
12
12
  def index; end
13
13
 
14
14
  def show
15
- enforce_permission_to :read, :sortition, sortition: sortition
15
+ enforce_permission_to :read, :sortition, sortition:
16
16
  end
17
17
 
18
18
  def edit
19
- enforce_permission_to :update, :sortition, sortition: sortition
19
+ enforce_permission_to(:update, :sortition, sortition:)
20
20
 
21
- @form = edit_sortition_form.from_model(sortition, current_participatory_space: current_participatory_space)
21
+ @form = edit_sortition_form.from_model(sortition, current_participatory_space:)
22
22
  end
23
23
 
24
24
  def update
25
- enforce_permission_to :update, :sortition, sortition: sortition
25
+ enforce_permission_to(:update, :sortition, sortition:)
26
26
 
27
- @form = edit_sortition_form.from_params(params, current_participatory_space: current_participatory_space)
27
+ @form = edit_sortition_form.from_params(params, current_participatory_space:)
28
28
  UpdateSortition.call(@form) do
29
29
  on(:ok) do |_sortition|
30
30
  flash[:notice] = I18n.t("sortitions.update.success", scope: "decidim.sortitions.admin")
@@ -41,13 +41,13 @@ module Decidim
41
41
  def new
42
42
  enforce_permission_to :create, :sortition
43
43
 
44
- @form = sortition_form.instance(current_participatory_space: current_participatory_space)
44
+ @form = sortition_form.instance(current_participatory_space:)
45
45
  end
46
46
 
47
47
  def create
48
48
  enforce_permission_to :create, :sortition
49
49
 
50
- @form = sortition_form.from_params(params, current_participatory_space: current_participatory_space)
50
+ @form = sortition_form.from_params(params, current_participatory_space:)
51
51
  CreateSortition.call(@form) do
52
52
  on(:ok) do |sortition|
53
53
  flash[:notice] = I18n.t("sortitions.create.success", scope: "decidim.sortitions.admin")
@@ -62,15 +62,15 @@ module Decidim
62
62
  end
63
63
 
64
64
  def confirm_destroy
65
- enforce_permission_to :destroy, :sortition, sortition: sortition
65
+ enforce_permission_to(:destroy, :sortition, sortition:)
66
66
 
67
- @form = destroy_sortition_form.from_model(sortition, current_participatory_space: current_participatory_space)
67
+ @form = destroy_sortition_form.from_model(sortition, current_participatory_space:)
68
68
  end
69
69
 
70
70
  def destroy
71
- enforce_permission_to :destroy, :sortition, sortition: sortition
71
+ enforce_permission_to(:destroy, :sortition, sortition:)
72
72
 
73
- @form = destroy_sortition_form.from_params(params, current_participatory_space: current_participatory_space)
73
+ @form = destroy_sortition_form.from_params(params, current_participatory_space:)
74
74
  DestroySortition.call(@form) do
75
75
  on(:ok) do |_sortition|
76
76
  flash[:notice] = I18n.t("sortitions.destroy.success", scope: "decidim.sortitions.admin")
@@ -4,7 +4,6 @@ module Decidim
4
4
  module Sortitions
5
5
  # Exposes the sortition resource so users can view them
6
6
  class SortitionsController < Decidim::Sortitions::ApplicationController
7
- helper Decidim::WidgetUrlsHelper
8
7
  include FilterResource
9
8
  include Decidim::Sortitions::Orderable
10
9
  include Paginable
@@ -5,6 +5,7 @@ module Decidim
5
5
  module Admin
6
6
  module SortitionsHelper
7
7
  include Decidim::TranslationsHelper
8
+ include Decidim::PaginateHelper
8
9
 
9
10
  # Converst a list of components into a list of selectable options
10
11
  def components_options(components)
@@ -10,6 +10,10 @@ module Decidim
10
10
  EngineRouter.main_proxy(proposal.component).proposal_path(proposal)
11
11
  end
12
12
 
13
+ def component_name
14
+ (defined?(current_component) && translated_attribute(current_component&.name).presence) || t("decidim.components.sortitions.name")
15
+ end
16
+
13
17
  # Generates the sortition category label
14
18
  def sortition_category_label(sortition)
15
19
  if sortition.category.present?
@@ -32,7 +36,27 @@ module Decidim
32
36
  end
33
37
  end
34
38
 
35
- result.join(", ").html_safe
39
+ result.join(" - ").html_safe
40
+ end
41
+
42
+ def filter_sections_sortitions
43
+ sections = [{ method: :with_any_state, collection: filter_state_values, label_scope: "decidim.sortitions.sortitions.filters", id: "state" }]
44
+ if current_participatory_space.categories.any?
45
+ sections.append(
46
+ method: :with_category,
47
+ collection: filter_categories_values,
48
+ label_scope: "decidim.sortitions.sortitions.filters", id: "category"
49
+ )
50
+ end
51
+ sections.reject { |item| item[:collection].blank? }
52
+ end
53
+
54
+ def filter_state_values
55
+ [
56
+ ["all", t("all", scope: "decidim.sortitions.sortitions.filters")],
57
+ ["active", t("active", scope: "decidim.sortitions.sortitions.filters")],
58
+ ["cancelled", t("cancelled", scope: "decidim.sortitions.sortitions.filters")]
59
+ ]
36
60
  end
37
61
  end
38
62
  end
@@ -41,10 +41,10 @@ module Decidim
41
41
  end
42
42
 
43
43
  def similar_count
44
- Sortition.where(component: component)
45
- .where(decidim_proposals_component: decidim_proposals_component)
44
+ Sortition.where(component:)
45
+ .where(decidim_proposals_component:)
46
46
  .with_category(category&.id)
47
- .where(target_items: target_items)
47
+ .where(target_items:)
48
48
  .count
49
49
  end
50
50
 
@@ -1,2 +1,5 @@
1
1
  // Images
2
2
  require.context("../images", true)
3
+
4
+ // CSS
5
+ import "stylesheets/sortitions.scss"
@@ -0,0 +1,31 @@
1
+ .sortition {
2
+ &__aside-element {
3
+ &-item {
4
+ @apply border-b border-gray-3 py-4 first:pt-0 last:pb-0 last:border-b-0;
5
+ }
6
+
7
+ &-item__title {
8
+ @apply text-sm block text-gray-2 mb-1;
9
+ }
10
+
11
+ &-item__text {
12
+ @apply text-md block font-semibold text-gray-2;
13
+ }
14
+
15
+ &-item__numbers {
16
+ @apply text-md block text-gray-2;
17
+ }
18
+ }
19
+
20
+ &__aside__count-number {
21
+ @apply text-5xl block text-center text-gray-2 font-bold;
22
+ }
23
+
24
+ &__aside__count-text {
25
+ @apply text-gray-2 text-sm block text-center;
26
+ }
27
+ }
28
+
29
+ a.sortition__aside-element-item__title {
30
+ @apply text-secondary underline;
31
+ }
@@ -6,8 +6,8 @@ module Decidim
6
6
  # This class holds the logic to present a `Decidim::Sortitions::Sortition`
7
7
  # for the `AdminLog` log.
8
8
  #
9
- # Usage should be automatic and you shouldn't need to call this class
10
- # directly, but here's an example:
9
+ # Usage should be automatic and you should not need to call this class
10
+ # directly, but here is an example:
11
11
  #
12
12
  # action_log = Decidim::ActionLog.last
13
13
  # view_helpers # => this comes from the views
@@ -20,7 +20,7 @@ module Decidim
20
20
 
21
21
  def query
22
22
  Component
23
- .where(participatory_space: participatory_space, manifest_name: "proposals")
23
+ .where(participatory_space:, manifest_name: "proposals")
24
24
  .published
25
25
  end
26
26
  end
@@ -1,40 +1,38 @@
1
- <div class="card">
2
- <div class="card-divider">
3
- <h2 class="card-title"><%= t ".title" %></h2>
4
- </div>
5
-
6
- <div class="card-section">
7
- <div class="row">
8
- <div class="columns xlarge-12">
9
- <%= form.translated :text_field, :title, autofocus: true %>
10
- </div>
1
+ <div class="form__wrapper">
2
+ <div class="card pt-4">
3
+ <div class="card-section">
4
+ <div class="row">
5
+ <div class="columns">
6
+ <%= form.translated :text_field, :title, autofocus: true, aria: { label: :title } %>
7
+ </div>
11
8
 
12
- <div class="columns xlarge-4">
13
- <%= form.select :decidim_proposals_component_id,
14
- components_options(proposal_components),
15
- prompt: t(".select_proposal_component") %>
16
- </div>
9
+ <div class="columns">
10
+ <%= form.select :decidim_proposals_component_id,
11
+ components_options(proposal_components),
12
+ prompt: t(".select_proposal_component") %>
13
+ </div>
17
14
 
18
- <div class="columns xlarge-4">
19
- <%= form.categories_select :decidim_category_id,
20
- @form.categories,
21
- include_blank: t(".all_categories") %>
22
- </div>
15
+ <div class="columns">
16
+ <%= form.categories_select :decidim_category_id,
17
+ @form.categories,
18
+ include_blank: t(".all_categories") %>
19
+ </div>
23
20
 
24
- <div class="columns xlarge-4">
25
- <%= form.number_field :target_items, min: 1, step: 1 %>
26
- </div>
21
+ <div class="columns">
22
+ <%= form.number_field :target_items, min: 1, step: 1 %>
23
+ </div>
27
24
 
28
- <div class="columns xlarge-12">
29
- <%= form.translated :editor, :witnesses, lines: 10, toolbar: :content %>
30
- </div>
25
+ <div class="columns">
26
+ <%= form.translated :editor, :witnesses, lines: 10, toolbar: :content, aria: { label: :witnesses } %>
27
+ </div>
31
28
 
32
- <div class="columns xlarge-12">
33
- <%= form.translated :editor, :additional_info, lines: 10 %>
34
- </div>
29
+ <div class="columns">
30
+ <%= form.translated :editor, :additional_info, lines: 10, aria: { label: :additional_info } %>
31
+ </div>
35
32
 
36
- <div class="columns xlarge-2">
37
- <%= form.number_field :dice, min: 1, max: 6, step: 1 %>
33
+ <div class="columns">
34
+ <%= form.number_field :dice, min: 1, max: 6, step: 1 %>
35
+ </div>
38
36
  </div>
39
37
  </div>
40
38
  </div>
@@ -1,22 +1,31 @@
1
1
  <% add_decidim_page_title(t(".title")) %>
2
- <h2 class="process-title-summary"><%= t ".title" %></h2>
3
2
 
4
- <%= decidim_form_for(@form, html: { class: "form confirm_destroy_sortition" }, method: :delete) do |form| %>
5
- <div class="card">
6
- <div class="card-divider">
7
- <h2 class="card-title"><%= decidim_html_escape(translated_attribute(sortition.title)) %></h2>
8
- </div>
3
+ <div class="item_show__header">
4
+ <h2 class="item_show__header-title">
5
+ <%= t(".title") %>
6
+ </h2>
7
+ </div>
9
8
 
10
- <div class="card-section">
11
- <div class="row">
12
- <div class="columns xlarge-12">
13
- <%= form.translated :editor, :cancel_reason, lines: 10, toolbar: :content %>
9
+ <div class="item__edit item__edit-1col">
10
+ <div class="item__edit-form">
11
+ <%= decidim_form_for(@form, html: { class: "form form-defaults confirm_destroy_sortition" }, method: :delete) do |form| %>
12
+ <div class="form__wrapper">
13
+ <div class="card pt-4">
14
+ <div class="card-section">
15
+ <div class="row">
16
+ <div class="columns">
17
+ <%= form.translated :editor, :cancel_reason, lines: 10, toolbar: :content, aria: { label: :cancel_reason } %>
18
+ </div>
19
+ </div>
20
+ </div>
14
21
  </div>
15
22
  </div>
16
- </div>
17
- </div>
18
23
 
19
- <div class="button--double form-general-submit">
20
- <%= form.submit t(".destroy"), data: { confirm: t(".confirm_destroy") } %>
24
+ <div class="item__edit-sticky">
25
+ <div class="item__edit-sticky-container">
26
+ <%= form.submit t(".destroy"), data: { confirm: t(".confirm_destroy") }, class: "button button__sm button__secondary" %>
27
+ </div>
28
+ </div>
29
+ <% end %>
21
30
  </div>
22
- <% end %>
31
+ </div>
@@ -1,28 +1,32 @@
1
1
  <% add_decidim_page_title(translated_attribute(sortition.title)) %>
2
- <h2 class="process-title-summary">
3
- <%= decidim_html_escape(translated_attribute(sortition.title)) %>
4
- </h2>
2
+ <div class="item_show__header">
3
+ <h2 class="item_show__header-title">
4
+ <%= t ".title" %>
5
+ </h2>
6
+ </div>
7
+ <div class="item__edit item__edit-1col">
8
+ <div class="item__edit-form">
9
+ <%= decidim_form_for(@form, html: { class: "form-defaults form edit_sortition" }) do |form| %>
10
+ <div class="form__wrapper">
11
+ <div class="card pt-4">
12
+ <div class="card-section">
13
+ <div class="row">
14
+ <div class="columns">
15
+ <%= form.translated :text_field, :title, autofocus: true, aria: { label: :title } %>
16
+ </div>
5
17
 
6
- <%= decidim_form_for(@form, html: { class: "form edit_sortition" }) do |form| %>
7
- <div class="card">
8
- <div class="card-divider">
9
- <h2 class="card-title"><%= t ".title" %></h2>
10
- </div>
11
-
12
- <div class="card-section">
13
- <div class="row">
14
- <div class="columns xlarge-12">
15
- <%= form.translated :text_field, :title, autofocus: true %>
18
+ <div class="columns">
19
+ <%= form.translated :editor, :additional_info, lines: 10, aria: { label: :additional_info } %>
20
+ </div>
21
+ </div>
22
+ </div>
16
23
  </div>
17
-
18
- <div class="columns xlarge-12">
19
- <%= form.translated :editor, :additional_info, lines: 10 %>
24
+ <div class="item__edit-sticky">
25
+ <div class="item__edit-sticky-container">
26
+ <%= form.submit t(".update"), class: "button button__sm button__secondary" %>
27
+ </div>
20
28
  </div>
21
29
  </div>
22
- </div>
23
- </div>
24
-
25
- <div class="button--double form-general-submit">
26
- <%= form.submit t(".update") %>
30
+ <% end %>
27
31
  </div>
28
- <% end %>
32
+ </div>
@@ -1,64 +1,57 @@
1
1
  <% add_decidim_page_title(t(".title")) %>
2
2
  <div class="card">
3
- <div class="card-divider">
4
- <h2 class="card-title">
3
+ <div class="item_show__header">
4
+ <h2 class="item_show__header-title">
5
5
  <%= t(".title") %>
6
- <div class="button--title">
7
- <% if allowed_to? :create, :sortition %>
8
- <%= link_to t("actions.new", scope: "decidim.sortitions.admin", name: t("models.sortition.name", scope: "decidim.sortitions.admin")), new_sortition_path, class: "button tiny button--simple" %>
9
- <% end %>
10
- </div>
6
+ <% if allowed_to? :create, :sortition %>
7
+ <%= link_to t("actions.new_sortition", scope: "decidim.sortitions.admin"), new_sortition_path, class: "button button__sm button__secondary" %>
8
+ <% end %>
9
+ <%= render partial: "decidim/admin/components/resource_action" %>
11
10
  </h2>
12
11
  </div>
12
+ <div class="table-scroll">
13
+ <table class="table-list">
14
+ <thead>
15
+ <tr>
16
+ <th><%= t("models.sortition.fields.reference", scope: "decidim.sortitions.admin") %></th>
17
+ <th><%= t("models.sortition.fields.title", scope: "decidim.sortitions.admin") %></th>
18
+ <th><%= t("models.sortition.fields.created_at", scope: "decidim.sortitions.admin") %></th>
19
+ <th class="actions"></th>
20
+ </tr>
21
+ </thead>
22
+ <tbody>
23
+ <% sortitions.each do |sortition| %>
24
+ <tr>
25
+ <td><%= sortition.reference %></td>
26
+ <td>
27
+ <% if allowed_to? :update, :sortition, sortition: sortition %>
28
+ <%= link_to decidim_html_escape(translated_attribute(sortition.title)), edit_sortition_path(sortition) %>
29
+ <% else %>
30
+ <%= decidim_html_escape(translated_attribute(sortition.title)) %>
31
+ <% end %>
32
+ </td>
33
+ <td><%= l sortition.created_at, format: :short %></td>
34
+ <td class="table-list__actions">
35
+ <% if allowed_to? :update, :sortition, sortition: sortition %>
36
+ <%= icon_link_to "pencil-line", edit_sortition_path(sortition), t("actions.edit", scope: "decidim.sortitions.admin"), class: "action-icon--edit" %>
37
+ <% else %>
38
+ <span class="action-space icon"></span>
39
+ <% end %>
13
40
 
14
- <div class="card-section">
15
- <div class="table-scroll">
16
- <table class="table-list">
17
- <thead>
18
- <tr>
19
- <th><%= t("models.sortition.fields.reference", scope: "decidim.sortitions.admin") %></th>
20
- <th><%= t("models.sortition.fields.title", scope: "decidim.sortitions.admin") %></th>
21
- <th><%= t("models.sortition.fields.created_at", scope: "decidim.sortitions.admin") %></th>
22
- <th class="actions"></th>
23
- </tr>
24
- </thead>
25
- <tbody>
26
- <% sortitions.each do |sortition| %>
27
- <tr>
28
- <td><%= sortition.reference %></td>
29
- <td><%= decidim_html_escape(translated_attribute(sortition.title)) %></td>
30
- <td><%= l sortition.created_at, format: :short %></td>
31
- <td class="table-list__actions">
32
- <%= icon_link_to "eye",
33
- sortition_path(sortition),
34
- t("actions.show", scope: "decidim.sortitions.admin"),
35
- class: "action-icon--preview" %>
36
-
37
- <% if allowed_to? :update, :sortition, sortition: sortition %>
38
- <%= icon_link_to "pencil",
39
- edit_sortition_path(sortition),
40
- t("actions.edit", scope: "decidim.sortitions.admin"),
41
- class: "action-icon--edit" %>
42
- <% else %>
43
- <span class="action-space icon"></span>
44
- <% end %>
41
+ <%= icon_link_to "eye-line", sortition_path(sortition), t("actions.show", scope: "decidim.sortitions.admin"), class: "action-icon--preview", target: "_blank", data: { "external-link": false } %>
45
42
 
46
- <%= resource_permissions_link(sortition) %>
43
+ <%= resource_permissions_link(sortition) %>
47
44
 
48
- <% if allowed_to? :destroy, :sortition, sortition: sortition %>
49
- <%= icon_link_to "circle-x",
50
- confirm_destroy_sortition_path(sortition),
51
- t("actions.destroy", scope: "decidim.sortitions.admin"),
52
- class: "action-icon--remove" %>
53
- <% else %>
54
- <span class="action-space icon"></span>
55
- <% end %>
56
- </td>
57
- </tr>
58
- <% end %>
59
- </tbody>
60
- </table>
61
- <%= paginate sortitions, theme: "decidim" %>
62
- </div>
45
+ <% if allowed_to? :destroy, :sortition, sortition: sortition %>
46
+ <%= icon_link_to "delete-bin-line", confirm_destroy_sortition_path(sortition), t("actions.destroy", scope: "decidim.sortitions.admin"), class: "action-icon--remove" %>
47
+ <% else %>
48
+ <span class="action-space icon"></span>
49
+ <% end %>
50
+ </td>
51
+ </tr>
52
+ <% end %>
53
+ </tbody>
54
+ </table>
63
55
  </div>
64
56
  </div>
57
+ <%= decidim_paginate sortitions %>