mirror of
https://github.com/scinote-eln/scinote-web.git
synced 2024-11-17 22:51:24 +08:00
114 lines
4.5 KiB
Text
114 lines
4.5 KiB
Text
<% project_form = nil
|
|
unassigned_team_owner = can_manage_team?(project.team) && !can_read_project?(project)
|
|
%>
|
|
|
|
<%= form_for project, format: :json, method: :put, remote: true, html: { id: "edit-project-dropdown-form-#{project.id}" } do |f| %>
|
|
<% project_form = f %>
|
|
<%= f.hidden_field :archived, value: !project.archived %>
|
|
<% end %>
|
|
<ul class="dropdown-menu dropdown-menu-right" aria-labelledby="projectActionsDropdown">
|
|
<% if unassigned_team_owner %>
|
|
<!-- Project members access -->
|
|
<li class="form-dropdown-item">
|
|
<%= link_to can_manage_project_users?(project) ? edit_access_permissions_project_path(project) : access_permissions_project_path(project),
|
|
data: { action: 'remote-modal'} do %>
|
|
<i class="sn-icon sn-icon-project-member-access"></i>
|
|
<%= I18n.t('projects.index.project_members_access') %>
|
|
<% end %>
|
|
</li>
|
|
<% else %>
|
|
<!-- Restore project -->
|
|
<% if project.archived? && can_restore_project?(project) %>
|
|
<li class="form-dropdown-item">
|
|
<%= link_to(project_path(project, format: :json) + '?project[archived]=false',
|
|
method: :put,
|
|
remote: true,
|
|
class: 'project-archive-restore-form') do %>
|
|
<i class="sn-icon sn-icon-restore"></i>
|
|
<span><%= t('projects.index.restore_option') %></span>
|
|
<% end %>
|
|
</li>
|
|
<% end %>
|
|
|
|
<!-- Edit project -->
|
|
<% if project.active? && can_manage_project?(project) %>
|
|
<li>
|
|
<a href="<%= edit_project_path(project, format: :json) %>"
|
|
class="edit-project-btn"
|
|
data-action="edit"
|
|
data-remote="true">
|
|
<i class="sn-icon sn-icon-edit"></i>
|
|
<span><%= t('projects.index.edit_option') %></span>
|
|
</a>
|
|
</li>
|
|
<% end %>
|
|
|
|
<!-- Project members access -->
|
|
<li class="form-dropdown-item">
|
|
<%= link_to can_manage_project_users?(project) ? edit_access_permissions_project_path(project) : access_permissions_project_path(project),
|
|
data: { action: 'remote-modal'} do %>
|
|
<i class="sn-icon sn-icon-project-member-access"></i>
|
|
<%= I18n.t('projects.index.project_members_access') %>
|
|
<% end %>
|
|
</li>
|
|
|
|
<!-- Move project -->
|
|
<% if can_manage_team?(project.team) %>
|
|
<li class="form-dropdown-item">
|
|
<a href="#" data-project-id="<%= project.id %>" data-url="/project_folders/move_to_modal" class="move-projects-btn">
|
|
<i class="sn-icon sn-icon-move"></i>
|
|
<%= I18n.t('projects.index.move_button') %>
|
|
</a>
|
|
</li>
|
|
<% end %>
|
|
|
|
<!-- Export project -->
|
|
<% if can_export_project?(project) %>
|
|
<li class="form-dropdown-item">
|
|
<a href="#" data-project-id="<%= project.id %>" data-url="<%= export_projects_modal_team_path(project.team) %>" class="export-projects-btn">
|
|
<i class="sn-icon sn-icon-export"></i>
|
|
<%= I18n.t('projects.export_projects.export_button') %>
|
|
</a>
|
|
</li>
|
|
<% end %>
|
|
|
|
<!-- Archive project -->
|
|
<% if project.active? && can_archive_project?(project) %>
|
|
<li class="form-dropdown-item">
|
|
<%= link_to(project_path(project, format: :json) + '?project[archived]=true',
|
|
method: :put,
|
|
remote: true,
|
|
class: 'project-archive-restore-form',
|
|
data: { confirm: t('projects.index.archive_confirm') }) do %>
|
|
<i class="sn-icon sn-icon-archive"></i>
|
|
<span><%= t('projects.index.archive_option') %></span>
|
|
<% end %>
|
|
</li>
|
|
<% end %>
|
|
<!-- Show comments -->
|
|
<li>
|
|
<a href="#"
|
|
class="open-comments-sidebar"
|
|
data-turbolinks="false"
|
|
data-object-type="Project"
|
|
data-object-id="<%= project.id %>">
|
|
<i class="sn-icon sn-icon-comments"></i>
|
|
<span id="comment-count-<%= project.id %>">
|
|
<% unseen_comment_count = project.comments.unseen_by(current_user).count %>
|
|
<% if unseen_comment_count.positive? %>
|
|
<%= t('projects.index.comments_option_with_unread', comments_count: unseen_comment_count) %>
|
|
<% else %>
|
|
<%= t('projects.index.comments_option') %>
|
|
<% end %>
|
|
</span>
|
|
</a>
|
|
</li>
|
|
<!-- Open activities -->
|
|
<li>
|
|
<a href="/global_activities?<%= Activity.url_search_query({ subjects: { Project: [project] } }) %>">
|
|
<i class="sn-icon sn-icon-activities"></i>
|
|
<span><%= t('projects.index.activities_option') %></span>
|
|
</a>
|
|
</li>
|
|
<% end %>
|
|
</ul>
|