diff --git a/CHANGELOG.md b/CHANGELOG.md index 36135cb153dcd25247288dbd26f4b4717b717922..eabd0f69d3867d0443c4082288e2ec375f47210f 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -17,6 +17,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 * `form_elements.make_form_modal` and `form_elements.make_scripting_submission_button` functions to create a form modal and an SSS submission button, respectively. +* Allow to supply a function that creates the form instead of a config to + create_show_form_callback * `BUILD_MODULE_EXT_ENTITY_ACL_USER_MANAGEMENT_BUTTON` build variable with which a button to the user management is added to the navbar for users with role administration if `BUILD_MODULE_EXT_ENTITY_ACL=ENABLED`. diff --git a/README_SETUP.md b/README_SETUP.md index fdd6b9f48990fad4bf9259f35ef5617ad0b9beca..195e2f729caa98745857ee9b7b3a7b3683d5a34f 100644 --- a/README_SETUP.md +++ b/README_SETUP.md @@ -20,11 +20,10 @@ * * ** end header --> - -# Getting Started with the Web Interface +# Build and install the Web Interface Here, we document how to install and build the CaosDB Web Interface. If you are -only interested in how to use it, please continue [here](tutorials/first_steps.html) +only interested in how to use it, please continue [here](tutorials/index). ## Folder Structure @@ -73,7 +72,7 @@ See `build.properties.d/00_default.properties` for more information. * Run `make clean` to clean up everything. -## Documentation # +## Build the documentation # Build documentation in `build/` with `make doc`. diff --git a/src/core/js/form_panel.js b/src/core/js/form_panel.js index 9728a4ccea54c36d85399a3148373b7372108db0..a745f949f98d6219e377783d7ca6c854908df573 100644 --- a/src/core/js/form_panel.js +++ b/src/core/js/form_panel.js @@ -65,15 +65,33 @@ var form_panel = new function () { }; /** - * Creates a callback function that toggles the form panel which + * Creates a callback function that creates the form inside + * the form panel when called for the first time. + * + * You may supply 'undefined' as form_config and use form_creator + * instead which is supposed to be a function without argument that + * return the form to be added to the panel */ - this.create_show_form_callback = function (panel_id, title, form_config) { + this.create_show_form_callback = function ( + panel_id, title, form_config, form_creator=undefined + ) { return (e) => { logger.trace("enter show_form_panel", e); const panel = $(form_panel.get_form_panel(panel_id, title)); if (panel.find("form").length === 0) { - const form = form_elements.make_form(form_config); + if (form_config != undefined && form_creator!=undefined){ + throw new Error("create_show_form_callback takes either a FormConfig or a function that creates the form"); + } + + var form; + if (form_config != undefined ){ + form = form_elements.make_form(form_config); + } else if (form_creator != undefined ){ + form = form_creator(); + } else { + throw new Error("create_show_form_callback takes a FormConfig or a function that creates the form"); + } panel.append(form); $(form).find(".selectpicker").selectpicker(); diff --git a/src/doc/conf.py b/src/doc/conf.py index cde1d8d627cd3364159ffdb899a701dd72eedd82..85a65a388efebafbd296b8f9d9f70ac072fa1984 100644 --- a/src/doc/conf.py +++ b/src/doc/conf.py @@ -41,10 +41,10 @@ release = '0.10.2-SNAPSHOT' # extensions coming with Sphinx (named 'sphinx.ext.*') or your custom # ones. extensions = [ -# 'sphinx_js', + # 'sphinx_js', 'sphinx.ext.todo', "sphinx.ext.autodoc", -# 'autoapi.extension', + # 'autoapi.extension', "recommonmark", # For markdown files. "sphinx_rtd_theme", 'sphinx.ext.intersphinx', @@ -70,7 +70,7 @@ master_doc = 'index' # # This is also used if you do content translation via gettext catalogs. # Usually you set "language" from the command line for these cases. -language = None +language = "en" # List of patterns, relative to source directory, that match files and # directories to ignore when looking for source files. diff --git a/src/doc/index.rst b/src/doc/index.rst index 96160cbee955f732f86c53f9416701faf569bdfc..fe38c99c75f288ee82591dd07de30d44c313c3c9 100644 --- a/src/doc/index.rst +++ b/src/doc/index.rst @@ -7,15 +7,19 @@ Welcome to the documentation of CaosDB's web UI! :caption: Contents: :hidden: - Getting started <getting_started> + Manual installation <install> Tutorials <tutorials/index> Concepts <concepts> administration/index.rst Extending the UI <extension> API <api/index> +.. note:: -This documentation helps you to :doc:`get started<getting_started>`, explains the most important + Go to `demo.indiscale.com <https://demo.indiscale.com>`__ and take the interactive tour to learn + how to use LinkAhead's web interface. + +This documentation helps you to :doc:`install the web UI <install>`, explains the most important :doc:`concepts<concepts>` and offers a range of :doc:`tutorials<tutorials/index>`. diff --git a/src/doc/getting_started.md b/src/doc/install.md similarity index 100% rename from src/doc/getting_started.md rename to src/doc/install.md diff --git a/test/core/js/modules/form_panel.js.js b/test/core/js/modules/form_panel.js.js index be4c4ad8e66402adedf8c386ff086be4d7cb7955..a810fb8711f14bc3b3637297c9f937884022fc15 100644 --- a/test/core/js/modules/form_panel.js.js +++ b/test/core/js/modules/form_panel.js.js @@ -55,9 +55,18 @@ QUnit.test("create_show_form_callback ", function (assert) { help: help_text, }, ], }; - const cb = form_panel.create_show_form_callback( panel_id, title, csv_form_config); + const cb = form_panel.create_show_form_callback(panel_id, title, csv_form_config); assert.equal(typeof cb, "function", "function created"); cb() + + const creator = function() { + return form_elements.make_form(csv_form_config); + } + const cb2 = form_panel.create_show_form_callback( + panel_id, title, undefined, creator + ); + assert.equal(typeof cb2, "function", "function created"); + cb2() });