diff --git a/app/controllers/welcome_controller.rb b/app/controllers/welcome_controller.rb
deleted file mode 100644
index dd09ea984..000000000
--- a/app/controllers/welcome_controller.rb
+++ /dev/null
@@ -1,6 +0,0 @@
-class WelcomeController < ApplicationController
-
- def index
- end
-
-end
diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb
index e3f79f023..32cb386c8 100644
--- a/app/helpers/application_helper.rb
+++ b/app/helpers/application_helper.rb
@@ -4,4 +4,8 @@ module ApplicationHelper
debate.tag_list.map { |tag| link_to sanitize(tag), debates_path(tag: tag) }.join(', ').html_safe
end
+ def percentage(vote, debate)
+ return if debate.total_votes == 0
+ debate.send(vote).percent_of(debate.total_votes).to_s + "%"
+ end
end
diff --git a/app/models/debate.rb b/app/models/debate.rb
index 0bebf6b8e..01dfa07c3 100644
--- a/app/models/debate.rb
+++ b/app/models/debate.rb
@@ -12,12 +12,6 @@ class Debate < ActiveRecord::Base
validates :terms_of_service, acceptance: { allow_nil: false }, on: :create
- #vote can be 'likes' or 'dislikes'
- def percentage(vote)
- return if total_votes == 0
- send(vote).percent_of(total_votes)
- end
-
def likes
get_likes.size
end
diff --git a/app/views/debates/show.html.erb b/app/views/debates/show.html.erb
index 5efdd833a..af8f60720 100644
--- a/app/views/debates/show.html.erb
+++ b/app/views/debates/show.html.erb
@@ -1,38 +1,40 @@
-
+
<%= link_to "up", debate_votes_path(@debate, value: 'yes'), method: "post" %>
- <%= @debate.percentage('likes') %>%
+ <%= percentage('likes', @debate) %>
<%= link_to "down", debate_votes_path(@debate, value: 'no'), method: "post" %>
- <%= @debate.percentage('dislikes') %>%
+ <%= percentage('dislikes', @debate) %>
Votos <%= @debate.total_votes %>
+
+
+
+ <%= render 'shared/tags', debate: @debate %>
-<%= render 'shared/tags', debate: @debate %>
-
-
-Deja tu comentario
-<%= render 'comments/form', parent: @debate %>
-
+Deja tu comentario
+<%= render 'comments/form', parent: @debate %>
+
+
<%= link_to 'Edit', edit_debate_path(@debate) %> |
<%= link_to 'Back', debates_path %>
\ No newline at end of file
diff --git a/app/views/devise/menu/_login_items.html.erb b/app/views/devise/menu/_login_items.html.erb
index 0a0c85430..797656f94 100644
--- a/app/views/devise/menu/_login_items.html.erb
+++ b/app/views/devise/menu/_login_items.html.erb
@@ -1,9 +1,11 @@
-<% if user_signed_in? %>
-
- <%= link_to('Logout', destroy_user_session_path, method: :delete) %>
-
-<% else %>
-
- <%= link_to('Login', new_user_session_path) %>
-
-<% end %>
\ No newline at end of file
+
+ <% if user_signed_in? %>
+
+ <%= link_to('Logout', destroy_user_session_path, method: :delete) %>
+
+ <% else %>
+
+ <%= link_to('Login', new_user_session_path) %>
+
+ <% end %>
+
\ No newline at end of file
diff --git a/app/views/layouts/application.html.erb b/app/views/layouts/application.html.erb
index bb1a5c28f..85f4e3838 100644
--- a/app/views/layouts/application.html.erb
+++ b/app/views/layouts/application.html.erb
@@ -11,7 +11,7 @@
<%= javascript_include_tag "application", 'data-turbolinks-track' => true %>
<%= csrf_meta_tags %>
-
+
<%= notice %>
<%= alert %>
diff --git a/app/views/welcome/index.html.erb b/app/views/welcome/index.html.erb
deleted file mode 100644
index c71238c69..000000000
--- a/app/views/welcome/index.html.erb
+++ /dev/null
@@ -1 +0,0 @@
-
Bienvenido al Ayuntamiento de Madrid
diff --git a/config/routes.rb b/config/routes.rb
index 4522da3d3..a364ef871 100644
--- a/config/routes.rb
+++ b/config/routes.rb
@@ -5,7 +5,7 @@ Rails.application.routes.draw do
# See how all your routes lay out with "rake routes".
# You can have the root of your site routed with "root"
- root 'welcome#index'
+ root 'debates#index'
resources :debates do
resources :votes, only: :create
resources :comments, only: :create
diff --git a/spec/features/home_spec.rb b/spec/features/home_spec.rb
index 0fa8b3255..5812ebb9d 100644
--- a/spec/features/home_spec.rb
+++ b/spec/features/home_spec.rb
@@ -4,7 +4,7 @@ feature "Home" do
scenario "Welcome message" do
visit '/'
- expect(page).to have_content 'Bienvenido al Ayuntamiento de Madrid'
+ expect(page).to have_content 'Debates sobre Madrid'
end
end
Comentarios
<%= render @debate.root_comments %>