[ticket/469] Only allow showing left or right module on all pages

B3P-469
This commit is contained in:
Marc Alexander
2015-02-13 16:33:06 +01:00
parent f75dd66601
commit 311c7cb97f
7 changed files with 41 additions and 12 deletions

View File

@@ -104,8 +104,7 @@ class portal_module
'legend3' => 'ACP_PORTAL_SHOW_ALL',
'board3_show_all_pages' => array('lang' => 'ACP_PORTAL_SHOW_ALL', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => true),
'board3_show_all_left' => array('lang' => 'PORTAL_SHOW_ALL_LEFT', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => true),
'board3_show_all_right' => array('lang' => 'PORTAL_SHOW_ALL_RIGHT', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => true),
'board3_show_all_side' => array('lang' => 'PORTAL_SHOW_ALL_SIDE', 'validate' => 'bool', 'type' => 'custom', 'method' => array('board3.portal.modules_helper', 'display_left_right'), 'explain' => true),
)
);

View File

@@ -149,11 +149,11 @@ class listener implements EventSubscriberInterface
protected function display_portal()
{
// Check if we should show the portal
if (isset($this->config['board3_show_all_pages']) && ($this->config['board3_show_all_left'] || $this->config['board3_show_all_right']) && !defined('ADMIN_START'))
if (isset($this->config['board3_show_all_pages']))
{
$this->board3_controller->handle(array(
'left' => $this->config['board3_show_all_left'],
'right' => $this->config['board3_show_all_right'],
'left' => $this->config['board3_show_all_side'] == false,
'right' => $this->config['board3_show_all_side'] == true,
));
}
}

View File

@@ -158,4 +158,19 @@ class modules_helper
{
return $this->controller_helper->route($route, $params, $is_amp, $session_id, $reference_type);
}
/**
* Display radio buttons for left/right choice
*
* @param int $value Selected value
* @param string $key Key of config variable
*
* @return string
*/
public function display_left_right($value, $key)
{
$radio_ary = array(0 => 'PORTAL_SHOW_ALL_LEFT', 1 => 'PORTAL_SHOW_ALL_RIGHT');
return h_radio($key, $radio_ary, $value, $key);
}
}

View File

@@ -96,10 +96,10 @@ $lang = array_merge($lang, array(
'PORTAL_LEFT_COLUMN_WIDTH_EXP' => 'Change the width of the left column in pixels; recommended value is 180',
'PORTAL_RIGHT_COLUMN_WIDTH' => 'Width of the right column',
'PORTAL_RIGHT_COLUMN_WIDTH_EXP' => 'Change the width of the right column in pixels; recommended value is 180',
'PORTAL_SHOW_ALL_LEFT' => 'Show left column on all pages',
'PORTAL_SHOW_ALL_LEFT_EXP' => 'Display the left column on all pages',
'PORTAL_SHOW_ALL_RIGHT' => 'Show right column on all pages',
'PORTAL_SHOW_ALL_RIGHT_EXP' => 'Display the right column on all pages',
'PORTAL_SHOW_ALL_SIDE' => 'Column to display on all pages',
'PORTAL_SHOW_ALL_SIDE_EXP' => 'Choose which column should be shown on all pages.',
'PORTAL_SHOW_ALL_LEFT' => 'Left',
'PORTAL_SHOW_ALL_RIGHT' => 'Right',
'LINK_ADDED' => 'The link has been successfully added',
'LINK_UPDATED' => 'The link has been successfully updated',

View File

@@ -21,8 +21,7 @@ class v210_rc3 extends \phpbb\db\migration\migration
return array(
array('config.update', array('board3_portal_version', '2.1.0-rc3')),
array('config.add', array('board3_show_all_pages', false)),
array('config.add', array('board3_show_all_left', false)),
array('config.add', array('board3_show_all_right', false)),
array('config.add', array('board3_show_all_side', false)),
);
}
}

View File

@@ -1,7 +1,9 @@
<!-- IF T_EXT_THEME_PATH -->
<!-- INCLUDECSS ../theme/portal.css -->
<!-- INCLUDECSS ../theme/portal_responsive.css -->
<!-- IF S_PORTAL_ALL -->
<!-- INCLUDECSS ../theme/portal_all.css -->
<!-- INCLUDECSS ../theme/portal_all_responsive.css -->
<!-- ELSE -->
<!-- INCLUDECSS ../theme/portal_responsive.css -->
<!-- ENDIF -->
<!-- ENDIF -->

View File

@@ -0,0 +1,14 @@
@media only screen and (max-width: 870px), only screen and (max-device-width: 870px) {
.portal-body-center dd.posts, .portal-body-center dd.views {
display: none !important;
}
.portal-body-center dt { width: 130% !important; }
}
@media only screen and (max-width: 740px), only screen and (max-device-width: 740px) {
.portal-body-center dt { width: 140% !important; }
#portal-left ul.topiclist dd, #portal-right ul.topiclist dd { display: block !important; }
#portal-right > .portal-clear, #portal-body > .portal-clear, #portal-left > .portal-clear,
#portal-center > .portal-clear, #portal-login-box .portal-clear { display: none !important; }
}