mirror of
https://github.com/mediacms-io/mediacms.git
synced 2026-03-18 19:01:56 -04:00
cate
This commit is contained in:
@@ -146,6 +146,8 @@ class CategoryAdmin(admin.ModelAdmin):
|
|||||||
list_filter.insert(0, "is_rbac_category")
|
list_filter.insert(0, "is_rbac_category")
|
||||||
if getattr(settings, 'USE_IDENTITY_PROVIDERS', False):
|
if getattr(settings, 'USE_IDENTITY_PROVIDERS', False):
|
||||||
list_filter.insert(-1, "identity_provider")
|
list_filter.insert(-1, "identity_provider")
|
||||||
|
if getattr(settings, 'USE_LTI', False):
|
||||||
|
list_filter.append("is_lms_course")
|
||||||
|
|
||||||
return list_filter
|
return list_filter
|
||||||
|
|
||||||
@@ -155,6 +157,8 @@ class CategoryAdmin(admin.ModelAdmin):
|
|||||||
list_display.insert(-1, "is_rbac_category")
|
list_display.insert(-1, "is_rbac_category")
|
||||||
if getattr(settings, 'USE_IDENTITY_PROVIDERS', False):
|
if getattr(settings, 'USE_IDENTITY_PROVIDERS', False):
|
||||||
list_display.insert(-1, "identity_provider")
|
list_display.insert(-1, "identity_provider")
|
||||||
|
if getattr(settings, 'USE_LTI', False):
|
||||||
|
list_display.insert(-1, "is_lms_course")
|
||||||
|
|
||||||
return list_display
|
return list_display
|
||||||
|
|
||||||
|
|||||||
@@ -736,7 +736,7 @@ class Media(models.Model):
|
|||||||
|
|
||||||
ret = []
|
ret = []
|
||||||
for cat in self.category.all():
|
for cat in self.category.all():
|
||||||
ret.append({"title": cat.title, "url": cat.get_absolute_url()})
|
ret.append({"title": cat.title, "url": cat.get_absolute_url(), "is_lms_course": cat.is_lms_course})
|
||||||
return ret
|
return ret
|
||||||
|
|
||||||
@property
|
@property
|
||||||
|
|||||||
@@ -94,11 +94,18 @@ export default function ViewerInfoContent(props) {
|
|||||||
!PageStore.get('config-enabled').taxonomies.tags || PageStore.get('config-enabled').taxonomies.tags.enabled
|
!PageStore.get('config-enabled').taxonomies.tags || PageStore.get('config-enabled').taxonomies.tags.enabled
|
||||||
? metafield(MediaPageStore.get('media-tags'))
|
? metafield(MediaPageStore.get('media-tags'))
|
||||||
: [];
|
: [];
|
||||||
|
let mediaCategories = MediaPageStore.get('media-categories');
|
||||||
|
|
||||||
|
// Filter to show only LMS courses when in embed mode
|
||||||
|
if (inEmbeddedApp()) {
|
||||||
|
mediaCategories = mediaCategories.filter(cat => cat.is_lms_course === true);
|
||||||
|
}
|
||||||
|
|
||||||
const categoriesContent = PageStore.get('config-options').pages.media.categoriesWithTitle
|
const categoriesContent = PageStore.get('config-options').pages.media.categoriesWithTitle
|
||||||
? []
|
? []
|
||||||
: !PageStore.get('config-enabled').taxonomies.categories ||
|
: !PageStore.get('config-enabled').taxonomies.categories ||
|
||||||
PageStore.get('config-enabled').taxonomies.categories.enabled
|
PageStore.get('config-enabled').taxonomies.categories.enabled
|
||||||
? metafield(MediaPageStore.get('media-categories'))
|
? metafield(mediaCategories)
|
||||||
: [];
|
: [];
|
||||||
|
|
||||||
let summary = MediaPageStore.get('media-summary');
|
let summary = MediaPageStore.get('media-summary');
|
||||||
@@ -220,9 +227,13 @@ export default function ViewerInfoContent(props) {
|
|||||||
<MediaMetaField
|
<MediaMetaField
|
||||||
value={categoriesContent}
|
value={categoriesContent}
|
||||||
title={
|
title={
|
||||||
1 < categoriesContent.length
|
inEmbeddedApp()
|
||||||
? translateString('Categories')
|
? (1 < categoriesContent.length
|
||||||
: translateString('Category')
|
? translateString('Courses')
|
||||||
|
: translateString('Course'))
|
||||||
|
: (1 < categoriesContent.length
|
||||||
|
? translateString('Categories')
|
||||||
|
: translateString('Category'))
|
||||||
}
|
}
|
||||||
id="categories"
|
id="categories"
|
||||||
/>
|
/>
|
||||||
|
|||||||
@@ -3,14 +3,14 @@ import { ApiUrlConsumer } from '../utils/contexts/';
|
|||||||
import { MediaListWrapper } from '../components/MediaListWrapper';
|
import { MediaListWrapper } from '../components/MediaListWrapper';
|
||||||
import { LazyLoadItemListAsync } from '../components/item-list/LazyLoadItemListAsync.jsx';
|
import { LazyLoadItemListAsync } from '../components/item-list/LazyLoadItemListAsync.jsx';
|
||||||
import { Page } from './Page';
|
import { Page } from './Page';
|
||||||
import { translateString } from '../utils/helpers/';
|
import { translateString, inEmbeddedApp } from '../utils/helpers/';
|
||||||
|
|
||||||
interface CategoriesPageProps {
|
interface CategoriesPageProps {
|
||||||
id?: string;
|
id?: string;
|
||||||
title?: string;
|
title?: string;
|
||||||
}
|
}
|
||||||
|
|
||||||
export const CategoriesPage: React.FC<CategoriesPageProps> = ({ id = 'categories', title = translateString('Categories') }) => (
|
export const CategoriesPage: React.FC<CategoriesPageProps> = ({ id = 'categories', title = inEmbeddedApp() ? translateString('Courses') : translateString('Categories') }) => (
|
||||||
<Page id={id}>
|
<Page id={id}>
|
||||||
<ApiUrlConsumer>
|
<ApiUrlConsumer>
|
||||||
{(apiUrl) => (
|
{(apiUrl) => (
|
||||||
|
|||||||
@@ -7,7 +7,7 @@ import { LazyLoadItemListAsync } from '../components/item-list/LazyLoadItemListA
|
|||||||
import { SearchMediaFiltersRow } from '../components/search-filters/SearchMediaFiltersRow';
|
import { SearchMediaFiltersRow } from '../components/search-filters/SearchMediaFiltersRow';
|
||||||
import { SearchResultsFilters } from '../components/search-filters/SearchResultsFilters';
|
import { SearchResultsFilters } from '../components/search-filters/SearchResultsFilters';
|
||||||
import { Page } from './_Page';
|
import { Page } from './_Page';
|
||||||
import { translateString } from '../utils/helpers/';
|
import { translateString, inEmbeddedApp } from '../utils/helpers/';
|
||||||
|
|
||||||
export class SearchPage extends Page {
|
export class SearchPage extends Page {
|
||||||
constructor(props) {
|
constructor(props) {
|
||||||
@@ -115,7 +115,7 @@ export class SearchPage extends Page {
|
|||||||
} else {
|
} else {
|
||||||
if (this.state.searchCategories) {
|
if (this.state.searchCategories) {
|
||||||
title = null === this.state.resultsCount || 0 === this.state.resultsCount ? 'No' : this.state.resultsCount;
|
title = null === this.state.resultsCount || 0 === this.state.resultsCount ? 'No' : this.state.resultsCount;
|
||||||
title += ' ' + translateString('media in category') + ' "' + this.state.searchCategories + '"';
|
title += ' ' + translateString(inEmbeddedApp() ? 'media in course' : 'media in category') + ' "' + this.state.searchCategories + '"';
|
||||||
} else if (this.state.searchTags) {
|
} else if (this.state.searchTags) {
|
||||||
title = null === this.state.resultsCount || 0 === this.state.resultsCount ? 'No' : this.state.resultsCount;
|
title = null === this.state.resultsCount || 0 === this.state.resultsCount ? 'No' : this.state.resultsCount;
|
||||||
title += ' ' + translateString('media in tag') + ' "' + this.state.searchTags + '"';
|
title += ' ' + translateString('media in tag') + ' "' + this.state.searchTags + '"';
|
||||||
|
|||||||
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
Reference in New Issue
Block a user