Skip to content

Commit d02c2e6

Browse files
committed
Improved no global git configs message
Now app notifications can be closed
1 parent f82967c commit d02c2e6

File tree

5 files changed

+38
-2
lines changed

5 files changed

+38
-2
lines changed

app/frontend/global/notification.js

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ class GPNotification {
2121
this.showLoad = opts.showLoad;
2222
this.notificationElement = null;
2323
this.autoclose = opts.autoclose;
24+
this.closable = opts.closable;
2425
}
2526

2627
pop() {
@@ -56,6 +57,19 @@ class GPNotification {
5657
}
5758

5859
this.notificationElement.innerHTML += `<section class="content">${bodyText || titleText}</section>`;
60+
61+
if (this.closable) {
62+
let closeBtn = document.createElement('button');
63+
64+
closeBtn.className = 'close-button';
65+
closeBtn.title = MSGS['Close'];
66+
closeBtn.innerHTML = '<span class="octicon octicon-x"></span>';
67+
closeBtn.onclick = function () {
68+
this.close();
69+
}.bind(this);
70+
71+
this.notificationElement.appendChild(closeBtn);
72+
}
5973

6074
container.appendChild(this.notificationElement);
6175

app/frontend/modules/settings-page.js

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
'use strict';
2+
13
(function () {
24

35
angular.module('settings', []).directive('settingsPage', function () {
@@ -36,9 +38,9 @@
3638

3739
this.getGlobalGitConfigs = function () {
3840
GIT.getGlobalConfigs(function (err, configs) {
39-
41+
4042
if (err) {
41-
alert(err.message);
43+
new GPNotification(MSGS['It seems that a git username and email are not set globally. You can fix this accessing the Settings menu'], { closable: true }).pop();
4244
} else {
4345
this.globalGitConfigs = configs;
4446
}

language/en.json

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -98,6 +98,8 @@
9898
"It happends with me all the time too. But lets's try find your project again!": "It happends with me all the time too. But let's try find your project again!",
9999
"Start adding, clonning or creating some awesome things": "Start adding, clonning or creating some awesome things",
100100
"Nothing for me here.\n The folder {folder} is not a git project": "Nothing for me here.\n The folder {folder} is not a git project",
101+
"Close": "Close",
102+
"It seems that a git username and email are not set globally. You can fix this accessing the Settings menu": "It seems that a git username and email are not set globally. You can fix this accessing the Settings menu",
101103

102104
"Error counting commits. Error: ": "Error counting commits. Error: ",
103105
"Error adding files. Error:": "Error adding files. Error:",

language/pt-BR.json

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -98,6 +98,8 @@
9898
"It happends with me all the time too. But lets's try find your project again!": "Isso acontece comigo o tempo todo. Mas vamos tentar achar o seu projeto de novo!",
9999
"Start adding, clonning or creating some awesome things": "Comece adicionando, clonando ou criando coisas incríveis",
100100
"Nothing for me here.\n The folder {folder} is not a git project": "Nada pra mim aqui.\n A pasta {folder} não é um projeto git",
101+
"Close": "Fechar",
102+
"It seems that a git username and email are not set globally. You can fix this accessing the Settings menu": "Parece que um usuário e email git não estão definidos globalmente. Você pode corrigir isso acessando o menu de Configurações",
101103

102104
"Error counting commits. Error: ": "Erro contando commits. Erro: ",
103105
"Error adding files. Error:": "Erro adicionando arquivos. Erro:",

resources/sass/all.scss

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -579,6 +579,22 @@ body {
579579
.content {
580580
flex: 1 1 auto;
581581
}
582+
583+
.close-button {
584+
padding: 0;
585+
padding-left: 20px;
586+
padding-right: 10px;
587+
color: #FFF;
588+
background-color: #404040;
589+
border: 0;
590+
box-shadow: none;
591+
cursor: pointer;
592+
transition: color ease 0.2s;
593+
594+
&:hover {
595+
color: rgba(255, 255, 255, 0.7);
596+
}
597+
}
582598
}
583599

584600
/* Header of the application */

0 commit comments

Comments
 (0)