add links to the documentation, confirmation of bot removal
This commit is contained in:
parent
0a27d33a31
commit
b75c725b3e
1
go.mod
1
go.mod
@ -33,7 +33,6 @@ require (
|
||||
github.com/json-iterator/go v0.0.0-20180806060727-1624edc4454b // indirect
|
||||
github.com/jtolds/gls v4.2.1+incompatible // indirect
|
||||
github.com/kr/pretty v0.1.0 // indirect
|
||||
github.com/kr/pty v1.1.2 // indirect
|
||||
github.com/lib/pq v1.0.0 // indirect
|
||||
github.com/mattn/go-isatty v0.0.3 // indirect
|
||||
github.com/mattn/go-sqlite3 v1.9.0 // indirect
|
||||
|
4
go.sum
4
go.sum
@ -69,7 +69,6 @@ github.com/jtolds/gls v4.2.1+incompatible/go.mod h1:QJZ7F/aHp+rZTRtaJ1ow/lLfFfVY
|
||||
github.com/kr/pretty v0.1.0 h1:L/CwN0zerZDmRFUapSPitk6f+Q3+0za1rQkzVuMiMFI=
|
||||
github.com/kr/pretty v0.1.0/go.mod h1:dAy3ld7l9f0ibDNOQOHHMYYIIbhfbHSm3C4ZsoJORNo=
|
||||
github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ=
|
||||
github.com/kr/pty v1.1.2/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ=
|
||||
github.com/kr/text v0.1.0 h1:45sCR5RtlFHMR4UwH9sdQ5TC8v0qDQCHnXt+kaKSTVE=
|
||||
github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI=
|
||||
github.com/lib/pq v1.0.0 h1:X5PMW56eZitiTeO7tKzZxFCSpbFZJtkMMooicw2us9A=
|
||||
@ -114,8 +113,7 @@ golang.org/x/net v0.0.0-20180821023952-922f4815f713 h1:rMJUcaDGbG+X967I4zGKCq5la
|
||||
golang.org/x/net v0.0.0-20180821023952-922f4815f713/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
|
||||
golang.org/x/sync v0.0.0-20180314180146-1d60e4601c6f h1:wMNYb4v58l5UBM7MYRLPG6ZhfOqbKu7X5eyFl8ZhKvA=
|
||||
golang.org/x/sync v0.0.0-20180314180146-1d60e4601c6f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
|
||||
golang.org/x/sys v0.0.0-20180821140842-3b58ed4ad339 h1:0w2EXzxbB03VAzqwe3csbadu4CPhMRtxCz/rjw9gkic=
|
||||
golang.org/x/sys v0.0.0-20180821140842-3b58ed4ad339/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
|
||||
golang.org/x/sys v0.0.0-20180823144017-11551d06cbcc h1:MeuS1UDyZyFH++6vVy44PuufTeFF0d0nfI6XB87YGSk=
|
||||
golang.org/x/sys v0.0.0-20180823144017-11551d06cbcc/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
|
||||
golang.org/x/text v0.0.0-20171214130843-f21a4dfb5e38/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
|
||||
golang.org/x/text v0.3.0 h1:g61tztE5qeGQ89tm6NTjjM9VPIm088od1l6aSorWRWg=
|
||||
|
@ -1,6 +1,7 @@
|
||||
package main
|
||||
|
||||
import (
|
||||
"html/template"
|
||||
"io/ioutil"
|
||||
|
||||
"github.com/nicksnyder/go-i18n/v2/i18n"
|
||||
@ -40,8 +41,8 @@ func getLocalizedMessage(messageID string) string {
|
||||
return localizer.MustLocalize(&i18n.LocalizeConfig{MessageID: messageID})
|
||||
}
|
||||
|
||||
func getLocale() map[string]string {
|
||||
return map[string]string{
|
||||
func getLocale() map[string]interface{} {
|
||||
return map[string]interface{}{
|
||||
"ButtonSave": getLocalizedMessage("button_save"),
|
||||
"ApiKey": getLocalizedMessage("api_key"),
|
||||
"TabSettings": getLocalizedMessage("tab_settings"),
|
||||
@ -51,5 +52,8 @@ func getLocale() map[string]string {
|
||||
"AddBot": getLocalizedMessage("add_bot"),
|
||||
"TableDelete": getLocalizedMessage("table_delete"),
|
||||
"Title": getLocalizedMessage("title"),
|
||||
"InfoBot": template.HTML(getLocalizedMessage("info_bot")),
|
||||
"CRMLink": template.HTML(getLocalizedMessage("crm_link")),
|
||||
"DocLink": template.HTML(getLocalizedMessage("doc_link")),
|
||||
}
|
||||
}
|
||||
|
@ -15,10 +15,12 @@ import (
|
||||
func connectHandler(c *gin.Context) {
|
||||
res := struct {
|
||||
Conn Connection
|
||||
Locale map[string]string
|
||||
Locale map[string]interface{}
|
||||
Year int
|
||||
}{
|
||||
c.MustGet("account").(Connection),
|
||||
getLocale(),
|
||||
time.Now().Year(),
|
||||
}
|
||||
|
||||
c.HTML(http.StatusOK, "home", &res)
|
||||
@ -133,11 +135,13 @@ func settingsHandler(c *gin.Context) {
|
||||
res := struct {
|
||||
Conn *Connection
|
||||
Bots Bots
|
||||
Locale map[string]string
|
||||
Locale map[string]interface{}
|
||||
Year int
|
||||
}{
|
||||
p,
|
||||
bots,
|
||||
getLocale(),
|
||||
time.Now().Year(),
|
||||
}
|
||||
|
||||
c.HTML(http.StatusOK, "form", &res)
|
||||
|
@ -44,7 +44,22 @@ $("#add-bot").on("submit", function(e) {
|
||||
});
|
||||
|
||||
$(document).on("click", ".delete-bot", function(e) {
|
||||
let but = $(this);
|
||||
e.preventDefault();
|
||||
var but = $(this);
|
||||
var confirmText = JSON.parse(sessionStorage.getItem("confirmText"));
|
||||
|
||||
$.confirm({
|
||||
title: false,
|
||||
content: confirmText["text"],
|
||||
useBootstrap: false,
|
||||
boxWidth: '30%',
|
||||
type: 'blue',
|
||||
backgroundDismiss: false,
|
||||
backgroundDismissAnimation: 'shake',
|
||||
buttons: {
|
||||
confirm: {
|
||||
text: confirmText["confirm"],
|
||||
action: function () {
|
||||
send("/delete-bot/",
|
||||
{
|
||||
token: but.attr("data-token"),
|
||||
@ -57,6 +72,13 @@ $(document).on("click", ".delete-bot", function(e) {
|
||||
}
|
||||
}
|
||||
)
|
||||
},
|
||||
},
|
||||
cancel: {
|
||||
text: confirmText["cancel"],
|
||||
},
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
function send(url, data, callback) {
|
||||
@ -103,6 +125,29 @@ $( document ).ready(function() {
|
||||
$("#bots").addClass("hide");
|
||||
}
|
||||
|
||||
if (!sessionStorage.getItem("confirmText")) {
|
||||
let confirmText = {};
|
||||
|
||||
switch (navigator.language.split('-')[0]) {
|
||||
case "ru":
|
||||
confirmText["text"] = "Вы уверены, что хотите удалить?";
|
||||
confirmText["confirm"] = "да";
|
||||
confirmText["cancel"] = "нет";
|
||||
break;
|
||||
case "es":
|
||||
confirmText["text"] = "¿Estás seguro que quieres borrar?";
|
||||
confirmText["confirm"] = "sí";
|
||||
confirmText["cancel"] = "no";
|
||||
break;
|
||||
default:
|
||||
confirmText["text"] = "Are you sure you want to delete?";
|
||||
confirmText["confirm"] = "yes";
|
||||
confirmText["cancel"] = "no";
|
||||
}
|
||||
|
||||
sessionStorage.setItem("confirmText", JSON.stringify(confirmText));
|
||||
}
|
||||
|
||||
let createdMsg = sessionStorage.getItem("createdMsg");
|
||||
if (createdMsg) {
|
||||
setTimeout(function() {
|
||||
|
@ -1,3 +1,13 @@
|
||||
body {
|
||||
display: flex;
|
||||
min-height: 100vh;
|
||||
flex-direction: column;
|
||||
}
|
||||
|
||||
main {
|
||||
flex: 1 0 auto;
|
||||
}
|
||||
|
||||
.indent-top {
|
||||
margin-top: 2%;
|
||||
}
|
||||
@ -11,7 +21,9 @@
|
||||
margin: 0 auto 23px;
|
||||
}
|
||||
|
||||
.tab-el-center{
|
||||
.docs,
|
||||
.tab-el-center,
|
||||
.footer-copyright{
|
||||
width: 67%;
|
||||
margin: 0 auto;
|
||||
}
|
||||
@ -102,3 +114,17 @@
|
||||
background-color: #039be5;
|
||||
will-change: left, right;
|
||||
}
|
||||
|
||||
.docs p {
|
||||
text-align: center;
|
||||
color: #9e9e9e;
|
||||
}
|
||||
|
||||
.footer-copyright {
|
||||
border-top: 1px solid #9e9e9e;
|
||||
margin-top: 10px;
|
||||
}
|
||||
|
||||
.footer-copyright p {
|
||||
color: #9e9e9e;
|
||||
}
|
||||
|
@ -32,6 +32,9 @@
|
||||
</div>
|
||||
</div>
|
||||
<div id="tab2" class="col s12">
|
||||
<div class="docs">
|
||||
<p>{{.Locale.InfoBot}}</p>
|
||||
</div>
|
||||
<div class="row indent-top">
|
||||
<form id="add-bot" class="tab-el-center" action="/add-bot/" method="POST">
|
||||
<input name="connectionId" type="hidden" value="{{.Conn.ID}}">
|
||||
|
@ -5,17 +5,33 @@
|
||||
<title>{{.Locale.Title}}</title>
|
||||
<link rel="stylesheet" href="/static/materialize.min.css">
|
||||
<link rel="stylesheet" href="/static/font.css" >
|
||||
<link rel="stylesheet" href="/static/jquery-confirm.min.css">
|
||||
<link rel="stylesheet" href="/static/style.css" >
|
||||
</head>
|
||||
<body>
|
||||
<main>
|
||||
<div class="container">
|
||||
<div class="indent-top center-align">
|
||||
<img id="logo" src="data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIj8+CjxzdmcgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIiB4bWxuczp4bGluaz0iaHR0cDovL3d3dy53My5vcmcvMTk5OS94bGluayIgdmlld0JveD0iMCAwIDI0MCAyNDAiPgo8ZGVmcz4KCTxsaW5lYXJHcmFkaWVudCBpZD0iYiIgeDE9IjAuNjY2NyIgeTE9IjAuMTY2NyIgeDI9IjAuNDE2NyIgeTI9IjAuNzUiPgoJCTxzdG9wIHN0b3AtY29sb3I9IiMzN2FlZTIiIG9mZnNldD0iMCIvPgoJCTxzdG9wIHN0b3AtY29sb3I9IiMxZTk2YzgiIG9mZnNldD0iMSIvPgoJPC9saW5lYXJHcmFkaWVudD4KCTxsaW5lYXJHcmFkaWVudCBpZD0idyIgeDE9IjAuNjU5NyIgeTE9IjAuNDM2OSIgeDI9IjAuODUxMiIgeTI9IjAuODAyNCI+CgkJPHN0b3Agc3RvcC1jb2xvcj0iI2VmZjdmYyIgb2Zmc2V0PSIwIi8+CgkJPHN0b3Agc3RvcC1jb2xvcj0iI2ZmZiIgb2Zmc2V0PSIxIi8+Cgk8L2xpbmVhckdyYWRpZW50Pgo8L2RlZnM+CjxjaXJjbGUgY3g9IjEyMCIgY3k9IjEyMCIgcj0iMTIwIiBmaWxsPSJ1cmwoI2IpIi8+CjxwYXRoIGZpbGw9IiNjOGRhZWEiIGQ9Im05OCAxNzVjLTMuODg3NiAwLTMuMjI3LTEuNDY3OS00LjU2NzgtNS4xNjk1TDgyIDEzMi4yMDU5IDE3MCA4MCIvPgo8cGF0aCBmaWxsPSIjYTljOWRkIiBkPSJtOTggMTc1YzMgMCA0LjMyNTUtMS4zNzIgNi0zbDE2LTE1LjU1OC0xOS45NTgtMTIuMDM1Ii8+CjxwYXRoIGZpbGw9InVybCgjdykiIGQ9Im0xMDAuMDQgMTQ0LjQxIDQ4LjM2IDM1LjcyOWM1LjUxODUgMy4wNDQ5IDkuNTAxNCAxLjQ2ODQgMTAuODc2LTUuMTIzNWwxOS42ODUtOTIuNzYzYzIuMDE1NC04LjA4MDItMy4wODAxLTExLjc0NS04LjM1OTQtOS4zNDgybC0xMTUuNTkgNDQuNTcxYy03Ljg5MDEgMy4xNjQ3LTcuODQ0MSA3LjU2NjYtMS40MzgyIDkuNTI4bDI5LjY2MyA5LjI1ODMgNjguNjczLTQzLjMyNWMzLjI0MTktMS45NjU5IDYuMjE3My0wLjkwODk5IDMuNzc1MiAxLjI1ODQiLz4KPC9zdmc+" alt="telegram" >
|
||||
</div>
|
||||
{{template "body" .}}
|
||||
</div>
|
||||
</main>
|
||||
<footer>
|
||||
<div class="container">
|
||||
<div class="footer-copyright">
|
||||
<p>
|
||||
©
|
||||
{{.Locale.CRMLink}}
|
||||
{{.Year}},
|
||||
{{.Locale.DocLink}}
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
</footer>
|
||||
<script src="/static/materialize.min.js"></script>
|
||||
<script src="/static/jquery-3.3.1.min.js"></script>
|
||||
<script src="/static/jquery-confirm.min.js"></script>
|
||||
<script src="/static/script.js"></script>
|
||||
</body>
|
||||
</html>
|
||||
|
@ -28,6 +28,9 @@ error_adding_bot: Error when adding a bot
|
||||
error_save: Error while saving, contact technical support
|
||||
missing_credentials: "Required methods: {{.Credentials}}"
|
||||
error_activity_mg: Check if the integration with MessageGateway is enabled in retailCRM settings
|
||||
info_bot: "If you have a problem with connecting a bot, please, refer to the <a target='_blank' href='//www.retailcrm.pro/docs/Users/Telegram'>documentation</a>"
|
||||
crm_link: "<a href='//www.retailcrm.pro' title='retailCRM'>retailCRM</a>"
|
||||
doc_link: "<a href='https://www.retailcrm.pro/docs' target='_blank'>документация</a>"
|
||||
|
||||
sticker: "[sticker]"
|
||||
audio: "[audio file]"
|
||||
|
@ -28,6 +28,9 @@ error_adding_bot: Error al añadir el bot
|
||||
error_save: Error al guardar, contacte con el soporte técnico
|
||||
missing_credentials: "Métodos requeridos: {{.Credenciales}}"
|
||||
error_activity_mg: Revisar si la integración con MessageGateway está habilitada en Ajustes de retailCRM
|
||||
info_bot: "Si tiene dificultades para conectar el bot, por favor, consulte la <a target='_blank' href='//www.retailcrm.es/docs/Users/Telegram'>documentación</a>"
|
||||
crm_link: "<a href='//www.retailcrm.es' title='retailCRM'>retailCRM</a>"
|
||||
doc_link: "<a href='https://www.retailcrm.es/docs' target='_blank'>documentación</a>"
|
||||
|
||||
sticker: "[etiqueta]"
|
||||
audio: "[archivo de audio]"
|
||||
|
@ -28,6 +28,9 @@ error_adding_bot: Ошибка при добавлении бота
|
||||
error_save: Ошибка при сохранении, обратитесь в службу технической поддержки
|
||||
missing_credentials: "Необходимые методы: {{.Credentials}}"
|
||||
error_activity_mg: Проверьте активность интеграции с MessageGateway в настройках retailCRM
|
||||
info_bot: "Если у вас возникли трудности при подключении бота, изучите, пожалуйста, <a target='_blank' href='//www.retailcrm.ru/docs/Users/Telegram'>документацию</a>"
|
||||
crm_link: "<a href='//www.retailcrm.ru' title='retailCRM'>retailCRM</a>"
|
||||
doc_link: "<a href='https://www.retailcrm.ru/docs' target='_blank'>документация</a>"
|
||||
|
||||
sticker: "[стикер]"
|
||||
audio: "[аудио файл]"
|
||||
|
Loading…
Reference in New Issue
Block a user