diff --git a/app/assets/stylesheets/participation.scss b/app/assets/stylesheets/participation.scss index a8a593dab..0c4aee9fa 100644 --- a/app/assets/stylesheets/participation.scss +++ b/app/assets/stylesheets/participation.scss @@ -1472,6 +1472,63 @@ } } +.budget-timeline { + border-left: 3px solid $budget; + margin-left: $line-height / 2; + padding: $line-height $line-height / 2; + + h3, + span, + p { + padding: 0 $line-height / 4; + } + + h3 { + margin-bottom: 0; + } + + span { + color: $text-medium; + display: block; + font-size: $small-font-size; + margin-bottom: $line-height / 2; + } + + .phase { + position: relative; + + &:not(:first-child) { + margin-top: $line-height * 1.5; + } + + &::before { + background-color: #fff; + border: 4px solid $budget; + border-radius: 100%; + content: ''; + height: 16px; + left: -22px; + position: absolute; + top: 6px; + width: 16px; + z-index: 99; + } + + &.active { + + h3 { + background: $budget; + color: white; + display: inline-block; + } + + &::before { + background-color: $budget; + } + } + } +} + // 07. Proposals successful // ------------------------- diff --git a/app/helpers/text_with_links_helper.rb b/app/helpers/text_with_links_helper.rb index baff460a1..9144bdd6b 100644 --- a/app/helpers/text_with_links_helper.rb +++ b/app/helpers/text_with_links_helper.rb @@ -7,6 +7,7 @@ module TextWithLinksHelper end def safe_html_with_links(html) + return if html.nil? return html.html_safe unless html.html_safe? Rinku.auto_link(html, :all, 'target="_blank" rel="nofollow"').html_safe end diff --git a/app/models/budget.rb b/app/models/budget.rb index 5d24e2437..8457ba1ac 100644 --- a/app/models/budget.rb +++ b/app/models/budget.rb @@ -41,7 +41,7 @@ class Budget < ActiveRecord::Base end def published_phases - phases.published + phases.published.order(:id) end def description diff --git a/app/models/budget/phase.rb b/app/models/budget/phase.rb index 87a3909a0..61f778678 100644 --- a/app/models/budget/phase.rb +++ b/app/models/budget/phase.rb @@ -56,7 +56,7 @@ class Budget end def step_number - budget.published_phases.order(:id).index(self) + 1 || 0 + budget.published_phases.index(self) + 1 || 0 end private diff --git a/app/views/budgets/_phases.html.erb b/app/views/budgets/_phases.html.erb new file mode 100644 index 000000000..fbf65ab22 --- /dev/null +++ b/app/views/budgets/_phases.html.erb @@ -0,0 +1,13 @@ +
<%= phase.summary %>
++ <%= link_to t("budgets.index.section_header.help"), "#section_help" %> +
- <% steps_progress = "(#{current_phase.step_number}/#{@budget.published_phases.count})" %> - <%= t('budgets.show.phase') %> <%= steps_progress %> + <% steps = "(#{@budget.current_phase.step_number}/#{@budget.published_phases.count})" %> + <%= t('budgets.show.phase') %> <%= steps %>