ambition/public/pages/share.html

172 lines
8.0 KiB
HTML

<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>Ambition-敏捷开发项目管理工具</title>
<!-- Tell the browser to be responsive to screen width -->
<meta content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no" name="viewport">
<!-- Font Awesome -->
<link rel="stylesheet" href="../plugins/font-awesome/css/font-awesome.css">
<!-- Theme style -->
<link rel="stylesheet" href="../dist/css/AdminLTE.min.css">
<!-- Bootstrap 3.3.5 -->
<link rel="stylesheet" href="../bootstrap/css/bootstrap.min.css">
<!-- AdminLTE Skins. We have chosen the skin-blue for this starter
page. However, you can choose any other skin. Make sure you
apply the skin class to the body tag so the changes take effect.
-->
<link rel="stylesheet" href="../dist/css/skins/skin-green.min.css">
<!-- date picker -->
<link rel="stylesheet" href="../dist/css/datepicker.css">
<!-- HTML5 Shim and Respond.js IE8 support of HTML5 elements and media queries -->
<!-- WARNING: Respond.js doesn't work if you view the page via file:// -->
<!--[if lt IE 9]>
<script src="https://oss.maxcdn.com/html5shiv/3.7.3/html5shiv.min.js"></script>
<script src="https://oss.maxcdn.com/respond/1.4.2/respond.min.js"></script>
<![endif]-->
</head>
<body class="hold-transition skin-green sidebar-mini" style="overflow-x:hidden;">
<div class="wrapper">
<!-- Content Wrapper. Contains page content -->
<div class="content-wrapper" style="margin-left:0px;">
<section class="content-header">
<h1>
分享
<small>写下关于项目的一切</small>
</h1>
</section>
<!-- header section -->
<!-- Content Header (Page header) -->
<section class="content">
<div class="row">
<div class="col-lg-8 col-lg-offset-2">
<div class="row" id="share_container">
<div class="col-lg-12">
<div class="box box-primary">
<div class="box-header with-border">
<h3 class="box-title">添加分享</h3>
</div>
<!-- /.box-header -->
<div class="box-body">
<div class="form-group">
<label>分享内容</label>
<textarea id="share_content" class="form-control" rows="3" placeholder="输入分享内容"></textarea>
</div>
</div>
<!-- /.box-body -->
<div class="box-footer">
<button onclick="submit_share()" class="btn btn-primary pull-right">提交</button>
</div>
</div>
</div>
<!-- col -->
</div>
<!-- row -->
</section>
<!-- content section -->
</div>
<!-- content-wrapper -->
</div>
<!-- ./wrapper -->
<center><strong>Copyright &copy; 2016 <a href="#">Aambition Inc.</a>.</strong> All rights reserved.</center>
<!-- jQuery 2.1.4 -->
<script src="../plugins/jQuery/jQuery-2.1.4.min.js"></script>
<!-- Bootstrap 3.3.5 -->
<script src="../bootstrap/js/bootstrap.min.js"></script>
<!-- AdminLTE App -->
<script src="../dist/js/app.min.js"></script>
<!-- AdminLTE for demo purposes -->
<script src="../dist/js/demo.js"></script>
<!-- date select and query -->
<script>
$(document).ready(function(){
$.ajax({
type: "get",
dataType: "json",
url:"/shares.json",
data:{
"project_id":parent.LoginUserInfo.selectProject
},
statusCode: {
200: function(response) {// 请求成功
var data=response.data;
for( var i=0;i<data.length;i++ ){
$("\
<div class='col-lg-12'>\
<div class='box box-widget'>\
<div class='box-header with-border'>\
<div class='user-block'>\
<img class='img-circle' src='../dist/img/avatar5.png' alt='user image'>\
<span class='username'><a href='#'>"+data[i].name+"</a></span>\
<span class='description'>向大家分享 - "+data[i].time.substring(0,10)+"&nbsp&nbsp"+data[i].time.substring(11,16)+"</span>\
</div>\
</div>\
<div class='box-body'>\
<p>"+data[i].content+"</p>\
<button class='btn btn-default btn-xs'>\
<i class='fa fa-thumbs-o-up'></i> 赞</button>\
<span class='pull-right text-muted'>45 赞 - 2 评论</span>\
</div>\
<div class='box-footer box-comments'>\
<div class='box-comment'>\
<img class='img-circle img-sm' src='../dist/img/avatar5.png' alt='user image'>\
<div class='comment-text'>\
<span class='username'>崔承旭<span class='text-muted pull-right'>8:03 PM 今天</span></span>高级软件工程使我快乐!\
</div>\
</div>\
</div>\
<div class='box-footer'>\
<div class='input-group'>\
<input type='text' name='message' placeholder='输入评论内容' class='form-control'>\
<span class='input-group-btn'>\
<button type='button' class='btn btn-primary btn-flat'>提交</button>\
</span>\
</div>\
</div>\
</div>\
</div>").appendTo("#share_container");
}
},
401:function(){// 未授权
alert("未登录!");
//window.location.href="pages/login.html";
}
}
});
});
function submit_share(){
var share_content=$("#share_content").val();
if( share_content.length>0 ){
$.ajax({
type:"post",
dataType:"json",
url:"/shares.json",
data:{
"share[project_id]":parent.LoginUserInfo.selectProject,
"share[content]":share_content
},
statusCode: {
201: function(response) {// 请求成功
alert("提交成功!");
window.location.reload();
},
422:function(){
alert("请重新输入!")
}
}
});
}else{
alert("请输入完整!");
}
}
</script>
</body>
</html>