Skip to content
Permalink
Browse files

Make sure next/prev links are always in the same place, otherwise bro…

…wsing this way is not really useable
  • Loading branch information...
flack committed Mar 4, 2019
1 parent 7ca205b commit 886fb9b2a0fca7c481da3f4f368d0646d714638e
@@ -78,24 +78,22 @@ private function _populate_toolbar($previous_week, $next_week)
{ {
$week_start = strftime('%Y-%m-%d', $this->_request_data['week_start']); $week_start = strftime('%Y-%m-%d', $this->_request_data['week_start']);
$week_end = strftime('%Y-%m-%d', $this->_request_data['week_end']); $week_end = strftime('%Y-%m-%d', $this->_request_data['week_end']);
$buttons = [
[ $this->_view_toolbar->add_item([
MIDCOM_TOOLBAR_URL => $this->router->generate('list_hours') . '?date[from]=' . $week_start . '&date[to]=' . $week_end, MIDCOM_TOOLBAR_URL => $this->router->generate('list_hours') . '?date[from]=' . $week_start . '&date[to]=' . $week_end,
MIDCOM_TOOLBAR_LABEL => $this->_l10n->get('list view'), MIDCOM_TOOLBAR_LABEL => $this->_l10n->get('list view'),
MIDCOM_TOOLBAR_GLYPHICON => 'list', MIDCOM_TOOLBAR_GLYPHICON => 'list',
], ]);
[
MIDCOM_TOOLBAR_URL => $this->router->generate('index_timestamp', ['timestamp' => $previous_week]), org_openpsa_widgets_ui::add_navigation_toolbar([[
MIDCOM_TOOLBAR_LABEL => $this->_l10n->get('previous week'), MIDCOM_TOOLBAR_URL => $this->router->generate('index_timestamp', ['timestamp' => $previous_week]),
MIDCOM_TOOLBAR_GLYPHICON => 'chevron-left', MIDCOM_TOOLBAR_LABEL => $this->_l10n->get('previous week'),
], MIDCOM_TOOLBAR_GLYPHICON => 'chevron-left',
[ ], [
MIDCOM_TOOLBAR_URL => $this->router->generate('index_timestamp', ['timestamp' => $next_week]), MIDCOM_TOOLBAR_URL => $this->router->generate('index_timestamp', ['timestamp' => $next_week]),
MIDCOM_TOOLBAR_LABEL => $this->_l10n->get('next week'), MIDCOM_TOOLBAR_LABEL => $this->_l10n->get('next week'),
MIDCOM_TOOLBAR_GLYPHICON => 'chevron-right', MIDCOM_TOOLBAR_GLYPHICON => 'chevron-right',
] ]]);
];
$this->_view_toolbar->add_items($buttons);
} }
/** /**
@@ -70,6 +70,7 @@ public function prepare_toolbar($show_backlink = true)
public function add_next_previous(org_openpsa_invoices_invoice_dba $object, $urlprefix) public function add_next_previous(org_openpsa_invoices_invoice_dba $object, $urlprefix)
{ {
$items = [];
if ($object->number > 1) { if ($object->number > 1) {
$mc = org_openpsa_invoices_invoice_dba::new_collector(); $mc = org_openpsa_invoices_invoice_dba::new_collector();
$mc->add_constraint('number', '<', $object->number); $mc->add_constraint('number', '<', $object->number);
@@ -78,12 +79,12 @@ public function add_next_previous(org_openpsa_invoices_invoice_dba $object, $url
$results = $mc->list_keys(); $results = $mc->list_keys();
if (!empty($results)) { if (!empty($results)) {
$this->_view_toolbar->add_item([ $items[] = [
MIDCOM_TOOLBAR_URL => $urlprefix . key($results) . '/', MIDCOM_TOOLBAR_URL => $urlprefix . key($results) . '/',
MIDCOM_TOOLBAR_LABEL => $this->_l10n_midcom->get('previous'), MIDCOM_TOOLBAR_LABEL => $this->_l10n_midcom->get('previous'),
MIDCOM_TOOLBAR_GLYPHICON => 'chevron-left', MIDCOM_TOOLBAR_GLYPHICON => 'chevron-left',
MIDCOM_TOOLBAR_ACCESSKEY => 'p', MIDCOM_TOOLBAR_ACCESSKEY => 'p',
]); ];
} }
} }
@@ -95,13 +96,14 @@ public function add_next_previous(org_openpsa_invoices_invoice_dba $object, $url
$results = $mc->list_keys(); $results = $mc->list_keys();
if (!empty($results)) { if (!empty($results)) {
$this->_view_toolbar->add_item([ $items[] = [
MIDCOM_TOOLBAR_URL => $urlprefix . key($results) . '/', MIDCOM_TOOLBAR_URL => $urlprefix . key($results) . '/',
MIDCOM_TOOLBAR_LABEL => $this->_l10n_midcom->get('next'), MIDCOM_TOOLBAR_LABEL => $this->_l10n_midcom->get('next'),
MIDCOM_TOOLBAR_GLYPHICON => 'chevron-right', MIDCOM_TOOLBAR_GLYPHICON => 'chevron-right',
MIDCOM_TOOLBAR_ACCESSKEY => 'n', MIDCOM_TOOLBAR_ACCESSKEY => 'n',
]); ];
} }
} }
org_openpsa_widgets_ui::add_navigation_toolbar($items);
} }
} }
@@ -20,24 +20,20 @@ class org_openpsa_mypage_handler_today extends midcom_baseclasses_components_han
private function _populate_toolbar() private function _populate_toolbar()
{ {
$buttons = [ $this->_view_toolbar->add_item([
[ MIDCOM_TOOLBAR_URL => $this->router->generate('weekreview', ['date' => $this->_request_data['this_day']]),
MIDCOM_TOOLBAR_URL => $this->router->generate('weekreview', ['date' => $this->_request_data['this_day']]), MIDCOM_TOOLBAR_LABEL => $this->_l10n->get('week review'),
MIDCOM_TOOLBAR_LABEL => $this->_l10n->get('week review'), MIDCOM_TOOLBAR_GLYPHICON => 'list',
MIDCOM_TOOLBAR_GLYPHICON => 'list', ]);
], org_openpsa_widgets_ui::add_navigation_toolbar([[
[ MIDCOM_TOOLBAR_URL => $this->router->generate('day', ['date' => $this->_request_data['prev_day']]),
MIDCOM_TOOLBAR_URL => $this->router->generate('day', ['date' => $this->_request_data['prev_day']]), MIDCOM_TOOLBAR_LABEL => $this->_l10n_midcom->get('previous'),
MIDCOM_TOOLBAR_LABEL => $this->_l10n_midcom->get('previous'), MIDCOM_TOOLBAR_GLYPHICON => 'chevron-left',
MIDCOM_TOOLBAR_GLYPHICON => 'chevron-left', ], [
], MIDCOM_TOOLBAR_URL => $this->router->generate('day', ['date' => $this->_request_data['next_day']]),
[ MIDCOM_TOOLBAR_LABEL => $this->_l10n_midcom->get('next'),
MIDCOM_TOOLBAR_URL => $this->router->generate('day', ['date' => $this->_request_data['next_day']]), MIDCOM_TOOLBAR_GLYPHICON => 'chevron-right',
MIDCOM_TOOLBAR_LABEL => $this->_l10n_midcom->get('next'), ]]);
MIDCOM_TOOLBAR_GLYPHICON => 'chevron-right',
]
];
$this->_view_toolbar->add_items($buttons);
} }
/** /**
@@ -26,24 +26,20 @@ public function _handler_redirect()
private function _populate_toolbar() private function _populate_toolbar()
{ {
$buttons = [ $this->_view_toolbar->add_item([
[ MIDCOM_TOOLBAR_URL => $this->router->generate('day', ['date' => strftime('%Y-%m-%d', $this->_request_data['week_start'])]),
MIDCOM_TOOLBAR_URL => $this->router->generate('day', ['date' => strftime('%Y-%m-%d', $this->_request_data['week_start'])]), MIDCOM_TOOLBAR_LABEL => $this->_l10n->get('day review'),
MIDCOM_TOOLBAR_LABEL => $this->_l10n->get('day review'), MIDCOM_TOOLBAR_GLYPHICON => 'dashboard',
MIDCOM_TOOLBAR_GLYPHICON => 'dashboard', ]);
], org_openpsa_widgets_ui::add_navigation_toolbar([[
[ MIDCOM_TOOLBAR_URL => $this->router->generate('weekreview', ['date' => $this->_request_data['prev_week']]),
MIDCOM_TOOLBAR_URL => $this->router->generate('weekreview', ['date' => $this->_request_data['prev_week']]), MIDCOM_TOOLBAR_LABEL => $this->_l10n_midcom->get('previous'),
MIDCOM_TOOLBAR_LABEL => $this->_l10n_midcom->get('previous'), MIDCOM_TOOLBAR_GLYPHICON => 'chevron-left',
MIDCOM_TOOLBAR_GLYPHICON => 'chevron-left', ], [
], MIDCOM_TOOLBAR_URL => $this->router->generate('weekreview', ['date' => $this->_request_data['next_week']]),
[ MIDCOM_TOOLBAR_LABEL => $this->_l10n_midcom->get('next'),
MIDCOM_TOOLBAR_URL => $this->router->generate('weekreview', ['date' => $this->_request_data['next_week']]), MIDCOM_TOOLBAR_GLYPHICON => 'chevron-right',
MIDCOM_TOOLBAR_LABEL => $this->_l10n_midcom->get('next'), ]]);
MIDCOM_TOOLBAR_GLYPHICON => 'chevron-right',
]
];
$this->_view_toolbar->add_items($buttons);
} }
/** /**
@@ -131,4 +131,14 @@ function()
</script> </script>
JSINIT; JSINIT;
} }
/**
* @param array $items
*/
public static function add_navigation_toolbar(array $items)
{
$toolbar = new midcom_helper_toolbar('midcom_toolbar navigation_toolbar');
$toolbar->add_items($items);
midcom::get()->toolbars->add_toolbar('navigation', $toolbar);
}
} }
@@ -72,7 +72,7 @@ var org_openpsa_layout = {
.appendTo('#org_openpsa_toolbar > ul.view_toolbar'), .appendTo('#org_openpsa_toolbar > ul.view_toolbar'),


dropdown = container.find('ul.midcom_toolbar'), dropdown = container.find('ul.midcom_toolbar'),
toolbarWidth = $('#org_openpsa_toolbar').width(), toolbarWidth = $('#org_openpsa_toolbar').width() - $('#org_openpsa_toolbar .navigation_toolbar').width(),
over = false; over = false;


$('#org_openpsa_toolbar > .view_toolbar > li:not(#toolbar_dropdown)').each(function() { $('#org_openpsa_toolbar > .view_toolbar > li:not(#toolbar_dropdown)').each(function() {
@@ -486,39 +486,44 @@ input#org_openpsa_search_query
position: relative; position: relative;
z-index: 10; z-index: 10;
font-size: 11px; font-size: 11px;
display: flex;
} }


#content .org_openpsa_toolbar #content .org_openpsa_toolbar
{ {
background: #cccec9; background: #cccec9;
background: linear-gradient(to bottom, #cccec9 0%, #bcbfbb 76%, #b1b5b4 93%, #b3b7b6 100%); background: linear-gradient(to bottom, #cccec9 0%, #bcbfbb 82%, #b1b5b4 97%, #b3b7b6 100%);
box-shadow: 0 -2px 7px rgba(0, 0, 0, 0.1) inset; box-shadow: 0 -2px 7px rgba(0, 0, 0, 0.1) inset;
} }


#org_openpsa_toolbar
{
border-top: 1px solid #eeeee7;
border-bottom: 1px solid #a2a2a3;
}

#org_openpsa_toolbar:hover #org_openpsa_toolbar:hover
{ {
box-shadow: 0 3px 6px rgba(0, 0, 0, 0.2); box-shadow: 0 3px 6px rgba(0, 0, 0, 0.2);
border-bottom: 1px solid #929293;
} }


.org_openpsa_toolbar ul.midcom_toolbar .org_openpsa_toolbar ul.midcom_toolbar
{ {
margin: 0; margin: 0;
padding: 0; padding: 0;
list-style-type: none; list-style-type: none;
overflow: hidden;
padding: 0.2em 0.4em 0.2em 0; padding: 0.2em 0.4em 0.2em 0;
} }


#org_openpsa_toolbar ul.midcom_toolbar #org_openpsa_toolbar ul.navigation_toolbar
{ {
border-bottom: 1px solid #a2a2a3; position: absolute;
border-top: 1px solid #eeeee7; right: 0;
z-index: 12;
padding-right: 1.2em;
} }


#org_openpsa_toolbar:hover ul.midcom_toolbar
{
border-bottom: 1px solid #929293;
}


.org_openpsa_toolbar ul.midcom_toolbar li .org_openpsa_toolbar ul.midcom_toolbar li
{ {
@@ -608,10 +613,15 @@ input#org_openpsa_search_query
border: none; border: none;
} }


.org_openpsa_toolbar #toolbar_dropdown
{
position: relative;
}

.org_openpsa_toolbar #toolbar_dropdown.expanded ul .org_openpsa_toolbar #toolbar_dropdown.expanded ul
{ {
position: absolute; position: absolute;
right: 0; left: 0;
top: 4px; top: 4px;
width: auto; width: auto;
height: auto; height: auto;
@@ -1,3 +1,4 @@
<?php <?php
echo midcom::get()->toolbars->render_view_toolbar(); echo midcom::get()->toolbars->render_view_toolbar();
echo midcom::get()->toolbars->_render_toolbar('navigation');
?> ?>

0 comments on commit 886fb9b

Please sign in to comment.
You can’t perform that action at this time.