separation of css
This commit is contained in:
1
static/css/rooms.css
Normal file
1
static/css/rooms.css
Normal file
@@ -0,0 +1 @@
|
|||||||
|
|
||||||
11
static/css/starred.css
Normal file
11
static/css/starred.css
Normal file
@@ -0,0 +1,11 @@
|
|||||||
|
.btn-group .btn.active {
|
||||||
|
background-color: #e6f3f4 !important;
|
||||||
|
border-color: #16767b !important;
|
||||||
|
color: #16767b !important;
|
||||||
|
}
|
||||||
|
|
||||||
|
.btn-group .btn:not(.active) {
|
||||||
|
background-color: #fff !important;
|
||||||
|
border-color: #e9ecef !important;
|
||||||
|
color: #6c757d !important;
|
||||||
|
}
|
||||||
58
static/js/starred.js
Normal file
58
static/js/starred.js
Normal file
@@ -0,0 +1,58 @@
|
|||||||
|
let currentView = 'grid';
|
||||||
|
|
||||||
|
document.addEventListener('DOMContentLoaded', function() {
|
||||||
|
// Initialize view
|
||||||
|
initializeView();
|
||||||
|
});
|
||||||
|
|
||||||
|
async function initializeView() {
|
||||||
|
try {
|
||||||
|
const response = await fetch('/api/user/preferred_view');
|
||||||
|
const data = await response.json();
|
||||||
|
currentView = data.preferred_view || 'grid';
|
||||||
|
toggleView(currentView);
|
||||||
|
} catch (error) {
|
||||||
|
console.error('Error fetching preferred view:', error);
|
||||||
|
currentView = 'grid';
|
||||||
|
toggleView(currentView);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function toggleView(view) {
|
||||||
|
currentView = view;
|
||||||
|
const grid = document.getElementById('fileGrid');
|
||||||
|
const gridBtn = document.getElementById('gridViewBtn');
|
||||||
|
const listBtn = document.getElementById('listViewBtn');
|
||||||
|
|
||||||
|
// Reset both buttons first
|
||||||
|
gridBtn.classList.remove('active');
|
||||||
|
listBtn.classList.remove('active');
|
||||||
|
|
||||||
|
if (view === 'grid') {
|
||||||
|
grid.classList.remove('list-view');
|
||||||
|
gridBtn.classList.add('active');
|
||||||
|
} else {
|
||||||
|
grid.classList.add('list-view');
|
||||||
|
listBtn.classList.add('active');
|
||||||
|
}
|
||||||
|
|
||||||
|
// Save the new preference
|
||||||
|
fetch('/api/user/preferred_view', {
|
||||||
|
method: 'POST',
|
||||||
|
headers: {
|
||||||
|
'Content-Type': 'application/json',
|
||||||
|
'X-CSRFToken': document.querySelector('meta[name="csrf-token"]').getAttribute('content')
|
||||||
|
},
|
||||||
|
body: JSON.stringify({ preferred_view: view })
|
||||||
|
})
|
||||||
|
.then(response => {
|
||||||
|
if (!response.ok) {
|
||||||
|
throw new Error('Network response was not ok');
|
||||||
|
}
|
||||||
|
return response.json();
|
||||||
|
})
|
||||||
|
.then(data => {
|
||||||
|
console.log('Preferred view saved:', data);
|
||||||
|
})
|
||||||
|
.catch(error => console.error('Error saving preferred view:', error));
|
||||||
|
}
|
||||||
@@ -3,6 +3,10 @@
|
|||||||
|
|
||||||
{% block title %}Rooms - DocuPulse{% endblock %}
|
{% block title %}Rooms - DocuPulse{% endblock %}
|
||||||
|
|
||||||
|
{% block extra_css %}
|
||||||
|
<link rel="stylesheet" href="{{ url_for('static', filename='css/rooms.css') }}">
|
||||||
|
{% endblock %}
|
||||||
|
|
||||||
{% block content %}
|
{% block content %}
|
||||||
{{ header(
|
{{ header(
|
||||||
title="Rooms",
|
title="Rooms",
|
||||||
@@ -128,42 +132,6 @@
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<style>
|
|
||||||
.hover-shadow {
|
|
||||||
transition: all 0.3s ease;
|
|
||||||
}
|
|
||||||
|
|
||||||
.hover-shadow:hover {
|
|
||||||
transform: translateY(-5px);
|
|
||||||
box-shadow: 0 0.5rem 1rem rgba(0, 0, 0, 0.15) !important;
|
|
||||||
}
|
|
||||||
|
|
||||||
.card {
|
|
||||||
border: none;
|
|
||||||
border-radius: 10px;
|
|
||||||
}
|
|
||||||
|
|
||||||
.card-footer {
|
|
||||||
padding: 1rem;
|
|
||||||
}
|
|
||||||
|
|
||||||
.btn {
|
|
||||||
border-radius: 5px;
|
|
||||||
font-weight: 500;
|
|
||||||
padding: 0.5rem 1rem;
|
|
||||||
transition: all 0.2s ease;
|
|
||||||
}
|
|
||||||
|
|
||||||
.btn:hover {
|
|
||||||
transform: translateY(-1px);
|
|
||||||
box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
|
|
||||||
}
|
|
||||||
|
|
||||||
.btn i {
|
|
||||||
font-size: 0.9em;
|
|
||||||
}
|
|
||||||
</style>
|
|
||||||
|
|
||||||
{% block extra_js %}
|
{% block extra_js %}
|
||||||
<script>
|
<script>
|
||||||
// Debounce function
|
// Debounce function
|
||||||
|
|||||||
@@ -3,6 +3,10 @@
|
|||||||
|
|
||||||
{% block title %}Starred - DocuPulse{% endblock %}
|
{% block title %}Starred - DocuPulse{% endblock %}
|
||||||
|
|
||||||
|
{% block extra_css %}
|
||||||
|
<link rel="stylesheet" href="{{ url_for('static', filename='css/starred.css') }}">
|
||||||
|
{% endblock %}
|
||||||
|
|
||||||
{% block content %}
|
{% block content %}
|
||||||
{{ header(
|
{{ header(
|
||||||
title="Starred",
|
title="Starred",
|
||||||
@@ -37,78 +41,6 @@
|
|||||||
{% endblock %}
|
{% endblock %}
|
||||||
|
|
||||||
{% block extra_js %}
|
{% block extra_js %}
|
||||||
<style>
|
|
||||||
.btn-group .btn.active {
|
|
||||||
background-color: #e6f3f4 !important;
|
|
||||||
border-color: #16767b !important;
|
|
||||||
color: #16767b !important;
|
|
||||||
}
|
|
||||||
|
|
||||||
.btn-group .btn:not(.active) {
|
|
||||||
background-color: #fff !important;
|
|
||||||
border-color: #e9ecef !important;
|
|
||||||
color: #6c757d !important;
|
|
||||||
}
|
|
||||||
</style>
|
|
||||||
<script src="{{ url_for('static', filename='js/file-grid.js') }}"></script>
|
<script src="{{ url_for('static', filename='js/file-grid.js') }}"></script>
|
||||||
<script>
|
<script src="{{ url_for('static', filename='js/starred.js') }}"></script>
|
||||||
let currentView = 'grid';
|
|
||||||
|
|
||||||
document.addEventListener('DOMContentLoaded', function() {
|
|
||||||
// Initialize view
|
|
||||||
initializeView();
|
|
||||||
});
|
|
||||||
|
|
||||||
async function initializeView() {
|
|
||||||
try {
|
|
||||||
const response = await fetch('/api/user/preferred_view');
|
|
||||||
const data = await response.json();
|
|
||||||
currentView = data.preferred_view || 'grid';
|
|
||||||
toggleView(currentView);
|
|
||||||
} catch (error) {
|
|
||||||
console.error('Error fetching preferred view:', error);
|
|
||||||
currentView = 'grid';
|
|
||||||
toggleView(currentView);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
function toggleView(view) {
|
|
||||||
currentView = view;
|
|
||||||
const grid = document.getElementById('fileGrid');
|
|
||||||
const gridBtn = document.getElementById('gridViewBtn');
|
|
||||||
const listBtn = document.getElementById('listViewBtn');
|
|
||||||
|
|
||||||
// Reset both buttons first
|
|
||||||
gridBtn.classList.remove('active');
|
|
||||||
listBtn.classList.remove('active');
|
|
||||||
|
|
||||||
if (view === 'grid') {
|
|
||||||
grid.classList.remove('list-view');
|
|
||||||
gridBtn.classList.add('active');
|
|
||||||
} else {
|
|
||||||
grid.classList.add('list-view');
|
|
||||||
listBtn.classList.add('active');
|
|
||||||
}
|
|
||||||
|
|
||||||
// Save the new preference
|
|
||||||
fetch('/api/user/preferred_view', {
|
|
||||||
method: 'POST',
|
|
||||||
headers: {
|
|
||||||
'Content-Type': 'application/json',
|
|
||||||
'X-CSRFToken': document.querySelector('meta[name="csrf-token"]').getAttribute('content')
|
|
||||||
},
|
|
||||||
body: JSON.stringify({ preferred_view: view })
|
|
||||||
})
|
|
||||||
.then(response => {
|
|
||||||
if (!response.ok) {
|
|
||||||
throw new Error('Network response was not ok');
|
|
||||||
}
|
|
||||||
return response.json();
|
|
||||||
})
|
|
||||||
.then(data => {
|
|
||||||
console.log('Preferred view saved:', data);
|
|
||||||
})
|
|
||||||
.catch(error => console.error('Error saving preferred view:', error));
|
|
||||||
}
|
|
||||||
</script>
|
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
Reference in New Issue
Block a user