kopia lustrzana https://github.com/nextcloud/social
Port to new Dashboard api
Signed-off-by: Carl Schwan <carl@carlschwan.eu>pull/1162/head
rodzic
b009d25e13
commit
c683f9135a
|
@ -23,19 +23,21 @@
|
||||||
|
|
||||||
namespace OCA\Social\Dashboard;
|
namespace OCA\Social\Dashboard;
|
||||||
|
|
||||||
|
use OCP\IURLGenerator;
|
||||||
use OCP\Dashboard\IWidget;
|
use OCP\Dashboard\IWidget;
|
||||||
use OCP\IL10N;
|
use OCP\IL10N;
|
||||||
use OCA\Social\AppInfo\Application;
|
use OCA\Social\AppInfo\Application;
|
||||||
|
|
||||||
class SocialWidget implements IWidget {
|
class SocialWidget implements IWidget {
|
||||||
|
private IL10N $l10n;
|
||||||
/** @var IL10N */
|
private IURLGenerator $urlGenerator;
|
||||||
private $l10n;
|
|
||||||
|
|
||||||
public function __construct(
|
public function __construct(
|
||||||
IL10N $l10n
|
IL10N $l10n,
|
||||||
|
IURLGenerator $urlGenerator
|
||||||
) {
|
) {
|
||||||
$this->l10n = $l10n;
|
$this->l10n = $l10n;
|
||||||
|
$this->urlGenerator = $urlGenerator;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -70,14 +72,13 @@ class SocialWidget implements IWidget {
|
||||||
* @inheritDoc
|
* @inheritDoc
|
||||||
*/
|
*/
|
||||||
public function getUrl(): ?string {
|
public function getUrl(): ?string {
|
||||||
return \OC::$server->getURLGenerator()->linkToRoute('social.local.streamNotifications', []);
|
return ''; //$this->uRLGenerator->linkToRoute('social.local.streamNotifications', []);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @inheritDoc
|
* @inheritDoc
|
||||||
*/
|
*/
|
||||||
public function load(): void {
|
public function load(): void {
|
||||||
\OC_Util::addScript(Application::APP_NAME, 'dashboard');
|
\OCP\Util::addScript(Application::APP_NAME, 'social-dashboard');
|
||||||
\OC_Util::addStyle(Application::APP_NAME, 'dashboard');
|
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -14,18 +14,20 @@
|
||||||
import Vue from 'vue'
|
import Vue from 'vue'
|
||||||
import Dashboard from './views/Dashboard.vue'
|
import Dashboard from './views/Dashboard.vue'
|
||||||
|
|
||||||
|
// eslint-disable-next-line
|
||||||
|
__webpack_nonce__ = btoa(OC.requestToken);
|
||||||
|
// eslint-disable-next-line
|
||||||
|
__webpack_public_path__ = OC.linkTo('social', 'js/');
|
||||||
|
|
||||||
Vue.prototype.t = t
|
Vue.prototype.t = t
|
||||||
Vue.prototype.n = n
|
Vue.prototype.n = n
|
||||||
Vue.prototype.OC = window.OC
|
Vue.prototype.OC = window.OC
|
||||||
Vue.prototype.OCA = window.OCA
|
|
||||||
|
|
||||||
document.addEventListener('DOMContentLoaded', function() {
|
document.addEventListener('DOMContentLoaded', function() {
|
||||||
|
|
||||||
OCA.Dashboard.register('social_notifications', (el, { widget }) => {
|
OCA.Dashboard.register('social_notifications', (el, { widget }) => {
|
||||||
const View = Vue.extend(Dashboard)
|
const View = Vue.extend(Dashboard)
|
||||||
new View({
|
new View({
|
||||||
propsData: { title: widget.title }
|
propsData: { title: widget.title }
|
||||||
}).$mount(el)
|
}).$mount(el)
|
||||||
})
|
})
|
||||||
|
|
||||||
})
|
})
|
||||||
|
|
|
@ -1,10 +1,10 @@
|
||||||
<template>
|
<template>
|
||||||
<DashboardWidget :items="items"
|
<NcDashboardWidget :items="items"
|
||||||
:show-more-url="showMoreUrl"
|
:show-more-url="showMoreUrl"
|
||||||
:show-more-text="title"
|
:show-more-text="title"
|
||||||
:loading="state === 'loading'">
|
:loading="state === 'loading'">
|
||||||
<template #empty-content>
|
<template #empty-content>
|
||||||
<EmptyContent
|
<NcEmptyContent
|
||||||
v-if="emptyContentMessage"
|
v-if="emptyContentMessage"
|
||||||
:icon="emptyContentIcon">
|
:icon="emptyContentIcon">
|
||||||
<template #desc>
|
<template #desc>
|
||||||
|
@ -15,24 +15,24 @@
|
||||||
</a>
|
</a>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
</EmptyContent>
|
</NcEmptyContent>
|
||||||
</template>
|
</template>
|
||||||
</DashboardWidget>
|
</NcDashboardWidget>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
import axios from '@nextcloud/axios'
|
import axios from '@nextcloud/axios'
|
||||||
import { generateUrl } from '@nextcloud/router'
|
import { generateUrl } from '@nextcloud/router'
|
||||||
import { showError } from '@nextcloud/dialogs'
|
import { showError } from '@nextcloud/dialogs'
|
||||||
import { DashboardWidget } from '@nextcloud/vue-dashboard'
|
import NcDashboardWidget from '@nextcloud/vue/dist/Components/NcDashboardWidget.js'
|
||||||
import EmptyContent from '@nextcloud/vue/dist/Components/EmptyContent'
|
import NcEmptyContent from '@nextcloud/vue/dist/Components/NcEmptyContent.js'
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
name: 'Dashboard',
|
name: 'Dashboard',
|
||||||
|
|
||||||
components: {
|
components: {
|
||||||
DashboardWidget,
|
NcDashboardWidget,
|
||||||
EmptyContent
|
NcEmptyContent
|
||||||
},
|
},
|
||||||
|
|
||||||
props: {
|
props: {
|
||||||
|
@ -152,6 +152,9 @@ export default {
|
||||||
if (n.subtype === 'Follow') {
|
if (n.subtype === 'Follow') {
|
||||||
return t('social', '{account} is following you', { account: this.getActorName(n) })
|
return t('social', '{account} is following you', { account: this.getActorName(n) })
|
||||||
}
|
}
|
||||||
|
if (n.subtype === 'Like') {
|
||||||
|
return t('social', '{account} liked your post', { account: this.getActorName(n) })
|
||||||
|
}
|
||||||
},
|
},
|
||||||
getAvatarUrl(n) {
|
getAvatarUrl(n) {
|
||||||
return undefined
|
return undefined
|
||||||
|
@ -180,6 +183,9 @@ export default {
|
||||||
if (n.subtype === 'Follow') {
|
if (n.subtype === 'Follow') {
|
||||||
return this.getActorAccountName(n)
|
return this.getActorAccountName(n)
|
||||||
}
|
}
|
||||||
|
if (n.subtype === 'Like') {
|
||||||
|
return this.getActorAccountName(n)
|
||||||
|
}
|
||||||
return ''
|
return ''
|
||||||
},
|
},
|
||||||
getNotificationTypeImage(n) {
|
getNotificationTypeImage(n) {
|
||||||
|
|
|
@ -10,3 +10,5 @@ webpackConfig.entry = {
|
||||||
profilePage: path.join(__dirname, 'src', 'profile.js'),
|
profilePage: path.join(__dirname, 'src', 'profile.js'),
|
||||||
dashboard: path.join(__dirname, 'src', 'dashboard.js'),
|
dashboard: path.join(__dirname, 'src', 'dashboard.js'),
|
||||||
}
|
}
|
||||||
|
|
||||||
|
module.exports = webpackConfig
|
||||||
|
|
Ładowanie…
Reference in New Issue