Ember Addons (KB using Tailwind) ******************************** - :doc:`dev-ember` - :doc:`dev-ember-addons` - :doc:`dev-ember-auth` - :doc:`dev-ember-data` - :doc:`dev-ember-patterns` Application =========== Put the following into ``application.hbs``:: {{outlet}} Add ``Header`` and ``Content`` sections to your template: .. tip:: Add a ``Profile`` and one or more ``Panel`` sections. .. tip:: The ``Panel::Group`` separates groups of controls e.g. buttons on the left and buttons on the right. :: To add labels to input controls in the panel:: State .. note:: For now, you will need to add labels to all the controls so the spacing works correctly. If you need two header rows, then add another header section. Setting ``mergeWithAbove`` to ``true`` will fix the spacing e.g:: Data Display ============ .. tip:: Also know as *Data Table* (DataTable). Copied from *Description Lists*, *Data Display*, *Left-aligned in card*:: My description {{{value}}} .. note:: 03/09/2022, Revised in ``ember-kb-base`` except for ``RowList``. Button Grid ----------- See Tab_ below for an example of buttons in a ``flex``. A grid has also worked for me e.g::
View Document
Return to list
.. tip:: Try using ``class="justify-self-start"`` to align the first button. Development =========== An ``addon`` will include an ``index.js`` file in the root of the package. To allow your project to auto-refresh, then set ``isDevelopingAddon`` to ``true`` in ``module.exports`` e.g: .. code-block:: javascript module.exports = { name: require("./package").name, isDevelopingAddon: function () { return true }, Forms ===== The standard form is copied from the TailwindUI *Two-column with cards* layout https://tailwindui.com/components/application-ui/forms/form-layouts .. tip:: This was called *Two-column cards with separate submit actions*, but it no longer exists on the TailwindUI site. The full width form uses styles from the *Stacked* form layout. .. tip:: To submit the form using the keyboard and to make sure the form isn't submitted twice, add the ``onSubmit`` to ``KbForm::Form`` (not the ``Button``). :: My Heading Some extra help... Reason for deletion Please enter the reason for deleting the workflow process... Cancel Delete workflow .. note:: The ``KbForm::Form::Button::Container`` probably isn't needed if you have one button... Select ------ .. tip:: Initial version created August 2023. Currently does not handle required fields or multi-select. :: Category Please select a category... - The ``options`` will need an ``id`` and a ``name`` to render. - ``setOption`` is an ``action`` which will receive the ``id`` of the selected option (example below). - ``value`` is the initial ``id`` of the option (probably from the ``changeset``). :: @action setCategory(optionId) { this.setCategoryTask.perform(optionId); } setCategoryTask = task(async (categoryId) => { try { let category = await this.store.findRecord( 'flowListCategory', categoryId, ); this.changeset.set('category', category); } catch (e) { this.kbMessages.addError( `Cannot find flow list category ${categoryId}`, e, ); } }); .. _dev-ember-addons-kb-markdown: Markdown ======== .. tip:: 13/10/2023, Our ``task/form/str`` component has support for Markdown in the help text, but has not been added elsewhere (yet) Using https://github.com/empress/ember-cli-showdown Update ``package.json``:: "@tailwindcss/typography": "^0.5.10", ember-cli-showdown": "^7.0.0", Add the Tailwind ``typography`` plugin:: # front/tailwind.config.js plugins: [require('@tailwindcss/forms'), require('@tailwindcss/typography')], Format the text using Tailwind ``prose`` and the ``markdown-to-html`` component::

{{markdown-to-html @field.help_text}}

For more information, see, https://www.kbsoftware.co.uk/crm/ticket/6864/ SVG Icons ========= - We use https://heroicons.com/. - There are two types of icons, *default* and *solid*. Solid icons should be used on buttons (because they fit). - The component name should match the name of the icon e.g. the *solid* icon for ``arrow-circle-left`` is named ``addon/components/kb-svg/arrow-circle-left-solid.hbs`` Tab === This is a tab bar with two tabs and one button:: {{#if @model.documentTask.isRunning}}{{else}} {{#let @model.documentTask.value as |document|}} Create {{/let}} {{/if}} .. tip:: Add ``@verticalPadding={{false}}`` to the ``KbButton``. Our standard pattern is to put tabs and buttons at the top of the page. If you want buttons, but don't need a tab, then use the same pattern but with no parameters for the tabs e.g:: Create .. tip:: To use a ``LinkTo`` within the ```` try enclosing it in ``
`` .. _dev-ember-addons-kb-table: Table ===== A checklist for handling data and for adding a spinner / *nothing found* to your table can be found here :ref:`dev-ember-patterns-tables-data`:: {{#if @model.processes.isRunning}} {{else}} Edit {{/if}} .. tip:: For pagination, see :ref:`dev-ember-patterns-pagination`. Table Header ============ If you want a title, description and button above your table:: .. tip:: You only need the ```` section if you want to add a button. Upload (File) ============= Is a legacy component. I added a new ``@maxFileSize`` attribute e.g::