decidim-consultations 0.19.0 → 0.22.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (107) hide show
  1. checksums.yaml +4 -4
  2. data/app/assets/images/decidim/consultations/icon.svg +1 -3
  3. data/app/assets/images/decidim/consultations/icon2.svg +1 -88
  4. data/app/assets/javascripts/decidim/consultations/utils_multiple.js +1 -1
  5. data/app/assets/stylesheets/decidim/consultations/_question.scss +0 -6
  6. data/app/assets/stylesheets/decidim/consultations/_question_multiple_votes.scss +22 -0
  7. data/app/assets/stylesheets/decidim/consultations/consultations.scss +1 -0
  8. data/app/assets/stylesheets/decidim/consultations/consultations/_consultations-header.scss +0 -1
  9. data/app/cells/decidim/consultations/consultation_m/data.erb +1 -1
  10. data/app/cells/decidim/consultations/consultation_m/footer.erb +1 -1
  11. data/app/cells/decidim/consultations/content_blocks/highlighted_consultations/show.erb +3 -3
  12. data/app/commands/decidim/consultations/admin/create_response.rb +2 -1
  13. data/app/commands/decidim/consultations/admin/create_response_group.rb +40 -0
  14. data/app/commands/decidim/consultations/admin/destroy_response_group.rb +39 -0
  15. data/app/commands/decidim/consultations/admin/update_response.rb +3 -2
  16. data/app/commands/decidim/consultations/admin/update_response_group.rb +46 -0
  17. data/app/controllers/concerns/decidim/consultations/admin/filterable.rb +27 -0
  18. data/app/controllers/decidim/consultations/admin/consultations_controller.rb +2 -1
  19. data/app/controllers/decidim/consultations/admin/response_groups_controller.rb +88 -0
  20. data/app/controllers/decidim/consultations/admin/responses_controller.rb +1 -0
  21. data/app/controllers/decidim/consultations/consultations_controller.rb +1 -1
  22. data/app/forms/decidim/consultations/admin/response_form.rb +5 -0
  23. data/app/forms/decidim/consultations/admin/response_group_form.rb +18 -0
  24. data/app/helpers/decidim/consultations/admin/questions_helper.rb +11 -0
  25. data/app/models/decidim/consultation.rb +16 -0
  26. data/app/models/decidim/consultations/question.rb +22 -0
  27. data/app/models/decidim/consultations/response.rb +7 -0
  28. data/app/models/decidim/consultations/response_group.rb +19 -0
  29. data/app/permissions/decidim/consultations/admin/permissions.rb +16 -0
  30. data/app/permissions/decidim/consultations/permissions.rb +2 -0
  31. data/app/types/decidim/consultations/consultation_question_type.rb +57 -0
  32. data/app/types/decidim/consultations/consultation_type.rb +32 -0
  33. data/app/views/decidim/consultations/admin/consultations/index.html.erb +3 -2
  34. data/app/views/decidim/consultations/admin/response_groups/_form.html.erb +11 -0
  35. data/app/views/decidim/consultations/admin/response_groups/edit.html.erb +18 -0
  36. data/app/views/decidim/consultations/admin/response_groups/index.html.erb +56 -0
  37. data/app/views/decidim/consultations/admin/response_groups/new.html.erb +13 -0
  38. data/app/views/decidim/consultations/admin/responses/_form.html.erb +3 -0
  39. data/app/views/decidim/consultations/admin/responses/index.html.erb +12 -1
  40. data/app/views/decidim/consultations/consultations/_consultation_card.html.erb +3 -3
  41. data/app/views/decidim/consultations/consultations/_consultation_details.html.erb +2 -2
  42. data/app/views/decidim/consultations/consultations/_filters.html.erb +9 -4
  43. data/app/views/decidim/consultations/consultations/_question.html.erb +2 -2
  44. data/app/views/decidim/consultations/consultations/index.html.erb +3 -3
  45. data/app/views/decidim/consultations/question_multiple_votes/_form.html.erb +14 -10
  46. data/app/views/decidim/consultations/question_multiple_votes/show.html.erb +8 -2
  47. data/app/views/decidim/consultations/questions/_vote_button.html.erb +70 -67
  48. data/app/views/decidim/consultations/questions/_vote_modal.html.erb +1 -1
  49. data/app/views/decidim/consultations/questions/_vote_modal_confirm.html.erb +1 -1
  50. data/app/views/decidim/consultations/questions/show.html.erb +4 -4
  51. data/app/views/layouts/decidim/_question_components.html.erb +3 -3
  52. data/app/views/layouts/decidim/_question_header.html.erb +1 -1
  53. data/app/views/layouts/decidim/admin/question.html.erb +1 -1
  54. data/config/locales/ar.yml +45 -1
  55. data/config/locales/bg-BG.yml +1 -0
  56. data/config/locales/ca.yml +29 -1
  57. data/config/locales/cs.yml +35 -7
  58. data/config/locales/da-DK.yml +1 -0
  59. data/config/locales/de.yml +82 -1
  60. data/config/locales/el-GR.yml +1 -0
  61. data/config/locales/el.yml +377 -0
  62. data/config/locales/en.yml +29 -1
  63. data/config/locales/es-MX.yml +67 -1
  64. data/config/locales/es-PY.yml +67 -1
  65. data/config/locales/es.yml +29 -1
  66. data/config/locales/et-EE.yml +1 -0
  67. data/config/locales/eu.yml +0 -1
  68. data/config/locales/fi-plain.yml +29 -1
  69. data/config/locales/fi.yml +38 -10
  70. data/config/locales/fr-CA.yml +377 -0
  71. data/config/locales/fr.yml +31 -2
  72. data/config/locales/ga-IE.yml +1 -0
  73. data/config/locales/gl.yml +0 -1
  74. data/config/locales/hr-HR.yml +1 -0
  75. data/config/locales/hu.yml +31 -7
  76. data/config/locales/id-ID.yml +0 -1
  77. data/config/locales/is-IS.yml +185 -0
  78. data/config/locales/it.yml +115 -51
  79. data/config/locales/ja-JP.yml +367 -0
  80. data/config/locales/lt-LT.yml +1 -0
  81. data/config/locales/lv-LV.yml +383 -0
  82. data/config/locales/mt-MT.yml +1 -0
  83. data/config/locales/nl.yml +29 -1
  84. data/config/locales/no.yml +366 -0
  85. data/config/locales/pl.yml +177 -96
  86. data/config/locales/pt-BR.yml +1 -2
  87. data/config/locales/pt.yml +156 -75
  88. data/config/locales/ro-RO.yml +338 -0
  89. data/config/locales/ru.yml +0 -1
  90. data/config/locales/sk-SK.yml +394 -0
  91. data/config/locales/sk.yml +393 -0
  92. data/config/locales/sl.yml +5 -0
  93. data/config/locales/sr-CS.yml +1 -0
  94. data/config/locales/sv.yml +78 -8
  95. data/config/locales/tr-TR.yml +0 -1
  96. data/config/locales/uk.yml +0 -1
  97. data/db/migrate/20190708114204_create_decidim_consultations_response_groups.rb +16 -0
  98. data/db/migrate/20190708120345_add_response_groups_count_to_decidim_consultations_questions.rb +7 -0
  99. data/db/migrate/20190708121643_add_response_groups_to_decidim_consultations_responses.rb +10 -0
  100. data/db/migrate/20200320105916_index_foreign_keys_in_decidim_consultations_votes.rb +7 -0
  101. data/db/seeds/city.jpeg +0 -0
  102. data/db/seeds/city2.jpeg +0 -0
  103. data/lib/decidim/consultations/admin_engine.rb +1 -0
  104. data/lib/decidim/consultations/participatory_space.rb +6 -0
  105. data/lib/decidim/consultations/test/factories.rb +5 -0
  106. data/lib/decidim/consultations/version.rb +1 -1
  107. metadata +47 -11
