Sha256: d61f8eb12e280bdb5756b52e6917939591b3a858f4b28cb009ecbc1746e0a68a

Contents?: true

Size: 1.2 KB

Versions: 13

Compression:

Stored size: 1.2 KB

Contents

var String_ = angular.module("StringField", []);

/*
 * <string-field></string-field> directive defination
 */
String_.directive('stringField', ["$filter", "gettext", function($filter, gettext) {

    function link(scope, element, attrs){
        var ltr = is_ltr();
        scope.element_id = "id_" + scope.field;
        scope.msg_element_id = "id_" + scope.field + "_msg";

        if (scope.on_change !== undefined) {
            // Watch event changes
            scope.$watch("model", function(newv, oldv, $scope) {
                // TODO: maybe we should pass locals to $eval
                scope.$parent.$eval(scope.on_change);
            }, true);
        }

    }
    // Actual object of <string-field> directive
    return {
        templateUrl: template("fields/string/string"),
        replace: true,
        restrict: "E",
        scope: {
            cssClasses: '=cssClass',
            // A call back to pass to field ng-change directive
            on_change: "@onChange",
            // fieldname
            field: "=fieldName",
            // Does this field is required
            required: "=",
            // Actual Angularjs ng-model
            model: '='
        },
        link: link
    };
}]);

Version data entries

13 entries across 13 versions & 1 rubygems

Version Path
faalis-0.19.0 app/assets/javascripts/faalis/dashboard/modules/fields/string.js
faalis-0.18.1 app/assets/javascripts/faalis/dashboard/modules/fields/string.js
faalis-0.18.0 app/assets/javascripts/faalis/dashboard/modules/fields/string.js
faalis-0.17.0 app/assets/javascripts/faalis/dashboard/modules/fields/string.js
faalis-0.16.3 app/assets/javascripts/faalis/dashboard/modules/fields/string.js
faalis-0.16.1 app/assets/javascripts/faalis/dashboard/modules/fields/string.js
faalis-0.16.0 app/assets/javascripts/faalis/dashboard/modules/fields/string.js
faalis-0.15.1 app/assets/javascripts/faalis/dashboard/modules/fields/string.js
faalis-0.15.0 app/assets/javascripts/faalis/dashboard/modules/fields/string.js
faalis-0.14.4 app/assets/javascripts/faalis/dashboard/modules/fields/string.js
faalis-0.14.3 app/assets/javascripts/faalis/dashboard/modules/fields/string.js
faalis-0.14.2 app/assets/javascripts/faalis/dashboard/modules/fields/string.js
faalis-0.14.0 app/assets/javascripts/faalis/dashboard/modules/fields/string.js