localize Profile

Change-Id: Ifa944757f5656157aa3c360666ccc88ca12dbaf0
Reviewed-on: https://gerrit.instructure.com/4343
Tested-by: Hudson <hudson@instructure.com>
Reviewed-by: Cody Cutrer <cody@instructure.com>
This commit is contained in:
Jacob Fugal 2011-06-20 14:26:54 -06:00
parent 0242d1261f
commit 774a5d7735
14 changed files with 346 additions and 303 deletions

View File

@ -22,7 +22,7 @@ class ProfileController < ApplicationController
def show
@user = params[:id] ? User.find(params[:id]) : @current_user
add_crumb("#{@user.short_name}'s profile", profile_path )
add_crumb(t(:crumb, "%{user}'s profile", :user => @user.short_name), profile_path )
@channels = @user.communication_channels.unretired
@email_channels = @channels.select{|c| c.path_type == "email"}
@sms_channels = @channels.select{|c| c.path_type == 'sms'}
@ -49,8 +49,11 @@ class ProfileController < ApplicationController
@user = @current_user
@user = User.find(params[:id]) if params[:id]
add_crumb(@user.short_name, profile_path )
add_crumb(t(:crumb_notification_preferences, "Notification Preferences"), communication_profile_path )
if @user.communication_channel.blank?
flash[:error] = "Please define at least one email address or other way to be contacted before setting notification preferences."
flash[:error] = t('errors.no_channels', "Please define at least one email address or other way to be contacted before setting notification preferences.")
redirect_to profile_url
return
end
@ -146,7 +149,7 @@ class ProfileController < ApplicationController
pseudonym_to_update = @user.pseudonyms.find(params[:pseudonym][:password_id]) if params[:pseudonym][:password_id] && change_password
if change_password == '1' && pseudonym_to_update && !pseudonym_to_update.valid_arbitrary_credentials?(old_password)
pseudonymed = true
flash[:error] = "Invalid old password for the login #{pseudonym_to_update.unique_id}"
flash[:error] = t('errors.invalid_old_password', "Invalid old password for the login %{pseudonym}", :pseudonym => pseudonym_to_update.unique_id)
format.html { redirect_to profile_url }
format.json { render :json => pseudonym_to_update.errors.to_json, :status => :bad_request }
end
@ -157,7 +160,7 @@ class ProfileController < ApplicationController
params[:pseudonym].delete :password_id
if !params[:pseudonym].empty? && pseudonym_to_update && !pseudonym_to_update.update_attributes(params[:pseudonym])
pseudonymed = true
flash[:error] = "Login failed to update"
flash[:error] = t('errors.profile_update_failed', "Login failed to update")
format.html { redirect_to profile_url }
format.json { render :json => pseudonym_to_update.errors.to_json, :status => :bad_request }
end
@ -168,7 +171,7 @@ class ProfileController < ApplicationController
cc.insert_at(1) if cc
end
unless pseudonymed
flash[:notice] = "Profile successfully updated"
flash[:notice] = t('notices.updated_profile', "Profile successfully updated")
format.html { redirect_to profile_url }
format.json { render :json => @user.to_json(:methods => :avatar_url, :include => {:communication_channel => {:only => [:id, :path]}, :pseudonym => {:only => [:id, :unique_id]} }) }
end

View File

@ -1,21 +1,21 @@
<tr class="access_token <%= 'blank' unless access_token %>" style="<%= hidden unless access_token %>">
<td class="app_name"><%= access_token.try(:app_name) || "No App" %></td>
<td class="app_name"><%= access_token.try(:app_name) || t(:default_app_name, "No App") %></td>
<td class="purpose"><%= access_token.try(:purpose) || nbsp %></td>
<td class="dates">
<table class="subtable">
<tr>
<td>Expires:</td>
<td class="expires nobr"><%= datetime_string(access_token.try(:expires_at)) || 'never' %></td>
<td><%= before_label(:token_expires, "Expires") %></td>
<td class="expires nobr"><%= datetime_string(access_token.try(:expires_at)) || t('profile.token_never_expires', 'never') %></td>
</tr><tr>
<td class="nobr">Last Used:</td>
<td class="nobr"><%= before_label(:token_last_used, "Last Used") %></td>
<td class="used nobr"><%= datetime_string(access_token.try(:last_used_at)) || '--' %></td>
</tr>
</table>
</td>
<td>
<a href="#" rel="<%= profile_token_url(access_token.try(:id) || "{{ id }}") %>" class="show_token_link">details</a>
<a href="#" rel="<%= profile_token_url(access_token.try(:id) || "{{ id }}") %>" class="show_token_link"><%= t('links.token_details', "details") %></a>
</td>
<td class="links">
<a href="#" class="delete_key_link" rel="<%= profile_token_url(access_token.try(:id) || "{{ id }}") %>" title="Delete this Token"><%= image_tag "delete.png" %></a>
<a href="#" class="delete_key_link" rel="<%= profile_token_url(access_token.try(:id) || "{{ id }}") %>" title="<%= t('titles.delete_this_token', "Delete this Token") %>"><%= image_tag "delete.png" %></a>
</td>
</tr>
</tr>

View File

@ -1,9 +1,9 @@
<select class="email_select contact_select" name="channel_id">
<% if @email_channels.empty? %>
<option value="">[Select Email]</option>
<option value=""><%= t(:default_email_option, "[Select Email]") %></option>
<% end %>
<% @email_channels.each do |c| %>
<option class="channel_option_<%= c.id %>" value="<%= c.id %>" <%= "selected" if c == email_select %>><%= c.path %></option>
<% end %>
<option value="new">New Email Address</option>
<option value="new"><%= t(:new_email_option, "New Email Address") %></option>
</select>

View File

@ -1,6 +1,6 @@
<select class="facebook_select contact_select" name="channel_id" style="display: none;">
<% facebook = @current_user.communication_channels.unretired.find_by_path_type('facebook') %>
<% if facebook && feature_and_service_enabled?(:facebook) %>
<option class="channel_option_<%= facebook.id %>" value="<%= facebook.id %>" selected>Facebook</option>
<option class="channel_option_<%= facebook.id %>" value="<%= facebook.id %>" selected><%= t(:facebook, "Facebook") %></option>
<% end %>
</select>

View File

@ -1,18 +1,18 @@
<table class="formtable">
<tr>
<td><%= form.label :unique_id, "Email Address:" %></td>
<td><%= form.blabel :unique_id, :email_address, :en => "Email Address" %></td>
<td><%= form.text_field :unique_id %></td>
</tr><tr>
<td><%= label :user, :time_zone, "Time Zone:" %></td>
<td><%= time_zone_select :user, :time_zone, TimeZone.us_zones, :default => ((@domain_root_account && @domain_root_account.default_time_zone) || "Mountain Time (US & Canada)") %></td>
<td><%= label :user, :time_zone, before_label(:time_zone, "Time Zone") %></td>
<td><%= time_zone_select :user, :time_zone, TimeZone.us_zones, :model => I18nTimeZone, :default => (@domain_root_account && @domain_root_account.default_time_zone) || "Mountain Time (US & Canada)" %><%# that default time zone is a value, not text %></td>
</tr><tr>
<td><%= form.label :password, form.object.new_record? ? "Password" : "Change password" %></td>
<td><%= form.label :password, form.object.new_record? ? t('labels.password', "Password") : t('labels.change_password', "Change password") %></td>
<td><%= form.password_field :password, :style => "width: 150px;" %></td>
</tr><tr>
<td><%= form.label :password_confirmation, "Confirm Password:"%></td>
<td><%= form.blabel :password_confirmation, :confirm_password, :en => "Confirm Password"%></td>
<td><%= form.password_field :password_confirmation, :style => "width: 150px;" %></td>
</tr><tr>
<td colspan="2">
<button type="submit" class="button">Register</button></td>
<button type="submit" class="button"><%= t('buttons.register', "Register") %></button></td>
</tr>
</table>
</table>

View File

@ -17,16 +17,16 @@
<%= notification_preference.category_description %>
<% if notification_preference.category == 'Message' %>
<div style="font-weight: normal; font-size: 0.8em;">
You must have at least one "right away" notification for email messages.
<%= t('notifications_hints.messages', 'You must have at least one "right away" notification for email messages.') %>
</div>
<% elsif notification_preference.category == 'Grading' && @domain_root_account && @domain_root_account.settings[:allow_sending_scores_in_emails] != false %>
<div style="font-weight: normal; font-size: 0.8em; margin-left: 10px;">
<%= check_box :user, :send_scores_in_emails, :checked => @current_user.send_scores_in_emails? %>
<%= label :user, :send_scores_in_emails, "Include scores when alerting about grade changes." %>
<%= label :user, :send_scores_in_emails, :en => "Include scores when alerting about grade changes." %>
</div>
<% elsif notification_preference.category == 'Course Content' %>
<div style="font-weight: normal; font-size: 0.8em;">
Will notify you of changes to any wiki or assignment pages (could be a lot of notifications)
<%= t('notifications_hints.course_content', "Will notify you of changes to any wiki or assignment pages (could be a lot of notifications)") %>
</div>
<% end %>
</td>
@ -35,13 +35,13 @@
<tr class="preference preference_<%= notification_preference.id %>">
<td colspan="2" style="padding-left: 10px;">
<select class="contact_type_select">
<option value="email_select" <%= "selected" if preference.communication_channel.path_type == "email" %>>Email Me</option>
<option value="sms_select" <%= "selected" if preference.communication_channel.path_type == "sms" %>>Text my Cell</option>
<option value="email_select" <%= "selected" if preference.communication_channel.path_type == "email" %>><%= t('contact_types.email', "Email Me") %></option>
<option value="sms_select" <%= "selected" if preference.communication_channel.path_type == "sms" %>><%= t('contact_types.sms', "Text my Cell") %></option>
<% if !@current_user.user_services.for_service('facebook').empty? %>
<option value="facebook_select" <%= 'selected' if preference.communication_channel.path_type == 'facebook' %>>Notify me on Facebook</option>
<option value="facebook_select" <%= 'selected' if preference.communication_channel.path_type == 'facebook' %>><%= t('contact_types.facebook', "Notify me on Facebook") %></option>
<% end %>
<% if !@current_user.user_services.for_service('twitter').empty? %>
<option value="twitter_select" <%= 'selected' if preference.communication_channel.path_type == 'twitter' %>>Notify me via Twitter</option>
<option value="twitter_select" <%= 'selected' if preference.communication_channel.path_type == 'twitter' %>><%= t('contact_types.twitter', "Notify me via Twitter") %></option>
<% end %>
</select>
<span style="white-space: nowrap;"><span class="at" style="<%= hidden unless preference.communication_channel.path_type == 'email' || preference.communication_channel.path_type == 'sms' %>">at </span>
@ -59,10 +59,10 @@
<div class="category_slug"><%= notification_preference.category_slug %></div>
</div>
</td>
<td class="frequency <%= "selected" if !preference.frequency || preference.frequency == "immediately" %> immediately" title="Notify me right away"><div>&nbsp;</div></td>
<td class="frequency <%= "selected" if preference.frequency == "daily" %> daily" title="Send notifications for the day in one message"><div>&nbsp;</div></td>
<td class="frequency <%= "selected" if preference.frequency == "weekly" %> weekly" title="Send notifications for the week in one message"><div>&nbsp;</div></td>
<td class="frequency <%= "selected" if preference.frequency == "never" %> never" title="Don't send me anything"><div>&nbsp;</div></td>
<td class="frequency <%= "selected" if !preference.frequency || preference.frequency == "immediately" %> immediately" title="<%= t('frequencies.right_away', "Notify me right away") %>"><div>&nbsp;</div></td>
<td class="frequency <%= "selected" if preference.frequency == "daily" %> daily" title="<%= t('frequencies.daily', "Send notifications for the day in one message") %>"><div>&nbsp;</div></td>
<td class="frequency <%= "selected" if preference.frequency == "weekly" %> weekly" title="<%= t('frequencies.weekly', "Send notifications for the week in one message") %>"><div>&nbsp;</div></td>
<td class="frequency <%= "selected" if preference.frequency == "never" %> never" title="<%= t('frequencies.never', "Don't send me anything") %>"><div>&nbsp;</div></td>
<td style="padding-left: 2px;">
<a href="#" class="delete_preference_link no-hover" style="opacity: 0.6; <%= hidden unless list.length > 1 %>"><%= image_tag "delete_circle.png" %></a>
</td>
@ -70,6 +70,6 @@
<% end %>
<tr>
<td colspan="7" style="text-align: right; font-size: 0.8em;">
<a href="#" class="add-small add_notification_link add_notification_<%= notification_preference.id %>"> And Also...</a>
<a href="#" class="add-small add_notification_link add_notification_<%= notification_preference.id %>"> <%= t('links.add_notification_continue', "And Also...") %></a>
</td>
</tr>

