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

115 lines
4.8 KiB
Text
Raw Normal View History

2016-02-12 23:52:43 +08:00
<% provide(:head_title, t("projects.index.head_title")) %>
<!-- 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">
2017-01-25 19:01:23 +08:00
<%= render partial: "new.html.erb", locals: { form: f, teams: @teams } %>
2016-02-12 23:52:43 +08:00
</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>
<!-- 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">&times;</span></button>
<h4 class="modal-title" id="edit-project-modal-label"></h4>
</div>
<div class="modal-body">
</div>
<div class="modal-footer">
2016-07-21 19:11:15 +08:00
<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>
2016-07-21 19:11:15 +08:00
<div class="modal-footer"></div>
2016-02-12 23:52:43 +08:00
</div>
</div>
</div>
<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 -->
2017-06-27 20:48:45 +08:00
<a class="btn btn-default pull-right" href="<%= url_for projects_archive_path %>" id="project-archive-btn" title="<%= t'projects.index.archive' %>">
2016-02-12 23:52:43 +08:00
<span class="glyphicon glyphicon-briefcase" aria-hidden="true"></span>
</a>
<!-- new project button -->
2017-01-25 19:01:23 +08:00
<% if @teams.length > 0 %>
<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 %>