temaplate: Separate stream and user group tabs in user profile modal.

We had stream and group tab inside a common div with class
`subscription-group-list` due to this adding any info
elements like alert boxes that were specific to one of them
became difficult. To fix this we keep them in their own
`.tabcontent` div. This change also makes the handling of
display of different tabs a lot easier and cleans
up unnecessary javascript code that was handling the
display of common parent div of stream and group tab.
This commit is contained in:
m-e-l-u-h-a-n
2021-06-23 15:18:01 +05:30
committed by Tim Abbott
parent 775b8eb05f
commit e10a315efd
3 changed files with 9 additions and 17 deletions

View File

@@ -429,27 +429,16 @@ export function show_user_profile(user) {
{label: $t({defaultMessage: "User groups"}), key: "groups-tab"}, {label: $t({defaultMessage: "User groups"}), key: "groups-tab"},
], ],
callback(name, key) { callback(name, key) {
function hide_profile_tab() { $(".tabcontent").hide();
$("#profile-tab").hide(); $("#" + key).show();
$(".subscription-group-list").show();
}
switch (name) { switch (name) {
case "User groups": case "User groups":
hide_profile_tab();
$("#streams-tab").hide();
render_user_group_list(groups_of_user, user); render_user_group_list(groups_of_user, user);
break; break;
case "Streams": case "Streams":
hide_profile_tab();
$("#groups-tab").hide();
render_user_stream_list(user_streams, user); render_user_stream_list(user_streams, user);
break; break;
default:
// default is profile section
$(".subscription-group-list").hide();
break;
} }
$("#" + key).show();
}, },
}; };

View File

@@ -362,7 +362,8 @@ ul {
margin-bottom: 20px; margin-bottom: 20px;
} }
.subscription-group-list { .subscription-group-list,
.subscription-stream-list {
position: relative; position: relative;
border: 1px solid hsl(0, 0%, 83%); border: 1px solid hsl(0, 0%, 83%);
border-radius: 4px; border-radius: 4px;

View File

@@ -64,12 +64,14 @@
</div> </div>
</div> </div>
<div class="subscription-group-list"> <div class="tabcontent" id="streams-tab">
<div class="tabcontent" id="streams-tab"> <div class="subscription-stream-list">
<table class="user-stream-list" data-empty="{{t 'No stream subscriptions.'}}"></table> <table class="user-stream-list" data-empty="{{t 'No stream subscriptions.'}}"></table>
</div> </div>
</div>
<div class="tabcontent" id="groups-tab"> <div class="tabcontent" id="groups-tab">
<div class="subscription-group-list">
<table class="user-group-list" data-empty="{{t 'No user group subscriptions.'}}"></table> <table class="user-group-list" data-empty="{{t 'No user group subscriptions.'}}"></table>
</div> </div>
</div> </div>