Merge branch 'master' into legislation-module-stable

This commit is contained in:
Amaia Castro
2017-01-02 11:56:17 +01:00
11 changed files with 26 additions and 15 deletions

View File

@@ -50,7 +50,7 @@ class Proposal < ActiveRecord::Base
scope :last_week, -> { where("proposals.created_at >= ?", 7.days.ago)} scope :last_week, -> { where("proposals.created_at >= ?", 7.days.ago)}
scope :retired, -> { where.not(retired_at: nil) } scope :retired, -> { where.not(retired_at: nil) }
scope :not_retired, -> { where(retired_at: nil) } scope :not_retired, -> { where(retired_at: nil) }
scope :successfull, -> { where("cached_votes_up + physical_votes >= ?", Proposal.votes_needed_for_success)} scope :successfull, -> { where("cached_votes_up >= ?", Proposal.votes_needed_for_success)}
def to_param def to_param
"#{id}-#{title}".parameterize "#{id}-#{title}".parameterize
@@ -99,7 +99,7 @@ class Proposal < ActiveRecord::Base
end end
def total_votes def total_votes
cached_votes_up + physical_votes cached_votes_up
end end
def voters def voters

View File

@@ -0,0 +1,5 @@
<meta name="description"
content="<%= content_for?(:meta_description) ? yield(:meta_description) : setting["meta_description"] %>" />
<meta name="keywords"
content="<%= content_for?(:meta_keywords) ? yield(:meta_keywords) : setting["meta_keywords"] %>" />

View File

@@ -4,7 +4,8 @@
<meta charset="utf-8" /> <meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" /> <meta name="viewport" content="width=device-width, initial-scale=1.0" />
<meta http-equiv="X-UA-Compatible" content="IE=edge" /> <meta http-equiv="X-UA-Compatible" content="IE=edge" />
<%=render "layouts/tracking_data"%> <%= render "layouts/tracking_data" %>
<%= render "layouts/meta_tags" %>
<title><%= content_for?(:title) ? yield(:title) : setting['org_name'] %></title> <title><%= content_for?(:title) ? yield(:title) : setting['org_name'] %></title>
<%= stylesheet_link_tag "application" %> <%= stylesheet_link_tag "application" %>
<!--[if lt IE 9]> <!--[if lt IE 9]>

View File

@@ -5,6 +5,7 @@
<meta name="viewport" content="width=device-width, initial-scale=1.0" /> <meta name="viewport" content="width=device-width, initial-scale=1.0" />
<meta http-equiv="X-UA-Compatible" content="IE=edge" /> <meta http-equiv="X-UA-Compatible" content="IE=edge" />
<title><%= content_for?(:title) ? yield(:title) : "Gobierno abierto" %></title> <title><%= content_for?(:title) ? yield(:title) : "Gobierno abierto" %></title>
<%= render "layouts/meta_tags" %>
<%= stylesheet_link_tag "application" %> <%= stylesheet_link_tag "application" %>
<%= javascript_include_tag "application", 'data-turbolinks-track' => true %> <%= javascript_include_tag "application", 'data-turbolinks-track' => true %>
<%= csrf_meta_tags %> <%= csrf_meta_tags %>

View File

@@ -34,3 +34,5 @@ en:
legislation: Legislation legislation: Legislation
mailer_from_name: Origin email name mailer_from_name: Origin email name
mailer_from_address: Origin email address mailer_from_address: Origin email address
meta_description: "Site description (SEO)"
meta_keywords: "Keywords (SEO)"

View File

@@ -34,3 +34,5 @@ es:
legislation: Legislación legislation: Legislación
mailer_from_name: Nombre email remitente mailer_from_name: Nombre email remitente
mailer_from_address: Dirección email remitente mailer_from_address: Dirección email remitente
meta_description: "Descripción del sitio (SEO)"
meta_keywords: "Palabras clave (SEO)"