@@ -7,6 +7,7 @@ module Decidim
7
7
  class ResponsesController < Decidim::Consultations::Admin::ApplicationController
8
8
  include QuestionAdmin
9
9
 
10
+ helper Admin::QuestionsHelper
10
11
  helper_method :current_response
11
12
 
12
13
  def index
@@ -7,11 +7,11 @@ module Decidim
7
7
  class ConsultationsController < Decidim::Consultations::ApplicationController
8
8
  layout "layouts/decidim/consultation", only: :show
9
9
 
10
+ include ParticipatorySpaceContext
10
11
  include NeedsConsultation
11
12
  include FilterResource
12
13
  include Paginable
13
14
  include Decidim::Consultations::Orderable
14
- include ParticipatorySpaceContext
15
15
 
16
16
  helper_method :collection, :consultations, :finished_consultations, :active_consultations, :filter
17
17
 
@@ -10,8 +10,13 @@ module Decidim
10
10
  mimic :response
11
11
 
12
12
  translatable_attribute :title, String
13
+ attribute :decidim_consultations_response_group_id, Integer
13
14
 
14
15
  validates :title, translatable_presence: true
16
+
17
+ def response_group
18
+ ResponseGroup.find_by(id: decidim_consultations_response_group_id) if decidim_consultations_response_group_id
19
+ end
15
20
  end
