Sanitize projects UI elements -- project selector, etc.

This commit is contained in:
bfederle 2012-03-14 14:59:15 -07:00
parent c4c68e2995
commit afbf97465a

View File

@ -90,7 +90,7 @@
$.each(item, function(arrayKey, arrayValue) { $.each(item, function(arrayKey, arrayValue) {
var $arrayElem = $li.find('[data-list-item=' + arrayKey + ']'); var $arrayElem = $li.find('[data-list-item=' + arrayKey + ']');
$arrayElem.html(arrayValue); $arrayElem.html(_s(arrayValue));
}); });
$li.attr({ title: item.description }); $li.attr({ title: item.description });
@ -103,7 +103,7 @@
if ($item.hasClass('chart-line')) { if ($item.hasClass('chart-line')) {
$item.show().animate({ width: value + '%' }); $item.show().animate({ width: value + '%' });
} else { } else {
$item.hide().html(value).fadeIn(); $item.hide().html(_s(value)).fadeIn();
} }
}); });
} }
@ -151,7 +151,7 @@
var $field = $('<div>').addClass('field'); var $field = $('<div>').addClass('field');
var $label = $('<label>').attr({ var $label = $('<label>').attr({
'for': resource.type 'for': resource.type
}).html(resource.label); }).html(_s(resource.label));
var $input = $('<input>').attr({ var $input = $('<input>').attr({
type: 'text', type: 'text',
name: resource.type, name: resource.type,
@ -324,18 +324,18 @@
var $confirm = $('<div>').addClass('confirm'); var $confirm = $('<div>').addClass('confirm');
// Update title with project name // Update title with project name
$newProject.find('.title').html(args.data.name); $newProject.find('.title').html(_s(args.data.name));
// Show field data // Show field data
$confirm.append($projectName).find('input').replaceWith( // Name $confirm.append($projectName).find('input').replaceWith( // Name
$('<span>').addClass('value').html( $('<span>').addClass('value').html(_s(
args.data.name args.data.name
) ))
); );
$confirm.append($projectDesc).find('input').replaceWith( // Display text $confirm.append($projectDesc).find('input').replaceWith( // Display text
$('<span>').addClass('value').html( $('<span>').addClass('value').html(_s(
args.data.displayText args.data.displayText
) ))
); );
var $buttons = $('<div>').addClass('buttons'); var $buttons = $('<div>').addClass('buttons');
@ -354,8 +354,8 @@
$newProject.find('.title').html( $newProject.find('.title').html(
cloudStack.projects.requireInvitation() ? cloudStack.projects.requireInvitation() ?
_l('label.invite.to') + ' ' + args.data.name : _l('label.invite.to') + ' ' + _s(args.data.name) :
_l('label.add.accounts.to') + ' ' + args.data.name _l('label.add.accounts.to') + ' ' + _s(args.data.name)
); );
$nextButton.appendTo($userManagement).click(function() { $nextButton.appendTo($userManagement).click(function() {
$newProject.find('.title').html(_l('label.review')); $newProject.find('.title').html(_l('label.review'));
@ -366,14 +366,14 @@
// Basic project data // Basic project data
$review.append($projectData); $review.append($projectData);
$projectData.append($projectName).find('input').replaceWith( // Name $projectData.append($projectName).find('input').replaceWith( // Name
$('<span>').addClass('value').html( $('<span>').addClass('value').html(_s(
args.data.name args.data.name
) ))
); );
$projectData.append($projectDesc).find('input').replaceWith( // Display text $projectData.append($projectDesc).find('input').replaceWith( // Display text
$('<span>').addClass('value').html( $('<span>').addClass('value').html(_s(
args.data.displayText args.data.displayText
) ))
); );
// User/resouce tabs // User/resouce tabs
@ -536,14 +536,14 @@
$('<li>') $('<li>')
.data('json-obj', this) .data('json-obj', this)
.html(displayText) .html(_s(displayText))
.appendTo($list.find('ul')); .appendTo($list.find('ul'));
// Populate project select // Populate project select
$('<option>') $('<option>')
.appendTo($projectSelect) .appendTo($projectSelect)
.data('json-obj', this) .data('json-obj', this)
.html(displayText); .html(_s(displayText));
}); });
cloudStack.evenOdd($list, 'li', { cloudStack.evenOdd($list, 'li', {
@ -598,7 +598,7 @@
showDashboard(); showDashboard();
var $switcher = $('.select.project-view'); var $switcher = $('.select.project-view');
var projectName = cloudStack.context.projects[0].name; var projectName = _s(cloudStack.context.projects[0].name);
$switcher.attr('title', projectName); $switcher.attr('title', projectName);
if (projectName.length > 10) { if (projectName.length > 10) {
@ -615,7 +615,7 @@
$projectSelect $projectSelect
.find('option').attr('selected', '') .find('option').attr('selected', '')
.filter(function() { .filter(function() {
return $(this).data('json-obj').name == cloudStack.context.projects[0].name; return $(this).data('json-obj').name == _s(cloudStack.context.projects[0].name);
}).attr('selected', 'selected'); }).attr('selected', 'selected');
//// ////