{I" class:ETI"ProcessedAsset;FI"logical_path;TI"push_type/nodes.js;FI" pathname;TI"\/Users/aaron/dev/push_type_split/admin/app/assets/javascripts/push_type/nodes.js.coffee;FI"content_type;TI"application/javascript;TI" mtime;Tl+¸škTI" length;Ti· I" digest;TI"%2e6dc1f6b795f7541728fd7f6023e769;FI" source;TI"· (function() { this.app.controller('NodeFormCtrl', [ '$scope', function($scope) { $scope.typeToString = function() { return $scope.node.type.replace(/([A-Z])/g, function(m) { return " " + (m.toLowerCase()); }).trim(); }; $scope.setSlug = function() { if ($scope.node['new_record?']) { return $scope.node.slug = $scope.node.title.toLowerCase().replace(/[\s\_]/g, '-').replace(/[^\w\-]/g, ''); } }; $scope.permalinkVisibility = function() { if ($scope.node.slug != null) { return 'visible'; } else { return null; } }; $scope.saveButtonClass = function() { if ($scope.node.status === 'published') { return 'success'; } else { return 'primary'; } }; $scope.saveButtonText = function() { switch ($scope.node.status) { case 'draft': if ($scope.node['new_record?'] || ($scope.node.published_at == null)) { return 'Save draft'; } else { return "Unpublish " + ($scope.typeToString()); } break; case 'published': if ($scope.node['new_record?'] || ($scope.node.published_at == null)) { if ($scope.publishedAtMoment().toDate() > new Date()) { return 'Publish later'; } else { return 'Publish now'; } } else { return "Save " + ($scope.typeToString()); } } }; $scope.publishedDates = function() { switch ($scope.node.status) { case 'draft': return 'N/A'; case 'published': if ($scope.node['new_record?'] || ($scope.node.published_at == null)) { if ($scope.publishedAtMoment().toDate() > new Date()) { return $scope.publishedAtMoment().format('Do MMM YYYY, h:mma'); } else { return 'Immediately'; } } else { return $scope.publishedAtMoment().format('Do MMM YYYY, h:mma'); } } }; return $scope.publishedAtMoment = function() { return $scope.published_at || ($scope.published_at = $scope.node.published_at ? moment($scope.node.published_at) : moment()); }; } ]); this.app.directive('nodeStatus', function() { return function(scope, $el, attrs) { return $el.on('click', function(e) { e.preventDefault(); scope.node.status = attrs.nodeStatus; $(this).foundation('dropdown', 'close', $(this).parents('.f-dropdown')); if (!scope.$$phase) { return scope.$apply(); } }); }; }); this.app.directive('nodeDatetime', function() { return function(scope, $el, attrs) { return $el.on('change', function(e) { var dateArray; dateArray = $(this).siblings('select').andSelf().map(function() { return $(this).val(); }).get(); dateArray[1]--; scope[attrs.nodeDatetime] = moment(dateArray); if (!scope.$$phase) { return scope.$apply(); } }); }; }); }).call(this); ;TI"dependency_digest;TI"%5a9e3be066a18fdf93b5cf4b9f99af03;FI"required_paths;T[I"\/Users/aaron/dev/push_type_split/admin/app/assets/javascripts/push_type/nodes.js.coffee;FI"dependency_paths;T[{I" path;TI"\/Users/aaron/dev/push_type_split/admin/app/assets/javascripts/push_type/nodes.js.coffee;FI" mtime;TI"2014-11-18T19:15:04+00:00;TI" digest;TI"%bc915e7fe054dafcd828d4346017b6fc;FI" _version;TI"%64e62ddc273c2f5847f30d698ca14b67;F