16
21
  end
17
22
  end
@@ -0,0 +1,18 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Decidim
4
+ module Consultations
5
+ module Admin
6
+ # A form object used to create responses for a question from the admin dashboard.
7
+ class ResponseGroupForm < Form
8
+ include TranslatableAttributes
9
+
10
+ mimic :response_group
11
+
12
+ translatable_attribute :title, String
13
+
14
+ validates :title, translatable_presence: true
15
+ end
16
+ end
17
+ end
18
+ end
@@ -5,9 +5,20 @@ module Decidim
5
5
  module Admin
6
6
  # Helper for questions controller
7
7
  module QuestionsHelper
8
+ include Decidim::TranslationsHelper
9
+
10
+ Option = Struct.new(:id, :title)
11
+
8
12
  def question_example_slug
9
13
  "question-#{Time.now.utc.year}-#{Time.now.utc.month}-1"
10
14
  end
15
+
16
+ def question_response_groups(question = current_question)
17
+ [Option.new("", "-")] +
18
+ question.response_groups.map do |group|
19
+ Option.new(group.id, translated_attribute(group.title))
20
+ end
21
+ end
11
22
  end
12
23
  end
13
24
  end
@@ -11,6 +11,7 @@ module Decidim
11
11
  include Decidim::Loggable
12
12
  include Decidim::ParticipatorySpaceResourceable
13
13
  include Decidim::Randomable
14
+ include Decidim::Searchable
14
15
 
15
16
  belongs_to :organization,
16
17
  foreign_key: "decidim_organization_id",
@@ -41,6 +42,16 @@ module Decidim
41
42
  scope :finished, -> { published.where("end_voting_date < ?", Time.now.utc) }
42
43
  scope :order_by_most_recent, -> { order(created_at: :desc) }
43
44
 
45
+ searchable_fields({
46
+ participatory_space: :itself,
47
+ A: :title,
48
+ B: :subtitle,
49
+ D: :description,
50
+ datetime: :published_at
51
+ },
52
+ index_on_create: ->(_process) { false },
53
+ index_on_update: ->(process) { process.visible? })
54
+
44
55
  def to_param
45
56
  slug
46
57
  end
@@ -85,5 +96,10 @@ module Decidim
85
96
  def closed?
86
97
  !active?
87
98
  end
99
+
100
+ # Allow ransacker to search for a key in a hstore column (`title`.`en`)
101
+ ransacker :title do |parent|
102
+ Arel::Nodes::InfixOperation.new("->>", parent.table[:title], Arel::Nodes.build_quoted(I18n.locale.to_s))
103
+ end
88
104
  end
89
105
  end
@@ -39,6 +39,12 @@ module Decidim
39
39
  inverse_of: :question,
40
40
  dependent: :destroy
41
41
 
42
+ has_many :response_groups,
43
+ foreign_key: "decidim_consultations_questions_id",
44
+ class_name: "Decidim::Consultations::ResponseGroup",
45
+ inverse_of: :question,
46
+ dependent: :destroy
47
+
42
48
  has_many :categories,
43
49
  foreign_key: "decidim_participatory_space_id",
44
50
  foreign_type: "decidim_participatory_space_type",
@@ -88,6 +94,22 @@ module Decidim
88
94
  max_votes > 1
89
95
  end
90
96
 
97
+ # Sorted responses by date so admins have a way to predict it
98
+ def sorted_responses
99
+ @sorted_responses ||= responses.sort_by(&:created_at)
100
+ end
101
+
102
+ # matrix of responses by group (sorted by configuration)
103
+ def grouped_responses
104
+ @grouped_responses ||= sorted_responses.group_by(&:response_group)
105
+ end
106
+
107
+ def grouped?
108
+ return false unless multiple?
109
+
110
+ response_groups_count.positive?
111
+ end
112
+
91
113
  # Public: Overrides the `comments_have_alignment?` Commentable concern method.
92
114
  def comments_have_alignment?
93
115
  true
@@ -14,6 +14,13 @@ module Decidim
14
14
  class_name: "Decidim::Consultations::Vote",
15
15
  inverse_of: :response,
