Merge pull request #1035 from consul/show_sp_ids

Show sp ids
This commit is contained in:
Raimond Garcia
2016-04-04 19:08:10 +02:00
5 changed files with 14 additions and 21 deletions

View File

@@ -102,7 +102,7 @@ class SpendingProposal < ActiveRecord::Base
end
def code
"#{Setting["proposal_code_prefix"]}-#{created_at.strftime('%Y')}-#{id}" + (administrator.present? ? "-A#{administrator.id}" : "")
"#{created_at.strftime('%Y')}-#{id}" + (administrator.present? ? "-A#{administrator.id}" : "")
end
def send_unfeasible_email

View File

@@ -15,6 +15,12 @@
<%= geozone_name(@spending_proposal) %>
</div>
<br>
<p id="spending_proposal_code">
<%= t("spending_proposals.show.code") %>
<strong><%= @spending_proposal.id %></strong>
</p>
<%= safe_html_with_links @spending_proposal.description.html_safe %>
<% if @spending_proposal.external_url.present? %>

View File

@@ -438,6 +438,7 @@ en:
back_link: Back
show:
author_deleted: User deleted
code: 'Investment project code:'
share: Share
wrong_price_format: Only integer numbers
spending_proposal:

View File

@@ -438,6 +438,7 @@ es:
back_link: Volver
show:
author_deleted: Usuario eliminado
code: 'Código propuesta de gasto:'
share: Compartir
wrong_price_format: Solo puede incluir caracteres numéricos
spending_proposal:

View File

@@ -166,25 +166,7 @@ feature 'Spending proposals' do
expect(page).to have_content error_message
end
scenario "Show (as admin)" do
user = create(:user)
admin = create(:administrator, user: user)
login_as(admin.user)
spending_proposal = create(:spending_proposal,
geozone: create(:geozone),
association_name: 'People of the neighbourhood')
visit spending_proposal_path(spending_proposal)
expect(page).to have_content(spending_proposal.title)
expect(page).to have_content(spending_proposal.description)
expect(page).to have_content(spending_proposal.author.name)
expect(page).to have_content(spending_proposal.association_name)
expect(page).to have_content(spending_proposal.geozone.name)
end
scenario "Show (as user)" do
scenario "Show" do
user = create(:user)
login_as(user)
@@ -199,6 +181,9 @@ feature 'Spending proposals' do
expect(page).to have_content(spending_proposal.author.name)
expect(page).to have_content(spending_proposal.association_name)
expect(page).to have_content(spending_proposal.geozone.name)
within("#spending_proposal_code") do
expect(page).to have_content(spending_proposal.id)
end
end
context "Destroy" do