Merge branch 'master' into budgets
This commit is contained in:
@@ -942,16 +942,12 @@ img.avatar, img.admin-avatar, img.moderator-avatar, img.initialjs-avatar {
|
||||
}
|
||||
|
||||
.author-deleted, .user-deleted {
|
||||
background-color: rgba(255,255,255,.5);
|
||||
color: rgba(0,0,0,.4);
|
||||
font-size: rem-calc(40);
|
||||
left: 11px;
|
||||
position: absolute;
|
||||
top: 72px;
|
||||
}
|
||||
|
||||
.user-deleted {
|
||||
top: -4px;
|
||||
display: inline-block;
|
||||
font-size: rem-calc(32);
|
||||
line-height: rem-calc(32);
|
||||
height: rem-calc(32);
|
||||
vertical-align: top;
|
||||
}
|
||||
|
||||
.user-permissions {
|
||||
@@ -1110,10 +1106,6 @@ img.avatar, img.admin-avatar, img.moderator-avatar, img.initialjs-avatar {
|
||||
background: #C0392B;
|
||||
}
|
||||
|
||||
.is-deleted {
|
||||
background: #E7E7E7;
|
||||
}
|
||||
|
||||
.level-1 {
|
||||
background: #1ABC9C;
|
||||
}
|
||||
@@ -1642,7 +1634,10 @@ table {
|
||||
}
|
||||
|
||||
.comment-body {
|
||||
margin-left: rem-calc(42);
|
||||
|
||||
img {
|
||||
margin-right: $line-height/2;
|
||||
}
|
||||
|
||||
.reply {
|
||||
background: white;
|
||||
@@ -1650,20 +1645,28 @@ table {
|
||||
border-left: 0;
|
||||
border-right: 0;
|
||||
font-size: $small-font-size;
|
||||
margin: rem-calc(6) 0;
|
||||
padding: rem-calc(6);
|
||||
margin: $line-height/4 0;
|
||||
padding: $line-height/4;
|
||||
position: relative;
|
||||
|
||||
a.relative, [class^="icon-arrow"] {
|
||||
padding-left: $line-height/2;
|
||||
}
|
||||
|
||||
[class^="icon-arrow"] {
|
||||
font-size: rem-calc(18);
|
||||
font-size: $base-font-size;
|
||||
left: -20px;
|
||||
position: absolute;
|
||||
top: 0;
|
||||
top: -1px;
|
||||
}
|
||||
|
||||
.divider {
|
||||
color: $text-light;
|
||||
}
|
||||
|
||||
form {
|
||||
margin-top: $line-height/2;
|
||||
}
|
||||
}
|
||||
|
||||
.comment-user {
|
||||
@@ -1691,27 +1694,19 @@ table {
|
||||
}
|
||||
}
|
||||
|
||||
.is-deleted {
|
||||
background: #E7E7E7;
|
||||
margin-left: rem-calc(42);
|
||||
padding: $line-height/4 $line-height/2;
|
||||
}
|
||||
|
||||
.comment-children {
|
||||
border-left: 1px dashed $border;
|
||||
margin-left: rem-calc(42);
|
||||
padding-left: $line-height/4;
|
||||
|
||||
@media only screen and (max-width: 40em) {
|
||||
display: inline-block;
|
||||
margin-left: rem-calc(16);
|
||||
}
|
||||
padding-left: rem-calc(8);
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
.comment-info {
|
||||
color: $text-medium;
|
||||
display: inline-block;
|
||||
font-size: $small-font-size;
|
||||
margin-top: $line-height/4;
|
||||
vertical-align: middle;
|
||||
line-height: rem-calc(32); // Same as avatar height
|
||||
|
||||
span.user-name {
|
||||
color: $text;
|
||||
@@ -1744,6 +1739,11 @@ table {
|
||||
}
|
||||
}
|
||||
|
||||
.comment-form {
|
||||
display: inline-block;
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
// 16. Flags
|
||||
// ---------
|
||||
|
||||
|
||||
@@ -328,9 +328,13 @@
|
||||
clear: both;
|
||||
color: $text-medium;
|
||||
font-size: $small-font-size;
|
||||
min-height: $line-height*2;
|
||||
margin-bottom: $line-height/2;
|
||||
position: relative;
|
||||
|
||||
span {
|
||||
line-height: rem-calc(32); // Same as avatar height
|
||||
}
|
||||
|
||||
a {
|
||||
color: $text-medium;
|
||||
}
|
||||
@@ -340,15 +344,6 @@
|
||||
line-height: $line-height;
|
||||
margin: 0;
|
||||
}
|
||||
|
||||
.author-deleted {
|
||||
left: 0;
|
||||
top: 4px;
|
||||
}
|
||||
|
||||
.author.deleted {
|
||||
margin-left: rem-calc(48);
|
||||
}
|
||||
}
|
||||
|
||||
.debate-description, .proposal-description {
|
||||
@@ -373,9 +368,9 @@
|
||||
}
|
||||
|
||||
.author-photo {
|
||||
line-height: $line-height*2;
|
||||
line-height: rem-calc(32);
|
||||
margin-right: rem-calc(6);
|
||||
vertical-align: middle;
|
||||
vertical-align: top;
|
||||
width: 32px;
|
||||
}
|
||||
|
||||
|
||||
@@ -50,7 +50,7 @@ class Proposal < ActiveRecord::Base
|
||||
scope :last_week, -> { where("proposals.created_at >= ?", 7.days.ago)}
|
||||
scope :retired, -> { where.not(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
|
||||
"#{id}-#{title}".parameterize
|
||||
@@ -95,7 +95,7 @@ class Proposal < ActiveRecord::Base
|
||||
end
|
||||
|
||||
def total_votes
|
||||
cached_votes_up + physical_votes
|
||||
cached_votes_up
|
||||
end
|
||||
|
||||
def voters
|
||||
|
||||
@@ -10,6 +10,8 @@ class Signature < ActiveRecord::Base
|
||||
|
||||
delegate :signable, to: :signature_sheet
|
||||
|
||||
before_validation :clean_document_number
|
||||
|
||||
def verified?
|
||||
user_exists? || in_census?
|
||||
end
|
||||
@@ -58,6 +60,11 @@ class Signature < ActiveRecord::Base
|
||||
User.create!(user_params)
|
||||
end
|
||||
|
||||
def clean_document_number
|
||||
return if self.document_number.blank?
|
||||
self.document_number = self.document_number.gsub(/[^a-z0-9]+/i, "").upcase
|
||||
end
|
||||
|
||||
def random_password
|
||||
(0...20).map { ('a'..'z').to_a[rand(26)] }.join
|
||||
end
|
||||
|
||||
@@ -22,14 +22,14 @@ class SignatureSheet < ActiveRecord::Base
|
||||
|
||||
def verify_signatures
|
||||
parsed_document_numbers.each do |document_number|
|
||||
signature = signatures.create(document_number: document_number)
|
||||
signature = self.signatures.where(document_number: document_number).first_or_create
|
||||
signature.verify
|
||||
end
|
||||
update(processed: true)
|
||||
end
|
||||
|
||||
def parsed_document_numbers
|
||||
document_numbers.split(/\W+/)
|
||||
document_numbers.split(/\r\n|\n|[,]/).collect {|d| d.gsub(/\s+/, '') }
|
||||
end
|
||||
|
||||
def signable_found
|
||||
|
||||
@@ -8,6 +8,11 @@
|
||||
<strong><%= @signature_sheet.author.name %></strong>
|
||||
</div>
|
||||
|
||||
<h3 id="document_count" class="block">
|
||||
<%= t("admin.signature_sheets.show.document_count") %>
|
||||
<%= @signature_sheet.signatures.count %>
|
||||
</h3>
|
||||
|
||||
<div class="callout margin-top">
|
||||
<p><strong><%= t("admin.signature_sheets.show.documents") %></strong></p>
|
||||
<%= simple_format @signature_sheet.document_numbers %>
|
||||
|
||||
@@ -1,11 +1,10 @@
|
||||
<% comment_flags ||= @comment_flags %>
|
||||
<% cache [locale_and_user_status(comment), comment, commentable_cache_key(comment.commentable), comment.author, (comment_flags[comment.id] if comment_flags)] do %>
|
||||
<div class="row">
|
||||
<ul id="<%= dom_id(comment) %>" class="comment no-bullet small-12 column">
|
||||
|
||||
<ul id="<%= dom_id(comment) %>" class="comment no-bullet small-12">
|
||||
<li class="comment-body">
|
||||
<% if comment.hidden? || comment.user.hidden? %>
|
||||
<% if comment.children.size > 0 %>
|
||||
<div class="is-deleted">
|
||||
<div class="callout secondary">
|
||||
<p><%= t("comments.comment.deleted") %></p>
|
||||
</div>
|
||||
<% end %>
|
||||
@@ -24,7 +23,6 @@
|
||||
<% end %>
|
||||
<% end %>
|
||||
|
||||
<li class="comment-body">
|
||||
<div class="comment-info">
|
||||
|
||||
<% if comment.as_administrator? %>
|
||||
@@ -59,7 +57,7 @@
|
||||
|
||||
<% end %>
|
||||
|
||||
• <time><%= l comment.created_at.to_datetime, format: :datetime %></time>
|
||||
• <span><%= l comment.created_at.to_datetime, format: :datetime %></span>
|
||||
</div>
|
||||
|
||||
<div class="comment-user
|
||||
@@ -69,12 +67,12 @@
|
||||
</div>
|
||||
|
||||
<div id="<%= dom_id(comment) %>_reply" class="reply">
|
||||
<span id="<%= dom_id(comment) %>_votes" class="comment-votes float-right">
|
||||
<div id="<%= dom_id(comment) %>_votes" class="comment-votes float-right">
|
||||
<%= render 'comments/votes', comment: comment %>
|
||||
</span>
|
||||
</div>
|
||||
|
||||
<% if comment.children.size > 0 %>
|
||||
<%= link_to "", class: "js-toggle-children relative", data: {'id': "#{dom_id(comment)}"} do %>
|
||||
<%= link_to "#{dom_id(comment)}", class: "js-toggle-children relative", data: {'id': "#{dom_id(comment)}"} do %>
|
||||
<span class="sr-only js-child-toggle" style="display: none;"><%= t("shared.show") %></span>
|
||||
<span class="sr-only js-child-toggle"><%= t("shared.hide") %></span>
|
||||
<span id="<%= dom_id(comment) %>_children_arrow" class="icon-arrow-down"></span> <%= t("comments.comment.responses", count: comment.children.size) %>
|
||||
@@ -93,13 +91,16 @@
|
||||
<%= render 'comments/form', {commentable: comment.commentable, parent_id: comment.id, toggeable: true} %>
|
||||
<% end %>
|
||||
</div>
|
||||
</li>
|
||||
<% end %>
|
||||
</li>
|
||||
<li>
|
||||
<ul id="<%= dom_id(comment) %>_children" class="no-bullet comment-children">
|
||||
<% child_comments_of(comment).each do |child| %>
|
||||
<li>
|
||||
<%= render 'comments/comment', comment: child %>
|
||||
</li>
|
||||
<% end %>
|
||||
</ul>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
<% end %>
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
<% cache [locale_and_user_status, parent_id, commentable_cache_key(commentable)] do %>
|
||||
<% css_id = parent_or_commentable_dom_id(parent_id, commentable) %>
|
||||
<div id="js-comment-form-<%= css_id %>" <%= "style='display:none'".html_safe if toggeable %>>
|
||||
<div id="js-comment-form-<%= css_id %>" <%= "style='display:none'".html_safe if toggeable %> class="comment-form">
|
||||
<%= form_for Comment.new, remote: true do |f| %>
|
||||
<%= label_tag "comment-body-#{css_id}", t("comments.form.leave_comment") %>
|
||||
<%= f.text_area :body, id: "comment-body-#{css_id}", maxlength: Comment.body_max_length, label: false %>
|
||||
|
||||
@@ -58,6 +58,7 @@
|
||||
</a>
|
||||
<% end %>
|
||||
</div>
|
||||
</aside>
|
||||
</div>
|
||||
</div>
|
||||
<% end %>
|
||||
|
||||
5
app/views/layouts/_meta_tags.html.erb
Normal file
5
app/views/layouts/_meta_tags.html.erb
Normal 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"] %>" />
|
||||
@@ -5,6 +5,7 @@
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
||||
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
|
||||
<%= render "layouts/tracking_data" %>
|
||||
<%= render "layouts/meta_tags" %>
|
||||
<title><%= content_for?(:title) ? yield(:title) : setting['org_name'] %></title>
|
||||
<%= stylesheet_link_tag "application" %>
|
||||
<!--[if lt IE 9]>
|
||||
|
||||
@@ -5,6 +5,7 @@
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
||||
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
|
||||
<title><%= content_for?(:title) ? yield(:title) : "Gobierno abierto" %></title>
|
||||
<%= render "layouts/meta_tags" %>
|
||||
<%= stylesheet_link_tag "application" %>
|
||||
<%= javascript_include_tag "application", 'data-turbolinks-track' => true %>
|
||||
<%= csrf_meta_tags %>
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
<div class="relative">
|
||||
<%= link_to t("shared.advanced_search.title"), "#", id: 'js-advanced-search-title', class: "advanced-search small" %>
|
||||
<%= link_to t("shared.advanced_search.title"), "#advanced_search_form", id: 'js-advanced-search-title', class: "advanced-search small" %>
|
||||
</div>
|
||||
|
||||
<div class="row advanced-search-form">
|
||||
<%= form_tag search_path, method: :get do %>
|
||||
<%= form_tag search_path, id: "advanced_search_form", method: :get do %>
|
||||
<div id='js-advanced-search' data-advanced-search-terms=<%= @advanced_search_terms.present? %> style="display: none">
|
||||
|
||||
<div class="small-12 column">
|
||||
@@ -36,6 +36,7 @@
|
||||
</label>
|
||||
<%= text_field_tag 'advanced_search[date_min]',
|
||||
params[:advanced_search].try(:[], :date_min),
|
||||
type: "date",
|
||||
placeholder: t("shared.advanced_search.date_placeholder"),
|
||||
class: 'js-calendar' %>
|
||||
</div>
|
||||
@@ -45,6 +46,7 @@
|
||||
</label>
|
||||
<%= text_field_tag 'advanced_search[date_max]',
|
||||
params[:advanced_search].try(:[], :date_max),
|
||||
type: "date",
|
||||
placeholder: t("shared.advanced_search.date_placeholder"),
|
||||
class: 'js-calendar' %>
|
||||
</div>
|
||||
|
||||
@@ -30,6 +30,7 @@ set :keep_releases, 5
|
||||
set :local_user, ENV['USER']
|
||||
|
||||
set :delayed_job_workers, 2
|
||||
set :delayed_job_roles, :background
|
||||
|
||||
set(:config_files, %w(
|
||||
log_rotation
|
||||
|
||||
@@ -6,5 +6,5 @@ set :ssh_options, port: deploysecret(:ssh_port)
|
||||
set :stage, :preproduction
|
||||
set :rails_env, :preproduction
|
||||
|
||||
server deploysecret(:server1), user: deploysecret(:user), roles: %w(web app db importer cron)
|
||||
server deploysecret(:server1), user: deploysecret(:user), roles: %w(web app db importer cron background)
|
||||
server deploysecret(:server2), user: deploysecret(:user), roles: %w(web app db importer)
|
||||
|
||||
@@ -7,6 +7,6 @@ set :stage, :production
|
||||
set :rails_env, :production
|
||||
|
||||
#server deploysecret(:server1), user: deploysecret(:user), roles: %w(web app db importer)
|
||||
server deploysecret(:server2), user: deploysecret(:user), roles: %w(web app db importer cron)
|
||||
server deploysecret(:server2), user: deploysecret(:user), roles: %w(web app db importer cron background)
|
||||
server deploysecret(:server3), user: deploysecret(:user), roles: %w(web app db importer)
|
||||
server deploysecret(:server4), user: deploysecret(:user), roles: %w(web app db importer)
|
||||
|
||||
@@ -6,7 +6,7 @@ end
|
||||
Delayed::Worker.destroy_failed_jobs = false
|
||||
Delayed::Worker.sleep_delay = 2
|
||||
Delayed::Worker.max_attempts = 3
|
||||
Delayed::Worker.max_run_time = 30.seconds
|
||||
Delayed::Worker.max_run_time = 30.minutes
|
||||
Delayed::Worker.read_ahead = 10
|
||||
Delayed::Worker.default_queue_name = 'default'
|
||||
Delayed::Worker.raise_signal_exceptions = :term
|
||||
|
||||
@@ -401,6 +401,7 @@ en:
|
||||
created_at: Created
|
||||
author: Author
|
||||
documents: Documents
|
||||
document_count: "Number of documents:"
|
||||
verified:
|
||||
one: "There is %{count} valid signature"
|
||||
other: "There are %{count} valid signatures"
|
||||
|
||||
@@ -401,6 +401,7 @@ es:
|
||||
created_at: Creado
|
||||
author: Autor
|
||||
documents: Documentos
|
||||
document_count: "Número de documentos:"
|
||||
verified:
|
||||
one: "Hay %{count} firma válida"
|
||||
other: "Hay %{count} firmas válidas"
|
||||
|
||||
@@ -34,3 +34,5 @@ en:
|
||||
voting_allowed: Voting on investment projects
|
||||
mailer_from_name: Origin email name
|
||||
mailer_from_address: Origin email address
|
||||
meta_description: "Site description (SEO)"
|
||||
meta_keywords: "Keywords (SEO)"
|
||||
@@ -34,3 +34,5 @@ es:
|
||||
voting_allowed: Votaciones sobre propuestas de inversión
|
||||
mailer_from_name: Nombre email remitente
|
||||
mailer_from_address: Dirección email remitente
|
||||
meta_description: "Descripción del sitio (SEO)"
|
||||
meta_keywords: "Palabras clave (SEO)"
|
||||
@@ -36,7 +36,8 @@ Setting.create(key: 'per_page_code', value: "")
|
||||
Setting.create(key: 'comments_body_max_length', value: '1000')
|
||||
Setting.create(key: 'mailer_from_name', value: 'Consul')
|
||||
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"
|
||||
('A'..'Z').each { |i| Geozone.create(name: "District #{i}", external_code: i.ord, census_code: i.ord) }
|
||||
|
||||
@@ -0,0 +1,5 @@
|
||||
class RemovePhysicalVotesFromProposals < ActiveRecord::Migration
|
||||
def change
|
||||
remove_column :proposals, :physical_votes
|
||||
end
|
||||
end
|
||||
@@ -393,7 +393,6 @@ ActiveRecord::Schema.define(version: 20170102080432) do
|
||||
t.string "responsible_name", limit: 60
|
||||
t.text "summary"
|
||||
t.string "video_url"
|
||||
t.integer "physical_votes", default: 0
|
||||
t.tsvector "tsv"
|
||||
t.integer "geozone_id"
|
||||
t.datetime "retired_at"
|
||||
|
||||
@@ -57,6 +57,10 @@ Setting["org_name"] = "Consul"
|
||||
# Consul installation place name (City, Country...)
|
||||
Setting["place_name"] = "Consul-land"
|
||||
|
||||
# Meta tags for SEO
|
||||
Setting["meta_description"] = nil
|
||||
Setting["meta_keywords"] = nil
|
||||
|
||||
# Feature flags
|
||||
Setting['feature.debates'] = true
|
||||
Setting['feature.spending_proposals'] = true
|
||||
|
||||
@@ -59,6 +59,10 @@ feature 'Signature sheets' do
|
||||
expect(page).to have_content signature_sheet.created_at.strftime("%d %b %H:%M")
|
||||
expect(page).to have_content user.name
|
||||
|
||||
within("#document_count") do
|
||||
expect(page).to have_content 3
|
||||
end
|
||||
|
||||
within("#verified_signatures") do
|
||||
expect(page).to have_content 1
|
||||
end
|
||||
|
||||
@@ -13,11 +13,6 @@ describe ProposalsHelper do
|
||||
expect(progress_bar_percentage(proposal)).to eq 50
|
||||
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
|
||||
proposal = create(:proposal, cached_votes_up: Proposal.votes_needed_for_success*2)
|
||||
expect(progress_bar_percentage(proposal)).to eq 100
|
||||
@@ -45,10 +40,6 @@ describe ProposalsHelper do
|
||||
expect(supports_percentage(proposal)).to eq "100%"
|
||||
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
|
||||
@@ -76,6 +76,12 @@ describe SignatureSheet do
|
||||
|
||||
expect(signature_sheet.parsed_document_numbers).to eq(['123A', '456B', '789C', '123B'])
|
||||
end
|
||||
|
||||
it "strips spaces between number and letter" do
|
||||
signature_sheet.document_numbers = "123 A\n456 B \n 789C"
|
||||
|
||||
expect(signature_sheet.parsed_document_numbers).to eq(['123A', '456B', '789C'])
|
||||
end
|
||||
end
|
||||
|
||||
end
|
||||
@@ -13,6 +13,12 @@ describe Signature do
|
||||
it "should not be valid without a document number" do
|
||||
signature.document_number = nil
|
||||
expect(signature).to_not be_valid
|
||||
|
||||
signature.document_number = ""
|
||||
expect(signature).to_not be_valid
|
||||
|
||||
signature.document_number = " "
|
||||
expect(signature).to_not be_valid
|
||||
end
|
||||
|
||||
it "should not be valid without an associated signature sheet" do
|
||||
@@ -22,6 +28,24 @@ describe Signature do
|
||||
|
||||
end
|
||||
|
||||
describe "#clean_document_number" do
|
||||
it "removes non alphanumeric characters" do
|
||||
signature = create(:signature, document_number: "123-[;,9]")
|
||||
expect(signature.document_number).to eq("1239")
|
||||
end
|
||||
|
||||
it "upcases letter in document number" do
|
||||
signature = create(:signature, document_number: "123a")
|
||||
expect(signature.document_number).to eq("123A")
|
||||
end
|
||||
|
||||
it "deals gracefully with empty document numbers" do
|
||||
signature = build(:signature, document_number: "")
|
||||
signature.clean_document_number
|
||||
expect(signature.document_number).to eq("")
|
||||
end
|
||||
end
|
||||
|
||||
describe "#verified?" do
|
||||
|
||||
it "returns true if user exists" do
|
||||
|
||||
Reference in New Issue
Block a user