/**
 * @file Tag list control
 * @copyright Digital Living Software Corp. 2014-2015
 * @todo
 * - Improve samples in sampler app
 * - What's pipType and pipTypeLocal? Give better name
 * - Do not use ng-if, instead generate template statically
 */
 
/* global angular */

(function () {
    'use strict';

    var thisModule = angular.module("pipTagList", ['pipCore']);

    /**
     * pipTags - set of tags
     * pipType - additional type tag
     * pipTypeLocal - additional translated type tag
     */
    thisModule.directive('pipTagList', 
        function ($parse) {
            return {
                restrict: 'EA',
                scope: {
                    pipTags: '=',
                    pipType: '=',
                    pipTypeLocal: '='
                },
                templateUrl: 'tags/tag_list.html',
                controller:
                    function ($scope, $element, $attrs, pipUtils) {
                        var tagsGetter = $parse($attrs.pipTags);
                        
                        $element.css("display", "block");
                        
                        // Set tags
                        $scope.tags = tagsGetter($scope);

                        // Also optimization to avoid watch if it is unnecessary
                        if (pipUtils.toBoolean($attrs.pipRebind)) {
                            $scope.$watch(tagsGetter, function (newValue) {
                                $scope.tags = tagsGetter($scope)
                            });
                        }

                        // Add class
                        $element.addClass('pip-tag-list');
                    }
            }
        }
    );

})();


@@ -244,31 +244,8 @@
 %0A */
-%0A %0A/* global angular */
 %0A%0A(f
@@ -253,16 +253,23 @@
 nction (
+angular
 ) %7B%0A    
@@ -319,17 +319,17 @@
 .module(
-%22
+'
 pipTagLi
@@ -330,17 +330,17 @@
 pTagList
-%22
+'
 , %5B'pipC
@@ -521,17 +521,16 @@
 agList',
- 
 %0A       
@@ -928,16 +928,53 @@
     var 
+tagsGetter;%0A%0A                        
 tagsGett
@@ -1006,33 +1006,8 @@
 s);%0A
-                        %0A
     
@@ -1043,54 +1043,29 @@
 css(
-%22
+'
 display
-%22, %22
+', '
 block
-%22
+'
 );%0A
-                        %0A
     
@@ -1444,16 +1444,17 @@
 ($scope)
+;
 %0A       
@@ -1628,32 +1628,33 @@
  %7D%0A            %7D
+;
 %0A        %7D%0A    )
@@ -1659,12 +1659,26 @@
  );%0A%0A%7D)(
+window.angular
 );%0A%0A

tag list add lint