add hifi link to table, make table icons anchors

This commit is contained in:
Stephen Birarda 2015-05-15 17:12:19 -07:00
parent 60a8dc1eb3
commit edf9042ed5
2 changed files with 36 additions and 19 deletions

View file

@ -78,6 +78,11 @@ td.reorder-buttons .glyphicon {
display: inherit; display: inherit;
} }
td a.glyphicon {
color: black;
text-decoration: none;
}
tr.new-row { tr.new-row {
color: #3c763d; color: #3c763d;
background-color: #dff0d8; background-color: #dff0d8;

View file

@ -173,6 +173,8 @@ $(document).ready(function(){
// set focus to the first input in the new row // set focus to the first input in the new row
$(this).closest('table').find('tr.inputs input:first').focus() $(this).closest('table').find('tr.inputs input:first').focus()
} }
e.preventDefault();
} }
}); });
@ -208,7 +210,7 @@ $(document).ready(function(){
chooseFromHighFidelityDomains($(this)) chooseFromHighFidelityDomains($(this))
}); });
$('#' + Settings.FORM_ID).on('click', '#' + Settings.GET_TEMPORARY_NAME_ID, function(){ $('#' + Settings.FORM_ID).on('click', '#' + Settings.GET_TEMPORARY_NAME_BTN_ID, function(){
$(this).blur(); $(this).blur();
createTemporaryDomain(); createTemporaryDomain();
}); });
@ -496,6 +498,11 @@ function setupPlacesTable() {
{ {
"name": "path", "name": "path",
"label": "Path" "label": "Path"
},
{
"name": "edit",
"label": "",
"class": "buttons"
} }
] ]
} }
@ -519,13 +526,16 @@ function setupPlacesTable() {
} }
function placeTableRow(name, path, isTemporary) { function placeTableRow(name, path, isTemporary) {
if (!isTemporary) { var name_link = "<a href='hifi://" + name + "'>" + name + "</a>";
var name_link = "<a href='" + Settings.METAVERSE_URL + "/user/places/" + name + "/edit'>" + name + "</a>";
if (isTemporary) {
var editColumn = "<td class='buttons'></td>";
} else { } else {
var name_link = name; var editColumn = "<td class='buttons'><a class='glyphicon glyphicon-pencil'"
+ " href='" + Settings.METAVERSE_URL + "/user/places/" + name + "/edit" + "'</a></td>";
} }
return "<tr><td>" + name_link + "</td><td>" + path + "</td></tr>"; return "<tr><td>" + name_link + "</td><td>" + path + "</td>" + editColumn + "</tr>";
} }
function placeTableRowForPlaceObject(place) { function placeTableRowForPlaceObject(place) {
@ -637,10 +647,11 @@ function chooseFromHighFidelityDomains(clickedButton) {
function createTemporaryDomain() { function createTemporaryDomain() {
swal({ swal({
title: 'Create temporary place name', title: 'Create temporary place name',
text: 'This will create a temporary place name and domain ID so other users can easily connect to your domain.', text: "This will create a temporary place name and domain ID (valid for 30 days) so other users can easily connect to your domain.",
showCancelButton: true, showCancelButton: true,
confirmButtonText: 'Create', confirmButtonText: 'Create',
closeOnConfirm: false closeOnConfirm: false,
html: true
}, function(isConfirm){ }, function(isConfirm){
if (isConfirm) { if (isConfirm) {
showSpinnerAlert('Creating temporary place name'); showSpinnerAlert('Creating temporary place name');
@ -757,15 +768,15 @@ function makeTable(setting, keypath, setting_value, isLocked) {
} }
_.each(setting.columns, function(col) { _.each(setting.columns, function(col) {
html += "<td class='data'><strong>" + col.label + "</strong></td>" // Data html += "<td class='data " + (col.class ? col.class : '') + "'><strong>" + col.label + "</strong></td>" // Data
}) })
if (!isLocked && !setting.read_only) { if (!isLocked && !setting.read_only) {
if (setting.can_order) { if (setting.can_order) {
html += "<td class=" + Settings.REORDER_BUTTONS_CLASSES + html += "<td class=" + Settings.REORDER_BUTTONS_CLASSES +
"><span class='glyphicon glyphicon-sort'></span></td>"; "><a href='javascript:void(0);' class='glyphicon glyphicon-sort'></a></td>";
} }
html += "<td class=" + Settings.ADD_DEL_BUTTONS_CLASSES + "></td></tr>" html += "<td class='" + Settings.ADD_DEL_BUTTONS_CLASSES + "'></td></tr>"
} }
// populate rows in the table from existing values // populate rows in the table from existing values
@ -804,11 +815,11 @@ function makeTable(setting, keypath, setting_value, isLocked) {
if (!isLocked && !setting.read_only) { if (!isLocked && !setting.read_only) {
if (setting.can_order) { if (setting.can_order) {
html += "<td class='" + Settings.REORDER_BUTTONS_CLASSES+ html += "<td class='" + Settings.REORDER_BUTTONS_CLASSES+
"'><span class='" + Settings.MOVE_UP_SPAN_CLASSES + "'></span><span class='" + "'><a href='javascript:void(0);' class='" + Settings.MOVE_UP_SPAN_CLASSES + "'></a>"
Settings.MOVE_DOWN_SPAN_CLASSES + "'></span></td>" + "<a href='javascript:void(0);' class='" + Settings.MOVE_DOWN_SPAN_CLASSES + "'></a></td>"
} }
html += "<td class='" + Settings.ADD_DEL_BUTTONS_CLASSES + html += "<td class='" + Settings.ADD_DEL_BUTTONS_CLASSES +
"'><span class='" + Settings.DEL_ROW_SPAN_CLASSES + "'></span></td>" "'><a href='javascript:void(0);' class='" + Settings.DEL_ROW_SPAN_CLASSES + "'></a></td>"
} }
html += "</tr>" html += "</tr>"
@ -850,7 +861,7 @@ function makeTableInputs(setting) {
html += "<td class='" + Settings.REORDER_BUTTONS_CLASSES + "'></td>" html += "<td class='" + Settings.REORDER_BUTTONS_CLASSES + "'></td>"
} }
html += "<td class='" + Settings.ADD_DEL_BUTTONS_CLASSES + html += "<td class='" + Settings.ADD_DEL_BUTTONS_CLASSES +
"'><span class='glyphicon glyphicon-plus " + Settings.ADD_ROW_BUTTON_CLASS + "'></span></td>" "'><a href='javascript:void(0);' class='glyphicon glyphicon-plus " + Settings.ADD_ROW_BUTTON_CLASS + "'></a></td>"
html += "</tr>" html += "</tr>"
return html return html
@ -956,13 +967,14 @@ function addTableRow(add_glyphicon) {
$(element).html(1) $(element).html(1)
} }
} else if ($(element).hasClass(Settings.REORDER_BUTTONS_CLASS)) { } else if ($(element).hasClass(Settings.REORDER_BUTTONS_CLASS)) {
$(element).html("<td class='" + Settings.REORDER_BUTTONS_CLASSES + "'><span class='" + Settings.MOVE_UP_SPAN_CLASSES + $(element).html("<td class='" + Settings.REORDER_BUTTONS_CLASSES + "'><a href='javascript:void(0);'"
"'></span><span class='" + Settings.MOVE_DOWN_SPAN_CLASSES + "'></span></td>") + " class='" + Settings.MOVE_UP_SPAN_CLASSES + "'></a><a href='javascript:void(0);' class='"
+ Settings.MOVE_DOWN_SPAN_CLASSES + "'></span></td>")
} else if ($(element).hasClass(Settings.ADD_DEL_BUTTONS_CLASS)) { } else if ($(element).hasClass(Settings.ADD_DEL_BUTTONS_CLASS)) {
// Change buttons // Change buttons
var span = $(element).children("span") var anchor = $(element).children("a")
span.removeClass(Settings.ADD_ROW_SPAN_CLASSES) anchor.removeClass(Settings.ADD_ROW_SPAN_CLASSES)
span.addClass(Settings.DEL_ROW_SPAN_CLASSES) anchor.addClass(Settings.DEL_ROW_SPAN_CLASSES)
} else if ($(element).hasClass("key")) { } else if ($(element).hasClass("key")) {
var input = $(element).children("input") var input = $(element).children("input")
$(element).html(input.val()) $(element).html(input.val())