i18n user*.js
Change-Id: I0cf2295352d4b9db053722353a2a96d308ecd95f Reviewed-on: https://gerrit.instructure.com/4383 Tested-by: Hudson <hudson@instructure.com> Reviewed-by: Jon Jensen <jon@instructure.com>
This commit is contained in:
parent
ba1d7c02cb
commit
a97820789c
|
@ -16,6 +16,7 @@
|
|||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
I18n.scoped('users', function(I18n) {
|
||||
$(function(){
|
||||
$(".courses .course,.groups .group").bind('focus mouseover', function(event) {
|
||||
$(this).find(".info").addClass('info_hover');
|
||||
|
@ -27,7 +28,7 @@ $(function(){
|
|||
event.preventDefault();
|
||||
$(this).parents("li").confirmDelete({
|
||||
url: $(this).attr('rel'),
|
||||
message: "Are you sure you want to unenroll this user?",
|
||||
message: I18n.t('confirms.unenroll_user', "Are you sure you want to unenroll this user?"),
|
||||
success: function() {
|
||||
$(this).slideUp(function() {
|
||||
$(this).remove();
|
||||
|
@ -36,3 +37,4 @@ $(function(){
|
|||
});
|
||||
});
|
||||
})
|
||||
});
|
||||
|
|
|
@ -16,6 +16,7 @@
|
|||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
I18n.scoped('user_logins', function(I18n) {
|
||||
$(document).ready(function() {
|
||||
var $form = $("#edit_pseudonym_form");
|
||||
var passwordable_account_ids = $("#passwordable_account_ids").text().split(",");
|
||||
|
@ -26,13 +27,13 @@ $(document).ready(function() {
|
|||
delete data['pseudonym[password_confirmation]'];
|
||||
}
|
||||
if((data['pseudonym[password]'] || data['pseudonym[password_confirmation]']) && data['pseudonym[password]'] != data['pseudonym[password_confirmation]']) {
|
||||
$(this).formErrors({'pseudonym[password]': 'passwords do not match'});
|
||||
$(this).formErrors({'pseudonym[password]': I18n.t('errors.passwords_do_not_match', 'passwords do not match')});
|
||||
return false;
|
||||
}
|
||||
},
|
||||
beforeSubmit: function(data) {
|
||||
$(this).find("button").attr('disabled', true)
|
||||
.filter(".submit_button").text("Saving...");
|
||||
.filter(".submit_button").text(I18n.t('messages.saving', "Saving..."));
|
||||
var select = $(this).find(".account_id select")[0];
|
||||
var idx = select && select.selectedIndex;
|
||||
$(this).data('account_name', null);
|
||||
|
@ -40,7 +41,7 @@ $(document).ready(function() {
|
|||
},
|
||||
success: function(data) {
|
||||
$(this).find("button").attr('disabled', false)
|
||||
.filter(".submit_button").text("Save");
|
||||
.filter(".submit_button").text(I18n.t('buttons.save', "Save"));
|
||||
$(this).dialog('close');
|
||||
if($(this).data('unique_id_text')) {
|
||||
var $login = $(this).data('unique_id_text').parents(".login");
|
||||
|
@ -60,7 +61,7 @@ $(document).ready(function() {
|
|||
},
|
||||
error: function(data) {
|
||||
$(this).find("button").attr('disabled', false)
|
||||
.filter(".submit_button").text("Save Failed");
|
||||
.filter(".submit_button").text(I18n.t('errors.save_failed', "Save Failed"));
|
||||
}
|
||||
});
|
||||
$("#edit_pseudonym_form .account_id_select").change(function() {
|
||||
|
@ -100,8 +101,8 @@ $(document).ready(function() {
|
|||
}
|
||||
}
|
||||
}).dialog('open');
|
||||
$form.dialog('option', 'title', 'Update Login')
|
||||
.find(".submit_button").text("Update Login");
|
||||
$form.dialog('option', 'title', I18n.t('titles.update_login', 'Update Login'))
|
||||
.find(".submit_button").text(I18n.t('buttons.update_login', "Update Login"));
|
||||
var $unique_id = $(this).parents(".login").find(".unique_id");
|
||||
$form.data('unique_id_text', $unique_id);
|
||||
$form.find(":input:visible:first").focus().select();
|
||||
|
@ -109,12 +110,12 @@ $(document).ready(function() {
|
|||
.delegate('.delete_pseudonym_link', 'click', function(event) {
|
||||
event.preventDefault();
|
||||
if($("#login_information .login:visible").length < 2) {
|
||||
alert("You can't delete the last login for a user");
|
||||
alert(I18n.t('notices.cant_delete_last_login', "You can't delete the last login for a user"));
|
||||
return;
|
||||
}
|
||||
var login = $(this).parents(".login").find(".unique_id").text();
|
||||
$(this).parents(".login").confirmDelete({
|
||||
message: "Are you sure you want to delete the login, \"" + login + "\"?",
|
||||
message: I18n.t('confirms.delete_login', "Are you sure you want to delete the login, \"%{login}\"?", {login: login}),
|
||||
url: $(this).attr('rel'),
|
||||
success: function() {
|
||||
$(this).fadeOut();
|
||||
|
@ -129,10 +130,11 @@ $(document).ready(function() {
|
|||
$("#login_information .login.blank .edit_pseudonym_link").click();
|
||||
$form.attr('action', $(this).attr('rel')).attr('method', 'POST');
|
||||
$form.fillFormData({'pseudonym[unique_id]': ''});
|
||||
$form.dialog('option', 'title', 'Add Login')
|
||||
.find(".submit_button").text("Add Login");
|
||||
$form.dialog('option', 'title', I18n.t('titles.add_login', 'Add Login'))
|
||||
.find(".submit_button").text(I18n.t('buttons.add_login', "Add Login"));
|
||||
$form.find(".account_id").show();
|
||||
$form.find(".account_id_select").change();
|
||||
$form.data('unique_id_text', null);
|
||||
});
|
||||
});
|
||||
});
|
||||
});
|
||||
|
|
|
@ -16,6 +16,7 @@
|
|||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
I18n.scoped('user_name', function(I18n) {
|
||||
$(document).ready(function() {
|
||||
$("#name_and_email").delegate('.edit_user_link', 'click', function(event) {
|
||||
event.preventDefault();
|
||||
|
@ -28,17 +29,17 @@ $(document).ready(function() {
|
|||
$("#edit_student_form").formSubmit({
|
||||
beforeSubmit: function(data) {
|
||||
$(this).find("button").attr('disabled', true)
|
||||
.filter(".submit_button").text("Updating User Details...");
|
||||
.filter(".submit_button").text(I18n.t('messages.updating_user_details', "Updating User Details..."));
|
||||
},
|
||||
success: function(data) {
|
||||
$(this).find("button").attr('disabled', false)
|
||||
.filter(".submit_button").text("Update User");
|
||||
.filter(".submit_button").text(I18n.t('buttons.update_user', "Update User"));
|
||||
$("#name_and_email .user_details").fillTemplateData({data: data && data.user});
|
||||
$("#edit_student_dialog").dialog('close');
|
||||
},
|
||||
error: function(data) {
|
||||
$(this).find("button").attr('disabled', false)
|
||||
.filter(".submit_button").text("Updating user details failed, please try again");
|
||||
.filter(".submit_button").text(I18n.t('errors.updating_user_details_failed', "Updating user details failed, please try again"));
|
||||
}
|
||||
});
|
||||
$("#edit_student_dialog .cancel_button").click(function() {
|
||||
|
@ -47,26 +48,27 @@ $(document).ready(function() {
|
|||
$(".remove_avatar_picture_link").click(function(event) {
|
||||
event.preventDefault();
|
||||
var $link = $(this);
|
||||
var result = confirm("Are you sure you want to remove this user's profile picture?");
|
||||
var result = confirm(I18n.t('confirms.remove_profile_picture', "Are you sure you want to remove this user's profile picture?"));
|
||||
if(!result) { return; }
|
||||
$link.text("Removing image...");
|
||||
$link.text(I18n.t('messages.removing_image', "Removing image..."));
|
||||
$.ajaxJSON($link.attr('href'), 'PUT', {'avatar[state]': 'none'}, function(data) {
|
||||
$link.parents("tr").find(".avatar_image").remove();
|
||||
$link.remove();
|
||||
}, function(data) {
|
||||
$link.text("Failed to remove the image, please try again");
|
||||
$link.text(I18n.t('errors.failed_to_remove_image', "Failed to remove the image, please try again"));
|
||||
});
|
||||
});
|
||||
$(".report_avatar_picture_link").click(function(event) {
|
||||
event.preventDefault();
|
||||
event.preventDefault();
|
||||
var $link = $(this);
|
||||
$link.text("Reporting image...");
|
||||
$link.text(I18n.t('messages.reporting_image', "Reporting image..."));
|
||||
$.ajaxJSON($link.attr('href'), 'POST', {}, function(data) {
|
||||
$link.after("This image has been reported");
|
||||
$link.after(I18n.t('notices.image_reported', "This image has been reported"));
|
||||
$link.remove();
|
||||
}, function(data) {
|
||||
$link.text("Failed to report the image, please try again");
|
||||
$link.text(I18n.t('errors.failed_to_report_image', "Failed to report the image, please try again"));
|
||||
});
|
||||
});
|
||||
});
|
||||
});
|
||||
});
|
||||
|
|
|
@ -61,12 +61,13 @@ $("#add_entry_form").formSubmit({
|
|||
}
|
||||
});
|
||||
|
||||
I18n.scoped('user_notes', function(I18n) {
|
||||
$(".delete_user_note_link").click(function(event) {
|
||||
event.preventDefault();
|
||||
var token = $("form:first").getFormData().authenticity_token;
|
||||
var $user_note = $(this).parents(".user_note");
|
||||
$user_note.confirmDelete({
|
||||
message: "Are you sure you want to delete this journal entry?",
|
||||
message: I18n.t('confirms.delete_journal_entry', "Are you sure you want to delete this journal entry?"),
|
||||
token: token,
|
||||
url: $(this).attr('href'),
|
||||
success: function() {
|
||||
|
@ -82,3 +83,4 @@ $(".delete_user_note_link").click(function(event) {
|
|||
}
|
||||
});
|
||||
});
|
||||
});
|
||||
|
|
Loading…
Reference in New Issue