View File

@ -1,5 +1,5 @@
<% view ||= 'profile' %>
<ul>
<li class="<%= 'active' if view == 'profile' %>" ><%= link_to 'User Settings', profile_url %></li>
<li class="<%= 'active' if view == 'communication' %>" ><%= link_to 'Communicaton Preferences', communication_profile_url %></li>
<li class="<%= 'active' if view == 'profile' %>" ><%= link_to t('links.user_settings', 'User Settings'), profile_url %></li>
<li class="<%= 'active' if view == 'communication' %>" ><%= link_to t('links.communication_preferences', 'Communicaton Preferences'), communication_profile_url %></li>
</ul>

View File

@ -1,9 +1,9 @@
<select class="sms_select contact_select" name="channel_id">
<% if @sms_channels.empty? %>
<option value="" class="blank_option">[Select Cell]</option>
<option value="" class="blank_option"><%= t(:default_sms_option, "[Select Cell]") %></option>
<% end %>
<% @sms_channels.each do |c| %>
<option value="<%= c.id %>" class="channel_option_<%= c.id %>" <%= "selected" if c == sms_select %>><%= c.path %></option>
<% end %>
<option value="new">New Cell Number</option>
<option value="new"><%= t(:new_sms_option, "New Cell Number") %></option>
</select>

View File

@ -1,6 +1,6 @@
<select class="twitter_select contact_select" name="channel_id" style="display: none;">
<% twitter = @current_user.communication_channels.unretired.find_by_path_type('twitter') %>
<% if twitter && feature_and_service_enabled?(:twitter) %>
<option class="channel_option_<%= twitter.id %>" value="<%= twitter.id %>" selected>Twitter</option>
<option class="channel_option_<%= twitter.id %>" value="<%= twitter.id %>" selected><%= t(:twitter, "Twitter") %></option>
<% end %>
</select>

View File

