Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
R
RoleGame
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
1
Issues
1
List
Boards
Labels
Service Desk
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Incidents
Environments
Packages & Registries
Packages & Registries
Container Registry
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Martin Lehoux
RoleGame
Commits
9824f39c
Commit
9824f39c
authored
Mar 25, 2019
by
Martin Lehoux
Browse files
Options
Browse Files
Download
Plain Diff
merge
parents
2033262a
f9110d24
Changes
15
Hide whitespace changes
Inline
Side-by-side
Showing
15 changed files
with
120 additions
and
37 deletions
+120
-37
back/index.js
back/index.js
+1
-1
back/routes/characters.js
back/routes/characters.js
+6
-1
back/views/character_summary.pug
back/views/character_summary.pug
+0
-32
front/public/img/avatars/boris_by_charro_art_d8eta2f-pre.jpg
front/public/img/avatars/boris_by_charro_art_d8eta2f-pre.jpg
+0
-0
front/public/img/avatars/drake_by_charro_art_d8eta33-pre.jpg
front/public/img/avatars/drake_by_charro_art_d8eta33-pre.jpg
+0
-0
front/public/img/avatars/fazzlemare_by_charro_art_d8etbfa-pre.jpg
...blic/img/avatars/fazzlemare_by_charro_art_d8etbfa-pre.jpg
+0
-0
front/public/img/avatars/mortimer_by_charro_art_d8eta4a-pre.jpg
...public/img/avatars/mortimer_by_charro_art_d8eta4a-pre.jpg
+0
-0
front/public/img/avatars/scarlet_by_charro_art_d8eta4q-pre.jpg
.../public/img/avatars/scarlet_by_charro_art_d8eta4q-pre.jpg
+0
-0
front/public/img/avatars/tobias_by_charro_art_d8eta17-pre.jpg
...t/public/img/avatars/tobias_by_charro_art_d8eta17-pre.jpg
+0
-0
front/public/img/avatars/warren_by_charro_art_d8eta25-pre.jpg
...t/public/img/avatars/warren_by_charro_art_d8eta25-pre.jpg
+0
-0
front/public/index.html
front/public/index.html
+1
-1
front/src/components/CharacterItem.vue
front/src/components/CharacterItem.vue
+24
-0
front/src/router.js
front/src/router.js
+6
-0
front/src/views/Characters.vue
front/src/views/Characters.vue
+81
-0
front/src/views/Home.vue
front/src/views/Home.vue
+1
-2
No files found.
back/index.js
View file @
9824f39c
...
...
@@ -30,7 +30,7 @@ app.use(loginChecker);
// Routes
app
.
use
(
'
/users
'
,
usersRouter
);
//
app.use('/characters', charactersRouter);
app
.
use
(
'
/characters
'
,
charactersRouter
);
mongoose
.
connect
(
'
mongodb://localhost/rolegame
'
,
err
=>
{
if
(
err
)
{
...
...
back/routes/characters.js
View file @
9824f39c
...
...
@@ -8,9 +8,14 @@ const router = express.Router();
const
getScore
=
(
data
)
=>
Object
.
keys
(
data
).
reduce
((
total
,
el
)
=>
total
+
costTable
[
data
[
el
]],
0
);
router
.
get
(
'
/avatars
'
,
(
req
,
res
)
=>
{
const
avatars
=
fs
.
readdirSync
(
'
../front/public/img/avatars
'
);
res
.
json
({
avatars
});
})
router
.
get
(
'
/
'
,
async
(
req
,
res
)
=>
{
// TODO: Login required
const
avatars
=
fs
.
readdirSync
(
'
media/avatars
'
);
Character
.
find
({
user
:
req
.
session
.
user
.
_id
},
(
err
,
characters
)
=>
{
if
(
err
)
return
res
.
status
(
400
).
json
({
error
:
err
});
return
res
.
json
(
characters
);
...
...
back/views/character_summary.pug
deleted
100644 → 0
View file @
2033262a
.ui.card.fluid
.content
img.right.floated.mini.image.ui(src="/media/avatars/"+character.avatar, alt="Avatar")
.header= character.name
.meta
.date Created on #{character.birthDate.toDateString()}
.ui.tiny.progress.yellow.progress(id="action-points-bar-"+character._id)
.bar
.label
span(id="action-points-value-"+character._id)= character.actionPoints
| action points
//- .content
//- .ui.label(class=character.attributes.strength<=8 ? "orange" : character.attributes.strength>=12 ? "green" : "" )
//- | Strength
//- .detail= character.attributes.strength
//- .ui.label(class=character.attributes.constitution<=8 ? "orange" : character.attributes.constitution>=12 ? "green" : "" )
//- | Constitution
//- .detail= character.attributes.constitution
//- .ui.label(class=character.attributes.dexterity<=8 ? "orange" : character.attributes.dexterity>=12 ? "green" : "" )
//- | Dexterity
//- .detail= character.attributes.dexterity
//- .ui.label(class=character.attributes.intelligence<=8 ? "orange" : character.attributes.intelligence>=12 ? "green" : "" )
//- | Intelligence
//- .detail= character.attributes.intelligence
//- .ui.label(class=character.attributes.wisdom<=8 ? "orange" : character.attributes.wisdom>=12 ? "green" : "" )
//- | Wisdom
//- .detail= character.attributes.wisdom
//- .ui.label(class=character.attributes.charisma<=8 ? "orange" : character.attributes.charisma>=12 ? "green" : "" )
//- | Charisma
//- .detail= character.attributes.charisma
script $('#action-points-bar-#{character._id}').progress({ total: #{maxActionPoints}, value: #{character.actionPoints}});
script updateActionPoints('#{character._id}', #{character.actionPoints}, #{maxActionPoints});
back/media
/avatars/boris_by_charro_art_d8eta2f-pre.jpg
→
front/public/img
/avatars/boris_by_charro_art_d8eta2f-pre.jpg
View file @
9824f39c
File moved
back/media
/avatars/drake_by_charro_art_d8eta33-pre.jpg
→
front/public/img
/avatars/drake_by_charro_art_d8eta33-pre.jpg
View file @
9824f39c
File moved
back/media
/avatars/fazzlemare_by_charro_art_d8etbfa-pre.jpg
→
front/public/img
/avatars/fazzlemare_by_charro_art_d8etbfa-pre.jpg
View file @
9824f39c
File moved
back/media
/avatars/mortimer_by_charro_art_d8eta4a-pre.jpg
→
front/public/img
/avatars/mortimer_by_charro_art_d8eta4a-pre.jpg
View file @
9824f39c
File moved
back/media
/avatars/scarlet_by_charro_art_d8eta4q-pre.jpg
→
front/public/img
/avatars/scarlet_by_charro_art_d8eta4q-pre.jpg
View file @
9824f39c
File moved
back/media
/avatars/tobias_by_charro_art_d8eta17-pre.jpg
→
front/public/img
/avatars/tobias_by_charro_art_d8eta17-pre.jpg
View file @
9824f39c
File moved
back/media
/avatars/warren_by_charro_art_d8eta25-pre.jpg
→
front/public/img
/avatars/warren_by_charro_art_d8eta25-pre.jpg
View file @
9824f39c
File moved
front/public/index.html
View file @
9824f39c
...
...
@@ -5,7 +5,7 @@
<meta
http-equiv=
"X-UA-Compatible"
content=
"IE=edge"
>
<meta
name=
"viewport"
content=
"width=device-width,initial-scale=1.0"
>
<link
rel=
"icon"
href=
"<%= BASE_URL %>favicon.ico"
>
<link
rel=
"stylesheet"
href=
"//cdnjs.cloudflare.com/ajax/libs/semantic-ui/2.3.0/semantic.min.css"
>
<link
rel=
"stylesheet"
href=
"
https:
//cdnjs.cloudflare.com/ajax/libs/semantic-ui/2.3.0/semantic.min.css"
>
<title>
front
</title>
</head>
<body>
...
...
front/src/components/CharacterItem.vue
0 → 100644
View file @
9824f39c
<
template
lang=
"pug"
>
sui-card(class="fluid")
sui-card-content
sui-image(floated="right", size="mini", :src="`avatars/${character.avatar}`")
sui-card-header
{{
character
.
name
}}
sui-card-meta Created on
{{
character
.
birthDate
}}
sui-progress(size="tiny", color="yellow", :label="`${character.actionPoints} action points`", :percent="character.actionPoints/480*100")
</
template
>
<
script
>
export
default
{
name
:
"
CharacterItem
"
,
props
:
[
'
character
'
],
data
()
{
return
{
}
}
// TODO: Update action points
}
</
script
>
<
style
scoped
>
</
style
>
front/src/router.js
View file @
9824f39c
import
Vue
from
"
vue
"
;
import
Router
from
"
vue-router
"
;
import
Home
from
"
./views/Home.vue
"
;
import
Characters
from
"
./views/Characters.vue
"
;
Vue
.
use
(
Router
);
...
...
@@ -12,6 +13,11 @@ export default new Router({
path
:
"
/
"
,
name
:
"
home
"
,
component
:
Home
},
{
path
:
"
/characters
"
,
name
:
"
characters
"
,
component
:
Characters
}
]
});
front/src/views/Characters.vue
0 → 100644
View file @
9824f39c
<
template
lang=
"pug"
>
div
sui-card-group
CharacterItem(v-for="character in characters", :key="character._id", :character="character")
sui-container(text-align="center")
sui-button(color="teal", basic, icon="add", @click="creationModal=true") Create character
sui-modal(v-model="creationModal")
sui-modal-header Create a new character
sui-modal-content(image)
sui-image(size="medium", :src="`avatars/${newCharacter.avatar}`")
sui-modal-description
sui-form(@submit.prevent="")
sui-header Details
sui-form-fields
sui-form-field
sui-input(type="text", v-model="newCharacter.name", placeholder="name")
sui-form-field
sui-dropdown(placeholder="Avatar", selection, :options="avatars", v-model="newCharacter.avatar")
sui-header Attributes:
{{
availablePoints
}}
points remaning
sui-grid
sui-grid-column(:width="8", v-for="attribute in attributes" :key="attribute")
sui-segment
sui-statistic(horizontal)
sui-statistic-value
{{
newCharacter
.
attributes
[
attribute
]
}}
sui-statistic-label
{{
attribute
}}
sui-button(color="orange", circular, floated="left", icon="minus")
sui-button(color="teal", circular, floated="right", icon="add")
sui-progress(attached, bottom, :percent="newCharacter.attributes[attribute]/20*100")
sui-modal-actions
sui-button(color="orange", basic, icon="close", @click="creationModal=false") Cancel
sui-button(color="grey", basic, icon="redo", @click="resetCharacter") Reset
sui-button(color="teal", basic, icon="check") Create
</
template
>
<
script
>
import
http
from
"
@/http
"
;
import
CharacterItem
from
"
@/components/CharacterItem.vue
"
;
export
default
{
name
:
"
Characters
"
,
components
:
{
CharacterItem
},
data
()
{
return
{
characters
:
[{
_id
:
"
13F3V34GBB
"
,
avatar
:
"
boris_by_charro_art_d8eta2f-pre.jpg
"
,
name
:
"
Kagamino
"
,
birthDate
:
"
01-01-1998
"
,
actionPoints
:
400
}],
creationModal
:
false
,
newCharacter
:
{
attributes
:
{
}
},
avatars
:
[],
attributes
:
[
'
strength
'
,
'
constitution
'
,
'
dexterity
'
,
'
intelligence
'
,
'
wisdom
'
,
'
charisma
'
],
availablePoints
:
15
}
},
created
()
{
this
.
attributes
.
forEach
(
attribute
=>
{
this
.
newCharacter
.
attributes
[
attribute
]
=
10
});
http
()
.
get
(
'
http://localhost:3000/characters/avatars
'
)
.
then
(
res
=>
this
.
avatars
=
res
.
data
.
avatars
.
map
(
avatar
=>
({
text
:
avatar
,
value
:
avatar
})))
},
methods
:
{
resetCharacter
()
{
this
.
characters
=
{
attributes
:
{
}
};
this
.
attributes
.
forEach
(
attribute
=>
{
this
.
newCharacter
.
attributes
[
attribute
]
=
10
});
}
}
}
</
script
>
<
style
scoped
>
</
style
>
front/src/views/Home.vue
View file @
9824f39c
<
template
lang=
"pug"
>
.home
sui-image(src="img/wallpaper.jpg")
sui-image(src="img/wallpaper.jpg")
</
template
>
<
script
>
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment