Merge pull request #1904 from consul/community-design

Community design
This commit is contained in:
Alberto García
2017-12-14 14:44:03 +01:00
committed by GitHub
18 changed files with 119 additions and 128 deletions

View File

@@ -306,7 +306,7 @@ a {
.icon-angle-left { .icon-angle-left {
clear: both; clear: both;
color: $text-medium; color: $text-medium;
float: left; display: inline-block;
} }
.back:not([class^="icon-"]) { .back:not([class^="icon-"]) {

View File

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

View File

@@ -250,6 +250,7 @@
.proposal-form, .proposal-form,
.budget-investment-form, .budget-investment-form,
.spending-proposal-form, .spending-proposal-form,
.document-form,
.topic-new, .topic-new,
.topic-form { .topic-form {
@@ -300,6 +301,7 @@
} }
.proposal-form, .proposal-form,
.document-form,
.topic-form, .topic-form,
.topic-new { .topic-new {

View File

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

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

@@ -3,20 +3,21 @@
<div class="jumbo light"> <div class="jumbo light">
<div class="row"> <div class="row">
<div class="small-12 column"> <div class="small-12 column">
<%= back_link_to community_back_link_path(@community) %> <span class="uppercase"><%= community_text(@community) %></span>
<h2><%= community_text(@community) %></h2> <h2><%= link_to community_title(@community), community_back_link_path(@community) %></h2>
<p class="lead"> <%= community_title(@community) %> </p> </div>
<div class="small-12 medium-9 column end">
<p><%= community_description(@community) %></p> <p><%= community_description(@community) %></p>
</div> </div>
</div> </div>
</div> </div>
<div class="row"> <div class="row">
<aside class="small-12 column show-for-small-only">
<aside class="show-for-small-only small-12 column">
<div class="sidebar-divider"></div> <div class="sidebar-divider"></div>
<h2><%= t("community.show.sidebar.participate") %></h2> <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> </aside>
<div class="small-12 medium-9 column"> <div class="small-12 medium-9 column">
@@ -26,14 +27,12 @@
<%= paginate @topics %> <%= paginate @topics %>
</div> </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> <div class="sidebar-divider"></div>
<h2><%= t("community.show.sidebar.participate") %></h2> <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> </aside>
</div> </div>
</div> </div>
<%= render 'participants' %> <%= render 'participants' %>

View File

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

View File

@@ -3,19 +3,15 @@
<%= render 'shared/errors', resource: @topic %> <%= render 'shared/errors', resource: @topic %>
<div class="row"> <div class="row">
<div class="small-12 column"> <div class="small-12 column">
<%= f.label :title, t("community.topic.form.topic_title") %> <%= f.label :title, t("community.topic.form.topic_title") %>
<%= f.text_field :title, label: false %> <%= f.text_field :title, label: false %>
</div>
<div class="small-12 column"> <%= f.label :description, t("community.topic.form.topic_text") %>
<%= f.label :description, t("community.topic.form.topic_description") %> <%= f.text_area :description, label: false, rows: "5" %>
<%= f.text_area :description, label: false %>
</div>
<div class="actions small-12 column">
<%= f.submit(class: "button", value: t("community.topic.form.#{action_name}.submit_button")) %> <%= f.submit(class: "button", value: t("community.topic.form.#{action_name}.submit_button")) %>
</div> </div>
</div> </div>
<% end %> <% 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? %> <% if user_signed_in? %>
<div class="callout primary">
<%= t("community.show.create_first_community_topic.first_theme_not_logged_in") %> <%= t("community.show.create_first_community_topic.first_theme_not_logged_in") %>
</div>
<% else %> <% else %>
<div class="callout primary"> <div class="callout primary">
<%= t("community.show.create_first_community_topic.sub_first_theme", <%= t("community.show.create_first_community_topic.sub_first_theme",
link: link_to(t("community.show.create_first_community_topic.sign_link", sign_in: link_to(t("community.show.create_first_community_topic.sign_in"), new_user_session_path),
org_name: setting['org_name']), new_user_session_path)).html_safe %> sign_up: link_to(t("community.show.create_first_community_topic.sign_up"), new_user_registration_path)).html_safe %>
</div> </div>
<% end %> <% end %>

View File

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

View File

@@ -1,6 +1,6 @@
<div id="<%= dom_id(topic) %>" class="panel column"> <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> <h3><%= link_to topic.title, community_topic_path(@community, topic) %></h3>
@@ -14,12 +14,4 @@
</p> </p>
</div> </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> </div>

View File

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

View File

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

View File

@@ -1,20 +1,42 @@
<div class="row topic-show"> <div class="topic-show">
<div class="small-12 medium-12 column"> <div class="row margin-bottom">
<div class="small-12 medium-9 column">
<%= back_link_to community_path(@community) %> <%= back_link_to community_path(@community), t("community.show.back",
<br> community: community_text(@community),
proposal: community_title(@community)) %>
<p><%= community_text(@community) %> <strong><%= community_title(@community) %></strong></p>
<h1><%= @topic.title %></h1> <h1><%= @topic.title %></h1>
<div class="topic-info">
<p><%= @topic.description %></p> <div class="topic-info margin-bottom">
<%= render '/shared/author_info', resource: @topic %> <%= render '/shared/author_info', resource: @topic %>
<span class="bullet">&nbsp;&bull;&nbsp;</span> <span class="bullet">&nbsp;&bull;&nbsp;</span>
<%= l @topic.created_at.to_date %> <%= l(@topic.created_at.to_date) %>
<span class="bullet">&nbsp;&bull;&nbsp;</span> <span class="bullet">&nbsp;&bull;&nbsp;</span>
<span class="icon-comments"></span>&nbsp; <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> </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"> <div class="tabs-content" data-tabs-content="topics-tabs" role="tablist">
<%= render "topics/filter_subnav" %> <%= render "topics/filter_subnav" %>
@@ -22,6 +44,4 @@
<%= render "topics/comments" %> <%= render "topics/comments" %>
</div> </div>
</div> </div>
</div>
</div> </div>

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. 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. 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: 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 first_theme: Create the first community topic
sub_first_theme: To create a theme you have to %{link} sub_first_theme: "To create a theme you must to %{sign_in} o %{sign_up}."
sign_link: "access %{org_name}" sign_in: "sign in"
sign_up: "sign up"
tab: tab:
participants: Participants participants: Participants
sidebar: sidebar:
participate: Participate participate: Participate
new_topic: Create topic new_topic: Create topic
disabled_info_title: You need to be logged to create a new topic
topic: topic:
edit_button: Edit edit: Edit topic
destroy_button: Destroy destroy: Destroy topic
comments: comments:
one: 1 comment one: 1 comment
other: "%{count} comments" other: "%{count} comments"
zero: No comments zero: No comments
author: Author
back: Back to %{community} %{proposal}
topic: topic:
create: Create a topic create: Create a topic
edit: Edit Topic edit: Edit Topic
form: form:
topic_title: Topic Title topic_title: Title
topic_description: Description topic_text: Initial text
new: new:
submit_button: Create topic submit_button: Create topic
edit: edit:

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. 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. 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: 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 first_theme: Crea el primer tema de la comunidad
sub_first_theme: Para crear un tema tienes que %{link} sub_first_theme: "Para crear un tema debes %{sign_in} o %{sign_up}."
sign_link: "acceder a %{org_name}" sign_in: "iniciar sesión"
sign_up: "registrarte"
tab: tab:
participants: Participantes participants: Participantes
sidebar: sidebar:
participate: Participa participate: Participa
new_topic: Crea un tema new_topic: Crea un tema
disabled_info_title: Necesitas estar logueado para crear un nuevo tema
topic: topic:
edit_button: Editar edit: Editar tema
destroy_button: Eliminar destroy: Eliminar tema
comments: comments:
zero: Sin comentarios zero: Sin comentarios
one: 1 Comentario one: 1 Comentario
other: "%{count} Comentarios" other: "%{count} Comentarios"
author: Autor
back: Volver a %{community} %{proposal}
topic: topic:
create: Crear un tema create: Crear un tema
edit: Editar tema edit: Editar tema
form: form:
topic_title: Titulo del tema topic_title: Título
topic_description: Descripción topic_text: Texto inicial
new: new:
submit_button: Crear tema submit_button: Crear tema
edit: edit:

View File

@@ -24,16 +24,6 @@ feature 'Communities' do
expect(page).to have_content proposal.title expect(page).to have_content proposal.title
expect(page).to have_content "Participate in the community of this proposal" 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).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 end
scenario 'Should display without_topics_text and participants when there are not topics' do 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) expect(topic2.title).to appear_before(topic1.title)
end 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) proposal = create(:proposal)
community = proposal.community community = proposal.community
user = create(:user) user = create(:user)
@@ -108,15 +98,11 @@ feature 'Communities' do
topic2 = create(:topic, community: community) topic2 = create(:topic, community: community)
login_as(user) 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 visit community_topic_path(community, topic2)
expect(page).to have_link("Edit", href: edit_community_topic_path(community, topic1)) expect(page).not_to have_link("Edit topic", href: edit_community_topic_path(community, topic2))
end
within "#topic_#{topic2.id}" do
expect(page).not_to have_link("Edit", href: edit_community_topic_path(community, topic2))
end
end end
scenario 'Should display participant when there is topics' do scenario 'Should display participant when there is topics' do

View File

@@ -4,13 +4,16 @@ feature 'Topics' do
context 'New' 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) proposal = create(:proposal)
community = proposal.community community = proposal.community
logout
visit community_path(community) 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 end
scenario 'Can access to new topic page with user logged', :js do scenario 'Can access to new topic page with user logged', :js do
@@ -34,8 +37,8 @@ feature 'Topics' do
click_link "Create topic" click_link "Create topic"
expect(page).to have_content "Topic Title" expect(page).to have_content "Title"
expect(page).to have_content "Description" expect(page).to have_content "Initial text"
expect(page).to have_content "Recommendations to create a topic" 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 "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." 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) user = create(:user)
topic = create(:topic, community: community, author: user) topic = create(:topic, community: community, author: user)
login_as(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).to have_content "Topic deleted successfully."
expect(page).not_to have_content topic.title expect(page).not_to have_content topic.title