@honeycut Awesome! The link you shared doesn’t work for me, I think your fork is private.
So I was thinking the way url
would work is that we’d introduce a new Formula Type called the
BaserowFormulaLinkType
.
This is because atm the way we decide how to render a formula in the frontend is by using its formula_type
. For example if you write a formula like 1+1
the backend calculates it’s formula_type
is number
and then the frontends BaserowFormulaNumberType
then has methods which define how to render a formula of that type (BaserowFormulaNumberType.getFunctionalGridViewFieldComponent
etc).
And so I’d imagine this way of solving this issue would look like:
- There would be a new backend
BaserowFormulaLinkType
- I think this would be a copy paste of the existing
BaserowFormulaCharType
but perhaps with a slightly different cast_to_text implementation.
- There would be a new backend function called
BaserowUrl
which returns a formula of type BaserowFormulaLinkType
and perhaps saved to the database a string like f"url=label"
instead of raw html
- There would be a new web-frontend
BaserowFormulaLinkType
once again very similar to the BaserowFormulaCharType
but instead defining its own components which render it
- There would be a new
FunctionalGridViewFieldFormulaLink
and RowEditFieldFormulaLink
components used by BaserowFormulaLinkType
which split the value to get the url and label components, and then render those as a link something like
... todo copy the rest from something like web-frontend/modules/database/components/view/grid/fields/FunctionalGridViewFieldText.vue
<a href="this.$options.methods.getUrl(this.$props.value)">
{{ this.$options.methods.getLabel(this.$props.value) }}
</a>
... todo implement the methods getUrl and getLabel
But perhaps there is a simpler way? Not sure