angular.module('app_base', [])

    /** @ngInject */
    .directive('iframe', ['$compile','AppSettings', function($compile,AppSettings) {
        return {
            restrict: 'E',
            link: function(scope, element, attrs) {
                if(AppSettings.contentH && scope.height.match('%')){
                    var h = AppSettings.contentH * (scope.height.split('%')[0]/100);
                    angular.element(element).parent().attr('style','height:'+h+'px');
                }
            },
            scope: {
                height:'@'
            }
        };
    }])

     /** @ngInject */
     .directive('field', ['$compile', function($compile) {
         var linker = function (scope, element, attrs) {
             var c = attrs.class;
             if (c.match('field-name-body')) {
             }
             if (c.match('field-name-field-image')) {
                // element.find('img').addClass('thumbnail')
             }
         };
         return {
             restrict: 'C',
             controller: "fieldCtrl",
             scope: {

             },
             link: linker
         };
     }])

      /** @ngInject */
     .directive('fieldNameFieldRelated', ['$compile', function($compile) {
         return {
             restrict: 'C',
             link: function(scope, element, attrs) {
                 var icon = '<i class="pull-left glyphicon glyphicon-chevron-right"></i>';
                 element.append(icon)
             }
         };
     }]);

