Skip to content
This repository was archived by the owner on May 15, 2021. It is now read-only.

Commit 1db5dc8

Browse files
committed
add new sorting method, Code of Conduct, refactoring
1 parent 3ae837c commit 1db5dc8

File tree

7 files changed

+114
-32
lines changed

7 files changed

+114
-32
lines changed

CODE_OF_CONDUCT.md

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
# Contributor Covenant Code of Conduct
2+
3+
## Our Pledge
4+
5+
In the interest of fostering an open and welcoming environment, we as contributors and maintainers pledge to making participation in our project and our community a harassment-free experience for everyone, regardless of age, body size, disability, ethnicity, gender identity and expression, level of experience, nationality, personal appearance, race, religion, or sexual identity and orientation.
6+
7+
## Our Standards
8+
9+
Examples of behavior that contributes to creating a positive environment include:
10+
11+
* Using welcoming and inclusive language
12+
* Being respectful of differing viewpoints and experiences
13+
* Gracefully accepting constructive criticism
14+
* Focusing on what is best for the community
15+
* Showing empathy towards other community members
16+
17+
Examples of unacceptable behavior by participants include:
18+
19+
* The use of sexualized language or imagery and unwelcome sexual attention or advances
20+
* Trolling, insulting/derogatory comments, and personal or political attacks
21+
* Public or private harassment
22+
* Publishing others' private information, such as a physical or electronic address, without explicit permission
23+
* Other conduct which could reasonably be considered inappropriate in a professional setting
24+
25+
## Our Responsibilities
26+
27+
Project maintainers are responsible for clarifying the standards of acceptable behavior and are expected to take appropriate and fair corrective action in response to any instances of unacceptable behavior.
28+
29+
Project maintainers have the right and responsibility to remove, edit, or reject comments, commits, code, wiki edits, issues, and other contributions that are not aligned to this Code of Conduct, or to ban temporarily or permanently any contributor for other behaviors that they deem inappropriate, threatening, offensive, or harmful.
30+
31+
## Scope
32+
33+
This Code of Conduct applies both within project spaces and in public spaces when an individual is representing the project or its community. Examples of representing a project or community include using an official project e-mail address, posting via an official social media account, or acting as an appointed representative at an online or offline event. Representation of a project may be further defined and clarified by project maintainers.
34+
35+
## Enforcement
36+
37+
Instances of abusive, harassing, or otherwise unacceptable behavior may be reported by contacting the project team at [email protected]. The project team will review and investigate all complaints, and will respond in a way that it deems appropriate to the circumstances. The project team is obligated to maintain confidentiality with regard to the reporter of an incident. Further details of specific enforcement policies may be posted separately.
38+
39+
Project maintainers who do not follow or enforce the Code of Conduct in good faith may face temporary or permanent repercussions as determined by other members of the project's leadership.
40+
41+
## Attribution
42+
43+
This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4, available at [http://contributor-covenant.org/version/1/4][version]
44+
45+
[homepage]: http://contributor-covenant.org
46+
[version]: http://contributor-covenant.org/version/1/4/

package.json

Lines changed: 14 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "dokdrop",
3-
"version": "0.1.0",
3+
"version": "0.1.1",
44
"author": "Julien Gelmar <[email protected]>",
55
"description": "Dokdrop",
66
"license": null,
@@ -20,6 +20,19 @@
2020
"publish": "electron-builder --x64 --win -p always"
2121
},
2222
"build": {
23+
"nsis": {
24+
"oneClick": true,
25+
"perMachine": true,
26+
"allowElevation": true,
27+
"allowToChangeInstallationDirectory": false,
28+
"deleteAppDataOnUninstall": true,
29+
"createDesktopShortcut": true,
30+
"installerIcon": "build/icons/icon.ico",
31+
"uninstallerIcon": "build/icons/icon.ico",
32+
"uninstallDisplayName": "Uninstall Dokdrop",
33+
"runAfterFinish": true
34+
},
35+
"buildVersion": "0.1.1",
2336
"productName": "dokdrop",
2437
"appId": "org.juliengelmar.dokdrop",
2538
"directories": {
@@ -54,9 +67,6 @@
5467
},
5568
"linux": {
5669
"icon": "build/icons/png"
57-
},
58-
"nsis": {
59-
"oneClick": true
6070
}
6171
},
6272
"dependencies": {

src/renderer/components/Fix.vue

Lines changed: 7 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
<label for="track">Track</label>
1212
<multiselect v-model="form.track" track-by="search" label="name" value="search" :options="tracks"></multiselect>
1313
</div>
14-
<div v-if="saving === 'season'" class="mt-2">
14+
<div v-if="saving.startsWith('season')" class="mt-2">
1515
<label for="season">Season</label>
1616
<multiselect v-model="form.season" track-by="search" label="name" value="search" :options="seasons"></multiselect>
1717
</div>
@@ -47,26 +47,22 @@
4747
this.notify('error', 'Please set a track.')
4848
return false
4949
}
50-
if (this.saving === 'season' && !this.form.season) {
50+
if (this.saving.startsWith('season') && !this.form.season) {
5151
this.notify('error', 'Please set a season.')
5252
return false
5353
}
5454
var newpath
55-
if (this.saving === 'season') {
55+
if (this.saving === 'season' || this.saving === 'seasonfirst') {
5656
newpath = this.createFolders(this.form.car.folder, this.form.track.search, this.form.season.search)
5757
} else if (this.saving === 'track') {
5858
newpath = this.createFolders(this.form.car.folder, this.form.track.search)
5959
} else {
6060
newpath = this.createFolders(this.form.car.folder)
6161
}
62-
console.log(newpath + this.filename)
63-
this.$fs.copy(this.path, newpath + this.filename).then(() => {
64-
this.notify('success', 'File successfully copied')
65-
this.$router.push('landing-page')
66-
}).catch(err => {
67-
console.log(err)
68-
this.notify('error', 'Some kind of error happened')
69-
})
62+
this.copySetup(
63+
this.path,
64+
newpath + this.filename
65+
)
7066
}
7167
},
7268
created () {

src/renderer/components/LandingPage.vue

Lines changed: 6 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
<div class="col-xs-4">
1818
<strong>Car</strong><br>
1919
{{ guess.car ? guess.car[1] : 'Not guessed' }}<br>
20-
<p class="mt-4" v-if="(saving === 'car' && guess.car) || (saving === 'track' && guess.car && guess.track) || (saving === 'season' && guess.car && guess.track && guess.season)">
20+
<p class="mt-4" v-if="(saving === 'car' && guess.car) || (saving === 'track' && guess.car && guess.track) || (saving.startsWith('season') && guess.car && guess.track && guess.season)">
2121
<a @click="copyFile" class="text-primary">Correct!</a> or <a @click="fix" class="text-primary">Wrong :(</a>
2222
</p>
2323
<p class="mt-4" v-else>
@@ -28,7 +28,7 @@
2828
<strong>Track</strong><br>
2929
{{ guess.track ? guess.track[1] : 'Not guessed' }}<br>
3030
</div>
31-
<div class="col-xs-4 mx-2" v-if="saving === 'season'">
31+
<div class="col-xs-4 mx-2" v-if="saving.startsWith('season')">
3232
<strong>Season</strong><br>
3333
{{ guess.season ? guess.season[1] : 'Not guessed'}}
3434
</div>
@@ -68,13 +68,10 @@
6868
},
6969
copyFile () {
7070
let season = (typeof this.guess.season === 'undefined') ? null : this.guess.season[1]
71-
var newpath = this.createFolders(this.guess.car[2], this.guess.track[0], season)
72-
this.$fs.copy(this.guess.path, newpath + this.guess.name).then(() => {
73-
this.notify('success', 'File successfully copied')
74-
}).catch(err => {
75-
console.log(err)
76-
this.notify('error', 'Some kind of error happened')
77-
})
71+
this.copySetup(
72+
this.guess.path,
73+
this.createFolders(this.guess.car[2], this.guess.track[0], season) + this.guess.name
74+
)
7875
},
7976
fix () {
8077
this.$router.push({path: 'fix', query: { filename: this.guess.name, path: this.guess.path }})

src/renderer/components/Settings.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
<h4 class="card-title">About</h4>
1212
<p class="card-body">
1313
Made by <a class="text-primary" @click="external('https://gelmar.app')">Julien Gelmar</a><br>
14-
Version 0.1
14+
Version 0.1.1
1515
</p>
1616
</div>
1717
</div>

src/renderer/components/partials/SettingCard.vue

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,9 @@
99
<div class="col-sm-12">
1010
<input type="radio" v-model="inputs.saving" value="season"> car\track\season\setup.sto
1111
</div>
12+
<div class="col-sm-12">
13+
<input type="radio" v-model="inputs.saving" value="seasonfirst"> car\season\track\setup.sto
14+
</div>
1215
<div class="col-sm-12">
1316
<input type="radio" v-model="inputs.saving" value="track"> car\track\setup.sto
1417
</div>

src/renderer/mixins.js

Lines changed: 37 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -8,22 +8,52 @@ Vue.mixin({
88
text: msg
99
})
1010
},
11-
createFolders (car, track, season) {
11+
createCarFolder (car) {
1212
let folder = localStorage.getItem('folder') + '\\' + car
1313
if (!this.$fs.existsSync(folder)) {
1414
this.$fs.mkdirSync(folder)
1515
}
16+
return folder
17+
},
18+
createTrackFolder (folder, track) {
19+
if (!this.$fs.existsSync(folder + '\\' + track)) {
20+
this.$fs.mkdirSync(folder + '\\' + track)
21+
}
22+
return folder + '\\' + track
23+
},
24+
createSeasonFolder (folder, season) {
25+
if (!this.$fs.existsSync(folder + '\\' + season)) {
26+
this.$fs.mkdirSync(folder + '\\' + season)
27+
}
28+
return folder + '\\' + season
29+
},
30+
createFolders (car, track, season) {
31+
var folder = this.createCarFolder(car)
1632
if (localStorage.getItem('saving') === 'car') {
1733
return folder + '\\'
1834
}
19-
if (!this.$fs.existsSync(folder + '\\' + track)) {
20-
this.$fs.mkdirSync(folder + '\\' + track)
35+
if (localStorage.getItem('saving') === 'seasonfirst') {
36+
folder = this.createSeasonFolder(folder, season)
37+
return this.createTrackFolder(folder, track) + '\\'
38+
}
39+
folder = this.createTrackFolder(folder, track)
40+
if (localStorage.getItem('saving') === 'season') {
41+
return this.createSeasonFolder(folder, season) + '\\'
2142
}
22-
if (localStorage.getItem('saving') === 'season' && !this.$fs.existsSync(folder + '\\' + track)) {
23-
this.$fs.mkdirSync(folder + '\\' + track + '\\' + season)
24-
return folder + '\\' + track + '\\' + season + '\\'
43+
return folder + '\\'
44+
},
45+
copySetup (path, newpath) {
46+
if (this.$fs.existsSync(newpath)) {
47+
this.notify('error', 'File already exists.')
48+
} else {
49+
this.$fs.copy(path, newpath).then(() => {
50+
this.notify('success', 'File successfully copied')
51+
this.$modal.hide('guess')
52+
}).catch(err => {
53+
console.log(err)
54+
this.notify('error', 'Some kind of error happened')
55+
})
2556
}
26-
return folder + '\\' + track + '\\'
2757
}
2858
}
2959
})

0 commit comments

Comments
 (0)