<%
  import org.exoplatform.wiki.webui.UIWikiPortlet;
  
  def rcontext = _ctx.getRequestContext(); 
  String addLink = uiform.event(uiform.ACTION_ADD);
  String anchor = "#" + uiform.ACTION_ADD;
  String actionId = UIWikiPortlet.WIKI_PORTLET_ACTION_PREFIX + uiform.ACTION_ADD;
  String inputId = uiform.TEMPLATE_SEARCHBOX;
  def requireJs = rcontext.getJavascriptManager().getRequireJS();
  requireJs.require("SHARED/UIWikiTemplateForm", "UIWikiTemplateForm");
  requireJs.addScripts("UIWikiTemplateForm.init('"+ uicomponent.id+"', '" + inputId + "', '" +  _ctx.appRes("UITemplateSettingForm.label.Search")  + "');");
%>

<div class="uiTemplateSettingForm uiWikiTemplateForm">
	<%uiform.begin();%>
	<div class="templateControl clearfix" style="overflow: hidden">		  		
    <button type="button" class="pull-right btn" onclick="eXo.wiki.UIWikiAjaxRequest.makeNewHash('$anchor');"><%=_ctx.appRes("UITemplateSettingForm.action.title.Add")%></button>
    <a onclick="$addLink" id="$actionId" style="display:none;">&nbsp;</a>

    <div class="pull-left uiSearchInput" >
      <% uiform.renderChild(uiform.TEMPLATE_SEARCHBOX);	%>
      <button type="button" class="btn TemplateSearchButton" style="display:none" onclick="<%=uiform.event(uiform.ACTION_SEARCH);%>"><%=_ctx.appRes("UITemplateSettingForm.label.Search")%></button>
    </div>
  </div>

  <div class="TemplateGrid">
  	<% uiform.renderChild(uiform.TEMPLATE_GRID);	%>
  </div>
  <%uiform.end();%>
</div>