16
16
  dependent: :restrict_with_error
17
+
18
+ belongs_to :response_group,
19
+ foreign_key: "decidim_consultations_response_group_id",
20
+ class_name: "Decidim::Consultations::ResponseGroup",
21
+ inverse_of: :responses,
22
+ counter_cache: :responses_count,
23
+ optional: true
17
24
  end
18
25
  end
19
26
  end
@@ -0,0 +1,19 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Decidim
4
+ module Consultations
5
+ class ResponseGroup < ApplicationRecord
6
+ belongs_to :question,
7
+ foreign_key: "decidim_consultations_questions_id",
8
+ class_name: "Decidim::Consultations::Question",
9
+ counter_cache: :response_groups_count,
10
+ inverse_of: :response_groups
11
+
12
+ has_many :responses,
13
+ foreign_key: "decidim_consultations_response_group_id",
14
+ class_name: "Decidim::Consultations::Response",
15
+ inverse_of: :response_group,
16
+ dependent: :restrict_with_error
17
+ end
18
+ end
19
+ end
@@ -27,6 +27,7 @@ module Decidim
27
27
  allowed_consultation_action?
28
28
  allowed_question_action?
29
29
  allowed_response_action?
30
+ allowed_response_group_action?
30
31
 
31
32
  permission_action
32
33
  end
@@ -45,6 +46,10 @@ module Decidim
45
46
  @response ||= context.fetch(:response, nil)
46
47
  end
47
48
 
49
+ def response_group
50
+ @response_group ||= context.fetch(:response_group, nil)
51
+ end
52
+
48
53
  def allowed_action_on_component?
49
54
  return unless permission_action.subject == :component
50
55
 
@@ -90,6 +95,17 @@ module Decidim
90
95
  end
91
96
  end
92
97
 
98
+ def allowed_response_group_action?
99
+ return unless permission_action.subject == :response_group
100
+
101
+ case permission_action.action
102
+ when :create, :read
103
+ toggle_allow(question&.multiple?)
104
+ when :update, :destroy
105
+ toggle_allow(response_group.present?)
106
+ end
107
+ end
108
+
93
109
  # Only admin users can enter the consultations area.
94
110
  def user_can_enter_space_area?
95
111
  return unless permission_action.action == :enter &&
@@ -42,6 +42,8 @@ module Decidim
42
42
  toggle_allow(consultation.published? || user&.admin?)
43
43
  when :question
44
44
  toggle_allow(question.published? || user&.admin?)
45
+ when :participatory_space
46
+ allow!
45
47
  end
46
48
  end
47
49
 
