= Description = It would be nice if the tables generated with `DataBrowserWidget` were styleable, i.e. identified with a CSS class through which themes can differentiate them from regular tables generated with wiki syntax. !MoinMoin uses the data browser component for generating some ui elements, for example the attachments and user administration in SystemAdmin, the page package installation in LanguageSetup, the macro-generated smiley table in HelpOnSmileys, etc. Sometimes it's nice to give these ui elements different styles from regular tables, for example remove the border. == Component selection == I think all clients of the `DataBrowserWidget` could be obligated to define a CSS class for allowing special style for their tables. Maybe they could pass a `css_class` param in the constructor. Here are the !MoinMoin components to be changed: || '''Component''' || '''Suggested class''' || '''UI element''' || || `action.AttachFile` || `attachment_admin` || SystemAdmin || || `action.Despam` || `despam` || <> || || `action.info` || `page_history` || <> || || `action.language_setup` || `language_setup` || LanguageSetup || || `macro.ShowSmileys` || `smileys` || HelpOnSmileys || || `parser.text_csv` || `csv` || `{{{#!csv`, see HelpOnParsers || || `stats.hitcounts` || `hitcounts` || EventStats/HitCounts || || `stats.languages` || `languages` || [[EventStats/Languages]] || || `stats.useragents` || `useragents` || EventStats/UserAgents || || `userform.admin` || `user_admin` || SystemAdmin || = Discussion = == Patch 1 == Please have a look if that is what you have expected. -- ReimarBauer <> {{attachment:StyleableDataBrowserTables.patch}} == Patch 2 == I think an easier way is to pass some css class to be aplied directly in the table element, rather than wrapping it with some identified div every time. Even though I think we should enforce the `css_class` param, the patch below does not break Moin "API". -- RenatoSilva {{{#!highlight diff --- MoinMoin/widget/browser.py 2010-02-28 15:28:47 +0000 +++ MoinMoin/widget/browser.py 2010-04-10 18:36:29 +0000 @@ -11,7 +11,7 @@ class DataBrowserWidget(base.Widget): - def __init__(self, request, show_header=True, **kw): + def __init__(self, request, show_header=True, css_class="", **kw): _ = request.getText base.Widget.__init__(self, request, **kw) self.data = None @@ -27,6 +27,7 @@ self._filter = _('filter') self.__filter = 'filter' self._show_header = show_header + self.css_class = "dbw-table %s" % css_class def setData(self, dataset): """ Sets the data for the browser (see MoinMoin.util.dataset). @@ -120,7 +121,7 @@ if havefilters: result.append(fmt.rawHTML('' % (self._filter, self._name('submit')))) - result.append(fmt.table(1, id='%stable' % self.unqual_data_id)) + result.append(fmt.table(1, id='%stable' % self.unqual_data_id, css_class=self.css_class)) # add header line if self._show_header: --- MoinMoin/action/AttachFile.py 2010-02-28 15:28:45 +0000 +++ MoinMoin/action/AttachFile.py 2010-04-10 18:50:25 +0000 @@ -1163,7 +1163,7 @@ if data: from MoinMoin.widget.browser import DataBrowserWidget - browser = DataBrowserWidget(request) + browser = DataBrowserWidget(request, css_class="attachment-admin") browser.setData(data) return browser.render(method="GET") --- MoinMoin/action/Despam.py 2010-02-28 15:28:45 +0000 +++ MoinMoin/action/Despam.py 2010-04-10 18:55:31 +0000 @@ -72,7 +72,7 @@ 'editor': repr(editor), }))) - table = DataBrowserWidget(request) + table = DataBrowserWidget(request, css_class="despam") table.setData(dataset) return table.render(method="GET") --- MoinMoin/action/info.py 2010-02-28 15:28:45 +0000 +++ MoinMoin/action/info.py 2010-04-10 19:33:33 +0000 @@ -316,7 +316,7 @@ request.write(_('No log entries found.')) return - history_table = DataBrowserWidget(request) + history_table = DataBrowserWidget(request, css_class="page-history") history_table.setData(history) div = html.DIV(id="page-history") --- MoinMoin/action/language_setup.py 2010-02-28 15:28:45 +0000 +++ MoinMoin/action/language_setup.py 2010-04-10 18:57:09 +0000 @@ -72,7 +72,7 @@ install_link = request.page.link_to(request, label_install, querystr=querystr) data.addRow((pageset_name, install_link)) - table = DataBrowserWidget(request) + table = DataBrowserWidget(request, css_class="language-setup") table.setData(data) page_table = ''.join(table.format(method='GET')) --- MoinMoin/macro/ShowSmileys.py 2010-02-28 15:28:46 +0000 +++ MoinMoin/macro/ShowSmileys.py 2010-04-10 19:00:02 +0000 @@ -47,7 +47,7 @@ # display table if data: - browser = DataBrowserWidget(macro.request) + browser = DataBrowserWidget(macro.request, css_class="smileys") browser.setData(data) return browser.render(method="GET") --- MoinMoin/parser/text_csv.py 2010-02-28 15:28:46 +0000 +++ MoinMoin/parser/text_csv.py 2010-04-10 19:01:34 +0000 @@ -183,6 +183,6 @@ self.data = data def format(self, formatter): - browser = DataBrowserWidget(self.request, show_header=self._show_header) + browser = DataBrowserWidget(self.request, show_header=self._show_header, css_class="csv") browser.setData(self.data) self.request.write(browser.render(method="GET")) --- MoinMoin/stats/hitcounts.py 2010-02-28 15:28:46 +0000 +++ MoinMoin/stats/hitcounts.py 2010-04-10 19:03:46 +0000 @@ -185,7 +185,7 @@ se = 0.0 sd = 0.0 - table = DataBrowserWidget(request) + table = DataBrowserWidget(request, css_class="hitcounts") table.setData(hits) return table.render(method="GET") --- MoinMoin/stats/languages.py 2010-02-28 15:28:46 +0000 +++ MoinMoin/stats/languages.py 2010-04-10 19:03:54 +0000 @@ -85,7 +85,7 @@ else: # If we don't have any users, we can safely assume that the only real user is the visitor (who is normally ignored, though) who is using "Browser setting" languages.addRow((browserlang, "100% (1)")) - table = DataBrowserWidget(request) + table = DataBrowserWidget(request, css_class="languages") table.setData(languages) return table.render(method="GET") --- MoinMoin/stats/useragents.py 2010-02-28 15:28:46 +0000 +++ MoinMoin/stats/useragents.py 2010-04-10 19:04:05 +0000 @@ -114,7 +114,7 @@ if total > cnt_printed: agents.addRow((_('Others'), "%.2f" % (100 * (total - cnt_printed) / total))) - table = DataBrowserWidget(request) + table = DataBrowserWidget(request, css_class="useragents") table.setData(agents) return table.render(method="GET") --- MoinMoin/userform/admin.py 2010-02-28 15:28:46 +0000 +++ MoinMoin/userform/admin.py 2010-04-10 19:06:59 +0000 @@ -104,7 +104,7 @@ if data: from MoinMoin.widget.browser import DataBrowserWidget - browser = DataBrowserWidget(request) + browser = DataBrowserWidget(request, css_class="user-admin") browser.setData(data) return browser.render() }}} = Plan = * Priority: * Assigned to: * Status: /* Reported by RenatoSilva */ /* Patched by RenatoSilva */ ---- ## If you are a moin core developer, replace the category to Category* in these cases: ## Category MoinMoinNoBug - if this is not a bug. ## Category MoinMoinBugConfirmed - if you can confirm the bug on current code. ## Category MoinMoinBugFixed - after the bug is fixed in current code. CategoryMoinMoinBug