Commit 7af33951378b1d7914bacb0163f0765d60afdd10
1 parent
6b262842
przełączanie zakładek bez zakładek
--HG-- branch : beta
Showing
3 changed files
with
39 additions
and
17 deletions
dictionary/static/css/reader_view.css
... | ... | @@ -86,6 +86,22 @@ div#settings-menu p { |
86 | 86 | margin-left: 20px; |
87 | 87 | } |
88 | 88 | |
89 | +#settings-menu .switch-tab { | |
90 | + position: relative; | |
91 | + cursor: pointer; | |
92 | +} | |
93 | + | |
94 | +#settings-menu .switch-tab .ui-icon { | |
95 | + display: none; | |
96 | +} | |
97 | + | |
98 | +#settings-menu .switch-tab.active .ui-icon { | |
99 | + display: block; | |
100 | + position: absolute; | |
101 | + top: 3px; | |
102 | + left: -22px; | |
103 | +} | |
104 | + | |
89 | 105 | div#settings-menu a { |
90 | 106 | color: white; |
91 | 107 | text-decoration: none; |
... | ... |
dictionary/static/js/reader-view.js
... | ... | @@ -8,6 +8,21 @@ var AJAX_URLS = { |
8 | 8 | $(function () { |
9 | 9 | "use strict"; |
10 | 10 | var sort_rules = slickgrid.loader.getSort(); |
11 | + $('#variant0').hide(); | |
12 | + $('[data-tab=variant1]').addClass('active'); | |
13 | + var divs = $('#right').children('div'); | |
14 | + $('.switch-tab').click(function() { | |
15 | + var $t = $(this); | |
16 | + var tab_id = $t.attr('data-tab'); | |
17 | + var tab = $('#' + tab_id); | |
18 | + if (tab.html() === '') { | |
19 | + edit.load_tab(tab_id, edit.get_id()); | |
20 | + } | |
21 | + divs.hide(); | |
22 | + tab.show(); | |
23 | + $('.switch-tab').removeClass('active'); | |
24 | + $t.addClass('active'); | |
25 | + }); | |
11 | 26 | function set_sort() { |
12 | 27 | // copypasta z lexeme-view.js |
13 | 28 | slickgrid.update_sort_button(sort_rules); |
... | ... | @@ -76,7 +91,6 @@ var edit = { |
76 | 91 | }, |
77 | 92 | load_content: function(id, is_created, check_callback) { |
78 | 93 | "use strict"; |
79 | - var tabs = $('#lexeme-tabs'); | |
80 | 94 | $.ajaxJSON({ |
81 | 95 | url: $dj.ajax_get_entry, |
82 | 96 | method: 'get', |
... | ... | @@ -87,12 +101,10 @@ var edit = { |
87 | 101 | common.update_hash('' + id + '/' + data.entry); |
88 | 102 | } |
89 | 103 | }); |
90 | - tabs.find('.ui-tabs-panel').each(function(i, tab) { | |
91 | - $(tab).empty(); | |
92 | - }); | |
93 | - var tab_no = tabs.tabs('option', 'active'); | |
94 | - var tab_id = tabs.children().get(tab_no + 1).id; | |
95 | - edit.load_tab(tab_id, id, check_callback); | |
104 | + var divs = $('#right').children('div'); | |
105 | + divs.empty(); | |
106 | + var current_div = divs.filter(':visible'); | |
107 | + edit.load_tab(current_div.attr('id'), id, check_callback); | |
96 | 108 | edit.active_id = id; |
97 | 109 | }, |
98 | 110 | |
... | ... |
dictionary/templates/reader_view.html
... | ... | @@ -58,8 +58,8 @@ |
58 | 58 | title="{% trans 'ustawienia' %}" src="{% static 'images/gears.png' %}"/> |
59 | 59 | <div id="settings-menu"> |
60 | 60 | <p class="item">{% trans "odmiana" %}</p> |
61 | - <p class="subitem">{% trans "wszystkie formy" %}</p> | |
62 | - <p class="subitem">{% trans "formy bazowe" %}</p> | |
61 | + <p class="subitem switch-tab" data-tab="variant1"><span class="ui-icon ui-icon-check"></span>{% trans "wszystkie formy" %}</p> | |
62 | + <p class="subitem switch-tab" data-tab="variant0"><span class="ui-icon ui-icon-check"></span>{% trans "formy bazowe" %}</p> | |
63 | 63 | <p id="show-columns-button" class="item">{% trans "lista haseł…" %}</p> |
64 | 64 | <p id="columns" class="subitem"></p> |
65 | 65 | <p class="item">{% trans "język interfejsu" %}</p> |
... | ... | @@ -82,14 +82,8 @@ |
82 | 82 | <div id="lexeme-grid"></div> |
83 | 83 | </div> |
84 | 84 | <div id="right"> |
85 | - <div class="tabs" id="lexeme-tabs"> | |
86 | - <ul> | |
87 | - <li><a href="#variant1">{% trans 'Wszystkie formy' %}</a></li> | |
88 | - <li><a href="#variant0">{% trans 'Formy bazowe' %}</a></li> | |
89 | - </ul> | |
90 | - <div id="variant1"></div> | |
91 | - <div id="variant0"></div> | |
92 | - </div> | |
85 | + <div id="variant1"></div> | |
86 | + <div id="variant0"></div> | |
93 | 87 | </div> |
94 | 88 | {% endblock %} |
95 | 89 | |
... | ... |