ruling_timer/app/views/admin/ruling_timers/project_management.html.erb

130 lines
5.0 KiB
Plaintext

<style type="text/css">
.span20-percent{
width: 20%;
float: left;
text-align: center;
font-size: 1.5em;
margin: 0;
border: 2px solid #333333;
-moz-box-sizing: border-box;
box-sizing: border-box;
}
.span20-percent img{
width: 100%;
}
.status-tags > *{
font-weight: bold;
}
.task_name{
font-size: 1.5em;
}
.working_label{
color: #5a5a5a;
font-weight: bold;
}
.finish_label{
color: #3ec700;
font-weight: bold;
}
.stop_label{
color: #cd1643;
font-weight: bold;
}
</style>
<h3><%= t("ruling_timer.projects") %></h3>
<table class="table main-list">
<thead>
<tr>
<th><%= t("ruling_timer.project_no") %></th>
<th><%= t("ruling_timer.project_name") %></th>
<th><%= t("ruling_timer.status") %></th>
<th><%= t("ruling_timer.project_manager") %></th>
<th><%= t("ruling_timer.project_member") %></th>
<th><%= t("ruling_timer.task_count") %></th>
<th><%=t("action")%></th>
</tr>
</thead>
<tbody>
<% @projects.each_with_index do |project,i| %>
<tr>
<td class="project_no_td"><%=project.project_no%></td>
<td class="project_name_td"><%=project.get_project_name%></td>
<td class="status_td"><%=project.get_status %></td>
<td class="project_manager_td"><%=project.project_manager.name rescue "" %></td>
<td class="all_user_ids_td"><%=project.all_user_ids.count %></td>
<td class="task_count_td">
<%= project.task_count %>
</td>
<td>
<a href="<%=view_project_admin_ruling_timer_path(:id=>project.id)%>" class="btn btn-primary"><%=t("view")%></a>
<a href="<%=section_management_admin_ruling_timer_path(:id=>project.id)%>" class="btn btn-primary"><%=t("ruling_timer.section_management")%></a>
<% unless project.is_private %>
<a href="<%=edit_project_admin_ruling_timer_path(:id=>project.id)%>" class="btn btn-primary"><%=t("edit")%></a>
<a href="#" class="btn btn-danger delete_project" data-project="<%=project.get_project_name%>" data-project-id="<%=project.id.to_s%>"><%=t("ruling_timer.delete_project")%></a>
<% end %>
</td>
</tr>
<% end %>
</tbody>
</table>
<%=
content_tag :div, class: "bottomnav clearfix" do
content_tag(:div, paginate(@projects), class: "pagination pagination-centered") +
content_tag(:div, link_to(t("ruling_timer.add_project"), add_project_admin_ruling_timers_path, :class=>"btn btn-primary"), class: "pull-right")
end %>
<script>
<% ["working","stop","finish"].each do |status| %>
$(".<%=status%>_label").attr("title",'<%=t("ruling_timer.#{status}")%>');
<% end %>
$('.delete_project').click(function(){
var item = $(this);
var item_row = $(this).parents("tr").eq(0);
var project_id = $(item).data("project-id")
if(window.confirm("<%=t("ruling_timer.delete_project_hint")%>")){
if(window.confirm("<%=t("ruling_timer.delete_project_hint")%>")){
if($("#dialog-confirm").length == 0){
$("#main-wrap").before("<div id='dialog-confirm' title='<%=t("ruling_timer.delete_task")%>'>"+
"<div style='clear:both;'></div><div id='info_texts'>"+'<%=t("ruling_timer.delete_project_hint1")%>'.replace('{{project}}',item.data('project'))+"</div>"+"<input id=\"confirm_input\"/ placeholder=\"<%= t('ruling_timer.please_input_confirm_delete') %>\" style=\"width: 17em;\">"+"<div id='msg_end' style='height:0px; overflow:hidden'></div>"+
"</div>");
}else{
$("#info_texts").html('<%=t("ruling_timer.delete_project_hint1")%>'.replace('{{project}}',item.data('project')));
$('#confirm_input').css('display','block');
$('#confirm_input').val('');
}
$( "#dialog-confirm" ).dialog({
resizable: true,
minHeight: 200,
maxHeight: 400,
modal: true,
width: '80%',
open: function(){
$('#confirm_input').blur();
},
close: function(){
$('#confirm_input').css('display','none');
$( this ).dialog( "close" );
},
buttons: {
"<%= t('ruling_timer.confirm') %>": function(){
var _this = $(this);
if($('#confirm_input').val().match(/<%= t('ruling_timer.confirm_delete') %>/gi)){
$('#confirm_input').css('display','none');
$.post(decodeURIComponent("<%=delete_project_admin_ruling_timer_path(:id=>"{{project_id}}")%>").replace("{{project_id}}",project_id),{'confirm_delete': true}).done(function(data){
item_row.remove();
_this.dialog( "close" );
});
}else{
alert("<%= t('ruling_timer.please_input_confirm_delete').html_safe %>");
$('#confirm_input').focus();
}
},
"<%= t('ruling_timer.cancel') %>": function(){
$('#confirm_input').css('display','none');
$( this ).dialog( "close" );
}
}
});
}
}
});
</script>