mirror of
https://github.com/mediacms-io/mediacms.git
synced 2025-11-12 02:18:55 -05:00
V7 small fixes (#1426)
This commit is contained in:
parent
e80590a3aa
commit
d9f299af4d
@ -178,14 +178,11 @@ class MediaPublishForm(forms.ModelForm):
|
|||||||
state = cleaned_data.get("state")
|
state = cleaned_data.get("state")
|
||||||
categories = cleaned_data.get("category")
|
categories = cleaned_data.get("category")
|
||||||
|
|
||||||
if getattr(settings, 'USE_RBAC', False) and 'category' in self.fields:
|
if state in ['private', 'unlisted']:
|
||||||
|
custom_permissions = self.instance.permissions.exists()
|
||||||
rbac_categories = categories.filter(is_rbac_category=True).values_list('title', flat=True)
|
rbac_categories = categories.filter(is_rbac_category=True).values_list('title', flat=True)
|
||||||
|
if rbac_categories or custom_permissions:
|
||||||
if rbac_categories and state in ['private', 'unlisted']:
|
|
||||||
# Make the confirm_state field visible and add it to the layout
|
|
||||||
self.fields['confirm_state'].widget = forms.CheckboxInput()
|
self.fields['confirm_state'].widget = forms.CheckboxInput()
|
||||||
|
|
||||||
# add it after the state field
|
|
||||||
state_index = None
|
state_index = None
|
||||||
for i, layout_item in enumerate(self.helper.layout):
|
for i, layout_item in enumerate(self.helper.layout):
|
||||||
if isinstance(layout_item, CustomField) and layout_item.fields[0] == 'state':
|
if isinstance(layout_item, CustomField) and layout_item.fields[0] == 'state':
|
||||||
@ -198,8 +195,12 @@ class MediaPublishForm(forms.ModelForm):
|
|||||||
self.helper.layout = Layout(*layout_items)
|
self.helper.layout = Layout(*layout_items)
|
||||||
|
|
||||||
if not cleaned_data.get('confirm_state'):
|
if not cleaned_data.get('confirm_state'):
|
||||||
error_message = f"I understand that although media state is {state}, the media is also shared with users that have access to the following categories: {', '.join(rbac_categories)}"
|
if rbac_categories:
|
||||||
self.add_error('confirm_state', error_message)
|
error_message = f"I understand that although media state is {state}, the media is also shared with users that have access to categories: {', '.join(rbac_categories)}"
|
||||||
|
self.add_error('confirm_state', error_message)
|
||||||
|
if custom_permissions:
|
||||||
|
error_message = f"I understand that although media state is {state}, the media is also shared by me with other users, that I can see in the 'Shared by me' page"
|
||||||
|
self.add_error('confirm_state', error_message)
|
||||||
|
|
||||||
return cleaned_data
|
return cleaned_data
|
||||||
|
|
||||||
|
|||||||
@ -763,6 +763,8 @@ class Media(models.Model):
|
|||||||
return helpers.url_from_path(self.uploaded_thumbnail.path)
|
return helpers.url_from_path(self.uploaded_thumbnail.path)
|
||||||
if self.thumbnail:
|
if self.thumbnail:
|
||||||
return helpers.url_from_path(self.thumbnail.path)
|
return helpers.url_from_path(self.thumbnail.path)
|
||||||
|
if self.media_type == "audio":
|
||||||
|
return helpers.url_from_path("userlogos/poster_audio.jpg")
|
||||||
return None
|
return None
|
||||||
|
|
||||||
@property
|
@property
|
||||||
|
|||||||
@ -26,7 +26,7 @@ function downloadOptionsList() {
|
|||||||
link: formatInnerLink(encodings_info[k][g].url, SiteContext._currentValue.url),
|
link: formatInnerLink(encodings_info[k][g].url, SiteContext._currentValue.url),
|
||||||
linkAttr: {
|
linkAttr: {
|
||||||
target: '_blank',
|
target: '_blank',
|
||||||
download: media_data.title + '_' + k + '_' + g.toUpperCase(),
|
download: k + '_' + g.toLowerCase() + '_' + media_data.title,
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|||||||
BIN
media_files/userlogos/poster_audio.jpg
Normal file
BIN
media_files/userlogos/poster_audio.jpg
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 43 KiB |
File diff suppressed because one or more lines are too long
Loading…
x
Reference in New Issue
Block a user