| Total Complexity | 6 |
| Complexity/F | 1.5 |
| Lines of Code | 32 |
| Function Count | 4 |
| Duplicated Lines | 0 |
| Ratio | 0 % |
| Changes | 1 | ||
| Bugs | 0 | Features | 0 |
| 1 | Mivhak.component('tabs', { |
||
| 2 | template: '<div class="mivhak-tabs"></div>', |
||
| 3 | props: { |
||
| 4 | mivhakInstance: null, |
||
| 5 | activeTab: null, |
||
| 6 | tabs: [] |
||
| 7 | }, |
||
| 8 | created: function() { |
||
| 9 | var $this = this; |
||
| 10 | this.$el = this.mivhakInstance.$selection.find('pre').wrapAll(this.$el).parent(); |
||
| 11 | $.each(this.mivhakInstance.resources.data,function(i, resource){ |
||
| 12 | if(resource.visible) |
||
| 13 | $this.tabs.push(Mivhak.render('tab-pane',{ |
||
| 14 | resource: resource, |
||
| 15 | index: i, |
||
| 16 | mivhakInstance: $this.mivhakInstance |
||
| 17 | })); |
||
| 18 | }); |
||
| 19 | }, |
||
| 20 | methods: { |
||
| 21 | showTab: function(index){ |
||
| 22 | var $this = this; |
||
| 23 | $.each(this.tabs, function(i, tab){ |
||
| 24 | if(index === i) { |
||
| 25 | $this.mivhakInstance.activeTab = tab; |
||
| 26 | tab.show(); |
||
| 27 | } |
||
| 28 | else tab.hide(); |
||
| 29 | }); |
||
| 30 | } |
||
| 31 | } |
||
| 32 | }); |