1
0
mirror of synced 2024-11-22 04:26:01 +03:00

improve templates, settings data & translation

This commit is contained in:
Alex Lushpai 2018-05-23 17:03:37 +03:00
parent 37c879bff1
commit 064bfec57a
9 changed files with 120 additions and 82 deletions

View File

@ -281,6 +281,7 @@ func settingsHandler(w http.ResponseWriter, r *http.Request, uid string) {
"TabBots": localizer.MustLocalize(&i18n.LocalizeConfig{MessageID: "tab_bots"}),
"TableName": localizer.MustLocalize(&i18n.LocalizeConfig{MessageID: "table_name"}),
"TableToken": localizer.MustLocalize(&i18n.LocalizeConfig{MessageID: "table_token"}),
"AddBot": localizer.MustLocalize(&i18n.LocalizeConfig{MessageID: "add_bot"}),
"TableActivity": localizer.MustLocalize(&i18n.LocalizeConfig{MessageID: "table_activity"}),
},
}
@ -358,13 +359,13 @@ func createHandler(w http.ResponseWriter, r *http.Request) {
cr, status, errr := client.APICredentials()
if errr.RuntimeErr != nil {
http.Error(w, localizer.MustLocalize(&i18n.LocalizeConfig{MessageID: "incorrect_url_key"}), http.StatusBadRequest)
logger.Error(c.APIURL, status, err.Error(), cr)
logger.Error(c.APIURL, status, errr.RuntimeErr, cr)
return
}
if !cr.Success {
http.Error(w, localizer.MustLocalize(&i18n.LocalizeConfig{MessageID: "incorrect_url_key"}), http.StatusBadRequest)
logger.Error(c.APIURL, status, err.Error(), cr)
logger.Error(c.APIURL, status, errr.ApiErr, cr)
return
}
@ -372,8 +373,12 @@ func createHandler(w http.ResponseWriter, r *http.Request) {
Code: transport,
IntegrationCode: transport,
Active: true,
Name: "MG Telegram",
Name: "Telegram",
ClientID: c.ClientID,
Logo: fmt.Sprintf(
"https://%s/web/telegram_logo.svg",
config.HTTPServer.Host,
),
BaseURL: fmt.Sprintf(
"https://%s",
config.HTTPServer.Host,

View File

@ -3,7 +3,7 @@
<div class="col s6 offset-s3">
<ul class="tabs" id="tab">
<li class="tab col s6"><a class="active" href="#tab1">{{.Locale.TabSettings}}</a></li>
<li class="tab col s6"><a href="#tab2">{{.Locale.TabBots}}</a></li>
<li class="tab col s6"><a class="" href="#tab2">{{.Locale.TabBots}}</a></li>
</ul>
</div>
<div class="col s6 offset-s3">
@ -24,8 +24,8 @@
</div>
</div>
<div class="row">
<div class="input-field col s6 offset-s5">
<button class="btn waves-effect waves-light red lighten-1" type="submit" name="action">
<div class="input-field col s12 center-align">
<button class="btn waves-effect waves-light light-blue darken-1" type="submit" name="action">
{{.Locale.ButConnect}}
<i class="material-icons right">sync</i>
</button>
@ -39,12 +39,14 @@
<form id="add-bot" class="col s8 offset-s2" action="/add-bot/" method="POST">
<input name="clientId" type="hidden" value="{{.Conn.ClientID}}">
<div class="row">
<div class="input-field col s11">
<div class="input-field col s12">
<input placeholder="{{.Locale.TableToken}}" id="token" name="token" type="text" class="validate">
</div>
<div class="input-field col s1">
<button class="btn btn-meddium waves-effect waves-light red" type="submit" name="action">
<i class="material-icons">add</i>
</div>
<div class="row">
<div class="input-field col s12 center-align">
<button class="btn waves-effect waves-light light-blue darken-1" type="submit" name="action">
{{.Locale.AddBot}} <i class="material-icons right">add</i>
</button>
</div>
</div>
@ -63,9 +65,9 @@
<td>{{.Name}}</td>
<td>{{.Token}}</td>
<td>
<button class="activity-bot btn btn-meddium waves-effect waves-light red" type="submit" name="action"
<button class="activity-bot btn btn-small waves-effect waves-light light-blue darken-1" type="submit" name="action"
data-activity="{{.Active}}" data-token="{{.Token}}">
<i class="material-icons">{{if .Active}}stop{{else}}play_arrow{{end}}</i>
<i class="material-icons">{{if .Active}}pause{{else}}play_arrow{{end}}</i>
</button>
</td>
</tr>

View File

@ -16,8 +16,8 @@
</div>
</div>
<div class="row">
<div class="input-field col s6 offset-s5">
<button class="btn waves-effect waves-light red lighten-1" type="submit" name="action">
<div class="input-field col s12 center-align">
<button class="btn waves-effect waves-light light-blue darken-1" type="submit" name="action">
{{.Locale.ButConnect}}
<i class="material-icons right">sync</i>
</button>

View File

@ -11,7 +11,7 @@
<body>
<div class="container">
<div class="indent-top center-align">
<img id="logo" src="../web/telegram_logo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1LjcyOWM1LjUxODUgMy4wNDQ5IDkuNTAxNCAxLjQ2ODQgMTAuODc2LTUuMTIzNWwxOS42ODUtOTIuNzYzYzIuMDE1NC04LjA4MDItMy4wODAxLTExLjc0NS04LjM1OTQtOS4zNDgybC0xMTUuNTkgNDQuNTcxYy03Ljg5MDEgMy4xNjQ3LTcuODQ0MSA3LjU2NjYtMS40MzgyIDkuNTI4bDI5LjY2MyA5LjI1ODMgNjguNjczLTQzLjMyNWMzLjI0MTktMS45NjU5IDYuMjE3My0wLjkwODk5IDMuNzc1MiAxLjI1ODQiLz4KPC9zdmc+" alt="telegram" >
</div>
{{ end }}

View File

@ -7,7 +7,7 @@ table_activity: Activity
api_key: API Key
no_bot_token: Enter the bot token
incorrect_data: Incorrect data
wrong_data: Incorrect data
set_method: Set POST method
bot_already_created: Bot already created
not_find_account: Could not find account, please contact technical support
@ -20,3 +20,4 @@ connection_already_created: Connection already created
missing_url_key: Missing crm url or apiKey
incorrect_url: Enter the correct CRM url
incorrect_token: Set correct bot token
add_bot: Add bot

View File

@ -6,7 +6,6 @@ table_token: Токен
table_activity: Активность
api_key: API Ключ
no_bot_token: Введите токен
wrong_data: Неверные данные
set_method: Установить метод POST
@ -14,10 +13,11 @@ bot_already_created: Бот уже создан
not_find_account: Не удалось найти учетную запись, обратитесь в службу технической поддержки
error_activating_channel: Ошибка при активации канала
error_deactivating_channel: Ошибка при отключении канала
correct_url_key: Введите корректный URL или apiKey
incorrect_url_key: Введите корректный URL или apiKey
error_creating_integration: Ошибка при создании интеграции
error_creating_connection: Ошибка при создании соединения
connection_already_created: Соединение уже создано
missing_url_key: Отсутствует URL или apiKey
incorrect_url: Введите корректный URL CRM
incorrect_token: Установите корректный токен
add_bot: Добавить бота

View File

@ -48,7 +48,7 @@ $(document).on("click", ".activity-bot", function(e) {
but.find('i').replaceWith('<i class="material-icons">play_arrow</i>');
but.attr("data-activity", "false")
} else {
but.find('i').replaceWith('<i class="material-icons">stop</i>');
but.find('i').replaceWith('<i class="material-icons">pause</i>');
but.attr("data-activity", "true")
}
}
@ -70,7 +70,8 @@ function send(url, data, callback) {
);
}
} else {
$('#msg').html(`<p class="err-msg truncate">${res.responseText}</p>`);
//$('#msg').html(`<p class="err-msg truncate">${res.responseText}</p>`);
M.toast({html: res.responseText})
}
}
});
@ -83,9 +84,9 @@ function getBotTemplate(data) {
<td>${bot.name}</td>
<td>${bot.token}</td>
<td>
<button class="activity-bot btn btn-meddium waves-effect waves-light red" type="submit" name="action"
<button class="activity-bot btn btn-small waves-effect waves-light light-blue darken-1" type="submit" name="action"
data-activity="true" data-token="${bot.token}">
<i class="material-icons">stop</i>
<i class="material-icons">pause</i>
</button>
</td>
</tr>`;

View File

@ -9,6 +9,11 @@
#bots .activity-bot{
float: right;
}
#bots {
font-size: 12px;
}
#msg{
height: 23px;
}
@ -19,6 +24,71 @@
}
#logo{
height: 80px;
border-bottom: 1px solid red;
height: 100px;
margin-bottom: 20px;
}
/* label color */
.input-field label {
color: #039be5;
}
/* label focus color */
.input-field input[type=text]:focus + label {
color: #039be5;
}
/* label underline focus color */
.input-field input[type=text]:focus {
border-bottom: 1px solid #039be5;
box-shadow: 0 1px 0 0 #039be5;
}
/* valid color */
.input-field input[type=text].valid {
border-bottom: 1px solid #039be5;
box-shadow: 0 1px 0 0 #039be5;
}
/* invalid color */
.input-field input[type=text].invalid {
border-bottom: 1px solid #c62828;
box-shadow: 0 1px 0 0 #c62828;
}
/* icon prefix focus color */
.input-field .prefix.active {
color: #039be5;
}
.tabs .tab a {
color: #039be5;
display: block;
width: 100%;
height: 100%;
padding: 0 24px;
font-size: 14px;
text-overflow: ellipsis;
overflow: hidden;
-webkit-transition: color .28s ease, background-color .28s ease;
transition: color .28s ease, background-color .28s ease;
}
.tabs .tab a:focus, .tabs .tab a:focus.active {
background-color: #e1f5fe;
outline: none;
}
.tabs .tab a:hover, .tabs .tab a.active {
background-color: transparent;
color: #039be5;
}
.tabs .tab.disabled a,
.tabs .tab.disabled a:hover {
color: #039be5;
cursor: default;
}
.tabs .indicator {
position: absolute;
bottom: 0;
height: 2px;
background-color: #039be5;
will-change: left, right;
}

View File

@ -1,58 +1,17 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!-- Created with Inkscape (http://www.inkscape.org/) -->
<svg
xmlns:dc="http://purl.org/dc/elements/1.1/"
xmlns:cc="http://creativecommons.org/ns#"
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns:svg="http://www.w3.org/2000/svg"
xmlns="http://www.w3.org/2000/svg"
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
width="170"
height="50"
version="1.1"
sodipodi:docname="Telegram text logo2.svg"
inkscape:version="0.48.5 r10040"
id="svg3007">
<defs
id="defs3009" />
<sodipodi:namedview
id="base"
borderopacity="1.0"
inkscape:pageopacity="0.0"
inkscape:pageshadow="2"
inkscape:zoom="0.9899495"
inkscape:cx="-115.33299"
inkscape:cy="-29.10437"
inkscape:document-units="px"
showgrid="false"
showborder="true"
inkscape:window-width="1280"
inkscape:window-height="962"
inkscape:window-x="-8"
inkscape:window-y="-8"
inkscape:window-maximized="1"
inkscape:current-layer="svg3007" />
<metadata
id="metadata3012">
<rdf:RDF>
<cc:Work
rdf:about="">
<dc:format>image/svg+xml</dc:format>
<dc:type
rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
<dc:title />
</cc:Work>
</rdf:RDF>
</metadata>
<g
id="layer1"
transform="translate(2.0203051,-1001.8571)">
<path
id="path3037"
style="fill:#000000"
d="m 83.155472,1043.9958 c -1.00897,-0.1855 -1.96835,-0.4668 -2.94737,-0.7588 -0.007,-1.0285 0.0834,-2.0972 0.27945,-3.0729 8.79587,2.5387 10.8337,0.8765 10.98371,-4.7483 l 0,-1.3514 -1.13569,1.038 c -1.47774,1.3505 -2.92429,1.8332 -5.07994,1.6948 -4.28229,-0.2748 -6.6539,-3.406 -6.66094,-8.7945 -0.004,-3.2222 0.70796,-5.2692 2.49964,-7.1847 2.39005,-2.5551 6.48012,-3.0465 9.33991,-1.122 l 1.03702,0.6979 0,-0.7308 0,-0.7308 1.8421,0.061 1.84211,0.061 0.0609,7.2632 c 0.0949,11.324 -0.23645,13.5351 -2.35141,15.6902 -2.83552,2.3932 -5.73302,2.3852 -9.70947,1.9885 z m 5.57301,-11.1493 c 0.48945,-0.2497 1.3068,-0.8382 1.81634,-1.3079 l 0.92644,-0.854 0,-3.5335 0,-3.5334 -0.65969,-0.5551 c -2.25725,-1.8994 -4.68386,-2.0438 -6.51672,-0.3879 -1.18858,1.0738 -1.71225,2.624 -1.7282,5.1161 -0.0193,3.0101 0.62904,4.5345 2.2522,5.2962 1.07547,0.5046 2.63749,0.4085 3.90963,-0.2405 z m -53.27448,2.3845 c -2.15175,-2.0525 -3.16459,-5.2677 -2.73366,-8.6781 0.35004,-2.7703 1.19489,-4.5767 2.85696,-6.1088 1.3186,-1.2154 2.55729,-1.7263 4.51029,-1.8602 4.75649,-0.326 7.57662,2.9187 7.59054,8.7332 l 0.004,1.5263 c -3.63093,0.097 -7.78258,-0.2289 -11.15789,0.2776 0.49364,3.1269 2.75376,5.4645 5.89474,5.5108 1.88735,0 3.24506,-0.4788 5.05953,-0.8366 l 0.0552,2.8796 c 0,0 -4.2377,1.0063 -5.85157,0.9942 -2.47688,0.01 -4.82827,-1.1145 -6.22787,-2.438 z m 8.43714,-9.9139 c -0.004,-1.7928 -1.16986,-3.4767 -2.59275,-3.7437 -2.24609,-0.4213 -3.96719,0.8806 -4.53152,3.4279 l -0.19822,0.8947 3.66183,0 3.66183,0 -10e-4,-0.5789 z m 19.14181,9.9139 c -2.15175,-2.0525 -3.16459,-5.2677 -2.73366,-8.6781 0.35004,-2.7703 1.19489,-4.5767 2.85696,-6.1088 1.3186,-1.2154 2.55729,-1.7263 4.51028,-1.8602 4.7565,-0.326 7.57662,2.9187 7.59055,8.7332 l 0.004,1.5263 c -3.87507,-0.05 -7.58727,-0.034 -11.25555,-0.064 0.21864,3.6924 2.60437,6.0438 5.99239,5.8526 1.90496,0.037 3.57714,-0.4819 5.05954,-0.8366 0.32954,0.2036 0.24922,2.5379 -0.0972,2.8254 -0.47841,0.397 -4.08529,1.0605 -5.69917,1.0484 -2.47682,0.01 -4.82834,-1.1148 -6.22783,-2.4382 z m 8.43714,-9.9139 c -0.004,-1.7928 -1.16986,-3.4767 -2.59275,-3.7437 -2.24609,-0.4213 -3.96719,0.8806 -4.53152,3.4279 l -0.19822,0.8947 3.66183,0 3.66183,0 -10e-4,-0.5789 z m 44.158598,12.0809 c -2.6345,-0.9828 -3.9318,-3.8164 -3.0677,-6.7004 0.3454,-1.1529 1.6649,-2.571 3.0003,-3.2244 1.263,-0.6179 3.8179,-1.1377 5.6468,-1.1488 l 1.2105,-0.01 0,-1.4841 c -0.071,-4.0094 -3.2394,-3.7486 -6.3658,-2.6135 -0.8409,0.3026 -1.9388,0.5527 -2.1415,0.6154 -0.026,-0.9406 -0.1242,-1.5866 -0.1242,-3.0258 l 1.7368,-0.5495 c 1.1575,-0.3662 2.4406,-0.5896 3.8464,-0.6697 3.3764,-0.1924 5.2014,0.5481 6.2677,2.5432 0.4384,0.8201 0.4699,1.1968 0.5697,6.799 0.1055,5.9206 0.1066,5.9319 0.6161,6.4738 0.3057,0.3252 1.4234,0.6406 1.7663,0.6406 -0.01,1.2358 0.1332,1.1853 -0.016,2.3446 -0.4912,0.1323 -2.1243,0.2968 -2.734,0.2463 -1.193,-0.099 -1.9325,-0.5993 -2.5012,-1.6926 l -0.3032,-0.5828 -0.7821,0.6259 c -1.8048,1.4445 -4.8149,2.0852 -6.6245,1.4101 z m 4.4232,-3.1681 c 0.4643,-0.1638 1.1856,-0.5191 1.6028,-0.7895 l 0.7587,-0.4916 0,-2.1579 0,-2.158 -0.9031,0 c -2.1237,0 -4.6531,1.0898 -5.1718,2.2281 -0.5714,1.2542 -0.093,2.7443 1.064,3.3146 0.8612,0.4244 1.5549,0.4386 2.6442,0.054 z m -101.212208,-7.9128 0,-10.9474 -4.31579,0 -4.31579,0 0,-1.4737 0,-1.4736 10.63158,0 10.63158,0 0,1.4736 0,1.4737 -4.31579,0 -4.31579,0 0,10.9474 0,10.9475 -2,0 -2,0 z m 33.47369,-2.2105 0,-13.1579 1.89473,0 1.89474,0 0,13.1579 0,13.158 -1.89474,0 -1.89473,0 z m 48.210518,4 0,-9.1743 c 1.2281,0.041 2.505,-0.016 3.733,0.024 -0.012,0.7575 0.033,1.5121 0.077,2.2676 1.7272,-1.8978 3.5592,-2.3862 5.0931,-2.5497 l 1.4127,-0.1465 0,1.8046 0,1.8047 c -2.3688,-0.6955 -4.8378,0.8702 -5.9666,2.3907 -0.4335,0.6025 -0.4593,0.9081 -0.5598,6.6317 l -0.1052,6 c -1.2281,0.041 -2.4562,0.081 -3.68423,0.122 l 0,-9.1744 z m 31.3684,0 0,-9.1579 c 1.2632,0 2.5263,0 3.7895,0 0,0.8384 0,2.3018 0,3.1402 1.5981,-1.7967 3.5324,-3.4881 5.6842,-3.456 2.6311,-0.1033 3.7089,1.5973 4.883,3.4845 3.2896,-3.7043 9.29,-4.769 11.1442,-0.363 0.1785,6.0172 0.075,8.25 -0.02,15.5029 -1.2211,0.041 -2.3445,-0.016 -3.5657,0.024 0.056,-4.6806 -0.012,-9.972 -0.1262,-14.3671 -0.4683,-0.9211 -1.3374,-1.6449 -2.8359,-1.2488 -1.4986,0.3962 -2.8543,1.5623 -4.2655,3.209 0,4.0814 0.049,8.3094 0.049,12.3908 l -1.8868,0 -1.8868,0 c -0.04,-4.7836 -0.081,-9.5673 -0.1212,-14.3509 -0.7567,-0.8753 -1.3605,-1.3878 -2.7897,-1.0472 -1.4291,0.3405 -3.3278,1.4703 -4.2629,3.2632 0,4.0449 -0.049,8.09 -0.049,12.1349 -1.2631,0 -2.4775,0 -3.7406,0 0,-3.0529 -2e-4,-6.1059 0,-9.1589 z"
inkscape:connector-curvature="0" />
</g>
<?xml version="1.0"?>
<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" viewBox="0 0 240 240">
<defs>
<linearGradient id="b" x1="0.6667" y1="0.1667" x2="0.4167" y2="0.75">
<stop stop-color="#37aee2" offset="0"/>
<stop stop-color="#1e96c8" offset="1"/>
</linearGradient>
<linearGradient id="w" x1="0.6597" y1="0.4369" x2="0.8512" y2="0.8024">
<stop stop-color="#eff7fc" offset="0"/>
<stop stop-color="#fff" offset="1"/>
</linearGradient>
</defs>
<circle cx="120" cy="120" r="120" fill="url(#b)"/>
<path fill="#c8daea" d="m98 175c-3.8876 0-3.227-1.4679-4.5678-5.1695L82 132.2059 170 80"/>
<path fill="#a9c9dd" d="m98 175c3 0 4.3255-1.372 6-3l16-15.558-19.958-12.035"/>
<path fill="url(#w)" d="m100.04 144.41 48.36 35.729c5.5185 3.0449 9.5014 1.4684 10.876-5.1235l19.685-92.763c2.0154-8.0802-3.0801-11.745-8.3594-9.3482l-115.59 44.571c-7.8901 3.1647-7.8441 7.5666-1.4382 9.528l29.663 9.2583 68.673-43.325c3.2419-1.9659 6.2173-0.90899 3.7752 1.2584"/>
</svg>

Before

Width:  |  Height:  |  Size: 6.0 KiB

After

Width:  |  Height:  |  Size: 999 B