scinote-web/app/views/projects/index/_project.html.erb

100 lines
4.8 KiB
Text

<div id="<%= project.id %>" class="panel panel-default panel-project" data-id="<%= project.id %>"
data-project-users-tab-url="<%= url_for project_user_projects_path(project_id: project.id, format: :json) %>">
<div class="panel-heading">
<% if can_manage_project?(@project) %>
<div class="dropdown pull-right">
<button class="btn btn-link dropdown-toggle" type="button" id="dropdownMenu1" data-toggle="dropdown" aria-haspopup="true" aria-expanded="true">
<span class="caret"></span>
</button>
<% project_form = nil %>
<%= form_for project, method: :patch, format: :html do |f| %>
<% project_form = f %>
<%= f.hidden_field :archived, value: true %>
<% end %>
<ul class="dropdown-menu dropdown-menu-right" aria-labelledby="dropdownMenu1">
<li class="dropdown-header"><%= t('projects.index.options_header') %></li>
<li>
<%= link_to t("projects.index.edit_option"), edit_project_path(project, format: :json), remote: true, "data-action" => "edit" %>
</li>
<% if can_archive_project?(project) %>
<li><a href="#" class="form-submit-link" data-submit-form="<%= project_form.options[:html][:id] %>" data-confirm-form="<%= t("projects.index.archive_confirm") %>"><%= t 'projects.index.archive_option' %></a></li>
<% end %>
</ul>
</div>
<% end %>
<h3 class="panel-title">
<% if project.hidden? then %>
<span class="glyphicon glyphicon-eye-close" aria-hidden="true" title="<%=t "projects.index.visibility_private" %>"></span>
<% else %>
<span class="glyphicon glyphicon-eye-open" aria-hidden="true" title="<%=t "projects.index.visibility_public" %>"></span>
<% end %>
<% if can_read_project?(project) then %>
<%= link_to project.name, project_path(project), id: "#{project.id}-project-canvas-link" %>
<% else %>
<%= project.name %>
<% end %>
</h3>
</div>
<div class="panel-body">
<div class="row">
<div class="col-xs-6"><%= t('projects.index.start_date') %></div>
<div class="col-xs-6">
<%=l project.created_at, format: :full_date %>
</div>
</div>
</div>
<div class="panel-footer panel-footer-scinote">
<!-- Nav tabs -->
<ul class="nav nav-tabs nav-tabs-less" role="tablist">
<% if can_read_project?(project) %>
<li role="presentation">
<a class="btn btn-link" href="<%= url_for project_project_activities_path(project_id: project.id, format: :json) %>" aria-controls="activities-<%= project.id %>" role="tab" data-remote="true">
<span class="glyphicon glyphicon-equalizer"></span>
</a>
</li>
<li role="presentation">
<a class="btn btn-link" href="<%= url_for project_user_projects_path(project_id: project.id, format: :json) %>" aria-controls="users-<%= project.id %>" role="tab" data-remote="true">
<span class="glyphicon glyphicon-user"></span>
<span class="badge badge-indicator users-badge-indicator <%= 'hidden' unless project.users.count.positive? %>"
data-linked-id="<%= project.id %>">
<%= project.users.count %>
</span>
</a>
</li>
<li role="presentation">
<a class="btn btn-link" href="<%= url_for notifications_project_path(id: project.id, format: :json) %>" aria-controls="notifications-<%= project.id %>" role="tab" data-remote="true">
<span class="glyphicon glyphicon-bell"></span>
<% if project.notifications_count(current_user).positive? %>
<span class="badge badge-indicator"><%= project.notifications_count(current_user) %></span>
<% end %>
</a>
</li>
<li role="presentation">
<a class="btn btn-link" href="<%= url_for project_project_comments_path(project_id: project.id, format: :json) %>" aria-controls="comments-<%= project.id %>" role="tab" data-remote="true">
<span class="glyphicon glyphicon-comment"></span>
<span class="badge badge-indicator comments-badge-indicator <%= 'hidden' unless project.project_comments.count.positive? %>"
data-linked-id="<%= project.id %>">
<%= project.project_comments.count %>
</span>
</a>
</li>
<% end %>
</ul>
<!-- Tab panes -->
<div class="tab-content">
<% if can_read_project?(project) %>
<div role="tabpanel" class="tab-pane" id="activities-<%= project.id %>"></div>
<div role="tabpanel" class="tab-pane" id="users-<%= project.id %>"></div>
<div role="tabpanel" class="tab-pane" id="notifications-<%= project.id %>"></div>
<div role="tabpanel" class="tab-pane" id="comments-<%= project.id %>"></div>
<% end %>
</div>
</div>
</div>