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

119 lines
5.1 KiB
Text
Raw Normal View History

2016-02-12 23:52:43 +08:00
<% provide(:head_title, t("projects.index.head_title")) %>
2018-01-26 01:24:28 +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">&times;</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">
<%= f.submit t("projects.index.modal_new_project.create"), class: "btn btn-primary" %>
<button type="button" class="btn btn-default" data-dismiss="modal"><%=t "general.cancel" %></button>
</div>
</div>
</div>
<% end %>
</div>
<% end %>
<% if can_manage_project?(@project) %>
<!-- Edit project modal -->
<div class="modal" id="edit-project-modal" tabindex="-1" role="dialog" aria-labelledby="edit-project-modal-label">
2016-02-12 23:52:43 +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">&times;</span></button>
<h4 class="modal-title" id="edit-project-modal-label"></h4>
2016-02-12 23:52:43 +08:00
</div>
<div class="modal-body">
</div>
<div class="modal-footer">
<button type="button" class="btn btn-primary" data-action="submit"><%=t "projects.index.modal_edit_project.submit" %></button>
2016-02-12 23:52:43 +08:00
<button type="button" class="btn btn-default" data-dismiss="modal"><%=t "general.cancel" %></button>
</div>
</div>
</div>
</div>
<!-- Manage users modal -->
<div class="modal" id="manage-users-modal" tabindex="-1" role="dialog" aria-labelledby="manage-users-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">&times;</span></button>
<h4 class="modal-title" id="manage-users-modal-label"><%= t("projects.index.modal_manage_users.modal_title") %> <span id="manage-users-modal-project"></span></h4>
</div>
<div class="modal-body"></div>
<div class="modal-footer"></div>
2016-02-12 23:52:43 +08:00
</div>
</div>
</div>
<% end %>
2016-02-12 23:52:43 +08:00
<div id="projects-toolbar">
2016-02-12 23:52:43 +08:00
<form class="form-inline" action="<%= projects_path %>">
<div class="form-group">
<!-- project archive button -->
<a class="btn btn-default pull-right" href="<%= url_for projects_archive_path %>" id="project-archive-btn" data-turbolinks="false" title="<%= t'projects.index.archive' %>">
2016-02-12 23:52:43 +08:00
<span class="glyphicon glyphicon-briefcase" aria-hidden="true"></span>
</a>
2018-02-03 03:14:03 +08:00
<% if @teams.length > 0 && can_create_projects?(current_team) %>
2016-02-12 23:52:43 +08:00
<!-- new project button -->
<a class="btn btn-primary pull-right" id="new-project-btn">
2016-02-12 23:52:43 +08:00
<span class="glyphicon glyphicon-plus" aria-hidden="true"></span>
<span class="hidden-xs"><%=t "projects.index.new" %></span>
</a>
<% end %>
<!-- 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>
<span class="visible-xs-inline"><i class="glyphicon glyphicon-sort"></i></span>
<span class="caret"></span>
</button>
<ul class="dropdown-menu" aria-labelledby="sortMenu">
<% ["new", "old", "atoz", "ztoa"].each do |sort| %>
<% if @current_sort != sort %>
2017-01-25 19:01:23 +08:00
<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>
2016-02-12 23:52:43 +08:00
<% else %>
<li class="disabled"><a href="#"><%= t('projects.index.sort_' + sort) %></a></li>
<% end %>
<% end %>
</ul>
</div>
</div>
</form>
</div>
2017-01-25 19:01:23 +08:00
<% if @teams.length == 0 %>
<!-- Show link to team management if member of
no teams -->
2016-02-12 23:52:43 +08:00
<div class="jumbotron">
2017-01-25 19:01:23 +08:00
<h2><%=t 'projects.index.no_teams.title' %></h2>
<p><%=t 'projects.index.no_teams.text' %></p>
<p data-hook="projects-manage-teams-button">
<%= link_to t('projects.index.no_teams.btn'), teams_path, class: 'btn btn-primary' %>
</p>
2016-02-12 23:52:43 +08:00
</div>
<% else %>
2017-01-25 19:01:23 +08:00
<h2 class="page-header"><%= current_team.name %></h2>
<% @projects_by_teams.each do |team, projects| %>
<%= render partial: "projects/index/team_projects",
locals: {team: team, projects: projects} %>
<% end %>
2016-10-21 15:06:19 +08:00
2016-02-12 23:52:43 +08:00
<% end %>
<%= javascript_include_tag "projects/index", "data-turbolinks-track" => true %>