From 4857b82a87a96aaaddea9c44ea629ae275d7abd0 Mon Sep 17 00:00:00 2001 From: Raphael LACOTE Date: Tue, 7 Mar 2023 09:25:10 +0100 Subject: [PATCH 1/5] =?UTF-8?q?Mise=20=C3=A0=20jour=20de=20'README.md'?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/README.md b/README.md index a4ab1f6..2a12e8b 100644 --- a/README.md +++ b/README.md @@ -1,2 +1,3 @@ # TP_JavaScript +HODIN Dorian / LACOTE RaphaĆ«l \ No newline at end of file From 91e54c0df4fafe7e6e310dd9a68eb83f17932c65 Mon Sep 17 00:00:00 2001 From: "dorian.hodin" Date: Thu, 9 Mar 2023 15:57:57 +0100 Subject: [PATCH 2/5] Merge Raphoubranche into dorian and merge dorian into master --- .idea/.gitignore | 3 +++ .idea/TP_JavaScript.iml | 9 +++++++++ .idea/misc.xml | 6 ++++++ .idea/modules.xml | 8 ++++++++ .idea/vcs.xml | 6 ++++++ 5 files changed, 32 insertions(+) create mode 100644 .idea/.gitignore create mode 100644 .idea/TP_JavaScript.iml create mode 100644 .idea/misc.xml create mode 100644 .idea/modules.xml create mode 100644 .idea/vcs.xml diff --git a/.idea/.gitignore b/.idea/.gitignore new file mode 100644 index 0000000..26d3352 --- /dev/null +++ b/.idea/.gitignore @@ -0,0 +1,3 @@ +# Default ignored files +/shelf/ +/workspace.xml diff --git a/.idea/TP_JavaScript.iml b/.idea/TP_JavaScript.iml new file mode 100644 index 0000000..d6ebd48 --- /dev/null +++ b/.idea/TP_JavaScript.iml @@ -0,0 +1,9 @@ + + + + + + + + + \ No newline at end of file diff --git a/.idea/misc.xml b/.idea/misc.xml new file mode 100644 index 0000000..639900d --- /dev/null +++ b/.idea/misc.xml @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/.idea/modules.xml b/.idea/modules.xml new file mode 100644 index 0000000..1e0f82e --- /dev/null +++ b/.idea/modules.xml @@ -0,0 +1,8 @@ + + + + + + + + \ No newline at end of file diff --git a/.idea/vcs.xml b/.idea/vcs.xml new file mode 100644 index 0000000..35eb1dd --- /dev/null +++ b/.idea/vcs.xml @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file From d95677ab57d0aabf248ad709d00d4a505c6e2283 Mon Sep 17 00:00:00 2001 From: Raphael LACOTE Date: Thu, 9 Mar 2023 20:00:52 +0100 Subject: [PATCH 3/5] Rectification d'un bug sur les liaisons et ajout de gestions d'erreurs sur la taille des strings --- index.html | 27 ++++++++++++++------------- src/error/string_size.js | 5 +++++ src/misc/constant.js | 4 +++- src/view/team_add.js | 17 +++++++++++------ 4 files changed, 33 insertions(+), 20 deletions(-) create mode 100644 src/error/string_size.js diff --git a/index.html b/index.html index f202fa7..6a36862 100644 --- a/index.html +++ b/index.html @@ -5,7 +5,7 @@ My awesome team - + @@ -16,39 +16,40 @@ + :id="team.id" + :name="team.name" + :description="team.description"> + diff --git a/src/error/string_size.js b/src/error/string_size.js new file mode 100644 index 0000000..96f207e --- /dev/null +++ b/src/error/string_size.js @@ -0,0 +1,5 @@ +class StringSize extends Error { + constructor(field,sSize) { + super('Le champ ' + field + ' doit avoir une taille superieur ą '+sSize); + } +} \ No newline at end of file diff --git a/src/misc/constant.js b/src/misc/constant.js index 322ba48..c1c9af9 100644 --- a/src/misc/constant.js +++ b/src/misc/constant.js @@ -1 +1,3 @@ -const ERROR_COLOR = 'red'; \ No newline at end of file +const ERROR_COLOR = 'red'; +const DESCRIPTION_MINIMAL_SIZE = 20; +const NAME_MINIMAL_SIZE = 5; \ No newline at end of file diff --git a/src/view/team_add.js b/src/view/team_add.js index 1ff54cd..f38e343 100644 --- a/src/view/team_add.js +++ b/src/view/team_add.js @@ -13,23 +13,25 @@ export default { try { this.errorMessage = ''; if (!this.id) { - this.name = ''; - this.description= ''; throw new RequiredFieldError("ID"); return; } if (!this.name) { - this.id = ''; - this.description= ''; throw new RequiredFieldError("Name"); return; } if (!this.description){ - this.id = ''; - this.name = ''; throw new RequiredFieldError("Description"); return; } + if (this.description.length < DESCRIPTION_MINIMAL_SIZE) { + throw new StringSize("Description", DESCRIPTION_MINIMAL_SIZE) + } + if (this.name.length < NAME_MINIMAL_SIZE) { + throw new StringSize("Name", NAME_MINIMAL_SIZE) + } + + console.log(this.description.length) const team = { id: this.id, name: this.name, description: this.description}; console.log('form.addTeam', team); @@ -43,6 +45,9 @@ export default { if (error instanceof RequiredFieldError) { this.errorMessage=error } + if (error instanceof StringSize) { + this.errorMessage = error + } return null; } } From 5021d71f4de449113ee90d73860e22474299326f Mon Sep 17 00:00:00 2001 From: Raphael LACOTE Date: Tue, 14 Mar 2023 21:48:34 +0100 Subject: [PATCH 4/5] Modification majeur des composants --- index.html | 32 +++++++++---------------- src/misc/constant.js | 4 ++-- src/view/navbar.js | 1 - src/view/{team_add.js => team-add.js} | 6 ++--- src/view/team.js | 34 +++++++++++++++++++++++++++ src/view/teamcard.js | 13 +++++++++- 6 files changed, 62 insertions(+), 28 deletions(-) rename src/view/{team_add.js => team-add.js} (94%) create mode 100644 src/view/team.js diff --git a/index.html b/index.html index 6a36862..a7ae2be 100644 --- a/index.html +++ b/index.html @@ -12,14 +12,15 @@
-
+ +
@@ -31,27 +32,16 @@ import { createApp } from 'https://unpkg.com/vue@3/dist/vue.esm-browser.js'; import Navbar from './src/view/navbar.js'; - import TeamAdd from './src/view/team_add.js'; - import Teamcard from './src/view/teamcard.js'; - - const app = createApp({ - data() { - return { - allTeam: [] - } - }, - methods: { - addTeam: function (team) { - console.log('index.addTeam', team); - this.allTeam.push(team); - } - } - }) + import Team from './src/view/team.js' + + const app = createApp(); + app.component('Navbar', Navbar) - .component('TeamAdd', TeamAdd) - .component('Teamcard', Teamcard); + .component('Team', Team) app.mount('#app'); - \ No newline at end of file + + + \ No newline at end of file diff --git a/src/misc/constant.js b/src/misc/constant.js index c1c9af9..fd5147e 100644 --- a/src/misc/constant.js +++ b/src/misc/constant.js @@ -1,3 +1,3 @@ const ERROR_COLOR = 'red'; -const DESCRIPTION_MINIMAL_SIZE = 20; -const NAME_MINIMAL_SIZE = 5; \ No newline at end of file +const DESCRIPTION_MINIMAL_SIZE = 1; +const NAME_MINIMAL_SIZE = 1; \ No newline at end of file diff --git a/src/view/navbar.js b/src/view/navbar.js index 8f9f476..26b1475 100644 --- a/src/view/navbar.js +++ b/src/view/navbar.js @@ -30,5 +30,4 @@ export default {
  • Results
  • ` - }; \ No newline at end of file diff --git a/src/view/team_add.js b/src/view/team-add.js similarity index 94% rename from src/view/team_add.js rename to src/view/team-add.js index f38e343..6e95c77 100644 --- a/src/view/team_add.js +++ b/src/view/team-add.js @@ -1,3 +1,5 @@ + + export default { data: function() { return { @@ -31,11 +33,10 @@ export default { throw new StringSize("Name", NAME_MINIMAL_SIZE) } - console.log(this.description.length) const team = { id: this.id, name: this.name, description: this.description}; console.log('form.addTeam', team); - this.$emit('addTeam', team); + this.$emit('teamAjoute', team); this.id = ''; this.name = ''; @@ -53,7 +54,6 @@ export default { } }, template: `
    -

    News form

    {{ errorMessage }}
    diff --git a/src/view/team.js b/src/view/team.js new file mode 100644 index 0000000..ac19ff1 --- /dev/null +++ b/src/view/team.js @@ -0,0 +1,34 @@ +import teamAdd from './team-add.js'; +import teamCard from './teamcard.js'; + + +export default { + data: function() { + return { + allTeam: [] + } + }, + methods: { + recupTeam: function (team) { + console.log('team.addTeam', team); + this.allTeam.push(team); + } + }, + components: { + teamCard, + teamAdd + }, + template: ` +
    +

    News form

    +
    + +
    + + +
    + ` +} diff --git a/src/view/teamcard.js b/src/view/teamcard.js index 28400e9..bd6031e 100644 --- a/src/view/teamcard.js +++ b/src/view/teamcard.js @@ -13,6 +13,16 @@ export default { require : true } }, + data: function () { + return { + isEdit: false + } + }, + methods: { + editTeam: function () { + this.isEdit = !this.isEdit; + } + }, computed: { description20(){ if (this.description.length > 20) { @@ -21,12 +31,13 @@ export default { return this.description; } } - }, + }, template: `
    ID of the Team : {{ id }}

    Name : {{ name }}

    Description : {{ description20 }}

    +
    ` } \ No newline at end of file From abacdcbbadc25e1a63c57b113441150651bd7794 Mon Sep 17 00:00:00 2001 From: Raphael LACOTE Date: Sat, 18 Mar 2023 19:50:35 +0100 Subject: [PATCH 5/5] =?UTF-8?q?Q8=20en=20l=C3=A9gende=20(Encore=20quelques?= =?UTF-8?q?=20am=C3=A9liorations=20n=C3=A9cessaires)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- index.html | 10 +--------- src/view/team-add.js | 18 ++++++++++++++---- src/view/team.js | 24 +++++++++++++++++++++--- src/view/teamcard.js | 5 ++++- 4 files changed, 40 insertions(+), 17 deletions(-) diff --git a/index.html b/index.html index a7ae2be..e24223b 100644 --- a/index.html +++ b/index.html @@ -13,14 +13,6 @@ -
    @@ -29,8 +21,8 @@