Hi,
I'm working on adding in-place preview editing to Bricolage for WHO.
However, being fairly new to Bricolage and Mason, I was hoping to get
some input on implementation. We want to get these changes committed
back into the project, so let me know if there's something that should
be done differently.
I've been playing around with the framework of getting this implemented
and what I've got so far is this:
- Modified /autohandler to load the in-place edit javascript and css
when we're in preview mode.
- Modified the various templates to store data that we need for the
field (I'm storing this in the class attribute).
So this gives me the basic interface to get the in-place editing
started. For the second item, I'm trying to add some way of making this
a simple task. Here is one of the things I'm not sure would be the best
approach to doing this. Would this be best done using a utility
template, creating a code ref in a <%shared> block, or <%method>? I
have currently got it set up as a template:
<%args>
$element
$just_classes => 0
</%args>
<%perl>
if ($burner->get_mode == PREVIEW_MODE) {
my $class = 'bricInlineEdit bricInlineEdit' . $element->get_id();
if ($just_classes) {
$m->out(" $class ");
}
else {
$m->out(qq| class="$class" |);
}
}
</%perl>
I'll probably need a global variable so we don't need to call
$burner->get_mode == PREVIEW_MODE (and whatever tests we might need) all
over the place. Would that be best placed in a <%shared> block in
/autohandler?
On the code side of things is where I'm really lost. I need to write
the code that the javascript will POST back to to save the field changes
given the element ID. I've been looking into how bulk edits are
saved and it looks like data is stored in sessions and saved using the
ContainerProf callback. Can anyone point me in the right direction for
this? I'm thinking we'll only allow in-place editing if you've already
checked out the story, so that should solve some of the permission
issues involved with being able to edit things. Are there any other
issues I need to be aware of for making such changes?
Thanks for any input!
Adrian
PS: I just realized that an element may have multiple fields so I need
to pass more than just the element ID back.
I'm working on adding in-place preview editing to Bricolage for WHO.
However, being fairly new to Bricolage and Mason, I was hoping to get
some input on implementation. We want to get these changes committed
back into the project, so let me know if there's something that should
be done differently.
I've been playing around with the framework of getting this implemented
and what I've got so far is this:
- Modified /autohandler to load the in-place edit javascript and css
when we're in preview mode.
- Modified the various templates to store data that we need for the
field (I'm storing this in the class attribute).
So this gives me the basic interface to get the in-place editing
started. For the second item, I'm trying to add some way of making this
a simple task. Here is one of the things I'm not sure would be the best
approach to doing this. Would this be best done using a utility
template, creating a code ref in a <%shared> block, or <%method>? I
have currently got it set up as a template:
<%args>
$element
$just_classes => 0
</%args>
<%perl>
if ($burner->get_mode == PREVIEW_MODE) {
my $class = 'bricInlineEdit bricInlineEdit' . $element->get_id();
if ($just_classes) {
$m->out(" $class ");
}
else {
$m->out(qq| class="$class" |);
}
}
</%perl>
I'll probably need a global variable so we don't need to call
$burner->get_mode == PREVIEW_MODE (and whatever tests we might need) all
over the place. Would that be best placed in a <%shared> block in
/autohandler?
On the code side of things is where I'm really lost. I need to write
the code that the javascript will POST back to to save the field changes
given the element ID. I've been looking into how bulk edits are
saved and it looks like data is stored in sessions and saved using the
ContainerProf callback. Can anyone point me in the right direction for
this? I'm thinking we'll only allow in-place editing if you've already
checked out the story, so that should solve some of the permission
issues involved with being able to edit things. Are there any other
issues I need to be aware of for making such changes?
Thanks for any input!
Adrian
PS: I just realized that an element may have multiple fields so I need
to pass more than just the element ID back.