Merge branch 'master' into feature/budget_phases

This commit is contained in:
BertoCQ
2018-01-16 17:47:47 +01:00
committed by GitHub
26 changed files with 166 additions and 76 deletions

View File

@@ -83,4 +83,4 @@ App.Map =
toogleMap: ->
$('.map').toggle()
$('.location-map-remove-marker-button').toggle()
$('.js-location-map-remove-marker').toggle()

View File

@@ -22,6 +22,7 @@
// 20. Documents
// 21. Related content
// 22. Images
// 23. Maps
//
// 01. Global styles
@@ -2427,10 +2428,6 @@ table {
margin-bottom: 0 !important;
padding: $line-height / 2;
&:first-child {
border-top: 1px solid $border;
}
@include breakpoint(medium) {
.score-actions {
@@ -2439,6 +2436,10 @@ table {
}
}
&:first-child {
border-top: 1px solid $border;
}
&:hover {
background: #f9f9f9;
@@ -2478,8 +2479,8 @@ table {
position: relative;
text-decoration: none;
&.score-positive:before,
&.score-negative:before {
&.score-positive::before,
&.score-negative::before {
font-family: 'icons';
left: 0;
position: absolute;
@@ -2488,7 +2489,7 @@ table {
&.score-positive {
color: $color-success;
&:before {
&::before {
color: $color-success;
content: '\6c';
}
@@ -2497,7 +2498,7 @@ table {
&.score-negative {
color: $color-alert;
&:before {
&::before {
color: $color-alert;
content: '\76';
}
@@ -2511,3 +2512,28 @@ table {
.images .button {
margin-top: $line-height / 2;
}
// 23. Maps
// -----------------
.location-map-remove-marker {
border-bottom: 1px dotted #cf2a0e;
color: $delete;
display: inline-block;
margin-top: $line-height / 2;
&:hover,
&:active,
&:focus {
border-bottom: 1px solid #cf2a0e;
color: #cf2a0e;
text-decoration: none;
}
}
.leaflet-bar a {
&.leaflet-disabled {
color: #525252 !important;
}
}

View File

@@ -339,6 +339,7 @@
.topic-show,
.milestone-content {
h1,
p {
word-wrap: break-word;
}

View File

@@ -2,7 +2,7 @@ class Admin::BudgetsController < Admin::BaseController
include FeatureFlags
feature_flag :budgets
has_filters %w{current finished}, only: :index
has_filters %w{open finished}, only: :index
load_and_authorize_resource

View File

@@ -25,6 +25,7 @@ class ApplicationController < ActionController::Base
layout :set_layout
respond_to :html
helper_method :current_budget
private
@@ -120,4 +121,8 @@ class ApplicationController < ActionController::Base
params[:filter] ||= "selected"
end
end
def current_budget
Budget.current
end
end

View File

@@ -19,7 +19,7 @@ class Management::BudgetsController < Management::BaseController
end
def print_investments
@budgets = Budget.current.order(created_at: :desc).page(params[:page])
@budget = Budget.current
end
private

View File

@@ -5,10 +5,10 @@ class Valuation::BudgetsController < Valuation::BaseController
load_and_authorize_resource
def index
@budgets = @budgets.current.order(created_at: :desc).page(params[:page])
@investments_with_valuation_open = {}
@budgets.each do |b|
@investments_with_valuation_open[b.id] = b.investments
@budget = Budget.current
if @budget.present?
@investments_with_valuation_open = {}
@investments_with_valuation_open = @budget.investments
.by_valuator(current_user.valuator.try(:id))
.valuation_open
.count

View File

@@ -34,11 +34,11 @@ module MapLocationsHelper
end
def map_location_remove_marker(map_location, text)
content_tag :div, class: "text-right" do
content_tag :div, class: "margin-bottom" do
content_tag :a,
id: map_location_remove_marker_link_id(map_location),
href: "#",
class: "location-map-remove-marker-button delete" do
class: "js-location-map-remove-marker location-map-remove-marker" do
text
end
end

View File

@@ -29,7 +29,12 @@ class Budget < ActiveRecord::Base
scope :balloting, -> { where(phase: "balloting") }
scope :reviewing_ballots, -> { where(phase: "reviewing_ballots") }
scope :finished, -> { where(phase: "finished") }
scope :current, -> { where.not(phase: "finished") }
scope :open, -> { where.not(phase: "finished") }
def self.current
where.not(phase: "drafting").last
end
def current_phase
phases.send(phase)
@@ -99,10 +104,6 @@ class Budget < ActiveRecord::Base
balloting_process? || finished?
end
def current?
!finished?
end
def heading_price(heading)
heading_ids.include?(heading.id) ? heading.price : -1
end

View File

@@ -4,7 +4,7 @@
<% if @investments.any? %>
<h3 class="inline-block"><%= page_entries_info @investments %></h3>
<table>
<table class="table-for-mobile">
<thead>
<tr>
<th><%= t("admin.budget_investments.index.table_id") %></th>

View File

@@ -1,12 +1,10 @@
<table>
<% @budgets.each do |budget| %>
<tr id="<%= dom_id(budget) %>">
<td><%= budget.name %></td>
<td><%= budget.translated_phase %></td>
<tr id="<%= dom_id(@budget) %>">
<td><%= @budget.name %></td>
<td><%= @budget.translated_phase %></td>
<td align="right">
<%= link_to t("management.budgets.print_investments"),
print_management_budget_investments_path(budget) %>
print_management_budget_investments_path(@budget) %>
</td>
</tr>
<% end %>
</table>

View File

@@ -1,7 +1,5 @@
<h2 class="inline-block"><%= t("valuation.budgets.index.title") %></h2>
<h3><%= page_entries_info @budgets %></h3>
<table>
<thead>
<tr>
@@ -12,25 +10,21 @@
</tr>
</thead>
<tbody>
<% @budgets.each do |budget| %>
<tr id="<%= dom_id(budget) %>" class="budget">
<td>
<%= budget.name %>
</td>
<td>
<%= t("budgets.phase.#{budget.phase}") %>
</td>
<td>
<%= @investments_with_valuation_open[budget.id] %>
</td>
<td>
<%= link_to t("valuation.budgets.index.evaluate"),
valuation_budget_budget_investments_path(budget_id: budget.id),
class: "button hollow expanded" %>
</td>
</tr>
<% end %>
<tr id="<%= dom_id(@budget) %>" class="budget">
<td>
<%= @budget.name %>
</td>
<td>
<%= t("budgets.phase.#{@budget.phase}") %>
</td>
<td>
<%= @investments_with_valuation_open %>
</td>
<td>
<%= link_to t("valuation.budgets.index.evaluate"),
valuation_budget_budget_investments_path(budget_id: @budget.id),
class: "button hollow expanded" %>
</td>
</tr>
</tbody>
</table>
<%= paginate @budgets %>