<div class="card"> <div class="card-divider"> <h2 class="card-title"> <%= link_to translated_attribute(election.title), elections_path %> > <%= t(".title") %> <%= link_to t("actions.new", scope: "decidim.elections", name: t("models.question.name", scope: "decidim.elections.admin")), new_election_question_path(election), class: "button tiny button--title" if allowed_to? :create, :question, election: election %> </h2> </div> <div class="card-section"> <div class="table-scroll"> <table class="table-list"> <thead> <tr> <th><%= t("models.question.fields.title", scope: "decidim.elections") %></th> <th><%= t("models.question.fields.answers", scope: "decidim.elections") %></th> <th><%= t("models.question.fields.max_selections", scope: "decidim.elections") %></th> <th class="actions"><%= t("actions.title", scope: "decidim.elections") %></th> </tr> </thead> <tbody> <% questions.each do |question| %> <tr data-id="<%= question.id %>"> <td> <%= translated_attribute(question.title) %> </td> <td> <%= question.answers.count %> </td> <td> <% if question.max_selections.zero? %> - <% else %> <%= question.max_selections %> <% end %> </td> <td class="table-list__actions"> <%= icon_link_to "list", election_question_answers_path(election, question), t("actions.manage_answers", scope: "decidim.elections"), class: "action-icon--manage-answers" %> <% if allowed_to? :update, :question, election: election, question: question %> <%= icon_link_to "pencil", edit_election_question_path(election, question), t("actions.edit", scope: "decidim.elections"), class: "action-icon--edit" %> <% else %> <%= icon "pencil", class: "action-icon action-icon--disabled", role: "img" %> <% end %> <% if allowed_to? :delete, :question, election: election, question: question %> <%= icon_link_to "circle-x", election_question_path(election, question), t("actions.destroy", scope: "decidim.elections"), method: :delete, class: "action-icon--remove", data: { confirm: t("actions.confirm_destroy", scope: "decidim.elections") } %> <% else %> <%= icon "circle-x", class: "action-icon action-icon--disabled", role: "img" %> <% end %> </td> </tr> <% end %> </tbody> </table> </div> </div> </div>