[ticket/12553] Open the notification dropdown to the left.

PHPBB3-12553
This commit is contained in:
Cesar G 2014-05-29 18:07:27 -07:00
parent def39a670b
commit edd9c0e064
4 changed files with 49 additions and 55 deletions

View file

@ -873,19 +873,6 @@ phpbb.timezonePreselectSelect = function(forceSelector) {
} }
}; };
// Toggle notification list
$('#notification_list_button').click(function(e) {
$('#notification_list').toggle();
e.preventDefault();
});
$('#phpbb').click(function(e) {
var target = $(e.target);
if (!target.is('#notification_list, #notification_list_button') && !target.parents().is('#notification_list, #notification_list_button')) {
$('#notification_list').hide();
}
});
phpbb.ajaxCallbacks = {}; phpbb.ajaxCallbacks = {};
/** /**
@ -1515,11 +1502,37 @@ phpbb.getFunctionByName = function (functionName) {
}; };
/** /**
* Apply code editor to all textarea elements with data-bbcode attribute * Register page dropdowns.
*/ */
$(document).ready(function() { phpbb.registerPageDropdowns = function() {
$('textarea[data-bbcode]').each(function() { $('body').find('.dropdown-container').each(function() {
phpbb.applyCodeEditor(this); var $this = $(this),
trigger = $this.find('.dropdown-trigger:first'),
contents = $this.find('.dropdown'),
options = {
direction: 'auto',
verticalDirection: 'auto'
},
data;
if (!trigger.length) {
data = $this.attr('data-dropdown-trigger');
trigger = data ? $this.children(data) : $this.children('a:first');
}
if (!contents.length) {
data = $this.attr('data-dropdown-contents');
contents = data ? $this.children(data) : $this.children('div:first');
}
if (!trigger.length || !contents.length) return;
if ($this.hasClass('dropdown-up')) options.verticalDirection = 'up';
if ($this.hasClass('dropdown-down')) options.verticalDirection = 'down';
if ($this.hasClass('dropdown-left')) options.direction = 'left';
if ($this.hasClass('dropdown-right')) options.direction = 'right';
phpbb.registerDropdown(trigger, contents, options);
}); });
// Hide active dropdowns when click event happens outside // Hide active dropdowns when click event happens outside
@ -1529,6 +1542,17 @@ $(document).ready(function() {
$(phpbb.dropdownHandles).each(phpbb.toggleDropdown); $(phpbb.dropdownHandles).each(phpbb.toggleDropdown);
} }
}); });
}
/**
* Apply code editor to all textarea elements with data-bbcode attribute
*/
$(document).ready(function() {
$('textarea[data-bbcode]').each(function() {
phpbb.applyCodeEditor(this);
});
phpbb.registerPageDropdowns();
$('#color_palette_placeholder').each(function() { $('#color_palette_placeholder').each(function() {
phpbb.registerPalette($(this)); phpbb.registerPalette($(this));

View file

@ -367,39 +367,6 @@ function parse_document(container)
jumpto($(this)); jumpto($(this));
}); });
/**
* Dropdowns
*/
container.find('.dropdown-container').each(function() {
var $this = $(this),
trigger = $this.find('.dropdown-trigger:first'),
contents = $this.find('.dropdown'),
options = {
direction: 'auto',
verticalDirection: 'auto'
},
data;
if (!trigger.length) {
data = $this.attr('data-dropdown-trigger');
trigger = data ? $this.children(data) : $this.children('a:first');
}
if (!contents.length) {
data = $this.attr('data-dropdown-contents');
contents = data ? $this.children(data) : $this.children('div:first');
}
if (!trigger.length || !contents.length) return;
if ($this.hasClass('dropdown-up')) options.verticalDirection = 'up';
if ($this.hasClass('dropdown-down')) options.verticalDirection = 'down';
if ($this.hasClass('dropdown-left')) options.direction = 'left';
if ($this.hasClass('dropdown-right')) options.direction = 'right';
phpbb.registerDropdown(trigger, contents, options);
});
/** /**
* Adjust HTML code for IE8 and older versions * Adjust HTML code for IE8 and older versions
*/ */

View file

@ -17,8 +17,8 @@
<ul class="linklist bulletin"> <ul class="linklist bulletin">
<!-- IF not S_IS_BOT and S_USER_LOGGED_IN --> <!-- IF not S_IS_BOT and S_USER_LOGGED_IN -->
<!-- IF S_NOTIFICATIONS_DISPLAY --> <!-- IF S_NOTIFICATIONS_DISPLAY -->
<li class="small-icon icon-notification" data-skip-responsive="true"> <li class="small-icon icon-notification dropdown-container dropdown-{S_CONTENT_FLOW_END}" data-skip-responsive="true">
<a href="{U_VIEW_ALL_NOTIFICATIONS}" id="notification_list_button"><span>{L_NOTIFICATIONS} [</span><strong>{NOTIFICATIONS_COUNT}</strong><span>]</span></a> <a href="{U_VIEW_ALL_NOTIFICATIONS}" id="notification_list_button" class="dropdown-trigger"><span>{L_NOTIFICATIONS} [</span><strong>{NOTIFICATIONS_COUNT}</strong><span>]</span></a>
<!-- INCLUDE notification_dropdown.html --> <!-- INCLUDE notification_dropdown.html -->
</li> </li>
<!-- ENDIF --> <!-- ENDIF -->

View file

@ -156,10 +156,13 @@ function marklist(id, name, state)
<div id="menubar"> <div id="menubar">
<table width="100%" cellspacing="0"> <table width="100%" cellspacing="0">
<tr> <tr>
<td class="genmed"> <td class="genmed dropdown-container">
<!-- IF S_NOTIFICATIONS_DISPLAY and not S_IS_BOT and S_USER_LOGGED_IN --> <!-- IF S_NOTIFICATIONS_DISPLAY and not S_IS_BOT and S_USER_LOGGED_IN -->
<a href="{U_VIEW_ALL_NOTIFICATIONS}" id="notification_list_button"><img src="{T_THEME_PATH}/images/icon_mini_notification.gif" width="12" height="13" alt="*" /> {L_NOTIFICATIONS} [<strong>{NOTIFICATIONS_COUNT}</strong>]</a>&nbsp; <a href="{U_VIEW_ALL_NOTIFICATIONS}" id="notification_list_button" class="dropdown-trigger">
<div id="notification_list" class="notification_list"> <img src="{T_THEME_PATH}/images/icon_mini_notification.gif" width="12" height="13" alt="*" />
{L_NOTIFICATIONS} [<strong>{NOTIFICATIONS_COUNT}</strong>]
</a>&nbsp;
<div id="notification_list" class="notification_list dropdown">
<div class="row1 header"> <div class="row1 header">
{L_NOTIFICATIONS} {L_NOTIFICATIONS}
<span class="header_settings"><a href="{U_NOTIFICATION_SETTINGS}">{L_SETTINGS}</a></span> <span class="header_settings"><a href="{U_NOTIFICATION_SETTINGS}">{L_SETTINGS}</a></span>