diff --git a/app/controllers/welcome_controller.rb b/app/controllers/welcome_controller.rb index d0c650fa3..5aec4a456 100644 --- a/app/controllers/welcome_controller.rb +++ b/app/controllers/welcome_controller.rb @@ -4,9 +4,6 @@ class WelcomeController < ApplicationController layout "devise", only: [:welcome, :verification] def index - if current_user - redirect_to :proposals - end end def welcome diff --git a/app/helpers/welcome_helper.rb b/app/helpers/welcome_helper.rb new file mode 100644 index 000000000..78c01b141 --- /dev/null +++ b/app/helpers/welcome_helper.rb @@ -0,0 +1,11 @@ +module WelcomeHelper + + def active_class(index) + "is-active is-in" if index == 0 + end + + def slide_display(index) + "display: none;" if index > 0 + end + +end diff --git a/app/models/user.rb b/app/models/user.rb index 60536195b..1a26030ea 100644 --- a/app/models/user.rb +++ b/app/models/user.rb @@ -313,6 +313,24 @@ class User < ActiveRecord::Base follows.map{|follow| follow.followable.tags.map(&:name)}.flatten.compact.uniq end + def recommended_debates + Debate.tagged_with(interests, any: true). + where("author_id != ?", self). + order("cached_votes_total DESC").limit(3) + end + + def recommended_proposals + Proposal.tagged_with(interests, any: true). + where("author_id != ?", self). + order("cached_votes_up DESC").limit(3) + end + + def recommended_budget_investments + Budget::Investment.tagged_with(interests, any: true). + where("author_id != ?", self). + order("cached_votes_up DESC").limit(3) + end + private def clean_document_number diff --git a/app/views/proposals/index.html.erb b/app/views/proposals/index.html.erb index e1c04c607..5d51ad279 100644 --- a/app/views/proposals/index.html.erb +++ b/app/views/proposals/index.html.erb @@ -16,13 +16,13 @@
<% if @search_terms || @advanced_search_terms %> -

<%= t("shared.search_results") %>

-

- <%= page_entries_info @proposals %> - <% if !@advanced_search_terms %> - <%= t("proposals.index.search_results_html", count: @proposals.size, search_term: @search_terms) %> - <% end %> -

+

<%= t("shared.search_results") %>

+

+ <%= page_entries_info @proposals %> + <% if !@advanced_search_terms %> + <%= t("proposals.index.search_results_html", count: @proposals.size, search_term: @search_terms) %> + <% end %> +

<% elsif @tag_filter %>

<%= t("shared.search_results") %>

diff --git a/app/views/welcome/_recommended_no_image.html.erb b/app/views/welcome/_recommended_no_image.html.erb index 8fc04488c..495bccc5c 100644 --- a/app/views/welcome/_recommended_no_image.html.erb +++ b/app/views/welcome/_recommended_no_image.html.erb @@ -1,128 +1,107 @@

-

Recomendaciones que te pueden interesar

-
+

<%= t("welcome.recommended.title") %>

+ +
-

Debates recomendados

+ +

<%= t("welcome.recommended.debates.title") %>

+
+
    -
  • -
    -
    -
    Titulo debate 1
    -

    Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua

    -
    -
    -
  • + <% current_user.recommended_debates.each_with_index do |debate, index| %> -
  • +
    +
    +
    <%= debate.title %>
    +

    <%= debate.description %>

    + +
    -
- + - + <% end %> + +
+ +
+ +
-
- - -
-
- +
-

Propuestas recomendadas

+ +

<%= t("welcome.recommended.proposals.title") %>

+
-
    -
  • -
    -
    -
    Titulo propuesta 1
    -

    Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua

    -
    -
    -
  • - - + + + <% end %>
+
-
+ +
-
+
+
-
+
+
+ +

<%= t("welcome.recommended.budget_investments.title") %>

-
-

Presupuestos recomendados

-
    -
  • -
    -
    -
    Titulo presupuesto 1
    -

    Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua

    -
    -
    -
  • - - + + + <% end %>
+
-
+ +
-
-
+
+ +
diff --git a/app/views/welcome/index.html.erb b/app/views/welcome/index.html.erb index 727ec67b7..a9b2d455c 100644 --- a/app/views/welcome/index.html.erb +++ b/app/views/welcome/index.html.erb @@ -45,3 +45,5 @@
<% end %> + +<%= render "recommended_no_image" %> diff --git a/config/locales/en/general.yml b/config/locales/en/general.yml index aea5c65c8..28e294c03 100644 --- a/config/locales/en/general.yml +++ b/config/locales/en/general.yml @@ -713,6 +713,14 @@ en: proposal: description: Open space for citizen proposals about the kind of city we want to live in. title: You propose + recommended: + title: Recommendations that may interest you + debates: + title: Recommended debates + proposals: + title: Recommended proposals + budget_investments: + title: Recommended investments verification: i_dont_have_an_account: I don't have an account i_have_an_account: I already have an account diff --git a/config/locales/es/general.yml b/config/locales/es/general.yml index 3f21ed55f..47aae4544 100644 --- a/config/locales/es/general.yml +++ b/config/locales/es/general.yml @@ -713,6 +713,14 @@ es: proposal: description: Espacio abierto para propuestas ciudadanas sobre el tipo de ciudad en el que queremos vivir. title: Propones + recommended: + title: Recomendaciones que te pueden interesar + debates: + title: Debates recomendados + proposals: + title: Propuestas recomendados + budget_investments: + title: Presupuestos recomendados verification: i_dont_have_an_account: No tengo cuenta, quiero crear una y verificarla i_have_an_account: Ya tengo una cuenta que quiero verificar