Skip to content

Commit 6608391

Browse files
committed
Merge pull request #28 from adyNabeelMadain/hotFix1
default custom colors
2 parents 89fbd03 + b029270 commit 6608391

File tree

3 files changed

+23
-20
lines changed

3 files changed

+23
-20
lines changed

control/design/index.html

Lines changed: 16 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
<script src="../../js/ui-bootstrap.min.js"></script>
1717
<script src="../../js/angular-color-picker.js"></script>
1818
<script src="../../js/shared.js"></script>
19-
19+
<script type="text/javascript" src="/app/scripts/framework/pluginAPI/datastoreAPI.js"></script>
2020
</head>
2121
<body ng-controller="folderPluginCtrl" ng-cloak ng-show="datastoreInitialized">
2222
<div ng-form="frmMain">
@@ -117,17 +117,17 @@
117117
</div>
118118
<div class="main col-md-9 pull-right">
119119
<div class="radio radio-primary radio-inline">
120-
<input id="appearance" type="radio" name="colorType" ng-checked="colorType=='A'" ng-click="setColorType('A')"/>
120+
<input id="appearance" type="radio" name="colorType" ng-checked="data.design.colorType=='A'" ng-click="setColorType('A')"/>
121121
<label for="appearance">Inherit Appearance Theme</label>
122122
</div>
123123
<div class="radio radio-primary radio-inline">
124-
<input id="customColor" type="radio" name="colorType" ng-checked="colorType=='C'" ng-click="setColorType('C')"/>
124+
<input id="customColor" type="radio" name="colorType" ng-checked="data.design.colorType=='C'" ng-click="setColorType('C')"/>
125125
<label for="customColor">Custom Theme</label>
126126
</div>
127127
</div>
128128
</div>
129129
<hr class="none">
130-
<div class="item clearfix row margin-bottom-twenty" ng-if="colorType=='C'">
130+
<div class="item clearfix row margin-bottom-twenty" ng-if="data.design.colorType=='C'">
131131
<div class="main col-md-9 pull-right">
132132
<div class="colorgrid pull-left">
133133
<div class="colorgrid pull-left row">
@@ -151,9 +151,9 @@
151151

152152
folderPluginApp.controller('folderPluginCtrl', ['$scope', '$window', function ($scope, $window) {
153153
$scope.defaultColors = {
154-
"backgroundColor": "",
155-
"bodyText": "",
156-
"icons": ""
154+
"backgroundColor": "#FFFFFF",
155+
"bodyText": "#32373a",
156+
"icons": "#09a3ee"
157157
};
158158

159159
$scope.availableLayouts = folderPluginShared.getLayouts();
@@ -191,7 +191,7 @@
191191
backgroundImage: {},
192192
selectedLayout: 1,
193193
backgroundblur: 0,
194-
colors: {}
194+
colorType: 'A'
195195
};
196196
}
197197
else {
@@ -204,9 +204,9 @@
204204
}
205205

206206
$scope.data.design = $scope.data.design || {};
207-
$scope.data.design.colors = $scope.data.design.colors || {};
208-
209-
$scope.colorType = angular.equals({}, $scope.data.design.colors) ? "A" : "C";
207+
if (!$scope.data.design.colorType) {
208+
$scope.data.design.colorType = "A";
209+
}
210210

211211
/*
212212
* watch for changes in data and trigger the saveData function on change
@@ -317,9 +317,11 @@
317317
};
318318

319319
$scope.setColorType = function (colorType) {
320-
if ($scope.colorType === colorType) return;
321-
$scope.colorType = colorType;
322-
$scope.data.design.colors = {};
320+
if ($scope.data.design.colorType === colorType) return;
321+
$scope.data.design.colorType = colorType;
322+
if ($scope.data.design.colorType === "C" && !$scope.data.design.colors) {
323+
$scope.data.design.colors = $scope.defaultColors;
324+
}
323325
};
324326

325327
angular.element($window).bind('mousedown', function () {

js/shared.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,8 @@ folderPluginShared.getDefaultScopeData = function () {
4343
backgroundImage: null,
4444
logoImage: null,
4545
selectedLayout: 1,
46-
backgroundblur: 0
46+
backgroundblur: 0,
47+
colorType: 'A'
4748
}
4849
};
4950
};

widget/index.html

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -22,17 +22,17 @@
2222
<body ng-cloak class="gridLayout" ng-controller="folderPluginCtrl">
2323
<style>
2424
body.gridLayout {
25-
background-color: {{data.design.colors.backgroundColor}} !important;
26-
background-image: url({{backgroundImage}}) !important;
27-
background-size: cover !important;
25+
background-color: {{data.design.colorType === 'C' && data.design.colors.backgroundColor}} !important;
26+
background-image: url({{backgroundImage}}) !important;
27+
background-size: cover !important;
2828
}
2929

3030
div.text-holder p {
31-
color: {{data.design.colors.bodyText}} !important;
31+
color: {{data.design.colorType === 'C' && data.design.colors.bodyText}} !important;
3232
}
3333

3434
.icon, .glyphicon, .icon:hover {
35-
color: {{data.design.colors.icons}} !important;
35+
color: {{data.design.colorType === 'C' && data.design.colors.icons}} !important;
3636
}
3737
</style>
3838
<div class="holder padding-zero">

0 commit comments

Comments
 (0)