<extend name="Public/base"/>

<block name="body">
   
    
    <div class="cf main-place top_nav_list navtab_list">
        <h3 class="page_title">{$meta_title}</h3>
        <p class="description_text"></p>
    </div>
    
    
    <div class="cf top_nav_list">
		<div class="fl button_list">
			<a class="" href="{:U('add')}"><span class="button_icon button_icon1"></span>新增</a>
        </div>
    </div>
	<!-- 表格列表 -->
	<div class="tb-unit posr category_list">
		<div class="category" style="margin-top:0;">
			<div class="hd cf">
				<div class="fold">折叠</div>
				<div class="order">排序</div>
				<div class="order">发布</div>
				<div class="name">名称</div>
			</div>
			{:R('Category/tree', array($tree))}
		</div>
	</div>
	<!-- /表格列表 -->
	
	<div class="common_settings">
			<span class="plus_icon"><span><img src="__IMG__/zwmimages/icon_jia.png"></span></span>
			<form class="addShortcutIcon">
				<input type="hidden" name="title" value="{$m_title}">
				<input type="hidden" name="url" value="{$m_url}">
			</form>
			<a class="ajax-post add-butn <notempty name='commonset'>addSIsetted</notempty>" href="javascript:;" target-form="addShortcutIcon" url="{:U('Think/addShortcutIcon')}"><img src="__IMG__/zwmimages/icon_jia.png"><span><notempty name='commonset'>已添加<else />添加至常用设置</notempty></span></a>
		</div>
	
</block>

<block name="script">
	<script type="text/javascript">

		highlight_subnav("{:U('Category/index')}");

		(function($){
			/* 分类展开收起 */
			$(".category dd").prev().find(".fold i").addClass("icon-unfold")
				.click(function(){
					var self = $(this);
					if(self.hasClass("icon-unfold")){
						self.closest("dt").next().slideUp("fast", function(){
							self.removeClass("icon-unfold").addClass("icon-fold");
						});
					} else {
						self.closest("dt").next().slideDown("fast", function(){
							self.removeClass("icon-fold").addClass("icon-unfold");
						});
					}
				});

			/* 三级分类删除新增按钮 */
			$(".category dd dd .add-sub").remove();

			/* 实时更新分类信息 */
			$(".category")
				.on("submit", "form", function(){
					var self = $(this);
					$.post(
						self.attr("action"),
						self.serialize(),
						function(data){
							/* 提示信息 */
							var name = data.status ? "success" : "error", msg;
							msg = self.find(".msg").addClass(name).text(data.info)
									  .css("display", "inline-block");
							setTimeout(function(){
								msg.fadeOut(function(){
									msg.text("").removeClass(name);
								});
							}, 1000);
						},
						"json"
					);
					return false;
				})
                .on("focus","input",function(){
                    $(this).data('param',$(this).closest("form").serialize());

                })
                .on("blur", "input", function(){
                    if($(this).data('param')!=$(this).closest("form").serialize()){
                        $(this).closest("form").submit();
                    }
                });
		})(jQuery);
	</script>
</block>