Afform - Ref directives to components in their own files
[civicrm-core.git] / ext / afform / admin / ang / afGuiEditor / afGuiMenuItemBackground.component.js
1 // https://civicrm.org/licensing
2 (function(angular, $, _) {
3 "use strict";
4
5 // Menu item to control the background property of a node
6 angular.module('afGuiEditor').component('afGuiMenuItemBackground', {
7 templateUrl: '~/afGuiEditor/afGuiMenuItemBackground.html',
8 bindings: {
9 node: '='
10 },
11 controller: function($scope, afAdmin) {
12 var ts = $scope.ts = CRM.ts(),
13 ctrl = this;
14
15 $scope.getSetBackgroundColor = function(color) {
16 if (!arguments.length) {
17 return afAdmin.getStyles(ctrl.node)['background-color'] || '#ffffff';
18 }
19 afAdmin.setStyle(ctrl.node, 'background-color', color);
20 };
21 }
22 });
23
24 })(angular, CRM.$, CRM._);