Skip to content

Commit

Permalink
Rendered markdown tables should be responsive. Moved the code to the …
Browse files Browse the repository at this point in the history
…render object.
  • Loading branch information
paulocheque committed Jun 16, 2016
1 parent f6b6df8 commit 3633bde
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 11 deletions.
5 changes: 3 additions & 2 deletions pskb_website/static/js/marked_settings.js
Original file line number Diff line number Diff line change
Expand Up @@ -48,12 +48,13 @@ renderer.blockquote = function(quote) {

renderer.table = function(header, body) {
var key = this.getUniqueKey('table' + header + body);
return '<table data-id="' + key + '" key="' + key + '">' + '<thead>'

return '<div class="table-responsive" data-id="' + key + '" key="' + key + '"><table class="table"><thead>'
+ header
+ '</thead>'
+ '<tbody>'
+ body
+ '</tbody></table>';
+ '</tbody></table></div>';
};

renderer.link = function(href, title, text) {
Expand Down
8 changes: 0 additions & 8 deletions pskb_website/static/js/utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -142,14 +142,6 @@ function create_toc_from_headers(headers) {
}


/* Turn any table tags in div into responsive tables by adding
* bootstrap-specific markup around table */
function create_responsive_tables(div) {
var tables = $(div).find('table');
tables.wrap('<div class="table-responsive">');
tables.addClass('table');
}

/* Confirm user typed DELETE in form and submit request for article deletion
* This function works with confirm_deletion.html form.
*/
Expand Down
1 change: 0 additions & 1 deletion pskb_website/templates/article.html
Original file line number Diff line number Diff line change
Expand Up @@ -252,7 +252,6 @@ <h5>Community suggestions</h5>

populate_table_of_contents(article, $('#table-of-contents'));

create_responsive_tables(article);
var article_z = article.css('z-index');

$('#stacks').on('show.bs.select', function(e) {
Expand Down

0 comments on commit 3633bde

Please sign in to comment.