From e0f24d57232b367ca7f7676543f879f7f19ed36a Mon Sep 17 00:00:00 2001 From: Julio Montoya Date: Mon, 18 May 2020 12:13:17 +0200 Subject: [PATCH] Add documents refactor using api calls --- assets/vue/App.vue | 84 +- assets/vue/components/Toolbar.vue | 16 + assets/vue/components/course/Form.vue | 2 +- assets/vue/components/documents/Filter.vue | 43 + assets/vue/components/documents/Layout.vue | 9 + assets/vue/main.js | 32 +- assets/vue/mixins/ListMixin.js | 19 +- assets/vue/router/course.js | 2 +- assets/vue/router/coursecategory.js | 2 +- assets/vue/router/documents.js | 33 + assets/vue/router/index.js | 9 +- assets/vue/services/documents.js | 3 + assets/vue/utils/fetch.js | 2 - assets/vue/views/course/List.vue | 4 +- assets/vue/views/coursecategory/List.vue | 3 - assets/vue/views/documents/Create.vue | 45 + assets/vue/views/documents/CreateFile.vue | 45 + assets/vue/views/documents/List.vue | 105 + assets/vue/views/documents/Show.vue | 98 + assets/vue/views/documents/Update.vue | 61 + config/packages/api_platform.yaml | 4 + config/routes.yaml | 5 + .../Controller/CreateMediaObjectAction.php | 25 + .../Controller/ResourceController.php | 2 +- src/CoreBundle/Entity/Course.php | 2 +- src/CoreBundle/Entity/CourseCategory.php | 4 +- .../Entity/Resource/ResourceFile.php | 80 +- .../Entity/Resource/ResourceLink.php | 4 +- .../Entity/Resource/ResourceNode.php | 23 +- ...esolveResourceFileContentUrlSubscriber.php | 72 + .../Resources/views/Index/courses.html.twig | 33 + .../Resources/views/Layout/head.html.twig | 14 +- .../Resources/views/login.html.twig | 4 +- src/CourseBundle/Entity/CDocument.php | 22 +- yarn.lock | 3255 ++++++++++++++--- 35 files changed, 3539 insertions(+), 627 deletions(-) create mode 100644 assets/vue/components/documents/Filter.vue create mode 100644 assets/vue/components/documents/Layout.vue create mode 100644 assets/vue/router/documents.js create mode 100644 assets/vue/services/documents.js create mode 100644 assets/vue/views/documents/Create.vue create mode 100644 assets/vue/views/documents/CreateFile.vue create mode 100644 assets/vue/views/documents/List.vue create mode 100644 assets/vue/views/documents/Show.vue create mode 100644 assets/vue/views/documents/Update.vue create mode 100644 src/CoreBundle/Controller/CreateMediaObjectAction.php create mode 100644 src/CoreBundle/EventSubscriber/ResolveResourceFileContentUrlSubscriber.php create mode 100644 src/CoreBundle/Resources/views/Index/courses.html.twig diff --git a/assets/vue/App.vue b/assets/vue/App.vue index 570b1852c6..280c49ad4d 100644 --- a/assets/vue/App.vue +++ b/assets/vue/App.vue @@ -1,7 +1,12 @@ diff --git a/assets/vue/components/Toolbar.vue b/assets/vue/components/Toolbar.vue index 46a8ba975a..b78f31d967 100644 --- a/assets/vue/components/Toolbar.vue +++ b/assets/vue/components/Toolbar.vue @@ -48,6 +48,11 @@ mdi-plus-circle + + + Add document + + + + + + + + + + + + + + + diff --git a/assets/vue/components/documents/Layout.vue b/assets/vue/components/documents/Layout.vue new file mode 100644 index 0000000000..f039ec8f64 --- /dev/null +++ b/assets/vue/components/documents/Layout.vue @@ -0,0 +1,9 @@ + + + diff --git a/assets/vue/main.js b/assets/vue/main.js index b219724cc1..bba6e818a1 100644 --- a/assets/vue/main.js +++ b/assets/vue/main.js @@ -3,6 +3,7 @@ import App from "./App"; import router from "./router"; import store from "./store"; import courseCategoryService from './services/coursecategory'; +import documentsService from './services/documents'; import courseService from './services/course'; import makeCrudModule from './store/modules/crud'; @@ -52,16 +53,23 @@ store.registerModule( }) ); -Vue.config.productionTip = false; +store.registerModule( + 'documents', + makeCrudModule({ + service: documentsService + }) +); -new Vue({ - vuetify, - i18n, - components: {App}, - apolloProvider, - data: {}, - store, - router, - render: h => h(App) -}). -$mount("#app"); +Vue.config.productionTip = false; +if (document.getElementById('app')) { + new Vue({ + vuetify, + i18n, + components: {App}, + apolloProvider, + data: {}, + store, + router, + render: h => h(App) + }).$mount("#app"); +} diff --git a/assets/vue/mixins/ListMixin.js b/assets/vue/mixins/ListMixin.js index b5a2479388..54b1c2ce82 100644 --- a/assets/vue/mixins/ListMixin.js +++ b/assets/vue/mixins/ListMixin.js @@ -33,7 +33,7 @@ export default { methods: { onUpdateOptions(props) { - const { page, itemsPerPage, sortBy, descending, totalItems } = props; + const { page, itemsPerPage, sortBy, sortDesc, descending, totalItems } = props; let params = { ...this.filters }; @@ -41,10 +41,21 @@ export default { params = { ...params, itemsPerPage, page }; } + let sortDescVuetify = false; + let vueDescending = descending; + if (sortBy.length === 1 && sortDesc.length === 1) { + if (sortDesc[0]) { + sortDescVuetify = true; + } + vueDescending = sortDescVuetify; + } + if (!isEmpty(sortBy)) { - params[`order[${sortBy}]`] = descending ? 'desc' : 'asc'; + params[`order[${sortBy}]`] = vueDescending ? 'desc' : 'asc'; } + this.resetList = true; + this.getPage(params).then(() => { this.options.sortBy = sortBy; this.options.descending = descending; @@ -66,6 +77,10 @@ export default { this.$router.push({ name: `${this.$options.servicePrefix}Create` }); }, + addDocumentHandler() { + this.$router.push({ name: `${this.$options.servicePrefix}CreateFile` }); + }, + showHandler(item) { this.$router.push({ name: `${this.$options.servicePrefix}Show`, diff --git a/assets/vue/router/course.js b/assets/vue/router/course.js index 05c7ccab9e..7a2c282988 100644 --- a/assets/vue/router/course.js +++ b/assets/vue/router/course.js @@ -1,5 +1,5 @@ export default { - path: '/courses', + path: '/resources/courses', name: 'courses', component: () => import('../components/course/Layout'), redirect: { name: 'CourseList' }, diff --git a/assets/vue/router/coursecategory.js b/assets/vue/router/coursecategory.js index c0b6785121..ca3056d4d4 100644 --- a/assets/vue/router/coursecategory.js +++ b/assets/vue/router/coursecategory.js @@ -1,5 +1,5 @@ export default { - path: '/course_categories', + path: '/resources/course_categories', name: 'course_categories', component: () => import('../components/coursecategory/Layout'), redirect: { name: 'CourseCategoryList' }, diff --git a/assets/vue/router/documents.js b/assets/vue/router/documents.js new file mode 100644 index 0000000000..3b457bba77 --- /dev/null +++ b/assets/vue/router/documents.js @@ -0,0 +1,33 @@ +export default { + path: '/resources/documents', + name: 'documents', + component: () => import('../components/documents/Layout'), + redirect: { name: 'DocumentsList' }, + children: [ + { + name: 'DocumentsList', + path: '', + component: () => import('../views/documents/List') + }, + { + name: 'DocumentsCreate', + path: 'new', + component: () => import('../views/documents/Create') + }, + { + name: 'DocumentsCreateFile', + path: 'new', + component: () => import('../views/documents/CreateFile') + }, + { + name: 'DocumentsUpdate', + path: ':id/edit', + component: () => import('../views/documents/Update') + }, + { + name: 'DocumentsShow', + path: ':id', + component: () => import('../views/documents/Show') + } + ] +}; diff --git a/assets/vue/router/index.js b/assets/vue/router/index.js index 96fe6587d7..47db3eb389 100644 --- a/assets/vue/router/index.js +++ b/assets/vue/router/index.js @@ -4,15 +4,14 @@ import VueRouter from "vue-router"; Vue.use(VueRouter); import courseRoutes from './course'; -import coursecategoryRoutes from './coursecategory'; -import sessionRoutes from './../../quasar/router/session'; +import courseCategoryRoutes from './coursecategory'; +import documents from './documents'; export default new VueRouter({ mode: "history", routes: [ courseRoutes, - ...sessionRoutes, - coursecategoryRoutes, - // { path: "*", redirect: "/home" } + courseCategoryRoutes, + documents ] }); diff --git a/assets/vue/services/documents.js b/assets/vue/services/documents.js new file mode 100644 index 0000000000..4bce188a24 --- /dev/null +++ b/assets/vue/services/documents.js @@ -0,0 +1,3 @@ +import makeService from './api'; + +export default makeService('documents'); diff --git a/assets/vue/utils/fetch.js b/assets/vue/utils/fetch.js index 09a7ea5224..ceee663e24 100644 --- a/assets/vue/utils/fetch.js +++ b/assets/vue/utils/fetch.js @@ -39,8 +39,6 @@ export default function(id, options = {}) { if (isObject(payload) && payload['@id']) options.body = JSON.stringify(normalize(payload)); - //console.log(id); console.log(new URL(id, entryPoint)); - return global.fetch(new URL(id, entryPoint), options).then(response => { if (response.ok) return response; diff --git a/assets/vue/views/course/List.vue b/assets/vue/views/course/List.vue index 13ae973216..1ee3acbef2 100644 --- a/assets/vue/views/course/List.vue +++ b/assets/vue/views/course/List.vue @@ -34,7 +34,9 @@ > + + diff --git a/assets/vue/views/documents/CreateFile.vue b/assets/vue/views/documents/CreateFile.vue new file mode 100644 index 0000000000..044dc585f5 --- /dev/null +++ b/assets/vue/views/documents/CreateFile.vue @@ -0,0 +1,45 @@ + + + diff --git a/assets/vue/views/documents/List.vue b/assets/vue/views/documents/List.vue new file mode 100644 index 0000000000..3e52a45ec9 --- /dev/null +++ b/assets/vue/views/documents/List.vue @@ -0,0 +1,105 @@ + + + diff --git a/assets/vue/views/documents/Show.vue b/assets/vue/views/documents/Show.vue new file mode 100644 index 0000000000..af6e57c4ff --- /dev/null +++ b/assets/vue/views/documents/Show.vue @@ -0,0 +1,98 @@ + + + diff --git a/assets/vue/views/documents/Update.vue b/assets/vue/views/documents/Update.vue new file mode 100644 index 0000000000..9ab9d5f11c --- /dev/null +++ b/assets/vue/views/documents/Update.vue @@ -0,0 +1,61 @@ + + + diff --git a/config/packages/api_platform.yaml b/config/packages/api_platform.yaml index d6609d2436..b0e373660a 100644 --- a/config/packages/api_platform.yaml +++ b/config/packages/api_platform.yaml @@ -12,5 +12,9 @@ api_platform: json: ['application/json'] html: ['text/html'] graphql: ['application/graphql'] + collection: + pagination: + client_items_per_page: true # Disabled by default + items_per_page_parameter_name: itemsPerPage # Default value # mercure: # hub_url: '%env(MERCURE_SUBSCRIBE_URL)%' diff --git a/config/routes.yaml b/config/routes.yaml index ad2420aee7..394bcdcfb0 100644 --- a/config/routes.yaml +++ b/config/routes.yaml @@ -32,6 +32,11 @@ sessions_vue: requirements: wildcard: .* +resources_vue: + path: /resources/{wildcard} + controller: Chamilo\CoreBundle\Controller\IndexController::courses + requirements: + wildcard: .* # web url shortcuts for legacy templates web.ajax: diff --git a/src/CoreBundle/Controller/CreateMediaObjectAction.php b/src/CoreBundle/Controller/CreateMediaObjectAction.php new file mode 100644 index 0000000000..c3a6a4c85b --- /dev/null +++ b/src/CoreBundle/Controller/CreateMediaObjectAction.php @@ -0,0 +1,25 @@ +files->get('file'); + if (!$uploadedFile) { + throw new BadRequestHttpException('"file" is required'); + } + + $resourceFile = new ResourceFile(); + $resourceFile->setFile($uploadedFile); + + return $resourceFile; + } +} diff --git a/src/CoreBundle/Controller/ResourceController.php b/src/CoreBundle/Controller/ResourceController.php index 3de4f83484..fbc558d854 100644 --- a/src/CoreBundle/Controller/ResourceController.php +++ b/src/CoreBundle/Controller/ResourceController.php @@ -47,7 +47,7 @@ use ZipStream\ZipStream; /** * Class ResourceController. * - * @Route("/resources") + * @Route("/resources2") * * @author Julio Montoya . */ diff --git a/src/CoreBundle/Entity/Course.php b/src/CoreBundle/Entity/Course.php index cc96f95176..21c222c142 100644 --- a/src/CoreBundle/Entity/Course.php +++ b/src/CoreBundle/Entity/Course.php @@ -29,7 +29,7 @@ use Symfony\Component\Validator\Constraints as Assert; * @ApiResource( * iri="https://schema.org/Course", * normalizationContext={"groups"={"course:read"}, "swagger_definition_name"="Read"}, - * denormalizationContext={"groups"={"course:write"}}, + * denormalizationContext={"groups"={"course:write","course_category:write"}}, * ) * * @ApiFilter(SearchFilter::class, properties={"title": "partial", "code": "partial", "category": "partial"}) diff --git a/src/CoreBundle/Entity/CourseCategory.php b/src/CoreBundle/Entity/CourseCategory.php index 76dd708854..5faa99602d 100644 --- a/src/CoreBundle/Entity/CourseCategory.php +++ b/src/CoreBundle/Entity/CourseCategory.php @@ -17,8 +17,8 @@ use Symfony\Component\Validator\Constraints as Assert; /** * CourseCategory. * @ApiResource( - * normalizationContext={"groups"={"course_category:read"}, "swagger_definition_name"="Read"}, - * denormalizationContext={"groups"={"course_category:write"}}, + * normalizationContext={"groups"={"course_category:read", "course:read"}, "swagger_definition_name"="Read"}, + * denormalizationContext={"groups"={"course_category:write", "course:write"}}, * ) * @ApiFilter(SearchFilter::class, properties={"name": "partial", "code": "partial"}) * @ApiFilter(PropertyFilter::class) diff --git a/src/CoreBundle/Entity/Resource/ResourceFile.php b/src/CoreBundle/Entity/Resource/ResourceFile.php index 08c24e7e93..2f550cd5ed 100644 --- a/src/CoreBundle/Entity/Resource/ResourceFile.php +++ b/src/CoreBundle/Entity/Resource/ResourceFile.php @@ -4,8 +4,12 @@ namespace Chamilo\CoreBundle\Entity\Resource; +use ApiPlatform\Core\Annotation\ApiFilter; use ApiPlatform\Core\Annotation\ApiProperty; use ApiPlatform\Core\Annotation\ApiResource; +use ApiPlatform\Core\Bridge\Doctrine\Orm\Filter\OrderFilter; +use ApiPlatform\Core\Bridge\Doctrine\Orm\Filter\SearchFilter; +use ApiPlatform\Core\Serializer\Filter\PropertyFilter; use Doctrine\ORM\Mapping as ORM; use Gedmo\Timestampable\Traits\TimestampableEntity; use Symfony\Component\HttpFoundation\File\File; @@ -13,12 +17,46 @@ use Symfony\Component\HttpFoundation\File\UploadedFile; use Symfony\Component\Serializer\Annotation\Groups; use Symfony\Component\Validator\Constraints as Assert; use Vich\UploaderBundle\Mapping\Annotation as Vich; +use Chamilo\CoreBundle\Controller\CreateMediaObjectAction; +// +//* attributes={"security"="is_granted('ROLE_ADMIN')"}, /** * @ApiResource( - * attributes={"security"="is_granted('ROLE_ADMIN')"}, - * normalizationContext={"groups"={"resource_file:read"}} + * iri="http://schema.org/MediaObject", + * normalizationContext={"groups"={"resource_file:read", "media_object_read"}}, + * collectionOperations={ + * "post"={ + * "controller"=CreateMediaObjectAction::class, + * "deserialize"=false, + * "security"="is_granted('ROLE_USER')", + * "validation_groups"={"Default", "media_object_create"}, + * "openapi_context"={ + * "requestBody"={ + * "content"={ + * "multipart/form-data"={ + * "schema"={ + * "type"="object", + * "properties"={ + * "file"={ + * "type"="string", + * "format"="binary" + * } + * } + * } + * } + * } + * } + * } + * }, + * "get" + * }, + * itemOperations={ + * "get" + * } * ) + * @ApiFilter(SearchFilter::class, properties={"name": "partial"}) + * @ApiFilter(PropertyFilter::class) * @ORM\Entity * @Vich\Uploadable * @@ -37,7 +75,7 @@ class ResourceFile /** * @Assert\NotBlank() - * @Groups({"resource_file:read", "document:read"}) + * @Groups({"resource_file:read", "resource_node:read", "document:read"}) * * @var string * @@ -45,40 +83,10 @@ class ResourceFile */ protected $name; - /** - * @var string - */ - //protected $description; - - /** - * @var bool - */ - //protected $enabled; - - /** - * @var int - */ - //protected $width; - - /** - * @var int - */ - //protected $height; - - /** - * @var float - */ - //protected $length; - - /** - * @var string - */ - //protected $copyright; - /** * @var string * - * @Groups({"resource_file:read", "document:read"}) + * @Groups({"resource_file:read", "resource_node:read", "document:read"}) * @ORM\Column(type="text", nullable=true) */ protected $mimeType; @@ -100,7 +108,7 @@ class ResourceFile /** * @var int - * @Groups({"resource_file:read", "document:read"}) + * @Groups({"resource_file:read", "resource_node:read", "document:read"}) * * @ORM\Column(type="integer", nullable=true) */ @@ -108,7 +116,7 @@ class ResourceFile /** * @var File - * @Groups({"resource_file:read", "document:read"}) + * @Groups({"resource_file:read", "resource_node:read", "document:read"}) * @Assert\NotNull(groups={"media_object_create"}) * @Vich\UploadableField( * mapping="resources", diff --git a/src/CoreBundle/Entity/Resource/ResourceLink.php b/src/CoreBundle/Entity/Resource/ResourceLink.php index c2eefb189d..eed9459920 100644 --- a/src/CoreBundle/Entity/Resource/ResourceLink.php +++ b/src/CoreBundle/Entity/Resource/ResourceLink.php @@ -14,9 +14,7 @@ use Doctrine\Common\Collections\ArrayCollection; use Doctrine\ORM\Mapping as ORM; /** - * @ApiResource( - * attributes={"security"="is_granted('ROLE_ADMIN')"} - * ) + * @ApiResource() * @ORM\Entity * @ORM\Table(name="resource_link") */ diff --git a/src/CoreBundle/Entity/Resource/ResourceNode.php b/src/CoreBundle/Entity/Resource/ResourceNode.php index cdca13fd1d..3c48214115 100644 --- a/src/CoreBundle/Entity/Resource/ResourceNode.php +++ b/src/CoreBundle/Entity/Resource/ResourceNode.php @@ -5,7 +5,11 @@ namespace Chamilo\CoreBundle\Entity\Resource; use ApiPlatform\Core\Annotation\ApiFilter; +use ApiPlatform\Core\Annotation\ApiProperty; use ApiPlatform\Core\Annotation\ApiResource; +use ApiPlatform\Core\Annotation\ApiSubresource; +use ApiPlatform\Core\Bridge\Doctrine\Orm\Filter\OrderFilter; +use ApiPlatform\Core\Bridge\Doctrine\Orm\Filter\SearchFilter; use ApiPlatform\Core\Serializer\Filter\PropertyFilter; use Chamilo\CoreBundle\Entity\Session; use Chamilo\CoreBundle\Entity\User; @@ -19,16 +23,19 @@ use Symfony\Component\Routing\RouterInterface; use Symfony\Component\Serializer\Annotation\Groups; use Symfony\Component\Validator\Constraints as Assert; + +//* attributes={"security"="is_granted('ROLE_ADMIN')"}, /** * Base entity for all resources. * * @ApiResource( - * attributes={"security"="is_granted('ROLE_ADMIN')"}, * collectionOperations={"get"}, * normalizationContext={"groups"={"resource_node:read", "document:read"}}, * denormalizationContext={"groups"={"resource_node:write", "document:write"}} * ) + * @ApiFilter(SearchFilter::class, properties={"title": "partial"}) * @ApiFilter(PropertyFilter::class) + * @ApiFilter(OrderFilter::class, properties={"id", "title", "createdAt", "updatedAt"}) * @ORM\Entity(repositoryClass="Chamilo\CoreBundle\Repository\ResourceNodeRepository") * * @ORM\Table(name="resource_node") @@ -51,7 +58,7 @@ class ResourceNode /** * @Assert\NotBlank() - * @Groups({"resource_node:read", "document:read"}) + * @Groups({"resource_node:read", "resource_node:write", "document:read"}) * @Gedmo\TreePathSource * * @ORM\Column(name="title", type="string", length=255, nullable=false) @@ -67,12 +74,16 @@ class ResourceNode protected $slug; /** + * @Groups({"resource_node:read", "resource_node:write"}) + * * @ORM\ManyToOne(targetEntity="ResourceType") * @ORM\JoinColumn(name="resource_type_id", referencedColumnName="id", nullable=false) */ protected $resourceType; /** + * @Groups({"resource_node:read", "resource_node:write"}) + * * @var ResourceLink[] * * @ORM\OneToMany(targetEntity="ResourceLink", mappedBy="resourceNode", cascade={"remove"}) @@ -82,7 +93,7 @@ class ResourceNode /** * @var ResourceFile available file for this node * - * @Groups({"resource_node:read", "document:read"}) + * @Groups({"resource_node:read", "resource_node:write", "document:read"}) * * @ORM\OneToOne(targetEntity="ResourceFile", inversedBy="resourceNode", orphanRemoval=true) * @ORM\JoinColumn(name="resource_file_id", referencedColumnName="id", onDelete="CASCADE") @@ -92,7 +103,7 @@ class ResourceNode /** * @var User the creator of this node * @Assert\Valid() - * @Groups({"resource_node:read", "document:read"}) + * @Groups({"resource_node:read", "resource_node:write"}) * @ORM\ManyToOne( * targetEntity="Chamilo\CoreBundle\Entity\User", inversedBy="resourceNodes" * ) @@ -152,7 +163,7 @@ class ResourceNode /** * @var \DateTime * - * @Groups({"resource_node:read", "list"}) + * @Groups({"resource_node:read", "document:read"}) * @Gedmo\Timestampable(on="create") * @ORM\Column(type="datetime") */ @@ -161,7 +172,7 @@ class ResourceNode /** * @var \DateTime * - * @Groups({"resource_node:read", "list"}) + * @Groups({"resource_node:read", "document:read"}) * @Gedmo\Timestampable(on="update") * @ORM\Column(type="datetime") */ diff --git a/src/CoreBundle/EventSubscriber/ResolveResourceFileContentUrlSubscriber.php b/src/CoreBundle/EventSubscriber/ResolveResourceFileContentUrlSubscriber.php new file mode 100644 index 0000000000..3e72110afd --- /dev/null +++ b/src/CoreBundle/EventSubscriber/ResolveResourceFileContentUrlSubscriber.php @@ -0,0 +1,72 @@ +storage = $storage; + $this->generator = $generator; + } + + public static function getSubscribedEvents(): array + { + return [ + KernelEvents::VIEW => ['onPreSerialize', EventPriorities::PRE_SERIALIZE], + ]; + } + + public function onPreSerialize(ViewEvent $event): void + { + $controllerResult = $event->getControllerResult(); + $request = $event->getRequest(); + + if ($controllerResult instanceof Response || !$request->attributes->getBoolean('_api_respond', true)) { + return; + } + + if (!($attributes = RequestAttributesExtractor::extractAttributes($request)) || + !\is_a($attributes['resource_class'], ResourceFile::class, true) + ) { + return; + } + + $mediaObjects = $controllerResult; + + if (!is_iterable($mediaObjects)) { + $mediaObjects = [$mediaObjects]; + } + + foreach ($mediaObjects as $mediaObject) { + if (!$mediaObject instanceof ResourceFile) { + continue; + } + $params = [ + 'id' => $mediaObject->getResourceNode()->getId(), + 'tool' => $mediaObject->getResourceNode()->getResourceType()->getTool()->getName(), + 'type' => $mediaObject->getResourceNode()->getResourceType()->getName(), + ]; + + $mediaObject->contentUrl = $this->generator->generate('chamilo_core_resource_view_file', $params); + + //$mediaObject->contentUrl = $this->storage->resolveUri($mediaObject, 'file'); + } + } +} diff --git a/src/CoreBundle/Resources/views/Index/courses.html.twig b/src/CoreBundle/Resources/views/Index/courses.html.twig new file mode 100644 index 0000000000..4a49d27973 --- /dev/null +++ b/src/CoreBundle/Resources/views/Index/courses.html.twig @@ -0,0 +1,33 @@ +{% extends "@ChamiloCore/Layout/no_layout.html.twig" %} + +{% block content %} +
+
+ + + + {{ encore_entry_script_tags('vue') }} +{% endblock %} \ No newline at end of file diff --git a/src/CoreBundle/Resources/views/Layout/head.html.twig b/src/CoreBundle/Resources/views/Layout/head.html.twig index 99d6840605..d19a80e5ad 100644 --- a/src/CoreBundle/Resources/views/Layout/head.html.twig +++ b/src/CoreBundle/Resources/views/Layout/head.html.twig @@ -33,21 +33,23 @@ {% endif %} - {{ encore_entry_link_tags('resource') }} + {{ encore_entry_link_tags('vue') }} {% endblock %} {# app.js is generated using the file webpack.config.js and using yarn read /assets/README.md for more info #} -{##} + + +{#{{ encore_entry_script_tags('app') }}#} -{##} {# Add third party js libraries that can't be loaded using webpack #} {##} + + + + {# Check chamilo_js key in assetic.yml #} {% block javascripts %} - {{ encore_entry_script_tags('app') }} - {{ encore_entry_script_tags('resource') }} - {% block chamilo_header_js %} {# Loading legacy js using the $htmlHeadXtra array #} {% autoescape false %} diff --git a/src/CoreBundle/Resources/views/login.html.twig b/src/CoreBundle/Resources/views/login.html.twig index f5f68f18c6..dbe7311233 100644 --- a/src/CoreBundle/Resources/views/login.html.twig +++ b/src/CoreBundle/Resources/views/login.html.twig @@ -13,17 +13,15 @@