Campaign description sync
This commit is contained in:
parent
be6d4fda26
commit
225926bec2
@ -100,7 +100,7 @@ router.get('/players', (req, res) => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
router.put('/update', (req, res) => {
|
router.put('/update', (req, res) => {
|
||||||
CampaignUser.find({campaign: req.query.campaign}).then((data) => {
|
CampaignUser.findOne({campaign: req.query.campaign, user: req.user}).then((data) => {
|
||||||
if(data.is_dm){
|
if(data.is_dm){
|
||||||
let {
|
let {
|
||||||
name,
|
name,
|
||||||
|
@ -6,6 +6,8 @@ import { GetUser } from "./User";
|
|||||||
import { chat } from './Chat';
|
import { chat } from './Chat';
|
||||||
import { ClearAll, CreateWindow } from './Windows';
|
import { ClearAll, CreateWindow } from './Windows';
|
||||||
|
|
||||||
|
import Api from '@/services/Api';
|
||||||
|
import { GetCampaign } from './Dragonroll';
|
||||||
|
|
||||||
let _currentCampaign = null;
|
let _currentCampaign = null;
|
||||||
let _currentPlayer = null;
|
let _currentPlayer = null;
|
||||||
@ -27,12 +29,17 @@ function Disconnect(){
|
|||||||
chat.value = [];
|
chat.value = [];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
function DisplayCampaign(data = _currentCampaign){
|
function DisplayCampaign(data = _currentCampaign){
|
||||||
ClearAll();
|
ClearAll();
|
||||||
CreateWindow('campaign_preview', {campaign: data});
|
CreateWindow('campaign_preview', {campaign: data});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function UpdateCampaignData(data){
|
||||||
|
Api().put('/campaign/update?campaign=' + GetCampaign()._id, {campaign: data}).then(response => {
|
||||||
|
console.log(response);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
socket.on('update-players', data => {
|
socket.on('update-players', data => {
|
||||||
_UpdatePlayers(data)
|
_UpdatePlayers(data)
|
||||||
})
|
})
|
||||||
@ -57,5 +64,6 @@ export {
|
|||||||
|
|
||||||
ConnectToCampaign,
|
ConnectToCampaign,
|
||||||
DisplayCampaign,
|
DisplayCampaign,
|
||||||
|
UpdateCampaignData,
|
||||||
Disconnect
|
Disconnect
|
||||||
}
|
}
|
@ -13,7 +13,7 @@ import ChatComponent from '../../partials/ChatComponent.vue';
|
|||||||
import GameSystem from '@/views/partials/GameSystem.vue'
|
import GameSystem from '@/views/partials/GameSystem.vue'
|
||||||
import { GetModule } from '../../../services/Modules';
|
import { GetModule } from '../../../services/Modules';
|
||||||
import { AddTooltip } from '../../../services/Tooltip';
|
import { AddTooltip } from '../../../services/Tooltip';
|
||||||
import { Disconnect } from '../../../services/Campaign';
|
import { Disconnect, UpdateCampaignData } from '../../../services/Campaign';
|
||||||
import MarkdownEditor from '@/views/partials/MarkdownEditor.vue';
|
import MarkdownEditor from '@/views/partials/MarkdownEditor.vue';
|
||||||
|
|
||||||
import { useI18n } from 'vue-i18n';
|
import { useI18n } from 'vue-i18n';
|
||||||
@ -31,6 +31,7 @@ const campaign_title = ref(null);
|
|||||||
const copy_code_button = ref(null);
|
const copy_code_button = ref(null);
|
||||||
|
|
||||||
const container = ref(null);
|
const container = ref(null);
|
||||||
|
const description = ref(null);
|
||||||
|
|
||||||
let id = data.id;
|
let id = data.id;
|
||||||
|
|
||||||
@ -50,10 +51,16 @@ function Exit(){
|
|||||||
CreateWindow('campaign_list');
|
CreateWindow('campaign_list');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function DescriptionChanged(description){
|
||||||
|
UpdateCampaignData({description})
|
||||||
|
}
|
||||||
|
|
||||||
const description_editable = ref(false);
|
const description_editable = ref(false);
|
||||||
|
|
||||||
onMounted(() => {
|
onMounted(() => {
|
||||||
if(GetClient().is_dm) description_editable.value = true;
|
if(GetClient().is_dm) description_editable.value = true;
|
||||||
|
|
||||||
|
description.value.text = data.campaign.description;
|
||||||
SetupHandle(id, handle);
|
SetupHandle(id, handle);
|
||||||
|
|
||||||
SetSize(id, {width: 800, height: 750});
|
SetSize(id, {width: 800, height: 750});
|
||||||
@ -71,7 +78,6 @@ onMounted(() => {
|
|||||||
campaign_title.value.style.backgroundColor = GetModule(data.campaign.system).color ? GetModule(data.campaign.system).color : "#1f1f1f";
|
campaign_title.value.style.backgroundColor = GetModule(data.campaign.system).color ? GetModule(data.campaign.system).color : "#1f1f1f";
|
||||||
|
|
||||||
AddTooltip(copy_code_button.value, `<p>${t('campaigns.preview.copy-explain')}</p>`, {max_width: 300})
|
AddTooltip(copy_code_button.value, `<p>${t('campaigns.preview.copy-explain')}</p>`, {max_width: 300})
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
</script>
|
</script>
|
||||||
|
Loading…
Reference in New Issue
Block a user