Skip to content

Commit

Permalink
small optimization on item table layout
Browse files Browse the repository at this point in the history
  • Loading branch information
chriwen committed Apr 26, 2021
1 parent e7c472f commit 197aa4e
Show file tree
Hide file tree
Showing 5 changed files with 38 additions and 19 deletions.
32 changes: 20 additions & 12 deletions assets/public/css/public.css

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion assets/public/css/public.css.map

Large diffs are not rendered by default.

11 changes: 9 additions & 2 deletions assets/public/sass/partials/_shortcodeItemsTable.scss
Original file line number Diff line number Diff line change
@@ -1,17 +1,22 @@
$table-font-size: 12px;

.tscroll {
width:100%;
overflow: scroll;
border: solid gray 1px;
}

.cb-items-table {

font-size: $table-font-size;
overflow-x: auto;
overflow-y: auto;

th {
font-size: $table-font-size;
padding: 0;
text-align: center;
vertical-align: middle;
font-weight: 600;
border: 1px solid rgb(167, 167, 167);
}

thead tr:nth-child(2) {
Expand All @@ -27,6 +32,8 @@ $table-font-size: 12px;
padding: 0;
text-align: center;
vertical-align: middle;
border: 1px solid rgb(167, 167, 167);
z-index: 11;

&:nth-child(1),
&:nth-child(2) {
Expand Down
2 changes: 1 addition & 1 deletion src/Map/MapAdmin.php
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@ class MapAdmin
const MARKER_ITEM_DRAFT_ICON_ANCHOR_X_DEFAULT = 0;
const MARKER_ITEM_DRAFT_ICON_ANCHOR_Y_DEFAULT = 0;
const AVAILABILITY_MAX_DAYS_TO_SHOW_DEFAULT = 11;
const AVAILABILITY_MAX_DAY_COUNT_DEFAULT = 20;
const AVAILABILITY_MAX_DAY_COUNT_DEFAULT = 14;

//const MARKER_POPUP_CONTENT_DEFAULT = "'<b>' + location.location_name + '</b><br>' + location.address.street + '<br>' + location.address.zip + ' ' + location.address.city + '<p>' + location.opening_hours + '</p>'";

Expand Down
10 changes: 7 additions & 3 deletions src/View/Calendar.php
Original file line number Diff line number Diff line change
Expand Up @@ -359,7 +359,8 @@ public static function renderTable($atts): string
$dayStr = implode($divider, $days_display);
$colStr = implode(' ', $days_cols);

$print = "<table class='cb-items-table tablesorter'><colgroup><col><col>" . $colStr . "</colgroup><thead>";
$print = '<div class="tscroll">';
$print .= "<table class='cb-items-table tablesorter'><colgroup><col><col>" . $colStr . "</colgroup><thead>";
$print .= "<tr><th colspan='2' class='sortless'>" . $desc . "</th><th class='sortless' colspan='" . $colspan . "'>";

if ($colspan > 1) {
Expand Down Expand Up @@ -414,7 +415,7 @@ public static function renderTable($atts): string
// Collect unique locations from timeframes
$locations = [];
foreach ($timeframes as $timeframe) {
$locations[$timeframe->getLocation()->ID] = $timeframe->getLocation()->title();
$locations[$timeframe->getLocation()->ID] = $timeframe->getLocation()->post_title;
}

// loop through location
Expand Down Expand Up @@ -469,14 +470,17 @@ public static function renderTable($atts): string
}
}


$dayStr = implode($divider, $days_display);
$itemLink = add_query_arg('location', $locationId, get_permalink($item->ID));
$print .= "<tr><td><b><a href='" . $itemLink . "'>" . $item_name . "</a></b>" . $divider . $locationName . $divider . $dayStr . "</td></tr>";
$locationString = '<div data-title="' . $locationName . '">' . $locationName . '</div>';
$print .= "<tr><td><b><a href='" . $itemLink . "'>" . $item_name . "</a></b>" . $divider . $locationString . $divider . $dayStr . "</td></tr>";
}
}
}

$print .= "</tbody></table>";
$print .= '</div>';
return $print;
}

Expand Down

0 comments on commit 197aa4e

Please sign in to comment.