Merge branch 'master' into aperez-dates-for-milestones

This commit is contained in:
BertoCQ
2017-12-14 15:42:35 +01:00
committed by GitHub
49 changed files with 380 additions and 395 deletions

View File

@@ -6,6 +6,25 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.
## [Unreleased](https://github.com/consul/consul/compare/v0.11...consul:master)
### Added
- Added Images to Budget Investment's Milestones https://github.com/consul/consul/pull/2186
- New setting `feature.allow_images` to allow upload and show images for both (proposals and budget investment projects). Set it manually through console with `Setting['feature.allow_images'] = true`
- Related Content List https://github.com/consul/consul/pull/2184
### Changed
- Design improvements https://github.com/consul/consul/pull/2170
- Adds timestamps to polls https://github.com/consul/consul/pull/2180 (Run `rake polls:initialize_timestamps` to initialize attributes created_at and updated_at with the current time for all existing polls, or manually through console set correct values)
- Improved Community design https://github.com/consul/consul/pull/1904
### Deprecated
### Removed
### Fixed
- Notifications for hidden resources https://github.com/consul/consul/pull/2172
### Security
## [0.11.0](https://github.com/consul/consul/compare/v0.10...v0.11) - 2017-12-05
### Added

View File

@@ -306,7 +306,7 @@ a {
.icon-angle-left {
clear: both;
color: $text-medium;
float: left;
display: inline-block;
}
.back:not([class^="icon-"]) {
@@ -2043,36 +2043,6 @@ table {
.activity {
.accordion li {
margin-bottom: $line-height / 2;
.accordion-title {
border-bottom: 1px solid $border;
background: #f8f9fb;
font-size: $small-font-size;
padding: $line-height / 2;
}
.accordion-content {
padding: 0;
}
}
.accordion .title {
display: block;
line-height: $line-height;
}
.accordion .icon {
font-size: rem-calc(20);
float: left;
margin-right: $line-height / 3;
&.icon-debates {
margin-top: rem-calc(3);
}
}
.retired {
text-decoration: line-through;
}
@@ -2082,6 +2052,45 @@ table {
li {
margin-right: $line-height / 4;
span {
background: none;
border: 1px solid #ececec;
}
}
}
.following {
.follow-list {
list-style-type: circle;
padding: $line-height / 2;
li {
margin-bottom: $line-height / 2;
margin-left: $line-height;
}
}
h3 {
font-size: rem-calc(24);
margin-top: $line-height;
padding-left: rem-calc(30);
position: relative;
span {
left: 0;
position: absolute;
top: 2px;
}
}
.interests {
@include breakpoint(medium) {
border-left: 1px solid #ececec;
padding-left: $line-height;
}
}
}

View File

@@ -44,8 +44,7 @@
// 03. Content
// ----------------------
.more-info-content,
.communities-show {
.more-info-content {
h3 {
color: $brand;

View File

@@ -250,6 +250,7 @@
.proposal-form,
.budget-investment-form,
.spending-proposal-form,
.document-form,
.topic-new,
.topic-form {
@@ -300,6 +301,7 @@
}
.proposal-form,
.document-form,
.topic-form,
.topic-new {
@@ -657,29 +659,6 @@
.budget-investments-list .budget-investment,
.proposals-list .proposal {
.no-image {
background: $brand;
}
}
.budget-investments-list .budget-investment,
.proposals-list .proposal {
@include breakpoint(small) {
.no-image {
width: 100%;
max-width: rem-calc(300);
margin: 0 auto;
&::before {
content: '';
display: block;
padding-top: 100%;
}
}
}
@include breakpoint(medium) {
.panel {
@@ -687,12 +666,6 @@
&.with-image {
padding: 0 $line-height / 2 0 0;
}
.no-image {
height: 100%;
min-height: rem-calc(245);
width: rem-calc(140);
}
}
.column:first-child {

View File

@@ -32,4 +32,7 @@ module CommunitiesHelper
community.from_proposal? ? t("community.sidebar.description.proposal") : t("community.sidebar.description.investment")
end
def create_topic_link(community)
current_user.present? ? new_community_topic_path(community.id) : new_user_session_path
end
end

View File

@@ -13,7 +13,7 @@ module FollowablesHelper
def render_follow(follow)
followable = follow.followable
partial = followable_class_name(followable)
partial = followable_class_name(followable) + "_follow"
locals = {followable_class_name(followable).to_sym => followable}
render partial, locals

View File

@@ -1,11 +0,0 @@
module TopicsHelper
def disabled_create_topic
"disabled" unless current_user
end
def disabled_info_title
t("community.show.sidebar.disabled_info_title") unless current_user
end
end

View File

@@ -64,12 +64,4 @@ module UsersHelper
end
end
def empty_interests_message_text(user)
if current_user == user
t('account.show.public_interests_my_empty_list')
else
t('account.show.public_interests_user_empty_list')
end
end
end

View File

@@ -21,9 +21,11 @@
<%= f.text_field :external_url %>
</div>
<div class="images small-12 column">
<%= render 'images/nested_image', imageable: @investment, f: f %>
</div>
<% if feature?(:allow_images) %>
<div class="images small-12 column">
<%= render 'images/nested_image', imageable: @investment, f: f %>
</div>
<% end %>
<div class="documents small-12 column">
<%= render 'documents/nested_documents', documentable: @investment, f: f %>

View File

@@ -1,18 +1,20 @@
<div id="<%= dom_id(investment) %>" class="budget-investment clear">
<div class="panel with-image">
<div class="panel <%= ('with-image' if feature?(:allow_images) && investment.image.present?) %>">
<% if feature?(:allow_images) && investment.image.present? %>
<div class="row" data-equalizer>
<div class="small-12 medium-3 large-2 column text-center">
<div data-equalizer-watch>
<% if investment.image.present? %>
<%= image_tag investment.image_url(:thumb), alt: investment.image.title %>
<% else %>
<div class="no-image"></div>
<% end %>
<%= image_tag investment.image_url(:thumb), alt: investment.image.title %>
</div>
</div>
<div class="small-12 medium-6 large-7 column">
<% else %>
<div class="row">
<div class="small-12 medium-9 column">
<% end %>
<div class="budget-investment-content">
<% cache [locale_and_user_status(investment), 'index', investment, investment.author] do %>
@@ -55,7 +57,8 @@
<% if investment.should_show_votes? %>
<div id="<%= dom_id(investment) %>_votes"
class="small-12 medium-3 column text-center" data-equalizer-watch>
class="small-12 medium-3 column text-center"
<%= 'data-equalizer-watch' if feature?(:allow_images) && investment.image.present? %>>
<%= render partial: '/budgets/investments/votes', locals: {
investment: investment,
investment_votes: investment_votes,
@@ -64,7 +67,8 @@
</div>
<% elsif investment.should_show_vote_count? %>
<div id="<%= dom_id(investment) %>_votes"
class="small-12 medium-3 column text-center" data-equalizer-watch>
class="small-12 medium-3 column text-center"
<%= 'data-equalizer-watch' if feature?(:allow_images) && investment.image.present? %>>
<div class="supports js-participation">
<span class="total-supports no-button">
<%= t("budgets.investments.investment.supports",
@@ -74,7 +78,8 @@
</div>
<% elsif investment.should_show_ballots? %>
<div id="<%= dom_id(investment) %>_ballot"
class="small-12 medium-3 column text-center" data-equalizer-watch>
class="small-12 medium-3 column text-center"
<%= 'data-equalizer-watch' if feature?(:allow_images) && investment.image.present? %>>
<%= render partial: '/budgets/investments/ballot', locals: {
investment: investment,
investment_ids: investment_ids,
@@ -83,13 +88,14 @@
</div>
<% elsif investment.should_show_price? %>
<div id="<%= dom_id(investment) %>_price"
class="supports small-12 medium-3 column text-center" data-equalizer-watch>
class="supports small-12 medium-3 column text-center"
<%= 'data-equalizer-watch' if feature?(:allow_images) && investment.image.present? %>>
<p class="investment-project-amount margin-top">
<%= investment.formatted_price %>
</p>
</div>
<% else %>
<div data-equalizer-watch></div>
<div <%= 'data-equalizer-watch' if feature?(:allow_images) && investment.image.present? %>></div>
<% end %>
<% end %>

View File

@@ -46,7 +46,9 @@
<%= safe_html_with_links investment.description.html_safe %>
<% if feature?(:map) && map_location_available?(@investment.map_location) %>
<%= render_map(@investment.map_location, "budget_investment", false, nil) %>
<div class="margin">
<%= render_map(@investment.map_location, "budget_investment", false, nil) %>
</div>
<% end %>
<% if investment.external_url.present? %>
@@ -129,6 +131,9 @@
} %>
<% if current_user %>
<div class="sidebar-divider"></div>
<p class="sidebar-title"><%= t("shared.follow") %></p>
<%= render 'follows/follow_button', follow: find_or_build_follow(current_user, investment) %>
<% end %>

View File

@@ -3,20 +3,21 @@
<div class="jumbo light">
<div class="row">
<div class="small-12 column">
<%= back_link_to community_back_link_path(@community) %>
<h2><%= community_text(@community) %></h2>
<p class="lead"> <%= community_title(@community) %> </p>
<p><%= community_description(@community) %> </p>
<span class="uppercase"><%= community_text(@community) %></span>
<h2><%= link_to community_title(@community), community_back_link_path(@community) %></h2>
</div>
<div class="small-12 medium-9 column end">
<p><%= community_description(@community) %></p>
</div>
</div>
</div>
<div class="row">
<aside class="show-for-small-only small-12 column">
<aside class="small-12 column show-for-small-only">
<div class="sidebar-divider"></div>
<h2><%= t("community.show.sidebar.participate") %></h2>
<%= link_to t("community.show.sidebar.new_topic"), new_community_topic_path(@community.id), class: "button expanded #{disabled_create_topic}" %>
<%= link_to t("community.show.sidebar.new_topic"), create_topic_link(@community) , class: "button expanded" %>
</aside>
<div class="small-12 medium-9 column">
@@ -26,14 +27,12 @@
<%= paginate @topics %>
</div>
<aside class="small-12 medium-3 hide-for-small-only column">
<aside class="small-12 medium-3 column hide-for-small-only">
<div class="sidebar-divider"></div>
<h2><%= t("community.show.sidebar.participate") %></h2>
<%= link_to t("community.show.sidebar.new_topic"), new_community_topic_path(@community.id), class: "button expanded #{disabled_create_topic}", title: "#{disabled_info_title}" %>
<%= link_to t("community.show.sidebar.new_topic"), create_topic_link(@community) , class: "button expanded" %>
</aside>
</div>
</div>
<%= render 'participants' %>

View File

@@ -1,24 +1,19 @@
<span class="js-follow">
<div class="js-follow">
<span class="followable-content">
<% if follow.followable.followed_by?(current_user) %>
<%= link_to t('shared.unfollow'),
<%= link_to t('shared.following'),
follow_path(follow),
method: :delete, remote: true,
title: unfollow_text(follow.followable),
class: 'button hollow' %>
class: 'button expanded' %>
<% else %>
<%= link_to t('shared.follow'),
<%= link_to follow_text(follow.followable),
follows_path(followable_id: follow.followable.id,
followable_type: follow.followable.class.name),
method: :post, remote: true,
title: follow_text(follow.followable),
class: 'button hollow' %>
class: 'button hollow expanded' %>
<% end %>
</span>
</span>
</div>

View File

@@ -10,8 +10,6 @@
<div class="image-container" data-equalizer-watch>
<% if poll.image.present? %>
<%= image_tag poll.image_url(:large), alt: poll.image.title %>
<% else %>
<div class="no-image"></div>
<% end %>
</div>
</div>

View File

@@ -46,9 +46,11 @@
<%= f.text_field :external_url, placeholder: t("proposals.form.proposal_external_url"), label: false %>
</div>
<div class="images small-12 column">
<%= render 'images/nested_image', imageable: @proposal, f: f %>
</div>
<% if feature?(:allow_images) %>
<div class="images small-12 column">
<%= render 'images/nested_image', imageable: @proposal, f: f %>
</div>
<% end %>
<div class="documents small-12 column">
<%= render 'documents/nested_documents', documentable: @proposal, f: f %>

View File

@@ -1,21 +1,23 @@
<div id="<%= dom_id(proposal) %>"
class="proposal clear <%= ("successful" if proposal.total_votes > Proposal.votes_needed_for_success) %>"
data-type="proposal">
<div class="panel with-image">
<div class="panel <%= ('with-image' if feature?(:allow_images) && proposal.image.present?) %>">
<div class="icon-successful"></div>
<div class="row" data-equalizer>
<div class="small-12 medium-3 large-2 column text-center">
<div data-equalizer-watch>
<% if proposal.image.present? %>
<% if feature?(:allow_images) && proposal.image.present? %>
<div class="row" data-equalizer>
<div class="small-12 medium-3 large-2 column text-center">
<div data-equalizer-watch>
<%= image_tag proposal.image_url(:thumb), alt: proposal.image.title %>
<% else %>
<div class="no-image"></div>
<% end %>
</div>
</div>
</div>
<div class="small-12 medium-6 large-7 column">
<div class="small-12 medium-6 large-7 column">
<% else %>
<div class="row">
<div class="small-12 medium-9 column">
<% end %>
<div class="proposal-content">
<% cache [locale_and_user_status(proposal), 'index', proposal, proposal.author] do %>
<h3><%= link_to proposal.title, namespaced_proposal_path(proposal) %></h3>
@@ -60,7 +62,9 @@
</div>
</div>
<div id="<%= dom_id(proposal) %>_votes" class="small-12 medium-3 column supports-container" data-equalizer-watch>
<div id="<%= dom_id(proposal) %>_votes"
class="small-12 medium-3 column supports-container"
<%= 'data-equalizer-watch' if feature?(:allow_images) && proposal.image.present? %>>
<% if proposal.successful? %>
<div class="padding text-center">

View File

@@ -69,7 +69,9 @@
<%= safe_html_with_links @proposal.description %>
<% if feature?(:map) && map_location_available?(@proposal.map_location) %>
<%= render_map(@proposal.map_location, "proposal", false, nil) %>
<div class="margin">
<%= render_map(@proposal.map_location, "proposal", false, nil) %>
</div>
<% end %>
<% if @proposal.external_url.present? %>
@@ -180,6 +182,9 @@
} %>
<% if current_user %>
<div class="sidebar-divider"></div>
<p class="sidebar-title"><%= t("shared.follow") %></p>
<%= render 'follows/follow_button', follow: find_or_build_follow(current_user, @proposal) %>
<% end %>

View File

@@ -13,12 +13,12 @@
<% if user_signed_in? %>
<%= render 'comments/form', {commentable: @topic, parent_id: nil, toggeable: false} %>
<% else %>
<br>
<div data-alert class="callout primary">
<%= t("topics.show.login_to_comment",
signin: link_to(t("votes.signin"), new_user_session_path),
signup: link_to(t("votes.signup"), new_user_registration_path)).html_safe %>
</div>
</div>
<% end %>
</div>

View File

@@ -3,19 +3,15 @@
<%= render 'shared/errors', resource: @topic %>
<div class="row">
<div class="small-12 column">
<%= f.label :title, t("community.topic.form.topic_title") %>
<%= f.text_field :title, label: false %>
</div>
<div class="small-12 column">
<%= f.label :description, t("community.topic.form.topic_description") %>
<%= f.text_area :description, label: false %>
</div>
<div class="actions small-12 column">
<%= f.label :description, t("community.topic.form.topic_text") %>
<%= f.text_area :description, label: false, rows: "5" %>
<%= f.submit(class: "button", value: t("community.topic.form.#{action_name}.submit_button")) %>
</div>
</div>
<% end %>

View File

@@ -1,11 +1,13 @@
<h3><%= t("community.show.create_first_community_topic.first_theme") %></h3>
<p class="lead"><%= t("community.show.create_first_community_topic.first_theme") %></p>
<% if user_signed_in? %>
<%= t("community.show.create_first_community_topic.first_theme_not_logged_in") %>
<div class="callout primary">
<%= t("community.show.create_first_community_topic.first_theme_not_logged_in") %>
</div>
<% else %>
<div class="callout primary">
<%= t("community.show.create_first_community_topic.sub_first_theme",
link: link_to(t("community.show.create_first_community_topic.sign_link",
org_name: setting['org_name']), new_user_session_path)).html_safe %>
sign_in: link_to(t("community.show.create_first_community_topic.sign_in"), new_user_session_path),
sign_up: link_to(t("community.show.create_first_community_topic.sign_up"), new_user_registration_path)).html_safe %>
</div>
<% end %>

View File

@@ -1,13 +1,7 @@
<div class="small-12 medium-3 column">
<h2><%= t("community.topic.sidebar.recommendations_title") %></h2>
<span class="icon-proposals float-right"></span>
<h2><%= t("community.topic.sidebar.recommendations_title") %></h2>
<ul class="recommendations">
<li><%= t("community.topic.sidebar.recommendation_one") %></li>
<li><%= t("community.topic.sidebar.recommendation_two") %></li>
<li><%= t("community.topic.sidebar.recommendation_three") %></li>
</ul>
</div>
<ul class="recommendations">
<li><%= t("community.topic.sidebar.recommendation_one") %></li>
<li><%= t("community.topic.sidebar.recommendation_two") %></li>
<li><%= t("community.topic.sidebar.recommendation_three") %></li>
</ul>

View File

@@ -1,6 +1,6 @@
<div id="<%= dom_id(topic) %>" class="panel column">
<div class="small-8 column">
<div class="small-12 medium-9 column">
<h3><%= link_to topic.title, community_topic_path(@community, topic) %></h3>
@@ -14,12 +14,4 @@
</p>
</div>
<div class="small-4 column text-right">
<% if topic.author == current_user %>
<%= link_to t("community.show.topic.edit_button"), edit_community_topic_path(@community.id, topic), class: 'button small hollow' %>
<%= link_to t("community.show.topic.destroy_button"), community_topic_path(@community.id, topic), method: :delete, class: 'button hollow alert small' %>
<% end %>
</div>
</div>

View File

@@ -1,4 +1,4 @@
<div class="topic-form row">
<div class="row">
<div class="small-12 medium-9 column">
<%= back_link_to community_path(@community) %>
@@ -6,6 +6,7 @@
<%= render "form" %>
</div>
<%= render "recommendations" %>
<div class="small-12 medium-3 column">
<%= render "recommendations" %>
</div>
</div>

View File

@@ -1,11 +1,12 @@
<div class="topic-new row">
<div class="row">
<div class="small-12 medium-9 column">
<%= back_link_to community_path(@community) %>
<h1><%= t("community.topic.create") %></h1>
<%= render 'form' %>
</div>
<%= render "recommendations" %>
<div class="small-12 medium-3 column">
<%= render "recommendations" %>
</div>
</div>

View File

@@ -1,27 +1,47 @@
<div class="row topic-show">
<div class="small-12 medium-12 column">
<div class="topic-show">
<div class="row margin-bottom">
<div class="small-12 medium-9 column">
<%= back_link_to community_path(@community) %>
<br>
<%= back_link_to community_path(@community), t("community.show.back",
community: community_text(@community),
proposal: community_title(@community)) %>
<p><%= community_text(@community) %> <strong><%= community_title(@community) %></strong></p>
<h1><%= @topic.title %></h1>
<div class="topic-info">
<p><%= @topic.description %></p>
<%= render '/shared/author_info', resource: @topic %>
<h1><%= @topic.title %></h1>
<span class="bullet">&nbsp;&bull;&nbsp;</span>
<%= l @topic.created_at.to_date %>
<span class="bullet">&nbsp;&bull;&nbsp;</span>
<span class="icon-comments"></span>&nbsp;
</div>
<div class="topic-info margin-bottom">
<%= render '/shared/author_info', resource: @topic %>
<div class="tabs-content" data-tabs-content="topics-tabs" role="tablist">
<%= render "topics/filter_subnav" %>
<div class="tabs-panel is-active" id="tab-comments">
<%= render "topics/comments" %>
<span class="bullet">&nbsp;&bull;&nbsp;</span>
<%= l(@topic.created_at.to_date) %>
<span class="bullet">&nbsp;&bull;&nbsp;</span>
<span class="icon-comments"></span>&nbsp;
<%= link_to t("community.show.topic.comments", count: @topic.comments_count),
community_topic_path(@community, @topic, anchor: "comments") %>
</div>
<br>
<p><%= @topic.description %></p>
</div>
<% if @topic.author == current_user %>
<aside class="small-12 medium-3 column">
<div class="sidebar-divider"></div>
<h2><%= t("community.show.author") %></h2>
<%= link_to t("community.show.topic.edit"),
edit_community_topic_path(@community.id, @topic),
class: 'button hollow expanded' %>
<%= link_to t("community.show.topic.destroy"),
community_topic_path(@community.id, @topic), method: :delete,
class: 'button hollow expanded alert' %>
</aside>
<% end %>
</div>
<div class="tabs-content" data-tabs-content="topics-tabs" role="tablist">
<%= render "topics/filter_subnav" %>
<div class="tabs-panel is-active" id="tab-comments">
<%= render "topics/comments" %>
</div>
</div>
</div>

View File

@@ -0,0 +1,3 @@
<li id="budget_investment_<%= budget_investment.id %>">
<%= link_to budget_investment.title, budget_investment_path(budget_investment.budget, budget_investment) %>
</li>

View File

@@ -1,30 +1,27 @@
<ul class="accordion" data-accordion data-allow-all-closed="true">
<div class="row following margin-top" data-equalizer data-equalize-on="medium" >
<div class="small-12 medium-8 column" data-equalizer-watch>
<ul class="menu simple clear">
<% @follows.each do |followable_type, follows| %>
<li><%= link_to followable_type_title(followable_type), "##{followable_type_title(followable_type).parameterize.underscore}" %></li>
<% end %>
</ul>
<% @follows.each do |followable_type, follows| %>
<% @follows.each do |followable_type, follows| %>
<li class="accordion-item" data-accordion-item>
<h3 id="<%= followable_type_title(followable_type).parameterize.underscore %>">
<span class="icon-<%= followable_icon(followable_type) %>"></span>
<%= followable_type_title(followable_type) %>
</h3>
<a href="#" class="accordion-title">
<span class="icon">
<i class="icon icon-<%= followable_icon(followable_type) %>"></i>
</span>
<span class="title">
<strong><%= followable_type_title(followable_type) %></strong>
</span>
</a>
<ul class="follow-list">
<% follows.each do |follow| %>
<%= render_follow(follow) %>
<% end %>
</ul>
<% end %>
</div>
<div class="accordion-content" data-tab-content>
<table>
<tbody>
<% follows.each do |follow| %>
<%= render_follow(follow) %>
<% end %>
</tbody>
</table>
</div>
</li>
<% end %>
</ul>
<div class="small-12 medium-4 column interests" data-equalizer-watch>
<%= render 'interests', user: @user if valid_interests_access? %>
</div>
</div>

View File

@@ -2,18 +2,10 @@
<h4><%= interests_title_text(user) %></h4>
<% if user.interests.any? %>
<ul class="no-bullet tags">
<% user.interests.each do |interest| %>
<li class="inline-block"><span><%= interest %></span></li>
<% end %>
</ul>
<% else %>
<div class="callout primary">
<%= empty_interests_message_text(user) %>
</div>
<% end %>
</div>

View File

@@ -0,0 +1,6 @@
<li id="proposal_<%= proposal.id %>">
<%= link_to proposal.title, proposal, proposal.retired? ? { class: 'retired' } : {} %>
<% if proposal.retired? %>
<span class="label alert"><%= t('users.proposals.retired') %></span>
<% end %>
</li>

View File

@@ -38,18 +38,20 @@
<% end %>
<% end %>
<% end %>
<%= t("users.show.no_activity") if @activity_counts.values.inject(&:+) == 0 %>
</ul>
<% if @activity_counts.values.inject(&:+) == 0 %>
<div class="callout primary">
<%= t("users.show.no_activity") %>
</div>
<% end %>
<%= render "activity_page" %>
<% else %>
<div class="callout warning margin">
<%= t('users.show.private_activity') %>
</div>
<% end %>
<%= render 'interests', user: @user if valid_interests_access? %>
</div>
</div>
</main>

View File

@@ -14,29 +14,31 @@ en:
proposal: Participate in the community of this proposal. An active community can help to improve the content of the proposal and boost its dissemination to get more support.
investment: Participate in the community of this budget investment. An active community can help to improve the content of the budget investment and boost its dissemination to get more support.
create_first_community_topic:
first_theme_not_logged_in: No issue yet available, participate creating the first one. Click on the create new topic button.
first_theme_not_logged_in: No issue available, participate creating the first one.
first_theme: Create the first community topic
sub_first_theme: To create a theme you have to %{link}
sign_link: "access %{org_name}"
sub_first_theme: "To create a theme you must to %{sign_in} o %{sign_up}."
sign_in: "sign in"
sign_up: "sign up"
tab:
participants: Participants
sidebar:
participate: Participate
new_topic: Create topic
disabled_info_title: You need to be logged to create a new topic
topic:
edit_button: Edit
destroy_button: Destroy
edit: Edit topic
destroy: Destroy topic
comments:
one: 1 comment
other: "%{count} comments"
zero: No comments
author: Author
back: Back to %{community} %{proposal}
topic:
create: Create a topic
edit: Edit Topic
form:
topic_title: Topic Title
topic_description: Description
topic_title: Title
topic_text: Initial text
new:
submit_button: Create topic
edit:

View File

@@ -13,10 +13,8 @@ en:
phone_number_label: Phone number
public_activity_label: Keep my list of activities public
public_interests_label: Keep my interests public
public_interests_my_title_list: List of interests (tags of elements you follow)
public_interests_user_title_list: List of interests (tags of elements this user follows)
public_interests_my_empty_list: You do not follow any elements yet.
public_interests_user_empty_list: This user does not follow any elements yet.
public_interests_my_title_list: Tags of elements you follow
public_interests_user_title_list: Tags of elements this user follows
save_changes_submit: Save changes
subscription_to_website_newsletter_label: Receive by email website relevant information
email_on_direct_message_label: Receive emails about direct messages
@@ -570,6 +568,7 @@ en:
collective: Collective
flag: Flag as inappropriate
follow: "Follow"
following: "Following"
follow_entity: "Follow %{entity}"
followable:
budget_investment:
@@ -614,7 +613,6 @@ en:
target_blank_html: " (link opens in new window)"
you_are_in: "You are in"
unflag: Unflag
unfollow: "Unfollow"
unfollow_entity: "Unfollow %{entity}"
outline:
budget: Participatory budget

View File

@@ -44,6 +44,7 @@ en:
recommendations: Recommendeds
community: Community on proposals and investments
map: Proposals and budget investments geolocation
allow_images: Allow upload and show images
map_latitude: Latitude
map_longitude: Longitude
map_zoom: Zoom

View File

@@ -14,29 +14,31 @@ es:
proposal: Participa en la comunidad de esta propuesta. Una comunidad activa puede ayudar a mejorar el contenido de la propuesta así como a dinamizar su difusión para conseguir más apoyos.
investment: Participa en la comunidad de este proyecto de inversión. Una comunidad activa puede ayudar a mejorar el contenido del proyecto de inversión así como a dinamizar su difusión para conseguir más apoyos.
create_first_community_topic:
first_theme_not_logged_in: Aún no hay ningun tema disponible, participa creando el primero. Haz click en el botón crear nuevo tema.
first_theme_not_logged_in: No hay ningún tema disponible, participa creando el primero.
first_theme: Crea el primer tema de la comunidad
sub_first_theme: Para crear un tema tienes que %{link}
sign_link: "acceder a %{org_name}"
sub_first_theme: "Para crear un tema debes %{sign_in} o %{sign_up}."
sign_in: "iniciar sesión"
sign_up: "registrarte"
tab:
participants: Participantes
sidebar:
participate: Participa
new_topic: Crea un tema
disabled_info_title: Necesitas estar logueado para crear un nuevo tema
topic:
edit_button: Editar
destroy_button: Eliminar
edit: Editar tema
destroy: Eliminar tema
comments:
zero: Sin comentarios
one: 1 Comentario
other: "%{count} Comentarios"
author: Autor
back: Volver a %{community} %{proposal}
topic:
create: Crear un tema
edit: Editar tema
form:
topic_title: Titulo del tema
topic_description: Descripción
topic_title: Título
topic_text: Texto inicial
new:
submit_button: Crear tema
edit:

View File

@@ -13,10 +13,8 @@ es:
phone_number_label: Teléfono
public_activity_label: Mostrar públicamente mi lista de actividades
public_interests_label: Mostrar públicamente mis intereses
public_interests_my_title_list: Lista de intereses (etiquetas de los elementos que sigues)
public_interests_user_title_list: Lista de intereses (etiquetas de los elementos seguidos este usuario)
public_interests_my_empty_list: Aún no sigues ningún elemento.
public_interests_user_empty_list: Este usuario no sigue ningún elemento todavía.
public_interests_my_title_list: Etiquetas de los elementos que sigues
public_interests_user_title_list: Etiquetas de los elementos que sigue este usuario
save_changes_submit: Guardar cambios
subscription_to_website_newsletter_label: Recibir emails con información interesante sobre la web
email_on_direct_message_label: Recibir emails con mensajes privados
@@ -567,6 +565,7 @@ es:
collective: Colectivo
flag: Denunciar como inapropiado
follow: "Seguir"
following: "Siguiendo"
follow_entity: "Seguir %{entity}"
followable:
budget_investment:
@@ -611,7 +610,6 @@ es:
target_blank_html: " (se abre en ventana nueva)"
you_are_in: "Estás en"
unflag: Deshacer denuncia
unfollow: "Dejar de seguir"
unfollow_entity: "Dejar de seguir %{entity}"
outline:
budget: Presupuestos participativos

View File

@@ -44,6 +44,7 @@ es:
recommendations: Recomendaciones
community: Comunidad en propuestas y proyectos de inversión
map: Geolocalización de propuestas y proyectos de inversión
allow_images: Permitir subir y mostrar imágenes
map_latitude: Latitud
map_longitude: Longitud
map_zoom: Zoom

View File

@@ -51,6 +51,7 @@ section "Creating Settings" do
Setting.create(key: 'feature.user.recommendations', value: "true")
Setting.create(key: 'feature.community', value: "true")
Setting.create(key: 'feature.map', value: "true")
Setting.create(key: 'feature.allow_images', value: "true")
Setting.create(key: 'feature.public_stats', value: "true")
Setting.create(key: 'per_page_code_head', value: "")
Setting.create(key: 'per_page_code_body', value: "")

View File

@@ -0,0 +1,5 @@
class AddTimestampsToPolls < ActiveRecord::Migration
def change
add_timestamps :polls, null: true
end
end

View File

@@ -11,7 +11,7 @@
#
# It's strongly recommended that you check this file into your version control system.
ActiveRecord::Schema.define(version: 20171212154048) do
ActiveRecord::Schema.define(version: 20171212193323) do
# These are extensions that must be enabled in order to support this database
enable_extension "plpgsql"
@@ -799,6 +799,8 @@ ActiveRecord::Schema.define(version: 20171212154048) do
t.datetime "hidden_at"
t.boolean "results_enabled", default: false
t.boolean "stats_enabled", default: false
t.datetime "created_at"
t.datetime "updated_at"
end
add_index "polls", ["starts_at", "ends_at"], name: "index_polls_on_starts_at_and_ends_at", using: :btree

View File

@@ -84,6 +84,7 @@ Setting['feature.legislation'] = true
Setting['feature.user.recommendations'] = true
Setting['feature.community'] = true
Setting['feature.map'] = nil
Setting['feature.allow_images'] = true
# Spending proposals feature flags
Setting['feature.spending_proposal_features.voting_allowed'] = nil

6
lib/tasks/polls.rake Normal file
View File

@@ -0,0 +1,6 @@
namespace :polls do
desc "Adds created_at and updated_at values to existing polls"
task initialize_timestamps: :environment do
Poll.update_all(created_at: Time.current, updated_at: Time.current)
end
end

View File

@@ -19,7 +19,8 @@ describe InstallationController, type: :request do
'user.recommendations' => nil,
'community' => nil,
'map' => 't',
'spending_proposal_features.voting_allowed' => 't'
'spending_proposal_features.voting_allowed' => 't',
'allow_images' => 't'
}
end
@@ -42,6 +43,7 @@ describe InstallationController, type: :request do
Setting['feature.community'] = true
Setting['feature.map'] = nil
Setting['feature.spending_proposal_features.voting_allowed'] = nil
Setting['feature.allow_images'] = true
end
specify "with query string inside query params" do

View File

@@ -9,6 +9,14 @@ feature 'Budget Investments' do
let(:group) { create(:budget_group, name: "Health", budget: budget) }
let!(:heading) { create(:budget_heading, name: "More hospitals", group: group) }
before do
Setting['feature.allow_images'] = true
end
after do
Setting['feature.allow_images'] = nil
end
scenario 'Index' do
investments = [create(:budget_investment, heading: heading),
create(:budget_investment, heading: heading),
@@ -37,7 +45,7 @@ feature 'Budget Investments' do
visit budget_investments_path(budget, heading_id: heading.id)
within("#budget_investment_#{investment.id}") do
expect(page).to have_css("div.no-image")
expect(page).to_not have_css("div.with-image")
end
within("#budget_investment_#{investment_with_image.id}") do
expect(page).to have_css("img[alt='#{investment_with_image.image.title}']")

View File

@@ -24,16 +24,6 @@ feature 'Communities' do
expect(page).to have_content proposal.title
expect(page).to have_content "Participate in the community of this proposal"
expect(page).to have_link("Create topic", href: new_community_topic_path(community))
expect(page).not_to have_selector(".button.disabled", text: "Create topic")
end
scenario 'Should display disabled create topic button when user is not logged' do
proposal = create(:proposal)
community = proposal.community
visit community_path(community)
expect(page).to have_selector(".button.disabled", text: "Create topic")
end
scenario 'Should display without_topics_text and participants when there are not topics' do
@@ -100,7 +90,7 @@ feature 'Communities' do
expect(topic2.title).to appear_before(topic1.title)
end
scenario 'Should display topic edit button when author is logged' do
scenario 'Should display topic edit button on topic show when author is logged' do
proposal = create(:proposal)
community = proposal.community
user = create(:user)
@@ -108,15 +98,11 @@ feature 'Communities' do
topic2 = create(:topic, community: community)
login_as(user)
visit community_path(community)
visit community_topic_path(community, topic1)
expect(page).to have_link("Edit topic", href: edit_community_topic_path(community, topic1))
within "#topic_#{topic1.id}" do
expect(page).to have_link("Edit", href: edit_community_topic_path(community, topic1))
end
within "#topic_#{topic2.id}" do
expect(page).not_to have_link("Edit", href: edit_community_topic_path(community, topic2))
end
visit community_topic_path(community, topic2)
expect(page).not_to have_link("Edit topic", href: edit_community_topic_path(community, topic2))
end
scenario 'Should display participant when there is topics' do

View File

@@ -10,6 +10,15 @@ feature 'Proposals' do
end
context 'Index' do
before do
Setting['feature.allow_images'] = true
end
after do
Setting['feature.allow_images'] = nil
end
scenario 'Lists featured and regular proposals' do
featured_proposals = create_featured_proposals
proposals = [create(:proposal), create(:proposal), create(:proposal)]
@@ -61,7 +70,7 @@ feature 'Proposals' do
visit proposals_path(proposal)
within("#proposal_#{proposal.id}") do
expect(page).to have_css("div.no-image")
expect(page).to_not have_css("div.with-image")
end
within("#proposal_#{proposal_with_image.id}") do
expect(page).to have_css("img[alt='#{proposal_with_image.image.title}']")

View File

@@ -4,13 +4,16 @@ feature 'Topics' do
context 'New' do
scenario 'Should display disabled button to new topic page without user logged', :js do
scenario 'Create new topic link should redirect to sign up for anonymous users', :js do
proposal = create(:proposal)
community = proposal.community
logout
visit community_path(community)
click_link "Create topic"
expect(page).to have_selector(".button.expanded.disabled")
expect(page).to have_content "Sign in with:"
expect(current_path).to eq(new_user_session_path)
end
scenario 'Can access to new topic page with user logged', :js do
@@ -34,8 +37,8 @@ feature 'Topics' do
click_link "Create topic"
expect(page).to have_content "Topic Title"
expect(page).to have_content "Description"
expect(page).to have_content "Title"
expect(page).to have_content "Initial text"
expect(page).to have_content "Recommendations to create a topic"
expect(page).to have_content "Do not write the topic title or whole sentences in capital letters. On the internet that is considered shouting. And no one likes to be yelled at."
expect(page).to have_content "Any topic or comment that implies an illegal action will be eliminated, also those that intend to sabotage the spaces of the subject, everything else is allowed."
@@ -128,9 +131,9 @@ feature 'Topics' do
user = create(:user)
topic = create(:topic, community: community, author: user)
login_as(user)
visit community_path(community)
visit community_topic_path(community, topic)
click_link "Destroy"
click_link "Destroy topic"
expect(page).to have_content "Topic deleted successfully."
expect(page).not_to have_content topic.title

View File

@@ -259,6 +259,9 @@ feature 'Users' do
end
scenario 'User can display public page' do
proposal = create(:proposal, tag_list: "Sport")
create(:follow, :followed_proposal, followable: proposal, user: @user)
login_as(@user)
visit account_path
@@ -267,22 +270,29 @@ feature 'Users' do
logout
visit user_path(@user)
visit user_path(@user, filter: 'follows', page: '1')
expect(page).to have_css('#public_interests')
end
scenario 'Is always visible for the owner' do
proposal = create(:proposal, tag_list: "Sport")
create(:follow, :followed_proposal, followable: proposal, user: @user)
login_as(@user)
visit account_path
uncheck 'account_public_interests'
click_button 'Save changes'
visit user_path(@user)
visit user_path(@user, filter: 'follows', page: '1')
expect(page).to have_css('#public_interests')
end
scenario 'Is always visible for admins' do
proposal = create(:proposal, tag_list: "Sport")
create(:follow, :followed_proposal, followable: proposal, user: @user)
login_as(@user)
visit account_path
@@ -292,11 +302,14 @@ feature 'Users' do
logout
login_as(create(:administrator).user)
visit user_path(@user)
visit user_path(@user, filter: 'follows', page: '1')
expect(page).to have_css('#public_interests')
end
scenario 'Is always visible for moderators' do
proposal = create(:proposal, tag_list: "Sport")
create(:follow, :followed_proposal, followable: proposal, user: @user)
login_as(@user)
visit account_path
@@ -306,38 +319,29 @@ feature 'Users' do
logout
login_as(create(:moderator).user)
visit user_path(@user)
visit user_path(@user, filter: 'follows', page: '1')
expect(page).to have_css('#public_interests')
end
scenario 'Should display generic interests title' do
@user.update(public_interests: true)
visit user_path(@user)
proposal = create(:proposal, tag_list: "Sport")
create(:follow, :followed_proposal, followable: proposal, user: @user)
expect(page).to have_content("List of interests (tags of elements this user follows)")
@user.update(public_interests: true)
visit user_path(@user, filter: 'follows', page: '1')
expect(page).to have_content("Tags of elements this user follows")
end
scenario 'Should display custom interests title when user is visiting own user page' do
proposal = create(:proposal, tag_list: "Sport")
create(:follow, :followed_proposal, followable: proposal, user: @user)
@user.update(public_interests: true)
login_as(@user)
visit user_path(@user)
visit user_path(@user, filter: 'follows', page: '1')
expect(page).to have_content("List of interests (tags of elements you follow)")
end
scenario 'Should display generic empty interests list message when visited user has not interests defined' do
@user.update(public_interests: true)
visit user_path(@user)
expect(page).to have_content("This user does not follow any elements yet.")
end
scenario 'Should display custom empty interests list message when user has not interests defined and user is visiting own user page' do
@user.update(public_interests: true)
login_as(@user)
visit user_path(@user)
expect(page).to have_content("You do not follow any elements yet.")
expect(page).to have_content("Tags of elements you follow")
end
end
@@ -418,22 +422,22 @@ feature 'Users' do
expect(page).to have_content('1 Following')
end
scenario 'Display accordion proposal tab when user is following one proposal at least' do
scenario 'Display proposal tab when user is following one proposal at least' do
proposal = create(:proposal)
create(:follow, followable: proposal, user: @user)
visit user_path(@user, filter: "follows")
expect(page).to have_link('Citizen proposals', href: "#")
expect(page).to have_link('Citizen proposals', href: "#citizen_proposals")
end
scenario 'Not display accordion proposal tab when user is not following any proposal' do
scenario 'Not display proposal tab when user is not following any proposal' do
visit user_path(@user, filter: "follows")
expect(page).not_to have_link('Citizen proposals', href: "#")
expect(page).not_to have_link('Citizen proposals', href: "#citizen_proposals")
end
scenario 'Display proposal with action buttons inside accordion proposal tab when current user is proposal author', :js do
scenario 'Display proposals with link to proposal' do
proposal = create(:proposal, author: @user)
create(:follow, followable: proposal, user: @user)
login_as @user
@@ -442,35 +446,7 @@ feature 'Users' do
click_link 'Citizen proposals'
expect(page).to have_content proposal.title
expect(page).to have_link "Send notification"
expect(page).to have_link "Retire"
end
scenario 'Display proposal with action buttons inside accordion proposal tab when there is no logged user', :js do
proposal = create(:proposal, author: @user)
create(:follow, followable: proposal, user: @user)
visit user_path(@user, filter: "follows")
click_link 'Citizen proposals'
expect(page).to have_content proposal.title
expect(page).not_to have_link "Send notification"
expect(page).not_to have_link "Retire"
end
scenario 'Display proposal without action buttons inside accordion proposal tab when current user is not proposal author', :js do
proposal = create(:proposal)
create(:follow, followable: proposal, user: @user)
login_as @user
visit user_path(@user, filter: "follows")
click_link 'Citizen proposals'
expect(page).to have_content proposal.title
expect(page).not_to have_link "Send notification"
expect(page).not_to have_link "Retire"
end
end
describe 'Budget Investments' do
@@ -484,35 +460,22 @@ feature 'Users' do
expect(page).to have_content('1 Following')
end
scenario 'Display accordion budget investment tab when user is following one budget investment at least' do
scenario 'Display budget investment tab when user is following one budget investment at least' do
budget_investment = create(:budget_investment)
create(:follow, followable: budget_investment, user: @user)
visit user_path(@user, filter: "follow")
visit user_path(@user, filter: "follows")
expect(page).to have_link('Investments', href: "#")
expect(page).to have_link('Investments', href: "#investments")
end
scenario 'Not display accordion budget investment tab when user is not following any budget investment' do
visit user_path(@user, filter: "follow")
scenario 'Not display budget investment tab when user is not following any budget investment' do
visit user_path(@user, filter: "follows")
expect(page).not_to have_link('Investments', href: "#")
expect(page).not_to have_link('Investments', href: "#investments")
end
scenario 'Display budget investment with action buttons inside accordion budget investment tab when current user is a verified user and author', :js do
user = create(:user, :level_two)
budget_investment = create(:budget_investment, author: user)
create(:follow, followable: budget_investment, user: user)
login_as user
visit user_path(user, filter: "follows")
click_link 'Investments'
expect(page).to have_link budget_investment.title
expect(page).to have_link "Delete"
end
scenario 'Display budget investment with action buttons inside accordion budget investment tab when there is no logged user', :js do
scenario 'Display budget investment with link to budget investment' do
user = create(:user, :level_two)
budget_investment = create(:budget_investment, author: user)
create(:follow, followable: budget_investment, user: user)
@@ -521,22 +484,7 @@ feature 'Users' do
click_link 'Investments'
expect(page).to have_link budget_investment.title
expect(page).not_to have_link "Delete"
end
scenario 'Display budget investment without action buttons inside accordion budget investment tab when current user is not budget investment author', :js do
user = create(:user, :level_two)
budget_investment = create(:budget_investment)
create(:follow, followable: budget_investment, user: user)
login_as user
visit user_path(user, filter: "follows")
click_link 'Investments'
expect(page).to have_link budget_investment.title
expect(page).not_to have_link "Delete"
end
end
end

View File

@@ -28,7 +28,7 @@ shared_examples "followable" do |followable_class_name, followable_path, followa
visit send(followable_path, arguments)
within "##{dom_id(followable)}" do
expect(page).to have_link("Follow")
expect(page).to have_link("Follow #{followable.model_name.human.downcase}")
end
end
@@ -37,8 +37,7 @@ shared_examples "followable" do |followable_class_name, followable_path, followa
login_as(user)
visit send(followable_path, arguments)
expect(page).to have_link("Follow")
expect(page).to have_link("Follow #{followable.model_name.human.downcase}")
end
scenario "Should display unfollow after user clicks on follow button", :js do
@@ -47,10 +46,10 @@ shared_examples "followable" do |followable_class_name, followable_path, followa
visit send(followable_path, arguments)
within "##{dom_id(followable)}" do
click_link "Follow"
click_link("Follow #{followable.model_name.human.downcase}")
expect(page).not_to have_link "Follow"
expect(page).to have_link "Unfollow"
expect(page).not_to have_link("Follow")
expect(page).to have_link("Following")
end
end
@@ -60,7 +59,7 @@ shared_examples "followable" do |followable_class_name, followable_path, followa
visit send(followable_path, arguments)
within "##{dom_id(followable)}" do
click_link "Follow"
click_link("Follow #{followable.model_name.human.downcase}")
end
expect(page).to have_content strip_tags(t("shared.followable.#{followable_class_name}.create.notice_html"))
@@ -73,7 +72,7 @@ shared_examples "followable" do |followable_class_name, followable_path, followa
visit send(followable_path, arguments)
expect(page).to have_link("Unfollow")
expect(page).to have_link("Following")
end
scenario "Should update follow button and show destroy notice after user clicks on unfollow button", :js do
@@ -83,10 +82,10 @@ shared_examples "followable" do |followable_class_name, followable_path, followa
visit send(followable_path, arguments)
within "##{dom_id(followable)}" do
click_link "Unfollow"
click_link("Unfollow #{followable.model_name.human.downcase}")
expect(page).not_to have_link "Unfollow"
expect(page).to have_link "Follow"
expect(page).not_to have_link("Unfollow")
expect(page).to have_link("Follow #{followable.model_name.human.downcase}")
end
end
@@ -97,7 +96,7 @@ shared_examples "followable" do |followable_class_name, followable_path, followa
visit send(followable_path, arguments)
within "##{dom_id(followable)}" do
click_link "Unfollow"
click_link("Unfollow #{followable.model_name.human.downcase}")
end
expect(page).to have_content strip_tags(t("shared.followable.#{followable_class_name}.destroy.notice_html"))

View File

@@ -9,6 +9,9 @@ shared_examples "nested imageable" do |imageable_factory_name, path, imageable_p
let!(:imageable) { create(imageable_factory_name) }
before do
Setting['feature.allow_images'] = true
imageable_path_arguments&.each do |argument_name, path_to_value|
arguments.merge!("#{argument_name}": imageable.send(path_to_value))
end
@@ -16,6 +19,10 @@ shared_examples "nested imageable" do |imageable_factory_name, path, imageable_p
imageable.update(author: user) if imageable.respond_to?(:author)
end
after do
Setting['feature.allow_images'] = nil
end
describe "at #{path}" do
scenario "Should show new image link when imageable has not an associated image defined" do