@@ -0,0 +1,57 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Decidim
4
+ module Consultations
5
+ # This type represents a consultation.
6
+ ConsultationQuestionType = GraphQL::ObjectType.define do
7
+ interfaces [
8
+ -> { Decidim::Core::ScopableInterface },
9
+ -> { Decidim::Core::AttachableInterface },
10
+ -> { Decidim::Comments::CommentableInterface }
11
+ ]
12
+
13
+ name "ConsultationQuestion"
14
+ description "A consultation question"
15
+
16
+ field :id, !types.ID, "Internal ID of the question"
17
+ field :title, Decidim::Core::TranslatedFieldType, "Title of the question"
18
+ field :subtitle, Decidim::Core::TranslatedFieldType, "The subtitle of this question"
19
+ field :slug, !types.String, "Slug of the question"
20
+ field :createdAt, !Decidim::Core::DateTimeType, "The time this question was created", property: :created_at
21
+ field :updatedAt, !Decidim::Core::DateTimeType, "The time this question was updated", property: :updated_at
22
+ field :publishedAt, !Decidim::Core::DateTimeType, "The time this question was published", property: :published_at
23
+
24
+ field :components, types[Decidim::Core::ComponentInterface] do
25
+ description "Lists the components this space contains."
26
+
27
+ resolve ->(participatory_space, _args, _ctx) {
28
+ Decidim::Component.where(
29
+ participatory_space: participatory_space
30
+ ).published
31
+ }
32
+ end
33
+
34
+ field :bannerImage, types.String, "The banner image for this question", property: :banner_image
35
+ field :heroImage, types.String, "The hero image for this question", property: :hero_image
36
+
37
+ field :whatIsDecided, Decidim::Core::TranslatedFieldType, "What is decided in this question", property: :what_is_decided
38
+ field :promoterGroup, Decidim::Core::TranslatedFieldType, "The promoter group of this question", property: :promoter_group
39
+ field :participatoryScope, Decidim::Core::TranslatedFieldType, "The participatory scope of this question", property: :participatory_scope
40
+ field :questionContext, Decidim::Core::TranslatedFieldType, "The context for this question", property: :question_context
41
+ field :reference, types.String, "The reference for this question", property: :reference
42
+ field :hashtag, types.String, "The hashtag of this question", property: :hashtag
43
+ field :votesCount, types.Int, "The number of votes in this question", property: :votes_count
44
+ field :originScope, Decidim::Core::TranslatedFieldType, "The origin scope of this question", property: :origin_scope
45
+ field :originTitle, Decidim::Core::TranslatedFieldType, "The origin title of this question", property: :origin_title
46
+ field :originUrl, types.String, "The origin URL for this question", property: :origin_url
47
+ field :iFrameUrl, types.String, "The iframe URL for this question", property: :i_frame_url
48
+ field :externalVoting, types.Boolean, "If the question has external voting", property: :external_voting
49
+ field :responsesCount, types.Int, "The number of responses for this question", property: :responses_count
50
+ field :order, types.Int, "The order in which the question should be represented", property: :order
51
+ field :maxVotes, types.Int, "The maximum number of votes in this question", property: :max_votes
52
+ field :minVotes, types.Int, "The minimum number of votes in this question", property: :min_votes
53
+ field :responseGroupsCount, types.Int, "The number of group responses for this question", property: :response_groups_count
54
+ field :instructions, Decidim::Core::TranslatedFieldType, "Instructions for this question", property: :instructions
55
+ end
56
+ end
57
+ end
@@ -0,0 +1,32 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Decidim
4
+ module Consultations
5
+ # This type represents a consultation.
6
+ ConsultationType = GraphQL::ObjectType.define do
7
+ interfaces [
8
+ -> { Decidim::Core::ParticipatorySpaceInterface }
9
+ ]
10
+
11
+ name "Consultation"
12
+ description "A consultation"
13
+
14
+ field :subtitle, Decidim::Core::TranslatedFieldType, "The subtitle of this consultation"
15
+ field :description, Decidim::Core::TranslatedFieldType, "The description of this consultation"
16
+ field :slug, !types.String, "Slug of this consultation"
17
+ field :createdAt, !Decidim::Core::DateTimeType, "The time this consultation was created", property: :created_at
18
+ field :updatedAt, !Decidim::Core::DateTimeType, "The time this consultation was updated", property: :updated_at
19
+ field :publishedAt, !Decidim::Core::DateTimeType, "The time this consultation was published", property: :published_at
20
+
21
+ field :introductoryVideoUrl, types.String, "The introductory video url for this consultation", property: :introductory_video_url
22
+ field :introductoryImage, types.String, "The introductory image for this consultation", property: :introductory_image
23
+ field :bannerImage, types.String, "The banner image for this consultation", property: :banner_image
24
+ field :highlightedScope, Decidim::Core::ScopeApiType, "This is the highlighted scope of this consultation", property: :highlighted_scope
25
+ field :startVotingDate, Decidim::Core::DateType, "Start date of the voting for this consultation", property: :start_voting_date
26
+ field :endVotingDate, Decidim::Core::DateType, "End date of the voting for this consultation", property: :end_voting_date
27
+ field :resultsPublishedAt, Decidim::Core::DateType, "Date when the results have been published", property: :results_published_at
28
+
29
+ field :questions, types[Decidim::Consultations::ConsultationQuestionType], ""
30
+ end
31
+ end
32
+ end
@@ -1,4 +1,4 @@
1
- <div class="card" id="consultations">
1
+ <div class="card with-overflow" id="consultations">
2
2
  <div class="card-divider">
3
3
  <h2 class="card-title">
4
4
  <%= t "decidim.admin.titles.consultations" %>
@@ -6,13 +6,14 @@
6
6
  ["new", "consultation"], class: "button tiny button--title" if allowed_to? :create, :consultation %>
7
7
  </h2>
8
8
  </div>
9
+ <%= admin_filter_selector %>
9
10
  <div class="card-section">
10
11
  <div class="table-scroll">
11
12
  <table class="table-list">
12
13
  <thead>
13
14
  <tr>
14
15
  <th><%= t("models.consultation.fields.title", scope: "decidim.admin") %></th>
15
- <th><%= t("models.consultation.fields.created_at", scope: "decidim.admin") %></th>
16
+ <th><%= sort_link(query, :created_at, t("models.consultation.fields.created_at", scope: "decidim.admin"), default_order: :desc) %></th>
16
17
  <th class="table-list__actions">
