mirror of
https://github.com/mediacms-io/mediacms.git
synced 2025-11-05 23:18:53 -05:00
this
This commit is contained in:
parent
845ceeaed7
commit
7acf748c24
@ -94,7 +94,7 @@ def add_subtitle(request):
|
||||
if not media:
|
||||
return HttpResponseRedirect("/")
|
||||
|
||||
if not (request.user == media.user or is_mediacms_editor(request.user)):
|
||||
if not (is_mediacms_editor(request.user) or request.user.has_contributor_access_to_media(media)):
|
||||
return HttpResponseRedirect("/")
|
||||
|
||||
# Initialize variables
|
||||
@ -146,7 +146,7 @@ def edit_subtitle(request):
|
||||
if not subtitle:
|
||||
return HttpResponseRedirect("/")
|
||||
|
||||
if not (request.user == subtitle.user or is_mediacms_editor(request.user)):
|
||||
if not (is_mediacms_editor(request.user) or request.user.has_contributor_access_to_media(subtitle.media)):
|
||||
return HttpResponseRedirect("/")
|
||||
|
||||
context = {"subtitle": subtitle, "action": action}
|
||||
@ -252,7 +252,7 @@ def video_chapters(request, friendly_token):
|
||||
if not media:
|
||||
return HttpResponseRedirect("/")
|
||||
|
||||
if not (request.user == media.user or is_mediacms_editor(request.user)):
|
||||
if not (is_mediacms_editor(request.user) or request.user.has_contributor_access_to_media(media)):
|
||||
return HttpResponseRedirect("/")
|
||||
|
||||
try:
|
||||
@ -370,7 +370,7 @@ def edit_chapters(request):
|
||||
if not media:
|
||||
return HttpResponseRedirect("/")
|
||||
|
||||
if not (request.user == media.user or is_mediacms_editor(request.user)):
|
||||
if not (is_mediacms_editor(request.user) or request.user.has_contributor_access_to_media(media)):
|
||||
return HttpResponseRedirect("/")
|
||||
|
||||
chapters = media.chapter_data
|
||||
@ -395,7 +395,7 @@ def trim_video(request, friendly_token):
|
||||
if not media:
|
||||
return HttpResponseRedirect("/")
|
||||
|
||||
if not (request.user == media.user or is_mediacms_editor(request.user)):
|
||||
if not (is_mediacms_editor(request.user) or request.user.has_contributor_access_to_media(media)):
|
||||
return HttpResponseRedirect("/")
|
||||
|
||||
existing_requests = VideoTrimRequest.objects.filter(media=media, status__in=["initial", "running"]).exists()
|
||||
@ -426,7 +426,7 @@ def edit_video(request):
|
||||
if not media:
|
||||
return HttpResponseRedirect("/")
|
||||
|
||||
if not (request.user == media.user or is_mediacms_editor(request.user)):
|
||||
if not (is_mediacms_editor(request.user) or request.user.has_contributor_access_to_media(media)):
|
||||
return HttpResponseRedirect("/")
|
||||
|
||||
if media.media_type not in ["video", "audio"]:
|
||||
|
||||
@ -686,9 +686,8 @@ a.item-edit-link {
|
||||
}
|
||||
}
|
||||
|
||||
// Show checkbox on hover or when any item is selected
|
||||
&:hover .item-selection-checkbox,
|
||||
&.has-any-selection .item-selection-checkbox {
|
||||
// Show checkbox only on hover
|
||||
&:hover .item-selection-checkbox {
|
||||
opacity: 1;
|
||||
}
|
||||
|
||||
@ -709,18 +708,6 @@ a.item-edit-link {
|
||||
border-radius: 10px;
|
||||
}
|
||||
}
|
||||
|
||||
// Make the whole item clickable for selection when any selection is active
|
||||
&.has-any-selection:not(.selected) {
|
||||
.item-thumb {
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
.item-main {
|
||||
cursor: pointer;
|
||||
pointer-events: auto;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Edit icon styles
|
||||
|
||||
@ -24,7 +24,8 @@ export function MediaItem(props) {
|
||||
|
||||
const finalClassname = containerClassname +
|
||||
(props.showSelection ? ' with-selection' : '') +
|
||||
(props.isSelected ? ' selected' : '');
|
||||
(props.isSelected ? ' selected' : '') +
|
||||
(props.hasAnySelection ? ' has-any-selection' : '');
|
||||
|
||||
return (
|
||||
<div className={finalClassname}>
|
||||
|
||||
@ -70,32 +70,8 @@ export function MediaItemAudio(props) {
|
||||
(props.isSelected ? ' selected' : '') +
|
||||
(props.hasAnySelection ? ' has-any-selection' : '');
|
||||
|
||||
const handleItemClick = (e) => {
|
||||
// Only handle clicks when selection mode is active
|
||||
if (props.showSelection) {
|
||||
// Check if click was on the checkbox (already handled)
|
||||
if (e.target.type === 'checkbox' || e.target.closest('.item-selection-checkbox')) {
|
||||
return;
|
||||
}
|
||||
|
||||
// Check if click was on the edit icon or view icon
|
||||
if (e.target.closest('.item-edit-icon') || e.target.closest('.item-view-icon')) {
|
||||
return;
|
||||
}
|
||||
|
||||
// Prevent default link behavior
|
||||
e.preventDefault();
|
||||
e.stopPropagation();
|
||||
|
||||
// Toggle the checkbox
|
||||
if (props.onCheckboxChange) {
|
||||
props.onCheckboxChange({ target: { checked: !props.isSelected } });
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
return (
|
||||
<div className={finalClassname} onClick={handleItemClick}>
|
||||
<div className={finalClassname}>
|
||||
{playlistOrderNumberComponent()}
|
||||
|
||||
<div className="item-content">
|
||||
|
||||
@ -77,32 +77,8 @@ export function MediaItemVideo(props) {
|
||||
(props.isSelected ? ' selected' : '') +
|
||||
(props.hasAnySelection ? ' has-any-selection' : '');
|
||||
|
||||
const handleItemClick = (e) => {
|
||||
// Only handle clicks when selection mode is active
|
||||
if (props.showSelection) {
|
||||
// Check if click was on the checkbox (already handled)
|
||||
if (e.target.type === 'checkbox' || e.target.closest('.item-selection-checkbox')) {
|
||||
return;
|
||||
}
|
||||
|
||||
// Check if click was on the edit icon or view icon
|
||||
if (e.target.closest('.item-edit-icon') || e.target.closest('.item-view-icon')) {
|
||||
return;
|
||||
}
|
||||
|
||||
// Prevent default link behavior
|
||||
e.preventDefault();
|
||||
e.stopPropagation();
|
||||
|
||||
// Toggle the checkbox
|
||||
if (props.onCheckboxChange) {
|
||||
props.onCheckboxChange({ target: { checked: !props.isSelected } });
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
return (
|
||||
<div className={finalClassname} onClick={handleItemClick}>
|
||||
<div className={finalClassname}>
|
||||
{playlistOrderNumberComponent()}
|
||||
|
||||
<div className="item-content">
|
||||
|
||||
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
Loading…
x
Reference in New Issue
Block a user