:date: 2017-04-07

=====================
Friday, April 7, 2017
=====================

I created :ticket:`1694` and decided that it is time to write a test
case :mod:`test_workflow
<lino_book.projects.team.tests.test_workflow>`.  which covers the
ticket and vote workflow.

For this test case I optimized the actions API:

- A subclass of Action can now define a hard-coded :attr:`action_name`.

- The :meth:`run_from_ui` method of certain actions now pass keyword
  arguments to :meth:`create_instance_from_request`

Relevant code changes:  

- 2017-04-07 10:12 in *lino*:
  `7612a5e <https://gitlab.com/lino-framework/lino/commit/9039e372db62404bbf927153eeec8bf357612a5e>`__
- 2017-04-07 10:12 in *lino_book*:
  `2f9b430 <https://github.com/lino-framework/book/commit/53b979974e217df54fcc765841ef5d3f32f9b430>`__
- 2017-04-07 10:13 in *lino_xl*:
  `dc6e3b2 <https://github.com/lino-framework/xl/commit/918f206d0fd7a41ba56c2c9f093907766dc6e3b2>`__
- 2017-04-07 10:13 in *lino_noi*:
  `6c2aeb3 <https://github.com/lino-framework/noi/commit/f8168b6bccac0d43b948f99daa240149e6c2aeb3>`__
- 2017-04-07 10:14 in *blog*:
  `086b345 <https://github.com/lsaffre/blog/commit/f6c08af6e41321ed2a96f8711029ff937086b345>`__
  




Lino application with mobile-friendly interface
===============================================

Joe plans a new Lino project which requires a mobile-friendly
interface. He wrote "What I have in mind is probably just changing the
skin to look more "modern" and what is more important to have
everything bigger - bigger buttons, windows, etc.  It is possible to
use the same skin as for example `this example
<http://examples.sencha.com/extjs/6.2.0/examples/classic/ticket-app/index.html>`__
is using? I was hoping that Lino ExtJS 6 will have this skin by
default.  In current "old style" everything is too small."

Hamza already answered correctly that yes you can choose which theme
or skin you want to use by setting the `theme_name
<https://github.com/lino-framework/extjs6/blob/master/lino_extjs6/extjs6/__init__.py#L126>`__
config for your site.

Spontaneously I would add that Joes "only" problem is the dashboard
(the main page). This page is indeed built using plain html and does
not use the ExtJS widgets, that's why everything looks so "small".

I suggest that you explore how Lino builds this page:

- :meth:`lino.core.site.Site.get_dashboard_items`
- :attr:`lino.core.userprefs.UserPrefs.dahboard_items`
- :xfile:`admin_main_base.html`
- :meth:`lino.core.dashboard.ActorItem.render`
- :meth:`lino.core.requests.BaseRequest.show`
- :meth:`lino_extjs6.extjs6.ext_renderer.Renderer.show_table`

I guess that we must define a :meth:`table2story` method on
:class:`lino_extjs6.extjs6.ext_renderer.Renderer` which overrides the
default implementation in :class:`lino.core.renderer.HtmlRenderer`.
  
Avanti weiter
=============

The seemingly innocent with of removing the :attr:`newcomer
<lino_xl.lib.coachings.choicelists.ClientStates.newcomer>` state from
their :class:`ClientStates
<lino_xl.lib.coachings.choicelists.ClientStates>` (:ticket:`1698`)
turned out to be quite a challenge.  I even merged the avanti demo
project and specs into book (:ticket:`1626`) because .

The problem here is that :class:`Coachable
<lino_xl.lib.coachings.mixins.Coachable>` defined the
:attr:`client_state` field with :attr:`newcomer` as default value, and
we then removed that default value from our choicelist.  The current
solution is to use the choicelist's :attr:`default_value
<lino.core.choicelists.Coicelist.default_value>` which has the
disadvantage that we must explicitly specify ``default=''`` when using
:class:`ClientStates <lino_xl.lib.coachings.choicelists.ClientStates>`
as a parameter field. Besides this it had a pitfall (which I now
removed): the :attr:`default_value
<lino.core.choicelists.Coicelist.default_value>` was being evaluated
at the field's definition time. This was too early because we want to
change them also later (e.g. during :attr:`workflows_module
<lino.core.site.Site.workflows_module>`).


A noteworthy stumblestone was a Sphinx warning
:message:`book/docs/api/index.rst:3: WARNING: Duplicate explicit
target name: "lino"` which surprisingly appeared after merging the
avanti api into the book.  This was because :ref:`avanti` had the
following text in its `long_description`::

    Lino Avanti is a free `Lino <http://www.lino-framework.org/>`_
    application ...

It must be::       
    
    Lino Avanti is a free `Lino <http://www.lino-framework.org/>`__
    application ...

Sphinx references ignore uppercase/lowercase, and the difference
between ```foo <bar.html>`_`` and ```foo <bar.html>`__`` is that the
latter inserts an "anonymous" link while the former also inserts a
reference (which is built from the link text).