FEATURE: add scripts and styles into gulpfile

This commit is contained in:
Michal Kváček
2017-02-10 02:13:03 +01:00
parent 724478d0c9
commit 0d22a14604
11 changed files with 548 additions and 74 deletions
+417
View File
@@ -0,0 +1,417 @@
a:focus {
outline: none;
}
.notification {
position: absolute;
z-index: 9999;
top: 0;
left: 0;
width: 100%;
border-radius: 0;
text-align: center;
transition: opacity .25s ease-in-out;
}
.notification:hover {
cursor: pointer;
opacity: .7;
}
.nav.nav-tabs-bordered + .tab-content {
padding-bottom: 20px !important;
}
.form-control {
margin: .3em 0;
}
.text-center {
text-align: center;
}
.text-right {
text-align: right;
}
.has-error {
color: #F44;
font-size: 13px;
display: block !important;
}
.tab-with-error {
color: red !important;
font-weight: bold;
}
.item-col-header {
outline: solid 1px;
}
.full-width {
width: 100%;
}
.content-overview.item-list {
display: table;
}
.table.content-overview td {
vertical-align: middle !important;
}
.content-overview .with-placeholder {
max-width: 3em;
}
.content-overview .placeholder {
max-height: 3em;
}
.item-list .item-actions-dropdown.active .item-actions-block {
max-width: 300px !important;
}
img {
max-width: 100%;
}
.file-preview .preview {
height: 4em;
line-height: 5em;
overflow: hidden;
}
.file-preview .preview.directory {
height: auto;
}
.users-list ul {
margin-left: -30px;
}
.users-list img {
border-radius: 50%;
padding: 3px;
}
.timeline {
list-style: none;
padding: 20px 0 20px;
position: relative;
}
.timeline:before {
top: 0;
bottom: 0;
position: absolute;
content: " ";
width: 3px;
background-color: #EEE;
left: 50%;
margin-left: -1.5px;
}
.timeline > li {
position: relative;
}
.timeline > li:before,
.timeline > li:after {
content: " ";
display: table;
}
.timeline > li:after {
clear: both;
}
.timeline > li > .timeline-panel {
width: 46%;
float: left;
border-radius: 2px;
padding: 10px;
position: relative;
-webkit-box-shadow: 0 1px 6px rgba(0, 0, 0, 0.175);
border: 1px solid #D4D4D4;
box-shadow: 0 1px 6px rgba(0, 0, 0, 0.175);
background: #FFF;
}
.timeline > li > .timeline-panel:before {
position: absolute;
top: 26px;
right: -15px;
display: inline-block;
border-top: 15px solid transparent;
border-left: 15px solid #CCC;
border-right: 0 solid #CCC;
border-bottom: 15px solid transparent;
content: " ";
}
.timeline > li > .timeline-panel:after {
position: absolute;
top: 27px;
right: -14px;
display: inline-block;
border-top: 14px solid transparent;
border-left: 14px solid #FFF;
border-right: 0 solid #FFF;
border-bottom: 14px solid transparent;
content: " ";
}
.timeline > li > .timeline-badge {
color: #FFF;
width: 30px;
height: 30px;
text-align: center;
position: absolute;
top: 26px;
left: 50%;
margin-left: -14px;
background-color: #DDD;
z-index: 100;
border-radius: 50%;
}
.timeline > li > .timeline-badge.big {
width: 40px;
height: 40px;
top: 23px;
margin-left: -20px;
}
.timeline:not(.more-space) > li {
margin-top: -25px;
}
.timeline > li:first-child {
margin-top: 0;
}
.timeline > li.timeline-inverted > .timeline-panel {
float: right;
}
.timeline > li.timeline-inverted > .timeline-panel:before {
border-left-width: 0;
border-right-width: 15px;
left: -15px;
right: auto;
}
.timeline > li.timeline-inverted > .timeline-panel:after {
border-left-width: 0;
border-right-width: 14px;
left: -14px;
right: auto;
}
.timeline-title {
margin-top: 0;
color: inherit;
}
.timeline-body > p,
.timeline-body > ul {
margin-bottom: 0;
}
.timeline-body > p + p {
margin-top: 5px;
}
@media (max-width: 767px) {
ul.timeline:before {
left: 40px;
}
ul.timeline > li > .timeline-panel {
width: calc(100% - 90px);
width: -moz-calc(100% - 90px);
width: -webkit-calc(100% - 90px);
}
ul.timeline > li > .timeline-badge {
left: 15px;
margin-left: 0;
top: 16px;
}
ul.timeline > li > .timeline-panel {
float: right;
}
ul.timeline > li > .timeline-panel:before {
border-left-width: 0;
border-right-width: 15px;
left: -15px;
right: auto;
}
ul.timeline > li > .timeline-panel:after {
border-left-width: 0;
border-right-width: 14px;
left: -14px;
right: auto;
}
}
.sidebar .divider {
height: 10px;
}
.sidebar .nav > li > ul > li a {
padding-left: 30px !important;
}
.ace-editor-container {
position: relative;
}
.ace-editor {
position: absolute !important;
width: 100%;
height: 100%;
bottom: 0;
}
.pagination {
list-style: none;
}
.pagination li {
display: inline;
padding: .5em;
}
.header-block img {
margin-right: 10px;
}
.truncate {
word-break: break-all;
}
.bold {
font-weight: bold;
}
.m-l-10 {
margin-left: 10px;
}
.m-t-15 {
margin-top: 15px;
}
.p-tb-15 {
padding-top: 15px;
padding-bottom: 15px;
}
.card .card-header .title {
line-height: 1.5em;
}
.card .card-header .title small {
padding-left: 10px;
}
.card.file-preview .card-block {
padding: 0;
height: 6em;
overflow: hidden;
}
.card.file-preview .card-block p {
padding: 1em 5px;
}
.card.file-preview .card-footer {
padding: 5px !important;
}
.card.file-preview .card-block img {
width: 100%;
}
/*.tag {*/
/*display: inline-block;*/
/*padding: 0.25em 0.4em;*/
/*font-size: 75%;*/
/*font-weight: bold;*/
/*line-height: 1;*/
/*color: #FFF;*/
/*text-align: center;*/
/*white-space: nowrap;*/
/*vertical-align: baseline;*/
/*border-radius: 0.25rem;*/
/*}*/
/*.tag:empty {*/
/*display: none;*/
/*}*/
/*.btn .tag {*/
/*position: relative;*/
/*top: -1px;*/
/*}*/
/*a.tag:focus, a.tag:hover {*/
/*color: #FFF;*/
/*text-decoration: none;*/
/*cursor: pointer;*/
/*}*/
/*.tag-pill {*/
/*padding-right: 0.6em;*/
/*padding-left: 0.6em;*/
/*border-radius: 10rem;*/
/*}*/
/*.tag-default {*/
/*background-color: #818A91;*/
/*}*/
/*.tag-default[href]:focus, .tag-default[href]:hover {*/
/*background-color: #687077;*/
/*}*/
/*.tag-success {*/
/*background-color: #5CB85C;*/
/*}*/
/*.tag-success[href]:focus, .tag-success[href]:hover {*/
/*background-color: #449D44;*/
/*}*/
/*.tag-info {*/
/*background-color: #5BC0DE;*/
/*}*/
/*.tag-info[href]:focus, .tag-info[href]:hover {*/
/*background-color: #31B0D5;*/
/*}*/
/*.tag-warning {*/
/*background-color: #F0AD4E;*/
/*}*/
/*.tag-warning[href]:focus, .tag-warning[href]:hover {*/
/*background-color: #EC971F;*/
/*}*/
/*.tag-danger {*/
/*background-color: #D9534F;*/
/*}*/
/*.tag-danger[href]:focus, .tag-danger[href]:hover {*/
/*background-color: #C9302C;*/
/*}*/
+510
View File
@@ -0,0 +1,510 @@
var config = window.config = {};
// Config reference element
var $ref = $ ("#ref");
// Configure responsive bootstrap toolkit
config.ResponsiveBootstrapToolkitVisibilityDivs = {
'xs': $ ('<div class="device-xs hidden-sm-up"></div>'),
'sm': $ ('<div class="device-sm hidden-xs-down hidden-md-up"></div>'),
'md': $ ('<div class="device-md hidden-sm-down hidden-lg-up"></div>'),
'lg': $ ('<div class="device-lg hidden-md-down hidden-xl-up"></div>'),
'xl': $ ('<div class="device-xl hidden-lg-down"></div>')
};
ResponsiveBootstrapToolkit.use ('Custom', config.ResponsiveBootstrapToolkitVisibilityDivs);
//validation configuration
config.validations = {
debug: true,
errorClass: 'has-error',
validClass: 'success',
errorElement: "span",
// add error class
highlight: function (element, errorClass, validClass) {
$ (element).parents ("div.form-group")
.addClass (errorClass)
.removeClass (validClass);
},
// add error class
unhighlight: function (element, errorClass, validClass) {
$ (element).parents (".has-error")
.removeClass (errorClass)
.addClass (validClass);
},
// submit handler
submitHandler: function (form) {
form.submit ();
}
};
//delay time configuration
config.delayTime = 50;
// chart configurations
config.chart = {};
/***********************************************
* Animation Settings
***********************************************/
function animate(options) {
var animationName = "animated " + options.name;
var animationEnd = "webkitAnimationEnd mozAnimationEnd MSAnimationEnd oanimationend animationend";
$ (options.selector)
.addClass (animationName)
.one (animationEnd,
function () {
$ (this).removeClass (animationName);
}
);
}
$ (function () {
var $itemActions = $ (".item-actions-dropdown");
$ (document).on ('click', function (e) {
if (!$ (e.target).closest ('.item-actions-dropdown').length) {
$itemActions.removeClass ('active');
}
});
$ ('.item-actions-toggle-btn').on ('click', function (e) {
e.preventDefault ();
var $thisActionList = $ (this).closest ('.item-actions-dropdown');
$itemActions.not ($thisActionList).removeClass ('active');
$thisActionList.toggleClass ('active');
});
});
// /***********************************************
// * NProgress Settings
// ***********************************************/
// var npSettings = {
// easing: 'ease',
// speed: 500
// };
//
// NProgress.configure (npSettings);
// $ (function () {
// setSameHeights ();
//
// var resizeTimer;
//
// $ (window).resize (function () {
// clearTimeout (resizeTimer);
// resizeTimer = setTimeout (setSameHeights, 150);
// });
// });
function setSameHeights($container) {
$container = $container || $ ('.sameheight-container');
var viewport = ResponsiveBootstrapToolkit.current ();
$container.each (function () {
var $items = $ (this).find (".sameheight-item");
// Get max height of items in container
var maxHeight = 0;
$items.each (function () {
$ (this).css ({height: 'auto'});
maxHeight = Math.max (maxHeight, $ (this).innerHeight ());
});
// Set heights of items
$items.each (function () {
// Ignored viewports for item
var excludedStr = $ (this).data ('exclude') || '';
var excluded = excludedStr.split (',');
// Set height of element if it's not excluded on
if (excluded.indexOf (viewport) === -1) {
$ (this).innerHeight (maxHeight);
}
});
});
}
$ (function () {
animate ({
name: 'flipInY',
selector: '.error-card > .error-title-block'
});
setTimeout (function () {
var $el = $ ('.error-card > .error-container');
animate ({
name: 'fadeInUp',
selector: $el
});
$el.addClass ('visible');
}, 500);
});
$ (function () {
$ ('#sidebar-menu, #customize-menu').metisMenu ({
activeClass: 'open'
});
$ ('#sidebar-collapse-btn').on ('click', function (event) {
event.preventDefault ();
$ ("#app").toggleClass ("sidebar-open");
});
$ ("#sidebar-overlay").on ('click', function () {
$ ("#app").removeClass ("sidebar-open");
});
});
$ (function () {
$ ('.actions-list > li').on ('click', '.check', function (e) {
e.preventDefault ();
$ (this).parents ('.tasks-item')
.find ('.checkbox')
.prop ("checked", true);
// removeActionList ();
});
});
// $ (function () {
// // set sortable options
// $ ('.images-container').sortable ({
// animation: 150,
// handle: ".control-btn.move",
// draggable: ".image-container",
// onMove: function (evt) {
// var $relatedElem = $ (evt.related);
//
// if ($relatedElem.hasClass ('add-image')) {
// return false;
// }
// }
// });
//
// var $controlsButtons = $ ('.controls');
//
// var $controlsButtonsStar = $controlsButtons.find ('.star');
//
// $controlsButtonsStar.on ('click', function (e) {
// e.preventDefault ();
//
// $controlsButtonsStar.removeClass ('active');
// $controlsButtonsStar.parents ('.image-container').removeClass ('main');
//
// $ (this).addClass ('active');
//
// $ (this).parents ('.image-container').addClass ('main');
// })
// });
$ (function () {
$ ('.nav-profile > li > a').on ('click', function () {
var $el = $ (this).next ();
animate ({
name: 'flipInX',
selector: $el
});
});
});
$ (function () {
// Local storage settings
var themeSettings = getThemeSettings ();
// Elements
var $app = $ ('#app');
var $styleLink = $ ('#theme-style');
var $customizeMenu = $ ('#customize-menu');
// Color switcher
var $customizeMenuColorBtns = $customizeMenu.find ('.color-item');
// Position switchers
var $customizeMenuRadioBtns = $customizeMenu.find ('.radio');
// /////////////////////////////////////////////////
// Initial state
// On setting event, set corresponding options
// Update customize view based on options
// Update theme based on options
/************************************************
* Initial State
*************************************************/
setThemeSettings ();
/************************************************
* Events
*************************************************/
// set theme type
$customizeMenuColorBtns.on ('click', function () {
themeSettings.themeName = $ (this).data ('theme');
setThemeSettings ();
});
$customizeMenuRadioBtns.on ('click', function () {
var optionName = $ (this).prop ('name');
themeSettings[optionName] = $ (this).val ();
setThemeSettings ();
});
function setThemeSettings() {
setThemeState ()
.delay (config.delayTime)
.queue (function (next) {
setThemeColor ();
setThemeControlsState ();
saveThemeSettings ();
$ (document).trigger ("themechange");
next ();
});
}
/************************************************
* Update theme based on options
*************************************************/
function setThemeState() {
// set theme type
if (themeSettings.themeName) {
$styleLink.attr ('href', window.cssPath + '/app-' + themeSettings.themeName + '.css');
}
else {
$styleLink.attr ('href', window.cssPath + '/app.css');
}
// App classes
$app.removeClass ('header-fixed footer-fixed sidebar-fixed');
// set header
$app.addClass (themeSettings.headerPosition);
// set footer
$app.addClass (themeSettings.footerPosition);
// set footer
$app.addClass (themeSettings.sidebarPosition);
return $app;
}
/************************************************
* Update theme controls based on options
*************************************************/
function setThemeControlsState() {
// set color switcher
$customizeMenuColorBtns.each (function () {
if ($ (this).data ('theme') === themeSettings.themeName) {
$ (this).addClass ('active');
}
else {
$ (this).removeClass ('active');
}
});
// set radio buttons
$customizeMenuRadioBtns.each (function () {
var name = $ (this).prop ('name');
var value = $ (this).val ();
if (themeSettings[name] === value) {
$ (this).prop ("checked", true);
}
else {
$ (this).prop ("checked", false);
}
});
}
/************************************************
* Update theme color
*************************************************/
function setThemeColor() {
config.chart.colorPrimary = tinycolor ($ref.find (".chart .color-primary").css ("color"));
config.chart.colorSecondary = tinycolor ($ref.find (".chart .color-secondary").css ("color"));
}
/************************************************
* Storage Functions
*************************************************/
function getThemeSettings() {
var settings = (localStorage.getItem ('themeSettings')) ? JSON.parse (localStorage.getItem ('themeSettings')) : {};
settings.headerPosition = settings.headerPosition || '';
settings.sidebarPosition = settings.sidebarPosition || '';
settings.footerPosition = settings.footerPosition || '';
return settings;
}
function saveThemeSettings() {
localStorage.setItem ('themeSettings', JSON.stringify (themeSettings));
}
});
$ (function () {
$ ("body").addClass ("loaded");
var notification = $ ('.notification');
if (notification.length) {
notification.click (function () {
$ (this).fadeOut ('fast');
});
setTimeout (function () {
notification.fadeOut (1500)
}, 5 * 1000)
}
});
/**
* Makes slug from input string
*
* @param text
* @param trimSpaces
*
* @returns {string}
*/
function slugify(text, trimSpaces) {
text = text.toString ().toLowerCase ();
if (trimSpaces)
text = text.trim ();
return text.replace (/ /g, '-')
.replace (/[àáâãäå]/g, "a")
.replace (/[čç]/g, "c")
.replace (/[ěèéêë]/g, "e")
.replace (/[ùúûüů]/g, "u")
.replace (/[ìíîï]/g, "i")
.replace (/[ňńñ]/g, "n")
.replace (/[òóôõö]/g, "o")
.replace (/[ýÿ]/g, "y")
.replace (/œ/g, "oe")
.replace (/ď/g, "d")
.replace (/ř/g, "r")
.replace (/š/g, "s")
.replace (/ž/g, "z")
.replace (/ť/g, "t")
.replace (/æ/g, "ae")
.replace (/[^a-z0-9\-]+/g, '')
.replace (/--+/g, '-');
}
// bind some custom methods
$ (document).ready (function () {
var previousTitle, previousMessage;
$ ('.confirm').click (function (e) {
var titleElement = $ ('#confirmation-title');
var messageElement = $ ('#confirmation-message');
previousTitle = titleElement.text ();
previousMessage = messageElement.text ();
var confirmTitle = $ (this).data ('title');
var confirmMessage = $ (this).data ('message');
var href = $ (this).attr ('href');
$ ('#confirm-button').attr ('href', href);
if (confirmTitle)
titleElement.text (confirmTitle);
if (confirmMessage)
messageElement.text (confirmMessage);
$ ('#confirm-modal').modal ('show');
e.preventDefault ();
});
$ ('#confirm-modal').on ('hidden.bs.modal', function () {
$ ('#confirmation-title').text (previousTitle);
$ ('#confirmation-message').text (previousMessage);
});
$ ('#lockUrl').change (function () {
$ ('.slug-source').keyup ();
});
$ ('.slug-target').keyup (function () {
$ (this).val (slugify ($ (this).val (), false));
$ ('#lockUrl').prop ('checked', true);
});
$ ('.slug-source').keyup (function () {
var source = $ (this);
var target = $ ('.slug-target');
var locked = $ ('#lockUrl');
if (!locked.is (':checked'))
target.val (slugify (source.val (), true));
});
$ (function () {
$ ('[data-toggle="tooltip"]').tooltip ()
});
// find if any error occured and mark tab with that error
$ ('.has-error').each (function () {
var error = $ (this);
var tabCard = error.closest ('.tab-pane');
$ ("#" + tabCard.prop ('id') + "-tab").addClass ('tab-with-error');
});
$('#removeTitlePhoto').click(function () {
$('#titlePhotoContainer').remove();
// $('existingTitlePhoto').val(null);
});
$('form').areYouSure();
});
// /***********************************************
// * NProgress Settings
// ***********************************************/
//
// // start load bar
// NProgress.start ();
//
// // end loading bar
// NProgress.done ();