:date: 2018-07-07 ====================== Saturday, July 7, 2018 ====================== I poked around in Jane, trying to organize our sites and meditating about :ticket:`2430`. I was unable to delete an unused site because it had summary records. New :ticket:`2433` : the :class:`lino.modlib.summaries.Summary` mixin now also sets :attr:`allow_cascaded_delete <lino.core.model.Model.allow_cascaded_delete>` to ``'master'``. *En passant* I converted more docstrings to prosa in :ref:`noi.specs.tickets`. I fixed a problem which caused the lightbox to not work on my `German blog <http://luc.saffre-rumma.net/blog/2018/0706.html>`__. The actual problem was in the :xfile:`layout.html` template, but *en passant* I updated the docstring of :mod:`rstgen.sphinxconf.sigal_image`. Responsive layouts for Lino =========================== Hamza and I had a look at the `Responsive Table <https://openui5.hana.ondemand.com/#/sample/sap.m.sample.Table/preview>`__ example. In the `Table.view.xml` source code we see:: <Column minScreenWidth="Desktop" demandPopin="true" hAlign="End"> <Text text="Dimensions" /> </Column> Looking at the `sap.m.Column <https://openui5.hana.ondemand.com/#/api/sap.m.Column/controlProperties>`__ API reference I note: - The *minScreenWidth* of a *Column* causes OpenUI5 to hide this column when the screen width is below the specified minimum width. You can specify that width either using CSS sizes (e.g: "480px" or "40em"), or using one of the names of the `sap.m.ScreenSize <https://openui5.hana.ondemand.com/#/api/sap.m.ScreenSize>`__ enumeration (e.g: "Phone", "Tablet", "Desktop", "Small", "Medium", "Large", ...). - When a column becomes hidden because there is not enough space, OpenUI5 looks at `demandPopin` : if this is *true*, the column is shown as *pop-in* instead of hiding it. This is an API feature of OpenUI5 which did not exist in ExtJS. The important question for us us now: what information should an application developer provide so that Lino can use these features in a meaningful way? Our first spontaneous suggestion was to introduce three new class attributes: :attr:`tablet_columns <lino.core.tables.Table.tablet_columns>`, :attr:`mobile_columns <lino.core.tables.Table.mobile_columns>` and :attr:`popin_columns <lino.core.tables.Table.popin_columns>`. IOW we made the intuitive design choice that Lino provides three possible screen sizes: "desktop", "tablet" and "phone". The default size is *desktop*. As the first example we made the :class:`lino_noi.lib.tickets.Tickets` table responsive:: class Tickets(dd.Table): column_names = 'id summary:50 priority workflow_buttons:30 site:10' tablet_columns = "id summary workflow_buttons" mobile_columns = "summary workflow_buttons" popin_columns = "id priority site" That means: the basic layout is *column_names*. These columns are visible when there is enough space. On a tablet (medium screen size) we want only the *tablet_columns* to be visible. These new attributes are *sets of field names* that can be specified as a single string with a space-separated list of field names, and we extended the :func:`expand_field_names <lino.core.utils.expand_field_names>` function for handling them. Test: >>> import lino >>> lino.startup('lino_book.projects.team.settings.demo') >>> from lino.api.doctest import * >>> pprint(rt.models.tickets.AllTickets.mobile_columns) set([<django.db.models.fields.CharField: summary>, lino.core.model.Model.workflow_buttons])