Skip to content

Commit c5962e7

Browse files
V1.2 Updates
1 parent dc96593 commit c5962e7

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

64 files changed

+2660
-3068
lines changed

README.md

Lines changed: 236 additions & 119 deletions
Large diffs are not rendered by default.

astroid/astroid-framework/assets/css/admin.css

Lines changed: 20 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -182,7 +182,24 @@
182182

183183
.unit-picker li{
184184
cursor: pointer;
185-
line-height: 26px;
185+
line-height: 30px;
186+
}
187+
188+
.unit-picker li label{
189+
cursor: pointer;
190+
line-height: 30px;
191+
}
192+
193+
.unit-picker li label input[type="radio"]{
194+
opacity: 0;
195+
width: 0;
196+
height: 0;
197+
}
198+
199+
.unit-picker li label input[type="radio"]:checked ~ span{
200+
color: #000;
201+
font-weight: bold;
202+
border-bottom: 1px dashed;
186203
}
187204

188205
.unit-picker li.active{
@@ -199,7 +216,7 @@
199216
border: none;
200217
line-height: 24px;
201218
background: none;
202-
width: 40px;
219+
width: 50px;
203220
text-align: center;
204221
border: none !important;
205222
border-bottom: 1px dashed !important;
@@ -209,7 +226,7 @@
209226
}
210227

211228
.margin-left-50px{
212-
margin-left: 50px;
229+
margin-left: 55px;
213230
}
214231

215232
[range-slider].d-none{

astroid/astroid-framework/assets/css/astroid-framework.css

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

astroid/astroid-framework/assets/js/astroid-framework.js

Lines changed: 18 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -210,6 +210,21 @@ astroidFramework.directive('astroidsocialprofiles', ['$http', function ($http) {
210210
});
211211
$scope.profiles = _profiles;
212212
};
213+
214+
$scope.addCustomProfile = function () {
215+
var _profile = {
216+
color: '#495057',
217+
enabled: false,
218+
icon: '',
219+
icons: [],
220+
id: "custom",
221+
link: "#",
222+
title: "Custom social profile"
223+
};
224+
var _profiles = $scope.profiles;
225+
_profiles.push(angular.copy(_profile));
226+
$scope.profiles = _profiles;
227+
};
213228
}
214229
};
215230
}
@@ -267,12 +282,12 @@ astroidFramework.directive('rangeSlider', function () {
267282
setTimeout(function () {
268283
ngModel.$setViewValue(parseFloat($(element).data('slider-value')));
269284
scope.$apply();
270-
}, 10);
285+
}, 50);
271286

272287

273288
setTimeout(function () {
274289
$(element).slider(rangeConfig);
275-
$(element).slider('setValue', parseFloat($(element).data('slider-value')));
290+
//$(element).slider('setValue', parseFloat($(element).data('slider-value')));
276291
}, 100);
277292

278293

@@ -295,43 +310,6 @@ astroidFramework.directive('rangeSlider', function () {
295310
};
296311
});
297312

