Skip to content

Commit 648fee7

Browse files
committed
Refactor on variable and UI (list in description)
Remove unuse code & call prettier Fix colorpicker & variable types Add correct template for colors swatch & clean some file Data services refactor Fix fonts Add boolean type Add correct type to variable Add reset button Add 3.1 version link
1 parent f9c50cd commit 648fee7

20 files changed

Lines changed: 2228 additions & 3518 deletions

3.1/index.html

Lines changed: 126 additions & 103 deletions
Large diffs are not rendered by default.

app/css/app.css

Lines changed: 11 additions & 5 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

app/css/app.css.map

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

app/js/controllers.js

Lines changed: 22 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,8 @@ function SassCtrl($scope, $http, apSass, $timeout) {
1919
importSassVariables: importSassVariables,
2020
saveCSS: saveCSS,
2121
resetSassVariables: resetSassVariables,
22-
saveSassVariables: saveSassVariables
22+
saveSassVariables: saveSassVariables,
23+
resetBaseVariable: resetBaseVariable
2324
}
2425

2526
$scope.$on('$routeChangeStart', function() {
@@ -36,22 +37,12 @@ function SassCtrl($scope, $http, apSass, $timeout) {
3637

3738
function initSassVariables() {
3839
$http.get('scss/variables.json').success(function(data) {
39-
if (window.localStorage) {
40-
// TODO: strange af
41-
for (var key in window.localStorage) {
42-
var url = 'http://pikock.github.io/bootstrap-magic/twitter-bootstrap/less/bootstrap.less:timestamp'
43-
if (key === url) {
44-
delete window.localStorage[key]
45-
}
46-
}
47-
}
48-
4940
$scope.variables = data
5041
$scope.applySass(false)
5142

52-
var keys = apSass.getKeys($scope)
53-
var icons = apSass.getUrls()
54-
var font = apSass.getFonts()
43+
var variables_keys = apSass.getKeys($scope)
44+
var icons_keys = apSass.getUrls()
45+
var fonts_keys = apSass.getFonts()
5546

5647
$timeout(function() {
5748
var $colorpicker = $('.colorpicker')
@@ -65,20 +56,27 @@ function SassCtrl($scope, $http, apSass, $timeout) {
6556
}
6657
}, 500)
6758
})
59+
$colorpicker.colorpicker().on('hide', function(ev) {
60+
var color = angular.element(this).scope().variable
61+
if (this.dataset.color !== color.value) {
62+
console.error('Wrong fucking color which is not apply because this is shit')
63+
}
64+
})
6865
$('.sassVariable').each(function(index) {
6966
var scope = angular.element(this).scope()
7067
switch (scope.variable.type) {
7168
case 'icons':
72-
var src = icons
69+
var src = icons_keys
7370
break
74-
7571
case 'font':
76-
var src = font
72+
var src = fonts_keys
73+
break
74+
case 'boolean':
75+
var src = ['true', 'false']
7776
break
78-
7977
case 'color':
8078
default:
81-
var src = keys
79+
var src = variables_keys
8280
}
8381
$(this).typeahead({
8482
source: src,
@@ -94,21 +92,18 @@ function SassCtrl($scope, $http, apSass, $timeout) {
9492

9593
function autoApplySass(event) {
9694
if ($scope.autoapplysass) {
97-
var vars = apSass.getVariables($scope, false)
98-
less.modifyVars(vars.variables)
99-
100-
WebFont.load({
101-
google: {
102-
families: vars.fonts
103-
}
104-
})
95+
apSass.applySass($scope)
10596
}
10697
}
10798

10899
function applySass(applyAll) {
109100
apSass.applySass($scope)
110101
}
111102

103+
function resetBaseVariable(variable) {
104+
variable.value = variable.default
105+
}
106+
112107
function colorpicker(type) {
113108
return type == 'color' ? true : false
114109
}

app/js/directives.js

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -4,20 +4,12 @@
44

55
angular
66
.module('bootstrapVariablesEditor.directives', [])
7-
.directive('appVersion', [
8-
'version',
9-
function(version) {
10-
return function(scope, elm, attrs) {
11-
elm.text(version)
12-
}
13-
}
14-
])
157
.directive('colorPickerApply', [
168
function() {
179
return {
1810
link: function(scope, element, attrs) {
1911
element.bind('change', function() {
20-
if (scope.variable.value.charAt(0) == '#') {
12+
if (scope.variable.value.charAt(0) === '#') {
2113
element.colorpicker('setValue', scope.variable.value)
2214
}
2315
})

app/js/filters.js

Lines changed: 2 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,5 @@
1-
'use strict';
1+
'use strict'
22

33
/* Filters */
44

5-
angular.module('bootstrapVariablesEditor.filters', []).
6-
filter('interpolate', ['version', function(version) {
7-
return function(text) {
8-
return String(text).replace(/\%VERSION\%/mg, version);
9-
}
10-
}]).
11-
filter('cssName', function() {
12-
return function(input) {
13-
return input.substring(1);
14-
}
15-
});
5+
angular.module('bootstrapVariablesEditor.filters', [])

app/js/ie/json3.min.js

Lines changed: 0 additions & 17 deletions
This file was deleted.

0 commit comments

Comments
 (0)