most app updates
This commit is contained in:
parent
7ca8d7fc02
commit
d670e38b40
Binary file not shown.
|
After Width: | Height: | Size: 1.1 KiB |
|
|
@ -11,4 +11,4 @@
|
|||
// about supported directives.
|
||||
//
|
||||
//= require rails-ujs
|
||||
//= require turbolinks
|
||||
// require turbolinks
|
||||
|
|
|
|||
|
|
@ -0,0 +1,41 @@
|
|||
(function($) {
|
||||
"use strict"; // Start of use strict
|
||||
|
||||
// Floating label headings for the contact form
|
||||
$("body").on("input propertychange", ".floating-label-form-group", function(e) {
|
||||
$(this).toggleClass("floating-label-form-group-with-value", !!$(e.target).val());
|
||||
}).on("focus", ".floating-label-form-group", function() {
|
||||
$(this).addClass("floating-label-form-group-with-focus");
|
||||
}).on("blur", ".floating-label-form-group", function() {
|
||||
$(this).removeClass("floating-label-form-group-with-focus");
|
||||
});
|
||||
|
||||
// Show the navbar when the page is scrolled up
|
||||
var MQL = 992;
|
||||
|
||||
//primary navigation slide-in effect
|
||||
if ($(window).width() > MQL) {
|
||||
var headerHeight = $('#mainNav').height();
|
||||
$(window).on('scroll', {
|
||||
previousTop: 0
|
||||
},
|
||||
function() {
|
||||
var currentTop = $(window).scrollTop();
|
||||
//check if user is scrolling up
|
||||
if (currentTop < this.previousTop) {
|
||||
//if scrolling up...
|
||||
if (currentTop > 0 && $('#mainNav').hasClass('is-fixed')) {
|
||||
$('#mainNav').addClass('is-visible');
|
||||
} else {
|
||||
$('#mainNav').removeClass('is-visible is-fixed');
|
||||
}
|
||||
} else if (currentTop > this.previousTop) {
|
||||
//if scrolling down...
|
||||
$('#mainNav').removeClass('is-visible');
|
||||
if (currentTop > headerHeight && !$('#mainNav').hasClass('is-fixed')) $('#mainNav').addClass('is-fixed');
|
||||
}
|
||||
this.previousTop = currentTop;
|
||||
});
|
||||
}
|
||||
|
||||
})(jQuery); // End of use strict
|
||||
|
|
@ -0,0 +1,75 @@
|
|||
$(function() {
|
||||
|
||||
$("#contactForm input,#contactForm textarea").jqBootstrapValidation({
|
||||
preventSubmit: true,
|
||||
submitError: function($form, event, errors) {
|
||||
// additional error messages or events
|
||||
},
|
||||
submitSuccess: function($form, event) {
|
||||
event.preventDefault(); // prevent default submit behaviour
|
||||
// get values from FORM
|
||||
var name = $("input#name").val();
|
||||
var email = $("input#email").val();
|
||||
var phone = $("input#phone").val();
|
||||
var message = $("textarea#message").val();
|
||||
var firstName = name; // For Success/Failure Message
|
||||
// Check for white space in name for Success/Fail message
|
||||
if (firstName.indexOf(' ') >= 0) {
|
||||
firstName = name.split(' ').slice(0, -1).join(' ');
|
||||
}
|
||||
$this = $("#sendMessageButton");
|
||||
$this.prop("disabled", true); // Disable submit button until AJAX call is complete to prevent duplicate messages
|
||||
$.ajax({
|
||||
url: "././mail/contact_me.php",
|
||||
type: "POST",
|
||||
data: {
|
||||
name: name,
|
||||
phone: phone,
|
||||
email: email,
|
||||
message: message
|
||||
},
|
||||
cache: false,
|
||||
success: function() {
|
||||
// Success message
|
||||
$('#success').html("<div class='alert alert-success'>");
|
||||
$('#success > .alert-success').html("<button type='button' class='close' data-dismiss='alert' aria-hidden='true'>×")
|
||||
.append("</button>");
|
||||
$('#success > .alert-success')
|
||||
.append("<strong>Your message has been sent. </strong>");
|
||||
$('#success > .alert-success')
|
||||
.append('</div>');
|
||||
//clear all fields
|
||||
$('#contactForm').trigger("reset");
|
||||
},
|
||||
error: function() {
|
||||
// Fail message
|
||||
$('#success').html("<div class='alert alert-danger'>");
|
||||
$('#success > .alert-danger').html("<button type='button' class='close' data-dismiss='alert' aria-hidden='true'>×")
|
||||
.append("</button>");
|
||||
$('#success > .alert-danger').append($("<strong>").text("Sorry " + firstName + ", it seems that my mail server is not responding. Please try again later!"));
|
||||
$('#success > .alert-danger').append('</div>');
|
||||
//clear all fields
|
||||
$('#contactForm').trigger("reset");
|
||||
},
|
||||
complete: function() {
|
||||
setTimeout(function() {
|
||||
$this.prop("disabled", false); // Re-enable submit button when AJAX call is complete
|
||||
}, 1000);
|
||||
}
|
||||
});
|
||||
},
|
||||
filter: function() {
|
||||
return $(this).is(":visible");
|
||||
},
|
||||
});
|
||||
|
||||
$("a[data-toggle=\"tab\"]").click(function(e) {
|
||||
e.preventDefault();
|
||||
$(this).tab("show");
|
||||
});
|
||||
});
|
||||
|
||||
/*When clicking on Full hide fail/success boxes */
|
||||
$('#name').focus(function() {
|
||||
$('#success').html('');
|
||||
});
|
||||
|
|
@ -0,0 +1,937 @@
|
|||
/* jqBootstrapValidation
|
||||
* A plugin for automating validation on Twitter Bootstrap formatted forms.
|
||||
*
|
||||
* v1.3.6
|
||||
*
|
||||
* License: MIT <http://opensource.org/licenses/mit-license.php> - see LICENSE file
|
||||
*
|
||||
* http://ReactiveRaven.github.com/jqBootstrapValidation/
|
||||
*/
|
||||
|
||||
(function($) {
|
||||
|
||||
var createdElements = [];
|
||||
|
||||
var defaults = {
|
||||
options: {
|
||||
prependExistingHelpBlock: false,
|
||||
sniffHtml: true, // sniff for 'required', 'maxlength', etc
|
||||
preventSubmit: true, // stop the form submit event from firing if validation fails
|
||||
submitError: false, // function called if there is an error when trying to submit
|
||||
submitSuccess: false, // function called just before a successful submit event is sent to the server
|
||||
semanticallyStrict: false, // set to true to tidy up generated HTML output
|
||||
autoAdd: {
|
||||
helpBlocks: true
|
||||
},
|
||||
filter: function() {
|
||||
// return $(this).is(":visible"); // only validate elements you can see
|
||||
return true; // validate everything
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
init: function(options) {
|
||||
|
||||
var settings = $.extend(true, {}, defaults);
|
||||
|
||||
settings.options = $.extend(true, settings.options, options);
|
||||
|
||||
var $siblingElements = this;
|
||||
|
||||
var uniqueForms = $.unique(
|
||||
$siblingElements.map(function() {
|
||||
return $(this).parents("form")[0];
|
||||
}).toArray()
|
||||
);
|
||||
|
||||
$(uniqueForms).bind("submit", function(e) {
|
||||
var $form = $(this);
|
||||
var warningsFound = 0;
|
||||
var $inputs = $form.find("input,textarea,select").not("[type=submit],[type=image]").filter(settings.options.filter);
|
||||
$inputs.trigger("submit.validation").trigger("validationLostFocus.validation");
|
||||
|
||||
$inputs.each(function(i, el) {
|
||||
var $this = $(el),
|
||||
$controlGroup = $this.parents(".form-group").first();
|
||||
if (
|
||||
$controlGroup.hasClass("warning")
|
||||
) {
|
||||
$controlGroup.removeClass("warning").addClass("error");
|
||||
warningsFound++;
|
||||
}
|
||||
});
|
||||
|
||||
$inputs.trigger("validationLostFocus.validation");
|
||||
|
||||
if (warningsFound) {
|
||||
if (settings.options.preventSubmit) {
|
||||
e.preventDefault();
|
||||
}
|
||||
$form.addClass("error");
|
||||
if ($.isFunction(settings.options.submitError)) {
|
||||
settings.options.submitError($form, e, $inputs.jqBootstrapValidation("collectErrors", true));
|
||||
}
|
||||
} else {
|
||||
$form.removeClass("error");
|
||||
if ($.isFunction(settings.options.submitSuccess)) {
|
||||
settings.options.submitSuccess($form, e);
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
return this.each(function() {
|
||||
|
||||
// Get references to everything we're interested in
|
||||
var $this = $(this),
|
||||
$controlGroup = $this.parents(".form-group").first(),
|
||||
$helpBlock = $controlGroup.find(".help-block").first(),
|
||||
$form = $this.parents("form").first(),
|
||||
validatorNames = [];
|
||||
|
||||
// create message container if not exists
|
||||
if (!$helpBlock.length && settings.options.autoAdd && settings.options.autoAdd.helpBlocks) {
|
||||
$helpBlock = $('<div class="help-block" />');
|
||||
$controlGroup.find('.controls').append($helpBlock);
|
||||
createdElements.push($helpBlock[0]);
|
||||
}
|
||||
|
||||
// =============================================================
|
||||
// SNIFF HTML FOR VALIDATORS
|
||||
// =============================================================
|
||||
|
||||
// *snort sniff snuffle*
|
||||
|
||||
if (settings.options.sniffHtml) {
|
||||
var message = "";
|
||||
// ---------------------------------------------------------
|
||||
// PATTERN
|
||||
// ---------------------------------------------------------
|
||||
if ($this.attr("pattern") !== undefined) {
|
||||
message = "Not in the expected format<!-- data-validation-pattern-message to override -->";
|
||||
if ($this.data("validationPatternMessage")) {
|
||||
message = $this.data("validationPatternMessage");
|
||||
}
|
||||
$this.data("validationPatternMessage", message);
|
||||
$this.data("validationPatternRegex", $this.attr("pattern"));
|
||||
}
|
||||
// ---------------------------------------------------------
|
||||
// MAX
|
||||
// ---------------------------------------------------------
|
||||
if ($this.attr("max") !== undefined || $this.attr("aria-valuemax") !== undefined) {
|
||||
var max = ($this.attr("max") !== undefined ? $this.attr("max") : $this.attr("aria-valuemax"));
|
||||
message = "Too high: Maximum of '" + max + "'<!-- data-validation-max-message to override -->";
|
||||
if ($this.data("validationMaxMessage")) {
|
||||
message = $this.data("validationMaxMessage");
|
||||
}
|
||||
$this.data("validationMaxMessage", message);
|
||||
$this.data("validationMaxMax", max);
|
||||
}
|
||||
// ---------------------------------------------------------
|
||||
// MIN
|
||||
// ---------------------------------------------------------
|
||||
if ($this.attr("min") !== undefined || $this.attr("aria-valuemin") !== undefined) {
|
||||
var min = ($this.attr("min") !== undefined ? $this.attr("min") : $this.attr("aria-valuemin"));
|
||||
message = "Too low: Minimum of '" + min + "'<!-- data-validation-min-message to override -->";
|
||||
if ($this.data("validationMinMessage")) {
|
||||
message = $this.data("validationMinMessage");
|
||||
}
|
||||
$this.data("validationMinMessage", message);
|
||||
$this.data("validationMinMin", min);
|
||||
}
|
||||
// ---------------------------------------------------------
|
||||
// MAXLENGTH
|
||||
// ---------------------------------------------------------
|
||||
if ($this.attr("maxlength") !== undefined) {
|
||||
message = "Too long: Maximum of '" + $this.attr("maxlength") + "' characters<!-- data-validation-maxlength-message to override -->";
|
||||
if ($this.data("validationMaxlengthMessage")) {
|
||||
message = $this.data("validationMaxlengthMessage");
|
||||
}
|
||||
$this.data("validationMaxlengthMessage", message);
|
||||
$this.data("validationMaxlengthMaxlength", $this.attr("maxlength"));
|
||||
}
|
||||
// ---------------------------------------------------------
|
||||
// MINLENGTH
|
||||
// ---------------------------------------------------------
|
||||
if ($this.attr("minlength") !== undefined) {
|
||||
message = "Too short: Minimum of '" + $this.attr("minlength") + "' characters<!-- data-validation-minlength-message to override -->";
|
||||
if ($this.data("validationMinlengthMessage")) {
|
||||
message = $this.data("validationMinlengthMessage");
|
||||
}
|
||||
$this.data("validationMinlengthMessage", message);
|
||||
$this.data("validationMinlengthMinlength", $this.attr("minlength"));
|
||||
}
|
||||
// ---------------------------------------------------------
|
||||
// REQUIRED
|
||||
// ---------------------------------------------------------
|
||||
if ($this.attr("required") !== undefined || $this.attr("aria-required") !== undefined) {
|
||||
message = settings.builtInValidators.required.message;
|
||||
if ($this.data("validationRequiredMessage")) {
|
||||
message = $this.data("validationRequiredMessage");
|
||||
}
|
||||
$this.data("validationRequiredMessage", message);
|
||||
}
|
||||
// ---------------------------------------------------------
|
||||
// NUMBER
|
||||
// ---------------------------------------------------------
|
||||
if ($this.attr("type") !== undefined && $this.attr("type").toLowerCase() === "number") {
|
||||
message = settings.builtInValidators.number.message;
|
||||
if ($this.data("validationNumberMessage")) {
|
||||
message = $this.data("validationNumberMessage");
|
||||
}
|
||||
$this.data("validationNumberMessage", message);
|
||||
}
|
||||
// ---------------------------------------------------------
|
||||
// EMAIL
|
||||
// ---------------------------------------------------------
|
||||
if ($this.attr("type") !== undefined && $this.attr("type").toLowerCase() === "email") {
|
||||
message = "Not a valid email address<!-- data-validator-validemail-message to override -->";
|
||||
if ($this.data("validationValidemailMessage")) {
|
||||
message = $this.data("validationValidemailMessage");
|
||||
} else if ($this.data("validationEmailMessage")) {
|
||||
message = $this.data("validationEmailMessage");
|
||||
}
|
||||
$this.data("validationValidemailMessage", message);
|
||||
}
|
||||
// ---------------------------------------------------------
|
||||
// MINCHECKED
|
||||
// ---------------------------------------------------------
|
||||
if ($this.attr("minchecked") !== undefined) {
|
||||
message = "Not enough options checked; Minimum of '" + $this.attr("minchecked") + "' required<!-- data-validation-minchecked-message to override -->";
|
||||
if ($this.data("validationMincheckedMessage")) {
|
||||
message = $this.data("validationMincheckedMessage");
|
||||
}
|
||||
$this.data("validationMincheckedMessage", message);
|
||||
$this.data("validationMincheckedMinchecked", $this.attr("minchecked"));
|
||||
}
|
||||
// ---------------------------------------------------------
|
||||
// MAXCHECKED
|
||||
// ---------------------------------------------------------
|
||||
if ($this.attr("maxchecked") !== undefined) {
|
||||
message = "Too many options checked; Maximum of '" + $this.attr("maxchecked") + "' required<!-- data-validation-maxchecked-message to override -->";
|
||||
if ($this.data("validationMaxcheckedMessage")) {
|
||||
message = $this.data("validationMaxcheckedMessage");
|
||||
}
|
||||
$this.data("validationMaxcheckedMessage", message);
|
||||
$this.data("validationMaxcheckedMaxchecked", $this.attr("maxchecked"));
|
||||
}
|
||||
}
|
||||
|
||||
// =============================================================
|
||||
// COLLECT VALIDATOR NAMES
|
||||
// =============================================================
|
||||
|
||||
// Get named validators
|
||||
if ($this.data("validation") !== undefined) {
|
||||
validatorNames = $this.data("validation").split(",");
|
||||
}
|
||||
|
||||
// Get extra ones defined on the element's data attributes
|
||||
$.each($this.data(), function(i, el) {
|
||||
var parts = i.replace(/([A-Z])/g, ",$1").split(",");
|
||||
if (parts[0] === "validation" && parts[1]) {
|
||||
validatorNames.push(parts[1]);
|
||||
}
|
||||
});
|
||||
|
||||
// =============================================================
|
||||
// NORMALISE VALIDATOR NAMES
|
||||
// =============================================================
|
||||
|
||||
var validatorNamesToInspect = validatorNames;
|
||||
var newValidatorNamesToInspect = [];
|
||||
|
||||
do // repeatedly expand 'shortcut' validators into their real validators
|
||||
{
|
||||
// Uppercase only the first letter of each name
|
||||
$.each(validatorNames, function(i, el) {
|
||||
validatorNames[i] = formatValidatorName(el);
|
||||
});
|
||||
|
||||
// Remove duplicate validator names
|
||||
validatorNames = $.unique(validatorNames);
|
||||
|
||||
// Pull out the new validator names from each shortcut
|
||||
newValidatorNamesToInspect = [];
|
||||
$.each(validatorNamesToInspect, function(i, el) {
|
||||
if ($this.data("validation" + el + "Shortcut") !== undefined) {
|
||||
// Are these custom validators?
|
||||
// Pull them out!
|
||||
$.each($this.data("validation" + el + "Shortcut").split(","), function(i2, el2) {
|
||||
newValidatorNamesToInspect.push(el2);
|
||||
});
|
||||
} else if (settings.builtInValidators[el.toLowerCase()]) {
|
||||
// Is this a recognised built-in?
|
||||
// Pull it out!
|
||||
var validator = settings.builtInValidators[el.toLowerCase()];
|
||||
if (validator.type.toLowerCase() === "shortcut") {
|
||||
$.each(validator.shortcut.split(","), function(i, el) {
|
||||
el = formatValidatorName(el);
|
||||
newValidatorNamesToInspect.push(el);
|
||||
validatorNames.push(el);
|
||||
});
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
validatorNamesToInspect = newValidatorNamesToInspect;
|
||||
|
||||
} while (validatorNamesToInspect.length > 0)
|
||||
|
||||
// =============================================================
|
||||
// SET UP VALIDATOR ARRAYS
|
||||
// =============================================================
|
||||
|
||||
var validators = {};
|
||||
|
||||
$.each(validatorNames, function(i, el) {
|
||||
// Set up the 'override' message
|
||||
var message = $this.data("validation" + el + "Message");
|
||||
var hasOverrideMessage = (message !== undefined);
|
||||
var foundValidator = false;
|
||||
message =
|
||||
(
|
||||
message ?
|
||||
message :
|
||||
"'" + el + "' validation failed <!-- Add attribute 'data-validation-" + el.toLowerCase() + "-message' to input to change this message -->"
|
||||
);
|
||||
|
||||
$.each(
|
||||
settings.validatorTypes,
|
||||
function(validatorType, validatorTemplate) {
|
||||
if (validators[validatorType] === undefined) {
|
||||
validators[validatorType] = [];
|
||||
}
|
||||
if (!foundValidator && $this.data("validation" + el + formatValidatorName(validatorTemplate.name)) !== undefined) {
|
||||
validators[validatorType].push(
|
||||
$.extend(
|
||||
true, {
|
||||
name: formatValidatorName(validatorTemplate.name),
|
||||
message: message
|
||||
},
|
||||
validatorTemplate.init($this, el)
|
||||
)
|
||||
);
|
||||
foundValidator = true;
|
||||
}
|
||||
}
|
||||
);
|
||||
|
||||
if (!foundValidator && settings.builtInValidators[el.toLowerCase()]) {
|
||||
|
||||
var validator = $.extend(true, {}, settings.builtInValidators[el.toLowerCase()]);
|
||||
if (hasOverrideMessage) {
|
||||
validator.message = message;
|
||||
}
|
||||
var validatorType = validator.type.toLowerCase();
|
||||
|
||||
if (validatorType === "shortcut") {
|
||||
foundValidator = true;
|
||||
} else {
|
||||
$.each(
|
||||
settings.validatorTypes,
|
||||
function(validatorTemplateType, validatorTemplate) {
|
||||
if (validators[validatorTemplateType] === undefined) {
|
||||
validators[validatorTemplateType] = [];
|
||||
}
|
||||
if (!foundValidator && validatorType === validatorTemplateType.toLowerCase()) {
|
||||
$this.data("validation" + el + formatValidatorName(validatorTemplate.name), validator[validatorTemplate.name.toLowerCase()]);
|
||||
validators[validatorType].push(
|
||||
$.extend(
|
||||
validator,
|
||||
validatorTemplate.init($this, el)
|
||||
)
|
||||
);
|
||||
foundValidator = true;
|
||||
}
|
||||
}
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
if (!foundValidator) {
|
||||
$.error("Cannot find validation info for '" + el + "'");
|
||||
}
|
||||
});
|
||||
|
||||
// =============================================================
|
||||
// STORE FALLBACK VALUES
|
||||
// =============================================================
|
||||
|
||||
$helpBlock.data(
|
||||
"original-contents",
|
||||
(
|
||||
$helpBlock.data("original-contents") ?
|
||||
$helpBlock.data("original-contents") :
|
||||
$helpBlock.html()
|
||||
)
|
||||
);
|
||||
|
||||
$helpBlock.data(
|
||||
"original-role",
|
||||
(
|
||||
$helpBlock.data("original-role") ?
|
||||
$helpBlock.data("original-role") :
|
||||
$helpBlock.attr("role")
|
||||
)
|
||||
);
|
||||
|
||||
$controlGroup.data(
|
||||
"original-classes",
|
||||
(
|
||||
$controlGroup.data("original-clases") ?
|
||||
$controlGroup.data("original-classes") :
|
||||
$controlGroup.attr("class")
|
||||
)
|
||||
);
|
||||
|
||||
$this.data(
|
||||
"original-aria-invalid",
|
||||
(
|
||||
$this.data("original-aria-invalid") ?
|
||||
$this.data("original-aria-invalid") :
|
||||
$this.attr("aria-invalid")
|
||||
)
|
||||
);
|
||||
|
||||
// =============================================================
|
||||
// VALIDATION
|
||||
// =============================================================
|
||||
|
||||
$this.bind(
|
||||
"validation.validation",
|
||||
function(event, params) {
|
||||
|
||||
var value = getValue($this);
|
||||
|
||||
// Get a list of the errors to apply
|
||||
var errorsFound = [];
|
||||
|
||||
$.each(validators, function(validatorType, validatorTypeArray) {
|
||||
if (value || value.length || (params && params.includeEmpty) || (!!settings.validatorTypes[validatorType].blockSubmit && params && !!params.submitting)) {
|
||||
$.each(validatorTypeArray, function(i, validator) {
|
||||
if (settings.validatorTypes[validatorType].validate($this, value, validator)) {
|
||||
errorsFound.push(validator.message);
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
return errorsFound;
|
||||
}
|
||||
);
|
||||
|
||||
$this.bind(
|
||||
"getValidators.validation",
|
||||
function() {
|
||||
return validators;
|
||||
}
|
||||
);
|
||||
|
||||
// =============================================================
|
||||
// WATCH FOR CHANGES
|
||||
// =============================================================
|
||||
$this.bind(
|
||||
"submit.validation",
|
||||
function() {
|
||||
return $this.triggerHandler("change.validation", {
|
||||
submitting: true
|
||||
});
|
||||
}
|
||||
);
|
||||
$this.bind(
|
||||
[
|
||||
"keyup",
|
||||
"focus",
|
||||
"blur",
|
||||
"click",
|
||||
"keydown",
|
||||
"keypress",
|
||||
"change"
|
||||
].join(".validation ") + ".validation",
|
||||
function(e, params) {
|
||||
|
||||
var value = getValue($this);
|
||||
|
||||
var errorsFound = [];
|
||||
|
||||
$controlGroup.find("input,textarea,select").each(function(i, el) {
|
||||
var oldCount = errorsFound.length;
|
||||
$.each($(el).triggerHandler("validation.validation", params), function(j, message) {
|
||||
errorsFound.push(message);
|
||||
});
|
||||
if (errorsFound.length > oldCount) {
|
||||
$(el).attr("aria-invalid", "true");
|
||||
} else {
|
||||
var original = $this.data("original-aria-invalid");
|
||||
$(el).attr("aria-invalid", (original !== undefined ? original : false));
|
||||
}
|
||||
});
|
||||
|
||||
$form.find("input,select,textarea").not($this).not("[name=\"" + $this.attr("name") + "\"]").trigger("validationLostFocus.validation");
|
||||
|
||||
errorsFound = $.unique(errorsFound.sort());
|
||||
|
||||
// Were there any errors?
|
||||
if (errorsFound.length) {
|
||||
// Better flag it up as a warning.
|
||||
$controlGroup.removeClass("success error").addClass("warning");
|
||||
|
||||
// How many errors did we find?
|
||||
if (settings.options.semanticallyStrict && errorsFound.length === 1) {
|
||||
// Only one? Being strict? Just output it.
|
||||
$helpBlock.html(errorsFound[0] +
|
||||
(settings.options.prependExistingHelpBlock ? $helpBlock.data("original-contents") : ""));
|
||||
} else {
|
||||
// Multiple? Being sloppy? Glue them together into an UL.
|
||||
$helpBlock.html("<ul role=\"alert\"><li>" + errorsFound.join("</li><li>") + "</li></ul>" +
|
||||
(settings.options.prependExistingHelpBlock ? $helpBlock.data("original-contents") : ""));
|
||||
}
|
||||
} else {
|
||||
$controlGroup.removeClass("warning error success");
|
||||
if (value.length > 0) {
|
||||
$controlGroup.addClass("success");
|
||||
}
|
||||
$helpBlock.html($helpBlock.data("original-contents"));
|
||||
}
|
||||
|
||||
if (e.type === "blur") {
|
||||
$controlGroup.removeClass("success");
|
||||
}
|
||||
}
|
||||
);
|
||||
$this.bind("validationLostFocus.validation", function() {
|
||||
$controlGroup.removeClass("success");
|
||||
});
|
||||
});
|
||||
},
|
||||
destroy: function() {
|
||||
|
||||
return this.each(
|
||||
function() {
|
||||
|
||||
var
|
||||
$this = $(this),
|
||||
$controlGroup = $this.parents(".form-group").first(),
|
||||
$helpBlock = $controlGroup.find(".help-block").first();
|
||||
|
||||
// remove our events
|
||||
$this.unbind('.validation'); // events are namespaced.
|
||||
// reset help text
|
||||
$helpBlock.html($helpBlock.data("original-contents"));
|
||||
// reset classes
|
||||
$controlGroup.attr("class", $controlGroup.data("original-classes"));
|
||||
// reset aria
|
||||
$this.attr("aria-invalid", $this.data("original-aria-invalid"));
|
||||
// reset role
|
||||
$helpBlock.attr("role", $this.data("original-role"));
|
||||
// remove all elements we created
|
||||
if (createdElements.indexOf($helpBlock[0]) > -1) {
|
||||
$helpBlock.remove();
|
||||
}
|
||||
|
||||
}
|
||||
);
|
||||
|
||||
},
|
||||
collectErrors: function(includeEmpty) {
|
||||
|
||||
var errorMessages = {};
|
||||
this.each(function(i, el) {
|
||||
var $el = $(el);
|
||||
var name = $el.attr("name");
|
||||
var errors = $el.triggerHandler("validation.validation", {
|
||||
includeEmpty: true
|
||||
});
|
||||
errorMessages[name] = $.extend(true, errors, errorMessages[name]);
|
||||
});
|
||||
|
||||
$.each(errorMessages, function(i, el) {
|
||||
if (el.length === 0) {
|
||||
delete errorMessages[i];
|
||||
}
|
||||
});
|
||||
|
||||
return errorMessages;
|
||||
|
||||
},
|
||||
hasErrors: function() {
|
||||
|
||||
var errorMessages = [];
|
||||
|
||||
this.each(function(i, el) {
|
||||
errorMessages = errorMessages.concat(
|
||||
$(el).triggerHandler("getValidators.validation") ? $(el).triggerHandler("validation.validation", {
|
||||
submitting: true
|
||||
}) : []
|
||||
);
|
||||
});
|
||||
|
||||
return (errorMessages.length > 0);
|
||||
},
|
||||
override: function(newDefaults) {
|
||||
defaults = $.extend(true, defaults, newDefaults);
|
||||
}
|
||||
},
|
||||
validatorTypes: {
|
||||
callback: {
|
||||
name: "callback",
|
||||
init: function($this, name) {
|
||||
return {
|
||||
validatorName: name,
|
||||
callback: $this.data("validation" + name + "Callback"),
|
||||
lastValue: $this.val(),
|
||||
lastValid: true,
|
||||
lastFinished: true
|
||||
};
|
||||
},
|
||||
validate: function($this, value, validator) {
|
||||
if (validator.lastValue === value && validator.lastFinished) {
|
||||
return !validator.lastValid;
|
||||
}
|
||||
|
||||
if (validator.lastFinished === true) {
|
||||
validator.lastValue = value;
|
||||
validator.lastValid = true;
|
||||
validator.lastFinished = false;
|
||||
|
||||
var rrjqbvValidator = validator;
|
||||
var rrjqbvThis = $this;
|
||||
executeFunctionByName(
|
||||
validator.callback,
|
||||
window,
|
||||
$this,
|
||||
value,
|
||||
function(data) {
|
||||
if (rrjqbvValidator.lastValue === data.value) {
|
||||
rrjqbvValidator.lastValid = data.valid;
|
||||
if (data.message) {
|
||||
rrjqbvValidator.message = data.message;
|
||||
}
|
||||
rrjqbvValidator.lastFinished = true;
|
||||
rrjqbvThis.data("validation" + rrjqbvValidator.validatorName + "Message", rrjqbvValidator.message);
|
||||
// Timeout is set to avoid problems with the events being considered 'already fired'
|
||||
setTimeout(function() {
|
||||
rrjqbvThis.trigger("change.validation");
|
||||
}, 1); // doesn't need a long timeout, just long enough for the event bubble to burst
|
||||
}
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
return false;
|
||||
|
||||
}
|
||||
},
|
||||
ajax: {
|
||||
name: "ajax",
|
||||
init: function($this, name) {
|
||||
return {
|
||||
validatorName: name,
|
||||
url: $this.data("validation" + name + "Ajax"),
|
||||
lastValue: $this.val(),
|
||||
lastValid: true,
|
||||
lastFinished: true
|
||||
};
|
||||
},
|
||||
validate: function($this, value, validator) {
|
||||
if ("" + validator.lastValue === "" + value && validator.lastFinished === true) {
|
||||
return validator.lastValid === false;
|
||||
}
|
||||
|
||||
if (validator.lastFinished === true) {
|
||||
validator.lastValue = value;
|
||||
validator.lastValid = true;
|
||||
validator.lastFinished = false;
|
||||
$.ajax({
|
||||
url: validator.url,
|
||||
data: "value=" + value + "&field=" + $this.attr("name"),
|
||||
dataType: "json",
|
||||
success: function(data) {
|
||||
if ("" + validator.lastValue === "" + data.value) {
|
||||
validator.lastValid = !!(data.valid);
|
||||
if (data.message) {
|
||||
validator.message = data.message;
|
||||
}
|
||||
validator.lastFinished = true;
|
||||
$this.data("validation" + validator.validatorName + "Message", validator.message);
|
||||
// Timeout is set to avoid problems with the events being considered 'already fired'
|
||||
setTimeout(function() {
|
||||
$this.trigger("change.validation");
|
||||
}, 1); // doesn't need a long timeout, just long enough for the event bubble to burst
|
||||
}
|
||||
},
|
||||
failure: function() {
|
||||
validator.lastValid = true;
|
||||
validator.message = "ajax call failed";
|
||||
validator.lastFinished = true;
|
||||
$this.data("validation" + validator.validatorName + "Message", validator.message);
|
||||
// Timeout is set to avoid problems with the events being considered 'already fired'
|
||||
setTimeout(function() {
|
||||
$this.trigger("change.validation");
|
||||
}, 1); // doesn't need a long timeout, just long enough for the event bubble to burst
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
return false;
|
||||
|
||||
}
|
||||
},
|
||||
regex: {
|
||||
name: "regex",
|
||||
init: function($this, name) {
|
||||
return {
|
||||
regex: regexFromString($this.data("validation" + name + "Regex"))
|
||||
};
|
||||
},
|
||||
validate: function($this, value, validator) {
|
||||
return (!validator.regex.test(value) && !validator.negative) ||
|
||||
(validator.regex.test(value) && validator.negative);
|
||||
}
|
||||
},
|
||||
required: {
|
||||
name: "required",
|
||||
init: function($this, name) {
|
||||
return {};
|
||||
},
|
||||
validate: function($this, value, validator) {
|
||||
return !!(value.length === 0 && !validator.negative) ||
|
||||
!!(value.length > 0 && validator.negative);
|
||||
},
|
||||
blockSubmit: true
|
||||
},
|
||||
match: {
|
||||
name: "match",
|
||||
init: function($this, name) {
|
||||
var element = $this.parents("form").first().find("[name=\"" + $this.data("validation" + name + "Match") + "\"]").first();
|
||||
element.bind("validation.validation", function() {
|
||||
$this.trigger("change.validation", {
|
||||
submitting: true
|
||||
});
|
||||
});
|
||||
return {
|
||||
"element": element
|
||||
};
|
||||
},
|
||||
validate: function($this, value, validator) {
|
||||
return (value !== validator.element.val() && !validator.negative) ||
|
||||
(value === validator.element.val() && validator.negative);
|
||||
},
|
||||
blockSubmit: true
|
||||
},
|
||||
max: {
|
||||
name: "max",
|
||||
init: function($this, name) {
|
||||
return {
|
||||
max: $this.data("validation" + name + "Max")
|
||||
};
|
||||
},
|
||||
validate: function($this, value, validator) {
|
||||
return (parseFloat(value, 10) > parseFloat(validator.max, 10) && !validator.negative) ||
|
||||
(parseFloat(value, 10) <= parseFloat(validator.max, 10) && validator.negative);
|
||||
}
|
||||
},
|
||||
min: {
|
||||
name: "min",
|
||||
init: function($this, name) {
|
||||
return {
|
||||
min: $this.data("validation" + name + "Min")
|
||||
};
|
||||
},
|
||||
validate: function($this, value, validator) {
|
||||
return (parseFloat(value) < parseFloat(validator.min) && !validator.negative) ||
|
||||
(parseFloat(value) >= parseFloat(validator.min) && validator.negative);
|
||||
}
|
||||
},
|
||||
maxlength: {
|
||||
name: "maxlength",
|
||||
init: function($this, name) {
|
||||
return {
|
||||
maxlength: $this.data("validation" + name + "Maxlength")
|
||||
};
|
||||
},
|
||||
validate: function($this, value, validator) {
|
||||
return ((value.length > validator.maxlength) && !validator.negative) ||
|
||||
((value.length <= validator.maxlength) && validator.negative);
|
||||
}
|
||||
},
|
||||
minlength: {
|
||||
name: "minlength",
|
||||
init: function($this, name) {
|
||||
return {
|
||||
minlength: $this.data("validation" + name + "Minlength")
|
||||
};
|
||||
},
|
||||
validate: function($this, value, validator) {
|
||||
return ((value.length < validator.minlength) && !validator.negative) ||
|
||||
((value.length >= validator.minlength) && validator.negative);
|
||||
}
|
||||
},
|
||||
maxchecked: {
|
||||
name: "maxchecked",
|
||||
init: function($this, name) {
|
||||
var elements = $this.parents("form").first().find("[name=\"" + $this.attr("name") + "\"]");
|
||||
elements.bind("click.validation", function() {
|
||||
$this.trigger("change.validation", {
|
||||
includeEmpty: true
|
||||
});
|
||||
});
|
||||
return {
|
||||
maxchecked: $this.data("validation" + name + "Maxchecked"),
|
||||
elements: elements
|
||||
};
|
||||
},
|
||||
validate: function($this, value, validator) {
|
||||
return (validator.elements.filter(":checked").length > validator.maxchecked && !validator.negative) ||
|
||||
(validator.elements.filter(":checked").length <= validator.maxchecked && validator.negative);
|
||||
},
|
||||
blockSubmit: true
|
||||
},
|
||||
minchecked: {
|
||||
name: "minchecked",
|
||||
init: function($this, name) {
|
||||
var elements = $this.parents("form").first().find("[name=\"" + $this.attr("name") + "\"]");
|
||||
elements.bind("click.validation", function() {
|
||||
$this.trigger("change.validation", {
|
||||
includeEmpty: true
|
||||
});
|
||||
});
|
||||
return {
|
||||
minchecked: $this.data("validation" + name + "Minchecked"),
|
||||
elements: elements
|
||||
};
|
||||
},
|
||||
validate: function($this, value, validator) {
|
||||
return (validator.elements.filter(":checked").length < validator.minchecked && !validator.negative) ||
|
||||
(validator.elements.filter(":checked").length >= validator.minchecked && validator.negative);
|
||||
},
|
||||
blockSubmit: true
|
||||
}
|
||||
},
|
||||
builtInValidators: {
|
||||
email: {
|
||||
name: "Email",
|
||||
type: "shortcut",
|
||||
shortcut: "validemail"
|
||||
},
|
||||
validemail: {
|
||||
name: "Validemail",
|
||||
type: "regex",
|
||||
regex: "[A-Za-z0-9._%+-]+@[A-Za-z0-9.-]+\\\.[A-Za-z]{2,4}",
|
||||
message: "Not a valid email address<!-- data-validator-validemail-message to override -->"
|
||||
},
|
||||
passwordagain: {
|
||||
name: "Passwordagain",
|
||||
type: "match",
|
||||
match: "password",
|
||||
message: "Does not match the given password<!-- data-validator-paswordagain-message to override -->"
|
||||
},
|
||||
positive: {
|
||||
name: "Positive",
|
||||
type: "shortcut",
|
||||
shortcut: "number,positivenumber"
|
||||
},
|
||||
negative: {
|
||||
name: "Negative",
|
||||
type: "shortcut",
|
||||
shortcut: "number,negativenumber"
|
||||
},
|
||||
number: {
|
||||
name: "Number",
|
||||
type: "regex",
|
||||
regex: "([+-]?\\\d+(\\\.\\\d*)?([eE][+-]?[0-9]+)?)?",
|
||||
message: "Must be a number<!-- data-validator-number-message to override -->"
|
||||
},
|
||||
integer: {
|
||||
name: "Integer",
|
||||
type: "regex",
|
||||
regex: "[+-]?\\\d+",
|
||||
message: "No decimal places allowed<!-- data-validator-integer-message to override -->"
|
||||
},
|
||||
positivenumber: {
|
||||
name: "Positivenumber",
|
||||
type: "min",
|
||||
min: 0,
|
||||
message: "Must be a positive number<!-- data-validator-positivenumber-message to override -->"
|
||||
},
|
||||
negativenumber: {
|
||||
name: "Negativenumber",
|
||||
type: "max",
|
||||
max: 0,
|
||||
message: "Must be a negative number<!-- data-validator-negativenumber-message to override -->"
|
||||
},
|
||||
required: {
|
||||
name: "Required",
|
||||
type: "required",
|
||||
message: "This is required<!-- data-validator-required-message to override -->"
|
||||
},
|
||||
checkone: {
|
||||
name: "Checkone",
|
||||
type: "minchecked",
|
||||
minchecked: 1,
|
||||
message: "Check at least one option<!-- data-validation-checkone-message to override -->"
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
var formatValidatorName = function(name) {
|
||||
return name
|
||||
.toLowerCase()
|
||||
.replace(
|
||||
/(^|\s)([a-z])/g,
|
||||
function(m, p1, p2) {
|
||||
return p1 + p2.toUpperCase();
|
||||
}
|
||||
);
|
||||
};
|
||||
|
||||
var getValue = function($this) {
|
||||
// Extract the value we're talking about
|
||||
var value = $this.val();
|
||||
var type = $this.attr("type");
|
||||
if (type === "checkbox") {
|
||||
value = ($this.is(":checked") ? value : "");
|
||||
}
|
||||
if (type === "radio") {
|
||||
value = ($('input[name="' + $this.attr("name") + '"]:checked').length > 0 ? value : "");
|
||||
}
|
||||
return value;
|
||||
};
|
||||
|
||||
function regexFromString(inputstring) {
|
||||
return new RegExp("^" + inputstring + "$");
|
||||
}
|
||||
|
||||
/**
|
||||
* Thanks to Jason Bunting via StackOverflow.com
|
||||
*
|
||||
* http://stackoverflow.com/questions/359788/how-to-execute-a-javascript-function-when-i-have-its-name-as-a-string#answer-359910
|
||||
* Short link: http://tinyurl.com/executeFunctionByName
|
||||
**/
|
||||
function executeFunctionByName(functionName, context /*, args*/ ) {
|
||||
var args = Array.prototype.slice.call(arguments).splice(2);
|
||||
var namespaces = functionName.split(".");
|
||||
var func = namespaces.pop();
|
||||
for (var i = 0; i < namespaces.length; i++) {
|
||||
context = context[namespaces[i]];
|
||||
}
|
||||
return context[func].apply(this, args);
|
||||
}
|
||||
|
||||
$.fn.jqBootstrapValidation = function(method) {
|
||||
|
||||
if (defaults.methods[method]) {
|
||||
return defaults.methods[method].apply(this, Array.prototype.slice.call(arguments, 1));
|
||||
} else if (typeof method === 'object' || !method) {
|
||||
return defaults.methods.init.apply(this, arguments);
|
||||
} else {
|
||||
$.error('Method ' + method + ' does not exist on jQuery.jqBootstrapValidation');
|
||||
return null;
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
$.jqBootstrapValidation = function(options) {
|
||||
$(":input").not("[type=image],[type=submit]").jqBootstrapValidation.apply(this, arguments);
|
||||
};
|
||||
|
||||
})(jQuery);
|
||||
|
|
@ -0,0 +1,693 @@
|
|||
/* ===================================================
|
||||
* jquery-sortable.js v0.9.13
|
||||
* http://johnny.github.com/jquery-sortable/
|
||||
* ===================================================
|
||||
* Copyright (c) 2012 Jonas von Andrian
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions are met:
|
||||
* * Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* * Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* * The name of the author may not be used to endorse or promote products
|
||||
* derived from this software without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
|
||||
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
* DISCLAIMED. IN NO EVENT SHALL <COPYRIGHT HOLDER> BE LIABLE FOR ANY
|
||||
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
||||
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
* ========================================================== */
|
||||
|
||||
|
||||
!function ( $, window, pluginName, undefined){
|
||||
var containerDefaults = {
|
||||
// If true, items can be dragged from this container
|
||||
drag: true,
|
||||
// If true, items can be droped onto this container
|
||||
drop: true,
|
||||
// Exclude items from being draggable, if the
|
||||
// selector matches the item
|
||||
exclude: "",
|
||||
// If true, search for nested containers within an item.If you nest containers,
|
||||
// either the original selector with which you call the plugin must only match the top containers,
|
||||
// or you need to specify a group (see the bootstrap nav example)
|
||||
nested: true,
|
||||
// If true, the items are assumed to be arranged vertically
|
||||
vertical: true
|
||||
}, // end container defaults
|
||||
groupDefaults = {
|
||||
// This is executed after the placeholder has been moved.
|
||||
// $closestItemOrContainer contains the closest item, the placeholder
|
||||
// has been put at or the closest empty Container, the placeholder has
|
||||
// been appended to.
|
||||
afterMove: function ($placeholder, container, $closestItemOrContainer) {
|
||||
},
|
||||
// The exact css path between the container and its items, e.g. "> tbody"
|
||||
containerPath: "",
|
||||
// The css selector of the containers
|
||||
containerSelector: "ol, ul",
|
||||
// Distance the mouse has to travel to start dragging
|
||||
distance: 0,
|
||||
// Time in milliseconds after mousedown until dragging should start.
|
||||
// This option can be used to prevent unwanted drags when clicking on an element.
|
||||
delay: 0,
|
||||
// The css selector of the drag handle
|
||||
handle: "",
|
||||
// The exact css path between the item and its subcontainers.
|
||||
// It should only match the immediate items of a container.
|
||||
// No item of a subcontainer should be matched. E.g. for ol>div>li the itemPath is "> div"
|
||||
itemPath: "",
|
||||
// The css selector of the items
|
||||
itemSelector: "li",
|
||||
// The class given to "body" while an item is being dragged
|
||||
bodyClass: "dragging",
|
||||
// The class giving to an item while being dragged
|
||||
draggedClass: "dragged",
|
||||
// Check if the dragged item may be inside the container.
|
||||
// Use with care, since the search for a valid container entails a depth first search
|
||||
// and may be quite expensive.
|
||||
isValidTarget: function ($item, container) {
|
||||
return true
|
||||
},
|
||||
// Executed before onDrop if placeholder is detached.
|
||||
// This happens if pullPlaceholder is set to false and the drop occurs outside a container.
|
||||
onCancel: function ($item, container, _super, event) {
|
||||
},
|
||||
// Executed at the beginning of a mouse move event.
|
||||
// The Placeholder has not been moved yet.
|
||||
onDrag: function ($item, position, _super, event) {
|
||||
$item.css(position)
|
||||
},
|
||||
// Called after the drag has been started,
|
||||
// that is the mouse button is being held down and
|
||||
// the mouse is moving.
|
||||
// The container is the closest initialized container.
|
||||
// Therefore it might not be the container, that actually contains the item.
|
||||
onDragStart: function ($item, container, _super, event) {
|
||||
$item.css({
|
||||
height: $item.outerHeight(),
|
||||
width: $item.outerWidth()
|
||||
})
|
||||
$item.addClass(container.group.options.draggedClass)
|
||||
$("body").addClass(container.group.options.bodyClass)
|
||||
},
|
||||
// Called when the mouse button is being released
|
||||
onDrop: function ($item, container, _super, event) {
|
||||
$item.removeClass(container.group.options.draggedClass).removeAttr("style")
|
||||
$("body").removeClass(container.group.options.bodyClass)
|
||||
},
|
||||
// Called on mousedown. If falsy value is returned, the dragging will not start.
|
||||
// Ignore if element clicked is input, select or textarea
|
||||
onMousedown: function ($item, _super, event) {
|
||||
if (!event.target.nodeName.match(/^(input|select|textarea)$/i)) {
|
||||
event.preventDefault()
|
||||
return true
|
||||
}
|
||||
},
|
||||
// The class of the placeholder (must match placeholder option markup)
|
||||
placeholderClass: "placeholder",
|
||||
// Template for the placeholder. Can be any valid jQuery input
|
||||
// e.g. a string, a DOM element.
|
||||
// The placeholder must have the class "placeholder"
|
||||
placeholder: '<li class="placeholder"></li>',
|
||||
// If true, the position of the placeholder is calculated on every mousemove.
|
||||
// If false, it is only calculated when the mouse is above a container.
|
||||
pullPlaceholder: true,
|
||||
// Specifies serialization of the container group.
|
||||
// The pair $parent/$children is either container/items or item/subcontainers.
|
||||
serialize: function ($parent, $children, parentIsContainer) {
|
||||
var result = $.extend({}, $parent.data())
|
||||
|
||||
if(parentIsContainer)
|
||||
return [$children]
|
||||
else if ($children[0]){
|
||||
result.children = $children
|
||||
}
|
||||
|
||||
delete result.subContainers
|
||||
delete result.sortable
|
||||
|
||||
return result
|
||||
},
|
||||
// Set tolerance while dragging. Positive values decrease sensitivity,
|
||||
// negative values increase it.
|
||||
tolerance: 0
|
||||
}, // end group defaults
|
||||
containerGroups = {},
|
||||
groupCounter = 0,
|
||||
emptyBox = {
|
||||
left: 0,
|
||||
top: 0,
|
||||
bottom: 0,
|
||||
right:0
|
||||
},
|
||||
eventNames = {
|
||||
start: "touchstart.sortable mousedown.sortable",
|
||||
drop: "touchend.sortable touchcancel.sortable mouseup.sortable",
|
||||
drag: "touchmove.sortable mousemove.sortable",
|
||||
scroll: "scroll.sortable"
|
||||
},
|
||||
subContainerKey = "subContainers"
|
||||
|
||||
/*
|
||||
* a is Array [left, right, top, bottom]
|
||||
* b is array [left, top]
|
||||
*/
|
||||
function d(a,b) {
|
||||
var x = Math.max(0, a[0] - b[0], b[0] - a[1]),
|
||||
y = Math.max(0, a[2] - b[1], b[1] - a[3])
|
||||
return x+y;
|
||||
}
|
||||
|
||||
function setDimensions(array, dimensions, tolerance, useOffset) {
|
||||
var i = array.length,
|
||||
offsetMethod = useOffset ? "offset" : "position"
|
||||
tolerance = tolerance || 0
|
||||
|
||||
while(i--){
|
||||
var el = array[i].el ? array[i].el : $(array[i]),
|
||||
// use fitting method
|
||||
pos = el[offsetMethod]()
|
||||
pos.left += parseInt(el.css('margin-left'), 10)
|
||||
pos.top += parseInt(el.css('margin-top'),10)
|
||||
dimensions[i] = [
|
||||
pos.left - tolerance,
|
||||
pos.left + el.outerWidth() + tolerance,
|
||||
pos.top - tolerance,
|
||||
pos.top + el.outerHeight() + tolerance
|
||||
]
|
||||
}
|
||||
}
|
||||
|
||||
function getRelativePosition(pointer, element) {
|
||||
var offset = element.offset()
|
||||
return {
|
||||
left: pointer.left - offset.left,
|
||||
top: pointer.top - offset.top
|
||||
}
|
||||
}
|
||||
|
||||
function sortByDistanceDesc(dimensions, pointer, lastPointer) {
|
||||
pointer = [pointer.left, pointer.top]
|
||||
lastPointer = lastPointer && [lastPointer.left, lastPointer.top]
|
||||
|
||||
var dim,
|
||||
i = dimensions.length,
|
||||
distances = []
|
||||
|
||||
while(i--){
|
||||
dim = dimensions[i]
|
||||
distances[i] = [i,d(dim,pointer), lastPointer && d(dim, lastPointer)]
|
||||
}
|
||||
distances = distances.sort(function (a,b) {
|
||||
return b[1] - a[1] || b[2] - a[2] || b[0] - a[0]
|
||||
})
|
||||
|
||||
// last entry is the closest
|
||||
return distances
|
||||
}
|
||||
|
||||
function ContainerGroup(options) {
|
||||
this.options = $.extend({}, groupDefaults, options)
|
||||
this.containers = []
|
||||
|
||||
if(!this.options.rootGroup){
|
||||
this.scrollProxy = $.proxy(this.scroll, this)
|
||||
this.dragProxy = $.proxy(this.drag, this)
|
||||
this.dropProxy = $.proxy(this.drop, this)
|
||||
this.placeholder = $(this.options.placeholder)
|
||||
|
||||
if(!options.isValidTarget)
|
||||
this.options.isValidTarget = undefined
|
||||
}
|
||||
}
|
||||
|
||||
ContainerGroup.get = function (options) {
|
||||
if(!containerGroups[options.group]) {
|
||||
if(options.group === undefined)
|
||||
options.group = groupCounter ++
|
||||
|
||||
containerGroups[options.group] = new ContainerGroup(options)
|
||||
}
|
||||
|
||||
return containerGroups[options.group]
|
||||
}
|
||||
|
||||
ContainerGroup.prototype = {
|
||||
dragInit: function (e, itemContainer) {
|
||||
this.$document = $(itemContainer.el[0].ownerDocument)
|
||||
|
||||
// get item to drag
|
||||
var closestItem = $(e.target).closest(this.options.itemSelector);
|
||||
// using the length of this item, prevents the plugin from being started if there is no handle being clicked on.
|
||||
// this may also be helpful in instantiating multidrag.
|
||||
if (closestItem.length) {
|
||||
this.item = closestItem;
|
||||
this.itemContainer = itemContainer;
|
||||
if (this.item.is(this.options.exclude) || !this.options.onMousedown(this.item, groupDefaults.onMousedown, e)) {
|
||||
return;
|
||||
}
|
||||
this.setPointer(e);
|
||||
this.toggleListeners('on');
|
||||
this.setupDelayTimer();
|
||||
this.dragInitDone = true;
|
||||
}
|
||||
},
|
||||
drag: function (e) {
|
||||
if(!this.dragging){
|
||||
if(!this.distanceMet(e) || !this.delayMet)
|
||||
return
|
||||
|
||||
this.options.onDragStart(this.item, this.itemContainer, groupDefaults.onDragStart, e)
|
||||
this.item.before(this.placeholder)
|
||||
this.dragging = true
|
||||
}
|
||||
|
||||
this.setPointer(e)
|
||||
// place item under the cursor
|
||||
this.options.onDrag(this.item,
|
||||
getRelativePosition(this.pointer, this.item.offsetParent()),
|
||||
groupDefaults.onDrag,
|
||||
e)
|
||||
|
||||
var p = this.getPointer(e),
|
||||
box = this.sameResultBox,
|
||||
t = this.options.tolerance
|
||||
|
||||
if(!box || box.top - t > p.top || box.bottom + t < p.top || box.left - t > p.left || box.right + t < p.left)
|
||||
if(!this.searchValidTarget()){
|
||||
this.placeholder.detach()
|
||||
this.lastAppendedItem = undefined
|
||||
}
|
||||
},
|
||||
drop: function (e) {
|
||||
this.toggleListeners('off')
|
||||
|
||||
this.dragInitDone = false
|
||||
|
||||
if(this.dragging){
|
||||
// processing Drop, check if placeholder is detached
|
||||
if(this.placeholder.closest("html")[0]){
|
||||
this.placeholder.before(this.item).detach()
|
||||
} else {
|
||||
this.options.onCancel(this.item, this.itemContainer, groupDefaults.onCancel, e)
|
||||
}
|
||||
this.options.onDrop(this.item, this.getContainer(this.item), groupDefaults.onDrop, e)
|
||||
|
||||
// cleanup
|
||||
this.clearDimensions()
|
||||
this.clearOffsetParent()
|
||||
this.lastAppendedItem = this.sameResultBox = undefined
|
||||
this.dragging = false
|
||||
}
|
||||
},
|
||||
searchValidTarget: function (pointer, lastPointer) {
|
||||
if(!pointer){
|
||||
pointer = this.relativePointer || this.pointer
|
||||
lastPointer = this.lastRelativePointer || this.lastPointer
|
||||
}
|
||||
|
||||
var distances = sortByDistanceDesc(this.getContainerDimensions(),
|
||||
pointer,
|
||||
lastPointer),
|
||||
i = distances.length
|
||||
|
||||
while(i--){
|
||||
var index = distances[i][0],
|
||||
distance = distances[i][1]
|
||||
|
||||
if(!distance || this.options.pullPlaceholder){
|
||||
var container = this.containers[index]
|
||||
if(!container.disabled){
|
||||
if(!this.$getOffsetParent()){
|
||||
var offsetParent = container.getItemOffsetParent()
|
||||
pointer = getRelativePosition(pointer, offsetParent)
|
||||
lastPointer = getRelativePosition(lastPointer, offsetParent)
|
||||
}
|
||||
if(container.searchValidTarget(pointer, lastPointer))
|
||||
return true
|
||||
}
|
||||
}
|
||||
}
|
||||
if(this.sameResultBox)
|
||||
this.sameResultBox = undefined
|
||||
},
|
||||
movePlaceholder: function (container, item, method, sameResultBox) {
|
||||
var lastAppendedItem = this.lastAppendedItem
|
||||
if(!sameResultBox && lastAppendedItem && lastAppendedItem[0] === item[0])
|
||||
return;
|
||||
|
||||
item[method](this.placeholder)
|
||||
this.lastAppendedItem = item
|
||||
this.sameResultBox = sameResultBox
|
||||
this.options.afterMove(this.placeholder, container, item)
|
||||
},
|
||||
getContainerDimensions: function () {
|
||||
if(!this.containerDimensions)
|
||||
setDimensions(this.containers, this.containerDimensions = [], this.options.tolerance, !this.$getOffsetParent())
|
||||
return this.containerDimensions
|
||||
},
|
||||
getContainer: function (element) {
|
||||
return element.closest(this.options.containerSelector).data(pluginName)
|
||||
},
|
||||
$getOffsetParent: function () {
|
||||
if(this.offsetParent === undefined){
|
||||
var i = this.containers.length - 1,
|
||||
offsetParent = this.containers[i].getItemOffsetParent()
|
||||
|
||||
if(!this.options.rootGroup){
|
||||
while(i--){
|
||||
if(offsetParent[0] != this.containers[i].getItemOffsetParent()[0]){
|
||||
// If every container has the same offset parent,
|
||||
// use position() which is relative to this parent,
|
||||
// otherwise use offset()
|
||||
// compare #setDimensions
|
||||
offsetParent = false
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
this.offsetParent = offsetParent
|
||||
}
|
||||
return this.offsetParent
|
||||
},
|
||||
setPointer: function (e) {
|
||||
var pointer = this.getPointer(e)
|
||||
|
||||
if(this.$getOffsetParent()){
|
||||
var relativePointer = getRelativePosition(pointer, this.$getOffsetParent())
|
||||
this.lastRelativePointer = this.relativePointer
|
||||
this.relativePointer = relativePointer
|
||||
}
|
||||
|
||||
this.lastPointer = this.pointer
|
||||
this.pointer = pointer
|
||||
},
|
||||
distanceMet: function (e) {
|
||||
var currentPointer = this.getPointer(e)
|
||||
return (Math.max(
|
||||
Math.abs(this.pointer.left - currentPointer.left),
|
||||
Math.abs(this.pointer.top - currentPointer.top)
|
||||
) >= this.options.distance)
|
||||
},
|
||||
getPointer: function(e) {
|
||||
var o = e.originalEvent || e.originalEvent.touches && e.originalEvent.touches[0]
|
||||
return {
|
||||
left: e.pageX || o.pageX,
|
||||
top: e.pageY || o.pageY
|
||||
}
|
||||
},
|
||||
setupDelayTimer: function () {
|
||||
var that = this
|
||||
this.delayMet = !this.options.delay
|
||||
|
||||
// init delay timer if needed
|
||||
if (!this.delayMet) {
|
||||
clearTimeout(this._mouseDelayTimer);
|
||||
this._mouseDelayTimer = setTimeout(function() {
|
||||
that.delayMet = true
|
||||
}, this.options.delay)
|
||||
}
|
||||
},
|
||||
scroll: function (e) {
|
||||
this.clearDimensions()
|
||||
this.clearOffsetParent() // TODO is this needed?
|
||||
},
|
||||
toggleListeners: function (method) {
|
||||
var that = this,
|
||||
events = ['drag','drop','scroll']
|
||||
|
||||
$.each(events,function (i,event) {
|
||||
that.$document[method](eventNames[event], that[event + 'Proxy'])
|
||||
})
|
||||
},
|
||||
clearOffsetParent: function () {
|
||||
this.offsetParent = undefined
|
||||
},
|
||||
// Recursively clear container and item dimensions
|
||||
clearDimensions: function () {
|
||||
this.traverse(function(object){
|
||||
object._clearDimensions()
|
||||
})
|
||||
},
|
||||
traverse: function(callback) {
|
||||
callback(this)
|
||||
var i = this.containers.length
|
||||
while(i--){
|
||||
this.containers[i].traverse(callback)
|
||||
}
|
||||
},
|
||||
_clearDimensions: function(){
|
||||
this.containerDimensions = undefined
|
||||
},
|
||||
_destroy: function () {
|
||||
containerGroups[this.options.group] = undefined
|
||||
}
|
||||
}
|
||||
|
||||
function Container(element, options) {
|
||||
this.el = element
|
||||
this.options = $.extend( {}, containerDefaults, options)
|
||||
|
||||
this.group = ContainerGroup.get(this.options)
|
||||
this.rootGroup = this.options.rootGroup || this.group
|
||||
this.handle = this.rootGroup.options.handle || this.rootGroup.options.itemSelector
|
||||
|
||||
var itemPath = this.rootGroup.options.itemPath
|
||||
this.target = itemPath ? this.el.find(itemPath) : this.el
|
||||
|
||||
this.target.on(eventNames.start, this.handle, $.proxy(this.dragInit, this))
|
||||
|
||||
if(this.options.drop)
|
||||
this.group.containers.push(this)
|
||||
}
|
||||
|
||||
Container.prototype = {
|
||||
dragInit: function (e) {
|
||||
var rootGroup = this.rootGroup
|
||||
|
||||
if( !this.disabled &&
|
||||
!rootGroup.dragInitDone &&
|
||||
this.options.drag &&
|
||||
this.isValidDrag(e)) {
|
||||
rootGroup.dragInit(e, this)
|
||||
}
|
||||
},
|
||||
isValidDrag: function(e) {
|
||||
return e.which == 1 ||
|
||||
e.type == "touchstart" && e.originalEvent.touches.length == 1
|
||||
},
|
||||
searchValidTarget: function (pointer, lastPointer) {
|
||||
var distances = sortByDistanceDesc(this.getItemDimensions(),
|
||||
pointer,
|
||||
lastPointer),
|
||||
i = distances.length,
|
||||
rootGroup = this.rootGroup,
|
||||
validTarget = !rootGroup.options.isValidTarget ||
|
||||
rootGroup.options.isValidTarget(rootGroup.item, this)
|
||||
|
||||
if(!i && validTarget){
|
||||
rootGroup.movePlaceholder(this, this.target, "append")
|
||||
return true
|
||||
} else
|
||||
while(i--){
|
||||
var index = distances[i][0],
|
||||
distance = distances[i][1]
|
||||
if(!distance && this.hasChildGroup(index)){
|
||||
var found = this.getContainerGroup(index).searchValidTarget(pointer, lastPointer)
|
||||
if(found)
|
||||
return true
|
||||
}
|
||||
else if(validTarget){
|
||||
this.movePlaceholder(index, pointer)
|
||||
return true
|
||||
}
|
||||
}
|
||||
},
|
||||
movePlaceholder: function (index, pointer) {
|
||||
var item = $(this.items[index]),
|
||||
dim = this.itemDimensions[index],
|
||||
method = "after",
|
||||
width = item.outerWidth(),
|
||||
height = item.outerHeight(),
|
||||
offset = item.offset(),
|
||||
sameResultBox = {
|
||||
left: offset.left,
|
||||
right: offset.left + width,
|
||||
top: offset.top,
|
||||
bottom: offset.top + height
|
||||
}
|
||||
if(this.options.vertical){
|
||||
var yCenter = (dim[2] + dim[3]) / 2,
|
||||
inUpperHalf = pointer.top <= yCenter
|
||||
if(inUpperHalf){
|
||||
method = "before"
|
||||
sameResultBox.bottom -= height / 2
|
||||
} else
|
||||
sameResultBox.top += height / 2
|
||||
} else {
|
||||
var xCenter = (dim[0] + dim[1]) / 2,
|
||||
inLeftHalf = pointer.left <= xCenter
|
||||
if(inLeftHalf){
|
||||
method = "before"
|
||||
sameResultBox.right -= width / 2
|
||||
} else
|
||||
sameResultBox.left += width / 2
|
||||
}
|
||||
if(this.hasChildGroup(index))
|
||||
sameResultBox = emptyBox
|
||||
this.rootGroup.movePlaceholder(this, item, method, sameResultBox)
|
||||
},
|
||||
getItemDimensions: function () {
|
||||
if(!this.itemDimensions){
|
||||
this.items = this.$getChildren(this.el, "item").filter(
|
||||
":not(." + this.group.options.placeholderClass + ", ." + this.group.options.draggedClass + ")"
|
||||
).get()
|
||||
setDimensions(this.items, this.itemDimensions = [], this.options.tolerance)
|
||||
}
|
||||
return this.itemDimensions
|
||||
},
|
||||
getItemOffsetParent: function () {
|
||||
var offsetParent,
|
||||
el = this.el
|
||||
// Since el might be empty we have to check el itself and
|
||||
// can not do something like el.children().first().offsetParent()
|
||||
if(el.css("position") === "relative" || el.css("position") === "absolute" || el.css("position") === "fixed")
|
||||
offsetParent = el
|
||||
else
|
||||
offsetParent = el.offsetParent()
|
||||
return offsetParent
|
||||
},
|
||||
hasChildGroup: function (index) {
|
||||
return this.options.nested && this.getContainerGroup(index)
|
||||
},
|
||||
getContainerGroup: function (index) {
|
||||
var childGroup = $.data(this.items[index], subContainerKey)
|
||||
if( childGroup === undefined){
|
||||
var childContainers = this.$getChildren(this.items[index], "container")
|
||||
childGroup = false
|
||||
|
||||
if(childContainers[0]){
|
||||
var options = $.extend({}, this.options, {
|
||||
rootGroup: this.rootGroup,
|
||||
group: groupCounter ++
|
||||
})
|
||||
childGroup = childContainers[pluginName](options).data(pluginName).group
|
||||
}
|
||||
$.data(this.items[index], subContainerKey, childGroup)
|
||||
}
|
||||
return childGroup
|
||||
},
|
||||
$getChildren: function (parent, type) {
|
||||
var options = this.rootGroup.options,
|
||||
path = options[type + "Path"],
|
||||
selector = options[type + "Selector"]
|
||||
|
||||
parent = $(parent)
|
||||
if(path)
|
||||
parent = parent.find(path)
|
||||
|
||||
return parent.children(selector)
|
||||
},
|
||||
_serialize: function (parent, isContainer) {
|
||||
var that = this,
|
||||
childType = isContainer ? "item" : "container",
|
||||
|
||||
children = this.$getChildren(parent, childType).not(this.options.exclude).map(function () {
|
||||
return that._serialize($(this), !isContainer)
|
||||
}).get()
|
||||
|
||||
return this.rootGroup.options.serialize(parent, children, isContainer)
|
||||
},
|
||||
traverse: function(callback) {
|
||||
$.each(this.items || [], function(item){
|
||||
var group = $.data(this, subContainerKey)
|
||||
if(group)
|
||||
group.traverse(callback)
|
||||
});
|
||||
|
||||
callback(this)
|
||||
},
|
||||
_clearDimensions: function () {
|
||||
this.itemDimensions = undefined
|
||||
},
|
||||
_destroy: function() {
|
||||
var that = this;
|
||||
|
||||
this.target.off(eventNames.start, this.handle);
|
||||
this.el.removeData(pluginName)
|
||||
|
||||
if(this.options.drop)
|
||||
this.group.containers = $.grep(this.group.containers, function(val){
|
||||
return val != that
|
||||
})
|
||||
|
||||
$.each(this.items || [], function(){
|
||||
$.removeData(this, subContainerKey)
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
var API = {
|
||||
enable: function() {
|
||||
this.traverse(function(object){
|
||||
object.disabled = false
|
||||
})
|
||||
},
|
||||
disable: function (){
|
||||
this.traverse(function(object){
|
||||
object.disabled = true
|
||||
})
|
||||
},
|
||||
serialize: function () {
|
||||
return this._serialize(this.el, true)
|
||||
},
|
||||
refresh: function() {
|
||||
this.traverse(function(object){
|
||||
object._clearDimensions()
|
||||
})
|
||||
},
|
||||
destroy: function () {
|
||||
this.traverse(function(object){
|
||||
object._destroy();
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
$.extend(Container.prototype, API)
|
||||
|
||||
/**
|
||||
* jQuery API
|
||||
*
|
||||
* Parameters are
|
||||
* either options on init
|
||||
* or a method name followed by arguments to pass to the method
|
||||
*/
|
||||
$.fn[pluginName] = function(methodOrOptions) {
|
||||
var args = Array.prototype.slice.call(arguments, 1)
|
||||
|
||||
return this.map(function(){
|
||||
var $t = $(this),
|
||||
object = $t.data(pluginName)
|
||||
|
||||
if(object && API[methodOrOptions])
|
||||
return API[methodOrOptions].apply(object, args) || this
|
||||
else if(!object && (methodOrOptions === undefined ||
|
||||
typeof methodOrOptions === "object"))
|
||||
$t.data(pluginName, new Container($t, methodOrOptions))
|
||||
|
||||
return this
|
||||
});
|
||||
};
|
||||
|
||||
}(jQuery, window, 'sortable');
|
||||
|
|
@ -0,0 +1,625 @@
|
|||
/* Notify.js - http://notifyjs.com/ Copyright (c) 2015 MIT */
|
||||
(function (factory) {
|
||||
// UMD start
|
||||
// https://github.com/umdjs/umd/blob/master/jqueryPluginCommonjs.js
|
||||
if (typeof define === 'function' && define.amd) {
|
||||
// AMD. Register as an anonymous module.
|
||||
define(['jquery'], factory);
|
||||
} else if (typeof module === 'object' && module.exports) {
|
||||
// Node/CommonJS
|
||||
module.exports = function( root, jQuery ) {
|
||||
if ( jQuery === undefined ) {
|
||||
// require('jQuery') returns a factory that requires window to
|
||||
// build a jQuery instance, we normalize how we use modules
|
||||
// that require this pattern but the window provided is a noop
|
||||
// if it's defined (how jquery works)
|
||||
if ( typeof window !== 'undefined' ) {
|
||||
jQuery = require('jquery');
|
||||
}
|
||||
else {
|
||||
jQuery = require('jquery')(root);
|
||||
}
|
||||
}
|
||||
factory(jQuery);
|
||||
return jQuery;
|
||||
};
|
||||
} else {
|
||||
// Browser globals
|
||||
factory(jQuery);
|
||||
}
|
||||
}(function ($) {
|
||||
//IE8 indexOf polyfill
|
||||
var indexOf = [].indexOf || function(item) {
|
||||
for (var i = 0, l = this.length; i < l; i++) {
|
||||
if (i in this && this[i] === item) {
|
||||
return i;
|
||||
}
|
||||
}
|
||||
return -1;
|
||||
};
|
||||
|
||||
var pluginName = "notify";
|
||||
var pluginClassName = pluginName + "js";
|
||||
var blankFieldName = pluginName + "!blank";
|
||||
|
||||
var positions = {
|
||||
t: "top",
|
||||
m: "middle",
|
||||
b: "bottom",
|
||||
l: "left",
|
||||
c: "center",
|
||||
r: "right"
|
||||
};
|
||||
var hAligns = ["l", "c", "r"];
|
||||
var vAligns = ["t", "m", "b"];
|
||||
var mainPositions = ["t", "b", "l", "r"];
|
||||
var opposites = {
|
||||
t: "b",
|
||||
m: null,
|
||||
b: "t",
|
||||
l: "r",
|
||||
c: null,
|
||||
r: "l"
|
||||
};
|
||||
|
||||
var parsePosition = function(str) {
|
||||
var pos;
|
||||
pos = [];
|
||||
$.each(str.split(/\W+/), function(i, word) {
|
||||
var w;
|
||||
w = word.toLowerCase().charAt(0);
|
||||
if (positions[w]) {
|
||||
return pos.push(w);
|
||||
}
|
||||
});
|
||||
return pos;
|
||||
};
|
||||
|
||||
var styles = {};
|
||||
|
||||
var coreStyle = {
|
||||
name: "core",
|
||||
html: "<div class=\"" + pluginClassName + "-wrapper\">\n <div class=\"" + pluginClassName + "-arrow\"></div>\n <div class=\"" + pluginClassName + "-container\"></div>\n</div>",
|
||||
css: "." + pluginClassName + "-corner {\n position: fixed;\n margin: 5px;\n z-index: 1050;\n}\n\n." + pluginClassName + "-corner ." + pluginClassName + "-wrapper,\n." + pluginClassName + "-corner ." + pluginClassName + "-container {\n position: relative;\n display: block;\n height: inherit;\n width: inherit;\n margin: 3px;\n}\n\n." + pluginClassName + "-wrapper {\n z-index: 1;\n position: absolute;\n display: inline-block;\n height: 0;\n width: 0;\n}\n\n." + pluginClassName + "-container {\n display: none;\n z-index: 1;\n position: absolute;\n}\n\n." + pluginClassName + "-hidable {\n cursor: pointer;\n}\n\n[data-notify-text],[data-notify-html] {\n position: relative;\n}\n\n." + pluginClassName + "-arrow {\n position: absolute;\n z-index: 2;\n width: 0;\n height: 0;\n}"
|
||||
};
|
||||
|
||||
var stylePrefixes = {
|
||||
"border-radius": ["-webkit-", "-moz-"]
|
||||
};
|
||||
|
||||
var getStyle = function(name) {
|
||||
return styles[name];
|
||||
};
|
||||
|
||||
var removeStyle = function(name) {
|
||||
if (!name) {
|
||||
throw "Missing Style name";
|
||||
}
|
||||
if (styles[name]) {
|
||||
delete styles[name];
|
||||
}
|
||||
};
|
||||
|
||||
var addStyle = function(name, def) {
|
||||
if (!name) {
|
||||
throw "Missing Style name";
|
||||
}
|
||||
if (!def) {
|
||||
throw "Missing Style definition";
|
||||
}
|
||||
if (!def.html) {
|
||||
throw "Missing Style HTML";
|
||||
}
|
||||
//remove existing style
|
||||
var existing = styles[name];
|
||||
if (existing && existing.cssElem) {
|
||||
if (window.console) {
|
||||
console.warn(pluginName + ": overwriting style '" + name + "'");
|
||||
}
|
||||
styles[name].cssElem.remove();
|
||||
}
|
||||
def.name = name;
|
||||
styles[name] = def;
|
||||
var cssText = "";
|
||||
if (def.classes) {
|
||||
$.each(def.classes, function(className, props) {
|
||||
cssText += "." + pluginClassName + "-" + def.name + "-" + className + " {\n";
|
||||
$.each(props, function(name, val) {
|
||||
if (stylePrefixes[name]) {
|
||||
$.each(stylePrefixes[name], function(i, prefix) {
|
||||
return cssText += " " + prefix + name + ": " + val + ";\n";
|
||||
});
|
||||
}
|
||||
return cssText += " " + name + ": " + val + ";\n";
|
||||
});
|
||||
return cssText += "}\n";
|
||||
});
|
||||
}
|
||||
if (def.css) {
|
||||
cssText += "/* styles for " + def.name + " */\n" + def.css;
|
||||
}
|
||||
if (cssText) {
|
||||
def.cssElem = insertCSS(cssText);
|
||||
def.cssElem.attr("id", "notify-" + def.name);
|
||||
}
|
||||
var fields = {};
|
||||
var elem = $(def.html);
|
||||
findFields("html", elem, fields);
|
||||
findFields("text", elem, fields);
|
||||
def.fields = fields;
|
||||
};
|
||||
|
||||
var insertCSS = function(cssText) {
|
||||
var e, elem, error;
|
||||
elem = createElem("style");
|
||||
elem.attr("type", 'text/css');
|
||||
$("head").append(elem);
|
||||
try {
|
||||
elem.html(cssText);
|
||||
} catch (_) {
|
||||
elem[0].styleSheet.cssText = cssText;
|
||||
}
|
||||
return elem;
|
||||
};
|
||||
|
||||
var findFields = function(type, elem, fields) {
|
||||
var attr;
|
||||
if (type !== "html") {
|
||||
type = "text";
|
||||
}
|
||||
attr = "data-notify-" + type;
|
||||
return find(elem, "[" + attr + "]").each(function() {
|
||||
var name;
|
||||
name = $(this).attr(attr);
|
||||
if (!name) {
|
||||
name = blankFieldName;
|
||||
}
|
||||
fields[name] = type;
|
||||
});
|
||||
};
|
||||
|
||||
var find = function(elem, selector) {
|
||||
if (elem.is(selector)) {
|
||||
return elem;
|
||||
} else {
|
||||
return elem.find(selector);
|
||||
}
|
||||
};
|
||||
|
||||
var pluginOptions = {
|
||||
clickToHide: true,
|
||||
autoHide: true,
|
||||
autoHideDelay: 5000,
|
||||
arrowShow: true,
|
||||
arrowSize: 5,
|
||||
breakNewLines: true,
|
||||
elementPosition: "bottom",
|
||||
globalPosition: "top right",
|
||||
style: "bootstrap",
|
||||
className: "error",
|
||||
showAnimation: "slideDown",
|
||||
showDuration: 400,
|
||||
hideAnimation: "slideUp",
|
||||
hideDuration: 200,
|
||||
gap: 5
|
||||
};
|
||||
|
||||
var inherit = function(a, b) {
|
||||
var F;
|
||||
F = function() {};
|
||||
F.prototype = a;
|
||||
return $.extend(true, new F(), b);
|
||||
};
|
||||
|
||||
var defaults = function(opts) {
|
||||
return $.extend(pluginOptions, opts);
|
||||
};
|
||||
|
||||
var createElem = function(tag) {
|
||||
return $("<" + tag + "></" + tag + ">");
|
||||
};
|
||||
|
||||
var globalAnchors = {};
|
||||
|
||||
var getAnchorElement = function(element) {
|
||||
var radios;
|
||||
if (element.is('[type=radio]')) {
|
||||
radios = element.parents('form:first').find('[type=radio]').filter(function(i, e) {
|
||||
return $(e).attr("name") === element.attr("name");
|
||||
});
|
||||
element = radios.first();
|
||||
}
|
||||
return element;
|
||||
};
|
||||
|
||||
var incr = function(obj, pos, val) {
|
||||
var opp, temp;
|
||||
if (typeof val === "string") {
|
||||
val = parseInt(val, 10);
|
||||
} else if (typeof val !== "number") {
|
||||
return;
|
||||
}
|
||||
if (isNaN(val)) {
|
||||
return;
|
||||
}
|
||||
opp = positions[opposites[pos.charAt(0)]];
|
||||
temp = pos;
|
||||
if (obj[opp] !== undefined) {
|
||||
pos = positions[opp.charAt(0)];
|
||||
val = -val;
|
||||
}
|
||||
if (obj[pos] === undefined) {
|
||||
obj[pos] = val;
|
||||
} else {
|
||||
obj[pos] += val;
|
||||
}
|
||||
return null;
|
||||
};
|
||||
|
||||
var realign = function(alignment, inner, outer) {
|
||||
if (alignment === "l" || alignment === "t") {
|
||||
return 0;
|
||||
} else if (alignment === "c" || alignment === "m") {
|
||||
return outer / 2 - inner / 2;
|
||||
} else if (alignment === "r" || alignment === "b") {
|
||||
return outer - inner;
|
||||
}
|
||||
throw "Invalid alignment";
|
||||
};
|
||||
|
||||
var encode = function(text) {
|
||||
encode.e = encode.e || createElem("div");
|
||||
return encode.e.text(text).html();
|
||||
};
|
||||
|
||||
function Notification(elem, data, options) {
|
||||
if (typeof options === "string") {
|
||||
options = {
|
||||
className: options
|
||||
};
|
||||
}
|
||||
this.options = inherit(pluginOptions, $.isPlainObject(options) ? options : {});
|
||||
this.loadHTML();
|
||||
this.wrapper = $(coreStyle.html);
|
||||
if (this.options.clickToHide) {
|
||||
this.wrapper.addClass(pluginClassName + "-hidable");
|
||||
}
|
||||
this.wrapper.data(pluginClassName, this);
|
||||
this.arrow = this.wrapper.find("." + pluginClassName + "-arrow");
|
||||
this.container = this.wrapper.find("." + pluginClassName + "-container");
|
||||
this.container.append(this.userContainer);
|
||||
if (elem && elem.length) {
|
||||
this.elementType = elem.attr("type");
|
||||
this.originalElement = elem;
|
||||
this.elem = getAnchorElement(elem);
|
||||
this.elem.data(pluginClassName, this);
|
||||
this.elem.before(this.wrapper);
|
||||
}
|
||||
this.container.hide();
|
||||
this.run(data);
|
||||
}
|
||||
|
||||
Notification.prototype.loadHTML = function() {
|
||||
var style;
|
||||
style = this.getStyle();
|
||||
this.userContainer = $(style.html);
|
||||
this.userFields = style.fields;
|
||||
};
|
||||
|
||||
Notification.prototype.show = function(show, userCallback) {
|
||||
var args, callback, elems, fn, hidden;
|
||||
callback = (function(_this) {
|
||||
return function() {
|
||||
if (!show && !_this.elem) {
|
||||
_this.destroy();
|
||||
}
|
||||
if (userCallback) {
|
||||
return userCallback();
|
||||
}
|
||||
};
|
||||
})(this);
|
||||
hidden = this.container.parent().parents(':hidden').length > 0;
|
||||
elems = this.container.add(this.arrow);
|
||||
args = [];
|
||||
if (hidden && show) {
|
||||
fn = "show";
|
||||
} else if (hidden && !show) {
|
||||
fn = "hide";
|
||||
} else if (!hidden && show) {
|
||||
fn = this.options.showAnimation;
|
||||
args.push(this.options.showDuration);
|
||||
} else if (!hidden && !show) {
|
||||
fn = this.options.hideAnimation;
|
||||
args.push(this.options.hideDuration);
|
||||
} else {
|
||||
return callback();
|
||||
}
|
||||
args.push(callback);
|
||||
return elems[fn].apply(elems, args);
|
||||
};
|
||||
|
||||
Notification.prototype.setGlobalPosition = function() {
|
||||
var p = this.getPosition();
|
||||
var pMain = p[0];
|
||||
var pAlign = p[1];
|
||||
var main = positions[pMain];
|
||||
var align = positions[pAlign];
|
||||
var key = pMain + "|" + pAlign;
|
||||
var anchor = globalAnchors[key];
|
||||
if (!anchor || !document.body.contains(anchor[0])) {
|
||||
anchor = globalAnchors[key] = createElem("div");
|
||||
var css = {};
|
||||
css[main] = 0;
|
||||
if (align === "middle") {
|
||||
css.top = '45%';
|
||||
} else if (align === "center") {
|
||||
css.left = '45%';
|
||||
} else {
|
||||
css[align] = 0;
|
||||
}
|
||||
anchor.css(css).addClass(pluginClassName + "-corner");
|
||||
$("body").append(anchor);
|
||||
}
|
||||
return anchor.prepend(this.wrapper);
|
||||
};
|
||||
|
||||
Notification.prototype.setElementPosition = function() {
|
||||
var arrowColor, arrowCss, arrowSize, color, contH, contW, css, elemH, elemIH, elemIW, elemPos, elemW, gap, j, k, len, len1, mainFull, margin, opp, oppFull, pAlign, pArrow, pMain, pos, posFull, position, ref, wrapPos;
|
||||
position = this.getPosition();
|
||||
pMain = position[0];
|
||||
pAlign = position[1];
|
||||
pArrow = position[2];
|
||||
elemPos = this.elem.position();
|
||||
elemH = this.elem.outerHeight();
|
||||
elemW = this.elem.outerWidth();
|
||||
elemIH = this.elem.innerHeight();
|
||||
elemIW = this.elem.innerWidth();
|
||||
wrapPos = this.wrapper.position();
|
||||
contH = this.container.height();
|
||||
contW = this.container.width();
|
||||
mainFull = positions[pMain];
|
||||
opp = opposites[pMain];
|
||||
oppFull = positions[opp];
|
||||
css = {};
|
||||
css[oppFull] = pMain === "b" ? elemH : pMain === "r" ? elemW : 0;
|
||||
incr(css, "top", elemPos.top - wrapPos.top);
|
||||
incr(css, "left", elemPos.left - wrapPos.left);
|
||||
ref = ["top", "left"];
|
||||
for (j = 0, len = ref.length; j < len; j++) {
|
||||
pos = ref[j];
|
||||
margin = parseInt(this.elem.css("margin-" + pos), 10);
|
||||
if (margin) {
|
||||
incr(css, pos, margin);
|
||||
}
|
||||
}
|
||||
gap = Math.max(0, this.options.gap - (this.options.arrowShow ? arrowSize : 0));
|
||||
incr(css, oppFull, gap);
|
||||
if (!this.options.arrowShow) {
|
||||
this.arrow.hide();
|
||||
} else {
|
||||
arrowSize = this.options.arrowSize;
|
||||
arrowCss = $.extend({}, css);
|
||||
arrowColor = this.userContainer.css("border-color") || this.userContainer.css("border-top-color") || this.userContainer.css("background-color") || "white";
|
||||
for (k = 0, len1 = mainPositions.length; k < len1; k++) {
|
||||
pos = mainPositions[k];
|
||||
posFull = positions[pos];
|
||||
if (pos === opp) {
|
||||
continue;
|
||||
}
|
||||
color = posFull === mainFull ? arrowColor : "transparent";
|
||||
arrowCss["border-" + posFull] = arrowSize + "px solid " + color;
|
||||
}
|
||||
incr(css, positions[opp], arrowSize);
|
||||
if (indexOf.call(mainPositions, pAlign) >= 0) {
|
||||
incr(arrowCss, positions[pAlign], arrowSize * 2);
|
||||
}
|
||||
}
|
||||
if (indexOf.call(vAligns, pMain) >= 0) {
|
||||
incr(css, "left", realign(pAlign, contW, elemW));
|
||||
if (arrowCss) {
|
||||
incr(arrowCss, "left", realign(pAlign, arrowSize, elemIW));
|
||||
}
|
||||
} else if (indexOf.call(hAligns, pMain) >= 0) {
|
||||
incr(css, "top", realign(pAlign, contH, elemH));
|
||||
if (arrowCss) {
|
||||
incr(arrowCss, "top", realign(pAlign, arrowSize, elemIH));
|
||||
}
|
||||
}
|
||||
if (this.container.is(":visible")) {
|
||||
css.display = "block";
|
||||
}
|
||||
this.container.removeAttr("style").css(css);
|
||||
if (arrowCss) {
|
||||
return this.arrow.removeAttr("style").css(arrowCss);
|
||||
}
|
||||
};
|
||||
|
||||
Notification.prototype.getPosition = function() {
|
||||
var pos, ref, ref1, ref2, ref3, ref4, ref5, text;
|
||||
text = this.options.position || (this.elem ? this.options.elementPosition : this.options.globalPosition);
|
||||
pos = parsePosition(text);
|
||||
if (pos.length === 0) {
|
||||
pos[0] = "b";
|
||||
}
|
||||
if (ref = pos[0], indexOf.call(mainPositions, ref) < 0) {
|
||||
throw "Must be one of [" + mainPositions + "]";
|
||||
}
|
||||
if (pos.length === 1 || ((ref1 = pos[0], indexOf.call(vAligns, ref1) >= 0) && (ref2 = pos[1], indexOf.call(hAligns, ref2) < 0)) || ((ref3 = pos[0], indexOf.call(hAligns, ref3) >= 0) && (ref4 = pos[1], indexOf.call(vAligns, ref4) < 0))) {
|
||||
pos[1] = (ref5 = pos[0], indexOf.call(hAligns, ref5) >= 0) ? "m" : "l";
|
||||
}
|
||||
if (pos.length === 2) {
|
||||
pos[2] = pos[1];
|
||||
}
|
||||
return pos;
|
||||
};
|
||||
|
||||
Notification.prototype.getStyle = function(name) {
|
||||
var style;
|
||||
if (!name) {
|
||||
name = this.options.style;
|
||||
}
|
||||
if (!name) {
|
||||
name = "default";
|
||||
}
|
||||
style = styles[name];
|
||||
if (!style) {
|
||||
throw "Missing style: " + name;
|
||||
}
|
||||
return style;
|
||||
};
|
||||
|
||||
Notification.prototype.updateClasses = function() {
|
||||
var classes, style;
|
||||
classes = ["base"];
|
||||
if ($.isArray(this.options.className)) {
|
||||
classes = classes.concat(this.options.className);
|
||||
} else if (this.options.className) {
|
||||
classes.push(this.options.className);
|
||||
}
|
||||
style = this.getStyle();
|
||||
classes = $.map(classes, function(n) {
|
||||
return pluginClassName + "-" + style.name + "-" + n;
|
||||
}).join(" ");
|
||||
return this.userContainer.attr("class", classes);
|
||||
};
|
||||
|
||||
Notification.prototype.run = function(data, options) {
|
||||
var d, datas, name, type, value;
|
||||
if ($.isPlainObject(options)) {
|
||||
$.extend(this.options, options);
|
||||
} else if ($.type(options) === "string") {
|
||||
this.options.className = options;
|
||||
}
|
||||
if (this.container && !data) {
|
||||
this.show(false);
|
||||
return;
|
||||
} else if (!this.container && !data) {
|
||||
return;
|
||||
}
|
||||
datas = {};
|
||||
if ($.isPlainObject(data)) {
|
||||
datas = data;
|
||||
} else {
|
||||
datas[blankFieldName] = data;
|
||||
}
|
||||
for (name in datas) {
|
||||
d = datas[name];
|
||||
type = this.userFields[name];
|
||||
if (!type) {
|
||||
continue;
|
||||
}
|
||||
if (type === "text") {
|
||||
d = encode(d);
|
||||
if (this.options.breakNewLines) {
|
||||
d = d.replace(/\n/g, '<br/>');
|
||||
}
|
||||
}
|
||||
value = name === blankFieldName ? '' : '=' + name;
|
||||
find(this.userContainer, "[data-notify-" + type + value + "]").html(d);
|
||||
}
|
||||
this.updateClasses();
|
||||
if (this.elem) {
|
||||
this.setElementPosition();
|
||||
} else {
|
||||
this.setGlobalPosition();
|
||||
}
|
||||
this.show(true);
|
||||
if (this.options.autoHide) {
|
||||
clearTimeout(this.autohideTimer);
|
||||
this.autohideTimer = setTimeout(this.show.bind(this, false), this.options.autoHideDelay);
|
||||
}
|
||||
};
|
||||
|
||||
Notification.prototype.destroy = function() {
|
||||
this.wrapper.data(pluginClassName, null);
|
||||
this.wrapper.remove();
|
||||
};
|
||||
|
||||
$[pluginName] = function(elem, data, options) {
|
||||
if ((elem && elem.nodeName) || elem.jquery) {
|
||||
$(elem)[pluginName](data, options);
|
||||
} else {
|
||||
options = data;
|
||||
data = elem;
|
||||
new Notification(null, data, options);
|
||||
}
|
||||
return elem;
|
||||
};
|
||||
|
||||
$.fn[pluginName] = function(data, options) {
|
||||
$(this).each(function() {
|
||||
var prev = getAnchorElement($(this)).data(pluginClassName);
|
||||
if (prev) {
|
||||
prev.destroy();
|
||||
}
|
||||
var curr = new Notification($(this), data, options);
|
||||
});
|
||||
return this;
|
||||
};
|
||||
|
||||
$.extend($[pluginName], {
|
||||
defaults: defaults,
|
||||
addStyle: addStyle,
|
||||
removeStyle: removeStyle,
|
||||
pluginOptions: pluginOptions,
|
||||
getStyle: getStyle,
|
||||
insertCSS: insertCSS
|
||||
});
|
||||
|
||||
//always include the default bootstrap style
|
||||
addStyle("bootstrap", {
|
||||
html: "<div>\n<span data-notify-text></span>\n</div>",
|
||||
classes: {
|
||||
base: {
|
||||
"font-weight": "bold",
|
||||
"padding": "8px 15px 8px 14px",
|
||||
"text-shadow": "0 1px 0 rgba(255, 255, 255, 0.5)",
|
||||
"background-color": "#fcf8e3",
|
||||
"border": "1px solid #fbeed5",
|
||||
"border-radius": "4px",
|
||||
"white-space": "nowrap",
|
||||
"padding-left": "25px",
|
||||
"background-repeat": "no-repeat",
|
||||
"background-position": "3px 7px"
|
||||
},
|
||||
error: {
|
||||
"color": "#B94A48",
|
||||
"background-color": "#F2DEDE",
|
||||
"border-color": "#EED3D7",
|
||||
"background-image": "url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABQAAAAUCAYAAACNiR0NAAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAAtRJREFUeNqkVc1u00AQHq+dOD+0poIQfkIjalW0SEGqRMuRnHos3DjwAH0ArlyQeANOOSMeAA5VjyBxKBQhgSpVUKKQNGloFdw4cWw2jtfMOna6JOUArDTazXi/b3dm55socPqQhFka++aHBsI8GsopRJERNFlY88FCEk9Yiwf8RhgRyaHFQpPHCDmZG5oX2ui2yilkcTT1AcDsbYC1NMAyOi7zTX2Agx7A9luAl88BauiiQ/cJaZQfIpAlngDcvZZMrl8vFPK5+XktrWlx3/ehZ5r9+t6e+WVnp1pxnNIjgBe4/6dAysQc8dsmHwPcW9C0h3fW1hans1ltwJhy0GxK7XZbUlMp5Ww2eyan6+ft/f2FAqXGK4CvQk5HueFz7D6GOZtIrK+srupdx1GRBBqNBtzc2AiMr7nPplRdKhb1q6q6zjFhrklEFOUutoQ50xcX86ZlqaZpQrfbBdu2R6/G19zX6XSgh6RX5ubyHCM8nqSID6ICrGiZjGYYxojEsiw4PDwMSL5VKsC8Yf4VRYFzMzMaxwjlJSlCyAQ9l0CW44PBADzXhe7xMdi9HtTrdYjFYkDQL0cn4Xdq2/EAE+InCnvADTf2eah4Sx9vExQjkqXT6aAERICMewd/UAp/IeYANM2joxt+q5VI+ieq2i0Wg3l6DNzHwTERPgo1ko7XBXj3vdlsT2F+UuhIhYkp7u7CarkcrFOCtR3H5JiwbAIeImjT/YQKKBtGjRFCU5IUgFRe7fF4cCNVIPMYo3VKqxwjyNAXNepuopyqnld602qVsfRpEkkz+GFL1wPj6ySXBpJtWVa5xlhpcyhBNwpZHmtX8AGgfIExo0ZpzkWVTBGiXCSEaHh62/PoR0p/vHaczxXGnj4bSo+G78lELU80h1uogBwWLf5YlsPmgDEd4M236xjm+8nm4IuE/9u+/PH2JXZfbwz4zw1WbO+SQPpXfwG/BBgAhCNZiSb/pOQAAAAASUVORK5CYII=)"
|
||||
},
|
||||
success: {
|
||||
"color": "#468847",
|
||||
"background-color": "#DFF0D8",
|
||||
"border-color": "#D6E9C6",
|
||||
"background-image": "url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABQAAAAUCAYAAACNiR0NAAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAAutJREFUeNq0lctPE0Ecx38zu/RFS1EryqtgJFA08YCiMZIAQQ4eRG8eDGdPJiYeTIwHTfwPiAcvXIwXLwoXPaDxkWgQ6islKlJLSQWLUraPLTv7Gme32zoF9KSTfLO7v53vZ3d/M7/fIth+IO6INt2jjoA7bjHCJoAlzCRw59YwHYjBnfMPqAKWQYKjGkfCJqAF0xwZjipQtA3MxeSG87VhOOYegVrUCy7UZM9S6TLIdAamySTclZdYhFhRHloGYg7mgZv1Zzztvgud7V1tbQ2twYA34LJmF4p5dXF1KTufnE+SxeJtuCZNsLDCQU0+RyKTF27Unw101l8e6hns3u0PBalORVVVkcaEKBJDgV3+cGM4tKKmI+ohlIGnygKX00rSBfszz/n2uXv81wd6+rt1orsZCHRdr1Imk2F2Kob3hutSxW8thsd8AXNaln9D7CTfA6O+0UgkMuwVvEFFUbbAcrkcTA8+AtOk8E6KiQiDmMFSDqZItAzEVQviRkdDdaFgPp8HSZKAEAL5Qh7Sq2lIJBJwv2scUqkUnKoZgNhcDKhKg5aH+1IkcouCAdFGAQsuWZYhOjwFHQ96oagWgRoUov1T9kRBEODAwxM2QtEUl+Wp+Ln9VRo6BcMw4ErHRYjH4/B26AlQoQQTRdHWwcd9AH57+UAXddvDD37DmrBBV34WfqiXPl61g+vr6xA9zsGeM9gOdsNXkgpEtTwVvwOklXLKm6+/p5ezwk4B+j6droBs2CsGa/gNs6RIxazl4Tc25mpTgw/apPR1LYlNRFAzgsOxkyXYLIM1V8NMwyAkJSctD1eGVKiq5wWjSPdjmeTkiKvVW4f2YPHWl3GAVq6ymcyCTgovM3FzyRiDe2TaKcEKsLpJvNHjZgPNqEtyi6mZIm4SRFyLMUsONSSdkPeFtY1n0mczoY3BHTLhwPRy9/lzcziCw9ACI+yql0VLzcGAZbYSM5CCSZg1/9oc/nn7+i8N9p/8An4JMADxhH+xHfuiKwAAAABJRU5ErkJggg==)"
|
||||
},
|
||||
info: {
|
||||
"color": "#3A87AD",
|
||||
"background-color": "#D9EDF7",
|
||||
"border-color": "#BCE8F1",
|
||||
"background-image": "url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABQAAAAUCAYAAACNiR0NAAAABmJLR0QA/wD/AP+gvaeTAAAACXBIWXMAAAsTAAALEwEAmpwYAAAAB3RJTUUH3QYFAhkSsdes/QAAA8dJREFUOMvVlGtMW2UYx//POaWHXg6lLaW0ypAtw1UCgbniNOLcVOLmAjHZolOYlxmTGXVZdAnRfXQm+7SoU4mXaOaiZsEpC9FkiQs6Z6bdCnNYruM6KNBw6YWewzl9z+sHImEWv+vz7XmT95f/+3/+7wP814v+efDOV3/SoX3lHAA+6ODeUFfMfjOWMADgdk+eEKz0pF7aQdMAcOKLLjrcVMVX3xdWN29/GhYP7SvnP0cWfS8caSkfHZsPE9Fgnt02JNutQ0QYHB2dDz9/pKX8QjjuO9xUxd/66HdxTeCHZ3rojQObGQBcuNjfplkD3b19Y/6MrimSaKgSMmpGU5WevmE/swa6Oy73tQHA0Rdr2Mmv/6A1n9w9suQ7097Z9lM4FlTgTDrzZTu4StXVfpiI48rVcUDM5cmEksrFnHxfpTtU/3BFQzCQF/2bYVoNbH7zmItbSoMj40JSzmMyX5qDvriA7QdrIIpA+3cdsMpu0nXI8cV0MtKXCPZev+gCEM1S2NHPvWfP/hL+7FSr3+0p5RBEyhEN5JCKYr8XnASMT0xBNyzQGQeI8fjsGD39RMPk7se2bd5ZtTyoFYXftF6y37gx7NeUtJJOTFlAHDZLDuILU3j3+H5oOrD3yWbIztugaAzgnBKJuBLpGfQrS8wO4FZgV+c1IxaLgWVU0tMLEETCos4xMzEIv9cJXQcyagIwigDGwJgOAtHAwAhisQUjy0ORGERiELgG4iakkzo4MYAxcM5hAMi1WWG1yYCJIcMUaBkVRLdGeSU2995TLWzcUAzONJ7J6FBVBYIggMzmFbvdBV44Corg8vjhzC+EJEl8U1kJtgYrhCzgc/vvTwXKSib1paRFVRVORDAJAsw5FuTaJEhWM2SHB3mOAlhkNxwuLzeJsGwqWzf5TFNdKgtY5qHp6ZFf67Y/sAVadCaVY5YACDDb3Oi4NIjLnWMw2QthCBIsVhsUTU9tvXsjeq9+X1d75/KEs4LNOfcdf/+HthMnvwxOD0wmHaXr7ZItn2wuH2SnBzbZAbPJwpPx+VQuzcm7dgRCB57a1uBzUDRL4bfnI0RE0eaXd9W89mpjqHZnUI5Hh2l2dkZZUhOqpi2qSmpOmZ64Tuu9qlz/SEXo6MEHa3wOip46F1n7633eekV8ds8Wxjn37Wl63VVa+ej5oeEZ/82ZBETJjpJ1Rbij2D3Z/1trXUvLsblCK0XfOx0SX2kMsn9dX+d+7Kf6h8o4AIykuffjT8L20LU+w4AZd5VvEPY+XpWqLV327HR7DzXuDnD8r+ovkBehJ8i+y8YAAAAASUVORK5CYII=)"
|
||||
},
|
||||
warn: {
|
||||
"color": "#C09853",
|
||||
"background-color": "#FCF8E3",
|
||||
"border-color": "#FBEED5",
|
||||
"background-image": "url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABQAAAAUCAMAAAC6V+0/AAABJlBMVEXr6eb/2oD/wi7/xjr/0mP/ykf/tQD/vBj/3o7/uQ//vyL/twebhgD/4pzX1K3z8e349vK6tHCilCWbiQymn0jGworr6dXQza3HxcKkn1vWvV/5uRfk4dXZ1bD18+/52YebiAmyr5S9mhCzrWq5t6ufjRH54aLs0oS+qD751XqPhAybhwXsujG3sm+Zk0PTwG6Shg+PhhObhwOPgQL4zV2nlyrf27uLfgCPhRHu7OmLgAafkyiWkD3l49ibiAfTs0C+lgCniwD4sgDJxqOilzDWowWFfAH08uebig6qpFHBvH/aw26FfQTQzsvy8OyEfz20r3jAvaKbhgG9q0nc2LbZxXanoUu/u5WSggCtp1anpJKdmFz/zlX/1nGJiYmuq5Dx7+sAAADoPUZSAAAAAXRSTlMAQObYZgAAAAFiS0dEAIgFHUgAAAAJcEhZcwAACxMAAAsTAQCanBgAAAAHdElNRQfdBgUBGhh4aah5AAAAlklEQVQY02NgoBIIE8EUcwn1FkIXM1Tj5dDUQhPU502Mi7XXQxGz5uVIjGOJUUUW81HnYEyMi2HVcUOICQZzMMYmxrEyMylJwgUt5BljWRLjmJm4pI1hYp5SQLGYxDgmLnZOVxuooClIDKgXKMbN5ggV1ACLJcaBxNgcoiGCBiZwdWxOETBDrTyEFey0jYJ4eHjMGWgEAIpRFRCUt08qAAAAAElFTkSuQmCC)"
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
$(function() {
|
||||
insertCSS(coreStyle.css).attr("id", "core-notify");
|
||||
$(document).on("click", "." + pluginClassName + "-hidable", function(e) {
|
||||
$(this).trigger("notify-hide");
|
||||
});
|
||||
$(document).on("notify-hide", "." + pluginClassName + "-wrapper", function(e) {
|
||||
var elem = $(this).data(pluginClassName);
|
||||
if(elem) {
|
||||
elem.show(false);
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
}));
|
||||
File diff suppressed because it is too large
Load Diff
|
|
@ -5671,3 +5671,47 @@ table.text-center th {
|
|||
white-space: normal !important;
|
||||
}
|
||||
}
|
||||
|
||||
body.dragging, body.dragging * {
|
||||
cursor: move !important;
|
||||
}
|
||||
|
||||
.dragged {
|
||||
position: absolute;
|
||||
opacity: 0.5;
|
||||
z-index: 2000;
|
||||
}
|
||||
|
||||
ol.sorting_pages li.placeholder {
|
||||
position: relative;
|
||||
/** More li styles **/
|
||||
}
|
||||
ol.sorting_pages li.placeholder:before {
|
||||
position: absolute;
|
||||
/** Define arrowhead **/
|
||||
}
|
||||
#sortable { list-style-type: none; margin: 0; padding: 0; width: 60%; }
|
||||
#sortable li { margin: 0 5px 5px 5px; padding: 5px; font-size: 1.2em; height: 1.5em; }
|
||||
html>body #sortable li { height: 1.5em; line-height: 1.2em; }
|
||||
.ui-state-highlight { height: 1.5em; line-height: 1.2em; }
|
||||
.ui-state-highlight,
|
||||
.ui-widget-content .ui-state-highlight,
|
||||
.ui-widget-header .ui-state-highlight {
|
||||
border: 1px solid #dad55e;
|
||||
background: #fffa90;
|
||||
color: #777620;
|
||||
}
|
||||
.ui-state-default,
|
||||
.ui-widget-content .ui-state-default,
|
||||
.ui-widget-header .ui-state-default,
|
||||
.ui-button,
|
||||
|
||||
/* We use html here because we need a greater specificity to make sure disabled
|
||||
works properly when clicked or hovered */
|
||||
html .ui-button.ui-state-disabled:hover,
|
||||
html .ui-button.ui-state-disabled:active {
|
||||
border: 1px solid #c5c5c5;
|
||||
background: #f6f6f6;
|
||||
font-weight: normal;
|
||||
color: #454545;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -6754,4 +6754,4 @@ button.close {
|
|||
display: none !important;
|
||||
}
|
||||
}
|
||||
/*# sourceMappingURL=bootstrap.css.map */
|
||||
/*# sourceMappingURL=bootstrap_lte.css.map */
|
||||
|
|
|
|||
|
|
@ -0,0 +1,420 @@
|
|||
body {
|
||||
font-size: 20px;
|
||||
color: #212529;
|
||||
font-family: 'Lora', 'Times New Roman', serif;
|
||||
}
|
||||
|
||||
p {
|
||||
line-height: 1.5;
|
||||
margin: 30px 0;
|
||||
}
|
||||
|
||||
p a {
|
||||
text-decoration: underline;
|
||||
}
|
||||
|
||||
h1,
|
||||
h2,
|
||||
h3,
|
||||
h4,
|
||||
h5,
|
||||
h6 {
|
||||
font-weight: 800;
|
||||
font-family: 'Open Sans', 'Helvetica Neue', Helvetica, Arial, sans-serif;
|
||||
}
|
||||
|
||||
a {
|
||||
color: #212529;
|
||||
-webkit-transition: all 0.2s;
|
||||
-moz-transition: all 0.2s;
|
||||
transition: all 0.2s;
|
||||
}
|
||||
|
||||
a:focus, a:hover {
|
||||
color: #0085A1;
|
||||
}
|
||||
|
||||
blockquote {
|
||||
font-style: italic;
|
||||
color: #868e96;
|
||||
}
|
||||
|
||||
.section-heading {
|
||||
font-size: 36px;
|
||||
font-weight: 700;
|
||||
margin-top: 60px;
|
||||
}
|
||||
|
||||
.caption {
|
||||
font-size: 14px;
|
||||
font-style: italic;
|
||||
display: block;
|
||||
margin: 0;
|
||||
padding: 10px;
|
||||
text-align: center;
|
||||
border-bottom-right-radius: 5px;
|
||||
border-bottom-left-radius: 5px;
|
||||
}
|
||||
|
||||
::-moz-selection {
|
||||
color: #fff;
|
||||
background: #0085A1;
|
||||
text-shadow: none;
|
||||
}
|
||||
|
||||
::selection {
|
||||
color: #fff;
|
||||
background: #0085A1;
|
||||
text-shadow: none;
|
||||
}
|
||||
|
||||
img::selection {
|
||||
color: #fff;
|
||||
background: transparent;
|
||||
}
|
||||
|
||||
img::-moz-selection {
|
||||
color: #fff;
|
||||
background: transparent;
|
||||
}
|
||||
|
||||
#mainNav {
|
||||
position: absolute;
|
||||
border-bottom: 1px solid #e9ecef;
|
||||
background-color: white;
|
||||
font-family: 'Open Sans', 'Helvetica Neue', Helvetica, Arial, sans-serif;
|
||||
}
|
||||
|
||||
#mainNav .navbar-brand {
|
||||
font-weight: 800;
|
||||
color: #343a40;
|
||||
}
|
||||
|
||||
#mainNav .navbar-toggler {
|
||||
font-size: 12px;
|
||||
font-weight: 800;
|
||||
padding: 13px;
|
||||
text-transform: uppercase;
|
||||
color: #343a40;
|
||||
}
|
||||
|
||||
#mainNav .navbar-nav > li.nav-item > a {
|
||||
font-size: 12px;
|
||||
font-weight: 800;
|
||||
letter-spacing: 1px;
|
||||
text-transform: uppercase;
|
||||
}
|
||||
|
||||
@media only screen and (min-width: 992px) {
|
||||
#mainNav {
|
||||
border-bottom: 1px solid transparent;
|
||||
background: transparent;
|
||||
}
|
||||
#mainNav .navbar-brand {
|
||||
padding: 10px 20px;
|
||||
color: #fff;
|
||||
}
|
||||
#mainNav .navbar-brand:focus, #mainNav .navbar-brand:hover {
|
||||
color: rgba(255, 255, 255, 0.8);
|
||||
}
|
||||
#mainNav .navbar-nav > li.nav-item > a {
|
||||
padding: 10px 20px;
|
||||
color: #fff;
|
||||
}
|
||||
#mainNav .navbar-nav > li.nav-item > a:focus, #mainNav .navbar-nav > li.nav-item > a:hover {
|
||||
color: rgba(255, 255, 255, 0.8);
|
||||
}
|
||||
}
|
||||
|
||||
@media only screen and (min-width: 992px) {
|
||||
#mainNav {
|
||||
-webkit-transition: background-color 0.2s;
|
||||
-moz-transition: background-color 0.2s;
|
||||
transition: background-color 0.2s;
|
||||
/* Force Hardware Acceleration in WebKit */
|
||||
-webkit-transform: translate3d(0, 0, 0);
|
||||
-moz-transform: translate3d(0, 0, 0);
|
||||
-ms-transform: translate3d(0, 0, 0);
|
||||
-o-transform: translate3d(0, 0, 0);
|
||||
transform: translate3d(0, 0, 0);
|
||||
-webkit-backface-visibility: hidden;
|
||||
}
|
||||
#mainNav.is-fixed {
|
||||
/* when the user scrolls down, we hide the header right above the viewport */
|
||||
position: fixed;
|
||||
top: -67px;
|
||||
-webkit-transition: -webkit-transform 0.2s;
|
||||
-moz-transition: -moz-transform 0.2s;
|
||||
transition: transform 0.2s;
|
||||
border-bottom: 1px solid white;
|
||||
background-color: rgba(255, 255, 255, 0.9);
|
||||
}
|
||||
#mainNav.is-fixed .navbar-brand {
|
||||
color: #212529;
|
||||
}
|
||||
#mainNav.is-fixed .navbar-brand:focus, #mainNav.is-fixed .navbar-brand:hover {
|
||||
color: #0085A1;
|
||||
}
|
||||
#mainNav.is-fixed .navbar-nav > li.nav-item > a {
|
||||
color: #212529;
|
||||
}
|
||||
#mainNav.is-fixed .navbar-nav > li.nav-item > a:focus, #mainNav.is-fixed .navbar-nav > li.nav-item > a:hover {
|
||||
color: #0085A1;
|
||||
}
|
||||
#mainNav.is-visible {
|
||||
/* if the user changes the scrolling direction, we show the header */
|
||||
-webkit-transform: translate3d(0, 100%, 0);
|
||||
-moz-transform: translate3d(0, 100%, 0);
|
||||
-ms-transform: translate3d(0, 100%, 0);
|
||||
-o-transform: translate3d(0, 100%, 0);
|
||||
transform: translate3d(0, 100%, 0);
|
||||
}
|
||||
}
|
||||
|
||||
header.masthead {
|
||||
margin-bottom: 50px;
|
||||
background: no-repeat center center;
|
||||
background-color: #868e96;
|
||||
background-attachment: scroll;
|
||||
position: relative;
|
||||
-webkit-background-size: cover;
|
||||
-moz-background-size: cover;
|
||||
-o-background-size: cover;
|
||||
background-size: cover;
|
||||
}
|
||||
|
||||
header.masthead .overlay {
|
||||
position: absolute;
|
||||
top: 0;
|
||||
left: 0;
|
||||
height: 100%;
|
||||
width: 100%;
|
||||
background-color: #212529;
|
||||
opacity: 0.5;
|
||||
}
|
||||
|
||||
header.masthead .page-heading,
|
||||
header.masthead .post-heading,
|
||||
header.masthead .site-heading {
|
||||
padding: 200px 0 150px;
|
||||
color: white;
|
||||
}
|
||||
|
||||
@media only screen and (min-width: 768px) {
|
||||
header.masthead .page-heading,
|
||||
header.masthead .post-heading,
|
||||
header.masthead .site-heading {
|
||||
padding: 200px 0;
|
||||
}
|
||||
}
|
||||
|
||||
header.masthead .page-heading,
|
||||
header.masthead .site-heading {
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
header.masthead .page-heading h1,
|
||||
header.masthead .site-heading h1 {
|
||||
font-size: 50px;
|
||||
margin-top: 0;
|
||||
}
|
||||
|
||||
header.masthead .page-heading .subheading,
|
||||
header.masthead .site-heading .subheading {
|
||||
font-size: 24px;
|
||||
font-weight: 300;
|
||||
line-height: 1.1;
|
||||
display: block;
|
||||
margin: 10px 0 0;
|
||||
font-family: 'Open Sans', 'Helvetica Neue', Helvetica, Arial, sans-serif;
|
||||
}
|
||||
|
||||
@media only screen and (min-width: 768px) {
|
||||
header.masthead .page-heading h1,
|
||||
header.masthead .site-heading h1 {
|
||||
font-size: 80px;
|
||||
}
|
||||
}
|
||||
|
||||
header.masthead .post-heading h1 {
|
||||
font-size: 35px;
|
||||
}
|
||||
|
||||
header.masthead .post-heading .meta,
|
||||
header.masthead .post-heading .subheading {
|
||||
line-height: 1.1;
|
||||
display: block;
|
||||
}
|
||||
|
||||
header.masthead .post-heading .subheading {
|
||||
font-size: 24px;
|
||||
font-weight: 600;
|
||||
margin: 10px 0 30px;
|
||||
font-family: 'Open Sans', 'Helvetica Neue', Helvetica, Arial, sans-serif;
|
||||
}
|
||||
|
||||
header.masthead .post-heading .meta {
|
||||
font-size: 20px;
|
||||
font-weight: 300;
|
||||
font-style: italic;
|
||||
font-family: 'Lora', 'Times New Roman', serif;
|
||||
}
|
||||
|
||||
header.masthead .post-heading .meta a {
|
||||
color: #fff;
|
||||
}
|
||||
|
||||
@media only screen and (min-width: 768px) {
|
||||
header.masthead .post-heading h1 {
|
||||
font-size: 55px;
|
||||
}
|
||||
header.masthead .post-heading .subheading {
|
||||
font-size: 30px;
|
||||
}
|
||||
}
|
||||
|
||||
.post-preview > a {
|
||||
color: #212529;
|
||||
}
|
||||
|
||||
.post-preview > a:focus, .post-preview > a:hover {
|
||||
text-decoration: none;
|
||||
color: #0085A1;
|
||||
}
|
||||
|
||||
.post-preview > a > .post-title {
|
||||
font-size: 30px;
|
||||
margin-top: 30px;
|
||||
margin-bottom: 10px;
|
||||
}
|
||||
|
||||
.post-preview > a > .post-subtitle {
|
||||
font-weight: 300;
|
||||
margin: 0 0 10px;
|
||||
}
|
||||
|
||||
.post-preview > .post-meta {
|
||||
font-size: 18px;
|
||||
font-style: italic;
|
||||
margin-top: 0;
|
||||
color: #868e96;
|
||||
}
|
||||
|
||||
.post-preview > .post-meta > a {
|
||||
text-decoration: none;
|
||||
color: #212529;
|
||||
}
|
||||
|
||||
.post-preview > .post-meta > a:focus, .post-preview > .post-meta > a:hover {
|
||||
text-decoration: underline;
|
||||
color: #0085A1;
|
||||
}
|
||||
|
||||
@media only screen and (min-width: 768px) {
|
||||
.post-preview > a > .post-title {
|
||||
font-size: 36px;
|
||||
}
|
||||
}
|
||||
|
||||
.floating-label-form-group {
|
||||
font-size: 14px;
|
||||
position: relative;
|
||||
margin-bottom: 0;
|
||||
padding-bottom: 0.5em;
|
||||
border-bottom: 1px solid #dee2e6;
|
||||
}
|
||||
|
||||
.floating-label-form-group input,
|
||||
.floating-label-form-group textarea {
|
||||
font-size: 1.5em;
|
||||
position: relative;
|
||||
z-index: 1;
|
||||
padding: 0;
|
||||
resize: none;
|
||||
border: none;
|
||||
border-radius: 0;
|
||||
background: none;
|
||||
box-shadow: none !important;
|
||||
font-family: 'Lora', 'Times New Roman', serif;
|
||||
}
|
||||
|
||||
.floating-label-form-group input::-webkit-input-placeholder,
|
||||
.floating-label-form-group textarea::-webkit-input-placeholder {
|
||||
color: #868e96;
|
||||
font-family: 'Lora', 'Times New Roman', serif;
|
||||
}
|
||||
|
||||
.floating-label-form-group label {
|
||||
font-size: 0.85em;
|
||||
line-height: 1.764705882em;
|
||||
position: relative;
|
||||
z-index: 0;
|
||||
top: 2em;
|
||||
display: block;
|
||||
margin: 0;
|
||||
-webkit-transition: top 0.3s ease, opacity 0.3s ease;
|
||||
-moz-transition: top 0.3s ease, opacity 0.3s ease;
|
||||
-ms-transition: top 0.3s ease, opacity 0.3s ease;
|
||||
transition: top 0.3s ease, opacity 0.3s ease;
|
||||
vertical-align: middle;
|
||||
vertical-align: baseline;
|
||||
opacity: 0;
|
||||
}
|
||||
|
||||
.floating-label-form-group .help-block {
|
||||
margin: 15px 0;
|
||||
}
|
||||
|
||||
.floating-label-form-group-with-value label {
|
||||
top: 0;
|
||||
opacity: 1;
|
||||
}
|
||||
|
||||
.floating-label-form-group-with-focus label {
|
||||
color: #0085A1;
|
||||
}
|
||||
|
||||
form .form-group:first-child .floating-label-form-group {
|
||||
border-top: 1px solid #dee2e6;
|
||||
}
|
||||
|
||||
footer {
|
||||
padding: 50px 0 65px;
|
||||
}
|
||||
|
||||
footer .list-inline {
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
}
|
||||
|
||||
footer .copyright {
|
||||
font-size: 14px;
|
||||
margin-bottom: 0;
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
.btn {
|
||||
font-size: 14px;
|
||||
font-weight: 800;
|
||||
padding: 15px 25px;
|
||||
letter-spacing: 1px;
|
||||
text-transform: uppercase;
|
||||
border-radius: 0;
|
||||
font-family: 'Open Sans', 'Helvetica Neue', Helvetica, Arial, sans-serif;
|
||||
}
|
||||
|
||||
.btn-primary {
|
||||
background-color: #0085A1;
|
||||
border-color: #0085A1;
|
||||
}
|
||||
|
||||
.btn-primary:hover, .btn-primary:focus, .btn-primary:active {
|
||||
color: #fff;
|
||||
background-color: #00657b !important;
|
||||
border-color: #00657b !important;
|
||||
}
|
||||
|
||||
.btn-lg {
|
||||
font-size: 16px;
|
||||
padding: 25px 35px;
|
||||
}
|
||||
|
|
@ -12,7 +12,7 @@ body {
|
|||
font-family: 'Merriweather', 'Helvetica Neue', Arial, sans-serif;
|
||||
}
|
||||
|
||||
hr {
|
||||
hr.mini {
|
||||
max-width: 50px;
|
||||
border-width: 3px;
|
||||
border-color: #40a5f0; }
|
||||
|
|
@ -46,7 +46,7 @@ h6 {
|
|||
color: rgba(255, 255, 255, 0.7); }
|
||||
|
||||
section {
|
||||
padding: 8rem 0; }
|
||||
padding: 1rem 0; }
|
||||
|
||||
.section-heading {
|
||||
margin-top: 0; }
|
||||
|
|
@ -74,7 +74,7 @@ body {
|
|||
|
||||
#mainNav {
|
||||
border-bottom: 1px solid rgba(33, 37, 41, 0.1);
|
||||
background-color: #fff;
|
||||
background-color: #8D8D8D;
|
||||
font-family: 'Open Sans', 'Helvetica Neue', Arial, sans-serif;
|
||||
-webkit-transition: all 0.2s;
|
||||
-moz-transition: all 0.2s;
|
||||
|
|
@ -120,7 +120,7 @@ body {
|
|||
color: #fff; }
|
||||
#mainNav.navbar-shrink {
|
||||
border-bottom: 1px solid rgba(33, 37, 41, 0.1);
|
||||
background-color: #fff; }
|
||||
background-color: #cec9c9; }
|
||||
#mainNav.navbar-shrink .navbar-brand {
|
||||
color: #40a5f0; }
|
||||
#mainNav.navbar-shrink .navbar-brand:focus, #mainNav.navbar-shrink .navbar-brand:hover {
|
||||
|
|
@ -131,7 +131,9 @@ body {
|
|||
#mainNav.navbar-shrink .navbar-nav > li.nav-item > a.nav-link:hover,
|
||||
#mainNav.navbar-shrink .navbar-nav > li.nav-item > a.nav-link:focus:hover {
|
||||
color: #40a5f0; } }
|
||||
|
||||
header.title {
|
||||
padding-top: 4rem;
|
||||
}
|
||||
header.masthead {
|
||||
padding-top: 10rem;
|
||||
padding-bottom: calc(10rem - 56px);
|
||||
|
|
@ -141,7 +143,7 @@ header.masthead {
|
|||
-moz-background-size: cover;
|
||||
-o-background-size: cover;
|
||||
background-size: cover; }
|
||||
header.masthead hr {
|
||||
header.masthead hr.mini {
|
||||
margin-top: 30px;
|
||||
margin-bottom: 30px; }
|
||||
header.masthead h1 {
|
||||
|
|
@ -231,3 +233,149 @@ header.masthead {
|
|||
background-color: #4080F0 !important; }
|
||||
.btn-primary:active, .btn-primary:focus {
|
||||
box-shadow: 0 0 0 0.2rem rgba(240, 95, 64, 0.5) !important; }
|
||||
.post-preview > a {
|
||||
color: #212529;
|
||||
}
|
||||
|
||||
.post-preview > a:focus, .post-preview > a:hover {
|
||||
text-decoration: none;
|
||||
color: #0085A1;
|
||||
}
|
||||
|
||||
.post-preview > a > .post-title {
|
||||
font-weight: 800;
|
||||
font-family: 'Open Sans', 'Helvetica Neue', Helvetica, Arial, sans-serif;
|
||||
font-size: 30px;
|
||||
margin-top: 30px;
|
||||
margin-bottom: 10px;
|
||||
}
|
||||
|
||||
.post-preview > a > .post-subtitle {
|
||||
font-family: 'Open Sans', 'Helvetica Neue', Helvetica, Arial, sans-serif;
|
||||
font-weight: 300;
|
||||
margin: 0 0 10px;
|
||||
}
|
||||
|
||||
.post-preview > .post-meta {
|
||||
font-size: 18px;
|
||||
font-style: italic;
|
||||
margin-top: 0;
|
||||
color: #868e96;
|
||||
}
|
||||
|
||||
.post-preview > .post-meta > a {
|
||||
text-decoration: none;
|
||||
color: #212529;
|
||||
}
|
||||
|
||||
.post-preview > .post-meta > a:focus, .post-preview > .post-meta > a:hover {
|
||||
text-decoration: underline;
|
||||
color: #0085A1;
|
||||
}
|
||||
|
||||
@media only screen and (min-width: 768px) {
|
||||
.post-preview > a > .post-title {
|
||||
font-size: 36px;
|
||||
}
|
||||
}
|
||||
header.contacthead {
|
||||
margin-bottom: 50px;
|
||||
background: no-repeat center center;
|
||||
background-color: #868e96;
|
||||
background-attachment: scroll;
|
||||
position: relative;
|
||||
-webkit-background-size: cover;
|
||||
-moz-background-size: cover;
|
||||
-o-background-size: cover;
|
||||
background-size: cover;
|
||||
}
|
||||
|
||||
header.contacthead .overlay {
|
||||
position: absolute;
|
||||
top: 0;
|
||||
left: 0;
|
||||
height: 100%;
|
||||
width: 100%;
|
||||
background-color: #212529;
|
||||
opacity: 0.5;
|
||||
}
|
||||
|
||||
header.contacthead .page-heading,
|
||||
header.contacthead .post-heading,
|
||||
header.contacthead .site-heading {
|
||||
padding: 200px 0 150px;
|
||||
color: white;
|
||||
}
|
||||
|
||||
@media only screen and (min-width: 768px) {
|
||||
header.contacthead .page-heading,
|
||||
header.contacthead .post-heading,
|
||||
header.contacthead .site-heading {
|
||||
padding: 200px 0;
|
||||
}
|
||||
}
|
||||
|
||||
header.contacthead .page-heading,
|
||||
header.contacthead .site-heading {
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
header.contacthead .page-heading h1,
|
||||
header.contacthead .site-heading h1 {
|
||||
font-size: 50px;
|
||||
margin-top: 0;
|
||||
}
|
||||
|
||||
header.contacthead .page-heading .subheading,
|
||||
header.contacthead .site-heading .subheading {
|
||||
font-size: 24px;
|
||||
font-weight: 300;
|
||||
line-height: 1.1;
|
||||
display: block;
|
||||
margin: 10px 0 0;
|
||||
font-family: 'Open Sans', 'Helvetica Neue', Helvetica, Arial, sans-serif;
|
||||
}
|
||||
|
||||
@media only screen and (min-width: 768px) {
|
||||
header.contacthead .page-heading h1,
|
||||
header.contacthead .site-heading h1 {
|
||||
font-size: 80px;
|
||||
}
|
||||
}
|
||||
|
||||
header.contacthead .post-heading h1 {
|
||||
font-size: 35px;
|
||||
}
|
||||
|
||||
header.contacthead .post-heading .meta,
|
||||
header.contacthead .post-heading .subheading {
|
||||
line-height: 1.1;
|
||||
display: block;
|
||||
}
|
||||
|
||||
header.contacthead .post-heading .subheading {
|
||||
font-size: 24px;
|
||||
font-weight: 600;
|
||||
margin: 10px 0 30px;
|
||||
font-family: 'Open Sans', 'Helvetica Neue', Helvetica, Arial, sans-serif;
|
||||
}
|
||||
|
||||
header.contacthead .post-heading .meta {
|
||||
font-size: 20px;
|
||||
font-weight: 300;
|
||||
font-style: italic;
|
||||
font-family: 'Lora', 'Times New Roman', serif;
|
||||
}
|
||||
|
||||
header.contacthead .post-heading .meta a {
|
||||
color: #fff;
|
||||
}
|
||||
|
||||
@media only screen and (min-width: 768px) {
|
||||
header.contacthead .post-heading h1 {
|
||||
font-size: 55px;
|
||||
}
|
||||
header.contacthead .post-heading .subheading {
|
||||
font-size: 30px;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -0,0 +1,484 @@
|
|||
.select2-container {
|
||||
box-sizing: border-box;
|
||||
display: inline-block;
|
||||
margin: 0;
|
||||
position: relative;
|
||||
vertical-align: middle; }
|
||||
.select2-container .select2-selection--single {
|
||||
box-sizing: border-box;
|
||||
cursor: pointer;
|
||||
display: block;
|
||||
height: 28px;
|
||||
user-select: none;
|
||||
-webkit-user-select: none; }
|
||||
.select2-container .select2-selection--single .select2-selection__rendered {
|
||||
display: block;
|
||||
padding-left: 8px;
|
||||
padding-right: 20px;
|
||||
overflow: hidden;
|
||||
text-overflow: ellipsis;
|
||||
white-space: nowrap; }
|
||||
.select2-container .select2-selection--single .select2-selection__clear {
|
||||
position: relative; }
|
||||
.select2-container[dir="rtl"] .select2-selection--single .select2-selection__rendered {
|
||||
padding-right: 8px;
|
||||
padding-left: 20px; }
|
||||
.select2-container .select2-selection--multiple {
|
||||
box-sizing: border-box;
|
||||
cursor: pointer;
|
||||
display: block;
|
||||
min-height: 32px;
|
||||
user-select: none;
|
||||
-webkit-user-select: none; }
|
||||
.select2-container .select2-selection--multiple .select2-selection__rendered {
|
||||
display: inline-block;
|
||||
overflow: hidden;
|
||||
padding-left: 8px;
|
||||
text-overflow: ellipsis;
|
||||
white-space: nowrap; }
|
||||
.select2-container .select2-search--inline {
|
||||
float: left; }
|
||||
.select2-container .select2-search--inline .select2-search__field {
|
||||
box-sizing: border-box;
|
||||
border: none;
|
||||
font-size: 100%;
|
||||
margin-top: 5px;
|
||||
padding: 0; }
|
||||
.select2-container .select2-search--inline .select2-search__field::-webkit-search-cancel-button {
|
||||
-webkit-appearance: none; }
|
||||
|
||||
.select2-dropdown {
|
||||
background-color: white;
|
||||
border: 1px solid #aaa;
|
||||
border-radius: 4px;
|
||||
box-sizing: border-box;
|
||||
display: block;
|
||||
position: absolute;
|
||||
left: -100000px;
|
||||
width: 100%;
|
||||
z-index: 1051; }
|
||||
|
||||
.select2-results {
|
||||
display: block; }
|
||||
|
||||
.select2-results__options {
|
||||
list-style: none;
|
||||
margin: 0;
|
||||
padding: 0; }
|
||||
|
||||
.select2-results__option {
|
||||
padding: 6px;
|
||||
user-select: none;
|
||||
-webkit-user-select: none; }
|
||||
.select2-results__option[aria-selected] {
|
||||
cursor: pointer; }
|
||||
|
||||
.select2-container--open .select2-dropdown {
|
||||
left: 0; }
|
||||
|
||||
.select2-container--open .select2-dropdown--above {
|
||||
border-bottom: none;
|
||||
border-bottom-left-radius: 0;
|
||||
border-bottom-right-radius: 0; }
|
||||
|
||||
.select2-container--open .select2-dropdown--below {
|
||||
border-top: none;
|
||||
border-top-left-radius: 0;
|
||||
border-top-right-radius: 0; }
|
||||
|
||||
.select2-search--dropdown {
|
||||
display: block;
|
||||
padding: 4px; }
|
||||
.select2-search--dropdown .select2-search__field {
|
||||
padding: 4px;
|
||||
width: 100%;
|
||||
box-sizing: border-box; }
|
||||
.select2-search--dropdown .select2-search__field::-webkit-search-cancel-button {
|
||||
-webkit-appearance: none; }
|
||||
.select2-search--dropdown.select2-search--hide {
|
||||
display: none; }
|
||||
|
||||
.select2-close-mask {
|
||||
border: 0;
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
display: block;
|
||||
position: fixed;
|
||||
left: 0;
|
||||
top: 0;
|
||||
min-height: 100%;
|
||||
min-width: 100%;
|
||||
height: auto;
|
||||
width: auto;
|
||||
opacity: 0;
|
||||
z-index: 99;
|
||||
background-color: #fff;
|
||||
filter: alpha(opacity=0); }
|
||||
|
||||
.select2-hidden-accessible {
|
||||
border: 0 !important;
|
||||
clip: rect(0 0 0 0) !important;
|
||||
height: 1px !important;
|
||||
margin: -1px !important;
|
||||
overflow: hidden !important;
|
||||
padding: 0 !important;
|
||||
position: absolute !important;
|
||||
width: 1px !important; }
|
||||
|
||||
.select2-container--default .select2-selection--single {
|
||||
background-color: #fff;
|
||||
border: 1px solid #aaa;
|
||||
border-radius: 4px; }
|
||||
.select2-container--default .select2-selection--single .select2-selection__rendered {
|
||||
color: #444;
|
||||
line-height: 28px; }
|
||||
.select2-container--default .select2-selection--single .select2-selection__clear {
|
||||
cursor: pointer;
|
||||
float: right;
|
||||
font-weight: bold; }
|
||||
.select2-container--default .select2-selection--single .select2-selection__placeholder {
|
||||
color: #999; }
|
||||
.select2-container--default .select2-selection--single .select2-selection__arrow {
|
||||
height: 26px;
|
||||
position: absolute;
|
||||
top: 1px;
|
||||
right: 1px;
|
||||
width: 20px; }
|
||||
.select2-container--default .select2-selection--single .select2-selection__arrow b {
|
||||
border-color: #888 transparent transparent transparent;
|
||||
border-style: solid;
|
||||
border-width: 5px 4px 0 4px;
|
||||
height: 0;
|
||||
left: 50%;
|
||||
margin-left: -4px;
|
||||
margin-top: -2px;
|
||||
position: absolute;
|
||||
top: 50%;
|
||||
width: 0; }
|
||||
|
||||
.select2-container--default[dir="rtl"] .select2-selection--single .select2-selection__clear {
|
||||
float: left; }
|
||||
|
||||
.select2-container--default[dir="rtl"] .select2-selection--single .select2-selection__arrow {
|
||||
left: 1px;
|
||||
right: auto; }
|
||||
|
||||
.select2-container--default.select2-container--disabled .select2-selection--single {
|
||||
background-color: #eee;
|
||||
cursor: default; }
|
||||
.select2-container--default.select2-container--disabled .select2-selection--single .select2-selection__clear {
|
||||
display: none; }
|
||||
|
||||
.select2-container--default.select2-container--open .select2-selection--single .select2-selection__arrow b {
|
||||
border-color: transparent transparent #888 transparent;
|
||||
border-width: 0 4px 5px 4px; }
|
||||
|
||||
.select2-container--default .select2-selection--multiple {
|
||||
background-color: white;
|
||||
border: 1px solid #aaa;
|
||||
border-radius: 4px;
|
||||
cursor: text; }
|
||||
.select2-container--default .select2-selection--multiple .select2-selection__rendered {
|
||||
box-sizing: border-box;
|
||||
list-style: none;
|
||||
margin: 0;
|
||||
padding: 0 5px;
|
||||
width: 100%; }
|
||||
.select2-container--default .select2-selection--multiple .select2-selection__rendered li {
|
||||
list-style: none; }
|
||||
.select2-container--default .select2-selection--multiple .select2-selection__placeholder {
|
||||
color: #999;
|
||||
margin-top: 5px;
|
||||
float: left; }
|
||||
.select2-container--default .select2-selection--multiple .select2-selection__clear {
|
||||
cursor: pointer;
|
||||
float: right;
|
||||
font-weight: bold;
|
||||
margin-top: 5px;
|
||||
margin-right: 10px; }
|
||||
.select2-container--default .select2-selection--multiple .select2-selection__choice {
|
||||
background-color: #e4e4e4;
|
||||
border: 1px solid #aaa;
|
||||
border-radius: 4px;
|
||||
cursor: default;
|
||||
float: left;
|
||||
margin-right: 5px;
|
||||
margin-top: 5px;
|
||||
padding: 0 5px; }
|
||||
.select2-container--default .select2-selection--multiple .select2-selection__choice__remove {
|
||||
color: #999;
|
||||
cursor: pointer;
|
||||
display: inline-block;
|
||||
font-weight: bold;
|
||||
margin-right: 2px; }
|
||||
.select2-container--default .select2-selection--multiple .select2-selection__choice__remove:hover {
|
||||
color: #333; }
|
||||
|
||||
.select2-container--default[dir="rtl"] .select2-selection--multiple .select2-selection__choice, .select2-container--default[dir="rtl"] .select2-selection--multiple .select2-selection__placeholder, .select2-container--default[dir="rtl"] .select2-selection--multiple .select2-search--inline {
|
||||
float: right; }
|
||||
|
||||
.select2-container--default[dir="rtl"] .select2-selection--multiple .select2-selection__choice {
|
||||
margin-left: 5px;
|
||||
margin-right: auto; }
|
||||
|
||||
.select2-container--default[dir="rtl"] .select2-selection--multiple .select2-selection__choice__remove {
|
||||
margin-left: 2px;
|
||||
margin-right: auto; }
|
||||
|
||||
.select2-container--default.select2-container--focus .select2-selection--multiple {
|
||||
border: solid black 1px;
|
||||
outline: 0; }
|
||||
|
||||
.select2-container--default.select2-container--disabled .select2-selection--multiple {
|
||||
background-color: #eee;
|
||||
cursor: default; }
|
||||
|
||||
.select2-container--default.select2-container--disabled .select2-selection__choice__remove {
|
||||
display: none; }
|
||||
|
||||
.select2-container--default.select2-container--open.select2-container--above .select2-selection--single, .select2-container--default.select2-container--open.select2-container--above .select2-selection--multiple {
|
||||
border-top-left-radius: 0;
|
||||
border-top-right-radius: 0; }
|
||||
|
||||
.select2-container--default.select2-container--open.select2-container--below .select2-selection--single, .select2-container--default.select2-container--open.select2-container--below .select2-selection--multiple {
|
||||
border-bottom-left-radius: 0;
|
||||
border-bottom-right-radius: 0; }
|
||||
|
||||
.select2-container--default .select2-search--dropdown .select2-search__field {
|
||||
border: 1px solid #aaa; }
|
||||
|
||||
.select2-container--default .select2-search--inline .select2-search__field {
|
||||
background: transparent;
|
||||
border: none;
|
||||
outline: 0;
|
||||
box-shadow: none;
|
||||
-webkit-appearance: textfield; }
|
||||
|
||||
.select2-container--default .select2-results > .select2-results__options {
|
||||
max-height: 200px;
|
||||
overflow-y: auto; }
|
||||
|
||||
.select2-container--default .select2-results__option[role=group] {
|
||||
padding: 0; }
|
||||
|
||||
.select2-container--default .select2-results__option[aria-disabled=true] {
|
||||
color: #999; }
|
||||
|
||||
.select2-container--default .select2-results__option[aria-selected=true] {
|
||||
background-color: #ddd; }
|
||||
|
||||
.select2-container--default .select2-results__option .select2-results__option {
|
||||
padding-left: 1em; }
|
||||
.select2-container--default .select2-results__option .select2-results__option .select2-results__group {
|
||||
padding-left: 0; }
|
||||
.select2-container--default .select2-results__option .select2-results__option .select2-results__option {
|
||||
margin-left: -1em;
|
||||
padding-left: 2em; }
|
||||
.select2-container--default .select2-results__option .select2-results__option .select2-results__option .select2-results__option {
|
||||
margin-left: -2em;
|
||||
padding-left: 3em; }
|
||||
.select2-container--default .select2-results__option .select2-results__option .select2-results__option .select2-results__option .select2-results__option {
|
||||
margin-left: -3em;
|
||||
padding-left: 4em; }
|
||||
.select2-container--default .select2-results__option .select2-results__option .select2-results__option .select2-results__option .select2-results__option .select2-results__option {
|
||||
margin-left: -4em;
|
||||
padding-left: 5em; }
|
||||
.select2-container--default .select2-results__option .select2-results__option .select2-results__option .select2-results__option .select2-results__option .select2-results__option .select2-results__option {
|
||||
margin-left: -5em;
|
||||
padding-left: 6em; }
|
||||
|
||||
.select2-container--default .select2-results__option--highlighted[aria-selected] {
|
||||
background-color: #5897fb;
|
||||
color: white; }
|
||||
|
||||
.select2-container--default .select2-results__group {
|
||||
cursor: default;
|
||||
display: block;
|
||||
padding: 6px; }
|
||||
|
||||
.select2-container--classic .select2-selection--single {
|
||||
background-color: #f7f7f7;
|
||||
border: 1px solid #aaa;
|
||||
border-radius: 4px;
|
||||
outline: 0;
|
||||
background-image: -webkit-linear-gradient(top, white 50%, #eeeeee 100%);
|
||||
background-image: -o-linear-gradient(top, white 50%, #eeeeee 100%);
|
||||
background-image: linear-gradient(to bottom, white 50%, #eeeeee 100%);
|
||||
background-repeat: repeat-x;
|
||||
filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#FFFFFFFF', endColorstr='#FFEEEEEE', GradientType=0); }
|
||||
.select2-container--classic .select2-selection--single:focus {
|
||||
border: 1px solid #5897fb; }
|
||||
.select2-container--classic .select2-selection--single .select2-selection__rendered {
|
||||
color: #444;
|
||||
line-height: 28px; }
|
||||
.select2-container--classic .select2-selection--single .select2-selection__clear {
|
||||
cursor: pointer;
|
||||
float: right;
|
||||
font-weight: bold;
|
||||
margin-right: 10px; }
|
||||
.select2-container--classic .select2-selection--single .select2-selection__placeholder {
|
||||
color: #999; }
|
||||
.select2-container--classic .select2-selection--single .select2-selection__arrow {
|
||||
background-color: #ddd;
|
||||
border: none;
|
||||
border-left: 1px solid #aaa;
|
||||
border-top-right-radius: 4px;
|
||||
border-bottom-right-radius: 4px;
|
||||
height: 26px;
|
||||
position: absolute;
|
||||
top: 1px;
|
||||
right: 1px;
|
||||
width: 20px;
|
||||
background-image: -webkit-linear-gradient(top, #eeeeee 50%, #cccccc 100%);
|
||||
background-image: -o-linear-gradient(top, #eeeeee 50%, #cccccc 100%);
|
||||
background-image: linear-gradient(to bottom, #eeeeee 50%, #cccccc 100%);
|
||||
background-repeat: repeat-x;
|
||||
filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#FFEEEEEE', endColorstr='#FFCCCCCC', GradientType=0); }
|
||||
.select2-container--classic .select2-selection--single .select2-selection__arrow b {
|
||||
border-color: #888 transparent transparent transparent;
|
||||
border-style: solid;
|
||||
border-width: 5px 4px 0 4px;
|
||||
height: 0;
|
||||
left: 50%;
|
||||
margin-left: -4px;
|
||||
margin-top: -2px;
|
||||
position: absolute;
|
||||
top: 50%;
|
||||
width: 0; }
|
||||
|
||||
.select2-container--classic[dir="rtl"] .select2-selection--single .select2-selection__clear {
|
||||
float: left; }
|
||||
|
||||
.select2-container--classic[dir="rtl"] .select2-selection--single .select2-selection__arrow {
|
||||
border: none;
|
||||
border-right: 1px solid #aaa;
|
||||
border-radius: 0;
|
||||
border-top-left-radius: 4px;
|
||||
border-bottom-left-radius: 4px;
|
||||
left: 1px;
|
||||
right: auto; }
|
||||
|
||||
.select2-container--classic.select2-container--open .select2-selection--single {
|
||||
border: 1px solid #5897fb; }
|
||||
.select2-container--classic.select2-container--open .select2-selection--single .select2-selection__arrow {
|
||||
background: transparent;
|
||||
border: none; }
|
||||
.select2-container--classic.select2-container--open .select2-selection--single .select2-selection__arrow b {
|
||||
border-color: transparent transparent #888 transparent;
|
||||
border-width: 0 4px 5px 4px; }
|
||||
|
||||
.select2-container--classic.select2-container--open.select2-container--above .select2-selection--single {
|
||||
border-top: none;
|
||||
border-top-left-radius: 0;
|
||||
border-top-right-radius: 0;
|
||||
background-image: -webkit-linear-gradient(top, white 0%, #eeeeee 50%);
|
||||
background-image: -o-linear-gradient(top, white 0%, #eeeeee 50%);
|
||||
background-image: linear-gradient(to bottom, white 0%, #eeeeee 50%);
|
||||
background-repeat: repeat-x;
|
||||
filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#FFFFFFFF', endColorstr='#FFEEEEEE', GradientType=0); }
|
||||
|
||||
.select2-container--classic.select2-container--open.select2-container--below .select2-selection--single {
|
||||
border-bottom: none;
|
||||
border-bottom-left-radius: 0;
|
||||
border-bottom-right-radius: 0;
|
||||
background-image: -webkit-linear-gradient(top, #eeeeee 50%, white 100%);
|
||||
background-image: -o-linear-gradient(top, #eeeeee 50%, white 100%);
|
||||
background-image: linear-gradient(to bottom, #eeeeee 50%, white 100%);
|
||||
background-repeat: repeat-x;
|
||||
filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#FFEEEEEE', endColorstr='#FFFFFFFF', GradientType=0); }
|
||||
|
||||
.select2-container--classic .select2-selection--multiple {
|
||||
background-color: white;
|
||||
border: 1px solid #aaa;
|
||||
border-radius: 4px;
|
||||
cursor: text;
|
||||
outline: 0; }
|
||||
.select2-container--classic .select2-selection--multiple:focus {
|
||||
border: 1px solid #5897fb; }
|
||||
.select2-container--classic .select2-selection--multiple .select2-selection__rendered {
|
||||
list-style: none;
|
||||
margin: 0;
|
||||
padding: 0 5px; }
|
||||
.select2-container--classic .select2-selection--multiple .select2-selection__clear {
|
||||
display: none; }
|
||||
.select2-container--classic .select2-selection--multiple .select2-selection__choice {
|
||||
background-color: #e4e4e4;
|
||||
border: 1px solid #aaa;
|
||||
border-radius: 4px;
|
||||
cursor: default;
|
||||
float: left;
|
||||
margin-right: 5px;
|
||||
margin-top: 5px;
|
||||
padding: 0 5px; }
|
||||
.select2-container--classic .select2-selection--multiple .select2-selection__choice__remove {
|
||||
color: #888;
|
||||
cursor: pointer;
|
||||
display: inline-block;
|
||||
font-weight: bold;
|
||||
margin-right: 2px; }
|
||||
.select2-container--classic .select2-selection--multiple .select2-selection__choice__remove:hover {
|
||||
color: #555; }
|
||||
|
||||
.select2-container--classic[dir="rtl"] .select2-selection--multiple .select2-selection__choice {
|
||||
float: right; }
|
||||
|
||||
.select2-container--classic[dir="rtl"] .select2-selection--multiple .select2-selection__choice {
|
||||
margin-left: 5px;
|
||||
margin-right: auto; }
|
||||
|
||||
.select2-container--classic[dir="rtl"] .select2-selection--multiple .select2-selection__choice__remove {
|
||||
margin-left: 2px;
|
||||
margin-right: auto; }
|
||||
|
||||
.select2-container--classic.select2-container--open .select2-selection--multiple {
|
||||
border: 1px solid #5897fb; }
|
||||
|
||||
.select2-container--classic.select2-container--open.select2-container--above .select2-selection--multiple {
|
||||
border-top: none;
|
||||
border-top-left-radius: 0;
|
||||
border-top-right-radius: 0; }
|
||||
|
||||
.select2-container--classic.select2-container--open.select2-container--below .select2-selection--multiple {
|
||||
border-bottom: none;
|
||||
border-bottom-left-radius: 0;
|
||||
border-bottom-right-radius: 0; }
|
||||
|
||||
.select2-container--classic .select2-search--dropdown .select2-search__field {
|
||||
border: 1px solid #aaa;
|
||||
outline: 0; }
|
||||
|
||||
.select2-container--classic .select2-search--inline .select2-search__field {
|
||||
outline: 0;
|
||||
box-shadow: none; }
|
||||
|
||||
.select2-container--classic .select2-dropdown {
|
||||
background-color: white;
|
||||
border: 1px solid transparent; }
|
||||
|
||||
.select2-container--classic .select2-dropdown--above {
|
||||
border-bottom: none; }
|
||||
|
||||
.select2-container--classic .select2-dropdown--below {
|
||||
border-top: none; }
|
||||
|
||||
.select2-container--classic .select2-results > .select2-results__options {
|
||||
max-height: 200px;
|
||||
overflow-y: auto; }
|
||||
|
||||
.select2-container--classic .select2-results__option[role=group] {
|
||||
padding: 0; }
|
||||
|
||||
.select2-container--classic .select2-results__option[aria-disabled=true] {
|
||||
color: grey; }
|
||||
|
||||
.select2-container--classic .select2-results__option--highlighted[aria-selected] {
|
||||
background-color: #3875d7;
|
||||
color: white; }
|
||||
|
||||
.select2-container--classic .select2-results__group {
|
||||
cursor: default;
|
||||
display: block;
|
||||
padding: 6px; }
|
||||
|
||||
.select2-container--classic.select2-container--open .select2-dropdown {
|
||||
border-color: #5897fb; }
|
||||
|
|
@ -2,7 +2,8 @@ class Admin::AllPageController < ApplicationController
|
|||
before_action :authenticate_admin!
|
||||
layout 'admin'
|
||||
def index
|
||||
@adm = AllPage.all
|
||||
@all_pages = AllPage.where('type_of != 3')
|
||||
@published_pages = PublishedPage.where('type_of = 1 OR type_of = 2').order('priority ASC')
|
||||
end
|
||||
|
||||
def show
|
||||
|
|
@ -10,31 +11,118 @@ class Admin::AllPageController < ApplicationController
|
|||
end
|
||||
|
||||
def new
|
||||
|
||||
@all_page = AllPage.new
|
||||
@articles = Article.all
|
||||
end
|
||||
|
||||
def create
|
||||
@all_page = AllPage.new(all_page_params)
|
||||
|
||||
@all_page.updated_by = current_admin.id
|
||||
@all_page.updated_at = Time.now
|
||||
@all_page.published = false
|
||||
@articles = Article.all
|
||||
if @all_page.save
|
||||
if params[:publish] == '1'
|
||||
params[:id] = @all_page.id
|
||||
publish
|
||||
end
|
||||
redirect_to action: 'index'
|
||||
else
|
||||
render :new
|
||||
end
|
||||
end
|
||||
|
||||
def edit
|
||||
|
||||
@all_page = AllPage.find(params[:id])
|
||||
@articles = Article.all
|
||||
end
|
||||
|
||||
def update
|
||||
|
||||
@all_page = AllPage.find(params[:id])
|
||||
@all_page.updated_by = current_admin.id
|
||||
@all_page.updated_at = Time.now
|
||||
@all_page.published = false
|
||||
if @all_page.update_attributes(all_page_params)
|
||||
if params[:publish] == '1'
|
||||
params[:id] = @all_page.id
|
||||
publish
|
||||
end
|
||||
else
|
||||
@articles = Article.all
|
||||
@all_page.errors.full_messages.each do |msg|
|
||||
puts "<li>#{msg}</li>"
|
||||
end
|
||||
render :edit
|
||||
end
|
||||
end
|
||||
|
||||
def destroy
|
||||
if @all_page = AllPage.find(params[:id])
|
||||
@all_page.destroy
|
||||
end
|
||||
redirect_to action: 'index'
|
||||
end
|
||||
|
||||
def change_priority
|
||||
|
||||
end
|
||||
|
||||
def publish
|
||||
if @all_page = AllPage.find(params[:id])
|
||||
if @published_page = @all_page.published_page
|
||||
@published_page.name = @all_page.name
|
||||
@published_page.title = @all_page.title
|
||||
@published_page.meta_description = @all_page.meta_description
|
||||
@published_page.all_page_id = @all_page.id
|
||||
@published_page.nofollow = @all_page.nofollow
|
||||
@published_page.type_of = @all_page.type_of
|
||||
@published_page.full_text = @all_page.full_text
|
||||
@published_page.article_id = @all_page.article_id
|
||||
@published_page.updated_by = current_admin.id
|
||||
@published_page.updated_at = Time.now
|
||||
else
|
||||
@published_page = PublishedPage.new
|
||||
@published_page.name = @all_page.name
|
||||
@published_page.title = @all_page.title
|
||||
@published_page.meta_description = @all_page.meta_description
|
||||
@published_page.all_page_id = @all_page.id
|
||||
@published_page.nofollow = @all_page.nofollow
|
||||
@published_page.type_of = @all_page.type_of
|
||||
@published_page.full_text = @all_page.full_text
|
||||
@published_page.article_id = @all_page.article_id
|
||||
@published_page.priority = PublishedPage.all.size + 1;
|
||||
@published_page.updated_by = current_admin.id
|
||||
@published_page.updated_at = Time.now
|
||||
@published_page.created_by = current_admin.id
|
||||
@published_page.created_at = Time.now
|
||||
end
|
||||
if @published_page.save
|
||||
@all_page.published = true
|
||||
@all_page.save
|
||||
else
|
||||
if @published_page.errors
|
||||
@published_page.errors.full_messages.each do |msg|
|
||||
puts msg
|
||||
end
|
||||
end
|
||||
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
def unpublish
|
||||
|
||||
if @all_page = AllPage.find(params[:id])
|
||||
if @all_page.published_page
|
||||
@all_page.published_page.destroy
|
||||
end
|
||||
@all_page.published = false
|
||||
@all_page.save
|
||||
end
|
||||
end
|
||||
|
||||
private
|
||||
def all_page_params
|
||||
params.require(:all_page).permit(:name, :article_id, :title, :type_of, :full_text)
|
||||
end
|
||||
end
|
||||
|
|
|
|||
|
|
@ -2,11 +2,12 @@ class Admin::ArticleController < ApplicationController
|
|||
before_action :authenticate_admin!
|
||||
layout 'admin'
|
||||
def index
|
||||
@adm = Article.all
|
||||
@articles = Article.all
|
||||
end
|
||||
|
||||
def show
|
||||
|
||||
@article = Article.find(params[:id])
|
||||
@all_pages = AllPage.where('article_id = ? AND type_of = 3', @article.id).order('updated_at DESC')
|
||||
end
|
||||
|
||||
def new
|
||||
|
|
@ -29,12 +30,4 @@ class Admin::ArticleController < ApplicationController
|
|||
|
||||
end
|
||||
|
||||
def publish
|
||||
|
||||
end
|
||||
|
||||
def unpublish
|
||||
|
||||
end
|
||||
|
||||
end
|
||||
|
|
|
|||
|
|
@ -0,0 +1,128 @@
|
|||
class Admin::Articles::AllPageController < ApplicationController
|
||||
before_action :authenticate_admin!
|
||||
layout 'admin'
|
||||
def index
|
||||
@all_pages = AllPage.where('type_of = 3 AND article_id = ?', params[:aid])
|
||||
@published_pages = PublishedPage.where('type_of = 1 OR type_of = 2').order('priority ASC')
|
||||
end
|
||||
|
||||
def show
|
||||
|
||||
end
|
||||
|
||||
def new
|
||||
@article = Article.find(params[:aid])
|
||||
@all_page = AllPage.new(article_id: params[:aid], type_of: 3)
|
||||
end
|
||||
|
||||
def create
|
||||
|
||||
@all_page = AllPage.new(all_page_params)
|
||||
@article = Article.find(@all_page.article_id)
|
||||
@all_page.updated_by = current_admin.id
|
||||
@all_page.updated_at = Time.now
|
||||
@all_page.published = false
|
||||
if @all_page.save
|
||||
if params[:publish] == '1'
|
||||
params[:id] = @all_page.id
|
||||
publish
|
||||
end
|
||||
redirect_to controller: '/admin/article', action: 'show', id: @article.id
|
||||
else
|
||||
render :new
|
||||
end
|
||||
end
|
||||
|
||||
def edit
|
||||
@article = Article.find(params[:aid])
|
||||
@all_page = AllPage.find(params[:id])
|
||||
end
|
||||
|
||||
def update
|
||||
@all_page = AllPage.find(params[:id])
|
||||
@article = Article.find(@all_page.article_id)
|
||||
@all_page.updated_by = current_admin.id
|
||||
@all_page.updated_at = Time.now
|
||||
@all_page.published = false
|
||||
if @all_page.update_attributes(all_page_params)
|
||||
if params[:publish] == '1'
|
||||
params[:id] = @all_page.id
|
||||
publish
|
||||
end
|
||||
else
|
||||
@all_page.errors.full_messages.each do |msg|
|
||||
puts "<li>#{msg}</li>"
|
||||
end
|
||||
render :edit
|
||||
end
|
||||
end
|
||||
|
||||
def destroy
|
||||
if @all_page = AllPage.find(params[:id])
|
||||
@all_page.destroy
|
||||
end
|
||||
redirect_to controller: '/admin/article', action: 'show', id: params[:aid]
|
||||
end
|
||||
|
||||
def publish
|
||||
if @all_page = AllPage.find(params[:id])
|
||||
if @published_page = @all_page.published_page
|
||||
@published_page.name = @all_page.name
|
||||
@published_page.title = @all_page.title
|
||||
@published_page.meta_description = @all_page.meta_description
|
||||
@published_page.all_page_id = @all_page.id
|
||||
@published_page.nofollow = @all_page.nofollow
|
||||
@published_page.type_of = @all_page.type_of
|
||||
@published_page.small_text = @all_page.small_text
|
||||
@published_page.full_text = @all_page.full_text
|
||||
@published_page.article_id = @all_page.article_id
|
||||
@published_page.updated_by = current_admin.id
|
||||
@published_page.updated_at = Time.now
|
||||
else
|
||||
@published_page = PublishedPage.new
|
||||
@published_page.name = @all_page.name
|
||||
@published_page.title = @all_page.title
|
||||
@published_page.meta_description = @all_page.meta_description
|
||||
@published_page.all_page_id = @all_page.id
|
||||
@published_page.nofollow = @all_page.nofollow
|
||||
@published_page.type_of = @all_page.type_of
|
||||
@published_page.small_text = @all_page.small_text
|
||||
@published_page.full_text = @all_page.full_text
|
||||
@published_page.article_id = @all_page.article_id
|
||||
@published_page.priority = PublishedPage.all.size + 1;
|
||||
@published_page.updated_by = current_admin.id
|
||||
@published_page.updated_at = Time.now
|
||||
@published_page.created_by = current_admin.id
|
||||
@published_page.created_at = Time.now
|
||||
end
|
||||
if @published_page.save
|
||||
@all_page.published = true
|
||||
@all_page.save
|
||||
else
|
||||
if @published_page.errors
|
||||
@published_page.errors.full_messages.each do |msg|
|
||||
puts msg
|
||||
end
|
||||
end
|
||||
|
||||
end
|
||||
end
|
||||
@all_page.reload
|
||||
end
|
||||
|
||||
def unpublish
|
||||
if @all_page = AllPage.find(params[:id])
|
||||
if @all_page.published_page
|
||||
@all_page.published_page.destroy
|
||||
end
|
||||
@all_page.published = false
|
||||
@all_page.save
|
||||
end
|
||||
@all_page.reload
|
||||
end
|
||||
|
||||
private
|
||||
def all_page_params
|
||||
params.require(:all_page).permit(:name, :article_id, :title, :type_of, :small_text, :full_text)
|
||||
end
|
||||
end
|
||||
|
|
@ -1,14 +1,28 @@
|
|||
class SiteController < ApplicationController
|
||||
def index
|
||||
@pages = PublishedPage.all
|
||||
@pages = PublishedPage.where('type_of != 3').order('priority ASC')
|
||||
@adm = Admin.all
|
||||
end
|
||||
|
||||
def show
|
||||
pages_get
|
||||
@page = PublishedPage.friendly.find(params[:id])
|
||||
end
|
||||
|
||||
def kontakt
|
||||
pages_get
|
||||
end
|
||||
|
||||
def preview
|
||||
pages_get
|
||||
if params[:id]
|
||||
@page = AllPage.friendly.find(params[:id])
|
||||
else
|
||||
@page = AllPage.first
|
||||
end
|
||||
end
|
||||
|
||||
def pages_get
|
||||
@pages = PublishedPage.where('type_of != 3').order('priority ASC')
|
||||
end
|
||||
end
|
||||
|
|
|
|||
|
|
@ -3,15 +3,38 @@ module ApplicationHelper
|
|||
def menu_top(pages)
|
||||
ret = '<nav class="navbar navbar-expand-lg navbar-light fixed-top navbar-shrink" id="mainNav">'
|
||||
ret += '<div class="container">'
|
||||
ret += '<a class="navbar-brand js-scroll-trigger" href="/">Ubezpieczenia-Należności</a>'
|
||||
ret += '<a class="navbar-brand" href="/">Ubezpieczenia-Należności</a>'
|
||||
ret += '<ul class="navbar-nav ml-auto">'
|
||||
friendly_id = nil
|
||||
if params[:id]
|
||||
pp = PublishedPage.friendly.find(params[:id])
|
||||
friendly_id = pp.type_of == 3 ? pp.article_friendly : params[:id]
|
||||
end
|
||||
for page in pages
|
||||
ret += '<li class="nav-item">'
|
||||
ret += '<a class="nav-link js-scroll-trigge ' + controller_path.to_s.include?(page.friendly_id) ? 'active' : '' + '" href="/site/' + page.friendly_id + '">' + page.name + '</a>'
|
||||
if !friendly_id.blank?
|
||||
ret += '<a class="nav-link ' + (friendly_id.include?(page.friendly_id) ? 'active' : '') + '" href="/site/' + page.friendly_id + '">' + page.name + '</a>'
|
||||
else
|
||||
ret += '<a class="nav-link" href="/site/' + page.friendly_id + '">' + page.name + '</a>'
|
||||
end
|
||||
ret += '</li>'
|
||||
end
|
||||
ret += '<li class="nav-item">'
|
||||
ret += '<a class="nav-link ' + (action_name.to_s.include?('kontakt') ? 'active' : '') + '" href="/site/kontakt">Kontakt</a>'
|
||||
ret += '</li>'
|
||||
|
||||
ret += '</ul></div></div></nav>'
|
||||
end
|
||||
# generate errors html
|
||||
def errors_to_html(errors )
|
||||
ret = '<div class="row"><div class="col-lg-12 col-md-12 panel-danger"><div class="content-box-header panel-heading"><div class="panel-title">'
|
||||
ret += I18n.t("activerecord.errors.messages.record_invalid", errors: errors.count)
|
||||
ret += '</div></div><div class="content-box-large box-with-header" style="background:#f9dddd"><ul>'
|
||||
errors.full_messages.each do |msg|
|
||||
ret += "<li>#{msg}</li>"
|
||||
end
|
||||
ret += "</ul></div></div></div>"
|
||||
ret
|
||||
end
|
||||
|
||||
end
|
||||
|
|
|
|||
|
|
@ -1,4 +1,31 @@
|
|||
class AllPage < ApplicationRecord
|
||||
belongs_to :article
|
||||
extend FriendlyId
|
||||
friendly_id :title, use: :slugged
|
||||
validates :name, presence: true, uniqueness: true
|
||||
belongs_to :article, optional: true
|
||||
has_one :published_page
|
||||
before_destroy :b_destroy
|
||||
PAGE_TYPES = {
|
||||
1 => 'Strona zwykła',
|
||||
2 => 'Strona z listą wpisów',
|
||||
3 => 'Artykuł'
|
||||
}
|
||||
FORM_PAGE_TYPES = [
|
||||
['Strona zwykła', '1'],
|
||||
['Strona z listą wpisów', '2']
|
||||
]
|
||||
|
||||
def b_destroy
|
||||
if self.published_page
|
||||
self.published_page.destroy
|
||||
end
|
||||
end
|
||||
def created_name
|
||||
Admin.find(self.updated_by).description
|
||||
end
|
||||
|
||||
def created_date
|
||||
self.updated_at.to_date
|
||||
end
|
||||
|
||||
end
|
||||
|
|
|
|||
|
|
@ -1,5 +1,12 @@
|
|||
class PublishedPage < ApplicationRecord
|
||||
class Article < ApplicationRecord
|
||||
has_many :all_pages
|
||||
has_many :published_pages
|
||||
|
||||
def all_page_articles
|
||||
AllPage.where('article_id = ? AND type_of = 3 AND published = 1', self.id).order('updated_at DESC')
|
||||
end
|
||||
|
||||
def published_page_articles
|
||||
PublishedPage.where('article_id = ? AND type_of = 3', self.id).order('created_at DESC')
|
||||
end
|
||||
end
|
||||
|
|
|
|||
|
|
@ -1,7 +1,28 @@
|
|||
class PublishedPage < ApplicationRecord
|
||||
extend FriendlyId
|
||||
friendly_id :name, :use => :slugged
|
||||
friendly_id :title, :use => :slugged
|
||||
belongs_to :all_page
|
||||
belongs_to :article
|
||||
belongs_to :article, optional: true
|
||||
|
||||
def published
|
||||
true
|
||||
end
|
||||
def created_name
|
||||
Admin.find(self.created_by).description
|
||||
end
|
||||
|
||||
def created_date
|
||||
self.created_at.to_date
|
||||
end
|
||||
def article_friendly
|
||||
ret = ''
|
||||
if self.type_of == 3 && self.article
|
||||
pp = self.article.published_pages.where('type_of = 2').first
|
||||
unless pp.blank?
|
||||
ret = pp.friendly_id
|
||||
end
|
||||
end
|
||||
return ret
|
||||
end
|
||||
|
||||
end
|
||||
|
|
|
|||
|
|
@ -8,20 +8,25 @@
|
|||
<table class="table table-bordered">
|
||||
<tbody>
|
||||
<tr>
|
||||
<th style="width: 10px">#</th>
|
||||
<th>Nazwa</th>
|
||||
<th>Publiczna/Aktualna</th>
|
||||
<th>Tytuł</th>
|
||||
<th>Rodzaj</th>
|
||||
<th>Data utworzenia</th>
|
||||
<th style="width: 80px">Akcje</th>
|
||||
<th style="width: 200px">Akcje</th>
|
||||
</tr>
|
||||
<% for ap in @all_pages %>
|
||||
<tr>
|
||||
<td><%= ap.name %></td>
|
||||
<td id="publish_<%= ap.id %>"><%= link_to raw(ap.published_page ? '<span class="badge bg-green" title="Zdejmij publikację">Tak</span>' : '<span class="badge bg-red" title="Opublikuj">Nie</span>'), (ap.published_page ? {controller: '/admin/all_page', action: 'unpublish', id: ap.id} : {controller: '/admin/all_page', action: 'publish', id: ap.id}), remote: true %>/<%= raw(ap.published.eql?(true) ? '<span class="badge bg-green">Tak</span>' : '<span class="badge bg-red">Nie</span>') %></td>
|
||||
<td><%= ap.title %></td>
|
||||
<td><%= ap.type_of %></td>
|
||||
<td><%= AllPage::PAGE_TYPES[ap.type_of] %></td>
|
||||
<td><%= ap.updated_at %></td>
|
||||
<td></td>
|
||||
<td>
|
||||
<%= link_to raw('<i class="fa fa-edit"></i> Edycja'), {controller: '/admin/all_page', action: 'edit', id: ap.id}, class: 'btn btn-xs btn-info' %>
|
||||
<%= link_to raw('<i class="fa fa-trash"></i> Usuń'), {controller: '/admin/all_page', action: 'destroy', id: ap.id}, class: "btn btn-danger btn-xs", method: :delete, data: { confirm: 'Czy na pewno usunąć?' } %>
|
||||
<%= link_to raw('<i class="fa fa-search"></i> Podgląd'), {controller: '/site', action: 'preview', id: ap.id}, class: 'btn btn-xs btn-primary', target: '__blank' %>
|
||||
</td>
|
||||
</tr>
|
||||
<% end %>
|
||||
</tbody>
|
||||
|
|
|
|||
|
|
@ -0,0 +1,3 @@
|
|||
<%= form_tag({:controller => '/admin/all_page', :action => :update, :id => @all_page.id}, :method => :put, :remote => true, :id => 'all_page_form_id', :authenticity_token => true) do %>
|
||||
<%= render 'form' %>
|
||||
<% end %>
|
||||
|
|
@ -0,0 +1,63 @@
|
|||
<%= stylesheet_link_tag 'select2' %>
|
||||
<div class="box-body">
|
||||
<% if @all_page.errors.any? %>
|
||||
<%= raw errors_to_html(@all_page.errors) %>
|
||||
<% end %>
|
||||
<div class="form-group">
|
||||
<label>Nazwa (Link w menu)</label>
|
||||
<%= text_field :all_page, :name, class: "form-control", placeholder: 'Nazwa' %>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label>Tytuł (SEO)</label>
|
||||
<%= text_field :all_page, :title, class: "form-control", placeholder: 'Tytuł' %>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col-md-6">
|
||||
<div class="form-group">
|
||||
<label>Rodzaj strony</label>
|
||||
<%= select(:all_page, :type_of, options_for_select(AllPage::FORM_PAGE_TYPES, @all_page.type_of.to_s), {:selected => @all_page.type_of.to_s}, {class: 'form-control select2'}) %>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-md-6">
|
||||
<div class="form-group">
|
||||
<label>Grupa wpisów</label>
|
||||
<%= select(:all_page, :article_id, @articles.collect {|p| [ p.name, p.id ] }, {:include_blank => true, :selected => @all_page.article_id.to_s}, {class: 'form-control select2'}) %>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label>Treść</label>
|
||||
<%= text_area :all_page, :full_text, :class => "summernote" %>
|
||||
</div>
|
||||
<div class="box-footer">
|
||||
<%= hidden_field_tag 'publish', '0' %>
|
||||
<%= submit_tag 'Zapisz', class: "btn btn-primary" %>
|
||||
<%= link_to 'Zapisz i Opublikuj', '#', class: 'btn btn-success', onclick: 'publishForm()' %>
|
||||
<% if action_name.eql?('edit') %>
|
||||
<%= link_to 'Podgląd', '/site/preview/' + @all_page.id.to_s, class: 'btn btn-info pull-right', target: '__blank' %>
|
||||
<% end %>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
<% content_for :footer_scripts do %>
|
||||
<%= javascript_include_tag 'select2' %>
|
||||
<script type="text/javascript">
|
||||
function publishForm() {
|
||||
$('#publish').val('1');
|
||||
<% if action_name.eql?('edit') %>
|
||||
form = document.getElementById('all_page_form_id');
|
||||
Rails.fire(form, 'submit');
|
||||
<% else %>
|
||||
$('#all_page_form_id').submit();
|
||||
<% end %>
|
||||
}
|
||||
$(document).ready(function() {
|
||||
$('.select2').select2();
|
||||
$('.summernote').summernote({
|
||||
height: 300,
|
||||
tabsize: 2,
|
||||
lang: 'pl-PL'
|
||||
});
|
||||
});
|
||||
</script>
|
||||
<% end %>
|
||||
|
|
@ -0,0 +1 @@
|
|||
<%= link_to raw(@all_page.published_page.blank? ? '<span class="badge bg-green" title="Zdejmij publikację">Tak</span>' : '<span class="badge bg-red" title="Opublikuj">Nie</span>'), (@all_page.published_page.blank? ? {controller: '/admin/all_page', action: 'unpublish', id: @all_page.id} : {controller: '/admin/all_page', action: 'publish', id: @all_page.id}), remote: true %>/<%= raw(@all_page.published.eql?(true) ? '<span class="badge bg-green">Tak</span>' : '<span class="badge bg-red">Nie</span>') %>
|
||||
|
|
@ -0,0 +1,31 @@
|
|||
<ul id="sortable">
|
||||
<% for pp in @published_pages %>
|
||||
<li data-id="<%= pp.id %>" data-name="<%= pp.name %>" class="ui-state-default"><%= pp.name %></li>
|
||||
<% end %>
|
||||
</ul>
|
||||
<pre id="serialize_output2"></pre>
|
||||
<% content_for :footer_scripts do %>
|
||||
<%= javascript_include_tag 'jquery-sortable' %>
|
||||
<script type="text/javascript">
|
||||
$(document).ready(function() {
|
||||
$( "#sortable" ).sortable({
|
||||
placeholder: "ui-state-highlight"
|
||||
});
|
||||
$( "#sortable" ).disableSelection();
|
||||
/*
|
||||
var group = $("ol.sorting_pages").sortable({
|
||||
group: 'sorting_pages',
|
||||
delay: 500,
|
||||
onDrop: function ($item, container, _super) {
|
||||
var data = group.sortable("serialize").get();
|
||||
|
||||
var jsonString = JSON.stringify(data, null, ' ');
|
||||
|
||||
$('#serialize_output2').text(jsonString);
|
||||
_super($item, container);
|
||||
}
|
||||
});
|
||||
*/
|
||||
});
|
||||
</script>
|
||||
<% end %>
|
||||
|
|
@ -0,0 +1,2 @@
|
|||
$.notify("Zapisano pomyślnie", "success");
|
||||
$('#all_page_form').html("<%= escape_javascript(render('/admin/all_page/edit')) %>");
|
||||
|
|
@ -0,0 +1,12 @@
|
|||
<div class="row">
|
||||
<div class="col-md-12">
|
||||
<div class="box">
|
||||
<div class="box-header with-border">
|
||||
<h3 class="box-title">Edycja Strony</h3>
|
||||
</div>
|
||||
<div id="all_page_form">
|
||||
<%= render 'edit' %>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
|
@ -0,0 +1,5 @@
|
|||
<% if @all_page.errors %>
|
||||
<% @all_page.errors.full_messages.each do |msg| %>
|
||||
$.notify("Błąd zapisu: \n<%= raw msg %>", "error");
|
||||
<% end %>
|
||||
<% end %>
|
||||
|
|
@ -3,11 +3,28 @@
|
|||
<div class="box">
|
||||
<div class="box-header with-border">
|
||||
<h3 class="box-title">Strony</h3>
|
||||
<div class="box-tools"><%= link_to 'Dodaj', '/admin/all_page/new', class: 'btn btn-block btn-primary btn-sm' %>
|
||||
<div class="box-tools"><%= link_to 'Dodaj', '/admin/all_page/new', class: 'btn btn-block btn-primary btn-sm' %></div>
|
||||
</div>
|
||||
<!-- /.box-header -->
|
||||
<div class="box-body">
|
||||
<%= render 'all_pages' %>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<% if false %>
|
||||
<div class="row">
|
||||
<div class="col-md-12">
|
||||
<div class="box">
|
||||
<div class="box-header with-border">
|
||||
<h3 class="box-title">Kolejność wyświetlania stron publicznych</h3>
|
||||
|
||||
</div>
|
||||
<!-- /.box-header -->
|
||||
<div class="box-body">
|
||||
<%= render 'published_pages_priority' %>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<% end %>
|
||||
|
|
|
|||
|
|
@ -1,24 +1,14 @@
|
|||
|
||||
<div class="row">
|
||||
<div class="col-md-12">
|
||||
<div class="box">
|
||||
<div class="box-header with-border">
|
||||
<h3 class="box-title">Strony</h3>
|
||||
<h3 class="box-title">Nowa Strona</h3>
|
||||
</div>
|
||||
<!-- /.box-header -->
|
||||
<div class="box-body">
|
||||
<div class="summernote"><p>Hello World</p></div>
|
||||
<div id="all_page_form">
|
||||
<%= form_tag({:controller => '/admin/all_page', :action => :create}, :id => 'all_page_form_id', :authenticity_token => true) do %>
|
||||
<%= render 'form' %>
|
||||
<% end %>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
<% content_for :footer_scripts do %>
|
||||
<script type="text/javascript">
|
||||
$(document).ready(function() {
|
||||
$('.summernote').summernote({
|
||||
height: 300,
|
||||
tabsize: 2,
|
||||
lang: 'pl-PL'
|
||||
});
|
||||
});
|
||||
</script>
|
||||
<% end %>
|
||||
|
|
|
|||
|
|
@ -0,0 +1,5 @@
|
|||
<% if @all_page.errors %>
|
||||
<% @all_page.errors.full_messages.each do |msg| %>
|
||||
$.notify("Błąd zapisu: \n<%= raw msg %>", "error");
|
||||
<% end %>
|
||||
<% end %>
|
||||
|
|
@ -0,0 +1,8 @@
|
|||
<% if @published_page.errors %>
|
||||
<% @published_page.errors.full_messages.each do |msg| %>
|
||||
$.notify("Błąd zapisu: \n<%= raw msg %>", "error");
|
||||
<% end %>
|
||||
<% else %>
|
||||
$.notify("Opublikowano pomyślnie", "success");
|
||||
<% end %>
|
||||
$('#publish_<%= @all_page.id %>').html('<%= escape_javascript(render('/admin/all_page/public_act')) %>');
|
||||
|
|
@ -0,0 +1,2 @@
|
|||
$.notify("Pomyślnie zdjęto publikację", "success");
|
||||
$('#publish_<%= @all_page.id %>').html('<%= escape_javascript(render('/admin/all_page/public_act')) %>');
|
||||
|
|
@ -0,0 +1 @@
|
|||
$.notify("Zapisano pomyślnie", "success");
|
||||
|
|
@ -0,0 +1,30 @@
|
|||
<% if @articles.blank? %>
|
||||
<div class="callout callout-warning">
|
||||
<h4>Brak wpisów</h4>
|
||||
<p>Dla kategorii Artykuły.</p>
|
||||
</div>
|
||||
<% else %>
|
||||
<table class="table table-bordered">
|
||||
<tbody>
|
||||
<tr>
|
||||
<th>Nazwa</th>
|
||||
<th>Ilość wpisów</th>
|
||||
<th>Ilość wpisów publicznych</th>
|
||||
<th>Data utworzenia</th>
|
||||
<th style="width: 180px">Akcje</th>
|
||||
</tr>
|
||||
<% for ap in @articles %>
|
||||
<tr>
|
||||
<td><%= link_to ap.name, {controller: '/admin/article', action: 'show', id: ap.id} %></td>
|
||||
<td><%= raw('<span class="badge bg-yellow">' + ap.all_page_articles.size.to_s + '</span>') %></td>
|
||||
<td><%= raw('<span class="badge bg-green">' + ap.published_page_articles.size.to_s + '</span>') %></td>
|
||||
<td><%= ap.updated_at %></td>
|
||||
<td>
|
||||
<%= link_to raw('<i class="fa fa-edit"></i> Edycja'), {controller: '/admin/article', action: 'edit', id: ap.id}, class: 'btn btn-xs btn-info' %>
|
||||
<%= link_to raw('<i class="fa fa-trash"></i> Usuń'), {controller: '/admin/article', action: 'destroy', id: ap.id}, class: "btn btn-danger btn-xs", method: :delete, data: { confirm: 'Czy na pewno usunąć?' } %>
|
||||
</td>
|
||||
</tr>
|
||||
<% end %>
|
||||
</tbody>
|
||||
</table>
|
||||
<% end %>
|
||||
|
|
@ -0,0 +1,13 @@
|
|||
<div class="row">
|
||||
<div class="col-md-12">
|
||||
<div class="box">
|
||||
<div class="box-header with-border">
|
||||
<h3 class="box-title">Grupy Wpisów</h3>
|
||||
<div class="box-tools"><%= link_to 'Dodaj', '/admin/article/new', class: 'btn btn-block btn-primary btn-sm' %>
|
||||
</div>
|
||||
<!-- /.box-header -->
|
||||
<div class="box-body">
|
||||
<%= render 'articles' %>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
|
@ -0,0 +1,13 @@
|
|||
<div class="row">
|
||||
<div class="col-md-12">
|
||||
<div class="box">
|
||||
<div class="box-header with-border">
|
||||
<h3 class="box-title">Grupa Wpisów: <strong><%= @article.name %></strong></h3>
|
||||
<div class="box-tools"><%= link_to 'Dodaj wpis', {controller: '/admin/articles/all_page', action: 'new', aid: @article.id}, class: 'btn btn-block btn-primary btn-sm' %></div>
|
||||
</div>
|
||||
<div id="all_pages">
|
||||
<%= render '/admin/articles/all_page/all_pages' %>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
|
@ -0,0 +1,34 @@
|
|||
<% if @all_pages.blank? %>
|
||||
<div class="callout callout-warning">
|
||||
<h4>Brak wpisów</h4>
|
||||
|
||||
<p>Dla kategorii Strony.</p>
|
||||
</div>
|
||||
<% else %>
|
||||
<table class="table table-bordered">
|
||||
<tbody>
|
||||
<tr>
|
||||
<th>Nazwa</th>
|
||||
<th>Publiczna/Aktualna</th>
|
||||
<th>Tytuł</th>
|
||||
<th>Rodzaj</th>
|
||||
<th>Data utworzenia</th>
|
||||
<th style="width: 200px">Akcje</th>
|
||||
</tr>
|
||||
<% for ap in @all_pages %>
|
||||
<tr>
|
||||
<td><%= ap.name %></td>
|
||||
<td id="publish_<%= ap.id %>"><%= link_to raw(ap.published_page ? '<span class="badge bg-green" title="Zdejmij publikację">Tak</span>' : '<span class="badge bg-red" title="Opublikuj">Nie</span>'), (ap.published_page ? {controller: '/admin/all_page', action: 'unpublish', id: ap.id} : {controller: '/admin/all_page', action: 'publish', id: ap.id}), remote: true %>/<%= raw(ap.published.eql?(true) ? '<span class="badge bg-green">Tak</span>' : '<span class="badge bg-red">Nie</span>') %></td>
|
||||
<td><%= ap.title %></td>
|
||||
<td><%= AllPage::PAGE_TYPES[ap.type_of] %></td>
|
||||
<td><%= ap.updated_at %></td>
|
||||
<td>
|
||||
<%= link_to raw('<i class="fa fa-edit"></i> Edycja'), {controller: '/admin/articles/all_page', action: 'edit', id: ap.id, aid: ap.article_id}, class: 'btn btn-xs btn-info' %>
|
||||
<%= link_to raw('<i class="fa fa-trash"></i> Usuń'), {controller: '/admin/articles/all_page', action: 'destroy', id: ap.id, aid: ap.article_id}, class: "btn btn-danger btn-xs", method: :delete, data: { confirm: 'Czy na pewno usunąć?' } %>
|
||||
<%= link_to raw('<i class="fa fa-search"></i> Podgląd'), {controller: '/site', action: 'preview', id: ap.id}, class: 'btn btn-xs btn-primary', target: '__blank' %>
|
||||
</td>
|
||||
</tr>
|
||||
<% end %>
|
||||
</tbody>
|
||||
</table>
|
||||
<% end %>
|
||||
|
|
@ -0,0 +1,3 @@
|
|||
<%= form_tag({:controller => '/admin/articles/all_page', :action => :update, :id => @all_page.id, :aid => @article.id}, :method => :put, :remote => true, :id => 'all_page_form_id', :authenticity_token => true) do %>
|
||||
<%= render 'form' %>
|
||||
<% end %>
|
||||
|
|
@ -0,0 +1,56 @@
|
|||
<%= stylesheet_link_tag 'select2' %>
|
||||
<div class="box-body">
|
||||
<% if @all_page.errors.any? %>
|
||||
<%= raw errors_to_html(@all_page.errors) %>
|
||||
<% end %>
|
||||
<div class="form-group">
|
||||
<label>Nazwa skrócona</label>
|
||||
<%= text_field :all_page, :name, class: "form-control", placeholder: 'Nazwa' %>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label>Tytuł na liście wpisów</label>
|
||||
<%= text_field :all_page, :title, class: "form-control", placeholder: 'Tytuł' %>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label>Krótki opis dla Wpisu (wyświetlany na liście skróconej)</label>
|
||||
<%= text_area :all_page, :small_text, :class => "form-control" %>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label>Treść</label>
|
||||
<%= text_area :all_page, :full_text, :class => "summernote" %>
|
||||
</div>
|
||||
<div class="box-footer">
|
||||
<%= hidden_field :all_page, :type_of %>
|
||||
<%= hidden_field :all_page, :article_id %>
|
||||
<%= hidden_field_tag 'publish', '0' %>
|
||||
<%= submit_tag 'Zapisz', class: "btn btn-primary" %>
|
||||
<%= link_to 'Zapisz i Opublikuj', '#', class: 'btn btn-success', onclick: 'publishForm()' %>
|
||||
<% if action_name.eql?('edit') %>
|
||||
<%= link_to 'Podgląd', '/site/preview/' + @all_page.id.to_s, class: 'btn btn-info pull-right', target: '__blank' %>
|
||||
<% end %>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
<% content_for :footer_scripts do %>
|
||||
<%= javascript_include_tag 'select2' %>
|
||||
<script type="text/javascript">
|
||||
function publishForm() {
|
||||
$('#publish').val('1');
|
||||
<% if action_name.eql?('edit') %>
|
||||
form = document.getElementById('all_page_form_id');
|
||||
Rails.fire(form, 'submit');
|
||||
<% else %>
|
||||
$('#all_page_form_id').submit();
|
||||
<% end %>
|
||||
//$('#all_page_form_id').dispatchEvent(new Event('submit', {bubbles: true}));
|
||||
}
|
||||
$(document).ready(function() {
|
||||
$('.select2').select2();
|
||||
$('.summernote').summernote({
|
||||
height: 300,
|
||||
tabsize: 2,
|
||||
lang: 'pl-PL'
|
||||
});
|
||||
});
|
||||
</script>
|
||||
<% end %>
|
||||
|
|
@ -0,0 +1 @@
|
|||
<%= link_to raw(@all_page.published_page.blank? ? '<span class="badge bg-green" title="Zdejmij publikację">Tak</span>' : '<span class="badge bg-red" title="Opublikuj">Nie</span>'), (@all_page.published_page.blank? ? {controller: '/admin/articles/all_page', action: 'unpublish', id: @all_page.id} : {controller: '/admin/articles/all_page', action: 'publish', id: @all_page.id}), remote: true %>/<%= raw(@all_page.published.eql?(true) ? '<span class="badge bg-green">Tak</span>' : '<span class="badge bg-red">Nie</span>') %>
|
||||
|
|
@ -0,0 +1,12 @@
|
|||
<div class="row">
|
||||
<div class="col-md-12">
|
||||
<div class="box">
|
||||
<div class="box-header with-border">
|
||||
<h3 class="box-title">Edycja Wpisu dla <strong><%= @article.name %></strong></h3>
|
||||
</div>
|
||||
<div id="all_page_form">
|
||||
<%= render 'edit' %>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
|
@ -0,0 +1,5 @@
|
|||
<% if @all_page.errors %>
|
||||
<% @all_page.errors.full_messages.each do |msg| %>
|
||||
$.notify("Błąd zapisu: \n<%= raw msg %>", "error");
|
||||
<% end %>
|
||||
<% end %>
|
||||
|
|
@ -0,0 +1,14 @@
|
|||
<div class="row">
|
||||
<div class="col-md-12">
|
||||
<div class="box">
|
||||
<div class="box-header with-border">
|
||||
<h3 class="box-title">Nowy Wpis dla <strong><%= @article.name %></strong></h3>
|
||||
</div>
|
||||
<div id="all_page_form">
|
||||
<%= form_tag({:controller => '/admin/articles/all_page', :action => :create}, :id => 'all_page_form_id', :authenticity_token => true) do %>
|
||||
<%= render 'form' %>
|
||||
<% end %>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
|
@ -0,0 +1,8 @@
|
|||
<% if @published_page.errors %>
|
||||
<% @published_page.errors.full_messages.each do |msg| %>
|
||||
$.notify("Błąd zapisu: \n<%= raw msg %>", "error");
|
||||
<% end %>
|
||||
<% else %>
|
||||
$.notify("Opublikowano pomyślnie", "success");
|
||||
<% end %>
|
||||
$('#publish_<%= @all_page.id %>').html('<%= escape_javascript(render('/admin/articles/all_page/public_act')) %>');
|
||||
|
|
@ -0,0 +1,2 @@
|
|||
$.notify("Pomyślnie zdjęto publikację", "success");
|
||||
$('#publish_<%= @all_page.id %>').html('<%= escape_javascript(render('/admin/articles/all_page/public_act')) %>');
|
||||
|
|
@ -0,0 +1 @@
|
|||
$.notify("Zapisano pomyślnie", "success");
|
||||
|
|
@ -3,7 +3,7 @@
|
|||
<head>
|
||||
<title>Ubezpieczenia - Należności - Panel Administracyjny</title>
|
||||
<%= csrf_meta_tags %>
|
||||
|
||||
<%= favicon_link_tag %>
|
||||
<%= stylesheet_link_tag 'application','bootstrap_lte' , 'font-awesome' , media: 'all', 'data-turbolinks-track': 'reload' %>
|
||||
<link href="https://fonts.googleapis.com/css?family=Source+Sans+Pro:300,400,600,700,300italic,400italic,600italic" rel='stylesheet' type='text/css'>
|
||||
<%= stylesheet_link_tag 'AdminLTE', 'skin-blue', 'summernote' %>
|
||||
|
|
@ -68,11 +68,9 @@
|
|||
<!-- Sidebar Menu -->
|
||||
<ul class="sidebar-menu" data-widget="tree">
|
||||
<li class="header">MENU</li>
|
||||
<!-- Optionally, you can add icons to the links -->
|
||||
<li class="active"><a href="/admin"><i class="fa fa-home"></i> <span>Home</span></a></li>
|
||||
<li><a href="/admin/all_page"><i class="fa fa-sitemap"></i> <span>Strony</span></a></li>
|
||||
<li><a href="/admin"><i class="fa fa-picture-o"></i> <span>Zdjęcia</span></a></li>
|
||||
<li><a href="/admin/article"><i class="fa fa-picture-o"></i> <span>Artykuły</span></a></li>
|
||||
<li <%= raw controller_path.to_s.include?('admin/home') ? 'class="active"' : '' %>><a href="/admin"><i class="fa fa-home"></i> <span>Home</span></a></li>
|
||||
<li <%= raw controller_path.to_s.include?('admin/all_page') ? 'class="active"' : '' %>><a href="/admin/all_page"><i class="fa fa-sitemap"></i> <span>Strony</span></a></li>
|
||||
<li <%= raw controller_path.to_s.include?('admin/article') ? 'class="active"' : '' %>><a href="/admin/article"><i class="fa fa-pencil-square-o"></i> <span>Grupy Wpisów</span></a></li>
|
||||
</ul>
|
||||
<!-- /.sidebar-menu -->
|
||||
</section>
|
||||
|
|
@ -97,7 +95,7 @@
|
|||
</footer>
|
||||
<div class="control-sidebar-bg"></div>
|
||||
</div>
|
||||
<%= javascript_include_tag 'bootstrap_lte', 'adminlte', 'summernote', 'summernote-pl-PL' %>
|
||||
<%= javascript_include_tag 'bootstrap_lte', 'adminlte', 'summernote', 'summernote-pl-PL', 'notify' %>
|
||||
<%= yield :footer_scripts %>
|
||||
</body>
|
||||
</html>
|
||||
|
|
|
|||
|
|
@ -3,7 +3,7 @@
|
|||
<head>
|
||||
<title><%= @page.blank? ? 'Ubezpieczenia - Należności' : @page.title %></title>
|
||||
<%= csrf_meta_tags %>
|
||||
|
||||
<%= favicon_link_tag %>
|
||||
<%= stylesheet_link_tag 'application','bootstrap' , 'font-awesome' , media: 'all', 'data-turbolinks-track': 'reload' %>
|
||||
<link href='https://fonts.googleapis.com/css?family=Open+Sans:300italic,400italic,600italic,700italic,800italic,400,300,600,700,800' rel='stylesheet' type='text/css'>
|
||||
<link href='https://fonts.googleapis.com/css?family=Merriweather:400,300,300italic,400italic,700,700italic,900,900italic' rel='stylesheet' type='text/css'>
|
||||
|
|
@ -14,6 +14,17 @@
|
|||
<body>
|
||||
<%= raw menu_top(@pages) %>
|
||||
<%= yield %>
|
||||
<hr>
|
||||
<footer>
|
||||
<div class="container">
|
||||
<div class="row">
|
||||
<div class="col-lg-8 col-md-10 mx-auto">
|
||||
<p class="copyright text-muted">Copyright © Ubezpieczenia-Należnośći 2018</p>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</footer>
|
||||
<%= javascript_include_tag 'bootstrap.bundle', 'jquery.easing', 'creative' %>
|
||||
<%= yield :footer_scripts %>
|
||||
</body>
|
||||
</html>
|
||||
|
|
|
|||
|
|
@ -3,7 +3,7 @@
|
|||
<head>
|
||||
<title>Ubezpieczenia - Należności - Panel Administracyjny</title>
|
||||
<%= csrf_meta_tags %>
|
||||
|
||||
<%= favicon_link_tag %>
|
||||
<%= stylesheet_link_tag 'application','bootstrap_lte' , 'font-awesome' , media: 'all', 'data-turbolinks-track': 'reload' %>
|
||||
<link href='href="https://fonts.googleapis.com/css?family=Source+Sans+Pro:300,400,600,700,300italic,400italic,600italic"' rel='stylesheet' type='text/css'>
|
||||
<%= stylesheet_link_tag 'AdminLTE' %>
|
||||
|
|
|
|||
|
|
@ -8,7 +8,7 @@
|
|||
<h1 class="text-uppercase">
|
||||
<strong style="display:none" id="line2">Pieniądze są najważniejsze</strong>
|
||||
</h1>
|
||||
<hr style="visibility:hidden" id="line3">
|
||||
<hr class="mini" style="visibility:hidden" id="line3">
|
||||
</div>
|
||||
<div class="col-lg-8 mx-auto" >
|
||||
<p class="text-faded mb-5" style="visibility:hidden" id="line4">czyli dlaczego warto ubezpieczać należności</p>
|
||||
|
|
|
|||
|
|
@ -0,0 +1,54 @@
|
|||
<!-- Page Header -->
|
||||
<header class="contacthead" style="background-image: url('/assets/header.jpg')">
|
||||
<div class="overlay"></div>
|
||||
<div class="container">
|
||||
<div class="row">
|
||||
<div class="col-lg-8 col-md-10 mx-auto">
|
||||
<div class="page-heading">
|
||||
<h1>Skontaktuj się</h1>
|
||||
<span class="subheading">Masz pytania? Udzielę odpowiedzi.</span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</header>
|
||||
|
||||
<!-- Main Content -->
|
||||
<div class="container">
|
||||
<div class="row">
|
||||
<div class="col-lg-8 col-md-10 mx-auto">
|
||||
<p>Wypełnij poniższy formularz i wyślij go do mnie. Odpowiem najszybciej jak to możliwe.</p>
|
||||
<!-- Contact Form - Enter your email address on line 19 of the mail/contact_me.php file to make this form work. -->
|
||||
<!-- WARNING: Some web hosts do not allow emails to be sent through forms to common mail hosts like Gmail or Yahoo. It's recommended that you use a private domain email address! -->
|
||||
<!-- To use the contact form, your site must be on a live web host with PHP! The form will not work locally! -->
|
||||
<form name="sentMessage" id="contactForm" novalidate>
|
||||
<div class="control-group">
|
||||
<div class="form-group floating-label-form-group controls">
|
||||
<label>Imię</label>
|
||||
<input type="text" class="form-control" placeholder="Imię" id="name" required data-validation-required-message="Proszę podać Imię.">
|
||||
<p class="help-block text-danger"></p>
|
||||
</div>
|
||||
</div>
|
||||
<div class="control-group">
|
||||
<div class="form-group floating-label-form-group controls">
|
||||
<label>Adres Email</label>
|
||||
<input type="email" class="form-control" placeholder="Adres Email" id="email" required data-validation-required-message="Proszę wprowadzić adres email.">
|
||||
<p class="help-block text-danger"></p>
|
||||
</div>
|
||||
</div>
|
||||
<div class="control-group">
|
||||
<div class="form-group floating-label-form-group controls">
|
||||
<label>Wiadomość</label>
|
||||
<textarea rows="5" class="form-control" placeholder="Wiadomość" id="message" required data-validation-required-message="Proszę wprowadzić wiadomość."></textarea>
|
||||
<p class="help-block text-danger"></p>
|
||||
</div>
|
||||
</div>
|
||||
<br>
|
||||
<div id="success"></div>
|
||||
<div class="form-group">
|
||||
<button type="submit" class="btn btn-primary" id="sendMessageButton">Wyślij</button>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
|
@ -0,0 +1,33 @@
|
|||
<header class="title">
|
||||
<div class="container">
|
||||
<h1><%= @page.title %></h1>
|
||||
</div>
|
||||
</header>
|
||||
<% if @page.type_of != 2 %>
|
||||
<section>
|
||||
<div class="container">
|
||||
<%= raw @page.full_text %>
|
||||
</div>
|
||||
</section>
|
||||
|
||||
<% elsif @page.type_of == 2 && @page.article && !@page.article.all_page_articles.blank? %>
|
||||
<section>
|
||||
<div class="container">
|
||||
<% for pas in @page.article.all_page_articles %>
|
||||
<div class="post-preview">
|
||||
<a href="/site/<%= pas.friendly_id %>">
|
||||
<h2 class="post-title">
|
||||
<%= pas.title %>
|
||||
</h2>
|
||||
<h3 class="post-subtitle">
|
||||
<%= raw pas.small_text %>
|
||||
</h3>
|
||||
</a>
|
||||
<p class="post-meta">Opublikowany <%= pas.created_date %> przez
|
||||
<a href="#"><%= pas.created_name %></a></p>
|
||||
</div>
|
||||
<hr>
|
||||
<% end %>
|
||||
</div>
|
||||
</section>
|
||||
<% end %>
|
||||
|
|
@ -0,0 +1,33 @@
|
|||
<header class="title">
|
||||
<div class="container">
|
||||
<h1><%= @page.title %></h1>
|
||||
</div>
|
||||
</header>
|
||||
<% if @page.type_of != 2 %>
|
||||
<section>
|
||||
<div class="container">
|
||||
<%= raw @page.full_text %>
|
||||
</div>
|
||||
</section>
|
||||
|
||||
<% elsif @page.type_of == 2 && @page.article && !@page.article.published_page_articles.blank? %>
|
||||
<section>
|
||||
<div class="container">
|
||||
<% for pas in @page.article.published_page_articles %>
|
||||
<div class="post-preview">
|
||||
<a href="/site/<%= pas.friendly_id %>">
|
||||
<h2 class="post-title">
|
||||
<%= pas.title %>
|
||||
</h2>
|
||||
<h3 class="post-subtitle">
|
||||
<%= raw pas.small_text %>
|
||||
</h3>
|
||||
</a>
|
||||
<p class="post-meta">Opublikowany <%= pas.created_date %> przez
|
||||
<a href="#"><%= pas.created_name %></a></p>
|
||||
</div>
|
||||
<hr>
|
||||
<% end %>
|
||||
</div>
|
||||
</section>
|
||||
<% end %>
|
||||
|
|
@ -1,13 +1,21 @@
|
|||
Rails.application.routes.draw do
|
||||
namespace :admin do
|
||||
namespace :articles do
|
||||
get 'all_page/publish'
|
||||
get 'all_page/unpublish'
|
||||
resources :all_page
|
||||
end
|
||||
root 'home#index'
|
||||
resources :home
|
||||
get 'all_page/publish'
|
||||
get 'all_page/unpublish'
|
||||
get 'all_page/change_priority'
|
||||
resources :all_page
|
||||
resources :article
|
||||
end
|
||||
devise_for :admins
|
||||
get 'site/kontakt'
|
||||
get 'site/preview/:id' => 'site#preview'
|
||||
root 'site#index'
|
||||
resources :site
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue