All Downloads are FREE. Search and download functionalities are using the official Maven repository.

META-INF.resources.scripts.controllers.lightadmin-quickview-controller.js Maven / Gradle / Ivy

Go to download

Pluggable data management solution for Java web applications developed in a "Rapid" manner

There is a newer version: 1.2.0.RC1
Show newest version
/*
 * Copyright 2012-2014 the original author or authors.
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

/**
 * TODO: Document me!
 *
 * @author Maxim Kharchenko ([email protected])
 */

var QuickViewController = (function () {

    function renderView(domainEntity, fields, primaryKeyProperty) {
        var primaryKey = domainEntity.getPropertyValue(primaryKeyProperty, 'quickView');
        var detailsHtmlBlock = '
'; if (fields.length > 0) { detailsHtmlBlock += ''; detailsHtmlBlock += ''; var currentFieldIdx = 0; for (var prop in fields) { var property = fields[prop]; var propertyName = property['name']; var propertyType = property['type']; var propertyTitle = property['title']; var propertyValue = domainEntity.getPropertyValue(property, 'quickView'); var rowClass = ''; if (currentFieldIdx == 0) { rowClass = 'noborder'; } if (currentFieldIdx == fields.length - 1) { rowClass = 'last'; } detailsHtmlBlock += ''; detailsHtmlBlock += ''; detailsHtmlBlock += ''; detailsHtmlBlock += ''; currentFieldIdx++; } detailsHtmlBlock += '
' + propertyTitle + ':' + FieldValueRenderer.render(propertyName, propertyValue, propertyType, 'quickView') + '
'; } detailsHtmlBlock += '
'; return detailsHtmlBlock; } return { handle: function (domainEntity) { var resourceName = ApplicationConfig.RESOURCE_NAME; var primaryKeyProperty = ConfigurationMetadataService.getPrimaryKeyProperty(resourceName); var fields = ConfigurationMetadataService.getDynamicPropertiesAsArray(resourceName, 'quickView'); return renderView(domainEntity, fields, primaryKeyProperty); } } }());




© 2015 - 2024 Weber Informatics LLC | Privacy Policy