Popravki v temi
This commit is contained in:
parent
6f63a6ac50
commit
d2bfbff9b1
@ -1,176 +1,188 @@
|
||||
/**
|
||||
* JS povezani s prijavo in registracijo
|
||||
*/
|
||||
(function ($, Drupal, window, document) {
|
||||
(function ($) {
|
||||
|
||||
'use strict';
|
||||
|
||||
|
||||
// To understand behaviors, see https://drupal.org/node/756722#behaviors
|
||||
Drupal.behaviors.prijavaInRegistracija = {
|
||||
/* Drupal.behaviors.prijavaInRegistracija = {
|
||||
attach: function (context, settings) {
|
||||
}
|
||||
};*/
|
||||
|
||||
jQuery(document).ready(function () {
|
||||
jQuery(document).ready(function () {
|
||||
|
||||
// Drupal nova prijava
|
||||
jQuery('.submit-prijava').on('click', function(){
|
||||
// ODstranimo vse napake
|
||||
jQuery('.error-field').removeClass('error-field');
|
||||
// Drupal nova prijava
|
||||
jQuery('.submit-prijava').on('click', function(){
|
||||
izvediPrijavoUporabnika();
|
||||
});
|
||||
jQuery('.prijava-password-input').keyup(function(e){
|
||||
if(e.keyCode == 13){
|
||||
izvediPrijavoUporabnika();
|
||||
}
|
||||
});
|
||||
|
||||
// Odpremo drop down menu za uporabnika
|
||||
jQuery('#user-login-menu').on('click', function () {
|
||||
jQuery('#user-menu').toggle();
|
||||
});
|
||||
|
||||
jQuery(':input[required]:visible').each(function () {
|
||||
if (jQuery(this).val() == '') {
|
||||
jQuery(this).addClass('error-field');
|
||||
}
|
||||
});
|
||||
// Obnovitev gesla
|
||||
jQuery('#open-modal-lost-password').on('click', function () {
|
||||
jQuery('#modal-login').hide();
|
||||
jQuery('#modal-lost-password').css('display', 'flex');
|
||||
});
|
||||
|
||||
if( jQuery('.error-field').length > 0){
|
||||
return false;
|
||||
}
|
||||
jQuery('#submit-lost-password').on('click', function () {
|
||||
jQuery('.obvestilo').empty().hide();
|
||||
jQuery('#input-obnovitev-email').removeClass('error');
|
||||
|
||||
var emailObnovitev = jQuery('#obnovitev-gesla-email').val();
|
||||
|
||||
jQuery('#prijava-1ka .error-message').empty().hide();
|
||||
if (emailObnovitev.length == 0 || emailObnovitev.length > 1 && (emailObnovitev.search('@') == -1 || emailObnovitev.indexOf('.') == -1)) {
|
||||
jQuery('#input-obnovitev-email').addClass('error');
|
||||
|
||||
var sendVariables = jQuery('#forma-prijava :input').serialize();
|
||||
var url = jQuery('#forma-prijava').attr('action');
|
||||
return false;
|
||||
}
|
||||
|
||||
jQuery.post(url, sendVariables, function (data) {
|
||||
var response = JSON.parse(data);
|
||||
// V kolikor je vse ok poljemo POST request, da preverimo v bazi
|
||||
jQuery.post('/api/drupal/reset_password', {
|
||||
email: emailObnovitev,
|
||||
ajax: true,
|
||||
jezik: pridobiJezik()
|
||||
}).done(function (val) {
|
||||
val = JSON.parse(val);
|
||||
|
||||
if(response.type == 'success'){
|
||||
jQuery('#modal-lost-password .w-form-done').html('').hide();
|
||||
jQuery('#modal-lost-password .w-form-fail').hide();
|
||||
|
||||
return window.location = response.data.url;
|
||||
if (val.type == 'success') {
|
||||
jQuery('#modal-lost-password .w-form-done').html('<div>' + val.text + '</div>').show();
|
||||
|
||||
} else if(response.type == 'error') {
|
||||
// Če je bil email uspešno poslal potem okno zapremo po 5 sekundah
|
||||
setTimeout(function () {
|
||||
jQuery("#modal-lost-password").hide();
|
||||
jQuery('#modal-lost-password .w-form-done').hide();
|
||||
jQuery("#obnovitev-gesla").val('');
|
||||
}, 2000);
|
||||
|
||||
let sporocilo = vrniBesediloNapake(response.data);
|
||||
} else {
|
||||
|
||||
jQuery('#prijava-1ka .error-message').append(sporocilo).show();
|
||||
// Napaka, če email ne obstaja v bazi
|
||||
jQuery('#modal-lost-password .w-form-fail').html('<div>' + val.text + '</div>').show();
|
||||
|
||||
}
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
// Obnovitev gesla
|
||||
jQuery('#open-modal-lost-password').on('click', function () {
|
||||
jQuery('#modal-login').hide();
|
||||
jQuery('#modal-lost-password').css('display', 'flex');
|
||||
});
|
||||
|
||||
jQuery('#submit-lost-password').on('click', function () {
|
||||
jQuery('.obvestilo').empty().hide();
|
||||
jQuery('#input-obnovitev-email').removeClass('error');
|
||||
|
||||
var emailObnovitev = jQuery('#obnovitev-gesla-email').val();
|
||||
|
||||
if (emailObnovitev.length == 0 || emailObnovitev.length > 1 && (emailObnovitev.search('@') == -1 || emailObnovitev.indexOf('.') == -1)) {
|
||||
jQuery('#input-obnovitev-email').addClass('error');
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
// V kolikor je vse ok poljemo POST request, da preverimo v bazi
|
||||
jQuery.post('/api/drupal/reset_password', {
|
||||
email: emailObnovitev,
|
||||
ajax: true,
|
||||
jezik: pridobiJezik()
|
||||
}).done(function (val) {
|
||||
val = JSON.parse(val);
|
||||
|
||||
jQuery('#modal-lost-password .w-form-done').html('').hide();
|
||||
jQuery('#modal-lost-password .w-form-fail').hide();
|
||||
|
||||
if (val.type == 'success') {
|
||||
jQuery('#modal-lost-password .w-form-done').html('<div>' + val.text + '</div>').show();
|
||||
|
||||
// Če je bil email uspešno poslal potem okno zapremo po 5 sekundah
|
||||
setTimeout(function () {
|
||||
jQuery("#modal-lost-password").hide();
|
||||
jQuery('#modal-lost-password .w-form-done').hide();
|
||||
jQuery("#obnovitev-gesla").val('');
|
||||
}, 2000);
|
||||
|
||||
} else {
|
||||
|
||||
// Napaka, če email ne obstaja v bazi
|
||||
jQuery('#modal-lost-password .w-form-fail').html('<div>' + val.text + '</div>').show();
|
||||
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
// AKtivacija izgubljenega gesla
|
||||
if (window.location.hash == '#aktivacija-gesla') {
|
||||
jQuery('#modal-lost-password-activate').show();
|
||||
}
|
||||
|
||||
jQuery('#submit-lost-password-activation').on('click', function () {
|
||||
jQuery('.w-form-fail').hide();
|
||||
jQuery('.error').removeClass('error');
|
||||
|
||||
var email = jQuery('#aktivacija-email').val();
|
||||
var geslo = jQuery('#aktivacija-geslo').val();
|
||||
var koda = '';
|
||||
var jezik = jQuery('#modal-lost-password [name="jezik"]').val();
|
||||
|
||||
var results = new RegExp('[\?&]code=([^&#]*)').exec(window.location.href);
|
||||
if (results[1].length > 10)
|
||||
koda = results[1];
|
||||
|
||||
if (email.length == 0 || geslo.length == 0 || koda.length == 0) {
|
||||
jQuery('#error-aktivacija-gesla').show();
|
||||
|
||||
if (email.length == 0) {
|
||||
jQuery('#aktivacija-email').addClass('error');
|
||||
}
|
||||
|
||||
if (geslo.length == 0) {
|
||||
jQuery('#aktivacija-geslo').addClass('error');
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
// V kolikor je vse ok poljemo POST request, da preverimo v bazi
|
||||
jQuery.post('/frontend/api/api.php?action=reset_password_activate', {
|
||||
email: email,
|
||||
pass: geslo,
|
||||
code: koda,
|
||||
ajax: true,
|
||||
lang: jezik
|
||||
}).done(function (val) {
|
||||
val = JSON.parse(val);
|
||||
|
||||
jQuery('#error-aktivacija-gesla').removeClass('w-form-fail').removeClass('w-form-done').html('').hide();
|
||||
|
||||
if (val.type == 'success') {
|
||||
jQuery('#error-aktivacija-gesla').addClass('w-form-done').html('<div>' + val.text + '</div>').show();
|
||||
|
||||
// Če je bil email uspešno poslal potem okno zapremo po 5 sekundah
|
||||
setTimeout(function () {
|
||||
window.location.href = val.action;
|
||||
}, 5000);
|
||||
|
||||
} else {
|
||||
|
||||
// Napaka, če email ne obstaja v bazi
|
||||
jQuery('#error-aktivacija-gesla').addClass('w-form-fail').html('<div>' + val.text + '</div>').show();
|
||||
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
// AKtivacija izgubljenega gesla
|
||||
if (window.location.hash == '#aktivacija-gesla') {
|
||||
jQuery('#modal-lost-password-activate').show();
|
||||
}
|
||||
|
||||
jQuery('#submit-lost-password-activation').on('click', function () {
|
||||
jQuery('.w-form-fail').hide();
|
||||
jQuery('.error').removeClass('error');
|
||||
|
||||
};
|
||||
var email = jQuery('#aktivacija-email').val();
|
||||
var geslo = jQuery('#aktivacija-geslo').val();
|
||||
var koda = '';
|
||||
var jezik = jQuery('#modal-lost-password [name="jezik"]').val();
|
||||
|
||||
})(jQuery, Drupal, this, this.document);
|
||||
var results = new RegExp('[\?&]code=([^&#]*)').exec(window.location.href);
|
||||
if (results[1].length > 10)
|
||||
koda = results[1];
|
||||
|
||||
if (email.length == 0 || geslo.length == 0 || koda.length == 0) {
|
||||
jQuery('#error-aktivacija-gesla').show();
|
||||
|
||||
if (email.length == 0) {
|
||||
jQuery('#aktivacija-email').addClass('error');
|
||||
}
|
||||
|
||||
if (geslo.length == 0) {
|
||||
jQuery('#aktivacija-geslo').addClass('error');
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
// V kolikor je vse ok poljemo POST request, da preverimo v bazi
|
||||
jQuery.post('/frontend/api/api.php?action=reset_password_activate', {
|
||||
email: email,
|
||||
pass: geslo,
|
||||
code: koda,
|
||||
ajax: true,
|
||||
lang: jezik
|
||||
}).done(function (val) {
|
||||
val = JSON.parse(val);
|
||||
|
||||
jQuery('#error-aktivacija-gesla').removeClass('w-form-fail').removeClass('w-form-done').html('').hide();
|
||||
|
||||
if (val.type == 'success') {
|
||||
jQuery('#error-aktivacija-gesla').addClass('w-form-done').html('<div>' + val.text + '</div>').show();
|
||||
|
||||
// Če je bil email uspešno poslal potem okno zapremo po 5 sekundah
|
||||
setTimeout(function () {
|
||||
window.location.href = val.action;
|
||||
}, 5000);
|
||||
|
||||
} else {
|
||||
|
||||
// Napaka, če email ne obstaja v bazi
|
||||
jQuery('#error-aktivacija-gesla').addClass('w-form-fail').html('<div>' + val.text + '</div>').show();
|
||||
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
});
|
||||
|
||||
})(jQuery);
|
||||
|
||||
function izvediPrijavoUporabnika()
|
||||
{
|
||||
// ODstranimo vse napake
|
||||
jQuery('.error-field').removeClass('error-field');
|
||||
|
||||
|
||||
jQuery(':input[required]:visible').each(function () {
|
||||
if (jQuery(this).val() == '') {
|
||||
jQuery(this).addClass('error-field');
|
||||
}
|
||||
});
|
||||
|
||||
if( jQuery('.error-field').length > 0){
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
jQuery('#prijava-1ka .error-message').empty().hide();
|
||||
|
||||
var sendVariables = jQuery('#forma-prijava :input').serialize();
|
||||
var url = jQuery('#forma-prijava').attr('action');
|
||||
|
||||
jQuery.post(url, sendVariables, function (data) {
|
||||
var response = JSON.parse(data);
|
||||
|
||||
if(response.type == 'success'){
|
||||
|
||||
return window.location = response.data.url;
|
||||
|
||||
} else if(response.type == 'error') {
|
||||
|
||||
let sporocilo = vrniBesediloNapake(response.data);
|
||||
|
||||
jQuery('#prijava-1ka .error-message').append(sporocilo).show();
|
||||
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
function pridobiJezik(){
|
||||
|
||||
|
@ -1,75 +1,44 @@
|
||||
/**
|
||||
* @file
|
||||
* A JavaScript file for the theme.
|
||||
*
|
||||
* In order for this JavaScript to be loaded on pages, see the instructions in
|
||||
* the README.txt next to this file.
|
||||
*/
|
||||
|
||||
// JavaScript should be made compatible with libraries other than jQuery by
|
||||
// wrapping it with an "anonymous closure". See:
|
||||
// - https://drupal.org/node/1446420
|
||||
// - http://www.adequatelygood.com/2010/3/JavaScript-Module-Pattern-In-Depth
|
||||
(function ($, Drupal, window, document) {
|
||||
(function ($) {
|
||||
|
||||
'use strict';
|
||||
|
||||
|
||||
// To understand behaviors, see https://drupal.org/node/756722#behaviors
|
||||
Drupal.behaviors.my_custom_behavior = {
|
||||
/* Drupal.behaviors.my_custom_behavior = {
|
||||
attach: function (context, settings) {
|
||||
var adminMenu = '';
|
||||
if (jQuery('#admin-menu').length > 0) {
|
||||
adminMenu = 'fixed-admin';
|
||||
}
|
||||
}*/
|
||||
|
||||
jQuery(document).ready(function () {
|
||||
// Prikaži polje za iskanje
|
||||
jQuery('.searchbutton').on('click', function(){
|
||||
jQuery('.searchform').css('transform', 'translate3d(0px, 0px, 0px)');
|
||||
});
|
||||
|
||||
// Drupal nova prijava
|
||||
// jQuery('.submit-prijava').on('click', function(){
|
||||
// // ODstranimo vse napake
|
||||
// jQuery('.error-field').removeClass('error-field');
|
||||
//
|
||||
//
|
||||
// jQuery(':input[required]:visible').each(function () {
|
||||
// if (jQuery(this).val() == '') {
|
||||
// jQuery(this).addClass('error-field');
|
||||
// }
|
||||
// });
|
||||
//
|
||||
// if( jQuery('.error-field').length > 0){
|
||||
// return false;
|
||||
// }
|
||||
//
|
||||
//
|
||||
// jQuery('#prijava-1ka error-message').append('').hide();
|
||||
//
|
||||
// var sendVariables = jQuery('#forma-prijava :input').serialize()
|
||||
// var url = jQuery('#forma-prijava').attr('action')
|
||||
//
|
||||
// jQuery.post(url, sendVariables, function (data) {
|
||||
// var response = JSON.parse(data)
|
||||
//
|
||||
// if(response.type == 'success'){
|
||||
//
|
||||
// return window.location = response.data.url
|
||||
//
|
||||
// } else if(response.type == 'error') {
|
||||
//
|
||||
// jQuery('#prijava-1ka error-message').append(response.message).show();
|
||||
// }
|
||||
// });
|
||||
//
|
||||
//
|
||||
// });
|
||||
|
||||
jQuery('.hide-search').on('click', function(){
|
||||
jQuery('.searchform').css('transform', 'translate3d(0px, -100%, 0px)');
|
||||
});
|
||||
|
||||
// ISKANJE
|
||||
jQuery('#forma-iskanje').keyup(function(event){
|
||||
if (event.keyCode == 13) {
|
||||
var iskaniNiz = jQuery('#iskanje-input').val();
|
||||
|
||||
var action = jQuery('#forma-iskanje').attr('data-action');
|
||||
|
||||
window.location.href = action + '/search/vsebina?keys=' +iskaniNiz;
|
||||
}
|
||||
});
|
||||
|
||||
// Odjava v Drupalu
|
||||
jQuery('#poslji-odjavo').on('click', function(e){
|
||||
console.log('klik odjava')
|
||||
e.preventDefault();
|
||||
jQuery('[name="odjava"]').submit();
|
||||
|
||||
@ -78,45 +47,13 @@
|
||||
}, 500);
|
||||
});
|
||||
|
||||
// Odpremo drop down menu za uporabnika
|
||||
jQuery('#submenu-login').on('click', function () {
|
||||
jQuery('#user-menu').toggle();
|
||||
});
|
||||
|
||||
// JEZIK pustimo samo 3 črke
|
||||
//var jezikText = jQuery('.language-link').text().substring(0, 4);
|
||||
//jQuery('.language-link').text(jezikText);
|
||||
var jezikText = jQuery('.language-link:not(.is-active)').text().substring(0, 3);
|
||||
jQuery('.language-link').text(jezikText);
|
||||
|
||||
// Iskalnik v navbaru
|
||||
// Zapremo iskalnik
|
||||
jQuery(document).on('click', '.search-close', function () {
|
||||
jQuery('#iskanje').show('fast');
|
||||
jQuery('#iskanje-form').hide('fast');
|
||||
jQuery('.burger').css('z-index', '');
|
||||
});
|
||||
|
||||
//Odpremo iskalnik
|
||||
jQuery('#iskanje').on('click', function () {
|
||||
jQuery('#iskanje-form').show('fast');
|
||||
jQuery('#iskanje').hide('fast');
|
||||
jQuery('.burger').css('z-index', '-99');
|
||||
});
|
||||
|
||||
// Preusmerimo na url za iskanje, ko uporabnik pritisne enter
|
||||
jQuery('#iskanje-input').on('keyup', function (event) {
|
||||
if (event.keyCode == 13) {
|
||||
var iskaniNiz = jQuery('#iskanje-input').val();
|
||||
|
||||
var action = jQuery('#iskanje-form').attr('data-action');
|
||||
|
||||
window.location.href = action + iskaniNiz;
|
||||
}
|
||||
});
|
||||
|
||||
// if (window.location.pathname.indexOf('/iskanje/') > -1) {
|
||||
// jQuery('.container-sidenav h1').hide();
|
||||
// }
|
||||
// END Iskalnik
|
||||
|
||||
|
||||
/**
|
||||
@ -1286,12 +1223,12 @@
|
||||
|
||||
|
||||
});
|
||||
}
|
||||
// }
|
||||
|
||||
|
||||
};
|
||||
//};
|
||||
|
||||
})(jQuery, Drupal, this, this.document);
|
||||
})(jQuery);
|
||||
|
||||
function CheckEmail(text) {
|
||||
jQuery('#modal-registration .w-form-fail').html('').hide();
|
||||
|
@ -0,0 +1,5 @@
|
||||
#block-languageswitcher ul {
|
||||
list-style: none;
|
||||
text-transform: uppercase;
|
||||
font-weight: bold;
|
||||
}
|
@ -3,22 +3,17 @@
|
||||
{#{% endif %}#}
|
||||
|
||||
{# Forma za iskanje#}
|
||||
<div class="searchform" style="display: block; transform: translate3d(0px, -100%, 0px) scale3d(1, 1, 1) rotateX(0deg) rotateY(0deg) rotateZ(0deg) skew(0deg, 0deg); transform-style: preserve-3d;">
|
||||
{% set site_url = url("<front>") %}
|
||||
<div class="searchform" style="display: flex; transform: translate3d(0px, -100%, 0px) scale3d(1, 1, 1) rotateX(0deg) rotateY(0deg) rotateZ(0deg) skew(0deg, 0deg); transform-style: preserve-3d;">
|
||||
<div class="container">
|
||||
<div class="row">
|
||||
<div class="vrstica">
|
||||
<div class="w-form">
|
||||
<form id="email-form" name="email-form" data-name="Email Form" class="form-2">
|
||||
<input type="text" class="text-field-2 w-input" maxlength="256" name="name-2" data-name="Name 2" placeholder="Kaj iščete?" id="name-2">
|
||||
<form id="forma-iskanje" data-action="{{ site_url }}" style="display: flex;">
|
||||
<input type="text" class="text-field-2 w-input" maxlength="256" name="iskanje-input" placeholder="Kaj iščete?" id="iskanje-input">
|
||||
<input type="submit" value="" data-wait="Please wait..." class="submit-button-2 w-button">
|
||||
<img src="/tema1ka/svg/icons-x.svg" loading="lazy" alt="" class="hide-search">
|
||||
</form>
|
||||
<div class="w-form-done">
|
||||
<div>Iskanje rezultatov..</div>
|
||||
</div>
|
||||
<div class="w-form-fail">
|
||||
<div>Pri iskranju je prišlo do napale!</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@ -53,10 +48,10 @@
|
||||
|
||||
{% if uporabnik %}
|
||||
<div class="usem-menu">
|
||||
<a href="#" class="login">
|
||||
<a href="#" class="login" id="user-login-menu">
|
||||
{{ uporabnik }} <span class="arrow-down"></span>
|
||||
</a>
|
||||
<div id="user-menu">
|
||||
<div id="user-menu" style="display: none;">
|
||||
<div name="odjava" method="post" action="/frontend/api/api.php?action=logout">
|
||||
<ul class="user-menu-link">
|
||||
<li>
|
||||
|
Loading…
x
Reference in New Issue
Block a user