{template 'common/header'}
{template 'article/common'}
{if $do == 'category'}
<div class="clearfix">
	<form action="{php echo url('article/news/category');}" method="post" class="we7-form" role="form">
		<div class="form-group">
			<div class="pull-right">
				<a href="{php echo url('article/news/category_post');}" class="btn btn-primary">添加分类</a>
			</div>
		</div>

				<table class="table we7-table table-hover">
						<col width="100px"/>
						<col />
						<col width="100px"/>
						<tr>
							<th>排序</th>
							<th>分类名称</th>
							<th class='text-right'>操作</th>
						</tr>

					{loop $data $da}
						<input type="hidden" name="ids[]" value="{$da['id']}"/>
						<tr>
							<td><input type="text" name="displayorder[]" value="{$da['displayorder']}" class="form-control"/></td>
							<td><input type="text" name="title[]" value="{$da['title']}" class="form-control"/></td>
							<td>
								<div class="link-group"><a href="{php echo url('article/news/category_del', array('id' => $da['id']));}" class="del" onclick="if(!confirm('删除分类后,该分类下新闻也会被删除,确定删除吗?')) return false;">删除</a></div>
							</td>
						</tr>
					{/loop}

				</table>

		
		<div class="form-group">
			<div class="col-sm-8 col-lg-9 col-xs-12">
				<input type="submit" class="btn btn-primary" name="submit" value="提交" />
				<input type="hidden" name="token" value="{$_W['token']}" />
			</div>
		</div>
	</form>
</div>
{elseif $do == 'category_post'}
<div class="clearfix">
	<form action="{php echo url('article/news/category_post');}" method="post" class="form-horizontal" role="form">
		<div class="panel panel-default">
			<div class="panel-body">
				<div id="tpl">
					<div class="form-group">
						<label class="col-xs-12 col-sm-2 col-md-2 control-label">分类名称</label>
						<div class="col-sm-8 col-lg-9 col-xs-12">
							<input type="text" class="form-control" name="title[]" vlaue="" placeholder="分类名称"/>
							<div class="help-block">请填写分类名称</div>
						</div>
					</div>
					<div class="form-group">
						<label class="col-xs-12 col-sm-2 col-md-2 control-label">排序</label>
						<div class="col-sm-8 col-lg-9 col-xs-12">
							<input type="text" class="form-control" name="displayorder[]" vlaue="" placeholder="排序"/>
							<div class="help-block">数字越大,越靠前</div>
						</div>
					</div>
					<hr/>
				</div>
				<div id="container"></div>
				<div class="form-group">
					<label class="col-xs-12 col-sm-2 col-md-2 col-lg-1 control-label"></label>
					<div class="col-sm-8 col-lg-9 col-xs-12">
						<a href="javascript:;" id="category-add"><i class="fa fa-plus-circle"></i> 继续添加分类</a>
					</div>
				</div>
			</div>
		</div>
		<div class="form-group">
			<div class="col-sm-8 col-lg-9 col-xs-12">
				<input type="submit" class="btn btn-primary" name="submit" value="提交" />
				<input type="hidden" name="token" value="{$_W['token']}" />
			</div>
		</div>
	</form>
</div>
{/if}
<script>
	$(function(){
		$('#category-add').click(function(){
			var html = $('#tpl').html();
			$('#container').append(html);
			return false;
		});
	});
</script>
{template 'common/footer'}