Skip to content

Commit

Permalink
Merge pull request #54 from vigoren/develop
Browse files Browse the repository at this point in the history
v1.2.5
  • Loading branch information
vigoren authored Apr 6, 2021
2 parents 06f4d79 + 41d0588 commit 2444bb7
Show file tree
Hide file tree
Showing 16 changed files with 76 additions and 17 deletions.
13 changes: 13 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,18 @@
# Change Log

## v1.2.5 - Bug Fixes and QoL Improvements

### Quality of Life Improvements

- Adjusted the styling around the calendar configuration tabs. The tab titles shouldn't break into multiple lines unless the config window is shrunk and if they do break into multiple lines it should look cleaner.
- Adjusted the starting height of the calendar to have more space for the events list.
- Updated adding/editing a note so that the text editor does not need to be saved before saving the note. When saving the note any content entered will be saved.
- Updated the weekday headings so that the first 2 characters of the weekday name are shown. This will help distinguish between days of the week that start with the same character.

### Bug Fixes

- Fixed a bug where in some instances importing data from Calendar/Weather into Simple Calendar would incorrectly save numerical data as strings causing Simple Calendar to not open.

## v1.2.0 - Time, Other Modules, Seasons, Moons and Notes

This update was a long time coming so apologies for making you wait for it. This update with most of the currently requested changes to Simple Calendar
Expand Down
2 changes: 1 addition & 1 deletion docs/Notes.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#Notes
# Notes

