Change initial tab in the share modal
This commit is contained in:
parent
71d2f8388d
commit
e35b1712c3
@ -187,7 +187,8 @@ define([
|
|||||||
dialog.tabs = function (tabs) {
|
dialog.tabs = function (tabs) {
|
||||||
var contents = [];
|
var contents = [];
|
||||||
var titles = [];
|
var titles = [];
|
||||||
tabs.forEach(function (tab) {
|
var active = 0;
|
||||||
|
tabs.forEach(function (tab, i) {
|
||||||
if (!tab.content || !tab.title) { return; }
|
if (!tab.content || !tab.title) { return; }
|
||||||
var content = h('div.alertify-tabs-content', tab.content);
|
var content = h('div.alertify-tabs-content', tab.content);
|
||||||
var title = h('span.alertify-tabs-title', tab.title);
|
var title = h('span.alertify-tabs-title', tab.title);
|
||||||
@ -203,10 +204,11 @@ define([
|
|||||||
});
|
});
|
||||||
titles.push(title);
|
titles.push(title);
|
||||||
contents.push(content);
|
contents.push(content);
|
||||||
|
if (tab.active) { active = i; }
|
||||||
});
|
});
|
||||||
if (contents.length) {
|
if (contents.length) {
|
||||||
$(contents[0]).addClass('alertify-tabs-content-active');
|
$(contents[active]).addClass('alertify-tabs-content-active');
|
||||||
$(titles[0]).addClass('alertify-tabs-active');
|
$(titles[active]).addClass('alertify-tabs-active');
|
||||||
}
|
}
|
||||||
return h('div.alertify-tabs', [
|
return h('div.alertify-tabs', [
|
||||||
h('div.alertify-tabs-titles', titles),
|
h('div.alertify-tabs-titles', titles),
|
||||||
|
|||||||
@ -1185,13 +1185,15 @@ define([
|
|||||||
|
|
||||||
// Create modal
|
// Create modal
|
||||||
var tabs = [{
|
var tabs = [{
|
||||||
title: Messages.share_linkCategory,
|
|
||||||
icon: "fa fa-link",
|
|
||||||
content: frameLink
|
|
||||||
}, {
|
|
||||||
title: Messages.share_contactCategory,
|
title: Messages.share_contactCategory,
|
||||||
icon: "fa fa-address-book",
|
icon: "fa fa-address-book",
|
||||||
content: frameContacts
|
content: frameContacts,
|
||||||
|
active: hasFriends
|
||||||
|
}, {
|
||||||
|
title: Messages.share_linkCategory,
|
||||||
|
icon: "fa fa-link",
|
||||||
|
content: frameLink,
|
||||||
|
active: !hasFriends
|
||||||
}, {
|
}, {
|
||||||
title: Messages.share_embedCategory,
|
title: Messages.share_embedCategory,
|
||||||
icon: "fa fa-code",
|
icon: "fa fa-code",
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user