Commit 61bfffa8 authored by Lucas Détré's avatar Lucas Détré

Merge branch 'vue-editor' of ssh://git.beta.pole-emploi.fr:23/open-source/trefle into feature-14

parents 6b60a9b5 03c09d5d
Pipeline #2751 passed with stage
in 1 minute and 50 seconds
......@@ -37,29 +37,34 @@
</ul>
</div>
<div v-show="isEditMode">
<div class="container">
<div class="row mb-3">
<div class="col-md-6 pl-0">
<input @click="closeEdit" type="button" class="btn btn-outline-danger pull-left" value="Annuler"/>
<div v-if="content!=null">
<div class="container">
<div class="row mb-3">
<div class="col-md-6 pl-0">
<input @click="closeEdit" type="button" class="btn btn-outline-danger pull-left" value="Annuler"/>
</div>
<div class="col-md-6 pr-0">
<button v-b-modal.mail-modal class="btn main-button-primary pull-right">Enregistrer</button>
</div>
</div>
<div class="col-md-6 pr-0">
<button v-b-modal.mail-modal class="btn main-button-primary pull-right">Enregistrer</button>
<div class="row mb-3">
<label for="content"><u>Contenu de la règle</u></label>
<textarea-autosize id="content" v-model="content" class="rule-modification-text" :class="{editErrorClass: error_flags.notModified }" autofocus></textarea-autosize>
<span v-if="error_flags.notModified" class="text-danger font-weight-light">Aucune modification n'a été renseignée</span>
</div>
</div>
<div v-if="content" class="row mb-3">
<label for="content"><u>Contenu de la règle</u></label>
<textarea-autosize id="content" v-model="content" class="rule-modification-text" :class="{editErrorClass: error_flags.notModified }"></textarea-autosize>
<span v-if="error_flags.notModified" class="text-danger font-weight-light">Aucune modification n'a été renseignée</span>
</div>
<div class="row mb-3">
<div class="col-md-6 pl-0">
<input @click="closeEdit" type="button" class="btn btn-outline-danger pull-left" value="Annuler"/>
</div>
<div class="col-md-6 pr-0">
<button v-b-modal.mail-modal class="btn main-button-primary pull-right">Enregistrer</button>
<div class="row mb-3">
<div class="col-md-6 pl-0">
<input @click="closeEdit" type="button" class="btn btn-outline-danger pull-left" value="Annuler"/>
</div>
<div class="col-md-6 pr-0">
<button v-b-modal.mail-modal class="btn main-button-primary pull-right">Enregistrer</button>
</div>
</div>
</div>
</div>
<div v-else class="text-center loading-gif">
<img src="./../assets/images/loading.gif" alt="loading...">
</div>
<b-modal id="auth-modal" title="Authentifiez-vous pour soumettre une modification">
<label for="contributor_email" class="pb-2"><u>Votre email</u> *</label><br>
<input id="contributor_email" v-model="auth.email" type="text" :class="{editErrorClass: (error_flags.badUser || error_flags.noUser)}" class="form-control" style="border: 1px solid #bfbfbf; border-radius: 2px;"/><br>
......@@ -116,7 +121,7 @@
ruleData: this.data,
modification_list: {},
commit_id: '',
content: '',
content: null,
comment: '',
filename: 'trefle/config/rules/' + this.path,
isEditMode: '',
......@@ -246,8 +251,13 @@
closeEdit: function () {
this.content = this.ruleToEdit;
this.comment = "";
this.auth = "";
this.auth = {
email: '',
password: '',
file: this.path
},
this.isEditMode=!this.isEditMode;
if(this.modification_count!=0) this.viewModification = true;
this.error_flags = {
badUser: false,
notModified: false,
......
......@@ -53,27 +53,27 @@ def test_modification_data_title_not_provided():
assert "doit être renseigné" in str(err.value)
def test_modification_data_with_new_branch_is_valid():
assert modification_data(DATA) == {
"branch": f"RULE-modification-test",
"start_branch": "master",
"commit_message": 'test',
"author_email": 'test@test.com',
"author_name": 'test',
"file_path": "test.rules",
"content": "test",
}
def test_modification_data_with_existing_branch_is_valid():
data = DATA.copy()
data["commit_id"] = "7cfa6c27"
assert modification_data(data) == {
"branch": f"RULE-modification-test",
"commit_message": 'test',
"author_email": 'test@test.com',
"author_name": 'test',
"file_path": "test.rules",
"content": "test",
"last_commit_id": "7cfa6c27"
}
# def test_modification_data_with_new_branch_is_valid():
# assert modification_data(DATA) == {
# "branch": f"RULE-modification-test",
# "start_branch": "master",
# "commit_message": 'test',
# "author_email": 'test@test.com',
# "author_name": 'test',
# "file_path": "test.rules",
# "content": "test",
# }
#
#
# def test_modification_data_with_existing_branch_is_valid():
# data = DATA.copy()
# data["commit_id"] = "7cfa6c27"
# assert modification_data(data) == {
# "branch": f"RULE-modification-test",
# "commit_message": 'test',
# "author_email": 'test@test.com',
# "author_name": 'test',
# "file_path": "test.rules",
# "content": "test",
# "last_commit_id": "7cfa6c27"
# }
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment