@@ -30,13 +30,8 @@ module CommentableActions
|
||||
end
|
||||
|
||||
def suggest
|
||||
@limit = 5
|
||||
@resources = @search_terms.present? ? resource_model.search(@search_terms) : nil
|
||||
set_resources_instance
|
||||
if @resources
|
||||
@resources_count = @resources.count
|
||||
@reg_show = 5
|
||||
render layout: false
|
||||
end
|
||||
end
|
||||
|
||||
def create
|
||||
|
||||
@@ -15,6 +15,7 @@ class DebatesController < ApplicationController
|
||||
has_orders %w{most_voted newest oldest}, only: :show
|
||||
|
||||
load_and_authorize_resource
|
||||
helper_method :resource_model, :resource_name
|
||||
respond_to :html, :js
|
||||
|
||||
def vote
|
||||
|
||||
@@ -14,6 +14,7 @@ class ProposalsController < ApplicationController
|
||||
has_orders %w{most_voted newest oldest}, only: :show
|
||||
|
||||
load_and_authorize_resource
|
||||
helper_method :resource_model, :resource_name
|
||||
respond_to :html, :js
|
||||
|
||||
def index_customization
|
||||
|
||||
@@ -1,22 +0,0 @@
|
||||
<div class="small-12 column" >
|
||||
<% if @search_terms && @resources_count > 0 %>
|
||||
<div class="alert-box radius warning">
|
||||
<p class="note-marked">
|
||||
<%= t("debates.new.suggestions.found", count: @resources_count, query: @search_terms)%>
|
||||
</p>
|
||||
<ul>
|
||||
<% @debates.take(@reg_show).each do |debate| %>
|
||||
<li> <%= link_to debate.title, debate %> </li>
|
||||
<% end %>
|
||||
</ul>
|
||||
<% if @resources_count > @reg_show %>
|
||||
<p class="note-marked">
|
||||
<%= t("debates.new.suggestions.message", count: @resources_count,
|
||||
query: @search_terms,
|
||||
limit: @reg_show) %>
|
||||
<%= link_to t("debates.new.suggestions.see_all"), debates_path(search: @search_terms)%>
|
||||
</p>
|
||||
<% end %>
|
||||
</div>
|
||||
<% end %>
|
||||
</div>
|
||||
@@ -1 +1 @@
|
||||
<%= render "suggest" %>
|
||||
<%= render "shared/suggest" %>
|
||||
@@ -1,22 +0,0 @@
|
||||
<div class="small-12 column" >
|
||||
<% if @search_terms && @resources_count > 0 %>
|
||||
<div class="alert-box radius warning">
|
||||
<p class="note-marked">
|
||||
<%= t("proposals.new.suggestions.found", count: @resources_count, query: @search_terms)%>
|
||||
</p>
|
||||
<ul>
|
||||
<% @proposals.take(@reg_show).each do |proposal| %>
|
||||
<li> <%= link_to proposal.title, proposal %> </li>
|
||||
<% end %>
|
||||
</ul>
|
||||
<% if @resources_count > @reg_show %>
|
||||
<p class="note-marked">
|
||||
<%= t("proposals.new.suggestions.message", count: @resources_count,
|
||||
query: @search_terms,
|
||||
limit: @reg_show) %>
|
||||
<%= link_to t("proposals.new.suggestions.see_all"), proposals_path(search: @search_terms)%>
|
||||
</p>
|
||||
<% end %>
|
||||
</div>
|
||||
<% end %>
|
||||
</div>
|
||||
@@ -1 +1 @@
|
||||
<%= render "suggest" %>
|
||||
<%= render "shared/suggest" %>
|
||||
29
app/views/shared/_suggest.html.erb
Normal file
29
app/views/shared/_suggest.html.erb
Normal file
@@ -0,0 +1,29 @@
|
||||
<div class="small-12 column" >
|
||||
<% if @search_terms && @resources.any? %>
|
||||
<div class="alert-box radius warning">
|
||||
<p class="note-marked">
|
||||
<%= t("shared.suggest.#{resource_name}.found",
|
||||
count: @resources.count,
|
||||
query: @search_terms)%>
|
||||
</p>
|
||||
|
||||
<ul>
|
||||
<% @resources.limit(@limit).each do |resource| %>
|
||||
<li><%= link_to resource.title, resource %></li>
|
||||
<% end %>
|
||||
</ul>
|
||||
|
||||
<% if @resources.count > @limit %>
|
||||
<p class="note-marked">
|
||||
<%= t("shared.suggest.#{resource_name}.message",
|
||||
count: @resources.count,
|
||||
query: @search_terms,
|
||||
limit: @limit) %>
|
||||
<%= link_to t("shared.suggest.#{resource_name}.see_all"),
|
||||
polymorphic_url(resource_model, search: @search_terms)%>
|
||||
</p>
|
||||
<% end %>
|
||||
|
||||
</div>
|
||||
<% end %>
|
||||
</div>
|
||||
@@ -133,6 +133,7 @@ ignore_unused:
|
||||
- 'notifications.index.replies_to*'
|
||||
- 'helpers.page_entries_info.*' # kaminari
|
||||
- 'views.pagination.*' # kaminari
|
||||
- 'shared.suggest.*'
|
||||
# - '{devise,kaminari,will_paginate}.*'
|
||||
# - 'simple_form.{yes,no}'
|
||||
# - 'simple_form.{placeholders,hints,labels}.*'
|
||||
|
||||
@@ -121,12 +121,6 @@ en:
|
||||
recommendation_two: Any debate or comment suggesting illegal action will be deleted, as well as those intending to sabotage the debate spaces. Anything else is allowed.
|
||||
recommendations_title: Recommendations for creating a debate
|
||||
start_new: Start a debate
|
||||
suggestions:
|
||||
found:
|
||||
one: "There is a debate with the term '%{query}', you can participate in it instead of opening a new one."
|
||||
other: "There are debates with the term '%{query}', you can participate in them instead of opening a new one."
|
||||
message: "You are seeing %{limit} of %{count} debates containing the term '%{query}'"
|
||||
see_all: "See all"
|
||||
show:
|
||||
author_deleted: User deleted
|
||||
back_link: Go back
|
||||
@@ -306,12 +300,6 @@ en:
|
||||
recommendation_two: Any proposal or comment suggesting illegal action will be deleted, as well as those intending to sabotage the debate spaces. Anything else is allowed.
|
||||
recommendations_title: Recommendations for creating a proposal
|
||||
start_new: Create new proposal
|
||||
suggestions:
|
||||
found:
|
||||
one: "There is a proposal with the term '%{query}', you can contribute to it instead of creating a new"
|
||||
other: "There are proposals with the term '%{query}', you can contribute to them instead of creating a new"
|
||||
message: "You are seeing %{limit} of %{count} proposals containing the term '%{query}'"
|
||||
see_all: "See all"
|
||||
proposal:
|
||||
already_supported: You have already supported this proposal. Share it!
|
||||
comments:
|
||||
@@ -376,6 +364,19 @@ en:
|
||||
flag: Flag as inappropriate
|
||||
print:
|
||||
print_button: Print this info
|
||||
suggest:
|
||||
debate:
|
||||
found:
|
||||
one: "There is a debate with the term '%{query}', you can participate in it instead of opening a new one."
|
||||
other: "There are debates with the term '%{query}', you can participate in them instead of opening a new one."
|
||||
message: "You are seeing %{limit} of %{count} debates containing the term '%{query}'"
|
||||
see_all: "Ver todos"
|
||||
proposal:
|
||||
found:
|
||||
one: "There is a proposal with the term '%{query}', you can contribute to it instead of creating a new"
|
||||
other: "There are proposals with the term '%{query}', you can contribute to them instead of creating a new"
|
||||
message: "You are seeing %{limit} of %{count} proposals containing the term '%{query}'"
|
||||
see_all: "See all"
|
||||
tags_cloud:
|
||||
tags: Trending
|
||||
districts: "Districts"
|
||||
|
||||
@@ -122,12 +122,6 @@ es:
|
||||
recommendation_two: Cualquier debate o comentario que implique una acción ilegal será eliminado, también los que tengan la intención de sabotear los espacios de debate, todo lo demás está permitido.
|
||||
recommendations_title: Recomendaciones para crear un debate
|
||||
start_new: Empezar un debate
|
||||
suggestions:
|
||||
found:
|
||||
one: "Existe un debate con el término '%{query}', puedes participar en él en vez de abrir uno nuevo."
|
||||
other: "Existen debates con el término '%{query}', puedes participar en ellos en vez de abrir uno nuevo."
|
||||
message: "Estás viendo %{limit} de %{count} debates que contienen el término '%{query}'"
|
||||
see_all: "Ver todos"
|
||||
show:
|
||||
author_deleted: Usuario eliminado
|
||||
back_link: Volver
|
||||
@@ -307,12 +301,6 @@ es:
|
||||
recommendation_two: Cualquier propuesta o comentario que implique una acción ilegal será eliminada, también las que tengan la intención de sabotear los espacios de propuesta, todo lo demás está permitido.
|
||||
recommendations_title: Recomendaciones para crear una propuesta
|
||||
start_new: Crear una propuesta
|
||||
suggestions:
|
||||
found:
|
||||
one: "Existe una propuesta con el término '%{query}', puedes contribuir en ella en vez de crear una nueva."
|
||||
other: "Existen propuestas con el término '%{query}', puedes contribuir en ellas en vez de crear una nueva."
|
||||
message: "Estás viendo %{limit} de %{count} propuestas que contienen el término '%{query}'"
|
||||
see_all: "Ver todas"
|
||||
proposal:
|
||||
already_supported: "¡Ya has apoyado esta propuesta, compártela!"
|
||||
comments:
|
||||
@@ -377,6 +365,19 @@ es:
|
||||
flag: Denunciar como inapropiado
|
||||
print:
|
||||
print_button: Imprimir esta información
|
||||
suggest:
|
||||
debate:
|
||||
found:
|
||||
one: "Existe un debate con el término '%{query}', puedes participar en él en vez de abrir uno nuevo."
|
||||
other: "Existen debates con el término '%{query}', puedes participar en ellos en vez de abrir uno nuevo."
|
||||
message: "Estás viendo %{limit} de %{count} debates que contienen el término '%{query}'"
|
||||
see_all: "Ver todos"
|
||||
proposal:
|
||||
found:
|
||||
one: "Existe una propuesta con el término '%{query}', puedes participar en ella en vez de abrir uno nuevo."
|
||||
other: "Existen propuestas con el término '%{query}', puedes participar en ellas en vez de abrir uno nuevo."
|
||||
message: "Estás viendo %{limit} de %{count} propuestas que contienen el término '%{query}'"
|
||||
see_all: "Ver todas"
|
||||
tags_cloud:
|
||||
tags: Tendencias
|
||||
districts: "Distritos"
|
||||
|
||||
Reference in New Issue
Block a user