All information around viewing, adding, editing and removing notes.

Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "foundryvtt-simple-calendar",
"description": "A simple calendar module for keeping track of game days and events.",
"version": "1.2.0",
"version": "1.2.5",
"author": "Dean Vigoren (vigorator)",
"keywords": [
"foundryvtt",
Expand Down
14 changes: 13 additions & 1 deletion src/classes/importer.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,15 @@ describe('Importer Class Tests', () => {
leapLength: 1,
isNumbered: false,
abbrev: ''
},
{
name: 'Month 4',
length: "asd",
leapLength: "asd",
isNumbered: true,
abbrev: ''
}

],
daysOfTheWeek: ["S","M","T"],
year: 12,
Expand Down Expand Up @@ -192,7 +200,7 @@ describe('Importer Class Tests', () => {
expect(y.weekdays[0].name).toBe('S');
expect(y.weekdays[1].name).toBe('M');
expect(y.weekdays[2].name).toBe('T');
expect(y.months.length).toBe(3);
expect(y.months.length).toBe(4);
expect(y.months[0].name).toBe('Month 1');
expect(y.months[0].numberOfDays).toBe(10);
expect(y.months[0].numberOfLeapYearDays).toBe(10);
Expand All @@ -205,6 +213,10 @@ describe('Importer Class Tests', () => {
expect(y.months[2].numberOfDays).toBe(1);
expect(y.months[2].numberOfLeapYearDays).toBe(1);
expect(y.months[2].intercalary).toBe(true);
expect(y.months[3].name).toBe('Month 4');
expect(y.months[3].numberOfDays).toBe(1);
expect(y.months[3].numberOfLeapYearDays).toBe(1);
expect(y.months[3].intercalary).toBe(false);
expect(y.leapYearRule.rule).toBe(LeapYearRules.None);
});

Expand Down
11 changes: 10 additions & 1 deletion src/classes/importer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,16 @@ export default class Importer{
let mCount = 1;
let mICount = 1;
for(let i = 0; i < currentSettings.months.length; i++){
const nMonth = new Month(currentSettings.months[i].name, i+1, currentSettings.months[i].length, currentSettings.months[i].leapLength)
let numDays = parseInt(currentSettings.months[i].length.toString());
let numLeapDays = parseInt(currentSettings.months[i].leapLength.toString());
if(isNaN(numDays)){
numDays = 1;
}
if(isNaN(numLeapDays)){
numLeapDays = 1;
}

const nMonth = new Month(currentSettings.months[i].name, i+1, numDays, numLeapDays)
if(!currentSettings.months[i].isNumbered){
nMonth.numericRepresentation = mICount * -1;
nMonth.intercalary = true;
Expand Down
2 changes: 1 addition & 1 deletion src/classes/simple-calendar-configuration.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ describe('Simple Calendar Configuration Tests', () => {
//@ts-ignore
expect(opts.resizable).toBe(true);
//@ts-ignore
expect(opts.width).toBe(960);
expect(opts.width).toBe(900);
//@ts-ignore
expect(opts.height).toBe(700);
//@ts-ignore
Expand Down
4 changes: 2 additions & 2 deletions src/classes/simple-calendar-configuration.ts
Original file line number Diff line number Diff line change
Expand Up @@ -55,15 +55,15 @@ export class SimpleCalendarConfiguration extends FormApplication {
options.resizable = true;
options.tabs = [{navSelector: ".tabs", contentSelector: "form", initial: "yearSettings"}];
options.height = 700;
options.width = 960;
options.width = 900;
return options;
}

/**
* Shows the application window
*/
public showApp(){
this.render(true, {width: 500, height: 500});
this.render(true);
}

/**
Expand Down
2 changes: 1 addition & 1 deletion src/classes/simple-calendar-notes.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -326,7 +326,7 @@ describe('Simple Calendar Notes Tests', () => {
SimpleCalendarNotes.instance.editors['content'].mce = {getContent: ()=>{return 'a';},isNotDirty: false};
SimpleCalendarNotes.instance.saveButtonClick(event);
//@ts-ignore
expect(ui.notifications.warn).toHaveBeenCalledTimes(2);
expect(ui.notifications.warn).toHaveBeenCalledTimes(1);

//@ts-ignore
SimpleCalendarNotes.instance.element = {
Expand Down
5 changes: 4 additions & 1 deletion src/classes/simple-calendar-notes.ts
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,7 @@ export class SimpleCalendarNotes extends FormApplication {
data.authorName = user.name;
}
}
console.log(this.editors['content']);
return data;
}

Expand Down Expand Up @@ -191,6 +192,7 @@ export class SimpleCalendarNotes extends FormApplication {
*/
protected _updateObject(event: Event | JQuery.Event, formData: any): Promise<any> {
(<Note>this.object).content = formData['content'];
Logger.debug('Update Object Called');
this.richEditorSaved = true;
return Promise.resolve(false);
}
Expand Down Expand Up @@ -279,7 +281,8 @@ export class SimpleCalendarNotes extends FormApplication {
let detailsEmpty = true;
if(this.editors['content'] && this.editors['content'].mce){
if(this.editors['content'].mce.getContent().trim() !== '' && !this.editors['content'].mce.isNotDirty){
detailsEmpty = false;
(<Note>this.object).content = this.editors['content'].mce.getContent().trim();
this.richEditorSaved = true;
}
} else {
detailsEmpty = false;
Expand Down
6 changes: 4 additions & 2 deletions src/classes/simple-calendar.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -65,11 +65,13 @@ describe('Simple Calendar Class Tests', () => {
test('Default Options', () => {
const spy = jest.spyOn(Application, 'defaultOptions', 'get');
const opts = SimpleCalendar.defaultOptions;
expect(Object.keys(opts).length).toBe(4); //Make sure no new properties have been added
expect(Object.keys(opts).length).toBe(5); //Make sure no new properties have been added
expect(opts.template).toBe('modules/foundryvtt-simple-calendar/templates/calendar.html');
expect(opts.title).toBe('FSC.Title');
expect(opts.classes).toStrictEqual(["simple-calendar"]);
expect(opts.resizable).toBe(true);
//@ts-ignore
expect(opts.height).toBe(475);
expect(spy).toHaveBeenCalled()
});

Expand Down Expand Up @@ -813,7 +815,7 @@ describe('Simple Calendar Class Tests', () => {
case SettingNames.YearConfiguration:
return {numericRepresentation: 0, prefix: '', postfix: ''};
case SettingNames.MonthConfiguration:
return [[{numericRepresentation: 1, numberOfDays: 2, name: ''}]];
return [[{numericRepresentation: 1, numberOfDays: "asd", numberOfLeapYearDays: "asd", name: ''}]];
case SettingNames.WeekdayConfiguration:
return [[{numericRepresentation: 0, name: ''}]];
case SettingNames.CurrentDate:
Expand Down
11 changes: 10 additions & 1 deletion src/classes/simple-calendar.ts
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,7 @@ export default class SimpleCalendar extends Application{
options.title = "FSC.Title";
options.classes = ["simple-calendar"];
options.resizable = true;
options.height = 475;
return options;
}

Expand Down Expand Up @@ -639,7 +640,15 @@ export default class SimpleCalendar extends Application{
Logger.debug('Setting the months from data.');
for(let i = 0; i < monthData.length; i++){
if(Object.keys(monthData[i]).length){
const newMonth = new Month(monthData[i].name, monthData[i].numericRepresentation, monthData[i].numberOfDays, monthData[i].numberOfLeapYearDays);
let numDays = parseInt(monthData[i].numberOfDays.toString());
let numLeapDays = monthData[i].numberOfLeapYearDays === undefined? 0 : parseInt(monthData[i].numberOfLeapYearDays.toString());
if(isNaN(numDays)){
numDays = 1;
}
if(isNaN(numLeapDays)){
numLeapDays = 1;
}
const newMonth = new Month(monthData[i].name, monthData[i].numericRepresentation, numDays, numLeapDays);
newMonth.intercalary = monthData[i].intercalary;
newMonth.intercalaryInclude = monthData[i].intercalaryInclude;
this.currentYear.months.push(newMonth);
Expand Down
2 changes: 1 addition & 1 deletion src/classes/weekday.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ describe('Weekday Class Tests', () => {
expect(w.firstCharacter).toBe("");
expect(w.numericRepresentation).toBe(0);
expect(w2.name).toBe("asd");
expect(w2.firstCharacter).toBe("A");
expect(w2.firstCharacter).toBe("As");
expect(w2.numericRepresentation).toBe(1);

});
Expand Down
6 changes: 5 additions & 1 deletion src/classes/weekday.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,9 +30,13 @@ export class Weekday {
* @return {WeekdayTemplate}
*/
toTemplate(): WeekdayTemplate{
let abbrv = this.name.substring(0,1).toUpperCase();
if(this.name.length > 1){
abbrv += this.name.substring(1,2).toLowerCase();
}
return {
name: this.name,
firstCharacter: this.name.substring(0,1).toUpperCase(),
firstCharacter: abbrv,
numericRepresentation: this.numericRepresentation
};
}
Expand Down
4 changes: 2 additions & 2 deletions src/interfaces.ts
Original file line number Diff line number Diff line change
Expand Up @@ -364,8 +364,8 @@ export namespace CalendarWeatherImport{
*/
export interface Month {
name: string;
length: number;
leapLength: number;
length: number | string;
leapLength: number | string;
isNumbered: boolean;
abbrev: string;
}
Expand Down
2 changes: 1 addition & 1 deletion src/module.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"name": "foundryvtt-simple-calendar",
"title": "Simple Calendar",
"description": "A simple calendar module for keeping track of game days and events.",
"version": "1.2.0",
"version": "1.2.5",
"author": "Dean Vigoren (Vigorator)",
"minimumCoreVersion": "0.7.9",
"compatibleCoreVersion": "0.7.9",
Expand Down
7 changes: 7 additions & 0 deletions src/styles/configuration.scss
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,18 @@
line-height: 32px;
font-size: 16px;
border-bottom: 1px solid #782e22;
justify-content: space-between;
flex-wrap: nowrap;

.item{
border: 1px solid transparent;
border-top-left-radius: 5px;
border-top-right-radius: 5px;
font-size: 14px;
font-weight: 600;
line-height: 1.25rem;
padding: 0.5rem 0.25rem;
flex: 0 1 125px;
&.active{
border-top-color: #782e22;
border-left-color: #782e22;
Expand Down

0 comments on commit 2444bb7

Please sign in to comment.