opf/openproject

View on GitHub
modules/budgets/app/views/budgets/show.html.erb

Summary

Maintainability
Test Coverage
<%#-- copyright
OpenProject is an open source project management software.
Copyright (C) 2012-2024 the OpenProject GmbH

This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License version 3.

OpenProject is a fork of ChiliProject, which is a fork of Redmine. The copyright follows:
Copyright (C) 2006-2013 Jean-Philippe Lang
Copyright (C) 2010-2013 the ChiliProject Team

This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License
as published by the Free Software Foundation; either version 2
of the License, or (at your option) any later version.

This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
GNU General Public License for more details.

You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.

See COPYRIGHT and LICENSE files for more details.

++#%>

<% html_title "#{t(:label_budget_id, id: @budget.id)}: #{@budget.subject}" %>
<%= toolbar title: t(:label_budget_id,  id:  @budget.id) do %>
  <% if authorize_for(:budgets, :edit) %>
    <li class="toolbar-item">
      <%= link_to({ controller: 'budgets', action: 'edit',  id: @budget }, class: 'button', accesskey: accesskey(:edit)) do %>
        <%= op_icon('button--icon icon-edit') %>
        <span class="button--text"><%= t(:button_update) %></span>
      <% end %>
    </li>
  <% end %>
  <% if authorize_for(:budgets, :copy) %>
    <li class="toolbar-item hidden-for-tablet">
      <%= link_to({ controller: 'budgets', action: 'copy', id: @budget }, class: 'button') do %>
        <%= op_icon('button--icon icon-copy') %>
        <span class="button--text"><%= t(:button_copy) %></span>
      <% end %>
    </li>
  <% end %>
  <% if authorize_for(:budgets, :destroy) %>
    <li class="toolbar-item">
      <%= link_to({ controller: 'budgets', action: 'destroy', id: @budget }, class: 'button', method: :delete) do %>
        <%= op_icon('button--icon icon-delete') %>
        <span class="button--text"><%= t(:button_delete) %></span>
      <% end %>
    </li>
  <% end %>
<% end %>

<div class="<%= @budget.css_classes %> details">
  <h3><%=h @budget.subject %></h3>
  <p class="author">
    <%= authoring @budget.created_at, @budget.author %>.
    <%= t(:label_updated_time, value: distance_of_time_in_words(Time.now, @budget.updated_at)) + '.' if @budget.created_at != @budget.updated_at %>
  </p>

  <%= render(AttributeGroups::AttributeGroupComponent.new) do |component|
    component.with_attribute(key: Budget.human_attribute_name(:type), value: @budget.type_label)
    component.with_attribute(key: Budget.human_attribute_name(:fixed_date), value: format_date(@budget.fixed_date))
    component.with_attribute(key: Budget.human_attribute_name(:budget_ratio),
                             value: extended_progress_bar(@budget.budget_ratio, :width => '80px', :legend => @budget.budget_ratio))
    component.with_attribute(key: Budget.human_attribute_name(:description),
                             value: content_tag(:div, class: "op-uc-container") do
                               format_text @budget, :description, :attachments => @budget.attachments
                             end)
  end %>

  <% resource = budget_attachment_representer(@budget) %>
  <%= list_attachments(resource) %>

  <%= render :partial => "show" %>
</div>

<div style="clear: both;"></div>

<% if authorize_for('budgets', 'edit') %>
  <div id="update" style="display:none;">
  <h3><%= t(:button_update) %></h3>
  <%= render :partial => 'edit' %>
  </div>
<% end %>