Javascripts localization implementation and html dist => src changes

pull/539/head
Alen BOHCELYAN 2017-02-13 18:05:49 +00:00 committed by Alen BOHCELYAN
parent f034d15aa2
commit 363ab116f4
12 changed files with 102 additions and 102 deletions

View File

@ -3,7 +3,7 @@ var doPoll = true;
// statuses is a helper map to point result statuses to ui classes
var statuses = {
"Email Sent": {
"Email Sent"): {
slice: "ct-slice-donut-sent",
legend: "ct-legend-sent",
label: "label-success",
@ -84,12 +84,12 @@ function dismiss() {
// Deletes a campaign after prompting the user
function deleteCampaign() {
swal({
title: "Are you sure?",
text: "This will delete the campaign. This can't be undone!",
title: T("Are you sure?"),
text: T("This will delete the campaign. This can't be undone!"),
type: "warning",
animation: false,
showCancelButton: true,
confirmButtonText: "Delete Campaign",
confirmButtonText: T("Delete Campaign"),
confirmButtonColor: "#428bca",
reverseButtons: true,
allowOutsideClick: false,
@ -106,8 +106,8 @@ function deleteCampaign() {
}
}).then(function() {
swal(
'Campaign Deleted!',
'This campaign has been deleted!',
T('Campaign Deleted!'),
T('This campaign has been deleted!'),
'success'
);
$('button:contains("OK")').on('click', function() {
@ -119,12 +119,12 @@ function deleteCampaign() {
// Completes a campaign after prompting the user
function completeCampaign() {
swal({
title: "Are you sure?",
text: "Gophish will stop processing events for this campaign",
title: T("Are you sure?"),
text: T("Gophish will stop processing events for this campaign"),
type: "warning",
animation: false,
showCancelButton: true,
confirmButtonText: "Complete Campaign",
confirmButtonText: T("Complete Campaign"),
confirmButtonColor: "#428bca",
reverseButtons: true,
allowOutsideClick: false,
@ -141,12 +141,12 @@ function completeCampaign() {
}
}).then(function() {
swal(
'Campaign Completed!',
'This campaign has been completed!',
T('Campaign Completed!'),
T('This campaign has been completed!'),
'success'
);
$('#complete_button')[0].disabled = true;
$('#complete_button').text('Completed!')
$('#complete_button').text(T('Completed!'))
doPoll = false;
})
}
@ -209,17 +209,17 @@ function replay(event_idx) {
/* Ensure we know where to send the user */
// Prompt for the URL
swal({
title: 'Where do you want the credentials submitted to?',
title: T('Where do you want the credentials submitted to?'),
input: 'text',
showCancelButton: true,
inputPlaceholder: "http://example.com/login",
inputPlaceholder: T("http://example.com/login"),
inputValue: url || "",
inputValidator: function(value) {
return new Promise(function(resolve, reject) {
if (value) {
resolve();
} else {
reject('Invalid URL.');
reject(T('Invalid URL.'));
}
});
}
@ -246,8 +246,8 @@ function renderTimeline(data) {
"position": data[5]
}
results = '<div class="timeline col-sm-12 well well-lg">' +
'<h6>Timeline for ' + escapeHtml(record.first_name) + ' ' + escapeHtml(record.last_name) +
'</h6><span class="subtitle">Email: ' + escapeHtml(record.email) + '</span>' +
'<h6>'+ T('Timeline for') + ' + escapeHtml(record.first_name) + ' ' + escapeHtml(record.last_name) +
'</h6><span class="subtitle">' + T('Email') + ': ' + escapeHtml(record.email) + '</span>' +
'<div class="timeline-graph col-sm-6">'
$.each(campaign.timeline, function(i, event) {
if (!event.email || event.email == record.email) {
@ -257,19 +257,19 @@ function renderTimeline(data) {
results +=
' <div class="timeline-icon ' + statuses[event.message].label + '">' +
' <i class="fa ' + statuses[event.message].icon + '"></i></div>' +
' <div class="timeline-message">' + escapeHtml(event.message) +
' <div class="timeline-message">' + T(escapeHtml(event.message)) +
' <span class="timeline-date">' + moment(event.time).format('MMMM Do YYYY h:mm a') + '</span>'
if (event.details) {
if (event.message == "Submitted Data") {
results += '<div class="timeline-replay-button"><button onclick="replay(' + i + ')" class="btn btn-success">'
results += '<i class="fa fa-refresh"></i> Replay Credentials</button></div>'
results += '<div class="timeline-event-details"><i class="fa fa-caret-right"></i> View Details</div>'
results += '<i class="fa fa-refresh"></i> '+ T('Replay Credentials') + '</button></div>'
results += '<div class="timeline-event-details"><i class="fa fa-caret-right"></i>' + T('View Details') + '</div>'
}
details = JSON.parse(event.details)
if (details.payload) {
results += '<div class="timeline-event-results">'
results += ' <table class="table table-condensed table-bordered table-striped">'
results += ' <thead><tr><th>Parameter</th><th>Value(s)</tr></thead><tbody>'
results += ' <thead><tr><th>' + T('Parameter') + '</th><th>' + T('Value(s)') + '</tr></thead><tbody>'
$.each(Object.keys(details.payload), function(i, param) {
if (param == "rid") {
return true;
@ -283,9 +283,9 @@ function renderTimeline(data) {
results += '</div>'
}
if (details.error) {
results += '<div class="timeline-event-details"><i class="fa fa-caret-right"></i> View Details</div>'
results += '<div class="timeline-event-details"><i class="fa fa-caret-right"></i> '+ T('View Details') + '</div>'
results += '<div class="timeline-event-results">'
results += '<span class="label label-default">Error</span> ' + details.error
results += '<span class="label label-default">'+ T('Error') + '</span> ' + details.error
results += '</div>'
}
}
@ -312,7 +312,7 @@ function poll() {
/* Update the timeline */
var timeline_data = {
series: [{
name: "Events",
name: T("Events"),
data: []
}]
}
@ -345,7 +345,7 @@ function poll() {
meta: status,
value: count
})
$("#email_chart_legend").append('<li><span class="' + statuses[status].legend + '"></span>' + status + '</li>')
$("#email_chart_legend").append('<li><span class="' + statuses[status].legend + '"></span>' + T(status) + '</li>')
})
var email_chart = $("#email_chart")
if (email_chart.get(0).__chartist__) {
@ -364,7 +364,7 @@ function poll() {
$.each(campaign.results, function(j, result) {
if (result.id == rid) {
var label = statuses[result.status].label || "label-default";
rowData[6] = "<span class=\"label " + label + "\">" + result.status + "</span>"
rowData[6] = "<span class=\"label " + label + "\">" + T(result.status) + "</span>"
resultsTable.row(i).data(rowData).draw(false)
if (row.child.isShown()) {
row.child(renderTimeline(row.data()))
@ -412,7 +412,7 @@ function load() {
$("#loading").hide()
$("#campaignResults").show()
// Set the title
$("#page-title").text("Results for " + c.name)
$("#page-title").text(T("Results for") + " " + c.name)
if (c.status == "Completed") {
$('#complete_button')[0].disabled = true;
$('#complete_button').text('Completed!');
@ -437,7 +437,7 @@ function load() {
// Setup our graphs
var timeline_data = {
series: [{
name: "Events",
name: T("Events"),
data: []
}]
}
@ -497,7 +497,7 @@ function load() {
escapeHtml(result.last_name) || "",
escapeHtml(result.email) || "",
escapeHtml(result.position) || "",
"<span class=\"label " + label + "\">" + result.status + "</span>"
"<span class=\"label " + label + "\">" + T(result.status) + "</span>"
]).draw()
if (!email_series_data[result.status]) {
email_series_data[result.status] = 1
@ -539,7 +539,7 @@ function load() {
meta: status,
value: count
})
$("#email_chart_legend").append('<li><span class="' + statuses[status].legend + '"></span>' + status + '</li>')
$("#email_chart_legend").append('<li><span class="' + statuses[status].legend + '"></span>' + T(status) + '</li>')
})
var timeline_chart = new Chartist.Line('#timeline_chart', timeline_data, timeline_opts)
timeline_chart.on('draw', function(data) {
@ -567,7 +567,7 @@ function load() {
cidx = $point.attr('meta')
html = "Event: " + campaign.timeline[cidx].message
if (campaign.timeline[cidx].email) {
html += '<br>' + "Email: " + escapeHtml(campaign.timeline[cidx].email)
html += '<br>' + T("Email:") + " " + escapeHtml(campaign.timeline[cidx].email)
}
$toolTip.html(html).show()
});
@ -671,7 +671,7 @@ function load() {
})
.error(function() {
$("#loading").hide()
errorFlash(" Campaign not found!")
errorFlash(T("Campaign not found!"))
})
}
$(document).ready(function() {

View File

@ -14,12 +14,12 @@ var campaign = {}
// Launch attempts to POST to /campaigns/
function launch() {
swal({
title: "Are you sure?",
text: "This will schedule the campaign to be launched.",
title: T("Are you sure?"),
text: T("This will schedule the campaign to be launched."),
type: "question",
animation: false,
showCancelButton: true,
confirmButtonText: "Launch",
confirmButtonText: T("Launch"),
confirmButtonColor: "#428bca",
reverseButtons: true,
allowOutsideClick: false,
@ -61,8 +61,8 @@ function launch() {
}
}).then(function() {
swal(
'Campaign Scheduled!',
'This campaign has been scheduled for launch!',
T('Campaign Scheduled!'),
T('This campaign has been scheduled for launch!'),
'success'
);
$('button:contains("OK")').on('click', function() {
@ -90,12 +90,12 @@ function sendTestEmail() {
}
}
btnHtml = $("#sendTestModalSubmit").html()
$("#sendTestModalSubmit").html('<i class="fa fa-spinner fa-spin"></i> Sending')
$("#sendTestModalSubmit").html('<i class="fa fa-spinner fa-spin"></i> '+ T('Sending'))
// Send the test email
api.send_test_email(test_email_request)
.success(function(data) {
$("#sendTestEmailModal\\.flashes").empty().append("<div style=\"text-align:center\" class=\"alert alert-success\">\
<i class=\"fa fa-check-circle\"></i> Email Sent!</div>")
<i class=\"fa fa-check-circle\"></i> " + T('Email Sent!') + "</div>")
$("#sendTestModalSubmit").html(btnHtml)
})
.error(function(data) {
@ -118,12 +118,12 @@ function dismiss() {
function deleteCampaign(idx) {
swal({
title: "Are you sure?",
text: "This will delete the campaign. This can't be undone!",
title: T("Are you sure?"),
text: T("This will delete the campaign. This can't be undone!"),
type: "warning",
animation: false,
showCancelButton: true,
confirmButtonText: "Delete " + campaigns[idx].name,
confirmButtonText: T("Delete") + " " + campaigns[idx].name,
confirmButtonColor: "#428bca",
reverseButtons: true,
allowOutsideClick: false,
@ -140,8 +140,8 @@ function deleteCampaign(idx) {
}
}).then(function() {
swal(
'Campaign Deleted!',
'This campaign has been deleted!',
T('Campaign Deleted!'),
T('This campaign has been deleted!'),
'success'
);
$('button:contains("OK")').on('click', function() {
@ -154,7 +154,7 @@ function setupOptions() {
api.groups.get()
.success(function(groups) {
if (groups.length == 0) {
modalError("No groups found!")
modalError(T("No groups found!"))
return false;
} else {
var group_s2 = $.map(groups, function(obj) {
@ -162,7 +162,7 @@ function setupOptions() {
return obj
});
$("#users.form-control").select2({
placeholder: "Select Groups",
placeholder: T("Select Groups"),
data: group_s2,
});
}
@ -170,7 +170,7 @@ function setupOptions() {
api.templates.get()
.success(function(templates) {
if (templates.length == 0) {
modalError("No templates found!")
modalError(T("No templates found!"))
return false
} else {
var template_s2 = $.map(templates, function(obj) {
@ -178,7 +178,7 @@ function setupOptions() {
return obj
});
$("#template.form-control").select2({
placeholder: "Select a Template",
placeholder: T("Select a Template"),
data: template_s2,
});
}
@ -186,7 +186,7 @@ function setupOptions() {
api.pages.get()
.success(function(pages) {
if (pages.length == 0) {
modalError("No pages found!")
modalError(T("No pages found!"))
return false
} else {
var page_s2 = $.map(pages, function(obj) {
@ -194,7 +194,7 @@ function setupOptions() {
return obj
});
$("#page.form-control").select2({
placeholder: "Select a Landing Page",
placeholder: T("Select a Landing Page"),
data: page_s2,
});
}
@ -202,7 +202,7 @@ function setupOptions() {
api.SMTP.get()
.success(function(profiles) {
if (profiles.length == 0) {
modalError("No profiles found!")
modalError(T("No profiles found!"))
return false
} else {
var profile_s2 = $.map(profiles, function(obj) {
@ -210,7 +210,7 @@ function setupOptions() {
return obj
});
$("#profile.form-control").select2({
placeholder: "Select a Sending Profile",
placeholder: T("Select a Sending Profile"),
data: profile_s2,
});
}
@ -226,7 +226,7 @@ function copy(idx) {
// Set our initial values
api.campaignId.get(campaigns[idx].id)
.success(function(campaign) {
$("#name").val("Copy of " + campaign.name)
$("#name").val(T("Copy of") + " " + campaign.name)
if (!campaign.template.id) {
$("#template").select2({
placeholder: campaign.template.name
@ -314,14 +314,14 @@ $(document).ready(function() {
campaignTable.row.add([
escapeHtml(campaign.name),
moment(campaign.created_date).format('MMMM Do YYYY, h:mm:ss a'),
"<span class=\"label " + label + "\">" + campaign.status + "</span>",
"<div class='pull-right'><a class='btn btn-primary' href='/campaigns/" + campaign.id + "' data-toggle='tooltip' data-placement='left' title='View Results'>\
"<span class=\"label " + label + "\">" + T(campaign.status) + "</span>",
"<div class='pull-right'><a class='btn btn-primary' href='/campaigns/" + campaign.id + "' data-toggle='tooltip' data-placement='left' title='" + T('View Results') + "'>\
<i class='fa fa-bar-chart'></i>\
</a>\
<span data-toggle='modal' data-target='#modal'><button class='btn btn-primary' data-toggle='tooltip' data-placement='left' title='Copy Campaign' onclick='copy(" + i + ")'>\
<span data-toggle='modal' data-target='#modal'><button class='btn btn-primary' data-toggle='tooltip' data-placement='left' title='" + T('Copy Campaign') + "' onclick='copy(" + i + ")'>\
<i class='fa fa-copy'></i>\
</button></span>\
<button class='btn btn-danger' onclick='deleteCampaign(" + i + ")' data-toggle='tooltip' data-placement='left' title='Delete Campaign'>\
<button class='btn btn-danger' onclick='deleteCampaign(" + i + ")' data-toggle='tooltip' data-placement='left' title='" + T('Delete Campaign') + "'>\
<i class='fa fa-trash-o'></i>\
</button></div>"
]).draw()
@ -333,7 +333,7 @@ $(document).ready(function() {
})
.error(function() {
$("#loading").hide()
errorFlash("Error fetching campaigns")
errorFlash(T("Error fetching campaigns"))
})
// Select2 Defaults
$.fn.select2.defaults.set("width", "100%");

View File

@ -10,7 +10,7 @@ var labels = {
}
function deleteCampaign(idx) {
if (confirm(T("Delete ") + campaigns[idx].name + "?")) {
if (confirm(T("Delete") + " " + campaigns[idx].name + "?")) {
api.campaignId.delete(campaigns[idx].id)
.success(function(data) {
successFlash(data.message)
@ -90,11 +90,11 @@ $(document).ready(function() {
})
average = Math.floor(average / data.total);
average_data.series.push({
meta: "Unsuccessful Phishes",
meta: T("Unsuccessful Phishes"),
value: 100 - average
})
average_data.series.push({
meta: "Successful Phishes",
meta: T("Successful Phishes"),
value: average
})
// Build the charts
@ -135,7 +135,7 @@ $(document).ready(function() {
var $point = $(this)
value = $point.attr('ct:value') || 0
cidx = $point.attr('ct:meta')
$toolTip.html(campaigns[cidx].name + '<br>' + "Successes: " + value.toString() + "%").show();
$toolTip.html(campaigns[cidx].name + '<br>' + T("Successes:" + " " + value.toString() + "%").show();
});
$chart.on('mouseleave', '.ct-point', function() {
@ -156,6 +156,6 @@ $(document).ready(function() {
}
})
.error(function() {
errorFlash("Error fetching campaigns")
errorFlash(T("Error fetching campaigns"))
})
})

View File

@ -18,7 +18,7 @@ function save(idx) {
page.id = pages[idx].id
api.pageId.put(page)
.success(function(data) {
successFlash("Page edited successfully!")
successFlash(T("Page edited successfully!"))
load()
dismiss()
})
@ -26,7 +26,7 @@ function save(idx) {
// Submit the page
api.pages.post(page)
.success(function(data) {
successFlash("Page added successfully!")
successFlash(T("Page added successfully!"))
load()
dismiss()
})
@ -49,7 +49,7 @@ function dismiss() {
}
function deletePage(idx) {
if (confirm("Delete " + pages[idx].name + "?")) {
if (confirm(T("Delete") + " " + pages[idx].name + "?")) {
api.pageId.delete(pages[idx].id)
.success(function(data) {
successFlash(data.message)
@ -61,7 +61,7 @@ function deletePage(idx) {
function importSite() {
url = $("#url").val()
if (!url) {
modalError("No URL Specified!")
modalError(T("No URL Specified!"))
} else {
api.clone_site({
url: url,
@ -104,7 +104,7 @@ function copy(idx) {
})
$("#html_editor").ckeditor()
var page = pages[idx]
$("#name").val("Copy of " + page.name)
$("#name").val(T("Copy of") + " " + page.name)
$("#html_editor").val(page.html)
}
@ -133,13 +133,13 @@ function load() {
pagesTable.row.add([
escapeHtml(page.name),
moment(page.modified_date).format('MMMM Do YYYY, h:mm:ss a'),
"<div class='pull-right'><span data-toggle='modal' data-target='#modal'><button class='btn btn-primary' data-toggle='tooltip' data-placement='left' title='Edit Page' onclick='edit(" + i + ")'>\
"<div class='pull-right'><span data-toggle='modal' data-target='#modal'><button class='btn btn-primary' data-toggle='tooltip' data-placement='left' title='" + T("Edit Page") + "' onclick='edit(" + i + ")'>\
<i class='fa fa-pencil'></i>\
</button></span>\
<span data-toggle='modal' data-target='#modal'><button class='btn btn-primary' data-toggle='tooltip' data-placement='left' title='Copy Page' onclick='copy(" + i + ")'>\
<span data-toggle='modal' data-target='#modal'><button class='btn btn-primary' data-toggle='tooltip' data-placement='left' title='" + T("Copy Page") + "' onclick='copy(" + i + ")'>\
<i class='fa fa-copy'></i>\
</button></span>\
<button class='btn btn-danger' data-toggle='tooltip' data-placement='left' title='Delete Page' onclick='deletePage(" + i + ")'>\
<button class='btn btn-danger' data-toggle='tooltip' data-placement='left' title='" + T("Delete Page") + "' onclick='deletePage(" + i + ")'>\
<i class='fa fa-trash-o'></i>\
</button></div>"
]).draw()
@ -151,7 +151,7 @@ function load() {
})
.error(function() {
$("#loading").hide()
errorFlash("Error fetching pages")
errorFlash(T("Error fetching pages"))
})
}

View File

@ -18,12 +18,12 @@ function sendTestEmail() {
}
}
btnHtml = $("#sendTestModalSubmit").html()
$("#sendTestModalSubmit").html('<i class="fa fa-spinner fa-spin"></i> Sending')
$("#sendTestModalSubmit").html('<i class="fa fa-spinner fa-spin"></i> ' + T('Sending'))
// Send the test email
api.send_test_email(test_email_request)
.success(function(data) {
$("#sendTestEmailModal\\.flashes").empty().append("<div style=\"text-align:center\" class=\"alert alert-success\">\
<i class=\"fa fa-check-circle\"></i> Email Sent!</div>")
<i class=\"fa fa-check-circle\"></i> " + T("Email Sent!") + "</div>")
$("#sendTestModalSubmit").html(btnHtml)
})
.error(function(data) {
@ -47,7 +47,7 @@ function save(idx) {
profile.id = profiles[idx].id
api.SMTPId.put(profile)
.success(function(data) {
successFlash("Profile edited successfully!")
successFlash(T("Profile edited successfully!"))
load()
dismiss()
})
@ -58,7 +58,7 @@ function save(idx) {
// Submit the profile
api.SMTP.post(profile)
.success(function(data) {
successFlash("Profile added successfully!")
successFlash(T("Profile added successfully!"))
load()
dismiss()
})
@ -81,7 +81,7 @@ function dismiss() {
}
function deleteProfile(idx) {
if (confirm("Delete " + profiles[idx].name + "?")) {
if (confirm(T("Delete") + " " + profiles[idx].name + "?")) {
api.SMTPId.delete(profiles[idx].id)
.success(function(data) {
successFlash(data.message)
@ -113,7 +113,7 @@ function copy(idx) {
})
var profile = {}
profile = profiles[idx]
$("#name").val("Copy of " + profile.name)
$("#name").val(T("Copy of") + " " + profile.name)
$("#interface_type").val(profile.interface_type)
$("#from").val(profile.from_address)
$("#host").val(profile.host)
@ -145,13 +145,13 @@ function load() {
escapeHtml(profile.name),
profile.interface_type,
moment(profile.modified_date).format('MMMM Do YYYY, h:mm:ss a'),
"<div class='pull-right'><span data-toggle='modal' data-target='#modal'><button class='btn btn-primary' data-toggle='tooltip' data-placement='left' title='Edit Profile' onclick='edit(" + i + ")'>\
"<div class='pull-right'><span data-toggle='modal' data-target='#modal'><button class='btn btn-primary' data-toggle='tooltip' data-placement='left' title='" + T("Edit Profile") + "' onclick='edit(" + i + ")'>\
<i class='fa fa-pencil'></i>\
</button></span>\
<span data-toggle='modal' data-target='#modal'><button class='btn btn-primary' data-toggle='tooltip' data-placement='left' title='Copy Profile' onclick='copy(" + i + ")'>\
<span data-toggle='modal' data-target='#modal'><button class='btn btn-primary' data-toggle='tooltip' data-placement='left' title='" + T("Copy Profile") + "' onclick='copy(" + i + ")'>\
<i class='fa fa-copy'></i>\
</button></span>\
<button class='btn btn-danger' data-toggle='tooltip' data-placement='left' title='Delete Profile' onclick='deleteProfile(" + i + ")'>\
<button class='btn btn-danger' data-toggle='tooltip' data-placement='left' title='" + T("Delete Profile") + "' onclick='deleteProfile(" + i + ")'>\
<i class='fa fa-trash-o'></i>\
</button></div>"
]).draw()
@ -163,7 +163,7 @@ function load() {
})
.error(function() {
$("#loading").hide()
errorFlash("Error fetching profiles")
errorFlash(T("Error fetching profiles"))
})
}

View File

@ -46,7 +46,7 @@ function save(idx) {
template.id = templates[idx].id
api.templateId.put(template)
.success(function(data) {
successFlash("Template edited successfully!")
successFlash(T("Template edited successfully!"))
load()
dismiss()
})
@ -57,7 +57,7 @@ function save(idx) {
// Submit the template
api.templates.post(template)
.success(function(data) {
successFlash("Template added successfully!")
successFlash(T("Template added successfully!"))
load()
dismiss()
})
@ -78,7 +78,7 @@ function dismiss() {
}
function deleteTemplate(idx) {
if (confirm("Delete " + templates[idx].name + "?")) {
if (confirm(T("Delete") + " " + templates[idx].name + "?")) {
api.templateId.delete(templates[idx].id)
.success(function(data) {
successFlash(data.message)
@ -204,7 +204,7 @@ function copy(idx) {
attachments: []
}
template = templates[idx]
$("#name").val("Copy of " + template.name)
$("#name").val(T("Copy of") + " " + template.name)
$("#subject").val(template.subject)
$("#html_editor").val(template.html)
$("#text_editor").val(template.text)
@ -236,7 +236,7 @@ function importEmail() {
raw = $("#email_content").val()
convert_links = $("#convert_links_checkbox").prop("checked")
if (!raw) {
modalError("No Content Specified!")
modalError(T("No Content Specified!"))
} else {
$.ajax({
method: "POST",
@ -282,13 +282,13 @@ function load() {
templateTable.row.add([
escapeHtml(template.name),
moment(template.modified_date).format('MMMM Do YYYY, h:mm:ss a'),
"<div class='pull-right'><span data-toggle='modal' data-target='#modal'><button class='btn btn-primary' data-toggle='tooltip' data-placement='left' title='Edit Template' onclick='edit(" + i + ")'>\
"<div class='pull-right'><span data-toggle='modal' data-target='#modal'><button class='btn btn-primary' data-toggle='tooltip' data-placement='left' title='" + T("Edit Template") + "' onclick='edit(" + i + ")'>\
<i class='fa fa-pencil'></i>\
</button></span>\
<span data-toggle='modal' data-target='#modal'><button class='btn btn-primary' data-toggle='tooltip' data-placement='left' title='Copy Template' onclick='copy(" + i + ")'>\
<span data-toggle='modal' data-target='#modal'><button class='btn btn-primary' data-toggle='tooltip' data-placement='left' title='" + T("Copy Template") + "' onclick='copy(" + i + ")'>\
<i class='fa fa-copy'></i>\
</button></span>\
<button class='btn btn-danger' data-toggle='tooltip' data-placement='left' title='Delete Template' onclick='deleteTemplate(" + i + ")'>\
<button class='btn btn-danger' data-toggle='tooltip' data-placement='left' title='" + T("Delete Template") + "' onclick='deleteTemplate(" + i + ")'>\
<i class='fa fa-trash-o'></i>\
</button></div>"
]).draw()
@ -300,7 +300,7 @@ function load() {
})
.error(function() {
$("#loading").hide()
errorFlash("Error fetching templates")
errorFlash(T("Error fetching templates"))
})
}

View File

@ -22,7 +22,7 @@ function save(id) {
group.id = id
api.groupId.put(group)
.success(function(data) {
successFlash("Group updated successfully!")
successFlash(T("Group updated successfully!"))
load()
dismiss()
$("#modal").modal('hide')
@ -35,7 +35,7 @@ function save(id) {
// to /groups
api.groups.post(group)
.success(function(data) {
successFlash("Group added successfully!")
successFlash(T("Group added successfully!"))
load()
dismiss()
$("#modal").modal('hide')
@ -82,7 +82,7 @@ function edit(id) {
})
.error(function() {
errorFlash("Error fetching group")
errorFlash(T("Error fetching group"))
})
}
// Handle file uploads
@ -93,7 +93,7 @@ function edit(id) {
var acceptFileTypes = /(csv|txt)$/i;
var filename = data.originalFiles[0]['name']
if (filename && !acceptFileTypes.test(filename.split(".").pop())) {
modalError("Unsupported file extension (use .csv or .txt)")
modalError(T("Unsupported file extension (use .csv or .txt)"))
return false;
}
data.submit();
@ -117,7 +117,7 @@ function deleteGroup(id) {
console.log('wat');
return
}
if (confirm("Delete " + group.name + "?")) {
if (confirm(T("Delete") + " " + group.name + "?")) {
api.groupId.delete(id)
.success(function(data) {
successFlash(data.message)
@ -194,7 +194,7 @@ function load() {
}
})
.error(function() {
errorFlash("Error fetching groups")
errorFlash(T("Error fetching groups"))
})
}

View File

@ -159,5 +159,5 @@
"Campaign not found!": "{{T "Campaign not found!"}}",
}
</script>
<script src="/js/dist/app/campaign_results.min.js"></script>
<script src="/js/src/app/campaign_results.js"></script>
{{end}}

View File

@ -175,5 +175,5 @@
"Error fetching campaigns": "{{T "Error fetching campaigns"}}"
}
</script>
<script src="/js/dist/app/campaigns.min.js"></script>
<script src="/js/src/app/campaigns.js"></script>
{{end}}

View File

@ -99,5 +99,5 @@
"Error fetching campaigns": "{{T "Error fetching campaigns"}}"
}
</script>
<script src="/js/dist/app/dashboard.min.js"></script>
<script src="/js/src/app/dashboard.js"></script>
{{end}}

View File

@ -149,5 +149,5 @@
</script>
<script src="/js/ckeditor/ckeditor.js"></script>
<script src="/js/ckeditor/adapters/jquery.js"></script>
<script src="/js/dist/app/sending_profiles.min.js"></script>
<script src="/js/src/app/sending_profiles.js"></script>
{{end}}

View File

@ -168,5 +168,5 @@
</script>
<script src="/js/src/vendor/ckeditor/ckeditor.js"></script>
<script src="/js/src/vendor/ckeditor/adapters/jquery.js"></script>
<script src="/js/dist/app/templates.min.js"></script>
<script src="/js/src/app/templates.js"></script>
{{end}}