diff --git a/app/assets/fonts/icons.eot b/app/assets/fonts/icons.eot
index f43277dfc..8515de027 100644
Binary files a/app/assets/fonts/icons.eot and b/app/assets/fonts/icons.eot differ
diff --git a/app/assets/fonts/icons.svg b/app/assets/fonts/icons.svg
index d15481e5b..492cc8d0b 100644
--- a/app/assets/fonts/icons.svg
+++ b/app/assets/fonts/icons.svg
@@ -38,4 +38,6 @@
+
+
diff --git a/app/assets/fonts/icons.ttf b/app/assets/fonts/icons.ttf
index 7a786cc38..5f40432b1 100644
Binary files a/app/assets/fonts/icons.ttf and b/app/assets/fonts/icons.ttf differ
diff --git a/app/assets/fonts/icons.woff b/app/assets/fonts/icons.woff
index 0f52d3a54..e22db04bd 100644
Binary files a/app/assets/fonts/icons.woff and b/app/assets/fonts/icons.woff differ
diff --git a/app/assets/stylesheets/admin.scss b/app/assets/stylesheets/admin.scss
index 378ff15c0..26c38f17a 100644
--- a/app/assets/stylesheets/admin.scss
+++ b/app/assets/stylesheets/admin.scss
@@ -203,6 +203,12 @@ body.admin {
margin-left: rem-calc(12);
}
+.proposal-description {
+ height: rem-calc(60);
+ overflow: hidden;
+ max-width: rem-calc(750);
+}
+
// 04. Stats
// - - - - - - - - - - - - - - - - - - - - - - - - -
diff --git a/app/assets/stylesheets/debates.scss b/app/assets/stylesheets/debates.scss
index cfd0fc323..23e7d3a55 100644
--- a/app/assets/stylesheets/debates.scss
+++ b/app/assets/stylesheets/debates.scss
@@ -467,11 +467,17 @@
}
}
+ .debate-description {
+ font-size: rem-calc(15);
+ line-height: rem-calc(30);
+ }
+
ul, ol {
+ margin: rem-calc(12) 0;
li {
- font-size: rem-calc(13);
- margin-bottom: rem-calc(12);
+ font-size: rem-calc(15);
+ margin-bottom: rem-calc(15);
}
}
diff --git a/app/assets/stylesheets/icons.scss b/app/assets/stylesheets/icons.scss
index 7b2a6df3a..f7cc2303a 100644
--- a/app/assets/stylesheets/icons.scss
+++ b/app/assets/stylesheets/icons.scss
@@ -130,3 +130,9 @@
.icon-external:before {
content: "F";
}
+.icon-video:before {
+ content: "D";
+}
+.icon-document:before {
+ content: "G";
+}
diff --git a/app/assets/stylesheets/proposals.scss b/app/assets/stylesheets/proposals.scss
index 6a38a4efe..81eafc78e 100644
--- a/app/assets/stylesheets/proposals.scss
+++ b/app/assets/stylesheets/proposals.scss
@@ -39,6 +39,15 @@
}
}
+ .percentage {
+ font-size: rem-calc(10);
+ color: $brand;
+ vertical-align: top;
+ position: absolute;
+ top: 17px;
+ right: 18px;
+ }
+
abbr {
color: white;
@@ -400,6 +409,10 @@
}
}
+ h4 {
+ margin: rem-calc(12) 0;
+ }
+
.edit-proposal {
margin-bottom: 0;
}
@@ -422,11 +435,17 @@
}
}
+ .proposal-description {
+ font-size: rem-calc(15);
+ line-height: rem-calc(30);
+ }
+
ul, ol {
+ margin: rem-calc(12) 0;
li {
- font-size: rem-calc(13);
- margin-bottom: rem-calc(12);
+ font-size: rem-calc(15);
+ margin-bottom: rem-calc(15);
}
}
@@ -454,6 +473,45 @@
}
}
+ blockquote {
+ margin-top: rem-calc(12);
+ padding-top: 0;
+ font-size: rem-calc(15);
+ line-height: rem-calc(30);
+ }
+
+ .document-link {
+ border: 1px solid $border;
+ display: block;
+ margin-top: rem-calc(12);
+ padding: rem-calc(12);
+ position: relative;
+
+ a {
+ padding-left: rem-calc(24);
+ }
+
+ :before {
+ color: #007BB7;
+ content: "G";
+ font-family: "icons" !important;
+ font-size: rem-calc(24);
+ left: rem-calc(6);
+ padding-top: rem-calc(3);
+ position: absolute;
+ top: 0;
+ }
+ }
+
+ .video-link {
+ @extend .document-link;
+
+ :before {
+ color: #CC181E;
+ content: "D";
+ }
+ }
+
.supports {
@include supports;
border: 0;
@@ -470,23 +528,6 @@
line-height: $line-height;
padding: rem-calc(24);
}
-
- @media (min-width: $small-breakpoint + em-calc(1)) and (max-width:$medium-breakpoint) {
- .in-favor, .against {
- text-align: left;
- width: rem-calc(100);
- }
- }
-
- .divider {
- display: none;
- }
-
- @media (min-width: $medium-breakpoint) {
- .divider {
- display: inline-block;
- }
- }
}
.leave-comment {
diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb
index 54eadb947..1d56ae4d3 100644
--- a/app/helpers/application_helper.rb
+++ b/app/helpers/application_helper.rb
@@ -1,10 +1,5 @@
module ApplicationHelper
- def percentage(vote, debate)
- return "0%" if debate.total_votes == 0
- debate.send(vote).percent_of(debate.total_votes).to_s + "%"
- end
-
def home_page?
return false if user_signed_in?
# Using path because fullpath yields false negatives since it contains
diff --git a/app/helpers/votes_helper.rb b/app/helpers/votes_helper.rb
index dafb108c7..dc1df0396 100644
--- a/app/helpers/votes_helper.rb
+++ b/app/helpers/votes_helper.rb
@@ -1,5 +1,18 @@
module VotesHelper
+ def debate_percentage_of_likes(debate)
+ debate.likes.percent_of(debate.total_votes)
+ end
+
+ def votes_percentage(vote, debate)
+ return "0%" if debate.total_votes == 0
+ if vote == 'likes'
+ debate_percentage_of_likes(debate).to_s + "%"
+ elsif vote == 'dislikes'
+ (100 - debate_percentage_of_likes(debate)).to_s + "%"
+ end
+ end
+
def css_classes_for_vote(votes, votable)
case votes[votable.id]
when true
diff --git a/app/views/debates/_votes.html.erb b/app/views/debates/_votes.html.erb
index 89a03752f..970bcc8a5 100644
--- a/app/views/debates/_votes.html.erb
+++ b/app/views/debates/_votes.html.erb
@@ -4,7 +4,7 @@
<%= link_to vote_debate_path(debate, value: 'yes'),
class: "like #{voted_classes[:in_favor]}", title: t('votes.agree'), method: "post", remote: true do %>
- <%= percentage('likes', debate) %>
+ <%= votes_percentage('likes', debate) %>
<% end %>
@@ -13,7 +13,7 @@
<%= link_to vote_debate_path(debate, value: 'no'), class: "unlike #{voted_classes[:against]}", title: t('votes.disagree'), method: "post", remote: true do %>
- <%= percentage('dislikes', debate) %>
+ <%= votes_percentage('dislikes', debate) %>
<% end %>
diff --git a/app/views/moderation/proposals/index.html.erb b/app/views/moderation/proposals/index.html.erb
index c7abaf18a..f8939932b 100644
--- a/app/views/moderation/proposals/index.html.erb
+++ b/app/views/moderation/proposals/index.html.erb
@@ -40,7 +40,7 @@
•
<%= proposal.author.username %>
-
+
<%= proposal.description %>
@@ -51,7 +51,6 @@
<% end %>
-
<%= submit_tag t('moderation.proposals.index.block_authors'),
name: "block_authors",
class: "button radius alert",
diff --git a/app/views/proposals/_votes.html.erb b/app/views/proposals/_votes.html.erb
index 526b114d5..9443e548b 100644
--- a/app/views/proposals/_votes.html.erb
+++ b/app/views/proposals/_votes.html.erb
@@ -2,11 +2,13 @@
+
+ <%= supports_percentage(proposal) %> / <%= t("proposals.proposal.total_percent") %>
+
<%= t("proposals.proposal.supports", count: proposal.total_votes) %>
- (<%= supports_percentage(proposal) %>)
">
<%= t("proposals.proposal.supports_necessary") %>
diff --git a/app/views/proposals/show.html.erb b/app/views/proposals/show.html.erb
index 152712b50..de0bf2801 100644
--- a/app/views/proposals/show.html.erb
+++ b/app/views/proposals/show.html.erb
@@ -19,7 +19,6 @@
<% end %>
-
<%= avatar_image(@proposal.author, seed: @proposal.author_id, size: 32, class: 'author-photo') %>
@@ -53,6 +52,7 @@
<%= link_to t("proposals.show.comments", count: @proposal.comments_count), "#comments" %>
•
+ <%= link_to t("proposals.show.code") %>
<%= @proposal.code %>
•
@@ -60,16 +60,20 @@
- <%= @proposal.summary %>
+ <%= @proposal.summary %>
<%= safe_html_with_links @proposal.description %>
<% if @proposal.external_url.present? %>
- <%= text_with_links @proposal.external_url %>
+
+ <%= text_with_links @proposal.external_url %>
+
<% end %>
<% if @proposal.video_url.present? %>
- <%= text_with_links @proposal.video_url %>
+
+ <%= text_with_links @proposal.video_url %>
+
<% end %>
<%= @proposal.question %>
diff --git a/config/locales/en.yml b/config/locales/en.yml
index dd0a9c4da..a8c0c8d70 100644
--- a/config/locales/en.yml
+++ b/config/locales/en.yml
@@ -171,6 +171,7 @@ en:
other: "%{count} supports"
supports_necessary: "53.726 necessary supports"
census_percent: "2% of census"
+ total_percent: "100%"
already_supported: "You already supported this proposal!"
form:
proposal_title: Proposal title
@@ -191,6 +192,7 @@ en:
show:
back_link: Back
author_deleted: Deleted user
+ code: "Proposal code:"
comments_title: Comments
comments:
zero: No comments
diff --git a/config/locales/es.yml b/config/locales/es.yml
index f3c2a2f5e..8de1f4cc8 100644
--- a/config/locales/es.yml
+++ b/config/locales/es.yml
@@ -171,6 +171,7 @@ es:
other: "%{count} apoyos"
supports_necessary: "53.726 apoyos necesarios"
census_percent: "2% del Censo"
+ total_percent: "100%"
already_supported: "¡Ya has apoyado esta propuesta!"
form:
proposal_title: Título de la propuesta
@@ -191,6 +192,7 @@ es:
show:
back_link: Volver
author_deleted: Usuario eliminado
+ code: "Código de la propuesta:"
comments_title: Comentarios
comments:
zero: Sin comentarios
diff --git a/spec/helpers/votes_helper_spec.rb b/spec/helpers/votes_helper_spec.rb
index 96be3b3fe..d695b881a 100644
--- a/spec/helpers/votes_helper_spec.rb
+++ b/spec/helpers/votes_helper_spec.rb
@@ -18,4 +18,15 @@ describe VotesHelper do
end
end
+ describe "#votes_percentage" do
+ it "should always sum 100%" do
+ debate = create(:debate)
+ create_list(:vote, 8, votable: debate, vote_flag: true)
+ create_list(:vote, 3, votable: debate, vote_flag: false)
+
+ expect(votes_percentage('likes', debate)).to eq("72%")
+ expect(votes_percentage('dislikes', debate)).to eq("28%")
+ end
+ end
+
end
\ No newline at end of file