Merge pull request #3057 from consul/backport-make-milestones-polymorphic
[Backport] Make milestones polymorphic
This commit is contained in:
2
Rakefile
2
Rakefile
@@ -3,5 +3,5 @@
|
||||
|
||||
require File.expand_path('../config/application', __FILE__)
|
||||
|
||||
Rails.application.load_tasks
|
||||
Rails.application.load_tasks if Rake::Task.tasks.empty?
|
||||
KnapsackPro.load_tasks if defined?(KnapsackPro)
|
||||
|
||||
@@ -2,19 +2,19 @@ class Admin::BudgetInvestmentMilestonesController < Admin::BaseController
|
||||
include Translatable
|
||||
|
||||
before_action :load_budget_investment, only: [:index, :new, :create, :edit, :update, :destroy]
|
||||
before_action :load_budget_investment_milestone, only: [:edit, :update, :destroy]
|
||||
before_action :load_milestone, only: [:edit, :update, :destroy]
|
||||
before_action :load_statuses, only: [:index, :new, :create, :edit, :update]
|
||||
|
||||
def index
|
||||
end
|
||||
|
||||
def new
|
||||
@milestone = Budget::Investment::Milestone.new
|
||||
@milestone = Milestone.new
|
||||
end
|
||||
|
||||
def create
|
||||
@milestone = Budget::Investment::Milestone.new(milestone_params)
|
||||
@milestone.investment = @investment
|
||||
@milestone = Milestone.new(milestone_params)
|
||||
@milestone.milestoneable = @investment
|
||||
if @milestone.save
|
||||
redirect_to admin_budget_budget_investment_path(@investment.budget, @investment),
|
||||
notice: t('admin.milestones.create.notice')
|
||||
@@ -47,22 +47,22 @@ class Admin::BudgetInvestmentMilestonesController < Admin::BaseController
|
||||
image_attributes = [:id, :title, :attachment, :cached_attachment, :user_id, :_destroy]
|
||||
documents_attributes = [:id, :title, :attachment, :cached_attachment, :user_id, :_destroy]
|
||||
attributes = [:publication_date, :budget_investment_id, :status_id,
|
||||
translation_params(Budget::Investment::Milestone),
|
||||
translation_params(Milestone),
|
||||
image_attributes: image_attributes, documents_attributes: documents_attributes]
|
||||
|
||||
params.require(:budget_investment_milestone).permit(*attributes)
|
||||
params.require(:milestone).permit(*attributes)
|
||||
end
|
||||
|
||||
def load_budget_investment
|
||||
@investment = Budget::Investment.find(params[:budget_investment_id])
|
||||
end
|
||||
|
||||
def load_budget_investment_milestone
|
||||
def load_milestone
|
||||
@milestone = get_milestone
|
||||
end
|
||||
|
||||
def get_milestone
|
||||
Budget::Investment::Milestone.find(params[:id])
|
||||
Milestone.find(params[:id])
|
||||
end
|
||||
|
||||
def resource
|
||||
@@ -70,7 +70,7 @@ class Admin::BudgetInvestmentMilestonesController < Admin::BaseController
|
||||
end
|
||||
|
||||
def load_statuses
|
||||
@statuses = Budget::Investment::Status.all
|
||||
@statuses = Milestone::Status.all
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
@@ -1,20 +1,20 @@
|
||||
class Admin::BudgetInvestmentStatusesController < Admin::BaseController
|
||||
class Admin::MilestoneStatusesController < Admin::BaseController
|
||||
|
||||
before_action :load_status, only: [:edit, :update, :destroy]
|
||||
|
||||
def index
|
||||
@statuses = Budget::Investment::Status.all
|
||||
@statuses = Milestone::Status.all
|
||||
end
|
||||
|
||||
def new
|
||||
@status = Budget::Investment::Status.new
|
||||
@status = Milestone::Status.new
|
||||
end
|
||||
|
||||
def create
|
||||
@status = Budget::Investment::Status.new(status_params)
|
||||
@status = Milestone::Status.new(status_params)
|
||||
|
||||
if @status.save
|
||||
redirect_to admin_budget_investment_statuses_path,
|
||||
redirect_to admin_milestone_statuses_path,
|
||||
notice: t('admin.statuses.create.notice')
|
||||
else
|
||||
render :new
|
||||
@@ -26,7 +26,7 @@ class Admin::BudgetInvestmentStatusesController < Admin::BaseController
|
||||
|
||||
def update
|
||||
if @status.update(status_params)
|
||||
redirect_to admin_budget_investment_statuses_path,
|
||||
redirect_to admin_milestone_statuses_path,
|
||||
notice: t('admin.statuses.update.notice')
|
||||
else
|
||||
render :edit
|
||||
@@ -35,17 +35,17 @@ class Admin::BudgetInvestmentStatusesController < Admin::BaseController
|
||||
|
||||
def destroy
|
||||
@status.destroy
|
||||
redirect_to admin_budget_investment_statuses_path,
|
||||
redirect_to admin_milestone_statuses_path,
|
||||
notice: t('admin.statuses.delete.notice')
|
||||
end
|
||||
|
||||
private
|
||||
|
||||
def load_status
|
||||
@status = Budget::Investment::Status.find(params[:id])
|
||||
@status = Milestone::Status.find(params[:id])
|
||||
end
|
||||
|
||||
def status_params
|
||||
params.require(:budget_investment_status).permit([:name, :description])
|
||||
params.require(:milestone_status).permit([:name, :description])
|
||||
end
|
||||
end
|
||||
@@ -6,7 +6,7 @@ module Budgets
|
||||
|
||||
def show
|
||||
authorize! :read_executions, @budget
|
||||
@statuses = ::Budget::Investment::Status.all
|
||||
@statuses = Milestone::Status.all
|
||||
|
||||
if params[:status].present?
|
||||
@investments_by_heading = @budget.investments.winners
|
||||
|
||||
@@ -24,6 +24,7 @@ class Budget
|
||||
include Notifiable
|
||||
include Filterable
|
||||
include Flaggable
|
||||
include Milestoneable
|
||||
|
||||
belongs_to :author, -> { with_hidden }, class_name: 'User', foreign_key: 'author_id'
|
||||
belongs_to :heading
|
||||
@@ -40,8 +41,6 @@ class Budget
|
||||
has_many :comments, -> {where(valuation: false)}, as: :commentable, class_name: 'Comment'
|
||||
has_many :valuations, -> {where(valuation: true)}, as: :commentable, class_name: 'Comment'
|
||||
|
||||
has_many :milestones
|
||||
|
||||
validates :title, presence: true
|
||||
validates :author, presence: true
|
||||
validates :description, presence: true
|
||||
|
||||
@@ -1,35 +0,0 @@
|
||||
class Budget
|
||||
class Investment
|
||||
class Milestone < ActiveRecord::Base
|
||||
include Imageable
|
||||
include Documentable
|
||||
documentable max_documents_allowed: 3,
|
||||
max_file_size: 3.megabytes,
|
||||
accepted_content_types: [ "application/pdf" ]
|
||||
|
||||
translates :title, :description, touch: true
|
||||
include Globalizable
|
||||
|
||||
belongs_to :investment
|
||||
belongs_to :status, class_name: 'Budget::Investment::Status'
|
||||
|
||||
validates :investment, presence: true
|
||||
validates :publication_date, presence: true
|
||||
validate :description_or_status_present?
|
||||
|
||||
scope :order_by_publication_date, -> { order(publication_date: :asc, created_at: :asc) }
|
||||
scope :published, -> { where("publication_date <= ?", Date.current) }
|
||||
scope :with_status, -> { where("status_id IS NOT NULL") }
|
||||
|
||||
def self.title_max_length
|
||||
80
|
||||
end
|
||||
|
||||
def description_or_status_present?
|
||||
unless description.present? || status_id.present?
|
||||
errors.add(:description)
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
7
app/models/concerns/milestoneable.rb
Normal file
7
app/models/concerns/milestoneable.rb
Normal file
@@ -0,0 +1,7 @@
|
||||
module Milestoneable
|
||||
extend ActiveSupport::Concern
|
||||
|
||||
included do
|
||||
has_many :milestones, as: :milestoneable, dependent: :destroy
|
||||
end
|
||||
end
|
||||
31
app/models/milestone.rb
Normal file
31
app/models/milestone.rb
Normal file
@@ -0,0 +1,31 @@
|
||||
class Milestone < ActiveRecord::Base
|
||||
include Imageable
|
||||
include Documentable
|
||||
documentable max_documents_allowed: 3,
|
||||
max_file_size: 3.megabytes,
|
||||
accepted_content_types: [ "application/pdf" ]
|
||||
|
||||
translates :title, :description, touch: true
|
||||
include Globalizable
|
||||
|
||||
belongs_to :milestoneable, polymorphic: true
|
||||
belongs_to :status
|
||||
|
||||
validates :milestoneable, presence: true
|
||||
validates :publication_date, presence: true
|
||||
validate :description_or_status_present?
|
||||
|
||||
scope :order_by_publication_date, -> { order(publication_date: :asc, created_at: :asc) }
|
||||
scope :published, -> { where("publication_date <= ?", Date.current) }
|
||||
scope :with_status, -> { where("status_id IS NOT NULL") }
|
||||
|
||||
def self.title_max_length
|
||||
80
|
||||
end
|
||||
|
||||
def description_or_status_present?
|
||||
unless description.present? || status_id.present?
|
||||
errors.add(:description)
|
||||
end
|
||||
end
|
||||
end
|
||||
@@ -1,4 +1,4 @@
|
||||
class Budget::Investment::Status < ActiveRecord::Base
|
||||
class Milestone::Status < ActiveRecord::Base
|
||||
acts_as_paranoid column: :hidden_at
|
||||
|
||||
has_many :milestones
|
||||
@@ -57,7 +57,7 @@
|
||||
|
||||
<% if feature?(:budgets) %>
|
||||
<li class="section-title <%= "is-active" if controller_name == "budgets" ||
|
||||
controller_name == "budget_investment_statuses" %>">
|
||||
controller_name == "milestone_statuses" %>">
|
||||
<%= link_to admin_budgets_path do %>
|
||||
<span class="icon-budget"></span>
|
||||
<strong><%= t("admin.menu.budgets") %></strong>
|
||||
|
||||
@@ -8,12 +8,12 @@
|
||||
{ include_blank: @statuses.any? ? '' : t('admin.milestones.form.no_statuses_defined') },
|
||||
{ disabled: @statuses.blank? } %>
|
||||
<%= link_to t('admin.milestones.form.admin_statuses'),
|
||||
admin_budget_investment_statuses_path %>
|
||||
admin_milestone_statuses_path %>
|
||||
</div>
|
||||
|
||||
<%= f.translatable_fields do |translations_form| %>
|
||||
<%= translations_form.hidden_field :title, value: l(Time.current, format: :datetime),
|
||||
maxlength: Budget::Investment::Milestone.title_max_length %>
|
||||
maxlength: Milestone.title_max_length %>
|
||||
|
||||
<%= translations_form.text_area :description,
|
||||
rows: 5,
|
||||
|
||||
@@ -1,5 +0,0 @@
|
||||
<%= back_link_to admin_budget_investment_statuses_path %>
|
||||
|
||||
<h2><%= t("admin.statuses.edit.title") %></h2>
|
||||
|
||||
<%= render '/admin/budget_investment_statuses/form' %>
|
||||
@@ -1,5 +0,0 @@
|
||||
<%= back_link_to admin_budget_investment_statuses_path %>
|
||||
|
||||
<h2><%= t("admin.statuses.new.title") %></h2>
|
||||
|
||||
<%= render '/admin/budget_investment_statuses/form' %>
|
||||
@@ -18,7 +18,7 @@
|
||||
<td class="text-center"><%= milestone.id %></td>
|
||||
<td>
|
||||
<%= link_to milestone.title,
|
||||
edit_admin_budget_budget_investment_budget_investment_milestone_path(@investment.budget,
|
||||
edit_admin_budget_budget_investment_milestone_path(@investment.budget,
|
||||
@investment,
|
||||
milestone) %>
|
||||
</td>
|
||||
@@ -46,7 +46,7 @@
|
||||
</td>
|
||||
<td class="small-2">
|
||||
<%= link_to t("admin.milestones.index.delete"),
|
||||
admin_budget_budget_investment_budget_investment_milestone_path(@investment.budget,
|
||||
admin_budget_budget_investment_milestone_path(@investment.budget,
|
||||
@investment,
|
||||
milestone),
|
||||
method: :delete,
|
||||
|
||||
@@ -63,6 +63,6 @@
|
||||
|
||||
<p>
|
||||
<%= link_to t("admin.budget_investments.show.new_milestone"),
|
||||
new_admin_budget_budget_investment_budget_investment_milestone_path(@budget, @investment),
|
||||
new_admin_budget_budget_investment_milestone_path(@budget, @investment),
|
||||
class: "button hollow" %>
|
||||
</p>
|
||||
|
||||
5
app/views/admin/milestone_statuses/edit.html.erb
Normal file
5
app/views/admin/milestone_statuses/edit.html.erb
Normal file
@@ -0,0 +1,5 @@
|
||||
<%= back_link_to admin_milestone_statuses_path %>
|
||||
|
||||
<h2><%= t("admin.statuses.edit.title") %></h2>
|
||||
|
||||
<%= render '/admin/milestone_statuses/form' %>
|
||||
@@ -1,7 +1,7 @@
|
||||
<h2 class="inline-block"><%= t("admin.statuses.index.title") %></h2>
|
||||
|
||||
<%= link_to t("admin.statuses.index.new_status"),
|
||||
new_admin_budget_investment_status_path,
|
||||
new_admin_milestone_status_path,
|
||||
class: "button float-right margin-right" %>
|
||||
|
||||
<% if @statuses.any? %>
|
||||
@@ -15,7 +15,7 @@
|
||||
</thead>
|
||||
<tbody>
|
||||
<% @statuses.each do |status| %>
|
||||
<tr id="<%= dom_id(status) %>" class="budget_investment_status">
|
||||
<tr id="<%= dom_id(status) %>" class="milestone_status">
|
||||
<td>
|
||||
<%= status.name %>
|
||||
</td>
|
||||
@@ -24,10 +24,10 @@
|
||||
</td>
|
||||
<td>
|
||||
<%= link_to t("admin.statuses.index.edit"),
|
||||
edit_admin_budget_investment_status_path(status),
|
||||
edit_admin_milestone_status_path(status),
|
||||
method: :get, class: "button hollow" %>
|
||||
<%= link_to t("admin.statuses.index.delete"),
|
||||
admin_budget_investment_status_path(status),
|
||||
admin_milestone_status_path(status),
|
||||
method: :delete, class: "button hollow alert" %>
|
||||
</td>
|
||||
</tr>
|
||||
5
app/views/admin/milestone_statuses/new.html.erb
Normal file
5
app/views/admin/milestone_statuses/new.html.erb
Normal file
@@ -0,0 +1,5 @@
|
||||
<%= back_link_to admin_milestone_statuses_path %>
|
||||
|
||||
<h2><%= t("admin.statuses.new.title") %></h2>
|
||||
|
||||
<%= render '/admin/milestone_statuses/form' %>
|
||||
@@ -7,8 +7,8 @@ module ActionDispatch::Routing::UrlFor
|
||||
case resource.class.name
|
||||
when "Budget::Investment"
|
||||
[resource.budget, resource]
|
||||
when "Budget::Investment::Milestone"
|
||||
[resource.investment.budget, resource.investment, resource]
|
||||
when "Milestone"
|
||||
[resource.milestoneable.budget, resource.milestoneable, resource]
|
||||
when "Legislation::Annotation"
|
||||
[resource.draft_version.process, resource.draft_version, resource]
|
||||
when "Legislation::Proposal", "Legislation::Question", "Legislation::DraftVersion"
|
||||
|
||||
@@ -86,12 +86,12 @@ ar:
|
||||
organization_name: "إذا كنت تقترح بإسم جماعي/منظمة, أو نيابة عن أشخاص آخرين, اكتب إسمها"
|
||||
image: "اقتراح صورة وصفية"
|
||||
image_title: "عنوان الصورة"
|
||||
budget/investment/milestone:
|
||||
milestone:
|
||||
status_id: "حالة الإستثمار الحالية (إختياري)"
|
||||
title: "العنوان"
|
||||
description: "الوصف (إختياري ان كان هناك حالة معينة)"
|
||||
publication_date: "تاريخ النشر"
|
||||
budget/investment/status:
|
||||
milestone/status:
|
||||
name: "الاسم"
|
||||
description: "الوصف (إختياري)"
|
||||
budget/heading:
|
||||
|
||||
@@ -7,7 +7,7 @@ ast:
|
||||
budget/investment:
|
||||
one: "Proyectu de inversión"
|
||||
other: "Proyectos d'inversión"
|
||||
budget/investment/milestone:
|
||||
milestone:
|
||||
one: "finxu"
|
||||
other: "finxos"
|
||||
comment:
|
||||
|
||||
@@ -10,7 +10,7 @@ ca:
|
||||
budget/investment:
|
||||
one: "Proposta d'inversió"
|
||||
other: "Propostes d'inversió"
|
||||
budget/investment/milestone:
|
||||
milestone:
|
||||
one: "fita"
|
||||
other: "fites"
|
||||
comment:
|
||||
|
||||
@@ -10,10 +10,10 @@ de:
|
||||
budget/investment:
|
||||
one: "Ausgabenvorschlag"
|
||||
other: "Ausgabenvorschläge"
|
||||
budget/investment/milestone:
|
||||
milestone:
|
||||
one: "Meilenstein"
|
||||
other: "Meilensteine"
|
||||
budget/investment/status:
|
||||
milestone/status:
|
||||
one: "Status des Ausgabenvorschlags"
|
||||
other: "Status der Ausgabenvorschläge"
|
||||
comment:
|
||||
@@ -131,12 +131,12 @@ de:
|
||||
organization_name: "Wenn Sie einen Vorschlag im Namen einer Gruppe, Organisation oder mehreren Personen einreichen, nennen Sie bitte dessen/deren Name/n"
|
||||
image: "Beschreibendes Bild zum Ausgabenvorschlag"
|
||||
image_title: "Bildtitel"
|
||||
budget/investment/milestone:
|
||||
milestone:
|
||||
status_id: "Derzeitiger Status des Ausgabenvorschlags (optional)"
|
||||
title: "Titel"
|
||||
description: "Beschreibung (optional, wenn kein Status zugewiesen ist)"
|
||||
publication_date: "Datum der Veröffentlichung"
|
||||
budget/investment/status:
|
||||
milestone/status:
|
||||
name: "Name"
|
||||
description: "Beschreibung (optional)"
|
||||
budget/heading:
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
en-US:
|
||||
activerecord:
|
||||
models:
|
||||
budget/investment/milestone:
|
||||
milestone:
|
||||
one: "Meilenstein"
|
||||
other: "Meilensteine"
|
||||
budget/investment/status:
|
||||
milestone/status:
|
||||
one: "Investitionsstatus, Anlagenstatus"
|
||||
other: "Investitionsstatus, Anlagenstatus"
|
||||
comment:
|
||||
|
||||
@@ -10,12 +10,12 @@ en:
|
||||
budget/investment:
|
||||
one: "Investment"
|
||||
other: "Investments"
|
||||
budget/investment/milestone:
|
||||
milestone:
|
||||
one: "milestone"
|
||||
other: "milestones"
|
||||
budget/investment/status:
|
||||
one: "Investment status"
|
||||
other: "Investment statuses"
|
||||
milestone/status:
|
||||
one: "Milestone Status"
|
||||
other: "Milestone Statuses"
|
||||
comment:
|
||||
one: "Comment"
|
||||
other: "Comments"
|
||||
@@ -131,12 +131,12 @@ en:
|
||||
organization_name: "If you are proposing in the name of a collective/organization, or on behalf of more people, write its name"
|
||||
image: "Proposal descriptive image"
|
||||
image_title: "Image title"
|
||||
budget/investment/milestone:
|
||||
milestone:
|
||||
status_id: "Current investment status (optional)"
|
||||
title: "Title"
|
||||
description: "Description (optional if there's an status assigned)"
|
||||
publication_date: "Publication date"
|
||||
budget/investment/status:
|
||||
milestone/status:
|
||||
name: "Name"
|
||||
description: "Description (optional)"
|
||||
budget/heading:
|
||||
|
||||
@@ -286,24 +286,24 @@ en:
|
||||
notice: Milestone successfully deleted
|
||||
statuses:
|
||||
index:
|
||||
title: Investment statuses
|
||||
empty_statuses: There are no investment statuses created
|
||||
new_status: Create new investment status
|
||||
title: Milestone statuses
|
||||
empty_statuses: There are no milestone statuses created
|
||||
new_status: Create new milestone status
|
||||
table_name: Name
|
||||
table_description: Description
|
||||
table_actions: Actions
|
||||
delete: Delete
|
||||
edit: Edit
|
||||
edit:
|
||||
title: Edit investment status
|
||||
title: Edit milestone status
|
||||
update:
|
||||
notice: Investment status updated successfully
|
||||
notice: Milestone status updated successfully
|
||||
new:
|
||||
title: Create investment status
|
||||
title: Create milestone status
|
||||
create:
|
||||
notice: Investment status created successfully
|
||||
notice: Milestone status created successfully
|
||||
delete:
|
||||
notice: Investment status deleted successfully
|
||||
notice: Milestone status deleted successfully
|
||||
comments:
|
||||
index:
|
||||
filter: Filter
|
||||
|
||||
@@ -7,10 +7,10 @@ es-AR:
|
||||
budget/investment:
|
||||
one: "Proyecto de inversión"
|
||||
other: "Proyectos de inversión"
|
||||
budget/investment/milestone:
|
||||
milestone:
|
||||
one: "hito"
|
||||
other: "hitos"
|
||||
budget/investment/status:
|
||||
milestone/status:
|
||||
one: "Estado de Inversiones"
|
||||
other: "Estado de Inversiones"
|
||||
comment:
|
||||
@@ -113,12 +113,12 @@ es-AR:
|
||||
organization_name: "Si estás proponiendo en nombre de una organización o colectivo, o en nombre de más gente, escribe su nombre"
|
||||
image: "Imagen descriptiva de la propuesta de inversión"
|
||||
image_title: "Título de la imagen"
|
||||
budget/investment/milestone:
|
||||
milestone:
|
||||
status_id: "Estado de inversión actual ( opcional)"
|
||||
title: "Título"
|
||||
description: "Descripción (opcional si hay estado asignado)"
|
||||
publication_date: "Fecha de publicación"
|
||||
budget/investment/status:
|
||||
milestone/status:
|
||||
name: "Nombre"
|
||||
description: "Descripción (opcional)"
|
||||
budget/heading:
|
||||
|
||||
@@ -7,7 +7,7 @@ es-BO:
|
||||
budget/investment:
|
||||
one: "Proyecto de inversión"
|
||||
other: "Proyectos de inversión"
|
||||
budget/investment/milestone:
|
||||
milestone:
|
||||
one: "hito"
|
||||
other: "hitos"
|
||||
comment:
|
||||
@@ -104,7 +104,7 @@ es-BO:
|
||||
organization_name: "Si estás proponiendo en nombre de una organización o colectivo, o en nombre de más gente, escribe su nombre"
|
||||
image: "Imagen descriptiva de la propuesta de inversión"
|
||||
image_title: "Título de la imagen"
|
||||
budget/investment/milestone:
|
||||
milestone:
|
||||
title: "Título"
|
||||
publication_date: "Fecha de publicación"
|
||||
budget/heading:
|
||||
|
||||
@@ -10,10 +10,10 @@ es-CL:
|
||||
budget/investment:
|
||||
one: "Proyecto de inversión"
|
||||
other: "Proyectos de inversión"
|
||||
budget/investment/milestone:
|
||||
milestone:
|
||||
one: "hito"
|
||||
other: "hitos"
|
||||
budget/investment/status:
|
||||
milestone/status:
|
||||
one: "Estado de la inversión"
|
||||
other: "Estados de las inversiones"
|
||||
comment:
|
||||
@@ -128,12 +128,12 @@ es-CL:
|
||||
organization_name: "Si estás proponiendo en nombre de una organización o colectivo, o en nombre de más gente, escribe su nombre"
|
||||
image: "Imagen descriptiva de la propuesta de inversión"
|
||||
image_title: "Título de la imagen"
|
||||
budget/investment/milestone:
|
||||
milestone:
|
||||
status_id: "Estado actual de la inversión (opcional)"
|
||||
title: "Título"
|
||||
description: "Descripción (opcional si hay una condición asignada)"
|
||||
publication_date: "Fecha de publicación"
|
||||
budget/investment/status:
|
||||
milestone/status:
|
||||
name: "Nombre"
|
||||
description: "Descripción (opcional)"
|
||||
budget/heading:
|
||||
|
||||
@@ -7,7 +7,7 @@ es-CO:
|
||||
budget/investment:
|
||||
one: "Proyecto de inversión"
|
||||
other: "Proyectos de inversión"
|
||||
budget/investment/milestone:
|
||||
milestone:
|
||||
one: "hito"
|
||||
other: "hitos"
|
||||
comment:
|
||||
@@ -104,7 +104,7 @@ es-CO:
|
||||
organization_name: "Si estás proponiendo en nombre de una organización o colectivo, o en nombre de más gente, escribe su nombre"
|
||||
image: "Imagen descriptiva de la propuesta de inversión"
|
||||
image_title: "Título de la imagen"
|
||||
budget/investment/milestone:
|
||||
milestone:
|
||||
title: "Título"
|
||||
publication_date: "Fecha de publicación"
|
||||
budget/heading:
|
||||
|
||||
@@ -7,7 +7,7 @@ es-CR:
|
||||
budget/investment:
|
||||
one: "Proyecto de inversión"
|
||||
other: "Proyectos de inversión"
|
||||
budget/investment/milestone:
|
||||
milestone:
|
||||
one: "hito"
|
||||
other: "hitos"
|
||||
comment:
|
||||
@@ -104,7 +104,7 @@ es-CR:
|
||||
organization_name: "Si estás proponiendo en nombre de una organización o colectivo, o en nombre de más gente, escribe su nombre"
|
||||
image: "Imagen descriptiva de la propuesta de inversión"
|
||||
image_title: "Título de la imagen"
|
||||
budget/investment/milestone:
|
||||
milestone:
|
||||
title: "Título"
|
||||
publication_date: "Fecha de publicación"
|
||||
budget/heading:
|
||||
|
||||
@@ -7,7 +7,7 @@ es-DO:
|
||||
budget/investment:
|
||||
one: "Proyecto de inversión"
|
||||
other: "Proyectos de inversión"
|
||||
budget/investment/milestone:
|
||||
milestone:
|
||||
one: "hito"
|
||||
other: "hitos"
|
||||
comment:
|
||||
@@ -104,7 +104,7 @@ es-DO:
|
||||
organization_name: "Si estás proponiendo en nombre de una organización o colectivo, o en nombre de más gente, escribe su nombre"
|
||||
image: "Imagen descriptiva de la propuesta de inversión"
|
||||
image_title: "Título de la imagen"
|
||||
budget/investment/milestone:
|
||||
milestone:
|
||||
title: "Título"
|
||||
publication_date: "Fecha de publicación"
|
||||
budget/heading:
|
||||
|
||||
@@ -7,7 +7,7 @@ es-EC:
|
||||
budget/investment:
|
||||
one: "Proyecto de inversión"
|
||||
other: "Proyectos de inversión"
|
||||
budget/investment/milestone:
|
||||
milestone:
|
||||
one: "hito"
|
||||
other: "hitos"
|
||||
comment:
|
||||
@@ -104,7 +104,7 @@ es-EC:
|
||||
organization_name: "Si estás proponiendo en nombre de una organización o colectivo, o en nombre de más gente, escribe su nombre"
|
||||
image: "Imagen descriptiva de la propuesta de inversión"
|
||||
image_title: "Título de la imagen"
|
||||
budget/investment/milestone:
|
||||
milestone:
|
||||
title: "Título"
|
||||
publication_date: "Fecha de publicación"
|
||||
budget/heading:
|
||||
|
||||
@@ -7,7 +7,7 @@ es-GT:
|
||||
budget/investment:
|
||||
one: "Proyecto de inversión"
|
||||
other: "Proyectos de inversión"
|
||||
budget/investment/milestone:
|
||||
milestone:
|
||||
one: "hito"
|
||||
other: "hitos"
|
||||
comment:
|
||||
@@ -104,7 +104,7 @@ es-GT:
|
||||
organization_name: "Si estás proponiendo en nombre de una organización o colectivo, o en nombre de más gente, escribe su nombre"
|
||||
image: "Imagen descriptiva de la propuesta de inversión"
|
||||
image_title: "Título de la imagen"
|
||||
budget/investment/milestone:
|
||||
milestone:
|
||||
title: "Título"
|
||||
publication_date: "Fecha de publicación"
|
||||
budget/heading:
|
||||
|
||||
@@ -7,7 +7,7 @@ es-HN:
|
||||
budget/investment:
|
||||
one: "Proyecto de inversión"
|
||||
other: "Proyectos de inversión"
|
||||
budget/investment/milestone:
|
||||
milestone:
|
||||
one: "hito"
|
||||
other: "hitos"
|
||||
comment:
|
||||
@@ -104,7 +104,7 @@ es-HN:
|
||||
organization_name: "Si estás proponiendo en nombre de una organización o colectivo, o en nombre de más gente, escribe su nombre"
|
||||
image: "Imagen descriptiva de la propuesta de inversión"
|
||||
image_title: "Título de la imagen"
|
||||
budget/investment/milestone:
|
||||
milestone:
|
||||
title: "Título"
|
||||
publication_date: "Fecha de publicación"
|
||||
budget/heading:
|
||||
|
||||
@@ -10,10 +10,10 @@ es-MX:
|
||||
budget/investment:
|
||||
one: "Proyecto de inversión"
|
||||
other: "Proyectos de inversión"
|
||||
budget/investment/milestone:
|
||||
milestone:
|
||||
one: "hito"
|
||||
other: "hitos"
|
||||
budget/investment/status:
|
||||
milestone/status:
|
||||
one: "Estado de inversión"
|
||||
other: "Estados de inversión"
|
||||
comment:
|
||||
@@ -128,11 +128,11 @@ es-MX:
|
||||
organization_name: "Si estás proponiendo en nombre de una organización o colectivo, o en nombre de más gente, escribe su nombre"
|
||||
image: "Imagen descriptiva de la propuesta de inversión"
|
||||
image_title: "Título de la imagen"
|
||||
budget/investment/milestone:
|
||||
milestone:
|
||||
title: "Título"
|
||||
description: "Descripción (opcional si cuenta con un estado asignado)"
|
||||
publication_date: "Fecha de publicación"
|
||||
budget/investment/status:
|
||||
milestone/status:
|
||||
name: "Nombre"
|
||||
description: "Descripción (opcional)"
|
||||
budget/heading:
|
||||
|
||||
@@ -7,7 +7,7 @@ es-NI:
|
||||
budget/investment:
|
||||
one: "Proyecto de inversión"
|
||||
other: "Proyectos de inversión"
|
||||
budget/investment/milestone:
|
||||
milestone:
|
||||
one: "hito"
|
||||
other: "hitos"
|
||||
comment:
|
||||
@@ -104,7 +104,7 @@ es-NI:
|
||||
organization_name: "Si estás proponiendo en nombre de una organización o colectivo, o en nombre de más gente, escribe su nombre"
|
||||
image: "Imagen descriptiva de la propuesta de inversión"
|
||||
image_title: "Título de la imagen"
|
||||
budget/investment/milestone:
|
||||
milestone:
|
||||
title: "Título"
|
||||
publication_date: "Fecha de publicación"
|
||||
budget/heading:
|
||||
|
||||
@@ -7,7 +7,7 @@ es-PA:
|
||||
budget/investment:
|
||||
one: "Proyecto de inversión"
|
||||
other: "Proyectos de inversión"
|
||||
budget/investment/milestone:
|
||||
milestone:
|
||||
one: "hito"
|
||||
other: "hitos"
|
||||
comment:
|
||||
@@ -104,7 +104,7 @@ es-PA:
|
||||
organization_name: "Si estás proponiendo en nombre de una organización o colectivo, o en nombre de más gente, escribe su nombre"
|
||||
image: "Imagen descriptiva de la propuesta de inversión"
|
||||
image_title: "Título de la imagen"
|
||||
budget/investment/milestone:
|
||||
milestone:
|
||||
title: "Título"
|
||||
publication_date: "Fecha de publicación"
|
||||
budget/heading:
|
||||
|
||||
@@ -7,7 +7,7 @@ es-PE:
|
||||
budget/investment:
|
||||
one: "Proyecto de inversión"
|
||||
other: "Proyectos de inversión"
|
||||
budget/investment/milestone:
|
||||
milestone:
|
||||
one: "hito"
|
||||
other: "hitos"
|
||||
comment:
|
||||
@@ -104,7 +104,7 @@ es-PE:
|
||||
organization_name: "Si estás proponiendo en nombre de una organización o colectivo, o en nombre de más gente, escribe su nombre"
|
||||
image: "Imagen descriptiva de la propuesta de inversión"
|
||||
image_title: "Título de la imagen"
|
||||
budget/investment/milestone:
|
||||
milestone:
|
||||
title: "Título"
|
||||
publication_date: "Fecha de publicación"
|
||||
budget/heading:
|
||||
|
||||
@@ -7,7 +7,7 @@ es-PR:
|
||||
budget/investment:
|
||||
one: "Proyecto de inversión"
|
||||
other: "Proyectos de inversión"
|
||||
budget/investment/milestone:
|
||||
milestone:
|
||||
one: "hito"
|
||||
other: "hitos"
|
||||
comment:
|
||||
@@ -104,7 +104,7 @@ es-PR:
|
||||
organization_name: "Si estás proponiendo en nombre de una organización o colectivo, o en nombre de más gente, escribe su nombre"
|
||||
image: "Imagen descriptiva de la propuesta de inversión"
|
||||
image_title: "Título de la imagen"
|
||||
budget/investment/milestone:
|
||||
milestone:
|
||||
title: "Título"
|
||||
publication_date: "Fecha de publicación"
|
||||
budget/heading:
|
||||
|
||||
@@ -7,7 +7,7 @@ es-PY:
|
||||
budget/investment:
|
||||
one: "Proyecto de inversión"
|
||||
other: "Proyectos de inversión"
|
||||
budget/investment/milestone:
|
||||
milestone:
|
||||
one: "hito"
|
||||
other: "hitos"
|
||||
comment:
|
||||
@@ -104,7 +104,7 @@ es-PY:
|
||||
organization_name: "Si estás proponiendo en nombre de una organización o colectivo, o en nombre de más gente, escribe su nombre"
|
||||
image: "Imagen descriptiva de la propuesta de inversión"
|
||||
image_title: "Título de la imagen"
|
||||
budget/investment/milestone:
|
||||
milestone:
|
||||
title: "Título"
|
||||
publication_date: "Fecha de publicación"
|
||||
budget/heading:
|
||||
|
||||
@@ -7,7 +7,7 @@ es-SV:
|
||||
budget/investment:
|
||||
one: "Proyecto de inversión"
|
||||
other: "Proyectos de inversión"
|
||||
budget/investment/milestone:
|
||||
milestone:
|
||||
one: "hito"
|
||||
other: "hitos"
|
||||
comment:
|
||||
@@ -104,7 +104,7 @@ es-SV:
|
||||
organization_name: "Si estás proponiendo en nombre de una organización o colectivo, o en nombre de más gente, escribe su nombre"
|
||||
image: "Imagen descriptiva de la propuesta de inversión"
|
||||
image_title: "Título de la imagen"
|
||||
budget/investment/milestone:
|
||||
milestone:
|
||||
title: "Título"
|
||||
publication_date: "Fecha de publicación"
|
||||
budget/heading:
|
||||
|
||||
@@ -7,7 +7,7 @@ es-UY:
|
||||
budget/investment:
|
||||
one: "Proyecto de inversión"
|
||||
other: "Proyectos de inversión"
|
||||
budget/investment/milestone:
|
||||
milestone:
|
||||
one: "hito"
|
||||
other: "hitos"
|
||||
comment:
|
||||
@@ -104,7 +104,7 @@ es-UY:
|
||||
organization_name: "Si estás proponiendo en nombre de una organización o colectivo, o en nombre de más gente, escribe su nombre"
|
||||
image: "Imagen descriptiva de la propuesta de inversión"
|
||||
image_title: "Título de la imagen"
|
||||
budget/investment/milestone:
|
||||
milestone:
|
||||
title: "Título"
|
||||
publication_date: "Fecha de publicación"
|
||||
budget/heading:
|
||||
|
||||
@@ -7,7 +7,7 @@ es-VE:
|
||||
budget/investment:
|
||||
one: "Proyecto de inversión"
|
||||
other: "Proyectos de inversión"
|
||||
budget/investment/milestone:
|
||||
milestone:
|
||||
one: "hito"
|
||||
other: "hitos"
|
||||
comment:
|
||||
@@ -104,7 +104,7 @@ es-VE:
|
||||
organization_name: "Si estás proponiendo en nombre de una organización o colectivo, o en nombre de más gente, escribe su nombre"
|
||||
image: "Imagen descriptiva de la propuesta de inversión"
|
||||
image_title: "Título de la imagen"
|
||||
budget/investment/milestone:
|
||||
milestone:
|
||||
title: "Título"
|
||||
publication_date: "Fecha de publicación"
|
||||
budget/heading:
|
||||
|
||||
@@ -10,12 +10,12 @@ es:
|
||||
budget/investment:
|
||||
one: "Proyecto de gasto"
|
||||
other: "Proyectos de gasto"
|
||||
budget/investment/milestone:
|
||||
milestone:
|
||||
one: "hito"
|
||||
other: "hitos"
|
||||
budget/investment/status:
|
||||
one: "Estado del proyecto"
|
||||
other: "Estados del proyecto"
|
||||
milestone/status:
|
||||
one: "Estado de seguimiento"
|
||||
other: "Estados de seguimiento"
|
||||
comment:
|
||||
one: "Comentario"
|
||||
other: "Comentarios"
|
||||
@@ -131,12 +131,12 @@ es:
|
||||
organization_name: "Si estás proponiendo en nombre de una organización o colectivo, o en nombre de más gente, escribe su nombre"
|
||||
image: "Imagen descriptiva del proyecto de gasto"
|
||||
image_title: "Título de la imagen"
|
||||
budget/investment/milestone:
|
||||
milestone:
|
||||
status_id: "Estado actual del proyecto (opcional)"
|
||||
title: "Título"
|
||||
description: "Descripción (opcional si hay un estado asignado)"
|
||||
publication_date: "Fecha de publicación"
|
||||
budget/investment/status:
|
||||
milestone/status:
|
||||
name: "Nombre"
|
||||
description: "Descripción (opcional)"
|
||||
budget/heading:
|
||||
|
||||
@@ -286,24 +286,24 @@ es:
|
||||
notice: Hito borrado correctamente
|
||||
statuses:
|
||||
index:
|
||||
title: Estados de proyectos
|
||||
empty_statuses: Aún no se ha creado ningún estado de proyecto
|
||||
new_status: Crear nuevo estado de proyecto
|
||||
title: Estados de seguimiento
|
||||
empty_statuses: Aún no se ha creado ningún estado de seguimiento
|
||||
new_status: Crear nuevo estado de seguimiento
|
||||
table_name: Nombre
|
||||
table_description: Descripción
|
||||
table_actions: Acciones
|
||||
delete: Borrar
|
||||
edit: Editar
|
||||
edit:
|
||||
title: Editar estado de proyecto
|
||||
title: Editar estado de seguimiento
|
||||
update:
|
||||
notice: Estado de proyecto editado correctamente
|
||||
notice: Estado de seguimiento editado correctamente
|
||||
new:
|
||||
title: Crear estado de proyecto
|
||||
title: Crear estado de seguimiento
|
||||
create:
|
||||
notice: Estado de proyecto creado correctamente
|
||||
notice: Estado de seguimiento creado correctamente
|
||||
delete:
|
||||
notice: Estado de proyecto eliminado correctamente
|
||||
notice: Estado de seguimiento eliminado correctamente
|
||||
comments:
|
||||
index:
|
||||
filter: Filtro
|
||||
|
||||
@@ -10,7 +10,7 @@ fa:
|
||||
budget/investment:
|
||||
one: "سرمایه گذاری"
|
||||
other: "سرمایه گذاری ها"
|
||||
budget/investment/milestone:
|
||||
milestone:
|
||||
one: "نقطه عطف"
|
||||
other: "نقاط عطف"
|
||||
comment:
|
||||
@@ -119,7 +119,7 @@ fa:
|
||||
organization_name: "اگر شما به نام یک گروه / سازمان، یا از طرف افراد بیشتری پیشنهاد می کنید، نام آنها را بنویسید."
|
||||
image: "تصویر طرح توصیفی"
|
||||
image_title: "عنوان تصویر"
|
||||
budget/investment/milestone:
|
||||
milestone:
|
||||
title: "عنوان"
|
||||
publication_date: "تاریخ انتشار"
|
||||
budget/heading:
|
||||
|
||||
@@ -10,10 +10,10 @@ fr:
|
||||
budget/investment:
|
||||
one: "Projet d'investissement"
|
||||
other: "Projets d'investissement"
|
||||
budget/investment/milestone:
|
||||
milestone:
|
||||
one: "jalon"
|
||||
other: "jalons"
|
||||
budget/investment/status:
|
||||
milestone/status:
|
||||
one: "Statut d’investissement"
|
||||
other: "Statuts d’investissement"
|
||||
comment:
|
||||
@@ -128,12 +128,12 @@ fr:
|
||||
organization_name: "Si votre proposition se fait au nom d'un collectif ou d'une organisation, renseignez leur nom"
|
||||
image: "Image descriptive de la proposition"
|
||||
image_title: "Titre de l'image"
|
||||
budget/investment/milestone:
|
||||
milestone:
|
||||
status_id: "Statut actuel de l'investissement (facultatif)"
|
||||
title: "Titre"
|
||||
description: "Description (facultative si un statut est affecté)"
|
||||
publication_date: "Date de publication"
|
||||
budget/investment/status:
|
||||
milestone/status:
|
||||
name: "Nom"
|
||||
description: "Description (facultative)"
|
||||
budget/heading:
|
||||
|
||||
@@ -10,10 +10,10 @@ gl:
|
||||
budget/investment:
|
||||
one: "Investimento"
|
||||
other: "Investimentos"
|
||||
budget/investment/milestone:
|
||||
milestone:
|
||||
one: "fito"
|
||||
other: "fitos"
|
||||
budget/investment/status:
|
||||
milestone/status:
|
||||
one: "Estado do investimento"
|
||||
other: "Estado dos investimentos"
|
||||
comment:
|
||||
@@ -131,12 +131,12 @@ gl:
|
||||
organization_name: "Se estás a propor no nome dunha organización, dun colectivo ou de mais xente, escribe o seu nome"
|
||||
image: "Imaxe descritiva da proposta"
|
||||
image_title: "Título da imaxe"
|
||||
budget/investment/milestone:
|
||||
milestone:
|
||||
status_id: "Estado do investimento actual (opcional)"
|
||||
title: "Título"
|
||||
description: "Descrición (opcional se hai unha condición asignada)"
|
||||
publication_date: "Data de publicación"
|
||||
budget/investment/status:
|
||||
milestone/status:
|
||||
name: "Nome"
|
||||
description: "Descrición (opcional)"
|
||||
budget/heading:
|
||||
|
||||
@@ -7,7 +7,7 @@ id:
|
||||
other: "Anggaran"
|
||||
budget/investment:
|
||||
other: "Investasi"
|
||||
budget/investment/milestone:
|
||||
milestone:
|
||||
other: "batu peringatan"
|
||||
comment:
|
||||
other: "Komentar"
|
||||
@@ -81,7 +81,7 @@ id:
|
||||
organization_name: "Jika Anda usulkan dalam nama kolektif/organisasi, atau atas nama orang lain, menulis namanya"
|
||||
image: "Gambar deskriptif proposal"
|
||||
image_title: "Judul gambar"
|
||||
budget/investment/milestone:
|
||||
milestone:
|
||||
title: "Judul"
|
||||
publication_date: "Tanggal publikasi"
|
||||
budget/heading:
|
||||
|
||||
@@ -10,10 +10,10 @@ it:
|
||||
budget/investment:
|
||||
one: "Investimento"
|
||||
other: "Investimenti"
|
||||
budget/investment/milestone:
|
||||
milestone:
|
||||
one: "traguardo"
|
||||
other: "traguardi"
|
||||
budget/investment/status:
|
||||
milestone/status:
|
||||
one: "Status dell’investimento"
|
||||
other: "Status dell’investimento"
|
||||
comment:
|
||||
@@ -128,12 +128,12 @@ it:
|
||||
organization_name: "Se presenti una proposta a nome di un collettivo o di un’organizzazione, ovvero per conto di più persone, indicane il nome"
|
||||
image: "Immagine descrittiva della proposta"
|
||||
image_title: "Titolo dell’immagine"
|
||||
budget/investment/milestone:
|
||||
milestone:
|
||||
status_id: "Stato attuale dell’investimento (facoltativo)"
|
||||
title: "Titolo"
|
||||
description: "Descrizione (facoltativa se c’è gia uno stato assegnato)"
|
||||
publication_date: "Data di pubblicazione"
|
||||
budget/investment/status:
|
||||
milestone/status:
|
||||
name: "Nome"
|
||||
description: "Descrizione (facoltativa)"
|
||||
budget/heading:
|
||||
|
||||
@@ -10,7 +10,7 @@ nl:
|
||||
budget/investment:
|
||||
one: "Investerning"
|
||||
other: "Investeringen"
|
||||
budget/investment/milestone:
|
||||
milestone:
|
||||
one: "mijlpaal"
|
||||
other: "mijlpalen"
|
||||
comment:
|
||||
@@ -122,12 +122,12 @@ nl:
|
||||
organization_name: "Als je een voorstel doet uit naam van een collectief/organisatie, voer dan hier de naam in"
|
||||
image: "Afbeelding ter omschrijving van het voorstel"
|
||||
image_title: "Naam van de afbeelding"
|
||||
budget/investment/milestone:
|
||||
milestone:
|
||||
status_id: "Huidige investeringsstatus (optioneel)"
|
||||
title: "Titel"
|
||||
description: "Omschrijving"
|
||||
publication_date: "Publicatiedatum"
|
||||
budget/investment/status:
|
||||
milestone/status:
|
||||
name: "Naam"
|
||||
description: "Beschrijving (optioneel)"
|
||||
budget/heading:
|
||||
|
||||
@@ -6,12 +6,12 @@ pl:
|
||||
few: "Inwestycje"
|
||||
many: "Inwestycji"
|
||||
other: "Inwestycji"
|
||||
budget/investment/milestone:
|
||||
milestone:
|
||||
one: "kamień milowy"
|
||||
few: "kamienie milowe"
|
||||
many: "kamieni milowych"
|
||||
other: "kamieni milowych"
|
||||
budget/investment/status:
|
||||
milestone/status:
|
||||
one: "Etap inwestycji"
|
||||
few: "Etapy inwestycji"
|
||||
many: "Etapów inwestycji"
|
||||
@@ -158,12 +158,12 @@ pl:
|
||||
organization_name: "Jeśli wnioskujesz w imieniu zespołu/organizacji, lub w imieniu większej liczby osób, wpisz ich nazwę"
|
||||
image: "Opisowy obraz wniosku"
|
||||
image_title: "Tytuł obrazu"
|
||||
budget/investment/milestone:
|
||||
milestone:
|
||||
status_id: "Bieżący stan inwestycji (opcjonalnie)"
|
||||
title: "Tytuł"
|
||||
description: "Opis (opcjonalnie, jeśli istnieje przydzielony stan)"
|
||||
publication_date: "Data publikacji"
|
||||
budget/investment/status:
|
||||
milestone/status:
|
||||
name: "Nazwa"
|
||||
description: "Opis (opcjonalnie)"
|
||||
budget/heading:
|
||||
|
||||
@@ -10,10 +10,10 @@ pt-BR:
|
||||
budget/investment:
|
||||
one: "Investimento"
|
||||
other: "Investimentos"
|
||||
budget/investment/milestone:
|
||||
milestone:
|
||||
one: "Marco"
|
||||
other: "Marcos"
|
||||
budget/investment/status:
|
||||
milestone/status:
|
||||
one: "Status de investimento"
|
||||
other: "Status dos investimentos"
|
||||
comment:
|
||||
@@ -128,12 +128,12 @@ pt-BR:
|
||||
organization_name: "Se você está propondo em nome de um coletivo / organização, ou em nome de mais pessoas, escreva seu nome"
|
||||
image: "Imagem descritiva da proposta"
|
||||
image_title: "Título da imagem"
|
||||
budget/investment/milestone:
|
||||
milestone:
|
||||
status_id: "Status atual do investimento (opcional)"
|
||||
title: "Título"
|
||||
description: "Descrição (opcional, se houver uma condição atribuída)"
|
||||
publication_date: "Data de publicação"
|
||||
budget/investment/status:
|
||||
milestone/status:
|
||||
name: "Nome"
|
||||
description: "Descrição (opcional)"
|
||||
budget/heading:
|
||||
|
||||
@@ -22,12 +22,12 @@ ru:
|
||||
organization_name: "Если вы делаете предложение от имени коллектива/организации или от имени большего числа людей, напишите его название"
|
||||
image: "Иллюстративное изображение предложения"
|
||||
image_title: "Название изображения"
|
||||
budget/investment/milestone:
|
||||
milestone:
|
||||
status_id: "Текущий инвестиционный статус (опционально)"
|
||||
title: "Название"
|
||||
description: "Описание (опционально, если присвоен статус)"
|
||||
publication_date: "Дата публикации"
|
||||
budget/investment/status:
|
||||
milestone/status:
|
||||
name: "Имя"
|
||||
description: "Описание (опционально)"
|
||||
budget/heading:
|
||||
|
||||
@@ -10,10 +10,10 @@ sq:
|
||||
budget/investment:
|
||||
one: "Investim"
|
||||
other: "Investim"
|
||||
budget/investment/milestone:
|
||||
milestone:
|
||||
one: "moment historik"
|
||||
other: "milestone"
|
||||
budget/investment/status:
|
||||
milestone/status:
|
||||
one: "Statusi investimeve"
|
||||
other: "Statusi investimeve"
|
||||
comment:
|
||||
@@ -128,12 +128,12 @@ sq:
|
||||
organization_name: "Nëse propozoni në emër të një kolektivi / organizate, ose në emër të më shumë njerëzve, shkruani emrin e tij"
|
||||
image: "Imazhi përshkrues i propozimit"
|
||||
image_title: "Titulli i imazhit"
|
||||
budget/investment/milestone:
|
||||
milestone:
|
||||
status_id: "Statusi aktual i investimit (opsional)"
|
||||
title: "Titull"
|
||||
description: "Përshkrimi (opsional nëse ka status të caktuar)"
|
||||
publication_date: "Data e publikimit"
|
||||
budget/investment/status:
|
||||
milestone/status:
|
||||
name: "Emri"
|
||||
description: "Përshkrimi (opsional)"
|
||||
budget/heading:
|
||||
|
||||
@@ -10,10 +10,10 @@ sv:
|
||||
budget/investment:
|
||||
one: "Budgetförslag"
|
||||
other: "Budgetförslag"
|
||||
budget/investment/milestone:
|
||||
milestone:
|
||||
one: "milstolpe"
|
||||
other: "milstolpar"
|
||||
budget/investment/status:
|
||||
milestone/status:
|
||||
one: "Budgetförslagets status"
|
||||
other: "Budgetförslagens status"
|
||||
comment:
|
||||
@@ -128,12 +128,12 @@ sv:
|
||||
organization_name: "Organisation eller grupp i vars namn du lämnar förslaget"
|
||||
image: "Förklarande bild till förslaget"
|
||||
image_title: "Bildtext"
|
||||
budget/investment/milestone:
|
||||
milestone:
|
||||
status_id: "Nuvarande status för budgetförslag (frivilligt fält)"
|
||||
title: "Titel"
|
||||
description: "Beskrivning (frivilligt fält om projektets status har ställts in)"
|
||||
publication_date: "Publiceringsdatum"
|
||||
budget/investment/status:
|
||||
milestone/status:
|
||||
name: "Namn"
|
||||
description: "Beskrivning (frivilligt fält)"
|
||||
budget/heading:
|
||||
|
||||
@@ -10,7 +10,7 @@ tr:
|
||||
budget/investment:
|
||||
one: "yatırım"
|
||||
other: "Yatırımlar"
|
||||
budget/investment/milestone:
|
||||
milestone:
|
||||
one: "kilometre taşı"
|
||||
other: "kilometre taşları"
|
||||
comment:
|
||||
|
||||
@@ -10,10 +10,10 @@ val:
|
||||
budget/investment:
|
||||
one: "Proposta d'inversió"
|
||||
other: "Propostes d'inversió"
|
||||
budget/investment/milestone:
|
||||
milestone:
|
||||
one: "fita"
|
||||
other: "fites"
|
||||
budget/investment/status:
|
||||
milestone/status:
|
||||
one: "Estat de la proposta"
|
||||
other: "Estat de les propostes"
|
||||
comment:
|
||||
@@ -131,12 +131,12 @@ val:
|
||||
organization_name: "Si estàs proposant en nom d'una associació o col·lectiu, escriu el seu nom"
|
||||
image: "Imatge descriptiva de la proposta d'inversió"
|
||||
image_title: "Títol de la imatge"
|
||||
budget/investment/milestone:
|
||||
milestone:
|
||||
status_id: "Estat actual de la proposta (opcional)"
|
||||
title: "Títol"
|
||||
description: "Descripció (opcional si hi ha un estat asignat)"
|
||||
publication_date: "Data de publicació"
|
||||
budget/investment/status:
|
||||
milestone/status:
|
||||
name: "Nom"
|
||||
description: "Descripció (opcional)"
|
||||
budget/heading:
|
||||
|
||||
@@ -7,9 +7,9 @@ zh-CN:
|
||||
other: "预算"
|
||||
budget/investment:
|
||||
other: "投资"
|
||||
budget/investment/milestone:
|
||||
milestone:
|
||||
other: "里程碑"
|
||||
budget/investment/status:
|
||||
milestone/status:
|
||||
other: "投资状态"
|
||||
comment:
|
||||
other: "意见"
|
||||
@@ -93,12 +93,12 @@ zh-CN:
|
||||
organization_name: "如果你是以集体/组织的名义或者代表更多的人提出建议,写下它的名字。"
|
||||
image: "建议说明性图像"
|
||||
image_title: "图像标题"
|
||||
budget/investment/milestone:
|
||||
milestone:
|
||||
status_id: "当前投资状况(可选)"
|
||||
title: "标题"
|
||||
description: "说明(如果指定了状态,则可选)"
|
||||
publication_date: "出版日期"
|
||||
budget/investment/status:
|
||||
milestone/status:
|
||||
name: "名字"
|
||||
description: "说明(可选)"
|
||||
budget/heading:
|
||||
|
||||
@@ -7,9 +7,9 @@ zh-TW:
|
||||
other: "預算"
|
||||
budget/investment:
|
||||
other: "投資"
|
||||
budget/investment/milestone:
|
||||
milestone:
|
||||
other: "里程碑"
|
||||
budget/investment/status:
|
||||
milestone/status:
|
||||
other: "投資狀態"
|
||||
comment:
|
||||
other: "評論"
|
||||
@@ -93,12 +93,12 @@ zh-TW:
|
||||
organization_name: "如果您以集體/組織的名義,或代表多人提出建議,請寫下其名稱"
|
||||
image: "建議說明性圖像"
|
||||
image_title: "圖像標題"
|
||||
budget/investment/milestone:
|
||||
milestone:
|
||||
status_id: "當前投資狀況 (可選擇填寫)"
|
||||
title: "標題"
|
||||
description: "說明 (如果已經指定了狀態, 則可選擇填寫)"
|
||||
publication_date: "出版日期"
|
||||
budget/investment/status:
|
||||
milestone/status:
|
||||
name: "名字"
|
||||
description: "說明 (可選擇填寫)"
|
||||
budget/heading:
|
||||
|
||||
@@ -62,14 +62,14 @@ namespace :admin do
|
||||
end
|
||||
|
||||
resources :budget_investments, only: [:index, :show, :edit, :update] do
|
||||
resources :budget_investment_milestones
|
||||
resources :milestones, controller: 'budget_investment_milestones'
|
||||
member { patch :toggle_selection }
|
||||
end
|
||||
|
||||
resources :budget_phases, only: [:edit, :update]
|
||||
end
|
||||
|
||||
resources :budget_investment_statuses, only: [:index, :new, :create, :update, :edit, :destroy]
|
||||
resources :milestone_statuses, only: [:index, :new, :create, :update, :edit, :destroy]
|
||||
|
||||
resources :signature_sheets, only: [:index, :new, :create, :show]
|
||||
|
||||
|
||||
@@ -139,16 +139,16 @@ section "Creating Valuation Assignments" do
|
||||
end
|
||||
end
|
||||
|
||||
section "Creating default Investment Milestone Statuses" do
|
||||
Budget::Investment::Status.create(name: I18n.t('seeds.budgets.statuses.studying_project'))
|
||||
Budget::Investment::Status.create(name: I18n.t('seeds.budgets.statuses.bidding'))
|
||||
Budget::Investment::Status.create(name: I18n.t('seeds.budgets.statuses.executing_project'))
|
||||
Budget::Investment::Status.create(name: I18n.t('seeds.budgets.statuses.executed'))
|
||||
section "Creating default Milestone Statuses" do
|
||||
Milestone::Status.create(name: I18n.t('seeds.budgets.statuses.studying_project'))
|
||||
Milestone::Status.create(name: I18n.t('seeds.budgets.statuses.bidding'))
|
||||
Milestone::Status.create(name: I18n.t('seeds.budgets.statuses.executing_project'))
|
||||
Milestone::Status.create(name: I18n.t('seeds.budgets.statuses.executed'))
|
||||
end
|
||||
|
||||
section "Creating investment milestones" do
|
||||
Budget::Investment.find_each do |investment|
|
||||
milestone = Budget::Investment::Milestone.new(investment_id: investment.id, publication_date: Date.tomorrow)
|
||||
milestone = investment.milestones.build(publication_date: Date.tomorrow, status_id: Milestone::Status.all.sample)
|
||||
I18n.available_locales.map do |locale|
|
||||
Globalize.with_locale(locale) do
|
||||
milestone.description = "Description for locale #{locale}"
|
||||
|
||||
@@ -1,15 +1,12 @@
|
||||
class AddTranslateMilestones < ActiveRecord::Migration
|
||||
def self.up
|
||||
Budget::Investment::Milestone.create_translation_table!(
|
||||
{
|
||||
title: :string,
|
||||
description: :text
|
||||
},
|
||||
{ migrate_data: true }
|
||||
)
|
||||
end
|
||||
def change
|
||||
create_table :budget_investment_milestone_translations do |t|
|
||||
t.integer :budget_investment_milestone_id, null: false
|
||||
t.string :locale, null: false
|
||||
t.string :title
|
||||
t.text :description
|
||||
|
||||
def self.down
|
||||
Budget::Investment::Milestone.drop_translation_table!
|
||||
t.timestamps null: false
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
@@ -0,0 +1,12 @@
|
||||
class ChangeBudgetInvestmentStatusesToMilestoneStatuses < ActiveRecord::Migration
|
||||
def change
|
||||
create_table :milestone_statuses do |t|
|
||||
t.string :name
|
||||
t.text :description
|
||||
t.datetime :hidden_at, index: true
|
||||
|
||||
t.timestamps null: false
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
@@ -0,0 +1,27 @@
|
||||
class MakeInvestmentMilestonesPolymorphic < ActiveRecord::Migration
|
||||
def change
|
||||
create_table :milestones do |t|
|
||||
t.references :milestoneable, polymorphic: true
|
||||
t.string "title", limit: 80
|
||||
t.text "description"
|
||||
t.datetime "publication_date"
|
||||
|
||||
t.references :status, index: true
|
||||
|
||||
t.timestamps null: false
|
||||
end
|
||||
|
||||
reversible do |change|
|
||||
change.up do
|
||||
Milestone.create_translation_table!({
|
||||
title: :string,
|
||||
description: :text
|
||||
})
|
||||
end
|
||||
|
||||
change.down do
|
||||
Milestone.drop_translation_table!
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
42
db/schema.rb
42
db/schema.rb
@@ -163,15 +163,12 @@ ActiveRecord::Schema.define(version: 20181016204729) do
|
||||
create_table "budget_investment_milestone_translations", force: :cascade do |t|
|
||||
t.integer "budget_investment_milestone_id", null: false
|
||||
t.string "locale", null: false
|
||||
t.datetime "created_at", null: false
|
||||
t.datetime "updated_at", null: false
|
||||
t.string "title"
|
||||
t.text "description"
|
||||
t.datetime "created_at", null: false
|
||||
t.datetime "updated_at", null: false
|
||||
end
|
||||
|
||||
add_index "budget_investment_milestone_translations", ["budget_investment_milestone_id"], name: "index_6770e7675fe296cf87aa0fd90492c141b5269e0b", using: :btree
|
||||
add_index "budget_investment_milestone_translations", ["locale"], name: "index_budget_investment_milestone_translations_on_locale", using: :btree
|
||||
|
||||
create_table "budget_investment_milestones", force: :cascade do |t|
|
||||
t.integer "investment_id"
|
||||
t.string "title", limit: 80
|
||||
@@ -781,6 +778,41 @@ ActiveRecord::Schema.define(version: 20181016204729) do
|
||||
add_index "map_locations", ["investment_id"], name: "index_map_locations_on_investment_id", using: :btree
|
||||
add_index "map_locations", ["proposal_id"], name: "index_map_locations_on_proposal_id", using: :btree
|
||||
|
||||
create_table "milestone_statuses", force: :cascade do |t|
|
||||
t.string "name"
|
||||
t.text "description"
|
||||
t.datetime "hidden_at"
|
||||
t.datetime "created_at", null: false
|
||||
t.datetime "updated_at", null: false
|
||||
end
|
||||
|
||||
add_index "milestone_statuses", ["hidden_at"], name: "index_milestone_statuses_on_hidden_at", using: :btree
|
||||
|
||||
create_table "milestone_translations", force: :cascade do |t|
|
||||
t.integer "milestone_id", null: false
|
||||
t.string "locale", null: false
|
||||
t.datetime "created_at", null: false
|
||||
t.datetime "updated_at", null: false
|
||||
t.string "title"
|
||||
t.text "description"
|
||||
end
|
||||
|
||||
add_index "milestone_translations", ["locale"], name: "index_milestone_translations_on_locale", using: :btree
|
||||
add_index "milestone_translations", ["milestone_id"], name: "index_milestone_translations_on_milestone_id", using: :btree
|
||||
|
||||
create_table "milestones", force: :cascade do |t|
|
||||
t.integer "milestoneable_id"
|
||||
t.string "milestoneable_type"
|
||||
t.string "title", limit: 80
|
||||
t.text "description"
|
||||
t.datetime "publication_date"
|
||||
t.integer "status_id"
|
||||
t.datetime "created_at", null: false
|
||||
t.datetime "updated_at", null: false
|
||||
end
|
||||
|
||||
add_index "milestones", ["status_id"], name: "index_milestones_on_status_id", using: :btree
|
||||
|
||||
create_table "moderators", force: :cascade do |t|
|
||||
t.integer "user_id"
|
||||
end
|
||||
|
||||
@@ -3,7 +3,7 @@ namespace :globalize do
|
||||
[
|
||||
AdminNotification,
|
||||
Banner,
|
||||
Budget::Investment::Milestone,
|
||||
Milestone,
|
||||
I18nContent,
|
||||
Legislation::DraftVersion,
|
||||
Legislation::Process,
|
||||
|
||||
106
lib/tasks/migrate_milestones_and_statuses.rake
Normal file
106
lib/tasks/migrate_milestones_and_statuses.rake
Normal file
@@ -0,0 +1,106 @@
|
||||
namespace :milestones do
|
||||
|
||||
def generate_table_migration_sql(new_table:, old_table:, columns:)
|
||||
from_cols = ['id', *columns.keys]
|
||||
to_cols = ['id', *columns.values]
|
||||
<<~SQL
|
||||
INSERT INTO #{new_table} (#{to_cols.join(', ')})
|
||||
SELECT #{from_cols.join(', ')} FROM #{old_table};
|
||||
SQL
|
||||
end
|
||||
|
||||
def migrate_table!(new_table:, old_table:, columns:)
|
||||
puts "Migrating data from '#{old_table}' to '#{new_table}'..."
|
||||
result = ActiveRecord::Base.connection.execute(
|
||||
generate_table_migration_sql(old_table: old_table,
|
||||
new_table: new_table,
|
||||
columns: columns)
|
||||
|
||||
)
|
||||
puts "#{result.cmd_tuples} rows affected"
|
||||
end
|
||||
|
||||
def populate_column!(table:, column:, value:)
|
||||
puts "Populating column '#{column}' from table '#{table}' with '#{value}'..."
|
||||
result = ActiveRecord::Base.connection.execute(
|
||||
"UPDATE #{table} SET #{column} = '#{value}';"
|
||||
)
|
||||
puts "#{result.cmd_tuples} rows affected"
|
||||
end
|
||||
|
||||
def count_rows(table)
|
||||
ActiveRecord::Base.connection.query("SELECT COUNT(*) FROM #{table};")[0][0].to_i
|
||||
end
|
||||
|
||||
desc "Migrate milestones and milestone status data after making the model polymorphic"
|
||||
task migrate: :environment do
|
||||
# This script copies all milestone-related data from the old tables to
|
||||
# the new ones (preserving all primary keys). All 3 of the new tables
|
||||
# must be empty.
|
||||
#
|
||||
# To clear the new tables to test this script:
|
||||
#
|
||||
# DELETE FROM milestone_statuses;
|
||||
# DELETE FROM milestones;
|
||||
# DELETE FROM milestone_translations;
|
||||
#
|
||||
|
||||
start = Time.now
|
||||
|
||||
ActiveRecord::Base.transaction do
|
||||
migrate_table! old_table: 'budget_investment_statuses',
|
||||
new_table: 'milestone_statuses',
|
||||
columns: {'name' => 'name',
|
||||
'description' => 'description',
|
||||
'hidden_at' => 'hidden_at',
|
||||
'created_at' => 'created_at',
|
||||
'updated_at' => 'updated_at'}
|
||||
|
||||
migrate_table! old_table: 'budget_investment_milestones',
|
||||
new_table: 'milestones',
|
||||
columns: {'investment_id' => 'milestoneable_id',
|
||||
'title' => 'title',
|
||||
'description' => 'description',
|
||||
'created_at' => 'created_at',
|
||||
'updated_at' => 'updated_at',
|
||||
'publication_date' => 'publication_date',
|
||||
'status_id' => 'status_id'}
|
||||
|
||||
populate_column! table: 'milestones',
|
||||
column: 'milestoneable_type',
|
||||
value: 'Budget::Investment'
|
||||
|
||||
migrate_table! old_table: 'budget_investment_milestone_translations',
|
||||
new_table: 'milestone_translations',
|
||||
columns: {'budget_investment_milestone_id' => 'milestone_id',
|
||||
'locale' => 'locale',
|
||||
'created_at' => 'created_at',
|
||||
'updated_at' => 'updated_at',
|
||||
'title' => 'title',
|
||||
'description' => 'description'}
|
||||
|
||||
Image.where(imageable_type: "Budget::Investment::Milestone").
|
||||
update_all(imageable_type: "Milestone")
|
||||
Document.where(documentable_type: "Budget::Investment::Milestone").
|
||||
update_all(documentable_type: "Milestone")
|
||||
|
||||
puts "Verifying that all rows were copied..."
|
||||
|
||||
{
|
||||
"budget_investment_milestones" => "milestones",
|
||||
"budget_investment_statuses" => "milestone_statuses",
|
||||
"budget_investment_milestone_translations" => "milestone_translations"
|
||||
}.each do |original_table, migrated_table|
|
||||
ActiveRecord::Base.connection.execute(
|
||||
"select setval('#{migrated_table}_id_seq', (select max(id) from #{migrated_table}));"
|
||||
)
|
||||
|
||||
unless count_rows(original_table) == count_rows(migrated_table)
|
||||
raise "Number of rows of old and new tables do not match! Rolling back transaction..."
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
puts "Finished in %.3f seconds" % (Time.now - start)
|
||||
end
|
||||
end
|
||||
@@ -193,14 +193,14 @@ FactoryBot.define do
|
||||
reason "unfeasible"
|
||||
end
|
||||
|
||||
factory :budget_investment_status, class: 'Budget::Investment::Status' do
|
||||
sequence(:name) { |n| "Budget investment status #{n} name" }
|
||||
sequence(:description) { |n| "Budget investment status #{n} description" }
|
||||
factory :milestone_status, class: 'Milestone::Status' do
|
||||
sequence(:name) { |n| "Milestone status #{n} name" }
|
||||
sequence(:description) { |n| "Milestone status #{n} description" }
|
||||
end
|
||||
|
||||
factory :budget_investment_milestone, class: 'Budget::Investment::Milestone' do
|
||||
association :investment, factory: :budget_investment
|
||||
association :status, factory: :budget_investment_status
|
||||
factory :milestone, class: 'Milestone' do
|
||||
association :milestoneable, factory: :budget_investment
|
||||
association :status, factory: :milestone_status
|
||||
sequence(:title) { |n| "Budget investment milestone #{n} title" }
|
||||
description 'Milestone description'
|
||||
publication_date { Date.current }
|
||||
|
||||
@@ -5,22 +5,22 @@ feature 'Admin budget investment milestones' do
|
||||
background do
|
||||
admin = create(:administrator)
|
||||
login_as(admin.user)
|
||||
|
||||
@investment = create(:budget_investment)
|
||||
end
|
||||
|
||||
let!(:investment) { create(:budget_investment) }
|
||||
|
||||
it_behaves_like "translatable",
|
||||
"budget_investment_milestone",
|
||||
"edit_admin_budget_budget_investment_budget_investment_milestone_path",
|
||||
"milestone",
|
||||
"edit_admin_budget_budget_investment_milestone_path",
|
||||
%w[description]
|
||||
|
||||
context "Index" do
|
||||
scenario 'Displaying milestones' do
|
||||
milestone = create(:budget_investment_milestone, investment: @investment)
|
||||
milestone = create(:milestone, milestoneable: investment)
|
||||
create(:image, imageable: milestone)
|
||||
document = create(:document, documentable: milestone)
|
||||
|
||||
visit admin_budget_budget_investment_path(@investment.budget, @investment)
|
||||
visit admin_budget_budget_investment_path(investment.budget, investment)
|
||||
|
||||
expect(page).to have_content("Milestone")
|
||||
expect(page).to have_content(milestone.title)
|
||||
@@ -32,7 +32,7 @@ feature 'Admin budget investment milestones' do
|
||||
end
|
||||
|
||||
scenario 'Displaying no_milestones text' do
|
||||
visit admin_budget_budget_investment_path(@investment.budget, @investment)
|
||||
visit admin_budget_budget_investment_path(investment.budget, investment)
|
||||
|
||||
expect(page).to have_content("Milestone")
|
||||
expect(page).to have_content("Don't have defined milestones")
|
||||
@@ -41,14 +41,14 @@ feature 'Admin budget investment milestones' do
|
||||
|
||||
context "New" do
|
||||
scenario "Add milestone" do
|
||||
status = create(:budget_investment_status)
|
||||
visit admin_budget_budget_investment_path(@investment.budget, @investment)
|
||||
status = create(:milestone_status)
|
||||
visit admin_budget_budget_investment_path(investment.budget, investment)
|
||||
|
||||
click_link 'Create new milestone'
|
||||
|
||||
select status.name, from: 'budget_investment_milestone_status_id'
|
||||
select status.name, from: 'milestone_status_id'
|
||||
fill_in 'Description', with: 'New description milestone'
|
||||
fill_in 'budget_investment_milestone_publication_date', with: Date.current
|
||||
fill_in 'milestone_publication_date', with: Date.current
|
||||
|
||||
click_button 'Create milestone'
|
||||
|
||||
@@ -58,14 +58,14 @@ feature 'Admin budget investment milestones' do
|
||||
end
|
||||
|
||||
scenario "Status select is disabled if there are no statuses available" do
|
||||
visit admin_budget_budget_investment_path(@investment.budget, @investment)
|
||||
visit admin_budget_budget_investment_path(investment.budget, investment)
|
||||
|
||||
click_link 'Create new milestone'
|
||||
expect(find("#budget_investment_milestone_status_id").disabled?).to be true
|
||||
expect(find("#milestone_status_id").disabled?).to be true
|
||||
end
|
||||
|
||||
scenario "Show validation errors on milestone form" do
|
||||
visit admin_budget_budget_investment_path(@investment.budget, @investment)
|
||||
visit admin_budget_budget_investment_path(investment.budget, investment)
|
||||
|
||||
click_link 'Create new milestone'
|
||||
|
||||
@@ -73,7 +73,7 @@ feature 'Admin budget investment milestones' do
|
||||
|
||||
click_button 'Create milestone'
|
||||
|
||||
within "#new_budget_investment_milestone" do
|
||||
within "#new_milestone" do
|
||||
expect(page).to have_content "can't be blank", count: 1
|
||||
expect(page).to have_content 'New description milestone'
|
||||
end
|
||||
@@ -82,11 +82,11 @@ feature 'Admin budget investment milestones' do
|
||||
|
||||
context "Edit" do
|
||||
scenario "Change title, description and document names" do
|
||||
milestone = create(:budget_investment_milestone, investment: @investment)
|
||||
milestone = create(:milestone, milestoneable: investment)
|
||||
create(:image, imageable: milestone)
|
||||
document = create(:document, documentable: milestone)
|
||||
|
||||
visit admin_budget_budget_investment_path(@investment.budget, @investment)
|
||||
visit admin_budget_budget_investment_path(investment.budget, investment)
|
||||
expect(page).to have_link document.title
|
||||
|
||||
click_link milestone.title
|
||||
@@ -94,8 +94,8 @@ feature 'Admin budget investment milestones' do
|
||||
expect(page).to have_css("img[alt='#{milestone.image.title}']")
|
||||
|
||||
fill_in 'Description', with: 'Changed description'
|
||||
fill_in 'budget_investment_milestone_publication_date', with: Date.current
|
||||
fill_in 'budget_investment_milestone_documents_attributes_0_title', with: 'New document title'
|
||||
fill_in 'milestone_publication_date', with: Date.current
|
||||
fill_in 'milestone_documents_attributes_0_title', with: 'New document title'
|
||||
|
||||
click_button 'Update milestone'
|
||||
|
||||
@@ -108,9 +108,9 @@ feature 'Admin budget investment milestones' do
|
||||
|
||||
context "Delete" do
|
||||
scenario "Remove milestone" do
|
||||
milestone = create(:budget_investment_milestone, investment: @investment, title: "Title will it remove")
|
||||
milestone = create(:milestone, milestoneable: investment, title: "Title will it remove")
|
||||
|
||||
visit admin_budget_budget_investment_path(@investment.budget, @investment)
|
||||
visit admin_budget_budget_investment_path(investment.budget, investment)
|
||||
|
||||
click_link "Delete milestone"
|
||||
|
||||
|
||||
@@ -1,95 +0,0 @@
|
||||
require 'rails_helper'
|
||||
|
||||
feature 'Admin budget investment statuses' do
|
||||
|
||||
background do
|
||||
admin = create(:administrator)
|
||||
login_as(admin.user)
|
||||
end
|
||||
|
||||
context "Index" do
|
||||
scenario 'Displaying only not hidden statuses' do
|
||||
status1 = create(:budget_investment_status)
|
||||
status2 = create(:budget_investment_status)
|
||||
|
||||
status1.destroy
|
||||
|
||||
visit admin_budget_investment_statuses_path
|
||||
|
||||
expect(page).not_to have_content status1.name
|
||||
expect(page).not_to have_content status1.description
|
||||
|
||||
expect(page).to have_content status2.name
|
||||
expect(page).to have_content status2.description
|
||||
end
|
||||
|
||||
scenario 'Displaying no statuses text' do
|
||||
visit admin_budget_investment_statuses_path
|
||||
|
||||
expect(page).to have_content("There are no investment statuses created")
|
||||
end
|
||||
end
|
||||
|
||||
context "New" do
|
||||
scenario "Create status" do
|
||||
visit admin_budget_investment_statuses_path
|
||||
|
||||
click_link 'Create new investment status'
|
||||
|
||||
fill_in 'budget_investment_status_name', with: 'New status name'
|
||||
fill_in 'budget_investment_status_description', with: 'This status description'
|
||||
click_button 'Create Investment status'
|
||||
|
||||
expect(page).to have_content 'New status name'
|
||||
expect(page).to have_content 'This status description'
|
||||
end
|
||||
|
||||
scenario "Show validation errors in status form" do
|
||||
visit admin_budget_investment_statuses_path
|
||||
|
||||
click_link 'Create new investment status'
|
||||
|
||||
fill_in 'budget_investment_status_description', with: 'This status description'
|
||||
click_button 'Create Investment status'
|
||||
|
||||
within "#new_budget_investment_status" do
|
||||
expect(page).to have_content "can't be blank", count: 1
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
context "Edit" do
|
||||
scenario "Change name and description" do
|
||||
status = create(:budget_investment_status)
|
||||
|
||||
visit admin_budget_investment_statuses_path
|
||||
|
||||
within("#budget_investment_status_#{status.id}") do
|
||||
click_link "Edit"
|
||||
end
|
||||
|
||||
fill_in 'budget_investment_status_name', with: 'Other status name'
|
||||
fill_in 'budget_investment_status_description', with: 'Other status description'
|
||||
click_button 'Update Investment status'
|
||||
|
||||
expect(page).to have_content 'Other status name'
|
||||
expect(page).to have_content 'Other status description'
|
||||
end
|
||||
end
|
||||
|
||||
context "Delete" do
|
||||
scenario "Hides status" do
|
||||
status = create(:budget_investment_status)
|
||||
|
||||
visit admin_budget_investment_statuses_path
|
||||
|
||||
within("#budget_investment_status_#{status.id}") do
|
||||
click_link "Delete"
|
||||
end
|
||||
|
||||
expect(page).not_to have_content status.name
|
||||
expect(page).not_to have_content status.description
|
||||
end
|
||||
end
|
||||
|
||||
end
|
||||
95
spec/features/admin/milestone_statuses_spec.rb
Normal file
95
spec/features/admin/milestone_statuses_spec.rb
Normal file
@@ -0,0 +1,95 @@
|
||||
require 'rails_helper'
|
||||
|
||||
feature 'Admin milestone statuses' do
|
||||
|
||||
background do
|
||||
admin = create(:administrator)
|
||||
login_as(admin.user)
|
||||
end
|
||||
|
||||
context "Index" do
|
||||
scenario 'Displaying only not hidden statuses' do
|
||||
status1 = create(:milestone_status)
|
||||
status2 = create(:milestone_status)
|
||||
|
||||
status1.destroy
|
||||
|
||||
visit admin_milestone_statuses_path
|
||||
|
||||
expect(page).not_to have_content status1.name
|
||||
expect(page).not_to have_content status1.description
|
||||
|
||||
expect(page).to have_content status2.name
|
||||
expect(page).to have_content status2.description
|
||||
end
|
||||
|
||||
scenario 'Displaying no statuses text' do
|
||||
visit admin_milestone_statuses_path
|
||||
|
||||
expect(page).to have_content("There are no milestone statuses created")
|
||||
end
|
||||
end
|
||||
|
||||
context "New" do
|
||||
scenario "Create status" do
|
||||
visit admin_milestone_statuses_path
|
||||
|
||||
click_link 'Create new milestone status'
|
||||
|
||||
fill_in 'milestone_status_name', with: 'New status name'
|
||||
fill_in 'milestone_status_description', with: 'This status description'
|
||||
click_button 'Create Milestone Status'
|
||||
|
||||
expect(page).to have_content 'New status name'
|
||||
expect(page).to have_content 'This status description'
|
||||
end
|
||||
|
||||
scenario "Show validation errors in status form" do
|
||||
visit admin_milestone_statuses_path
|
||||
|
||||
click_link 'Create new milestone status'
|
||||
|
||||
fill_in 'milestone_status_description', with: 'This status description'
|
||||
click_button 'Create Milestone Status'
|
||||
|
||||
within "#new_milestone_status" do
|
||||
expect(page).to have_content "can't be blank", count: 1
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
context "Edit" do
|
||||
scenario "Change name and description" do
|
||||
status = create(:milestone_status)
|
||||
|
||||
visit admin_milestone_statuses_path
|
||||
|
||||
within("#milestone_status_#{status.id}") do
|
||||
click_link "Edit"
|
||||
end
|
||||
|
||||
fill_in 'milestone_status_name', with: 'Other status name'
|
||||
fill_in 'milestone_status_description', with: 'Other status description'
|
||||
click_button 'Update Milestone Status'
|
||||
|
||||
expect(page).to have_content 'Other status name'
|
||||
expect(page).to have_content 'Other status description'
|
||||
end
|
||||
end
|
||||
|
||||
context "Delete" do
|
||||
scenario "Hides status" do
|
||||
status = create(:milestone_status)
|
||||
|
||||
visit admin_milestone_statuses_path
|
||||
|
||||
within("#milestone_status_#{status.id}") do
|
||||
click_link "Delete"
|
||||
end
|
||||
|
||||
expect(page).not_to have_content status.name
|
||||
expect(page).not_to have_content status.description
|
||||
end
|
||||
end
|
||||
|
||||
end
|
||||
@@ -12,7 +12,7 @@ feature 'Executions' do
|
||||
let!(:investment3) { create(:budget_investment, :incompatible, heading: heading) }
|
||||
|
||||
scenario 'only displays investments with milestones' do
|
||||
create(:budget_investment_milestone, investment: investment1)
|
||||
create(:milestone, milestoneable: investment1)
|
||||
|
||||
visit budget_path(budget)
|
||||
click_link 'See results'
|
||||
@@ -28,7 +28,7 @@ feature 'Executions' do
|
||||
end
|
||||
|
||||
scenario "Do not display headings with no winning investments for selected status" do
|
||||
create(:budget_investment_milestone, investment: investment1)
|
||||
create(:milestone, milestoneable: investment1)
|
||||
|
||||
empty_group = create(:budget_group, budget: budget)
|
||||
empty_heading = create(:budget_heading, group: empty_group, price: 1000)
|
||||
@@ -46,7 +46,7 @@ feature 'Executions' do
|
||||
end
|
||||
|
||||
scenario "Show message when there are no winning investments with the selected status", :js do
|
||||
create(:budget_investment_status, name: I18n.t('seeds.budgets.statuses.executed'))
|
||||
create(:milestone_status, name: I18n.t('seeds.budgets.statuses.executed'))
|
||||
|
||||
visit budget_path(budget)
|
||||
|
||||
@@ -63,7 +63,7 @@ feature 'Executions' do
|
||||
context 'Images' do
|
||||
|
||||
scenario 'renders milestone image if available' do
|
||||
milestone1 = create(:budget_investment_milestone, investment: investment1)
|
||||
milestone1 = create(:milestone, milestoneable: investment1)
|
||||
create(:image, imageable: milestone1)
|
||||
|
||||
visit budget_path(budget)
|
||||
@@ -76,7 +76,7 @@ feature 'Executions' do
|
||||
end
|
||||
|
||||
scenario 'renders investment image if no milestone image is available' do
|
||||
create(:budget_investment_milestone, investment: investment2)
|
||||
create(:milestone, milestoneable: investment2)
|
||||
create(:image, imageable: investment2)
|
||||
|
||||
visit budget_path(budget)
|
||||
@@ -89,7 +89,7 @@ feature 'Executions' do
|
||||
end
|
||||
|
||||
scenario 'renders default image if no milestone nor investment images are available' do
|
||||
create(:budget_investment_milestone, investment: investment4)
|
||||
create(:milestone, milestoneable: investment4)
|
||||
|
||||
visit budget_path(budget)
|
||||
|
||||
@@ -101,16 +101,16 @@ feature 'Executions' do
|
||||
end
|
||||
|
||||
scenario "renders last milestone's image if investment has multiple milestones with images associated" do
|
||||
milestone1 = create(:budget_investment_milestone, investment: investment1,
|
||||
milestone1 = create(:milestone, milestoneable: investment1,
|
||||
publication_date: Date.yesterday)
|
||||
|
||||
milestone2 = create(:budget_investment_milestone, investment: investment1,
|
||||
milestone2 = create(:milestone, milestoneable: investment1,
|
||||
publication_date: Date.yesterday)
|
||||
|
||||
milestone3 = create(:budget_investment_milestone, investment: investment1,
|
||||
milestone3 = create(:milestone, milestoneable: investment1,
|
||||
publication_date: Date.yesterday)
|
||||
|
||||
milestone4 = create(:budget_investment_milestone, investment: investment1,
|
||||
milestone4 = create(:milestone, milestoneable: investment1,
|
||||
publication_date: Date.yesterday)
|
||||
|
||||
create(:image, imageable: milestone2, title: 'Image for first milestone with image')
|
||||
@@ -129,15 +129,15 @@ feature 'Executions' do
|
||||
|
||||
context 'Filters' do
|
||||
|
||||
let!(:status1) { create(:budget_investment_status, name: I18n.t('seeds.budgets.statuses.studying_project')) }
|
||||
let!(:status2) { create(:budget_investment_status, name: I18n.t('seeds.budgets.statuses.bidding')) }
|
||||
let!(:status1) { create(:milestone_status, name: "Studying the project") }
|
||||
let!(:status2) { create(:milestone_status, name: "Bidding") }
|
||||
|
||||
scenario 'Filters select with counter are shown' do
|
||||
create(:budget_investment_milestone, investment: investment1,
|
||||
create(:milestone, milestoneable: investment1,
|
||||
publication_date: Date.yesterday,
|
||||
status: status1)
|
||||
|
||||
create(:budget_investment_milestone, investment: investment2,
|
||||
create(:milestone, milestoneable: investment2,
|
||||
publication_date: Date.yesterday,
|
||||
status: status2)
|
||||
|
||||
@@ -152,9 +152,9 @@ feature 'Executions' do
|
||||
end
|
||||
|
||||
scenario 'by milestone status', :js do
|
||||
create(:budget_investment_milestone, investment: investment1, status: status1)
|
||||
create(:budget_investment_milestone, investment: investment2, status: status2)
|
||||
create(:budget_investment_status, name: I18n.t('seeds.budgets.statuses.executing_project'))
|
||||
create(:milestone, milestoneable: investment1, status: status1)
|
||||
create(:milestone, milestoneable: investment2, status: status2)
|
||||
create(:milestone_status, name: I18n.t('seeds.budgets.statuses.executing_project'))
|
||||
|
||||
visit budget_path(budget)
|
||||
|
||||
@@ -181,11 +181,11 @@ feature 'Executions' do
|
||||
end
|
||||
|
||||
scenario 'are based on latest milestone status', :js do
|
||||
create(:budget_investment_milestone, investment: investment1,
|
||||
create(:milestone, milestoneable: investment1,
|
||||
publication_date: 1.month.ago,
|
||||
status: status1)
|
||||
|
||||
create(:budget_investment_milestone, investment: investment1,
|
||||
create(:milestone, milestoneable: investment1,
|
||||
publication_date: Date.yesterday,
|
||||
status: status2)
|
||||
|
||||
@@ -201,11 +201,11 @@ feature 'Executions' do
|
||||
end
|
||||
|
||||
scenario 'milestones with future dates are not shown', :js do
|
||||
create(:budget_investment_milestone, investment: investment1,
|
||||
create(:milestone, milestoneable: investment1,
|
||||
publication_date: Date.yesterday,
|
||||
status: status1)
|
||||
|
||||
create(:budget_investment_milestone, investment: investment1,
|
||||
create(:milestone, milestoneable: investment1,
|
||||
publication_date: Date.tomorrow,
|
||||
status: status2)
|
||||
|
||||
@@ -226,7 +226,7 @@ feature 'Executions' do
|
||||
def create_heading_with_investment_with_milestone(group:, name:)
|
||||
heading = create(:budget_heading, group: group, name: name)
|
||||
investment = create(:budget_investment, :winner, heading: heading)
|
||||
milestone = create(:budget_investment_milestone, investment: investment)
|
||||
milestone = create(:milestone, milestoneable: investment)
|
||||
heading
|
||||
end
|
||||
|
||||
@@ -260,8 +260,8 @@ feature 'Executions' do
|
||||
context 'No milestones' do
|
||||
|
||||
scenario 'Milestone not yet published' do
|
||||
status = create(:budget_investment_status)
|
||||
unpublished_milestone = create(:budget_investment_milestone, investment: investment1,
|
||||
status = create(:milestone_status)
|
||||
unpublished_milestone = create(:milestone, milestoneable: investment1,
|
||||
status: status, publication_date: Date.tomorrow)
|
||||
|
||||
visit budget_executions_path(budget, status: status.id)
|
||||
|
||||
@@ -1121,11 +1121,11 @@ feature 'Budget Investments' do
|
||||
scenario "Show milestones", :js do
|
||||
user = create(:user)
|
||||
investment = create(:budget_investment)
|
||||
create(:budget_investment_milestone, investment: investment,
|
||||
create(:milestone, milestoneable: investment,
|
||||
description_en: "Last milestone with a link to https://consul.dev",
|
||||
description_es: "Último hito con el link https://consul.dev",
|
||||
publication_date: Date.tomorrow)
|
||||
first_milestone = create(:budget_investment_milestone, investment: investment,
|
||||
first_milestone = create(:milestone, milestoneable: investment,
|
||||
description: "First milestone",
|
||||
publication_date: Date.yesterday)
|
||||
image = create(:image, imageable: first_milestone)
|
||||
|
||||
@@ -1,15 +1,9 @@
|
||||
require 'rails_helper'
|
||||
require 'rake'
|
||||
|
||||
describe 'Communities Rake' do
|
||||
|
||||
describe '#associate_community' do
|
||||
|
||||
before do
|
||||
Rake.application.rake_require "tasks/communities"
|
||||
Rake::Task.define_task(:environment)
|
||||
end
|
||||
|
||||
let :run_rake_task do
|
||||
Rake::Task['communities:associate_community'].reenable
|
||||
Rake.application.invoke_task 'communities:associate_community'
|
||||
|
||||
@@ -1,7 +1,4 @@
|
||||
require 'rake'
|
||||
require 'rails_helper'
|
||||
Rake::Task.define_task(:environment)
|
||||
Rake.application.rake_require('tasks/db')
|
||||
|
||||
describe 'rake db:dev_seed' do
|
||||
let :run_rake_task do
|
||||
|
||||
@@ -1,15 +1,9 @@
|
||||
require "rails_helper"
|
||||
require "rake"
|
||||
|
||||
describe "Globalize tasks" do
|
||||
|
||||
describe "#migrate_data" do
|
||||
|
||||
before do
|
||||
Rake.application.rake_require "tasks/globalize"
|
||||
Rake::Task.define_task(:environment)
|
||||
end
|
||||
|
||||
let :run_rake_task do
|
||||
Rake::Task["globalize:migrate_data"].reenable
|
||||
Rake.application.invoke_task "globalize:migrate_data"
|
||||
@@ -151,7 +145,7 @@ describe "Globalize tasks" do
|
||||
before { I18n.locale = :"pt-BR" }
|
||||
|
||||
let!(:milestone) do
|
||||
create(:budget_investment_milestone).tap do |milestone|
|
||||
create(:milestone).tap do |milestone|
|
||||
milestone.translations.delete_all
|
||||
milestone.update_column(:title, "Português")
|
||||
milestone.reload
|
||||
|
||||
@@ -1,6 +1,4 @@
|
||||
require 'rake'
|
||||
require 'rails_helper'
|
||||
Rails.application.load_tasks
|
||||
|
||||
describe 'rake map_locations:destroy' do
|
||||
before do
|
||||
|
||||
147
spec/lib/tasks/milestones_spec.rb
Normal file
147
spec/lib/tasks/milestones_spec.rb
Normal file
@@ -0,0 +1,147 @@
|
||||
require "rails_helper"
|
||||
|
||||
describe "Milestones tasks" do
|
||||
describe "#migrate" do
|
||||
let :run_rake_task do
|
||||
Rake::Task["milestones:migrate"].reenable
|
||||
Rake.application.invoke_task "milestones:migrate"
|
||||
end
|
||||
|
||||
let!(:investment) { create(:budget_investment) }
|
||||
|
||||
before do
|
||||
ActiveRecord::Base.connection.execute(
|
||||
"INSERT INTO budget_investment_statuses " +
|
||||
"(name, description, hidden_at, created_at, updated_at) " +
|
||||
"VALUES ('open', 'Good', NULL, '#{Time.current - 1.day}', '#{Time.current}');"
|
||||
)
|
||||
|
||||
status_id = ActiveRecord::Base.connection.execute(
|
||||
"SELECT MAX(id) FROM budget_investment_statuses;"
|
||||
).to_a.first["max"]
|
||||
|
||||
milestone_attributes = {
|
||||
investment_id: investment.id,
|
||||
title: "First",
|
||||
description: "Interesting",
|
||||
publication_date: Date.yesterday,
|
||||
status_id: status_id,
|
||||
created_at: Time.current - 1.day,
|
||||
updated_at: Time.current
|
||||
}
|
||||
|
||||
ActiveRecord::Base.connection.execute(
|
||||
"INSERT INTO budget_investment_milestones " +
|
||||
"(#{milestone_attributes.keys.join(", ")}) " +
|
||||
"VALUES (#{milestone_attributes.values.map { |value| "'#{value}'"}.join(", ")})"
|
||||
)
|
||||
end
|
||||
|
||||
it "migrates statuses" do
|
||||
run_rake_task
|
||||
|
||||
expect(Milestone::Status.count).to be 1
|
||||
|
||||
status = Milestone::Status.first
|
||||
expect(status.name).to eq "open"
|
||||
expect(status.description).to eq "Good"
|
||||
expect(status.hidden_at).to be nil
|
||||
expect(status.created_at.to_date).to eq Date.yesterday
|
||||
expect(status.updated_at.to_date).to eq Date.current
|
||||
end
|
||||
|
||||
it "migrates milestones" do
|
||||
run_rake_task
|
||||
|
||||
expect(Milestone.count).to be 1
|
||||
|
||||
milestone = Milestone.first
|
||||
expect(milestone.milestoneable_id).to eq investment.id
|
||||
expect(milestone.milestoneable_type).to eq "Budget::Investment"
|
||||
expect(milestone.title).to eq "First"
|
||||
expect(milestone.description).to eq "Interesting"
|
||||
expect(milestone.publication_date).to eq Date.yesterday
|
||||
expect(milestone.status_id).to eq Milestone::Status.first.id
|
||||
expect(milestone.created_at.to_date).to eq Date.yesterday
|
||||
expect(milestone.updated_at.to_date).to eq Date.current
|
||||
end
|
||||
|
||||
it "Updates the primary key sequence correctly" do
|
||||
run_rake_task
|
||||
expect { create(:milestone) }.not_to raise_exception
|
||||
end
|
||||
|
||||
context "Milestone has images and documents" do
|
||||
let(:milestone_id) do
|
||||
ActiveRecord::Base.connection.execute(
|
||||
"SELECT MAX(id) FROM budget_investment_milestones;"
|
||||
).to_a.first["max"]
|
||||
end
|
||||
|
||||
let!(:image) do
|
||||
create(:image, imageable_id: milestone_id).tap do |image|
|
||||
image.update_column(:imageable_type, "Budget::Investment::Milestone")
|
||||
end
|
||||
end
|
||||
|
||||
let!(:document) do
|
||||
create(:document, documentable_id: milestone_id).tap do |document|
|
||||
document.update_column(:documentable_type, "Budget::Investment::Milestone")
|
||||
end
|
||||
end
|
||||
|
||||
it "migrates images and documents" do
|
||||
run_rake_task
|
||||
|
||||
expect(Milestone.last.image).to eq image
|
||||
expect(Milestone.last.documents).to eq [document]
|
||||
end
|
||||
end
|
||||
|
||||
context "Statuses had been deleted" do
|
||||
before do
|
||||
ActiveRecord::Base.connection.execute(
|
||||
"INSERT INTO budget_investment_statuses " +
|
||||
"(name, description, hidden_at, created_at, updated_at) " +
|
||||
"VALUES ('deleted', 'Del', NULL, '#{Time.current - 1.day}', '#{Time.current}');"
|
||||
)
|
||||
|
||||
ActiveRecord::Base.connection.execute(
|
||||
"DELETE FROM budget_investment_statuses WHERE name='deleted'"
|
||||
)
|
||||
|
||||
ActiveRecord::Base.connection.execute(
|
||||
"INSERT INTO budget_investment_statuses " +
|
||||
"(name, description, hidden_at, created_at, updated_at) " +
|
||||
"VALUES ('new', 'New', NULL, '#{Time.current - 1.day}', '#{Time.current}');"
|
||||
)
|
||||
|
||||
status_id = ActiveRecord::Base.connection.execute(
|
||||
"SELECT MAX(id) FROM budget_investment_statuses;"
|
||||
).to_a.first["max"]
|
||||
|
||||
milestone_attributes = {
|
||||
investment_id: investment.id,
|
||||
title: "Last",
|
||||
description: "Different",
|
||||
publication_date: Date.yesterday,
|
||||
status_id: status_id,
|
||||
created_at: Time.current - 1.day,
|
||||
updated_at: Time.current
|
||||
}
|
||||
|
||||
ActiveRecord::Base.connection.execute(
|
||||
"INSERT INTO budget_investment_milestones " +
|
||||
"(#{milestone_attributes.keys.join(", ")}) " +
|
||||
"VALUES (#{milestone_attributes.values.map { |value| "'#{value}'"}.join(", ")})"
|
||||
)
|
||||
end
|
||||
|
||||
it "migrates the status id correctly" do
|
||||
run_rake_task
|
||||
|
||||
expect(Milestone.last.status_id).to eq Milestone::Status.last.id
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
@@ -1,15 +1,9 @@
|
||||
require 'rails_helper'
|
||||
require 'rake'
|
||||
|
||||
describe 'Settings Rake' do
|
||||
|
||||
describe '#per_page_code_migration' do
|
||||
|
||||
before do
|
||||
Rake.application.rake_require "tasks/settings"
|
||||
Rake::Task.define_task(:environment)
|
||||
end
|
||||
|
||||
let :run_rake_task do
|
||||
Rake::Task['settings:per_page_code_migration'].reenable
|
||||
Rake.application.invoke_task 'settings:per_page_code_migration'
|
||||
|
||||
@@ -1,7 +1,4 @@
|
||||
require 'rake'
|
||||
require 'rails_helper'
|
||||
Rails.application.load_tasks
|
||||
Rake::Task.define_task(:environment)
|
||||
|
||||
feature 'rake sitemap:create' do
|
||||
before do
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
require 'rails_helper'
|
||||
|
||||
describe Budget::Investment::Status do
|
||||
describe Milestone::Status do
|
||||
|
||||
describe "Validations" do
|
||||
let(:status) { build(:budget_investment_status) }
|
||||
let(:status) { build(:milestone_status) }
|
||||
|
||||
it "is valid" do
|
||||
expect(status).to be_valid
|
||||
@@ -1,9 +1,9 @@
|
||||
require 'rails_helper'
|
||||
|
||||
describe Budget::Investment::Milestone do
|
||||
describe Milestone do
|
||||
|
||||
describe "Validations" do
|
||||
let(:milestone) { build(:budget_investment_milestone) }
|
||||
let(:milestone) { build(:milestone) }
|
||||
|
||||
it "is valid" do
|
||||
expect(milestone).to be_valid
|
||||
@@ -25,8 +25,8 @@ describe Budget::Investment::Milestone do
|
||||
expect(milestone).to be_valid
|
||||
end
|
||||
|
||||
it "is not valid without an investment" do
|
||||
milestone.investment_id = nil
|
||||
it "is not valid without a milestoneable" do
|
||||
milestone.milestoneable_id = nil
|
||||
expect(milestone).not_to be_valid
|
||||
end
|
||||
|
||||
@@ -48,7 +48,7 @@ describe Budget::Investment::Milestone do
|
||||
end
|
||||
|
||||
describe "#description_or_status_present?" do
|
||||
let(:milestone) { build(:budget_investment_milestone) }
|
||||
let(:milestone) { build(:milestone) }
|
||||
|
||||
it "is not valid when status is removed and there's no description" do
|
||||
milestone.update(description: nil)
|
||||
@@ -71,14 +71,14 @@ describe Budget::Investment::Milestone do
|
||||
|
||||
describe ".published" do
|
||||
it "uses the application's time zone date", :with_different_time_zone do
|
||||
published_in_local_time_zone = create(:budget_investment_milestone,
|
||||
published_in_local_time_zone = create(:milestone,
|
||||
publication_date: Date.today)
|
||||
|
||||
published_in_application_time_zone = create(:budget_investment_milestone,
|
||||
published_in_application_time_zone = create(:milestone,
|
||||
publication_date: Date.current)
|
||||
|
||||
expect(Budget::Investment::Milestone.published).to include(published_in_application_time_zone)
|
||||
expect(Budget::Investment::Milestone.published).not_to include(published_in_local_time_zone)
|
||||
expect(Milestone.published).to include(published_in_application_time_zone)
|
||||
expect(Milestone.published).not_to include(published_in_local_time_zone)
|
||||
end
|
||||
end
|
||||
end
|
||||
@@ -12,6 +12,7 @@ require 'capybara/rails'
|
||||
require 'capybara/rspec'
|
||||
require 'selenium/webdriver'
|
||||
|
||||
Rails.application.load_tasks if Rake::Task.tasks.empty?
|
||||
I18n.default_locale = :en
|
||||
|
||||
include Warden::Test::Helpers
|
||||
|
||||
@@ -317,7 +317,7 @@ end
|
||||
# even share the same colour.
|
||||
def update_button_text
|
||||
case translatable_class.name
|
||||
when "Budget::Investment::Milestone"
|
||||
when "Milestone"
|
||||
"Update milestone"
|
||||
when "AdminNotification"
|
||||
"Update notification"
|
||||
|
||||
Reference in New Issue
Block a user