2016-02-12 23:52:43 +08:00
|
|
|
<% provide(:head_title, t("projects.index.head_title")) %>
|
|
|
|
|
2018-05-25 23:14:22 +08:00
|
|
|
<% if current_team %>
|
|
|
|
<%= render partial: "shared/sidebar" %>
|
|
|
|
<%= render partial: "shared/secondary_navigation" %>
|
|
|
|
|
2018-06-06 23:23:22 +08:00
|
|
|
<% if can_create_projects?(current_team) %>
|
|
|
|
<!-- New project modal -->
|
|
|
|
<div class="modal" id="new-project-modal" tabindex="-1" role="dialog" aria-labelledby="new-project-modal-label">
|
|
|
|
<%= bootstrap_form_for @project, remote: true do |f| %>
|
|
|
|
<div class="modal-dialog" role="document">
|
|
|
|
<div class="modal-content">
|
|
|
|
<div class="modal-header">
|
|
|
|
<button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">×</span></button>
|
|
|
|
<h4 class="modal-title" id="new-project-modal-label"><%= t("projects.index.modal_new_project.modal_title") %></h4>
|
|
|
|
</div>
|
|
|
|
<div class="modal-body">
|
|
|
|
<%= render partial: "new.html.erb", locals: { form: f, teams: @teams } %>
|
|
|
|
</div>
|
|
|
|
<div class="modal-footer">
|
|
|
|
<button type="button" class="btn btn-default" data-dismiss="modal"><%=t "general.cancel" %></button>
|
|
|
|
<%= f.submit t("projects.index.modal_new_project.create"), class: "btn btn-success" %>
|
2018-05-25 23:14:22 +08:00
|
|
|
</div>
|
|
|
|
</div>
|
2018-06-06 23:23:22 +08:00
|
|
|
</div>
|
|
|
|
<% end %>
|
|
|
|
</div>
|
|
|
|
<% end %>
|
|
|
|
|
|
|
|
<div class="content-pane" id="projects-index">
|
|
|
|
|
|
|
|
<% if @projects_tree.empty? %>
|
|
|
|
<div class="jumbotron text-center" style="margin-top:12%">
|
|
|
|
<strong><%=t 'projects.index.no_projects.text' %></strong>
|
|
|
|
<% if @teams.exists? && can_create_projects?(current_team) %>
|
|
|
|
<h2><strong><%=t 'projects.index.no_projects.title' %><strong></h2>
|
|
|
|
<br />
|
|
|
|
<a class="btn btn-primary btn-lg"
|
|
|
|
id="new-project-btn">
|
2018-07-09 19:13:44 +08:00
|
|
|
<span class="fas fa-plus"></span>
|
2018-06-06 23:23:22 +08:00
|
|
|
<span class="hidden-xs"><%= t('projects.index.no_projects.create_new_button') %></span>
|
|
|
|
</a>
|
|
|
|
<% else %>
|
|
|
|
<p><strong><%=t 'projects.index.no_projects.no_permission_title' %></strong></p>
|
2018-05-25 23:14:22 +08:00
|
|
|
<% end %>
|
|
|
|
</div>
|
2018-06-06 23:23:22 +08:00
|
|
|
<% else %>
|
|
|
|
<!-- Edit project modal -->
|
|
|
|
<div class="modal" id="edit-project-modal" tabindex="-1" role="dialog" aria-labelledby="edit-project-modal-label">
|
|
|
|
<div class="modal-dialog" role="document">
|
|
|
|
<div class="modal-content">
|
|
|
|
<div class="modal-header">
|
|
|
|
<button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">×</span></button>
|
|
|
|
<h4 class="modal-title" id="edit-project-modal-label"></h4>
|
|
|
|
</div>
|
|
|
|
<div class="modal-body">
|
|
|
|
</div>
|
|
|
|
<div class="modal-footer">
|
|
|
|
<button type="button" class="btn btn-default" data-dismiss="modal"><%=t "general.cancel" %></button>
|
|
|
|
<button type="button" class="btn btn-success" data-action="submit"><%=t "projects.index.modal_edit_project.submit" %></button>
|
|
|
|
</div>
|
2018-01-22 23:25:53 +08:00
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</div>
|
2016-02-12 23:52:43 +08:00
|
|
|
|
2018-06-06 23:23:22 +08:00
|
|
|
<!-- Manage users modal -->
|
2018-06-12 23:26:44 +08:00
|
|
|
<div class="modal" id="project-actions-modal" tabindex="-1" role="dialog" aria-labelledby="project-actions-modal-label">
|
2018-06-06 23:23:22 +08:00
|
|
|
<div class="modal-dialog" role="document">
|
|
|
|
<div class="modal-content">
|
|
|
|
<div class="modal-header">
|
|
|
|
<button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">×</span></button>
|
2018-06-12 23:26:44 +08:00
|
|
|
<h4 class="modal-title" id="project-actions-modal-label"></h4>
|
2018-06-06 23:23:22 +08:00
|
|
|
</div>
|
|
|
|
<div class="modal-body"></div>
|
|
|
|
<div class="modal-footer"></div>
|
2018-05-25 23:14:22 +08:00
|
|
|
</div>
|
|
|
|
</div>
|
2016-02-12 23:52:43 +08:00
|
|
|
</div>
|
|
|
|
|
2018-06-06 23:23:22 +08:00
|
|
|
<div id="projects-toolbar">
|
2016-02-12 23:52:43 +08:00
|
|
|
|
2018-06-06 23:23:22 +08:00
|
|
|
<form class="form-inline" action="<%= projects_path %>">
|
2016-02-12 23:52:43 +08:00
|
|
|
|
2018-06-06 23:23:22 +08:00
|
|
|
<div class="form-group">
|
2016-02-12 23:52:43 +08:00
|
|
|
|
2018-06-06 23:23:22 +08:00
|
|
|
<% if @teams.exists? && can_create_projects?(current_team) %>
|
|
|
|
<!-- new project button -->
|
|
|
|
<a class="btn btn-primary pull-right" id="new-project-btn">
|
2018-07-09 19:13:44 +08:00
|
|
|
<span class="fas fa-plus" aria-hidden="true"></span>
|
2018-06-06 23:23:22 +08:00
|
|
|
<span class="hidden-xs"><%=t "projects.index.new" %></span>
|
|
|
|
</a>
|
|
|
|
<% end %>
|
2016-02-12 23:52:43 +08:00
|
|
|
|
2018-06-06 23:23:22 +08:00
|
|
|
<!-- project sort -->
|
|
|
|
<div class="dropdown">
|
|
|
|
<button class="btn btn-default dropdown-toggle" type="button" id="sortMenu" data-toggle="dropdown" aria-haspopup="true" aria-expanded="true">
|
|
|
|
<span class="hidden-xs"><%= t'projects.index.sort' %></span>
|
2018-07-09 19:13:44 +08:00
|
|
|
<span class="visible-xs-inline"><i class="fas fa-sort"></i></span>
|
2018-06-06 23:23:22 +08:00
|
|
|
<span class="caret"></span>
|
|
|
|
</button>
|
|
|
|
<ul class="dropdown-menu" aria-labelledby="sortMenu">
|
|
|
|
<% ["new", "old", "atoz", "ztoa"].each do |sort| %>
|
|
|
|
<% if @current_sort != sort %>
|
|
|
|
<li><a href="?<%= {team: @current_team.id, sort: sort}.reject{|k,v| v.to_s == "0"}.to_query %>"><%= t('projects.index.sort_' + sort) %></a></li>
|
|
|
|
<% else %>
|
|
|
|
<li class="disabled"><a href="#"><%= t('projects.index.sort_' + sort) %></a></li>
|
|
|
|
<% end %>
|
2018-05-25 23:14:22 +08:00
|
|
|
<% end %>
|
2018-06-06 23:23:22 +08:00
|
|
|
</ul>
|
|
|
|
</div>
|
|
|
|
|
2018-05-25 23:14:22 +08:00
|
|
|
</div>
|
2018-06-06 23:23:22 +08:00
|
|
|
</form>
|
|
|
|
</div>
|
2016-02-12 23:52:43 +08:00
|
|
|
|
2018-06-06 23:23:22 +08:00
|
|
|
<%= render partial: "projects/index/team_projects",
|
|
|
|
locals: { projects: @projects_tree } %>
|
|
|
|
<% end %>
|
2016-10-21 15:06:19 +08:00
|
|
|
|
2018-05-25 23:14:22 +08:00
|
|
|
</div>
|
2018-06-06 23:23:22 +08:00
|
|
|
|
2016-02-12 23:52:43 +08:00
|
|
|
<% end %>
|
2018-05-08 22:33:42 +08:00
|
|
|
|
2018-07-19 23:56:42 +08:00
|
|
|
<%= javascript_include_tag "projects/index" %>
|