merges with master and fixes conflicts

This commit is contained in:
kikito
2015-10-31 17:09:52 +01:00
87 changed files with 1747 additions and 1343 deletions

Binary file not shown.

After

Width:  |  Height:  |  Size: 55 KiB

View File

@@ -92,6 +92,10 @@ body.admin {
}
}
.for-print-only {
display: none;
}
// 02. Sidebar
// - - - - - - - - - - - - - - - - - - - - - - - - -

View File

@@ -687,6 +687,7 @@ header {
line-height: $line-height*3;
margin-left: rem-calc(12);
margin-right: rem-calc(36);
margin-right: 12px\9;
}
&:after {
@@ -898,6 +899,13 @@ form.locale-form {
select {
background-image: image-url("language_select.png");
option {
background: white;
color: $text;
border: 0;
outline: none;
}
&.locale-switcher {
background-color: transparent;
border: 0;
@@ -916,6 +924,19 @@ form {
line-height: $line-height;
}
input, textarea {
height: 48px\9;
line-height: 48px\9;
margin-bottom: 24px\9;
width: 100%\9;
}
input[type="checkbox"] {
height: auto\9;
line-height: inherit\9;
width: auto\9;
}
input[type]:not([type=submit]):not([type=file]):not([type=checkbox]) {
background: $input-bg;
height: rem-calc(48);

View File

@@ -2,6 +2,8 @@
/* Print proposals */
.admin-content { margin-top: 0 !important; }
.tags a { display: none !important; }
.supports { display: none !important; }
@@ -24,7 +26,7 @@ img.left { display: none !important; }
.captcha { display: none !important; }
li.name span { display: none !important; }
li.name { display: none !important; }
p.proposal-info span:nth-child(3) { display: none !important; }
@@ -36,11 +38,22 @@ p.proposal-info span:nth-child(3) { display: none !important; }
input[type="submit"] { display: none !important; }
.filters h2 { margin: 0 !important; font-size: 20px !important; line-height: 20px !important; width: auto !important; }
.search-results h2 { margin: 0 !important; font-size: 20px !important; line-height: 20px !important; }
.admin h2 { font-size: 20px !important; line-height: 20px !important; }
.select-order {
border: 0;
font-size: 24px;
font-weight: bold;
margin-left: -6px;
border: 0 !important;
font-size: 20px !important;
font-weight: bold !important;
line-height: 20px !important;
margin-left: 10px !important;
margin-top: 0 !important;
margin-bottom: 0 !important;
margin-right: 0 !important;
padding: 0 !important;
}
p.proposal-info { margin-left: -6px; }
@@ -49,16 +62,26 @@ a { text-decoration: none !important; }
a:after { content: none !important; }
.proposal .panel { min-height: auto !important; }
.proposal .panel { min-height: auto !important; margin: 0 !important; padding-bottom: 0 !important; padding-left: 0 !important; }
.proposal .panel .proposal-content { min-height: auto !important; }
.proposal .panel h3 { min-height: auto !important; }
.proposal .panel h3 { min-height: auto !important; font-size: 16px !important; }
.proposal .panel .proposal-description { height: auto; }
.proposal .panel .proposal-description { height: auto !important; margin-bottom: 0 !important; }
.proposal .panel {
border-left: 0 !important;
border-right: 0 !important;
border-top: 0 !important;
}
.for-print-only { display: block !important; }
.for-print-only p { font-size: 14px !important; line-height: 24px !important; }
.not-print { display: none !important; }
.date-for-print { font-size: 14px !important; line-height: 20px !important; }
.filters { height: 48px !important;}

View File

@@ -6,8 +6,6 @@ class ApplicationController < ActionController::Base
include HasOrders
before_action :authenticate_http_basic, if: :http_basic_auth_site?
before_action :authenticate_user!, unless: :devise_controller?, if: :beta_site?
before_action :authenticate_beta_tester!, unless: :devise_controller?, if: :beta_site?
before_action :ensure_signup_complete
before_action :set_locale
@@ -33,21 +31,6 @@ class ApplicationController < ActionController::Base
end
end
def authenticate_beta_tester!
unless signed_in? && beta_testers.include?(current_user.email)
sign_out(current_user)
redirect_to new_user_session_path, alert: t('application.alert.only_beta_testers')
end
end
def beta_testers
File.readlines('config/beta-testers.txt').map {|email| email.strip }
end
def beta_site?
Rails.application.secrets.beta_site
end
def http_basic_auth_site?
Rails.application.secrets.http_basic_auth
end

View File

@@ -13,7 +13,7 @@ class ProposalsController < ApplicationController
respond_to :html, :js
def index_customization
@featured_proposals = Proposal.all.sort_by_confidence_score.limit(3) if @search_terms.blank?
@featured_proposals = Proposal.all.sort_by_confidence_score.limit(3) if (@search_terms.blank? && @tag_filter.blank?)
if @featured_proposals.present?
set_featured_proposal_votes(@featured_proposals)
@resources = @resources.where('proposals.id NOT IN (?)', @featured_proposals.map(&:id))

View File

@@ -5,6 +5,7 @@ class Debate < ActiveRecord::Base
include Conflictable
include Measurable
include Sanitizable
include PgSearch
apply_simple_captcha
acts_as_votable
@@ -36,6 +37,22 @@ class Debate < ActiveRecord::Base
# Ahoy setup
visitable # Ahoy will automatically assign visit_id on create
pg_search_scope :pg_search, {
against: {
title: 'A',
description: 'B'
},
associated_against: {
tags: :name
},
using: {
tsearch: { dictionary: "spanish" },
trigram: { threshold: 0.1 },
},
ranked_by: '(:tsearch + debates.cached_votes_up)',
order_within_rank: "debates.created_at DESC"
}
def description
super.try :html_safe
end

View File

@@ -4,6 +4,7 @@ class Proposal < ActiveRecord::Base
include Conflictable
include Measurable
include Sanitizable
include PgSearch
apply_simple_captcha
acts_as_votable
@@ -38,12 +39,30 @@ class Proposal < ActiveRecord::Base
scope :sort_by_random, -> { order("RANDOM()") }
scope :sort_by_flags, -> { order(flags_count: :desc, updated_at: :desc) }
pg_search_scope :pg_search, {
against: {
title: 'A',
question: 'B',
summary: 'C',
description: 'D'
},
associated_against: {
tags: :name
},
using: {
tsearch: { dictionary: "spanish" },
trigram: { threshold: 0.1 },
},
ranked_by: '(:tsearch + proposals.cached_votes_up)',
order_within_rank: "proposals.created_at DESC"
}
def description
super.try :html_safe
end
def total_votes
cached_votes_up
cached_votes_up + physical_votes
end
def editable?
@@ -74,14 +93,13 @@ class Proposal < ActiveRecord::Base
def calculate_hot_score
self.hot_score = ScoreCalculator.hot_score(created_at,
cached_votes_up,
cached_votes_up,
total_votes,
total_votes,
comments_count)
end
def calculate_confidence_score
self.confidence_score = ScoreCalculator.confidence_score(cached_votes_up,
cached_votes_up)
self.confidence_score = ScoreCalculator.confidence_score(total_votes, total_votes)
end
def after_hide
@@ -93,7 +111,7 @@ class Proposal < ActiveRecord::Base
end
def self.search(terms)
terms.present? ? where("title ILIKE ? OR description ILIKE ? OR question ILIKE ?", "%#{terms}%", "%#{terms}%", "%#{terms}%") : none
self.pg_search(terms)
end
def self.votes_needed_for_success

View File

@@ -60,7 +60,6 @@
<div class="row-full subnavigation-container">
<section class="subnavigation row">
<div class="small-12 medium-8 column">
<%= link_to t("layouts.header.highlights"), highlights_path, class: ("active" if current_page? highlights_path) %>
<%= link_to t("layouts.header.debates"), debates_path, class: ("active" if current_page?(controller: "/debates")) %>
<%= link_to t("layouts.header.proposals"), proposals_path, class: ("active" if current_page?(controller: "/proposals")) %>
<%= link_to t("layouts.header.more_information"), "/more_information", class: ("active" if current_page?("/more_information")) %>

View File

@@ -5,14 +5,24 @@
<%= t('management.proposals.print.print_button') %>
</a>
<%= image_tag "header_print_proposals.jpg", class: "for-print-only" %>
<div class="filters">
<span class="for-print-only date-for-print"><%= l Date.today, format: :long %></span>
<h2 class="inline-block">
<%= t("proposals.index.select_order_long") %>
<span class="not-print"><%= t("proposals.index.select_order_long") %></span>
<span class="for-print-only"><%= t("management.print.proposals_title") %></span>
</h2>
<%= render 'shared/order_selector', i18n_namespace: "proposals.index" %>
</div>
<%= render @proposals %>
<div class="for-print-only">
<p><strong><%= t("management.print.info") %></strong><br>
<%= t("management.print.note") %></p>
</div>
</div>
</div>
</section>