| 1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768 |
- if globalThis.stylFns and globalThis.stylFns['app/pages/Admin/index.styl']
- styleElement = document.createElement('style')
- styleElement.type = 'text/css'
- styleElement.textContent = globalThis.stylFns['app/pages/Admin/index.styl']
- document.head.appendChild(styleElement)
- module.exports = {
- props:
- domainSettings:
- type: Object
- default: -> {}
- language:
- type: String
- default: 'ru'
- data: ->
- {
- user: null
- breadcrumbs: []
- }
- computed:
- currentRoute: -> @$route
- methods:
- logout: ->
- localStorage.removeItem('user')
- @$router.push('/')
- @$emit('show-notification', 'Вы вышли из админ-панели', 'info')
- updateBreadcrumbs: ->
- crumbs = []
- pathArray = @$route.path.split('/').filter (x) -> x
-
- pathArray.forEach (path, index) =>
- path = "/#{pathArray.slice(0, index + 1).join('/')}"
- name = @getBreadcrumbName(path, pathArray[index])
- crumbs.push({ path, name })
-
- @breadcrumbs = crumbs
- getBreadcrumbName: (path, segment) ->
- names =
- '/admin': 'Дашборд'
- '/admin/products': 'Товары'
- '/admin/categories': 'Категории'
- '/admin/import': 'Импорт'
- '/admin/media': 'Медиафайлы'
-
- return names[path] || segment.charAt(0).toUpperCase() + segment.slice(1)
- watch:
- '$route.path': ->
- @updateBreadcrumbs()
- mounted: ->
- userData = localStorage.getItem('user')
- if userData
- try
- @user = JSON.parse(userData)
- catch
- @user = null
-
- @updateBreadcrumbs()
- render: (new Function '_ctx', '_cache', globalThis.renderFns['app/pages/Admin/index.pug'])()
- }
|