Fixes settings menu for non moderators

pull/862/head
yanas 8 years ago
parent 45496b7592
commit a9e31a2843
  1. 38
      modules/UI/side_pannels/settings/SettingsMenu.js
  2. 21
      modules/UI/util/UIUtil.js

@ -74,11 +74,11 @@ export default {
} }
}); });
// Only show the subtitle if this is the only setting section. // Only show the subtitle if this isn't the only setting section.
if (interfaceConfig.SETTINGS_SECTIONS.length > 1) if (interfaceConfig.SETTINGS_SECTIONS.length > 1)
UIUtil.showHiddenElement("deviceOptionsTitle"); UIUtil.showElement("deviceOptionsTitle");
UIUtil.showHiddenElement("devicesOptions"); UIUtil.showElement("devicesOptions");
} }
if (UIUtil.isSettingEnabled('language')) { if (UIUtil.isSettingEnabled('language')) {
@ -93,7 +93,7 @@ export default {
emitter.emit(UIEvents.LANG_CHANGED, languagesBox.val()); emitter.emit(UIEvents.LANG_CHANGED, languagesBox.val());
}); });
UIUtil.showHiddenElement("languages_selectbox"); UIUtil.showElement("languages_selectbox");
} }
if (UIUtil.isSettingEnabled('moderator')) { if (UIUtil.isSettingEnabled('moderator')) {
@ -116,13 +116,6 @@ export default {
isFollowMeEnabled isFollowMeEnabled
); );
}); });
// Only show the subtitle if this is the only setting section.
if (interfaceConfig.SETTINGS_SECTIONS.length > 1)
UIUtil.showHiddenElement("moderatorOptionsTitle");
UIUtil.showHiddenElement("startMutedOptions");
UIUtil.showHiddenElement("followMeOptions");
} }
}, },
@ -155,10 +148,21 @@ export default {
* @param {boolean} show * @param {boolean} show
*/ */
showStartMutedOptions (show) { showStartMutedOptions (show) {
if (show) { console.log("------", show, UIUtil.isSettingEnabled('moderator'));
$("#startMutedOptions").css("display", "block"); if (show && UIUtil.isSettingEnabled('moderator')) {
console.log("idva li tuuk");
// Only show the subtitle if this isn't the only setting section.
if (!$("#moderatorOptionsTitle").is(":visible")
&& interfaceConfig.SETTINGS_SECTIONS.length > 1)
UIUtil.showElement("moderatorOptionsTitle");
UIUtil.showElement("startMutedOptions");
} else { } else {
$("#startMutedOptions").css("display", "none"); // Only show the subtitle if this isn't the only setting section.
if ($("#moderatorOptionsTitle").is(":visible"))
UIUtil.hideElement("moderatorOptionsTitle");
UIUtil.hideElement("startMutedOptions");
} }
}, },
@ -173,10 +177,10 @@ export default {
* @param {boolean} show {true} to show those options, {false} to hide them * @param {boolean} show {true} to show those options, {false} to hide them
*/ */
showFollowMeOptions (show) { showFollowMeOptions (show) {
if (show) { if (show && UIUtil.isSettingEnabled('moderator')) {
$("#followMeOptions").css("display", "block"); UIUtil.showElement("followMeOptions");
} else { } else {
$("#followMeOptions").css("display", "none"); UIUtil.hideElement("followMeOptions");
} }
}, },

@ -129,10 +129,25 @@
/** /**
* Shows the element given by id. * Shows the element given by id.
* *
* @param {String} the identifier of the element * @param {String} the identifier of the element to show
*/ */
showHiddenElement(id) { showElement(id) {
$("#"+id).toggleClass("hide").toggleClass("show"); if ($("#"+id).hasClass("hide"))
$("#"+id).removeClass("hide");
$("#"+id).addClass("show");
},
/**
* Hides the element given by id.
*
* @param {String} the identifier of the element to hide
*/
hideElement(id) {
if ($("#"+id).hasClass("show"))
$("#"+id).removeClass("show");
$("#"+id).addClass("hide");
}, },
hideDisabledButtons: function (mappings) { hideDisabledButtons: function (mappings) {

Loading…
Cancel
Save