View File

@@ -36,7 +36,8 @@ Setting.create(key: 'per_page_code', value: "")
Setting.create(key: 'comments_body_max_length', value: '1000') Setting.create(key: 'comments_body_max_length', value: '1000')
Setting.create(key: 'mailer_from_name', value: 'Consul') Setting.create(key: 'mailer_from_name', value: 'Consul')
Setting.create(key: 'mailer_from_address', value: 'noreply@consul.dev') Setting.create(key: 'mailer_from_address', value: 'noreply@consul.dev')
Setting.create(key: 'meta_description', value: 'Citizen Participation and Open Government Application')
Setting.create(key: 'meta_keywords', value: 'citizen participation, open government')
puts "Creating Geozones" puts "Creating Geozones"
('A'..'Z').each { |i| Geozone.create(name: "District #{i}", external_code: i.ord, census_code: i.ord) } ('A'..'Z').each { |i| Geozone.create(name: "District #{i}", external_code: i.ord, census_code: i.ord) }

View File

@@ -0,0 +1,5 @@
class RemovePhysicalVotesFromProposals < ActiveRecord::Migration
def change
remove_column :proposals, :physical_votes
end
end

View File

@@ -11,7 +11,7 @@
# #
# It's strongly recommended that you check this file into your version control system. # It's strongly recommended that you check this file into your version control system.
ActiveRecord::Schema.define(version: 20161222180927) do ActiveRecord::Schema.define(version: 20161229110336) do
# These are extensions that must be enabled in order to support this database # These are extensions that must be enabled in order to support this database
enable_extension "plpgsql" enable_extension "plpgsql"
@@ -383,7 +383,6 @@ ActiveRecord::Schema.define(version: 20161222180927) do
t.string "responsible_name", limit: 60 t.string "responsible_name", limit: 60
t.text "summary" t.text "summary"
t.string "video_url" t.string "video_url"
t.integer "physical_votes", default: 0
t.tsvector "tsv" t.tsvector "tsv"
t.integer "geozone_id" t.integer "geozone_id"
t.datetime "retired_at" t.datetime "retired_at"

View File

@@ -57,6 +57,10 @@ Setting["org_name"] = "Consul"
# Consul installation place name (City, Country...) # Consul installation place name (City, Country...)
Setting["place_name"] = "Consul-land" Setting["place_name"] = "Consul-land"
# Meta tags for SEO
Setting["meta_description"] = nil
Setting["meta_keywords"] = nil
# Feature flags # Feature flags
Setting['feature.debates'] = true Setting['feature.debates'] = true
Setting['feature.spending_proposals'] = true Setting['feature.spending_proposals'] = true

View File

@@ -13,11 +13,6 @@ describe ProposalsHelper do
expect(progress_bar_percentage(proposal)).to eq 50 expect(progress_bar_percentage(proposal)).to eq 50
end end
it "should take into account the physical votes" do
proposal = create(:proposal, cached_votes_up: ((Proposal.votes_needed_for_success/2)-100), physical_votes: 100)
expect(progress_bar_percentage(proposal)).to eq 50
end
it "should be 100 if there are more votes than needed" do it "should be 100 if there are more votes than needed" do
proposal = create(:proposal, cached_votes_up: Proposal.votes_needed_for_success*2) proposal = create(:proposal, cached_votes_up: Proposal.votes_needed_for_success*2)
expect(progress_bar_percentage(proposal)).to eq 100 expect(progress_bar_percentage(proposal)).to eq 100
@@ -45,10 +40,6 @@ describe ProposalsHelper do
expect(supports_percentage(proposal)).to eq "100%" expect(supports_percentage(proposal)).to eq "100%"
end end
it "should take into account the physical votes" do
proposal = create(:proposal, physical_votes: Proposal.votes_needed_for_success/2)
expect(supports_percentage(proposal)).to eq "50%"
end
end end
end end