Send message to the community has been moved outside of dashboard.
This commit is contained in:
Juan Salvador Pérez García
2018-07-11 11:04:44 +02:00
parent a606324ee7
commit 26d2a500ef
6 changed files with 34 additions and 26 deletions

View File

@@ -28,6 +28,14 @@
</div>
<aside class="small-12 medium-3 column hide-for-small-only">
<% if @community.proposal.present? %>
<div class="sidebar-divider"></div>
<h2><%= t('.author') %></h2>
<%= link_to t('.send_notification'),
new_proposal_notification_path(proposal_id: @community.proposal.id),
class: 'button expanded hollow' %>
<% end %>
<div class="sidebar-divider"></div>
<h2><%= t("community.show.sidebar.participate") %></h2>
<%= link_to t("community.show.sidebar.new_topic"), create_topic_link(@community) , class: "button expanded" %>

View File

@@ -4,11 +4,6 @@
<% end %>
<%= link_to t('.send_notification'),
new_proposal_notification_path(proposal_id: proposal.id),
target: '_blank',
class: 'button hollow' %>
<% if can_destroy_image?(proposal) %>
<%= link_to t('images.remove_image'),
image_path(proposal.image, from: request.url),

View File

@@ -526,7 +526,6 @@ en:
edit_proposal_link: Edit
publish: Publish
retire: Retire
send_notification: Send notification
new_request:
links: Links
resources:
@@ -989,3 +988,7 @@ en:
link_fields:
label_placeholder: Link title
url_placeholder: Link address
communities:
show:
send_notification: Send message to the community
author: Author

View File

@@ -526,7 +526,6 @@ es:
edit_proposal_link: Editar propuesta
publish: Publicar
retire: Retirar
send_notification: Enviar notificación
new_request:
liks: Enlaces
resources:
@@ -988,3 +987,7 @@ es:
link_fields:
label_placeholder: Título del enlace
url_placeholder: Dirección del enlace
communities:
show:
send_notification: Enviar mensaje a la Comunidad
author: Autor

View File

@@ -10,23 +10,20 @@ feature 'Proposal Notifications' do
visit root_path
click_link 'My activity'
within("#proposal_#{proposal.id}") do
click_link 'Dashboard'
end
click_link 'Send notification'
click_link proposal.title
click_link 'Access the community'
click_link 'Send message to the community'
fill_in 'proposal_notification_title', with: 'Thank you for supporting my proposal'
fill_in 'proposal_notification_body', with: 'Please share it with others so we can make it happen!'
click_button "Send message"
click_button 'Send message'
expect(page).to have_content 'Your message has been sent correctly.'
expect(page).to have_content 'Thank you for supporting my proposal'
expect(page).to have_content 'Please share it with others so we can make it happen!'
end
scenario "Send a notification (Active voter)" do
scenario 'Send a notification (Active voter)' do
author = create(:user)
proposal = create(:proposal, author: author)
@@ -38,7 +35,7 @@ feature 'Proposal Notifications' do
expect(Notification.count).to eq(1)
end
scenario "Send a notification (Follower)" do
scenario 'Send a notification (Follower)' do
author = create(:user)
proposal = create(:proposal, author: author)
user_follower = create(:user)
@@ -49,7 +46,7 @@ feature 'Proposal Notifications' do
expect(Notification.count).to eq(1)
end
scenario "Send a notification (Follower and Voter)" do
scenario 'Send a notification (Follower and Voter)' do
author = create(:user)
proposal = create(:proposal, author: author)
@@ -93,8 +90,8 @@ feature 'Proposal Notifications' do
scenario "Show notifications" do
proposal = create(:proposal)
notification1 = create(:proposal_notification, proposal: proposal, title: "Hey guys", body: "Just wanted to let you know that...")
notification2 = create(:proposal_notification, proposal: proposal, title: "Another update",
_notification1 = create(:proposal_notification, proposal: proposal, title: "Hey guys", body: "Just wanted to let you know that...")
_notification2 = create(:proposal_notification, proposal: proposal, title: "Another update",
body: "We are almost there please share with your peoples!")
visit proposal_path(proposal)
@@ -161,16 +158,17 @@ feature 'Proposal Notifications' do
expect(page).to have_link("the proposal's page", href: proposal_path(proposal, anchor: 'comments'))
end
context "Permissions" do
context 'Permissions' do
scenario "Link to send the message" do
user = create(:user)
scenario 'Link to send the message' do
_user = create(:user)
author = create(:user)
proposal = create(:proposal, author: author)
login_as(author)
visit proposal_dashboard_index_path(proposal)
expect(page).to have_link "Send notification"
visit community_path(proposal.community)
expect(page).to have_link 'Send message to the community'
end
scenario "Accessing form directly" do

View File

@@ -20,10 +20,11 @@ module Notifications
click_link "My activity"
within("#proposal_#{proposal.id}") do
click_link "Dashboard"
click_link proposal.title
end
click_link "Send notification"
click_link 'Access the community'
click_link 'Send message to the community'
fill_in 'proposal_notification_title', with: "Thanks for supporting proposal: #{proposal.title}"
fill_in 'proposal_notification_body', with: "Please share it with others! #{proposal.summary}"