-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
e5a81eb
commit 55c5786
Showing
23 changed files
with
487 additions
and
120 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
.tooltip-slider { | ||
position: relative; | ||
overflow: hidden; | ||
height: 120px; /* Changed from 150px to 120px */ | ||
margin-bottom: 5px; /* Further reduce from 10px */ | ||
} | ||
|
||
.tooltip-slide { | ||
position: absolute; | ||
top: 0; | ||
left: 0; | ||
width: 100%; | ||
height: 100%; | ||
opacity: 0; | ||
transition: opacity 0.5s ease-in-out; | ||
} | ||
|
||
.tooltip-slide.active { | ||
opacity: 1; | ||
} | ||
|
||
.tooltip-content { | ||
background-color: #f8f9fa; | ||
border: 1px solid #dee2e6; | ||
border-radius: 5px; | ||
padding: 15px; | ||
text-align: center; | ||
} | ||
|
||
.slider-controls { | ||
text-align: center; | ||
margin-bottom: 5px; /* Further reduce from 10px */ | ||
} | ||
|
||
.slider-controls button { | ||
margin: 0 5px; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,57 +1,82 @@ | ||
document.addEventListener('DOMContentLoaded', function() { | ||
console.log('A/B Tests Management Page Loaded'); | ||
console.log("A/B Tests Management Page Loaded"); | ||
|
||
const addPagePathButton = document.getElementById('addPagePath'); | ||
// Event listener for toggling test status | ||
document.querySelectorAll('.toggle-test-status').forEach(button => { | ||
button.addEventListener('click', function(e) { | ||
e.preventDefault(); | ||
|
||
if (addPagePathButton) { | ||
addPagePathButton.addEventListener('click', function() { | ||
const pagePathsContainer = document.getElementById('pagePaths'); | ||
if (pagePathsContainer) { | ||
const newInput = document.createElement('input'); | ||
newInput.type = 'text'; | ||
newInput.className = 'form-control mb-2'; | ||
newInput.name = 'pagePaths[]'; | ||
pagePathsContainer.appendChild(newInput); | ||
console.log('Added new page path input field.'); | ||
} else { | ||
console.error('Page paths container not found.'); | ||
const csrfTokenElement = document.getElementById('csrfToken'); | ||
if (!csrfTokenElement) { | ||
console.log("CSRF token not found. User might not be logged in."); | ||
return; | ||
} | ||
}); | ||
} else { | ||
console.error('Add page path button not found.'); | ||
} | ||
|
||
document.querySelectorAll('.toggle-test-status').forEach(button => { | ||
button.addEventListener('click', function(event) { | ||
event.preventDefault(); | ||
const testId = this.dataset.testid; | ||
const currentStatus = this.dataset.status; | ||
if (!testId) { | ||
console.error("Test ID not found on button."); | ||
return; | ||
} | ||
|
||
const csrfToken = csrfTokenElement.value; | ||
|
||
fetch(`/tests/${testId}/toggle-status`, { | ||
method: 'POST', | ||
headers: { | ||
'Content-Type': 'application/json', | ||
'CSRF-Token': document.getElementById('csrfToken').value | ||
'CSRF-Token': csrfToken | ||
}, | ||
body: JSON.stringify({ testStatus: currentStatus === 'Running' ? 'Stopped' : 'Running' }), | ||
body: JSON.stringify({ testStatus: this.dataset.status === 'Running' ? 'Stopped' : 'Running' }), | ||
credentials: 'same-origin' | ||
}) | ||
.then(response => response.json()) | ||
.then(data => { | ||
if (data.success) { | ||
const newStatus = data.testStatus; | ||
this.dataset.status = newStatus; | ||
this.classList.toggle('btn-success', newStatus === 'Stopped'); | ||
this.classList.toggle('btn-danger', newStatus === 'Running'); | ||
this.classList.remove('btn-success', 'btn-danger'); | ||
this.classList.add(newStatus === 'Running' ? 'btn-danger' : 'btn-success'); | ||
this.textContent = newStatus === 'Running' ? 'Stop' : 'Start'; | ||
console.log(`Test status updated to: ${newStatus}`); | ||
this.closest('.card-body').querySelector('.card-text').textContent = `Status: ${newStatus}`; | ||
const statusElement = this.closest('.card-body').querySelector('.card-text'); | ||
if (statusElement) { | ||
statusElement.textContent = `Status: ${newStatus}`; | ||
} | ||
} else { | ||
console.error('Failed to toggle test status.'); | ||
console.error('Failed to toggle test status:', data.message); | ||
} | ||
}) | ||
.catch(error => { | ||
console.error('Error toggling test status:', error.message, error.stack); | ||
}); | ||
}); | ||
}); | ||
|
||
// Functionality for adding page paths on the A/B Tests Management page | ||
function addPagePathFunctionality() { | ||
const addPagePathButton = document.getElementById('addPagePath'); | ||
if (addPagePathButton) { | ||
addPagePathButton.addEventListener('click', function() { | ||
const pagePathsContainer = document.getElementById('pagePaths'); | ||
if (pagePathsContainer) { | ||
const newInput = document.createElement('input'); | ||
newInput.type = 'text'; | ||
newInput.className = 'form-control mb-2'; | ||
newInput.name = 'pagePaths[]'; | ||
pagePathsContainer.appendChild(newInput); | ||
console.log('Added new page path input field.'); | ||
} else { | ||
console.error('Page paths container not found.'); | ||
} | ||
}); | ||
} else { | ||
console.error('Add page path button not found.'); | ||
} | ||
} | ||
|
||
// Check if we're on the A/B Tests Management page to add page paths | ||
if (document.getElementById('testsList')) { | ||
addPagePathFunctionality(); | ||
} else { | ||
console.log("Not on A/B Tests Management page, skipping A/B test-specific operations."); | ||
} | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
document.addEventListener('DOMContentLoaded', function() { | ||
// Add fade-in effect to main content | ||
const mainContent = document.querySelector('main'); | ||
if (mainContent) { | ||
mainContent.classList.add('fade-in'); | ||
} | ||
|
||
// Add slide-in effect to cards | ||
const cards = document.querySelectorAll('.card'); | ||
cards.forEach((card, index) => { | ||
card.classList.add('slide-in'); | ||
card.style.animationDelay = `${index * 0.1}s`; | ||
}); | ||
|
||
// Add pulse effect to buttons | ||
const buttons = document.querySelectorAll('.btn-primary'); | ||
buttons.forEach(button => { | ||
button.classList.add('pulse'); | ||
}); | ||
|
||
// Initialize tooltips | ||
const tooltips = document.querySelectorAll('[data-toggle="tooltip"]'); | ||
tooltips.forEach(tooltip => { | ||
new bootstrap.Tooltip(tooltip); | ||
}); | ||
|
||
// Error handling for missing elements | ||
window.addEventListener('error', function(event) { | ||
console.error("Error occurred in animations.js: ", event.message, event.error.stack); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,14 @@ | ||
// Placeholder for future JavaScript code | ||
document.addEventListener('DOMContentLoaded', function() { | ||
console.log('Main script loaded'); | ||
|
||
// Initialize tooltips | ||
const tooltips = document.querySelectorAll('[data-toggle="tooltip"]'); | ||
tooltips.forEach(tooltip => { | ||
new bootstrap.Tooltip(tooltip); | ||
}); | ||
|
||
// Error handling for missing elements | ||
window.addEventListener('error', function(event) { | ||
console.error("Error occurred in main.js: ", event.message, event.error.stack); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
document.addEventListener('DOMContentLoaded', function() { | ||
const slides = document.querySelectorAll('.tooltip-slide'); | ||
const prevButton = document.getElementById('prevTip'); | ||
const nextButton = document.getElementById('nextTip'); | ||
let currentSlide = 0; | ||
|
||
function showSlide(index) { | ||
slides.forEach(slide => slide.classList.remove('active')); | ||
slides[index].classList.add('active'); | ||
} | ||
|
||
function nextSlide() { | ||
currentSlide = (currentSlide + 1) % slides.length; | ||
showSlide(currentSlide); | ||
console.log(`Showing next slide: ${currentSlide}`); | ||
} | ||
|
||
function prevSlide() { | ||
currentSlide = (currentSlide - 1 + slides.length) % slides.length; | ||
showSlide(currentSlide); | ||
console.log(`Showing previous slide: ${currentSlide}`); | ||
} | ||
|
||
nextButton.addEventListener('click', nextSlide); | ||
prevButton.addEventListener('click', prevSlide); | ||
|
||
showSlide(currentSlide); | ||
|
||
// Auto-advance slides every 5 seconds | ||
setInterval(function() { | ||
try { | ||
nextSlide(); | ||
} catch (error) { | ||
console.error("Error auto-advancing slide: ", error.message, error.stack); | ||
} | ||
}, 5000); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.