BSBMaterial added
This commit is contained in:
16
app/assets/javascripts/BSBMaterial/pages/ui/animations.js
Normal file
16
app/assets/javascripts/BSBMaterial/pages/ui/animations.js
Normal file
@@ -0,0 +1,16 @@
|
||||
$(function () {
|
||||
$('.js-animations').bind('change', function () {
|
||||
var animation = $(this).val();
|
||||
$('.js-animating-object').animateCss(animation);
|
||||
});
|
||||
});
|
||||
|
||||
//Copied from https://github.com/daneden/animate.css
|
||||
$.fn.extend({
|
||||
animateCss: function (animationName) {
|
||||
var animationEnd = 'webkitAnimationEnd mozAnimationEnd MSAnimationEnd oanimationend animationend';
|
||||
$(this).addClass('animated ' + animationName).one(animationEnd, function() {
|
||||
$(this).removeClass('animated ' + animationName);
|
||||
});
|
||||
}
|
||||
});
|
||||
140
app/assets/javascripts/BSBMaterial/pages/ui/dialogs.js
Normal file
140
app/assets/javascripts/BSBMaterial/pages/ui/dialogs.js
Normal file
@@ -0,0 +1,140 @@
|
||||
$(function () {
|
||||
$('.js-sweetalert button').on('click', function () {
|
||||
var type = $(this).data('type');
|
||||
if (type === 'basic') {
|
||||
showBasicMessage();
|
||||
}
|
||||
else if (type === 'with-title') {
|
||||
showWithTitleMessage();
|
||||
}
|
||||
else if (type === 'success') {
|
||||
showSuccessMessage();
|
||||
}
|
||||
else if (type === 'confirm') {
|
||||
showConfirmMessage();
|
||||
}
|
||||
else if (type === 'cancel') {
|
||||
showCancelMessage();
|
||||
}
|
||||
else if (type === 'with-custom-icon') {
|
||||
showWithCustomIconMessage();
|
||||
}
|
||||
else if (type === 'html-message') {
|
||||
showHtmlMessage();
|
||||
}
|
||||
else if (type === 'autoclose-timer') {
|
||||
showAutoCloseTimerMessage();
|
||||
}
|
||||
else if (type === 'prompt') {
|
||||
showPromptMessage();
|
||||
}
|
||||
else if (type === 'ajax-loader') {
|
||||
showAjaxLoaderMessage();
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
//These codes takes from http://t4t5.github.io/sweetalert/
|
||||
function showBasicMessage() {
|
||||
swal("Here's a message!");
|
||||
}
|
||||
|
||||
function showWithTitleMessage() {
|
||||
swal("Here's a message!", "It's pretty, isn't it?");
|
||||
}
|
||||
|
||||
function showSuccessMessage() {
|
||||
swal("Good job!", "You clicked the button!", "success");
|
||||
}
|
||||
|
||||
function showConfirmMessage() {
|
||||
swal({
|
||||
title: "Are you sure?",
|
||||
text: "You will not be able to recover this imaginary file!",
|
||||
type: "warning",
|
||||
showCancelButton: true,
|
||||
confirmButtonColor: "#DD6B55",
|
||||
confirmButtonText: "Yes, delete it!",
|
||||
closeOnConfirm: false
|
||||
}, function () {
|
||||
swal("Deleted!", "Your imaginary file has been deleted.", "success");
|
||||
});
|
||||
}
|
||||
|
||||
function showCancelMessage() {
|
||||
swal({
|
||||
title: "Are you sure?",
|
||||
text: "You will not be able to recover this imaginary file!",
|
||||
type: "warning",
|
||||
showCancelButton: true,
|
||||
confirmButtonColor: "#DD6B55",
|
||||
confirmButtonText: "Yes, delete it!",
|
||||
cancelButtonText: "No, cancel plx!",
|
||||
closeOnConfirm: false,
|
||||
closeOnCancel: false
|
||||
}, function (isConfirm) {
|
||||
if (isConfirm) {
|
||||
swal("Deleted!", "Your imaginary file has been deleted.", "success");
|
||||
} else {
|
||||
swal("Cancelled", "Your imaginary file is safe :)", "error");
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
function showWithCustomIconMessage() {
|
||||
swal({
|
||||
title: "Sweet!",
|
||||
text: "Here's a custom image.",
|
||||
imageUrl: "../../images/thumbs-up.png"
|
||||
});
|
||||
}
|
||||
|
||||
function showHtmlMessage() {
|
||||
swal({
|
||||
title: "HTML <small>Title</small>!",
|
||||
text: "A custom <span style=\"color: #CC0000\">html<span> message.",
|
||||
html: true
|
||||
});
|
||||
}
|
||||
|
||||
function showAutoCloseTimerMessage() {
|
||||
swal({
|
||||
title: "Auto close alert!",
|
||||
text: "I will close in 2 seconds.",
|
||||
timer: 2000,
|
||||
showConfirmButton: false
|
||||
});
|
||||
}
|
||||
|
||||
function showPromptMessage() {
|
||||
swal({
|
||||
title: "An input!",
|
||||
text: "Write something interesting:",
|
||||
type: "input",
|
||||
showCancelButton: true,
|
||||
closeOnConfirm: false,
|
||||
animation: "slide-from-top",
|
||||
inputPlaceholder: "Write something"
|
||||
}, function (inputValue) {
|
||||
if (inputValue === false) return false;
|
||||
if (inputValue === "") {
|
||||
swal.showInputError("You need to write something!"); return false
|
||||
}
|
||||
swal("Nice!", "You wrote: " + inputValue, "success");
|
||||
});
|
||||
}
|
||||
|
||||
function showAjaxLoaderMessage() {
|
||||
swal({
|
||||
title: "Ajax request example",
|
||||
text: "Submit to run ajax request",
|
||||
type: "info",
|
||||
showCancelButton: true,
|
||||
closeOnConfirm: false,
|
||||
showLoaderOnConfirm: true,
|
||||
}, function () {
|
||||
setTimeout(function () {
|
||||
swal("Ajax request finished!");
|
||||
}, 2000);
|
||||
});
|
||||
}
|
||||
7
app/assets/javascripts/BSBMaterial/pages/ui/modals.js
Normal file
7
app/assets/javascripts/BSBMaterial/pages/ui/modals.js
Normal file
@@ -0,0 +1,7 @@
|
||||
$(function () {
|
||||
$('.js-modal-buttons .btn').on('click', function () {
|
||||
var color = $(this).data('color');
|
||||
$('#mdModal .modal-content').removeAttr('class').addClass('modal-content modal-col-' + color);
|
||||
$('#mdModal').modal('show');
|
||||
});
|
||||
});
|
||||
47
app/assets/javascripts/BSBMaterial/pages/ui/notifications.js
Normal file
47
app/assets/javascripts/BSBMaterial/pages/ui/notifications.js
Normal file
@@ -0,0 +1,47 @@
|
||||
$(function () {
|
||||
$('.jsdemo-notification-button button').on('click', function () {
|
||||
var placementFrom = $(this).data('placement-from');
|
||||
var placementAlign = $(this).data('placement-align');
|
||||
var animateEnter = $(this).data('animate-enter');
|
||||
var animateExit = $(this).data('animate-exit');
|
||||
var colorName = $(this).data('color-name');
|
||||
|
||||
showNotification(colorName, null, placementFrom, placementAlign, animateEnter, animateExit);
|
||||
});
|
||||
});
|
||||
|
||||
function showNotification(colorName, text, placementFrom, placementAlign, animateEnter, animateExit) {
|
||||
if (colorName === null || colorName === '') { colorName = 'bg-black'; }
|
||||
if (text === null || text === '') { text = 'Turning standard Bootstrap alerts'; }
|
||||
if (animateEnter === null || animateEnter === '') { animateEnter = 'animated fadeInDown'; }
|
||||
if (animateExit === null || animateExit === '') { animateExit = 'animated fadeOutUp'; }
|
||||
var allowDismiss = true;
|
||||
|
||||
$.notify({
|
||||
message: text
|
||||
},
|
||||
{
|
||||
type: colorName,
|
||||
allow_dismiss: allowDismiss,
|
||||
newest_on_top: true,
|
||||
timer: 1000,
|
||||
placement: {
|
||||
from: placementFrom,
|
||||
align: placementAlign
|
||||
},
|
||||
animate: {
|
||||
enter: animateEnter,
|
||||
exit: animateExit
|
||||
},
|
||||
template: '<div data-notify="container" class="bootstrap-notify-container alert alert-dismissible {0} ' + (allowDismiss ? "p-r-35" : "") + '" role="alert">' +
|
||||
'<button type="button" aria-hidden="true" class="close" data-notify="dismiss">×</button>' +
|
||||
'<span data-notify="icon"></span> ' +
|
||||
'<span data-notify="title">{1}</span> ' +
|
||||
'<span data-notify="message">{2}</span>' +
|
||||
'<div class="progress" data-notify="progressbar">' +
|
||||
'<div class="progress-bar progress-bar-{0}" role="progressbar" aria-valuenow="0" aria-valuemin="0" aria-valuemax="100" style="width: 0%;"></div>' +
|
||||
'</div>' +
|
||||
'<a href="{3}" target="{4}" data-notify="url"></a>' +
|
||||
'</div>'
|
||||
});
|
||||
}
|
||||
93
app/assets/javascripts/BSBMaterial/pages/ui/range-sliders.js
Normal file
93
app/assets/javascripts/BSBMaterial/pages/ui/range-sliders.js
Normal file
@@ -0,0 +1,93 @@
|
||||
$(function () {
|
||||
//Taken from http://ionden.com/a/plugins/ion.rangeSlider/demo.html
|
||||
|
||||
$("#range_01").ionRangeSlider();
|
||||
|
||||
$("#range_02").ionRangeSlider({
|
||||
min: 100,
|
||||
max: 1000,
|
||||
from: 550
|
||||
});
|
||||
|
||||
$("#range_03").ionRangeSlider({
|
||||
type: "double",
|
||||
grid: true,
|
||||
min: 0,
|
||||
max: 1000,
|
||||
from: 200,
|
||||
to: 800,
|
||||
prefix: "$"
|
||||
});
|
||||
|
||||
$("#range_04").ionRangeSlider({
|
||||
type: "double",
|
||||
grid: true,
|
||||
min: -1000,
|
||||
max: 1000,
|
||||
from: -500,
|
||||
to: 500
|
||||
});
|
||||
|
||||
$("#range_05").ionRangeSlider({
|
||||
type: "double",
|
||||
grid: true,
|
||||
min: -1000,
|
||||
max: 1000,
|
||||
from: -500,
|
||||
to: 500,
|
||||
step: 250
|
||||
});
|
||||
|
||||
|
||||
$("#range_06").ionRangeSlider({
|
||||
type: "double",
|
||||
grid: true,
|
||||
min: -12.8,
|
||||
max: 12.8,
|
||||
from: -3.2,
|
||||
to: 3.2,
|
||||
step: 0.1
|
||||
});
|
||||
|
||||
$("#range_07").ionRangeSlider({
|
||||
type: "double",
|
||||
grid: true,
|
||||
from: 1,
|
||||
to: 5,
|
||||
values: [0, 10, 100, 1000, 10000, 100000, 1000000]
|
||||
});
|
||||
|
||||
|
||||
$("#range_08").ionRangeSlider({
|
||||
grid: true,
|
||||
from: 5,
|
||||
values: [
|
||||
"zero", "one",
|
||||
"two", "three",
|
||||
"four", "five",
|
||||
"six", "seven",
|
||||
"eight", "nine",
|
||||
"ten"
|
||||
]
|
||||
});
|
||||
|
||||
$("#range_09").ionRangeSlider({
|
||||
grid: true,
|
||||
from: 3,
|
||||
values: [
|
||||
"January", "February", "March",
|
||||
"April", "May", "June",
|
||||
"July", "August", "September",
|
||||
"October", "November", "December"
|
||||
]
|
||||
});
|
||||
|
||||
$("#range_10").ionRangeSlider({
|
||||
grid: true,
|
||||
min: 1000,
|
||||
max: 1000000,
|
||||
from: 100000,
|
||||
step: 1000,
|
||||
prettify_enabled: false
|
||||
});
|
||||
});
|
||||
@@ -0,0 +1,10 @@
|
||||
$(function () {
|
||||
$('.dd').nestable();
|
||||
|
||||
$('.dd').on('change', function () {
|
||||
var $this = $(this);
|
||||
var serializedData = window.JSON.stringify($($this).nestable('serialize'));
|
||||
|
||||
$this.parents('div.body').find('textarea').val(serializedData);
|
||||
});
|
||||
});
|
||||
@@ -0,0 +1,9 @@
|
||||
$(function () {
|
||||
//Tooltip
|
||||
$('[data-toggle="tooltip"]').tooltip({
|
||||
container: 'body'
|
||||
});
|
||||
|
||||
//Popover
|
||||
$('[data-toggle="popover"]').popover();
|
||||
})
|
||||
Reference in New Issue
Block a user