Add I18n texts for milestone images.

Add specs to test admin image uploader and milestones' show.
Modify the UI to fit the mockups provided in the issue.
This commit is contained in:
iagirre
2017-12-13 14:03:46 +01:00
parent 5186149b33
commit 59a4b93a00
6 changed files with 11 additions and 2 deletions

View File

@@ -314,7 +314,8 @@
.polls-form,
.poll-question-form,
.legislation-process-new,
.legislation-process-edit {
.legislation-process-edit,
.milestone-new {
@include direct-uploads;
}

View File

@@ -15,8 +15,8 @@
<span class="milestone-date">
<strong><%= t("budgets.investments.show.milestone_publish_date", publish_date: l(milestone.created_at.to_date)) %></strong>
</span>
<%= image_tag(milestone.image_url(:large), {alt: milestone.image.title, class: "margin", id: "image_#{milestone.id}"}) if milestone.image.present? %>
<p><%= milestone.description %></p>
<%= image_tag milestone.image_url(:large) if milestone.image.present? %>
</div>
</li>
<% end %>

View File

@@ -196,6 +196,7 @@ en:
table_actions: "Actions"
delete: "Delete milestone"
no_milestones: "Don't have defined milestones"
image: "Image"
show_image: "Show image"
new:
creating: Create milestone

View File

@@ -196,6 +196,7 @@ es:
table_actions: "Acciones"
delete: "Eliminar hito"
no_milestones: "No hay hitos definidos"
image: "Imagen"
show_image: "Ver imagen"
new:
creating: Crear hito

View File

@@ -62,11 +62,14 @@ feature 'Admin budget investment milestones' do
context "Edit" do
scenario "Change title and description" do
milestone = create(:budget_investment_milestone, investment: @investment)
create(:image, imageable: milestone)
visit admin_budget_budget_investment_path(@investment.budget, @investment)
click_link milestone.title
expect(page).to have_css("img[alt='#{milestone.image.title}']")
fill_in 'budget_investment_milestone_title', with: 'Changed title'
fill_in 'budget_investment_milestone_description', with: 'Changed description'
@@ -74,6 +77,7 @@ feature 'Admin budget investment milestones' do
expect(page).to have_content 'Changed title'
expect(page).to have_content 'Changed description'
expect(page).to have_link 'Show image'
end
end

View File

@@ -495,6 +495,7 @@ feature 'Budget Investments' do
investment = create(:budget_investment)
milestone = create(:budget_investment_milestone, investment: investment, title: "New text to show",
created_at: DateTime.new(2015, 9, 19).utc)
image = create(:image, imageable: milestone)
login_as(user)
visit budget_investment_path(budget_id: investment.budget.id, id: investment.id)
@@ -505,6 +506,7 @@ feature 'Budget Investments' do
expect(page).to have_content(milestone.title)
expect(page).to have_content(milestone.description)
expect(page).to have_content("Published 2015-09-19")
expect(page.find("#image_#{milestone.id}")['alt']).to have_content image.title
end
end