diff --git a/app/controllers/admin/poll/questions_controller.rb b/app/controllers/admin/poll/questions_controller.rb index 3b23ec21d..b7b16e379 100644 --- a/app/controllers/admin/poll/questions_controller.rb +++ b/app/controllers/admin/poll/questions_controller.rb @@ -9,6 +9,8 @@ class Admin::Poll::QuestionsController < Admin::BaseController @search = search_params[:search] @questions = @questions.search(search_params).page(params[:page]).order("created_at DESC") + + @proposals = Proposal.successful.sort_by_confidence_score end def new diff --git a/app/views/admin/poll/questions/_filter_subnav.html.erb b/app/views/admin/poll/questions/_filter_subnav.html.erb new file mode 100644 index 000000000..7f641d390 --- /dev/null +++ b/app/views/admin/poll/questions/_filter_subnav.html.erb @@ -0,0 +1,12 @@ + diff --git a/app/views/admin/poll/questions/_questions.html.erb b/app/views/admin/poll/questions/_questions.html.erb new file mode 100644 index 000000000..f8fc13302 --- /dev/null +++ b/app/views/admin/poll/questions/_questions.html.erb @@ -0,0 +1,23 @@ +
+ <%= render 'filter' %> +
+ +<% if @questions.count == 0 %> +
+ <%= t('admin.questions.index.no_questions') %> +
+<% else %> + + <% @questions.each do |question| %> + + + + + <% end %> +
<%= link_to question.title, admin_question_path(question) %> + <%= link_to t('shared.edit'), edit_admin_question_path(question), class: "button hollow" %> + <%= link_to t('shared.delete'), admin_question_path(question), class: "button hollow alert", method: :delete %> +
+ + <%= paginate @questions %> +<% end %> diff --git a/app/views/admin/poll/questions/_successful_proposals.html.erb b/app/views/admin/poll/questions/_successful_proposals.html.erb new file mode 100644 index 000000000..39d0ea7dc --- /dev/null +++ b/app/views/admin/poll/questions/_successful_proposals.html.erb @@ -0,0 +1,20 @@ + + + <% @proposals.each do |proposal| %> + + + + + <% end %> + +
+ <%= link_to proposal.title, proposal_path(proposal) %> +

+ <%= proposal.summary %>
+ <%= proposal.question %> +

+
+ <%= link_to t("admin.questions.index.create_question"), + new_admin_question_path(proposal_id: proposal.id), + class: "button hollow" %> +
diff --git a/app/views/admin/poll/questions/index.html.erb b/app/views/admin/poll/questions/index.html.erb index 64e22dd2d..f45497af0 100644 --- a/app/views/admin/poll/questions/index.html.erb +++ b/app/views/admin/poll/questions/index.html.erb @@ -9,26 +9,14 @@ -
- <%= render 'filter' %> -
+
+ <%= render "filter_subnav" %> -<% if @questions.count == 0 %> -
- <%= t('admin.questions.index.no_questions') %> +
+ <%= render "questions" %>
-<% else %> - - <% @questions.each do |question| %> - - - - - <% end %> -
<%= link_to question.title, admin_question_path(question) %> - <%= link_to t('shared.edit'), edit_admin_question_path(question), class: "button hollow" %> - <%= link_to t('shared.delete'), admin_question_path(question), class: "button hollow alert", method: :delete %> -
- <%= paginate @questions %> -<% end %> \ No newline at end of file +
+ <%= render "successful_proposals" %> +
+
diff --git a/config/locales/admin.en.yml b/config/locales/admin.en.yml index 87a8cc75f..4e2c63c32 100755 --- a/config/locales/admin.en.yml +++ b/config/locales/admin.en.yml @@ -106,7 +106,7 @@ en: valuators: Valuators poll_officers: Poll officers polls: Polls - poll_booths: Booths + poll_booths: Booths location officials: Officials organizations: Organisations settings: Configuration settings @@ -200,6 +200,9 @@ en: no_questions: "There are no questions." filter_poll: Filter by Poll select_poll: Select Poll + questions_tab: "Questions" + successful_proposals_tab: "Successful proposals" + create_question: "Create question" edit: title: "Edit Question" new: diff --git a/config/locales/admin.es.yml b/config/locales/admin.es.yml index 183597625..64cde3f8d 100644 --- a/config/locales/admin.es.yml +++ b/config/locales/admin.es.yml @@ -106,7 +106,7 @@ es: valuators: Evaluadores poll_officers: Presidentes de mesa polls: Votaciones - poll_booths: Urnas + poll_booths: Ubicación de urnas officials: Cargos públicos organizations: Organizaciones settings: Configuración global @@ -200,6 +200,9 @@ es: no_questions: "No hay ninguna pregunta ciudadana." filter_poll: "Filtrar por votación" select_poll: "Seleccionar votación" + questions_tab: "Preguntas ciudadanas" + successful_proposals_tab: "Propuestas que han superado el umbral" + create_question: "Crear pregunta para votación" edit: title: "Editar pregunta ciudadana" new: diff --git a/spec/features/admin/poll/booths_spec.rb b/spec/features/admin/poll/booths_spec.rb index b84e32b74..ec8c10d58 100644 --- a/spec/features/admin/poll/booths_spec.rb +++ b/spec/features/admin/poll/booths_spec.rb @@ -11,7 +11,7 @@ feature 'Admin booths' do visit admin_root_path within('#side_menu') do - click_link "Booths" + click_link "Booths location" end expect(page).to have_content "There are no booths" @@ -23,7 +23,7 @@ feature 'Admin booths' do visit admin_root_path within('#side_menu') do - click_link "Booths" + click_link "Booths location" end booths = Poll::Booth.all