17
18
  <%= t("models.consultation.fields.published", scope: "decidim.admin") %>
18
19
  </th>
@@ -0,0 +1,11 @@
1
+ <div class="card">
2
+ <div class="card-divider">
3
+ <h2 class="card-title"><%= t "response_groups.form.title", scope: "decidim.admin" %></h2>
4
+ </div>
5
+
6
+ <div class="card-section">
7
+ <div class="row column">
8
+ <%= form.translated :text_field, :title, autofocus: true %>
9
+ </div>
10
+ </div>
11
+ </div>
@@ -0,0 +1,18 @@
1
+ <%= decidim_form_for @form,
2
+ url: response_group_path(current_question, current_response_group),
3
+ html: { class: "form edit_response_group" } do |f| %>
4
+ <%= render partial: "form", object: f %>
5
+ <div class="button--double form-general-submit">
6
+ <%= f.submit t("response_groups.edit.update", scope: "decidim.admin"),
7
+ class: "button",
8
+ data: { disable_with: true } %>
9
+
10
+ <% if allowed_to? :destroy, :response_group, response_group: current_response_group %>
11
+ <%= link_to t("decidim.admin.actions.destroy"),
12
+ response_group_path(current_question, current_response_group),
13
+ method: :delete,
14
+ class: "alert button",
15
+ data: { confirm: t("decidim.admin.actions.confirm_destroy") } %>
16
+ <% end %>
17
+ </div>
18
+ <% end %>
@@ -0,0 +1,56 @@
1
+ <div class="card" id="questions">
2
+ <div class="card-divider">
3
+ <h2 class="card-title">
4
+ <%= t "decidim.admin.titles.response_groups" %>
5
+ <%= link_to t("actions.new_response_group", scope: "decidim.admin"),
6
+ new_response_group_path(current_question),
7
+ class: "button tiny button--title" if allowed_to? :create, :response_group, question: current_question %>
8
+ <%= link_to t("actions.back_to_responses", scope: "decidim.admin"),
9
+ responses_path(current_question),
10
+ class: "button tiny button--title" if allowed_to? :read, :response %>
11
+ </h2>
12
+ </div>
13
+ <div class="card-section">
14
+ <p>
15
+ <%= t "decidim.admin.response_groups.help" %>
16
+ </p>
17
+ </div>
18
+ <div class="card-section">
19
+ <div class="table-scroll">
20
+ <table class="table-list">
21
+ <thead>
22
+ <tr>
23
+ <th><%= t("models.response.fields.title", scope: "decidim.admin") %></th>
24
+ <th><%= t("models.response.fields.created_at", scope: "decidim.admin") %></th>
25
+ <th></th>
26
+ </tr>
27
+ </thead>
28
+ <tbody>
29
+ <% current_question.response_groups.each do |group| %>
30
+ <tr>
31
+ <td>
32
+ <% if allowed_to? :update, :response_group, response_group: group %>
33
+ <%= link_to translated_attribute(group.title),
34
+ edit_response_group_path(current_question, group) %>
35
+ <% else %>
36
+ <%= translated_attribute(group.title) %>
37
+ <% end %>
38
+ </td>
39
+ <td>
40
+ <%= l group.created_at, format: :short %>
41
+ </td>
42
+ <td class="table-list__actions">
43
+ <% if allowed_to? :update, :response_group, response_group: group %>
44
+ <%= icon_link_to "pencil",
45
+ edit_response_group_path(current_question, group),
46
+ t("actions.configure", scope: "decidim.admin"),
47
+ class: "action-icon--edit" %>
48
+ <% end %>
49
+ </td>
50
+ </tr>
51
+ <% end %>
52
+ </tbody>
53
+ </table>
54
+ </div>
55
+ </div>
56
+ </div>
@@ -0,0 +1,13 @@
1
+ <h2 class="questions-title-summary">
2
+ <%= t "response_groups.new.title", scope: "decidim.admin" %>
3
+ </h2>
4
+
5
+ <%= decidim_form_for @form,
6
+ url: response_groups_path(current_question),
7
+ html: { class: "form new_response_group" } do |f| %>
8
+ <%= render partial: "form", object: f %>
9
+
10
+ <div class="button--double form-general-submit">
11
+ <%= f.submit t("response_groups.new.create", scope: "decidim.admin"), data: { disable_with: true } %>
12
+ </div>
13
+ <% end %>