Skip to content

Commit

Permalink
Merge pull request #205 from AresMUSH/dev
Browse files Browse the repository at this point in the history
Version 1.0.8
  • Loading branch information
lynnfaraday authored Jul 23, 2023
2 parents 6ebc13e + 167cb94 commit a50ec0f
Show file tree
Hide file tree
Showing 38 changed files with 3,308 additions and 11,827 deletions.
2 changes: 1 addition & 1 deletion app/components/cmd-box.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import TextArea from '@ember/component/text-area';
import { TextArea } from '@ember/legacy-built-in-components'

export default TextArea.extend({

Expand Down
5 changes: 3 additions & 2 deletions app/components/live-scene-control.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ export default Component.extend(AuthenticatedController, {
flashMessages: service(),
gameSocket: service(),
session: service(),
router: service(),

updatePoseControls: function() {
this.set('poseType', { title: 'Pose', id: 'pose' });
Expand Down Expand Up @@ -170,8 +171,8 @@ export default Component.extend(AuthenticatedController, {
if (response.error) {
return;
}
this.flashMessages.success('The scene has been deleted.');
this.set('scene.reload_required', true);
this.flashMessages.success('The scene has been marked for deletion.');
this.router.transitionTo('scenes-live');
});
},
saveScenePose(scenePose, notify) {
Expand Down
5 changes: 0 additions & 5 deletions app/components/mail-inbox.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,11 +21,6 @@ export default Component.extend({
actions: {
changeTag(tag) {
this.set('selectedTag', tag);
},

showMessage(message) {
this.set('selectedMessage', message);
}

}
});
56 changes: 35 additions & 21 deletions app/controllers/application.js
Original file line number Diff line number Diff line change
Expand Up @@ -58,40 +58,30 @@ export default Controller.extend(AuthenticatedController, AvailableRoutes, AresC
config.forEach(n => {
let menuOK = true;
try {
n.menu.forEach(m => {
let route = m.route;
if (route) {

if (!availableRoutes.includes(route)) {
console.log(`Bad route in menu: ${route}`);
menuOK = false;
}

let routeHasId = this.routeHasId(route);
if (m.id && !routeHasId) {
console.log(`Menu ${route} has an ID when it shouldn't.`);
menuOK = false;
}

if (!m.id && routeHasId) {
console.log(`Menu ${route} is missing ID.`);
menuOK = false;
}
}
});
if (n.menu) {
n.menu.forEach(m => {
if (!this.checkRoute(m, availableRoutes)) {
menuOK = false;
}
});
} else {
menuOK = this.checkRoute(n, availableRoutes);
}
if (menuOK) {
nav.push(n);
} else {
nav.push({ title: `MENU ERROR` });
}
}
catch(error) {
console.log(error);
console.log(`Bad menu config under ${n.title}.`);
nav.push({ title: `MENU ERROR` });
}
});
}
catch(error) {
console.log(error);
console.log("Bad menu config.");
nav.push({ title: `MENU ERROR` });
}
Expand All @@ -103,6 +93,30 @@ export default Controller.extend(AuthenticatedController, AvailableRoutes, AresC
return this.mushVersion != this.portalVersion;
}),

checkRoute: function(menu, availableRoutes) {
let route = menu.route;
if (route) {

if (!availableRoutes.includes(route)) {
console.log(`Bad route in menu: ${route}`);
return false;
}

let routeHasId = this.routeHasId(route);
if (menu.id && !routeHasId) {
console.log(`Menu ${menu.title}:${route} has an ID when it shouldn't.`);
return false;
}

if (!menu.id && routeHasId) {
console.log(`Menu ${menu.title}:${route} is missing ID.`);
return false;
}
return true;
}
return true;
},

actions: {
switchAlt: function(alt) {
this.set('showAltSelection', false);
Expand Down
14 changes: 9 additions & 5 deletions app/controllers/event-create.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import Controller from '@ember/controller';
import AuthenticatedController from 'ares-webportal/mixins/authenticated-controller';
import dayjs from 'dayjs';
import { inject as service } from '@ember/service';
import { action } from '@ember/object';

export default Controller.extend(AuthenticatedController, {
gameApi: service(),
Expand All @@ -27,15 +28,17 @@ export default Controller.extend(AuthenticatedController, {
this.set('warning_tags', []);
},

@action
changeDate(date) {
this.set('date', date);
},

actions: {
organizerChanged(org) {
this.set('organizer', org);
},

changeDate: function(date) {
let formatted_date = dayjs(date).format(this.get('model.app.game.date_entry_format')); //moment(date).format(this.get('model.app.game.date_entry_format'));
this.set('date', formatted_date);
},

create: function() {
let api = this.gameApi;

Expand All @@ -44,8 +47,9 @@ export default Controller.extend(AuthenticatedController, {
tags = tags.split(/[\s,]/);
}

let formattedDate = dayjs(this.date).format(this.get('model.app.game.date_entry_format'));
api.requestOne('createEvent', { title: this.title,
date: this.date,
date: formattedDate,
time: this.time,
content_warning: this.content_warning,
organizer: this.organizer ? this.organizer.name : "",
Expand Down
25 changes: 19 additions & 6 deletions app/controllers/event-edit.js
Original file line number Diff line number Diff line change
@@ -1,23 +1,34 @@
import Controller from '@ember/controller';
import AuthenticatedController from 'ares-webportal/mixins/authenticated-controller';
import dayjs from 'dayjs';
import customParseFormat from 'dayjs/plugin/customParseFormat';

import { inject as service } from '@ember/service';
import { action } from '@ember/object';

export default Controller.extend(AuthenticatedController, {
gameApi: service(),
flashMessages: service(),
router: service(),

warning_tags: [],
selectedDate: '',

@action
changeDate(date) {
this.set('selectedDate', date);
},

setup() {
dayjs.extend(customParseFormat);
let parsedDate = dayjs(this.model.event.date, this.get('model.event.date_entry_format'), true);
this.set('selectedDate', new Date(parsedDate));
},

actions: {
organizerChanged(org) {
this.set('model.event.organizer', org);
},
changeDate: function(date) {
let formatted_date = dayjs(date).format(this.get('model.event.date_entry_format')); //moment(date).format(this.get('model.event.date_entry_format'));
this.set('model.event.date', formatted_date);
},

edit: function() {
let api = this.gameApi;

Expand All @@ -26,9 +37,11 @@ export default Controller.extend(AuthenticatedController, {
tags = tags.split(/[\s,]/);
}

let formattedDate = dayjs(this.selectedDate).format(this.get('model.event.date_entry_format'));

api.requestOne('editEvent', { event_id: this.get('model.event.id'),
title: this.get('model.event.title'),
date: this.get('model.event.date'),
date: formattedDate,
time: this.get('model.event.time'),
organizer: this.get('model.event.organizer.name'),
tags: tags,
Expand Down
11 changes: 8 additions & 3 deletions app/controllers/play.js
Original file line number Diff line number Diff line change
Expand Up @@ -52,14 +52,17 @@ export default Controller.extend(AuthenticatedController, SceneUpdate, {
let char = splitMsg[1];
let notify = true;
let currentUsername = this.get('currentUser.name');
let alts = this.model.app.alts ? this.model.app.alts.map(c => c.name) : [ currentUsername ];

// For poses we can just add it to the display. Other events require a reload.
if (sceneId === this.get('currentScene.id')) {
let scene = this.currentScene;

notify = this.updateSceneData(scene, msg, timestamp);

if (currentUsername != char) {


// -1 is not found
if (alts.indexOf(char) < 0) {
scene.set('is_unread', false);
}
else {
Expand All @@ -75,7 +78,9 @@ export default Controller.extend(AuthenticatedController, SceneUpdate, {
this.get('model.scenes').forEach(s => {
if (s.id === sceneId) {
notify = this.updateSceneData(s, msg, timestamp);
if (currentUsername != char) {

// -1 is not found
if (alts.indexOf(char) < 0) {
s.set('is_unread', true);
this.gameSocket.notify(`New activity from ${char} in one of your other scenes (${sceneId}).`);
}
Expand Down
22 changes: 14 additions & 8 deletions app/controllers/scene-download.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import Controller from '@ember/controller';
import { inject as service } from '@ember/service';
import { action } from '@ember/object';

export default Controller.extend({
showOoc: false,
Expand All @@ -23,16 +24,21 @@ export default Controller.extend({
this.set('showOoc', false);
this.set('showSystem', true);
},

@action
toggleOoc() {
this.set('showOoc', !this.showOoc);
this.reloadScene();
},

@action
toggleSystem() {
this.set('showSystem', !this.showSystem);
this.reloadScene();
},

actions: {
toggleOoc() {
this.set('showOoc', !this.showOoc);
this.reloadScene();
},

toggleSystem() {
this.set('showSystem', !this.showSystem);
this.reloadScene();
},

download() {

Expand Down
4 changes: 3 additions & 1 deletion app/controllers/scene-live.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,13 @@ export default Controller.extend(AuthenticatedController, SceneUpdate, {
let sceneId = splitMsg[0];
let char = splitMsg[1];
let currentUsername = this.get('currentUser.name');
let alts = this.model.app.alts ? this.model.app.alts.map(c => c.name) : [ currentUsername ];

if (sceneId === this.get('model.scene.id')) {
let notify = this.updateSceneData(this.get('model.scene'), msg, timestamp);

if (notify && (char != currentUsername)) {
// -1 is not found
if (notify && alts.indexOf(char) < 0) {
this.gameSocket.notify(`New activity from ${char} in scene ${sceneId}.`);
}

Expand Down
10 changes: 10 additions & 0 deletions app/helpers/local-date.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
import dayjs from 'dayjs';
import { helper } from '@ember/component/helper';

export function localDate(params, hash) {
let date = params[0];
let format = params[1];
return dayjs(date).format(format);
}

export default helper(localDate);
2 changes: 0 additions & 2 deletions app/modifiers/pikaday.js

This file was deleted.

5 changes: 5 additions & 0 deletions app/routes/event-edit.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,5 +16,10 @@ export default Route.extend(AuthenticatedRoute, {
sceneOptions: api.requestOne('sceneOptions')
})
.then((model) => EmberObject.create(model));
},

setupController: function(controller, model) {
this._super(controller, model);
controller.setup();
}
});
3 changes: 2 additions & 1 deletion app/routes/play.js
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,8 @@ export default Route.extend(ReloadableRoute, RouteResetOnExit, {
custom: api.requestOne('customSceneData'),
locations: api.request('sceneLocations', { id: params['id'] }),
chat: api.requestOne('chat'),
characters: api.requestMany('characters', { select: 'all' })
characters: api.requestMany('characters', { select: 'all' }),
app: this.modelFor('application')
})
.then((model) => EmberObject.create(model));
},
Expand Down
3 changes: 2 additions & 1 deletion app/routes/scene-live.js
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,8 @@ export default Route.extend(ReloadableRoute, RouteResetOnExit, {
abilities: api.request('charAbilities', { id: this.get('session.data.authenticated.id') }),
custom: api.requestOne('customSceneData'),
locations: api.request('sceneLocations', { id: params['id'] }),
characters: api.requestMany('characters', { select: 'include_staff' })
characters: api.requestMany('characters', { select: 'include_staff' }),
app: this.modelFor('application')
})
.then((model) => {

Expand Down
4 changes: 2 additions & 2 deletions app/templates/application.hbs
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@

{{#if (not this.hideSidebar)}}
{{#if this.model.left_sidebar}}
<div class="col-md-3 left-sidebar" role="navigation" aria-labelledby="sidebar">
<div class="col-md-3 left-sidebar" role="navigation" aria-label="sidebar">
<GlobalSidebar @model={{this.sidebar}} @socketConnected={{this.socketConnected}} @versionWarning={{this.versionWarning}} @boxStyle="sidebar-box-left" />
</div>
{{/if}}
Expand Down Expand Up @@ -93,7 +93,7 @@

{{#if (not this.hideSidebar)}}
{{#if (not this.model.left_sidebar)}}
<div class="col-md-3 right-sidebar" role="navigation" aria-labelledby="sidebar">
<div class="col-md-3 right-sidebar" role="navigation" aria-label="sidebar">
<GlobalSidebar @model={{this.sidebar}} @socketConnected={{this.socketConnected}} @versionWarning={{this.versionWarning}} @boxStyle="sidebar-box-right" />
</div>
{{/if}}
Expand Down
2 changes: 1 addition & 1 deletion app/templates/char-source.hbs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{{page-title pageTitle}}
{{page-title this.pageTitle}}

<h1>{{this.model.char_name}} Page Source</h1>

Expand Down
2 changes: 1 addition & 1 deletion app/templates/char.hbs
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@

<div class="thumbnail-gallery-item">
<LinkTo @route="file" @models={{array charFile.folder charFile.name}}>
{{file.path}} <img src="/game/uploads/{{charFile.path}}" alt="{{charFile.name}}" class="thumbnail" title={{charFile.description}}>
<img src="/game/uploads/{{charFile.path}}" alt="{{charFile.name}}" class="thumbnail" title={{charFile.description}}>
</LinkTo>
</div>
{{/each}}
Expand Down
2 changes: 1 addition & 1 deletion app/templates/components/chat-control.hbs
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,7 @@
<table>
{{#each this.channel.messages as |message|}}
<tr>
<td><Input @type="radio" id="{{message.id}}" @name="reportMessage" onclick={{action (mut this.selectedReportMessage) message.id}} /></td>
<td><Input @type="radio" id="{{message.id}}" name="reportMessage" onclick={{action (mut this.selectedReportMessage) message.id}} /></td>
<td><AnsiFormat @text={{message.message}} /></td>
</tr>
{{/each}}
Expand Down
2 changes: 1 addition & 1 deletion app/templates/components/fs3-damage.hbs
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
<div class="col col-xs-12 col-sm-4">{{damage.date}}</div>
<div class="col col-xs-12 col-sm-4">

{{#if showOriginal}}
{{#if this.showOriginal}}
<AnsiFormat @text={{damage.original_severity}} />
( now <AnsiFormat @text={{damage.severity}} />)
{{else}}
Expand Down
Loading

0 comments on commit a50ec0f

Please sign in to comment.