@ -31,7 +31,23 @@
}
</style>
<% end %>
<% js_block do %>
<%# set up separately scoped error checker to match model scope; this is way
fragile. It's just the list of possible "already been activated" errors
from the CommunicationChannel model. if one is added there, it needs to be
added here as well. %>
<% js_block :i18n_scope => 'communication_channel.errors' do %>
<script>
var alreadyActivatedPattern = new RegExp(
I18n.t('duplicate_email', "The email address %{email} has already been activated for another account", {'email': '.*'}) + '|' +
I18n.t('duplicate_sms', "The SMS address %{email} has already been activated for another account", {'email': '.*'}) + '|' +
I18n.t('duplicate_facebook', "The Facebook account %{email} has already been activated for another account", {'email': '.*'}) + '|' +
I18n.t('duplicate_twitter', "The Twitter handle %{handle} has already been activated for another account", {'handle': '.*'}) + '|' +
I18n.t('duplicate', "The address %{address} has already been activated for another account", {'address': '.*'}));
window.isAlreadyActivatedError = function(message) { return message.match(alreadyActivatedPattern); };
</script>
<% end %>
<% js_block :i18n_scoped => 'profile._ways_to_contact' do %>
<script>
$(document).ready(function() {
$("#communication_channels").tabs();
@ -47,12 +63,12 @@ $(document).ready(function() {
});
$(".channel_list tr").hover(function() {
if($(this).hasClass('unconfirmed')) {
var channel_type = "contact";
var title = I18n.t('titles.contact_not_confirmed', 'This contact has not been confirmed. Click the address for more details');
if($(this).closest(".email_channels").length > 0) {
channel_type = "email";
title = I18n.t('titles.email_not_confirmed', 'This email has not been confirmed. Click the address for more details');
}
$(this).attr('title', 'This ' + channel_type + ' has not been confirmed. Click the address for more details');
$(this).find("a.path").parent().attr('title', 'This ' + channel_type + ' has not been confirmed. Click for more details');
$(this).attr('title', title);
$(this).find("a.path").parent().attr('title', title);
}
}, function() {
$(this).attr('title', '');
@ -62,7 +78,7 @@ $(document).ready(function() {
event.preventDefault();
var view = "email";
$("#communication_channels").show().dialog('close').dialog({
title: "Register Communication",
title: I18n.t('titles.register_communication', "Register Communication"),
width: 430,
resizable: false,
modal: true,
@ -104,7 +120,7 @@ $(document).ready(function() {
var $channel = null;
if(path) {
$channel = $list.find(".channel.blank").clone(true).removeClass('blank');
$channel.find(".path").attr('title', "Unconfirmed. Click to confirm");
$channel.find(".path").attr('title', I18n.t('titles.unconfirmed_click_to_confirm', "Unconfirmed. Click to confirm"));
$channel.fillTemplateData({
data: {path: path}
});
@ -137,7 +153,6 @@ $(document).ready(function() {
}
$(this).after($select.clone(true).val(val)).remove();
});
//$(".email_select or .sms_select")
$channel.fillTemplateData({
data: channel,
id: 'channel_' + channel.id,
@ -154,7 +169,7 @@ $(document).ready(function() {
if(data && data.path) {
for(var idx in data.path) {
var error = data.path[idx];
if(error && error.message.match(/has already been activated for another account/)) {
if(error && isAlreadyActivatedError(error.message)) {
var email = $(this).data('email');
$("#claim_email_address_dialog")
.find(":text").val(email || "").end()
@ -162,17 +177,12 @@ $(document).ready(function() {
$("#claim_email_address_dialog").dialog('close').dialog({
autoOpen: false,
width: 400,
title: "Email Address Already Taken"
title: I18n.t('titles.email_address_already_taken', "Email Address Already Taken")
}).dialog('open');
// var message = error.message + "<br/><a href='#' class='email_address_taken_learn_more' style='font-size: 0.8em;'>learn more</a>";
// $channel.parents(".channel_list").errorBox(message);
errored = true;
}
}
}
if(!errored) {
// $channel.parents(".channel_list").formErrors(data); //.errorBox(message); //formErrors(data);
}
$channel.remove();
}
});
@ -202,9 +212,9 @@ $(document).ready(function() {
event.preventDefault();
var $channel = $(this).parents(".channel");
if($channel.hasClass('unconfirmed')) {
var type = "email address", type_proper = "Email Address";
var type = "email address", confirm_title = I18n.t('titles.confirm_email_address', "Confirm Email Address");
if($(this).parents(".channel_list").hasClass('other_channels')) {
type = "sms number", type_proper = "SMS Number";
type = "sms number", confirm_title = I18n.t('titles.confirm_sms_number', "Confirm SMS Number");
}
var $box = $("#confirm_communication_channel");
if($channel.parents(".email_channels").length > 0) {
@ -228,11 +238,11 @@ $(document).ready(function() {
url = $.replaceTags(url, "pseudonym_id", data.pseudonym_id);
url = $.replaceTags(url, "user_id", data.user_id);
$box.find(".re_send_confirmation_link").attr('href', url)
.text("Re-Send Confirmation");
.text(I18n.t('links.resend_confirmation', "Re-Send Confirmation"));
$box.fillFormData(data);
$box.show().dialog('close').dialog({
autoOpen: false,
title: "Confirm " + type_proper,
title: confirm_title,
width: 350,
open: function() {
$(this).find(":text:first").focus().select();
@ -249,7 +259,7 @@ $(document).ready(function() {
$(this).attr('action', url);
},
beforeSubmit: function(data) {
$(this).find(".status_message").text("Confirming...").css('visibility', 'visible');
$(this).find(".status_message").text(I18n.t('confirming_contact', "Confirming...")).css('visibility', 'visible');
},
success: function(data) {
$(this).find(".status_message").css('visibility', 'hidden');
@ -257,10 +267,10 @@ $(document).ready(function() {
$("#channel_" + data.communication_channel.id).removeClass('unconfirmed');
$(".channel.pseudonym_" + pseudonym_id).removeClass('unconfirmed');
$("#confirm_communication_channel").dialog('close');
$.flashMessage("Contact successfully confirmed!");
$.flashMessage(I18n.t('notices.contact_confirmed', "Contact successfully confirmed!"));
},
error: function(data) {
$(this).find(".status_message").text("Confirmation failed. Please try again.");
$(this).find(".status_message").text(I18n.t('errors.confirmation_failed', "Confirmation failed. Please try again."));
}
});
$(".channel_list .channel .default_link").click(function(event) {
@ -279,11 +289,11 @@ $(document).ready(function() {
$(".dialog .re_send_confirmation_link").click(function(event) {
event.preventDefault();
var $link = $(this);
$link.text("Re-Sending...");
$link.text(I18n.t('links.resending_confirmation', "Re-Sending..."));
$.ajaxJSON($link.attr('href'), 'POST', {}, function(data) {
$link.text("Done! Message may take a few minutes.");
$link.text(I18n.t('links.resent_confirmation', "Done! Message may take a few minutes."));
}, function(data) {
$link.text("Request failed. Try again.");
$link.text(I18n.t('links.resend_confirmation_failed', "Request failed. Try again."));
});
});
$("#communication_channels .cancel_button").click(function(event) {
@ -295,27 +305,27 @@ $(document).ready(function() {
});
</script>
<% end %>
<h2>Ways to Contact</h2>
<h2><%= t('headers.ways_to_contact', "Ways to Contact") %></h2>
<div class="rs-margin-lr">
<table class="<%= 'single' if @email_channels.length <= 1 %> summary channel_list email_channels" style="width: 100%; margin-left: 0; margin-right: 0;">
<thead>
<tr>
<th style="padding: 0;">&nbsp;</th>
<th>Email Addresses</th>
<th><%= t('headers.email_addresses', "Email Addresses") %></th>
<th style="padding: 0;" class="hidden_for_single">&nbsp;</th>
</tr>
</thead>
<% @email_channels.each do |c| %>
<tr class="channel <%= "default" if c.position && c.position <= 1 %> <%= "unconfirmed" if c.state == :unconfirmed %> pseudonym_<%= c.pseudonym &&c.pseudonym.id %>" id="channel_<%= c.id %>">
<td style="padding: 0; text-align: center;">
<a href="<%= profile_url %>" class="default_link no-hover"><%= image_tag "star.png", :title => "Default email address" %></a>
<a href="<%= profile_url %>" class="default_link no-hover"><%= image_tag "star.png", :title => t('titles.default_email_address', "Default email address") %></a>
</td>
<td><div style="overflow: hidden; position: relative;">&nbsp;
<div style="position: absolute; top: 0; left: 0; font-size: 0.8em;" title="<%=h c.path %>">
<a href="#" class="path"><%= c.path %></a>
</div></div></td>
<td style="padding: 0; text-align: center;" class="hidden_for_single">
<a href="<%= communication_channel_url(c.id) %>" class="delete_channel_link no-hover"><%= image_tag "delete.png", :title => "Remove email address" %></a>
<a href="<%= communication_channel_url(c.id) %>" class="delete_channel_link no-hover"><%= image_tag "delete.png", :title => t('titles.remove_email_address', "Remove email address") %></a>
<span class="pseudonym_id" style="display: none;"><%= c.pseudonym_id %></span>
<span class="channel_id" style="display: none;"><%= c.id %></span>
<span class="user_id" style="display: none;"><%= c.user_id %></span>
@ -324,7 +334,7 @@ $(document).ready(function() {
<% end %>
<tr class="channel blank unconfirmed" style="display: none;">
<td style="padding: 0; text-align: center;">
<a href="<%= profile_url %>" class="default_link no-hover"><%= image_tag "star.png", :title => "Default email address" %></a>
<a href="<%= profile_url %>" class="default_link no-hover"><%= image_tag "star.png", :title => t('titles.default_email_address', "Default email address") %></a>
</td>
<td><div style="overflow: hidden; position: relative;">&nbsp;
<div style="position: absolute; top: 0; left: 0; font-size: 0.8em;" title="">
@ -339,15 +349,15 @@ $(document).ready(function() {
</tr>
<tr>
<td colspan="3" style="text-align: center;">
<a href="#" class="add_email_link add">Add Email Address</a>
<a href="#" class="add_email_link add"><%= t('links.add_email_address', "Add Email Address") %></a>
</td>
</tr>
</table>
<table class="summary channel_list other_channels" style="width: 100%; margin-left: 0; margin-right: 0;">
<thead>
<tr>
<th>Other Contacts</th>
<th colspan='2'>Type</th>
<th><%= t('headers.other_contact', "Other Contacts") %></th>
<th colspan='2'><%= t('headers.contact_type', "Type") %></th>
</tr>
</thead>
<tbody style="font-size: 0.8em">
@ -356,7 +366,7 @@ $(document).ready(function() {
<td><a href="#" class="path"><%= c.path_description %></a></td>
<td><%= c.path_type %></td>
<td style="padding: 0; text-align: center;">
<a href="<%= communication_channel_url(c.id) %>" class="delete_channel_link no-hover"><%= image_tag "delete.png", :title => "Remove email address", :style => (c.first?) ? "display: none;" : "" %></a>
<a href="<%= communication_channel_url(c.id) %>" class="delete_channel_link no-hover"><%= image_tag "delete.png", :title => t('titles.remove_email_address', "Remove email address"), :style => (c.first?) ? "display: none;" : "" %></a>
<span class="pseudonym_id" style="display: none;"><%= c.pseudonym_id %></span>
<span class="channel_id" style="display: none;"><%= c.id %></span>
<span class="user_id" style="display: none;"><%= c.user_id %></span>
@ -365,7 +375,7 @@ $(document).ready(function() {
<% end %>
<tr class="channel blank unconfirmed" style="display: none;">
<td><a href="#" class="path">&nbsp;</a></td>
<td>sms</td>
<td><%= t('contact_types.sms', "sms") %></td>
<td style="padding: 0; text-align: center;">
<a href="<%= communication_channel_url("{{ channel_id }}") %>" class="delete_channel_link no-hover"><%= image_tag "delete.png" %></a>
<span class="pseudonym_id" style="display: none;">&nbsp;</span>
@ -377,7 +387,7 @@ $(document).ready(function() {
<tfoot>
<tr>
<td colspan="3" style="text-align: center;">
<a href="#" class="add_contact_link add"> Add Contact Method</a>
<a href="#" class="add_contact_link add"> <%= t('links.add_contact_method', "Add Contact Method") %></a>
</td>
</tr>
</tfoot>
@ -385,23 +395,23 @@ $(document).ready(function() {
</div>
<div id="communication_channels" style="display: none;">
<ul>
<li><a href="#register_email_address">Email</a></li>
<li><a href="#register_sms_number">Text (SMS)</a></li>
<li><a href="#register_email_address"><%= t('links.email', "Email") %></a></li>
<li><a href="#register_sms_number"><%= t('links.text_sms', "Text (SMS)") %></a></li>
</ul>
<% form_tag communication_channels_url, {:id => "register_email_address"} do %>
<input type="hidden" name="path_type" value="email"/>
<table>
<tr>
<td style="white-space: nowrap"><%= label :pseudonym, :unique_id, "Email Address:" %></td>
<td style="white-space: nowrap"><%= label :pseudonym, :unique_id, before_label(:email_address, "Email Address") %></td>
<td><%= text_field :pseudonym, :unique_id %></td>
</tr><tr>
<td colspan="2">
<input type="checkbox" id="build_pseudonym_for_email" name="build_pseudonym" value="1"/>
<label for="build_pseudonym_for_email">I want to log in to Canvas using this email address</label>
<label for="build_pseudonym_for_email"><%= t('labels.enable_login_for_email', "I want to log in to Canvas using this email address") %></label>
</td>
</tr><tr>
<td colspan="2">
<button type="submit" class="button">Register Email</button>
<button type="submit" class="button"><%= t('buttons.register_email', "Register Email") %></button>
</td>
</tr>
</table>
@ -410,90 +420,95 @@ $(document).ready(function() {
<input type="hidden" name="path_type" value="sms"/>
<table>
<tr>
<td style="white-space: nowrap; vertical-align: top;">Cell Number:</td>
<td style="white-space: nowrap; vertical-align: top;"><%= before_label(:cell_number, "Cell Number") %></td>
<td>
<input type="text" class="user_selected sms_number"/><br/>
<span style="font-size: 0.8em; color: #a44" class="should_be_10_digits">should be 10-digit number</span>
<span style="font-size: 0.8em; color: #a44" class="should_be_10_digits"><%= t('validations.should_be_10_digits', "should be 10-digit number") %></span>
</td>
</tr><tr>
<td>Carrier:</td>
<td><%= before_label(:carrier, "Carrier") %></td>
<td>
<select class="user_selected carrier">
<option value="other">[Select Carrier]</option>
<option value="#@txt.att.net">AT&amp;T</option>
<option value="#@message.alltel.com">Alltel</option>
<option value="#@myboostmobile.com">Boost</option>
<option value="#@cingularme.com">Cingular</option>
<option value="#@mobile.celloneusa.com">CellularOne</option>
<option value="#@sms.mycricket.com">Cricket</option>
<option value="#@messaging.nextel.com">Nextel</option>
<option value="#@messaging.sprintpcs.com">Sprint PCS</option>
<option value="#@tmomail.net">T-Mobile</option>
<option value="#@vtext.com">Verizon</option>
<option value="#@vmobile.com">Virgin Mobile</option>
<option value="other">Other Carrier</option>
<option value="other"><%= t(:default_carrier_option, "[Select Carrier]") %></option>
<option value="#@txt.att.net"><%= t('carriers.a_t_and_t', "AT&T") %></option>
<option value="#@message.alltel.com"><%= t('carriers.alltel', "Alltel") %></option>
<option value="#@myboostmobile.com"><%= t('carriers.boost', "Boost") %></option>
<option value="#@cingularme.com"><%= t('carriers.cingular', "Cingular") %></option>
<option value="#@mobile.celloneusa.com"><%= t('carriers.cellular_one', "CellularOne") %></option>
<option value="#@sms.mycricket.com"><%= t('carriers.cricket', "Cricket") %></option>
<option value="#@messaging.nextel.com"><%= t('carriers.nextel', "Nextel") %></option>
<option value="#@messaging.sprintpcs.com"><%= t('carriers.sprint_psc', "Sprint PCS") %></option>
<option value="#@tmomail.net"><%= t('carriers.t_mobile', "T-Mobile") %></option>
<option value="#@vtext.com"><%= t('carriers.verizon', "Verizon") %></option>
<option value="#@vmobile.com"><%= t('carriers.virgin_mobile', "Virgin Mobile") %></option>
<option value="other"><%= t('carriers.other', "Other Carrier") %></option>
</select>
</td>
</tr><tr>
<td style="white-space: nowrap; vertical-align: top;">SMS Email:</td>
<td style="white-space: nowrap; vertical-align: top;"><%= before_label(:sms_email, "SMS Email") %></td>
<td>
<%= text_field :pseudonym, :unique_id, :class => "sms_email" %><br/>
</td>
</tr><tr>
<td colspan="2">
<button type="submit" class="button">Register SMS</button>
<button type="submit" class="button"><%= t('buttons.register_sms', "Register SMS") %></button>
</td>
</table>
<% end %>
</div>
<div id="confirm_email_channel" style="display: none;" class="dialog">
<div style="text-align: center;">We emailed a confirmation link to
<span class="path" style="font-weight: bold;">&nbsp;</span>. Click the link in that
email to finish registering. Make sure to check your spam box in case
it got filtered.
</div>
<div style="text-align: center;"><%= t(:sent_confirmation_email, <<-TEXT, :email_address => raw('<span class="path" style="font-weight: bold;">&nbsp;</span>'))
We emailed a confirmation link to %{email_address}. Click the link in that
email to finish registering. Make sure to check your spam box in case it
got filtered.
TEXT
%></div>
<div style="text-align: center; margin: 10px 0; font-weight: bold;">
<a href="#" class="re_send_confirmation_link">Re-Send Confirmation</a>
<a href="#" class="re_send_confirmation_link"><%= t('links.resend_confirmation', "Re-Send Confirmation") %></a>
<a href="<%= re_send_confirmation_url("{{ user_id }}", "{{ id }}") %>" class="re_send_confirmation_url" style="display: none;">&nbsp;</a>
</div>
<div class="button-container">
<button type="button" class="button cancel_button">Ok, Thanks</button>
<button type="button" class="button cancel_button"><%= t('buttons.ok_thanks', "Ok, Thanks") %></button>
</div>
</div>
<% form_tag "", {:id => "confirm_communication_channel", :style => "display: none;", :class => "dialog"} do %>
<input type="hidden" name="pseudonym_id" value=""/>
<input type="hidden" name="channel_id" value=""/>
<input type="hidden" name="user_id" value=""/>
<div style="text-align: center;">We sent a four-character confirmation code to <span class="path" style="font-weight: bold;">&nbsp;</span>.
Enter the code below to activate this <span class="path_type">&nbsp;</span></div>
<div style="text-align: center;"><%= t(:sent_confirmation_sms, <<-TEXT, :sms_number => raw('<span class="path" style="font-weight: bold;">&nbsp;</span>'))
We sent a four-character confirmation code to %{sms_number}.
Enter the code below to activate this sms number.
TEXT
%></div>
<div style="text-align: center;">
<input type="text" style="width: 100px; font-size: 1.5em;" name="code"/><br/>
<!--a href="#" style="font-size: 0.8em;">Re-send code</a-->
<span style="display: none;" class="channel_id">&nbsp;</span>
<a href="<%= communication_channel_confirm_path("{{ id }}", "{{ code }}") %>" style="display: none;" class="register_channel_link">&nbsp;</a>
</div>
<div style="margin: 0 0 5px; text-align: center; font-size: 0.8em;">
<a href="#" class="re_send_confirmation_link">Re-Send Confirmation</a>
<a href="#" class="re_send_confirmation_link"><%= t('links.resend_confirmation', "Re-Send Confirmation") %></a>
</div>
<div class="status_message" style="visibility: hidden; text-align: center; color: #444; font-weight: bold">Confirming...</div>
<div class="status_message" style="visibility: hidden; text-align: center; color: #444; font-weight: bold"><%= t(:confirming_contact, "Confirming...") %></div>
<div class="button-container">
<button type="submit" class="button">Confirm</button>
<button type="submit" class="button"><%= t('buttons.confirm', "Confirm") %></button>
</div>
<% end %>
<div id="claim_email_address_dialog" style="display: none;">
<%= image_tag "email_big.png", :style => "float: left; padding-right: 5px; padding-bottom: 3px;" %>
The address you entered (<b class="user_email">email</b>) is
currently assigned to another user. Email addresses can only be
tied to one user at a time. If you're sure this
address belongs to you and you want to claim it, enter it again in the
form below:
<%= t('errors.address_already_claimed', <<-TEXT, :email => raw('<b class="user_email">email</b>'))
The address you entered (%{email}) is currently assigned to another user.
Email addresses can only be tied to one user at a time. If you're sure this
address belongs to you and you want to claim it, enter it again in the form
below:
TEXT
%>
<% form_for :communication_channel, :url => try_merge_communication_channels_url, :html => {:id => ""} do |f| %>
<div style="margin: 10px; text-align: center;">
<%= f.text_field :path %>
</div>
<div class="button-container">
<button type="submit" class="button">Find Email Address</button>
<button type="button" class="button button-secondary cancel_button">Cancel</button>
<button type="submit" class="button"><%= t('buttons.find_email_address', "Find Email Address") %></button>
<button type="button" class="button button-secondary cancel_button"><%= t('#buttons.cancel', "Cancel") %></button>
</div>
<% end %>
</div>

View File

@ -1,21 +1,17 @@
<%
add_crumb(@user.short_name, profile_path )
add_crumb("Notification Preferences", communication_profile_path )
%>
<% content_for :page_title do %>Notification Preferences<% end %>
<% content_for :page_title do %><%= t(:page_title, "Notification Preferences") %><% end %>
<% content_for :right_side do %>
<%= render :partial => "ways_to_contact" %>
<% if service = @current_user.user_services.find_by_service('twitter') %>
<div class='rs-margin-lr' style="text-align: right;">
<a href="#" id="no_tweets" class="help">Not Receiving Tweets?</a>
<a href="#" id="no_tweets" class="help"><%= t('links.not_receiving_tweets', "Not Receiving Tweets?") %></a>
<div id="no_tweets_dialog">
</div>
</div>
<% end %>
<% end %>
<% js_block do %>
<% js_block :i18n_scope => 'profile.communication' do %>
<script>
$(document).ready(function() {
$(".notification_preferences .frequency").click(function(event) {
@ -38,7 +34,6 @@ $(document).ready(function() {
$prev = $prev.prev(".preference");
}
$next.find(".contact_type_select").change();
// $next.addClass('event_pending').find(":input").attr('disabled', true);
});
$(".delete_preference_link").bind('click', function(event, skipAnimate) {
event.preventDefault();
@ -86,7 +81,6 @@ $(document).ready(function() {
$(".save_preferences_button").click(function(event) {
event.preventDefault();
var $button = $(this);
//$("html,body").scrollTo({top: $(".notification_preferences").offset().top});
$(".notification_preferences").loadingImage();
var data = $(".notification_preferences").getFormData();
$(".notification_preferences tr.preference").each(function() {
@ -106,16 +100,15 @@ $(document).ready(function() {
}
});
var url = $("#contact_urls .update_communication_url").filter(":last").attr('href');
$button.text("Saving Preferences...").attr('disabled', true);
$button.text(I18n.t('buttons.saving_preferences', "Saving Preferences...")).attr('disabled', true);
$.ajaxJSON(url, 'POST', data, function(data) {
$button.text("Saved Preferences!").attr('disabled', false);
$button.text(I18n.t('buttons.saved_preferences', "Saved Preferences!")).attr('disabled', false);
setTimeout(function() {
$button.text("Save Preferences");
$button.text(I18n.t('buttons.save_preferences', "Save Preferences"));
}, 2500);
$.flashMessage('Communication Preferences updated');
$.flashMessage(I18n.t('notices.communication_preferences_updated', 'Communication Preferences updated'));
$(".notification_preferences").loadingImage('remove');
$("tr.preference .frequency.selected_pending").removeClass('selected_pending').addClass('selected');
//location.reload();
var found = {};
$("tr.preference").each(function() {
var slug = $(this).getTemplateData({textValues: ['category_slug']}).category_slug;
@ -146,9 +139,9 @@ $(document).ready(function() {
}
$("tr.preference .frequency.selected_pending").removeClass('selected_pending').addClass('selected');
}, function(data) {
$button.text("Problem Saving Preferences").attr('disabled', false);
$button.text(I18n.t('buttons.problem_saving_preferences', "Problem Saving Preferences")).attr('disabled', false);
$(".notification_preferences").loadingImage('remove');
$.flashError('Oops! Something broke. Try saving again');
$.flashError(I18n.t('errors.saving_preferences_failed', 'Oops! Something broke. Try saving again'));
});
});
$(".sms_select, .email_select").change(function() {
@ -223,11 +216,11 @@ $(document).ready(function() {
<table class="notification_preferences" cellspacing="0">
<tr>
<td colspan="2"><h2>Notification Preferences</h2></td>
<td class="frequency_header">Right Away</td>
<td class="frequency_header">Daily</td>
<td class="frequency_header">Weekly</td>
<td class="frequency_header">Never</td>
<td colspan="2"><h2><%= t('headers.notification_preferences', "Notification Preferences") %></h2></td>
<td class="frequency_header"><%= t('frequencies.right_away', "Right Away") %></td>
<td class="frequency_header"><%= t('frequencies.daily', "Daily") %></td>
<td class="frequency_header"><%= t('frequencies.weekly', "Weekly") %></td>
<td class="frequency_header"><%= t('frequencies.never', "Never") %></td>
<td>&nbsp;</td>
</tr>
<% @notification_categories.each do |n| %>
@ -235,6 +228,6 @@ $(document).ready(function() {
<% end %>
</table>
<p class="button-container">
<button type="button" class="save_preferences_button button">Save Preferences</button>
<button type="button" class="save_preferences_button button"><%= t('buttons.save_preferences', "Save Preferences") %></button>
</p>

View File

@ -1,12 +1,12 @@
<% content_for :page_title do %>
Profile - <%= @user.name %>
<%= t(:page_title, "Profile - %{user}", :user => @user.name) %>
<% end %>
<% content_for :right_side do %>
<%= render :partial => "ways_to_contact" %>
<div class="rs-margin-lr">
<hr />
<a href="#" class="edit_profile_link button button-sidebar-wide"><%= image_tag "edit.png" %> Edit Profile</a>
<a href="#" class="edit_profile_link button button-sidebar-wide"><%= image_tag "edit.png" %> <%= t('links.edit_profile', "Edit Profile") %></a>
</div>
<% end %>
@ -14,31 +14,31 @@
<% jammit_css :profile %>
<% if service_enabled?(:avatars) %>
<a href="#" class="profile_pic_link <%= @user.avatar_state %>" title="Click to change profile pic" style="float: left; margin-right: 5px; min-width: 50px; min-height: 50px; display: inline-block;">
<a href="#" class="profile_pic_link <%= @user.avatar_state %>" title="<%= t('titles.click_to_change_profile_pic', "Click to change profile pic") %>" style="float: left; margin-right: 5px; min-width: 50px; min-height: 50px; display: inline-block;">
<%= avatar_image(@user.id) %>
</a>
<% end %>
<h2 style="padding-top: 0.3em;"><%= @user.short_name %>'s Profile</h2>
<h2 style="padding-top: 0.3em;"><%= t('headers.users_profile', "%{user}'s Profile", :user => @user.short_name) %></h2>
<div class="clear"></div>
<% form_for @user, :url => profile_url, :html => {:id => "update_profile_form", :style => "margin-bottom: 20px;"} do |f| %>
<table class="profile_table">
<tr>
<td><%= f.label :name, "Full Name:" %></td>
<td><%= f.blabel :name, :en => "Full Name" %></td>
<td><span class="full_name display_data"><%=h @user.name %></span>
<%= f.text_field :name, :class => "edit_data" %>
<span class="edit_or_show_data" style="font-size: 0.8em; color: #888;"><br/>This name will be used by teachers for grading.</span>
<span class="edit_or_show_data" style="font-size: 0.8em; color: #888;"><br/><%= t('hints.name', "This name will be used by teachers for grading.") %></span>
</tr>
<tr>
<td><%= f.label :short_name, "Display Name:" %></td>
<td><%= f.blabel :short_name, :en => "Display Name" %></td>
<td><span class="short_name display_data"><%=h @user.short_name %></span>
<%= f.text_field :short_name, :class => "edit_data" %>
<span class="edit_or_show_data" style="font-size: 0.8em; color: #888;"><br/>People will see this name in discussions, messages and comments.</span>
<span class="edit_or_show_data" style="font-size: 0.8em; color: #888;"><br/><%= t('hints.short_name', "People will see this name in discussions, messages and comments.") %></span>
</td>
</tr>
<% active_email_channels = @email_channels.select { |cc| cc.active? } %>
<% if active_email_channels.length > 1 %>
<tr>
<td><label for="default_email_id">Default Email:</label></td>
<td><label for="default_email_id"><%= before_label(:default_email, "Default Email") %></label></td>
<td>
<span class="default_email unique_id display_data"><%=h @default_email_channel.path %></span>
<select id="default_email_id" name="default_email_id" class="default_email edit_data">
@ -50,10 +50,10 @@
</tr>
<% end %>
<tr>
<td><%= f.label :time_zone, "Time Zone:" %></td>
<td><%= f.blabel :time_zone, :en => "Time Zone" %></td>
<td>
<span class="time_zone display_data"><%= @user.time_zone || "None" %></span>
<span class="edit_data"><%= f.time_zone_select :time_zone, ActiveSupport::TimeZone.us_zones, :default => ((@domain_root_account && @domain_root_account.default_time_zone) || "Mountain Time (US & Canada)") %></span>
<span class="edit_data"><%= f.time_zone_select :time_zone, ActiveSupport::TimeZone.us_zones, :model => I18nTimeZone, :default => ((@domain_root_account && @domain_root_account.default_time_zone) || "Mountain Time (US & Canada)") %><%# that default time zone is a value, not text %></span>
</td>
</tr>
<% if @domain_root_account == Account.default %>
@ -61,19 +61,19 @@
<td colspan="2">
<div class="edit_data">
<%= f.check_box :subscribe_to_emails %>
<%= f.label :subscribe_to_emails, "I want to receive information, news and tips from Instructure" %>
<%= f.label :subscribe_to_emails, :en => "I want to receive information, news and tips from Instructure" %>
</div>
</td>
</tr>
<% end %>
<% if !@password_pseudonyms.empty? %>
<tr class="edit_data_row select_change_password_row" style="display: none;">
<td>Password:</td>
<td><input type="checkbox" id="change_password_checkbox" name="pseudonym[change_password]" value="1"/><label for="change_password_checkbox">Change Password</label></td>
<td><%= before_label(:password, "Password") %></td>
<td><input type="checkbox" id="change_password_checkbox" name="pseudonym[change_password]" value="1"/><label for="change_password_checkbox"><%= t('labels.change_password', "Change Password") %></label></td>
</tr>
<% end %>
<tr class="change_password_row" style="display: none;">
<td class="nobr"><label for="profile_pseudonym_id">Password For:</label></td>
<td class="nobr"><label for="profile_pseudonym_id"><%= before_label(:password_for, "Password For") %></label></td>
<td>
<select name="pseudonym[password_id]" id="profile_pseudonym_id">
<% @password_pseudonyms.each do |p| %>
@ -82,41 +82,37 @@
</select>
</td>
</tr>
<!--tr class="change_password_row" style="display: none;">
<td>Old Password:</td>
<td><input type="password" name="old_password" value="" style="width: 150px;"/></td>
</tr-->
<tr class="change_password_row" style="display: none;">
<td><label for="old_password">Old Password:</label></td>
<td><label for="old_password"><%= before_label(:old_password, "Old Password") %></label></td>
<td><input type="password" style="width: 150px;" id="old_password" name="pseudonym[old_password]"/></td>
</tr>
<tr class="change_password_row" style="display: none;">
<td><%= label :pseudonym, :password, "New Password:" %></td>
<td><%= label :pseudonym, :password, before_label(:new_password, "New Password") %></td>
<td><%= password_field :pseudonym, :password, :value => "", :style => "width: 150px;" %></td>
</tr>
<tr class="change_password_row" style="display: none;">
<td><%= label :pseudonym, :password_confirmation, "Confirm Password:" %></td>
<td><%= label :pseudonym, :password_confirmation, before_label(:confirm_password, "Confirm Password") %></td>
<td><%= password_field :pseudonym, :password_confirmation, :value => "", :style => "width: 150px;" %></td>
</tr>
<tr class="edit_data_row more_options_link_row" style="display: none;">
<td colspan="2"><a href="#" class="more_options_link" style="display: none;">more options</a></td>
<td colspan="2"><a href="#" class="more_options_link" style="display: none;"><%= t('links.more_options', "more options") %></a></td>
</tr>
<tr class="edit_data_row" style="display: none;">
<td colspan="2">
<p><a style="font-size: 0.9em" href="<%= user_delete_url(@user.id) %>" class="admin">Delete My Profile </a></p>
<button type="submit" class="button">Update Profile</button>
<button type="button" class="cancel_button button-secondary">Cancel</button>
<p><a style="font-size: 0.9em" href="<%= user_delete_url(@user.id) %>" class="admin"><%= t('links.delete_profile', "Delete My Profile") %> </a></p>
<button type="submit" class="button"><%= t('buttons.update_profile', "Update Profile") %></button>
<button type="button" class="cancel_button button-secondary"><%= t('#buttons.cancel', "Cancel") %></button>
</td>
</tr>
</table>
<% end %>
<div style="<%= hidden unless @pseudonyms.length > 1 %> margin-bottom: 20px;">
<h2>Ways to Log In</h2>
<h2><%= t('headers.ways_to_log_in', "Ways to Log In") %></h2>
<table class="summary pseudonym_list">
<thead>
<tr>
<th>Organization</th>
<th>Login</th>
<th><%= t('headers.organization', "Organization") %></th>
<th><%= t('headers.login', "Login") %></th>
<th>&nbsp;</th>
</tr>
</thead>
@ -126,49 +122,52 @@
<td><%= p.account_name %></td>
<td><a href="<%= login_url(:host => HostUrl.context_host(p.account)) %>" class="not_external"><%= p.unique_id %></a></td>
<td>
<a class="delete_pseudonym_link no-hover" href="<%= profile_pseudonym_url(p.id) %>" style="<%= hidden if p.managed_password? %>" title="Remove account from this profile"><%= image_tag "delete.png" %></a>
<a class="delete_pseudonym_link no-hover" href="<%= profile_pseudonym_url(p.id) %>" style="<%= hidden if p.managed_password? %>" title="<%= t('titles.remove_account_from_profile', "Remove account from this profile") %>"><%= image_tag "delete.png" %></a>
</td>
</tr>
<% end %>
<% end %>
</table>
<div style="text-align: center; display: none;">
<a href="#" class="add">Add Account</a>
<a href="#" class="add"><%= t('links.add_account', "Add Account") %></a>
</div>
</div>
<% unless @domain_root_account && @domain_root_account.service_enabled?(:none) %>
<a name="registered_web_services"></a>
<h2>Web Services</h2>
<p>Canvas can make your life a lot easier by tying itself in with the web tools
you already use. Click any of the services in "Other Services" to see what we mean.</p>
<h2><%= t('headers.web_services', "Web Services") %></h2>
<p><%= t(:web_services, <<-TEXT)
Canvas can make your life a lot easier by tying itself in with the web tools
you already use. Click any of the services in "Other Services" to see what we mean.
TEXT
%></p>
<p>
<input type="checkbox" id="show_user_services" <%= 'checked' if @user.show_user_services %>/><label for="show_user_services">Let fellow course/group members see which services I've linked to my profile</label>
<input type="checkbox" id="show_user_services" <%= 'checked' if @user.show_user_services %>/><label for="show_user_services"><%= t('labels.show_user_services', "Let fellow course/group members see which services I've linked to my profile") %></label>
</p>
<table style="width: 100%;"><tr>
<td style="vertical-align: top; width: 50%; padding-right: 20px;">
<h3>Registered Services</h3>
<h3><%= t('headers.registered_services', "Registered Services") %></h3>
<div style="margin-left: 20px; margin-bottom: 20px;">
<ul id="registered_services" class="unstyled_list">
<% @user.user_services.select{|s| !UserService.configured_service?(s.service) || feature_and_service_enabled?(s.service) }.each do |service| %>
<li class="service" id="service_<%= service.service %>">
<a href="<%= profile_user_service_url(service.id) %>" class="delete_service_link no-hover" style="float: right; padding-top: 0.5em; padding-right: 10px;" title="Unregister Service"><%= image_tag "delete_circle.png" %></a>
<a href="<%= profile_user_service_url(service.id) %>" class="delete_service_link no-hover" style="float: right; padding-top: 0.5em; padding-right: 10px;" title="<%= t('titles.unregister_service', "Unregister Service") %>"><%= image_tag "delete_circle.png" %></a>
<a href="<%= service.service_access_link %>">
<%= image_tag "#{service.service}.png", :style => "vertical-align: middle; float: left;" %>
</a>
<div style="float: left; padding-left: 5px;">
<%= service.service.titleize rescue "Unknown" %>
<%= service.service.titleize rescue t(:unknown_service, "Unknown") %>
<div style="font-size: 0.6em; line-height: 0.5em;">
<% if service.has_profile_link? %>
<a href="<%= service.service_user_link %>">
view your profile
<%= t('links.view_your_profile', "view your profile") %>
</a>
<% elsif service.has_readable_user_name? %>
<span><%= service.service_user_name %></span>
<% end %>
<% if service.service == 'facebook' && feature_and_service_enabled?(:facebook) && Facebook.config['canvas_name'] %>
<div style="line-height: 2.0em;">
<a href="<%= service.service_access_link %>">view the Facebook app</a>
<a href="<%= service.service_access_link %>"><%= t('links.view_facebook_app', "view the Facebook app") %></a>
</div>
<% end %>
</div>
@ -181,40 +180,46 @@ you already use. Click any of the services in "Other Services" to see what we m
<span class="service">&nbsp;</span>
</li>
</ul>
<%= "No Registered Services" if @user.user_services.empty? %>
<%= t(:no_registered_services, "No Registered Services") if @user.user_services.empty? %>
</div>
</td>
<td style="vertical-align: top; width: 50%; padding-left: 20px;">
<h3>Other Services</h3>
<h3><%= t('headers.other_services', "Other Services") %></h3>
<div style="margin-left: 20px;">
Click any service below to register:
<%= before_label(:other_services, "Click any service below to register") %>
<% services = @user.user_services.map{|s| s.service} %>
<ul id="unregistered_services" class="unstyled_list">
<li id="unregistered_service_google_docs" class="service" style="<%= hidden if !feature_and_service_enabled?(:google_docs) || services.include?("google_docs") %>">
<a href="#" class="button small-button"><%= image_tag "google_docs_icon.png" %> Google Docs</a>
<div style="display: none; text-align: left;" class="content" title="Authorize Google Docs" id="unregistered_service_google_docs_dialog">
<a href="#" class="button small-button"><%= image_tag "google_docs_icon.png" %> <%= t('links.google_docs', "Google Docs") %></a>
<div style="display: none; text-align: left;" class="content" title="<%= t('titles.authorize_google_docs', "Authorize Google Docs") %>" id="unregistered_service_google_docs_dialog">
<div>
<%= image_tag "google_docs.png", :style => "float: left; padding-right: 5px;" %>
<div style="font-size: 1.2em; font-weight: bold;">Google Docs Access</div>
<div style="font-size: 1.2em; font-weight: bold;"><%= t('headers.google_docs_access', "Google Docs Access") %></div>
<%= t(:google_docs_description, <<-TEXT)
Once you authorize us to see your Google Docs you'll be able to submit your assignments
directly from Google Docs, and create and share documents with members of your classes.
TEXT
%>
<div class="clear"></div>
</div>
<div style="text-align: center; margin-top: 10px;">
<a class='button' href="<%= oauth_url(:service => "google_docs", :return_to => profile_url) %>">Authorize Google Docs Access</a>
<a class='button' href="<%= oauth_url(:service => "google_docs", :return_to => profile_url) %>"><%= t('buttons.authorize_google_docs', "Authorize Google Docs Access") %></a>
</div>
</div>
</li>
<li id="unregistered_service_skype" class="service" style="<%= hidden if services.include?("skype") %>">
<a href="#" class="button small-button"><%= image_tag "skype_icon.png" %> Skype</a>
<div style="display: none; text-align: left;" class="content" title="Register Skype" id="unregistered_service_skype_dialog">
<a href="#" class="button small-button"><%= image_tag "skype_icon.png" %> <%= t('links.skype', "Skype") %></a>
<div style="display: none; text-align: left;" class="content" title="<%= t('titles.register_skype', "Register Skype") %>" id="unregistered_service_skype_dialog">
<div>
<%= image_tag "skype.png", :style => "float: left; padding-right: 5px;" %>
<div style="font-size: 1.2em; font-weight: bold;">Share your Skype ID</div>
<div style="font-size: 1.2em; font-weight: bold;"><%= t('headers.share_skype_id', "Share your Skype ID") %></div>
<%= t(:skype_description, <<-TEXT)
Skype offers free online voice and video calls. Lots of students use
Skype as a free, easy way to communicate. If you register your Skype Name
and enable visibility, then other students can easily find your contact
and call or add you using Skype.
TEXT
%>
<div class="clear"></div>
</div>
<div style="text-align: center; font-size: 1.2em; margin-top: 10px;">
@ -222,11 +227,11 @@ you already use. Click any of the services in "Other Services" to see what we m
<%= f.hidden_field :service, :value => "skype" %>
<table class="formtable">
<tr>
<td><%= f.label :user_name, "Skype Name:" %></td>
<td><%= f.blabel :user_name, :skype_name, :en => "Skype Name" %></td>
<td><%= f.text_field :user_name, :style => "width: 150px;" %></td>
</tr><tr>
<td colspan="2">
<button type="submit" class="button">Save Skype Name</button>
<button type="submit" class="button"><%= t('buttons.save_skype_name', "Save Skype Name") %></button>
</td>
</tr>
</table>
@ -235,73 +240,82 @@ you already use. Click any of the services in "Other Services" to see what we m
</div>
</li>
<li id="unregistered_service_facebook" class="service" style="<%= hidden if !feature_and_service_enabled?(:facebook) || services.include?("facebook") %>">
<a href="#" class="button small-button"><%= image_tag "facebook_icon.png" %> Facebook</a>
<div style="display: none; text-align: left;" class="content" title="Authorize Facebook" id="unregistered_service_facebook_dialog">
<a href="#" class="button small-button"><%= image_tag "facebook_icon.png" %> <%= t('links.facebook', "Facebook") %></a>
<div style="display: none; text-align: left;" class="content" title="<%= t('titles.authorize_facebook', "Authorize Facebook") %>" id="unregistered_service_facebook_dialog">
<div>
<%= image_tag "facebook.png", :style => "float: left; padding-right: 5px;" %>
<div style="font-size: 1.2em; font-weight: bold;">Facebook Access</div>
<div style="font-size: 1.2em; font-weight: bold;"><%= t('headers.facebook_access', "Facebook Access") %></div>
<%= t(:facebook_description, <<-TEXT)
If you have a Facebook account, you can install the Canvas app and receive
course notifications on your profile. You can specify which types of
notifications you want and how often you'd like them sent.
TEXT
%>
<div class="clear"></div>
</div>
<div style="text-align: center; font-size: 1.2em; margin-top: 10px;">
<a class="button" href="<%= oauth_url(:service => "facebook", :return_to => profile_url) %>">Register Your Facebook Account</a>
<a class="button" href="<%= oauth_url(:service => "facebook", :return_to => profile_url) %>"><%= t('buttons.register_facebook_account', "Register Your Facebook Account") %></a>
</div>
</div>
</li>
<li id="unregistered_service_linked_in" class="service" style="<%= hidden if services.include?("linked_in") || !feature_and_service_enabled?(:linked_in) %>">
<a href="#" class="button small-button"><%= image_tag "linked_in_icon.png" %> LinkedIn</a>
<div style="display: none; text-align: left;" class="content" title="Authorize LinkedIn" id="unregistered_service_linked_in_dialog">
<a href="#" class="button small-button"><%= image_tag "linked_in_icon.png" %> <%= t('links.linkedin', "LinkedIn") %></a>
<div style="display: none; text-align: left;" class="content" title="<%= t('titles.authorize_linkedin', "Authorize LinkedIn") %>" id="unregistered_service_linked_in_dialog">
<div>
<%= image_tag "linked_in.png", :style => "float: left; padding-right: 5px;" %>
<div style="font-size: 1.2em; font-weight: bold;">LinkedIn Access</div>
<div style="font-size: 1.2em; font-weight: bold;"><%= t('headers.linkedin_access', "LinkedIn Access") %></div>
<%= t(:linkedin_description, <<-TEXT)
LinkedIn is a great resources for business networking, and can be
helpful long after you've finished your education.
If you have a LinkedIn account, you can register it here. Then if you
allow fellow course/group members to see your registered services, they
can easily invite you to link with them without having to search LinkedIn
for your profile.
TEXT
%>
<div class="clear"></div>
</div>
<div style="text-align: center; font-size: 1.2em; margin-top: 10px;">
<a class="button" href="<%= oauth_url(:service => "linked_in", :return_to => profile_url) %>">Register Your LinkedIn Account</a>
<a class="button" href="<%= oauth_url(:service => "linked_in", :return_to => profile_url) %>"><%= t('buttons.register_linkedin_account', "Register Your LinkedIn Account") %></a>
</div>
</div>
</li>
<li id="unregistered_service_twitter" class="service" style="<%= hidden if services.include?("twitter") || !feature_and_service_enabled?(:twitter) %>">
<a href="#" class="button small-button"><%= image_tag "twitter_icon.png" %> Twitter</a>
<div style="display: none; text-align: left;" class="content" title="Authorize Twitter" id="unregistered_service_twitter_dialog">
<a href="#" class="button small-button"><%= image_tag "twitter_icon.png" %> <%= t('links.twitter', "Twitter") %></a>
<div style="display: none; text-align: left;" class="content" title="<%= t('titles.authorize_twitter', "Authorize Twitter") %>" id="unregistered_service_twitter_dialog">
<div>
<%= image_tag "twitter.png", :style => "float: left; padding-right: 5px;" %>
<div style="font-size: 1.2em; font-weight: bold;">Twitter Access</div>
<p>
Twitter is a service for posting and subscribing to short messages.
If you have a Twitter account, you can register it here. Then if you allow
fellow course/group members to see your registered services, they can
easily connect with your Twitter account.
</p>
<p>
You can also sign up to have notifications sent to your Twitter account.
These notifications will be sent as direct messages to yourself from
yourself, and won't appear in your public stream.
</p>
<div style="font-size: 1.2em; font-weight: bold;"><%= t('headers.twitter_access', "Twitter Access") %></div>
<%= mt(:twitter_description, <<-TEXT)
Twitter is a service for posting and subscribing to short messages.
If you have a Twitter account, you can register it here. Then if you allow
fellow course/group members to see your registered services, they can
easily connect with your Twitter account.
You can also sign up to have notifications sent to your Twitter account.
These notifications will be sent as direct messages to yourself from
yourself, and won't appear in your public stream.
TEXT
%>
<div class="clear"></div>
</div>
<div style="text-align: center; margin-top: 10px;">
<a class="button" href="<%= oauth_url(:service => "twitter", :return_to => profile_url) %>">Authorize Twitter Access</a>
<a class="button" href="<%= oauth_url(:service => "twitter", :return_to => profile_url) %>"><%= t('buttons.authorize_twitter', "Authorize Twitter Access") %></a>
</div>
</div>
</li>
<li id="unregistered_service_delicious" class="service" style="<%= hidden if services.include?("delicious") %>">
<a href="#" class="button small-button"><%= image_tag "delicious_icon.png" %> Delicious</a>
<div style="display: none; text-align: left;" class="content" title="Delicious Login" id="unregistered_service_delicious_dialog">
<a href="#" class="button small-button"><%= image_tag "delicious_icon.png" %> <%= t('links.delicious', "Delicious") %></a>
<div style="display: none; text-align: left;" class="content" title="<%= t('titles.delicious_login', "Delicious Login") %>" id="unregistered_service_delicious_dialog">
<div>
<%= image_tag "delicious.png", :style => "float: left; padding-right: 5px;" %>
<div style="font-size: 1.2em; font-weight: bold;">Delicious Login</div>
<div style="font-size: 1.2em; font-weight: bold;"><%= t('headers.delicious_login', "Delicious Login") %></div>
<%= t(:delicious_description, <<-TEXT)
Delicious is a tool that lets you store and share your bookmarks with others.
Canvas's rich content editor will let you search your Delicious tags
to easily link from within Canvas to other resources you find useful.
TEXT
%>
<div class="clear"></div>
</div>
<div style="font-size: 1.0em; margin-top: 10px;">
@ -309,14 +323,14 @@ you already use. Click any of the services in "Other Services" to see what we m
<%= f.hidden_field :service, :value => "delicious" %>
<table class="formtable">
<tr>
<td><%= f.label :user_name, "User Name:" %></td>
<td><%= f.blabel :user_name, :en => "User Name" %></td>
<td><%= f.text_field :user_name, :style => "width: 150px;" %></td>
</tr><tr>
<td><%= f.label :password, "Password:" %></td>
<td><%= f.blabel :password, :en => "Password" %></td>
<td><%= f.password_field :password, :style => "width: 150px;" %></td>
</tr><tr>
<td colspan="2">
<button type="submit" class="button">Save Login</button>
<button type="submit" class="button"><%= t('buttons.save_login', "Save Login") %></button>
</td>
</tr>
</table>
@ -325,15 +339,18 @@ you already use. Click any of the services in "Other Services" to see what we m
</div>
</li>
<li id="unregistered_service_diigo" class="service" style="<%= hidden if services.include?("diigo") %>">
<a href="#" class="button small-button"><%= image_tag "diigo_icon.png" %> Diigo</a>
<div style="display: none; text-align: left;" class="content" title="Diigo Login" id="unregistered_service_diigo_dialog">
<a href="#" class="button small-button"><%= image_tag "diigo_icon.png" %> <%= t('links.diigo', "Diigo") %></a>
<div style="display: none; text-align: left;" class="content" title="<%= t('titles.diigo_login', "Diigo Login") %>" id="unregistered_service_diigo_dialog">
<div>
<%= image_tag "diigo.png", :style => "float: left; padding-right: 5px;" %>
<div style="font-size: 1.2em; font-weight: bold;">Diigo Login</div>
<div style="font-size: 1.2em; font-weight: bold;"><%= t('headers.diigo_login', "Diigo Login") %></div>
<%= t(:diigo_description, <<-TEXT)
Diigo is a social bookmarking tool tailored specifically to research and
education.
Canvas's rich content editor will let you search your Diigo tags
to easily link from within Canvas to other resources you find useful.
TEXT
%>
<div class="clear"></div>
</div>
<div style="font-size: 1.0em; margin-top: 10px;">
@ -341,14 +358,14 @@ you already use. Click any of the services in "Other Services" to see what we m
<%= f.hidden_field :service, :value => "diigo" %>
<table class="formtable">
<tr>
<td><%= f.label :user_name, "User Name:" %></td>
<td><%= f.blabel :user_name, :en => "User Name" %></td>
<td><%= f.text_field :user_name, :style => "width: 150px;" %></td>
</tr><tr>
<td><%= f.label :password, "Password:" %></td>
<td><%= f.blabel :password, :en => "Password" %></td>
<td><%= f.password_field :password, :style => "width: 150px;" %></td>
</tr><tr>
<td colspan="2">
<button type="submit" class="button">Save Login</button>
<button type="submit" class="button"><%= t('buttons.save_login', "Save Login") %></button>
</td>
</tr>
</table>
@ -361,24 +378,28 @@ you already use. Click any of the services in "Other Services" to see what we m
</td>
</tr></table>
<% end %>
<h3>Approved Integrations:</h3>
<h3><%= before_label(:'headers.approved_integrations', "Approved Integrations") %></h3>
<div style="margin-left: 20px;">
<% if @user.access_tokens.empty? %>
<div id="no_approved_integrations">
<div id="no_approved_integrations"><%= t(:no_approved_integrations, <<-TEXT)
Third-party applications can request permission to access
the Canvas site on your behalf. As you begin authorizing
applications you will see them listed here.
</div>
TEXT
%></div>
<% end %>
<div id="access_tokens_holder" style="<%= hidden if @user.access_tokens.empty? %>">
<%= t(:approved_integrations, <<-TEXT)
These are the third-party applications you have authorized
to access the Canvas site on your behalf:
TEXT
%>
<table id="access_tokens" class="summary" style="margin-top: 10px;">
<thead>
<tr>
<th>App</th>
<th>Purpose</th>
<th>Dates</th>
<th><%= t('headers.application_abbrev', "App") %></th>
<th><%= t('headers.purpose', "Purpose") %></th>
<th><%= t('headers.dates', "Dates") %></th>
<th>&nbsp;</th>
<th>&nbsp;</th>
</tr>
@ -390,81 +411,82 @@ you already use. Click any of the services in "Other Services" to see what we m
</table>
</div>
<div style="margin-top: 10px;">
<a href="#" class="button add_access_token_link"><%= image_tag "add.png" %> New Access Token</a>
<a href="#" class="button add_access_token_link"><%= image_tag "add.png" %> <%= t('buttons.new_access_token', "New Access Token") %></a>
</div>
<div id="token_details_dialog" style="display: none;" title="Access Token Details">
<p>
Access tokens can be used to allow other applications to make
API calls on your behalf. You can also generate access tokens and
<a href="http://instructure.github.com/canvas-lms/doc/api/index.html" target="_blank" class="external">
use the Canvas Open API
</a>
to come up with your own integrations.
</p>
<div id="token_details_dialog" style="display: none;" title="<%= t('titles.access_token_details', "Access Token Details") %>">
<p><%= t(:access_token_description, <<-TEXT, :wrapper => '<a href="http://instructure.github.com/canvas-lms/doc/api/index.html" target="_blank" class="external">\1</a>')
Access tokens can be used to allow other applications to make API calls
on your behalf. You can also generate access tokens and *use the Canvas
Open API* to come up with your own integrations.
TEXT
%></p>
<div class="loading_message">Loading Token Details...</div>
<div class="error_loading_message">Error Loading Token Details</div>
<div class="loading_message"><%= t(:loading_token_details, "Loading Token Details...") %></div>
<div class="error_loading_message"><%= t(:error_loading_token_details, "Error Loading Token Details") %></div>
<div class="results">
<table>
<tr>
<th>Token:</th>
<th><%= before_label(:token, "Token") %></th>
<td>
<div class="visible_token">&nbsp;</div>
<div class="full_token_warning"><strong>Copy this token down now</strong>. Once you
leave this page you won't be able to retrieve the full token anymore, you'll
have to regenerate it to get a new value.
</div>
<div class="full_token_warning"><%= mt(:full_token_warning, <<-TEXT)
**Copy this token down now**. Once you leave this page you won't be able to
retrieve the full token anymore, you'll have to regenerate it to get a new
value.
TEXT
%></div>
</td>
</tr><tr>
<th>App:</th>
<th><%= before_label(:token_application, "App") %></th>
<td class="app_name">&nbsp;</td>
</tr><tr>
<th>Purpose:</th>
<th><%= before_label(:token_purpose, "Purpose") %></th>
<td class="purpose">&nbsp;</td>
</tr><tr>
<th>Created:</th>
<th><%= before_label(:token_created, "Created") %></th>
<td class="created">&nbsp;</td>
</tr><tr>
<th>Last Used:</th>
<th><%= before_label(:token_last_used, "Last Used") %></th>
<td class="used">&nbsp;</td>
</tr><tr>
<th>Expires:</th>
<th><%= before_label(:token_expires, "Expires") %></th>
<td class="expires">&nbsp;</td>
</tr><tr class="refresh_token">
<td colspan="2">
<div class="button-container">
<button class="button regenerate_token">Regenerate Token</button>
<button class="button regenerate_token"><%= t('buttons.regenerate_token', "Regenerate Token") %></button>
</div>
</td>
</tr>
</table>
</div>
</div>
<div id="add_access_token_dialog" style="display: none;" title="New Access Token">
<h2>Generate an Access Token</h2>
Access tokens are what allow third-party applications to access Canvas
resources on your behalf. These tokens are normally created automatically
for applications as needed, but if
<a href="http://instructure.github.com/canvas-lms/doc/api/index.html">
you're developing a new or limited
project</a> you can just generate the token from here.
<div id="add_access_token_dialog" style="display: none;" title="<%= t('titles.new_access_token', "New Access Token") %>">
<h2><%= t('headers.generate_access_token', "Generate an Access Token") %></h2>
<%= mt(:generate_access_token_description, <<-TEXT, :documentation_url => 'http://instructure.github.com/canvas-lms/doc/api/index.html')
Access tokens are what allow third-party applications to access Canvas
resources on your behalf. These tokens are normally created automatically for
applications as needed, but if [you're developing a new or limited
project](%{documentation_url}) you can just generate the token from here.
TEXT
%>
<% form_for :access_token, :url => profile_tokens_url, :html => {:id => "access_token_form", :style => "margin-top: 10px;"} do |f| %>
<table class="formtable">
<tr>
<td><%= f.label :purpose, "Purpose:" %></td>
<td><%= f.blabel :purpose, :en => "Purpose" %></td>
<td><%= f.text_field :purpose %></td>
</tr>
<tr>
<td><%= f.label :expires_at, "Expires:" %></td>
<td><%= f.blabel :expires_at, :en => "Expires" %></td>
<td>
<div><%= f.text_field :expires_at, :class => "expires_field datetime_field", :style => "width: 120px;" %></div>
<div style="font-size: 0.8em;" class="hint">leave blank for no expiration</div>
<div style="font-size: 0.8em;" class="hint"><%= t('hints.expires_at', "leave blank for no expiration") %></div>
</td>
</tr>
<td colspan="2">
<div class="button-container">
<button class="button submit_button" type="submit">Generate Token</button>
<button class="button button-secondary cancel_button" type="button">Cancel</button>
<button class="button submit_button" type="submit"><%= t('buttons.generate_token', "Generate Token") %></button>
<button class="button button-secondary cancel_button" type="button"><%= t('#buttons.cancel', "Cancel") %></button>
</div>
</td>
</tr>
@ -474,19 +496,19 @@ you already use. Click any of the services in "Other Services" to see what we m
</div>
<div id="profile_pic_dialog" style="display: none;">
<a href="<%= profile_pics_url %>" class="profile_pics_url" style="display: none;">&nbsp;</a>
Select the image you'd like to use as your profile pic, or upload a new image:
<%= t(:profile_pictures, "Select the image you'd like to use as your profile pic, or upload a new image:") %>
<div class="profile_pic_list" style="background: #eee; padding: 5px; -moz-border-radius: 5px; margin: 5px 10px;">
<h3 style="padding-left: 10px; padding-top: 10px;">Loading Images...</h3>
<h3 style="padding-left: 10px; padding-top: 10px;"><%= t('headers.loading_images', "Loading Images...") %></h3>
<div class="clear"></div>
</div>
<a href="#" class="add_pic_link add">Upload a new Image</a>
<a href="#" class="add_pic_link add"><%= t('links.upload_new_image', "Upload a new Image") %></a>
<% form_for :attachment, :url => context_url(@user, :context_files_url), :html => {:id => "add_pic_form", :style => "display: none;"} do |f| %>
<input type="hidden" name="format" value="text" />
<%= f.file_field :uploaded_data %>
<button type="submit" class="button small-button">Add File</button>
<button type="submit" class="button small-button"><%= t('buttons.add_picture_file', "Add File") %></button>
<% end %>
<div class="button-container">
<button type="button" class="button select_button">Select Image</button>
<button type="button" class="button cancel_button button-secondary">Cancel</button>
<button type="button" class="button select_button"><%= t('buttons.select_image', "Select Image") %></button>
<button type="button" class="button cancel_button button-secondary"><%= t('#buttons.cancel', "Cancel") %></button>
</div>
</div>

6
lib/i18n_time_zone.rb Normal file
View File

@ -0,0 +1,6 @@
class I18nTimeZone < ActiveSupport::TimeZone
def to_s
translated_name = I18n.t(:timezones)[name] || name
"(GMT#{formatted_offset}) #{translated_name}"
end
end

View File

@ -16,6 +16,8 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
I18n.scoped('profile', function(I18n) {
$(function() {
var $profile_table = $(".profile_table"),
$update_profile_form = $("#update_profile_form"),
@ -63,7 +65,7 @@ $(function() {
property_validations: {
'=default_email_id': function(val, data) {
if($("#default_email_id").length && (!val || val == "new")) {
return "Please select an option";
return I18n.t('please_select_an_option', "Please select an option");
}
}
},
@ -122,7 +124,7 @@ $(function() {
document.location.reload();
},
error: function(data) {
$(this).loadingImage('remove').errorBox('Registration failed. Check the user name and password, and try again.');
$(this).loadingImage('remove').errorBox(I18n.t('errors.registration_failed', 'Registration failed. Check the user name and password, and try again.'));
}
});
$("#unregistered_services li.service .content form .cancel_button").click(function(event) {
@ -131,7 +133,7 @@ $(function() {
$("#registered_services li.service .delete_service_link").click(function(event) {
event.preventDefault();
$(this).parents("li.service").confirmDelete({
message: "Are you sure you want to unregister this service?",
message: I18n.t('confirms.unregister_service', "Are you sure you want to unregister this service?"),
url: $(this).attr('href'),
success: function(data) {
$(this).slideUp(function() {
@ -154,7 +156,7 @@ $(function() {
event.preventDefault();
$(this).parents(".pseudonym").confirmDelete({
url: $(this).attr('href'),
message: "Are you sure you want to delete this login?"
message: I18n.t('confirms.delete_login', "Are you sure you want to delete this login?")
});
});
$(".datetime_field").datetime_field();
@ -165,7 +167,7 @@ $(function() {
event.preventDefault();
$(this).closest(".access_token").confirmDelete({
url: $(this).attr('rel'),
message: "Are you sure you want to delete this access key?",
message: I18n.t('confirms.delete_access_key', "Are you sure you want to delete this access key?"),
success: function() {
$(this).remove();
if(!$(".access_token:visible").length) {
@ -181,16 +183,16 @@ $(function() {
object_name: 'access_token',
required: ['purpose'],
beforeSubmit: function() {
$(this).find("button").attr('disabled', true).filter(".submit_button").text("Generating Token...");
$(this).find("button").attr('disabled', true).filter(".submit_button").text(I18n.t('buttons.generating_token', "Generating Token..."));
},
success: function(data) {
$(this).find("button").attr('disabled', false).filter(".submit_button").text("Generate Token");
$(this).find("button").attr('disabled', false).filter(".submit_button").text(I18n.t('buttons.generate_token', "Generate Token"));
$("#add_access_token_dialog").dialog('close');
$("#no_approved_integrations").hide()
$("#access_tokens_holder").show();
var $token = $(".access_token.blank:first").clone(true).removeClass('blank');
data.created = $.parseFromISO(data.created_at).datetime_formatted || "--";
data.expires = $.parseFromISO(data.expires_at).datetime_formatted || "never";
data.expires = $.parseFromISO(data.expires_at).datetime_formatted || I18n.t('token_never_expires', "never");
data.used = "--";
$token.fillTemplateData({
data: data,
@ -201,29 +203,29 @@ $(function() {
$token.find(".show_token_link").click();
},
error: function() {
$(this).find("button").attr('disabled', false).filter(".submit_button").text("Generating Token Failed");
$(this).find("button").attr('disabled', false).filter(".submit_button").text(I18n.t('errors.generating_token_failed', "Generating Token Failed"));
}
});
$("#token_details_dialog .regenerate_token").click(function() {
var result = confirm("Are you sure you want to regenerate this token? Anything using this token will have to be updated.");
var result = confirm(I18n.t('confirms.regenerate_token', "Are you sure you want to regenerate this token? Anything using this token will have to be updated."));
if(!result) { return; }
var $dialog = $("#token_details_dialog");
var $token = $dialog.data('token');
var url = $dialog.data('token_url');
var $button = $(this);
$button.text("Regenerating token...").attr('disabled', true);
$button.text(I18n.t('buttons.regenerating_token', "Regenerating token...")).attr('disabled', true);
$.ajaxJSON(url, 'PUT', {'access_token[regenerate]': '1'}, function(data) {
data.created = $.parseFromISO(data.created_at).datetime_formatted || "--";
data.expires = $.parseFromISO(data.expires_at).datetime_formatted || "never";
data.expires = $.parseFromISO(data.expires_at).datetime_formatted || I18n.t('token_never_expires', "never");
data.used = $.parseFromISO(data.last_used_at).datetime_formatted || "--";
data.visible_token = data.visible_token || "protected";
$dialog.fillTemplateData({data: data})
.find(".full_token_warning").showIf(data.visible_token.length > 10);
$token.data('token', data);
$button.text("Regenerate Token").attr('disabled', false);
$button.text(I18n.t('buttons.regenerate_token', "Regenerate Token")).attr('disabled', false);
}, function() {
$button.text("Regenerating Token Failed").attr('disabled', false);
$button.text(I18n.t('errors.regenerating_token_failed', "Regenerating Token Failed")).attr('disabled', false);
});
});
$(".show_token_link").click(function(event) {
@ -242,7 +244,7 @@ $(function() {
$dialog.fillTemplateData({data: token});
$dialog.data('token_url', url);
$dialog.find(".refresh_token").showIf(token.visible_token && token.visible_token !== "protected")
.find(".regenerate_token").text("Regenerate Token").attr('disabled', false);
.find(".regenerate_token").text(I18n.t('buttons.regenerate_token', "Regenerate Token")).attr('disabled', false);
$dialog.find(".loading_message,.error_loading_message").hide().end()
.find(".results").show().end()
.find(".full_token_warning").showIf(token.visible_token.length > 10);
@ -253,7 +255,7 @@ $(function() {
} else {
$.ajaxJSON(url, 'GET', {}, function(data) {
data.created = $.parseFromISO(data.created_at).datetime_formatted || "--";
data.expires = $.parseFromISO(data.expires_at).datetime_formatted || "never";
data.expires = $.parseFromISO(data.expires_at).datetime_formatted || I18n.t('token_never_expires', "never");
data.used = $.parseFromISO(data.last_used_at).datetime_formatted || "--";
data.visible_token = data.visible_token || "protected";
$token.data('token', data);
@ -267,7 +269,7 @@ $(function() {
});
$(".add_access_token_link").click(function(event) {
event.preventDefault();
$("#access_token_form").find("button").attr('disabled', false).filter(".submit_button").text("Generate Token");
$("#access_token_form").find("button").attr('disabled', false).filter(".submit_button").text(I18n.t('buttons.generate_token', "Generate Token"));
$("#add_access_token_dialog").find(":input").val("").end()
.dialog({
width: 500
@ -296,7 +298,7 @@ $(function() {
$("#add_pic_form").formSubmit({
fileUpload: true,
beforeSubmit: function() {
$(this).find("button").attr('disabled', true).text("Adding File...");
$(this).find("button").attr('disabled', true).text(I18n.t('buttons.adding_file', "Adding File..."));
var $span = $("<span class='img'><img/></span>");
var $img = $span.find("img");
$img.attr('src', '/images/ajax-loader.gif');
@ -304,7 +306,7 @@ $(function() {
return $img;
},
success: function(data, $img) {
$(this).find("button").attr('disabled', false).text("Add File");
$(this).find("button").attr('disabled', false).text(I18n.t('buttons.add_file', "Add File"));
var attachment = data.attachment;
if($img) {
$img.removeClass('pending');
@ -319,7 +321,7 @@ $(function() {
}
},
error: function(data, $img) {
$(this).find("button").attr('disabled', false).text("Adding File Failed");
$(this).find("button").attr('disabled', false).text(I18n.t('errors.adding_file_failed', "Adding File Failed"));
if($img) {
$img.remove();
}
@ -331,7 +333,7 @@ $(function() {
$("#profile_pic_dialog .select_button").click(function() {
var url = $("#update_profile_form").attr('action');
var $dialog = $("#profile_pic_dialog");
$dialog.find("button").attr('disabled', true).filter(".select_button").text("Selecting Image...");
$dialog.find("button").attr('disabled', true).filter(".select_button").text(I18n.t('buttons.selecting_image', "Selecting Image..."));
var $img = $("#profile_pic_dialog .profile_pic_list .img.selected img");
if($img.length == 0) {
return;
@ -342,7 +344,7 @@ $(function() {
'user[avatar_image][type]': $img.attr('data-type')
};
$.ajaxJSON(url, 'PUT', data, function(data) {
$dialog.find("button").attr('disabled', false).filter(".select_button").text("Select Image");
$dialog.find("button").attr('disabled', false).filter(".select_button").text(I18n.t('buttons.select_image', "Select Image"));
var user = data.user;
if(user.avatar_url == '/images/no_pic.gif') {
user.avatar_url = '/images/dotted_pic.png';
@ -350,7 +352,7 @@ $(function() {
$(".profile_pic_link img").attr('src', user.avatar_url);
$dialog.dialog('close');
}, function(data) {
$dialog.find("button").attr('disabled', false).filter(".select_button").text("Selecting Image Failed, please try again");
$dialog.find("button").attr('disabled', false).filter(".select_button").text(I18n.t('errors.selecting_image_failed', "Selecting Image Failed, please try again"));
});
});
$(".profile_pic_link").click(function(event) {
@ -359,11 +361,11 @@ $(function() {
$dialog.find(".img.selected").removeClass('selected');
$dialog.find(".select_button").attr('disabled', true);
if($(this).hasClass('locked')) {
alert("Your profile picture has been locked by an administrator, and cannot be changed.");
alert(I18n.t('alerts.profile_picture_locked', "Your profile picture has been locked by an administrator, and cannot be changed."));
return;
}
if(!$dialog.hasClass('loaded')) {
$dialog.find(".profile_pic_list h3").text("Loading Images...");
$dialog.find(".profile_pic_list h3").text(I18n.t('headers.loading_images', "Loading Images..."));
$.ajaxJSON($(".profile_pics_url").attr('href'), 'GET', {}, function(data) {
if(data && data.length > 0) {
$dialog.addClass('loaded')
@ -382,15 +384,15 @@ $(function() {
$dialog.find(".profile_pic_list div").before($span);
}
} else {
$dialog.find(".profile_pic_list h3").text("Loading Images Failed, please try again");
$dialog.find(".profile_pic_list h3").text(I18n.t('errors.loading_images_failed', "Loading Images Failed, please try again"));
}
}, function(data) {
$dialog.find(".profile_pic_list h3").text("Loading Images Failed, please try again");
$dialog.find(".profile_pic_list h3").text(I18n.t('errors.loading_images_failed', "Loading Images Failed, please try again"));
});
}
$("#profile_pic_dialog").dialog('close').dialog({
autoOpen: false,
title: "Select Profile Pic",
title: I18n.t('titles.select_profile_pic', "Select Profile Pic"),
width: 500,
height: 300
}).dialog('open');
@ -409,3 +411,5 @@ $(function() {
};
setTimeout(checkImage, 500);
});
})