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

get_value and its use #16

Merged
merged 4 commits into from
Apr 18, 2012
Merged

get_value and its use #16

merged 4 commits into from
Apr 18, 2012

Conversation

tex
Copy link
Contributor

@tex tex commented Feb 11, 2012

This is inplace element, general version of inplace_textbox and inplace_textarea.

It can replace both of them by simply:

inplace{edit=#textbox{}, view=#span{}},

inplace{edit=#textarea{}, view=#span{}}.

It also supports #image and #dropdown. Any other element can be used as well.
It supports actions connected to edit element.

Example:

body() ->
Span = #span{},
TextBox = #textbox{ id=testBox, actions=[ #validate { validators=[ #is_required { text="Required." } ] } ] },
ListBox = #dropdown{ options = [
#option { text = "Pokus1" },
#option { text = "Pokus2" },
#option { text = "Pokus3" } ]},
Image = #image{ alt="obrazek" },
TextBoxImage = #textbox{ text = Image#image.image },
[
#panel { body=[
#inplace { tag=a, text="Pokus1", view=Span, edit=TextBox },
#inplace { tag=b, text="Pokus2", view=Span, edit=ListBox },
#inplace { tag=c, text="/images/test.jpg", view=Image, edit=TextBoxImage }
]}
].

@choptastic
Copy link
Member

......iiiiiiinteresting. I really quite like this. We can use this as a replacement for #inplace_textbox and #inplace_textarea in general, changing those other elements to just use this, while opening this up as a more flexible abstration.

I dig it.

Before I merge this, I'd like to play with it a bit, but I like this a lot. Kudos to you.

@tex
Copy link
Contributor Author

tex commented Feb 13, 2012

Cool!

Let me know if you'd like to change something. I personally don't like much the part about getting/generating view and edit element's IDs. I'll rewrite it using the base 'trick' I learnt some time after I created this element.

tex added 2 commits February 13, 2012 18:15
use wf_utils:get_elementbase to get module and id
of view and edit elements.

use better names of variables in append_field_actions
and refactor it to make it more readable.
choptastic added a commit that referenced this pull request Apr 18, 2012
get_value and its use
@choptastic choptastic merged commit 7fa7fc2 into nitrogen:master Apr 18, 2012
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.

2 participants