Skip to content

Commit efb528f

Browse files
committed
Better commit workflow
After click on the COMMIT button the entire commit form is blocked instead just the button
1 parent 6d4d562 commit efb528f

File tree

5 files changed

+20
-6
lines changed

5 files changed

+20
-6
lines changed

app/frontend/modules/content.js

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -266,24 +266,27 @@
266266
if (commitMessage) {
267267
let selectedFiles = [];
268268

269-
event.target.setAttribute('disabled', true);
269+
event.target.parentNode.setAttribute('disabled', true);
270270

271271
this.commitChanges.forEach(function (file) {
272272
if (file.checked) {
273273
selectedFiles.push(file.path);
274274
}
275275
});
276276

277+
this.isCreatingCommit = true;
278+
277279
if (selectedFiles.length > 0) {
278280

279281
GIT.add(selectedRepository.path, {
280282
files: selectedFiles,
281283
callback: function (error) {
282284

283285
if (error) {
284-
alert(`${MSGS['Error adding files. Error:']} ${error.message}`);
286+
event.target.parentNode.removeAttribute('disabled');
287+
this.isCreatingCommit = false;
285288

286-
event.target.removeAttribute('disabled');
289+
alert(`${MSGS['Error adding files. Error:']} ${error.message}`);
287290
} else {
288291

289292
GIT.commit(selectedRepository.path, {
@@ -299,15 +302,17 @@
299302
this.setCommitDescription(null);
300303
}
301304

302-
event.target.removeAttribute('disabled');
305+
event.target.parentNode.removeAttribute('disabled');
306+
this.isCreatingCommit = false;
303307
}.bind(this)
304308
});
305309

306310
}
307311
}.bind(this)
308312
});
309313
} else {
310-
event.target.removeAttribute('disabled');
314+
event.target.parentNode.removeAttribute('disabled');
315+
this.isCreatingCommit = false;
311316
}
312317
}
313318
};

app/frontend/view/content/pieContent.html

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,9 @@ <h3><span class="octicon octicon-diff"></span> {{ MSGS["Commit changes"] }}</h3>
8080
<textarea ng-model="commitDescription"
8181
placeholder="{{ MSGS['Give a description to the commit. Tell more about your changes...'] }}"></textarea>
8282
</div>
83-
<button type="button" class="featured" ng-click="appCtrl.commitSelectedChanges(commitMessage, commitDescription, $event)"><span class="octicon octicon-cloud-upload"></span> {{ MSGS.COMMIT }}</button>
83+
<button type="button" class="featured" ng-click="appCtrl.commitSelectedChanges(commitMessage, commitDescription, $event)">
84+
<span class="octicon octicon-cloud-upload"></span> {{ appCtrl.isCreatingCommit ? MSGS["CREATING COMMIT..."] : MSGS.COMMIT }}
85+
</button>
8486
</form>
8587

8688
<nav ng-scroll="appCtrl.loadMoreCommits($event)" ng-hide="appCtrl.showNoMatchFilterMessage">

language/en.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818
"Add local git projects to GitPie": "Add local git projects to GitPie",
1919
"Search repositories": "Search repositories",
2020
"COMMIT": "COMMIT",
21+
"CREATING COMMIT...": "CREATING COMMIT...",
2122
"Clone URL": "Clone URL",
2223
"cloned": "cloned",
2324
"with success": "with success",

language/pt-BR.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818
"Add local git projects to GitPie": "Adicionar projetos git locais ao GitPie",
1919
"Search repositories": "Procurar repositórios",
2020
"COMMIT": "COMMIT",
21+
"CREATING COMMIT...": "CRIANDO COMMIT...",
2122
"Clone URL": "URL de clone",
2223
"cloned": "clonado",
2324
"with success": "com sucesso",

resources/sass/all.scss

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -116,6 +116,11 @@
116116
opacity: 0.6 !important;
117117
}
118118

119+
[disabled] {
120+
opacity: 0.6 !important;
121+
pointer-events: none;
122+
}
123+
119124
input[type="button"] {
120125
@extend button;
121126
}

0 commit comments

Comments
 (0)