Merge pull request #2539 from consul/admin-budget-investments

Admin budget investment info
This commit is contained in:
Raimond Garcia
2018-03-27 20:21:03 +02:00
committed by GitHub
7 changed files with 106 additions and 18 deletions

View File

@@ -508,8 +508,7 @@ $sidebar-active: #f4fcd0;
} }
.account-info, .account-info,
.login-as, .login-as {
.spending-proposal-info {
background-color: #e7e7e7; background-color: #e7e7e7;
border-radius: rem-calc(3); border-radius: rem-calc(3);
font-size: rem-calc(16); font-size: rem-calc(16);
@@ -522,8 +521,26 @@ $sidebar-active: #f4fcd0;
} }
} }
.spending-proposal-info p { .extra-info {
margin-bottom: 0; background: #fafafa;
border-bottom-left-radius: rem-calc(6);
border-bottom-right-radius: rem-calc(6);
border-top: 2px solid #000;
font-size: $small-font-size;
padding: $line-height / 2;
}
.admin-budget-investment-info {
background: $highlight-soft;
border: 2px solid $highlight;
border-radius: rem-calc(4);
margin-bottom: $line-height;
padding: $line-height / 2;
p {
font-size: $small-font-size;
margin-bottom: 0;
}
} }
.admin { .admin {

View File

@@ -1,50 +1,53 @@
<div class="callout primary float-right"> <div class="extra-info float-right">
<%= t "admin.budget_investments.show.info", budget_name: @budget.name, group_name: @investment.group.name, id: @investment.id %> <%= t "admin.budget_investments.show.info",
budget_name: @budget.name,
group_name: @investment.group.name,
id: @investment.id %>
</div> </div>
<br> <br>
<h1 class="inline-block"><%= @investment.title %></h1> <h1 class="inline-block"><%= @investment.title %></h1>
<div class="row small-collapse spending-proposal-info"> <div class="admin-budget-investment-info">
<div class="row"> <div class="row expanded">
<div class="small-12 medium-4 column"> <div class="small-12 medium-4 column">
<p title="<%= t("admin.budget_investments.show.group") %>: <%= @investment.group.name %>"> <p title="<%= t("admin.budget_investments.show.group") %>: <%= @investment.group.name %>">
<strong><%= t("admin.budget_investments.show.heading") %>:</strong> <strong><%= t("admin.budget_investments.show.heading") %></strong>:
<%= @investment.heading.name %> <%= @investment.heading.name %>
</p> </p>
</div> </div>
<div class="small-12 medium-4 column"> <div class="small-12 medium-4 column">
<p> <p>
<strong><%= t("admin.budget_investments.show.by") %>:</strong> <strong><%= t("admin.budget_investments.show.by") %></strong>:
<%= link_to @investment.author.name, admin_hidden_user_path(@investment.author) %> <%= link_to @investment.author.name, admin_hidden_user_path(@investment.author) %>
</p> </p>
</div> </div>
<div class="small-12 medium-4 column"> <div class="small-12 medium-4 column">
<p> <p>
<strong><%= t("admin.budget_investments.show.sent") %>:</strong> <strong><%= t("admin.budget_investments.show.sent") %></strong>:
<%= l @investment.created_at, format: :datetime %> <%= l @investment.created_at, format: :datetime %>
</p> </p>
</div> </div>
</div> </div>
<div class="row"> <div class="row expanded">
<div class="small-12 medium-4 column"> <div class="small-12 medium-4 column">
<p> <p>
<strong><%= t("admin.budget_investments.show.compatibility.title") %>:</strong> <strong><%= t("admin.budget_investments.show.compatibility.title") %></strong>:
<%= t("admin.budget_investments.show.compatibility.#{@investment.incompatible?}") %> <%= t("admin.budget_investments.show.compatibility.#{@investment.incompatible?}") %>
</p> </p>
</div> </div>
<div class="small-12 medium-4 column"> <div class="small-12 medium-4 column">
<p> <p>
<strong><%= t("admin.budget_investments.show.selection.title") %>:</strong> <strong><%= t("admin.budget_investments.show.selection.title") %></strong>:
<%= t("admin.budget_investments.show.selection.#{@investment.selected?}") %> <%= t("admin.budget_investments.show.selection.#{@investment.selected?}") %>
</p> </p>
</div> </div>
<div class="small-12 medium-4 column"> <div class="small-12 medium-4 column">
<p> <p>
<strong><%= t("admin.budget_investments.show.winner.title") %>:</strong> <strong><%= t("admin.budget_investments.show.winner.title") %></strong>:
<%= t("admin.budget_investments.show.winner.#{@investment.winner?}") %> <%= t("admin.budget_investments.show.winner.#{@investment.winner?}") %>
</p> </p>
</div> </div>
@@ -52,11 +55,38 @@
</div> </div>
<% if @investment.external_url.present? %> <% if @investment.external_url.present? %>
<p><%= text_with_links @investment.external_url %>&nbsp;<span class="icon-external small"></span></p> <p>
<%= text_with_links @investment.external_url %>&nbsp;<span class="icon-external small"></span>
</p>
<% end %> <% end %>
<%= safe_html_with_links @investment.description %> <%= safe_html_with_links @investment.description %>
<p>
<strong><%= t("admin.budget_investments.show.image") %></strong>:
<% if @investment.image.present? %>
<%= link_to t("admin.budget_investments.show.see_image"),
namespaced_budget_investment_path(@investment, {anchor: 'image'}),
target: "blank" %>
<% else %>
<%= t("admin.budget_investments.show.no_image") %>
<% end %>
</p>
<p>
<strong><%= t("admin.budget_investments.show.documents") %></strong>:
<% if @investment.documents.present? %>
<%= link_to t("admin.budget_investments.show.see_documents",
count: @investment.documents.count),
namespaced_budget_investment_path(@investment, {anchor: 'documents'}),
target: "blank" %>
<% else %>
<%= t("admin.budget_investments.show.no_documents") %>
<% end %>
</p>
<p id="user-tags"> <p id="user-tags">
<strong><%= t("admin.budget_investments.show.user_tags") %>: </strong> <strong><%= t("admin.budget_investments.show.user_tags") %>: </strong>
<%= @investment.tag_list.sort.join(', ') %> <%= @investment.tag_list.sort.join(', ') %>

View File

@@ -1,4 +1,4 @@
<div class="documents"> <div id="documents" class="documents">
<h2><%= t("documents.title") %>&nbsp;<span>(<%= documents.count %>)</span></h2> <h2><%= t("documents.title") %>&nbsp;<span>(<%= documents.count %>)</span></h2>
<% if documents.any? %> <% if documents.any? %>

View File

@@ -1,4 +1,4 @@
<div class="small-12 column text-center image-preview"> <div id="image" class="small-12 column text-center image-preview">
<figure> <figure>
<%= image_tag image.attachment.url(version), <%= image_tag image.attachment.url(version),
class: image_class(image), class: image_class(image),

View File

@@ -217,6 +217,12 @@ en:
title: Winner title: Winner
"true": "Yes" "true": "Yes"
"false": "No" "false": "No"
image: "Image"
see_image: "See image"
no_image: "Without image"
documents: "Documents"
see_documents: "See documents (%{count})"
no_documents: "Without documents"
edit: edit:
classification: Classification classification: Classification
compatibility: Compatibility compatibility: Compatibility

View File

@@ -216,6 +216,12 @@ es:
title: Ganadora title: Ganadora
"true": "Si" "true": "Si"
"false": "No" "false": "No"
image: "Imagen"
see_image: "Ver imagen"
no_image: "Sin imagen"
documents: "Documentos"
see_documents: "Ver documentos (%{count})"
no_documents: "Sin documentos"
edit: edit:
classification: Clasificación classification: Clasificación
compatibility: Compatibilidad compatibility: Compatibilidad

View File

@@ -443,6 +443,8 @@ feature 'Admin budget investments' do
expect(page).to have_content(budget_investment.description) expect(page).to have_content(budget_investment.description)
expect(page).to have_content(budget_investment.author.name) expect(page).to have_content(budget_investment.author.name)
expect(page).to have_content(budget_investment.heading.name) expect(page).to have_content(budget_investment.heading.name)
expect(page).to have_content('Without image')
expect(page).to have_content('Without documents')
expect(page).to have_content('1234') expect(page).to have_content('1234')
expect(page).to have_content('1000') expect(page).to have_content('1000')
expect(page).to have_content('Unfeasible') expect(page).to have_content('Unfeasible')
@@ -456,6 +458,33 @@ feature 'Admin budget investments' do
expect(page).to have_button "Publish comment" expect(page).to have_button "Publish comment"
end end
scenario 'Show image and documents on investment details' do
budget_investment = create(:budget_investment,
price: 1234,
price_first_year: 1000,
feasibility: "unfeasible",
unfeasibility_explanation: 'It is impossible',
administrator: administrator)
create(:image, imageable: budget_investment)
document = create(:document, documentable: budget_investment)
visit admin_budget_budget_investments_path(budget_investment.budget)
click_link budget_investment.title
expect(page).to have_content(budget_investment.title)
expect(page).to have_content(budget_investment.description)
expect(page).to have_content(budget_investment.author.name)
expect(page).to have_content(budget_investment.heading.name)
expect(page).to have_content('See image')
expect(page).to have_content('See documents (1)')
expect(page).to have_content('1234')
expect(page).to have_content('1000')
expect(page).to have_content('Unfeasible')
expect(page).to have_content('It is impossible')
expect(page).to have_content('Ana (ana@admins.org)')
end
scenario "If budget is finished, investment cannot be edited or valuation comments created" do scenario "If budget is finished, investment cannot be edited or valuation comments created" do
# Only milestones can be managed # Only milestones can be managed