298-
astroidFramework.directive('unitPicker', function () {
299-
return {
300-
restrict: 'A',
301-
scope: true,
302-
require: 'ngModel',
303-
link: function ($scope, element, attrs, ngModel) {
304-
if (typeof $ == 'undefined') {
305-
var $ = jQuery;
306-
}
307-
setTimeout(function () {
308-
$(element).wrap('<div class="d-inline-block margin-left-50px" />');
309-
$(element).after('<ul class="list-inline unit-picker"><li class="list-inline-item" data-value="px">px</li><li class="list-inline-item" data-value="em">em</li><li class="list-inline-item" data-value="rem">rem</li><li class="list-inline-item" data-value="pt">pt</li><li class="list-inline-item" data-value="%">%</li></ul>');
310-
$(element).parent('div').find('.unit-picker').children('li').bind('click', function () {
311-
$(this).siblings().removeClass('active');
312-
$(this).addClass('active');
313-
$(element).val($(this).data('value'));
314-
ngModel.$setViewValue($(this).data('value'));
315-
$scope.$apply();
316-
});
317-
318-
if (ngModel.$modelValue != '') {
319-
$(element).parent('div').find('.unit-picker').children('li[data-value="' + ngModel.$modelValue + '"]').addClass('active');
320-
}
321-
322-
var setUnit = function () {
323-
var _slider = $('[data-slider-id="' + $(element).data('unit-slider-id') + '"]');
324-
$(_slider).attr('data-unit', ngModel.$modelValue);
325-
$(_slider).trigger('change');
326-
};
327-
328-
$scope.$watch(attrs['ngModel'], setUnit);
329-
330-
}, 100);
331-
},
332-
};
333-
});
334-
335313
astroidFramework.directive('colorPicker', function ($parse) {
336314
return {
337315
restrict: 'A',
@@ -342,7 +320,7 @@ astroidFramework.directive('colorPicker', function ($parse) {
342320
}
343321
var _value = $(element).val();
344322
if ($(element).hasClass('color-picker-lg')) {
345-
var spectrumConfigExtend = spectrumConfig;
323+
var spectrumConfigExtend = angular.copy(spectrumConfig);
346324
spectrumConfigExtend.replacerClassName = 'color-picker-lg';
347325
$(element).spectrum(spectrumConfigExtend);
348326
} else {

astroid/astroid-framework/assets/js/astroid.js

Lines changed: 99 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -183,14 +183,27 @@ class AstroidAdmin {
183183
this.initSidebar = function () {
184184
var _class = this;
185185
$('.sidebar-nav > li > a[data-toggle="tab"]').on('shown.bs.tab', function (e) {
186+
$('body').removeClass('show-options');
187+
if ($('body').hasClass('astroid-live-preview')) {
188+
_class.refreshPreviewScrolls();
189+
}
190+
191+
if ($(e.target).attr('data-target') == '#astroid-tab-astroid_layout') {
192+
$('body').addClass('astroid-layout-tab-selected');
193+
} else {
194+
$('body').removeClass('astroid-layout-tab-selected');
195+
}
196+
186197
$.cookie("astroid-default-tab", $(e.target).attr('data-target'));
187198
$('.sidebar-submenu').slideUp(500);
188199
$(e.target).siblings('.sidebar-submenu').slideDown(500);
189200
setTimeout(function () {
190201
$('body, html').animate({
191202
scrollTop: 0
192203
}, 0);
193-
_class.refreshScroll();
204+
if (!$('body').hasClass('astroid-live-preview')) {
205+
_class.refreshScroll();
206+
}
194207
}, 510);
195208
$('body, html').animate({
196209
scrollTop: 2
@@ -256,6 +269,63 @@ class AstroidAdmin {
256269
}, 300);
257270
};
258271

272+
this.livePreview = function () {
273+
$('body').addClass('astroid-live-preview');
274+
$('body').addClass('show-options');
275+
setTimeout(function () {
276+
Admin.livePreviewScrolls();
277+
//Admin.refreshScroll();
278+
}, 220);
279+
Admin.hideAllTabs();
280+
};
281+
282+
this.reloadPreview = function () {
283+
if ($('body').hasClass('astroid-live-preview')) {
284+
var iframe = document.getElementById('live-preview');
285+
iframe.src = iframe.src + '?ts=' + generateID();
286+
}
287+
};
288+
289+
this.hideAllTabs = function () {
290+
$('#astroid-menu li a').removeClass('active');
291+
$('#astroid-menu li a').removeClass('show');
292+
$('#astroid-menu li a').prop('aria-selected', false);
293+
};
294+
295+
this.closeLivePreview = function () {
296+
$('body').removeClass('astroid-live-preview');
297+
$('body').removeClass('show-options');
298+
setTimeout(function () {
299+
$('#astroid-content-wrapper').getNiceScroll().remove();
300+
Admin.refreshScroll();
301+
}, 220);
302+
};
303+
304+
this.livePreviewScrolls = function () {
305+
$('#astroid-content-wrapper').niceScroll({autohidemode: 'leave', cursoropacitymin: 0.4, background: 'rgba(243,243,243,1)', cursorcolor: '#4A5768', cursorwidth: '7px', cursorborderradius: 0, cursorborder: 'none'});
306+
Admin.refreshPreviewScrolls();
307+
};
308+
309+
this.setPreviewViewport = function (_class, _obj) {
310+
$('#live-preview-viewport').removeClass().addClass(_class);
311+
$('.viewport-options').find('a').removeClass('active');
312+
$(_obj).addClass('active');
313+
};
314+
315+
this.refreshPreviewScrolls = function () {
316+
setTimeout(function () {
317+
$('#astroid-content-wrapper').getNiceScroll().resize();
318+
$("#astroid-sidebar-wrapper").getNiceScroll().resize();
319+
}, 50);
320+
};
321+
322+
this.showOptions = function () {
323+
$('body').addClass('show-options');
324+
$('body').removeClass('astroid-layout-tab-selected');
325+
Admin.refreshPreviewScrolls();
326+
Admin.hideAllTabs();
327+
}
328+
259329
// form functions
260330
this.initForm = function () {
261331
$('#astroid-form').parsley({
@@ -302,6 +372,7 @@ class AstroidAdmin {
302372
return false;
303373
}
304374
Admin.saved = true;
375+
Admin.reloadPreview();
305376
if (!_export) {
306377
Admin.notify('Template Saved.', 'success');
307378
} else {
@@ -373,6 +444,7 @@ class AstroidAdmin {
373444
Admin.notify(response.message, 'error');
374445
} else {
375446
Admin.saved = true;
447+
Admin.reloadPreview();
376448
Admin.notify('Settings Imported.', 'success');
377449
}
378450
setTimeout(function () {
@@ -514,6 +586,14 @@ class AstroidAdmin {
514586
var _this = this;
515587

516588
var _defaultTab = $.cookie("astroid-default-tab");
589+
590+
591+
if (_defaultTab == '#astroid-tab-astroid_layout') {
592+
$('body').addClass('astroid-layout-tab-selected');
593+
} else {
594+
$('body').removeClass('astroid-layout-tab-selected');
595+
}
596+
517597
if (typeof _defaultTab == 'undefined') {
518598
$('#astroid-menu li:first-child a').tab('show');
519599
} else {
@@ -523,10 +603,14 @@ class AstroidAdmin {
523603
$('#astroid-menu li a[data-target="' + _defaultTab + '"]').tab('show');
524604
}
525605
}
526-
606+
//Admin.livePreview();
607+
setTimeout(function () {
608+
_this.loading(false);
609+
Admin.saved = true;
610+
}, 150);
527611
setTimeout(function () {
528612
_this.loading(false);
529-
}, 500);
613+
}, 300);
530614
this.initCodeArea();
531615
};
532616

@@ -552,7 +636,6 @@ var Admin = new AstroidAdmin();
552636
Admin.init();
553637
getGoogleFonts();
554638
initAstroidUploader();
555-
initAstroidTypographyField();
556639
$('.astroid-code-editor-exit-fs').click(function () {
557640
$(this).parent('.head').parent('.astroid-code-editor').removeClass('full-screen');
558641
});
@@ -574,6 +657,7 @@ var Admin = new AstroidAdmin();
574657
$(this).parent('div').parent('.body').parent('.astroid-preloaders-selector').parent('.astroid-preloader-field').children('.select-preloader').html($(this).html());
575658
$(this).parent('div').parent('.body').parent('.astroid-preloaders-selector').removeClass('open');
576659
});
660+
initAstroidUnitPicker();
577661
};
578662

579663
var initAstroidTypographyField = function () {
@@ -648,6 +732,9 @@ var Admin = new AstroidAdmin();
648732
_preview.css(_property, _value + _unit);
649733
_field.change(function () {
650734
var _u = $(this).attr('data-unit');
735+
if (typeof _u == 'undefined') {
736+
_u = '';
737+
}
651738
var _value = _field.val();
652739
_preview.css(_property, _value + _u);
653740
});
@@ -771,7 +858,15 @@ var Admin = new AstroidAdmin();
771858
Dropzone.autoDiscover = false;
772859
};
773860

861+
var initAstroidUnitPicker = function () {
862+
$('.unit-picker').children('li').children('label').children('input[type=radio]').change(function () {
863+
var _sliderid = $(this).data('sid');
864+
$('[data-slider-id="' + _sliderid + '"]').attr('data-unit', $(this).val()).trigger('change');
865+
});
866+
};
867+
774868
var winLoad = function () {
869+
initAstroidTypographyField();
775870
Admin.load();
776871
};
777872

0 commit comments

Comments
 (0)