Skip to content

Commit

Permalink
[#3444] responsve feature checkbox
Browse files Browse the repository at this point in the history
  • Loading branch information
wardi committed Mar 4, 2017
1 parent 603d48c commit bb0ae39
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 7 deletions.
24 changes: 17 additions & 7 deletions ckanext/datatablesview/plugin.py
Expand Up @@ -6,6 +6,9 @@
import ckan.plugins as p
import ckan.plugins.toolkit as toolkit

default = toolkit.get_validator(u'default')
boolean_validator = toolkit.get_validator(u'boolean_validator')


class DataTablesView(p.SingletonPlugin):
'''
Expand All @@ -29,14 +32,21 @@ def can_view(self, data_dict):
def view_template(self, context, data_dict):
return u'datatables/datatables_view.html'

def form_template(self, context, data_dict):
return u'datatables/datatables_form.html'

def info(self):
return {u'name': u'datatables_view',
u'title': u'Table',
u'filterable': True,
u'icon': u'table',
u'requires_datastore': True,
u'default_title': p.toolkit._(u'Table'),
}
return {
u'name': u'datatables_view',
u'title': u'Table',
u'filterable': True,
u'icon': u'table',
u'requires_datastore': True,
u'default_title': p.toolkit._(u'Table'),
u'schema': {
u'responsive': [default(False), boolean_validator],
}
}

def before_map(self, m):
m.connect(
Expand Down
@@ -0,0 +1,9 @@
{% import 'macros/form.html' as form %}

{{ form.checkbox(
'responsive',
id='field-responsive',
label=_('Responsive display'),
value='True',
checked=data.responsive,
) }}

0 comments on commit bb0ae39

Please sign in to comment.