Update to tabs. Styling needs work

This commit is contained in:
Erik Ziegler committed 2015-10-20 15:45:27 +02:00
1 parent 7217b7c67d
commit f7e6bee94f
29 files changed
+257 -200

No files matched your search

@@ -2,7 +2,7 @@
<li role="presentation" class="tabTitle">
<a data-target="#{{contentid}}" role="tab" data-toggle="tab">
{{title}}
<a class="close">x</a>
</a>
<a class="close">x</a>
</li>
</template>
@@ -1,21 +1,21 @@
Template.tabTitle.events({
'click .close': function(e) {
var tab = $(e.currentTarget).parents('[data-toggle="tab"]').eq(0);
var contentId = tab.data("target").replace("#","");
var tab = $(e.currentTarget).siblings('a[data-toggle="tab"]').eq(0);
var contentId = tab.data("target").replace("#", "");
var tabObjectId = tabs.find({contentid: contentId}).fetch()[0]._id;
tabs.remove(tabObjectId);
var tabIndex = tab.index();
var tabIndex = tab.parent('li').index();
var newActiveTabIndex = Math.max(tabIndex - 1, 0);
if (newActiveTabIndex === 0) {
$('a[data-target="#worklistTab"]').addClass('active').tab('show');
return;
}
var newActiveTab = $(".tabTitle").eq(newActiveTabIndex);
var newContentId = newActiveTab.data("contentid");
var newActiveTabLink = newActiveTab.find("a[data-toggle=tab]");
var newContentId = newActiveTabLink.data("target");
switchToTab(newContentId);
}
});
var tabObject = tabs.find({contentId: newContentId}).fetch()[0];
tabObject.active = true;
Template.tabTitle.helpers({
'active': function() {
return this.active ? "active" : "";
}
});
@@ -1,8 +1 @@
.tabTitle
a
padding: 0 5px
a.close
font-size: 16pt
padding: 0 5px
font-weight: normal