%
if(!uiConfig){
var uiConfig;
if(model.id){
uiConfig = endpointConfig.get('methods.put.options.ui') || endpointConfig.get('methods.get.options.ui');
}else{
uiConfig = endpointConfig.get('methods.post.options.ui') || endpointConfig.get('methods.get.options.ui');
}
}
uiConfig = new BasicApp.DataAccess(uiConfig);
var results = [];
uiConfig.each('item.fields', function(fieldConfig){
var fieldPath = path.extend(fieldConfig.name);
var title = pluginApplicator.process(fieldConfig.title, fieldPath, model, '');
var value = pluginApplicator.process(fieldConfig.value, fieldPath, model);
var layoutContext = {
model: model,
value: value
};
var layout = pluginApplicator.process(fieldConfig.layout, fieldPath, layoutContext, '');
results.push({
fieldPath: fieldPath,
title: title,
value: value,
layout: layout
});
});
var widget = {};
uiConfig.exists('widget', function(plugins){
widget = pluginApplicator.process(plugins, path, model);
});
var elId = _.uniqueId();
var title;
%>
<%= uiConfig.get('before') %>
<%= widget.before %>
class='form'<% } %>>
<% uiConfig.exists('item.title', function(plugins){//move to lib %>
<% title = pluginApplicator.process(plugins, path, model) %>
<%
if(title.options.collapse) {
var $panelTitle = $el.find(".panel-title").first();
%>
<% } else { %>
<% }%>
<%= title.clean %>
<%
var help = uiConfig.get('help');
if(!_.isEmpty(help)){
%>
<%= help.title %>
<% } %>
<% if(uiConfig.get('item.tools2')){ %>
<%
var results = [];
toolPath = new WidgetPlugins.Path('');
uiConfig.each('item.tools2', function(fieldConfig){
var fieldPath = toolPath.extend(fieldConfig.name);
var title = pluginApplicator.process(fieldConfig.title, fieldPath, model);
var value = pluginApplicator.process(fieldConfig.value, fieldPath, model);
var layoutContext = {
model: {},
value: value
};
var layout = pluginApplicator.process(fieldConfig.layout, fieldPath, layoutContext, '');
results.push({
fieldPath: fieldPath,
title: title,
value: value,
layout: layout
});
});
%>
<%= _.template(deps.itemTemplate)({
results: results,
}) %>
<% } %>
<% }) %>
<% if(_.get(title, 'options.collapse')) { %>
<% } %>
<%
uiConfig.exists('item.before', function(plugins){
var itemBefore = pluginApplicator.process(plugins, path, model)
%>
<%= itemBefore.clean %>
<% }) %>
<%= _.template(deps.itemTemplate)({
results: results,
model: model
}) %>
<% uiConfig.exists('item.after', function(config){ var itemAfter = pluginApplicator.process(config, path, model) %>
<%= itemAfter.clean %>
<% }) %>
<% if(!uiConfig.get('item.options.noToolbar')){ %>
<% if(endpointConfig.get('methods.patch') || endpointConfig.get('methods.put') || endpointConfig.get('methods.post') || endpointConfig.get('methods.delete') || uiConfig.get('item.tools')){ %>
<% } %>
<% } %>
<% if(_.get(title, 'options.collapse')) { %>
<% } %>
<%= widget.after %>
<%= uiConfig.get('after') %>