Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add automatic json conversion for attributes #232

Merged
merged 3 commits into from
Oct 31, 2023
Merged

Conversation

hhaensel
Copy link
Member

This PR addresses #231.

It requires adaptation of the respective functions in StippleUI to allow for Vectors or Dicts.

E.g. with

function btntoggle(fieldname::Symbol,
                args...;
                options::Union{Symbol, Vector{<:AbstractDict}},
                kwargs...)

  q__btn__toggle(args...; kw(
    [Symbol(":options") => options, :fieldname => fieldname, kwargs...])...)
end

we could write

julia> import Stipple.opts

julia> btntoggle(:network, options = [opts(label = x, value = lowercase(x)) for x in ("Google", "Facebook")])
"<q-btn-toggle v-model=\"network\" :options=\"[{'value':'google','label':'Google'},{'value':'facebook','label':'Facebook'}]\"></q-btn-toggle>"

julia> select(:selector, options = ["a", "b", "c"],)
"<q-select v-model=\"selector\" :options=\"['a','b','c']\"></q-select>"

@essenciary
Copy link
Member

@hhaensel is this breaking or the current syntax is still supported?

@essenciary
Copy link
Member

@hhaensel nothing to comment regarding the code and I can't see anything off. Does it require more testing? If tests pass, it's good to go IMO.

@hhaensel
Copy link
Member Author

@hhaensel is this breaking or the current syntax is still supported?

Old syntax is, of course, still supported. Some adaptiations will needed to be made in StippleUI to support the new attribute handling.
That's already waiting 😉

@hhaensel hhaensel merged commit 65bc066 into master Oct 31, 2023
20 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants