kitchen-site icon indicating copy to clipboard operation
kitchen-site copied to clipboard

Referencing different div's in a form

Open xauxatz opened this issue 9 years ago • 5 comments

I've been trying to place buttons at different rows in a form, but cannot seem to find a way to control their placement. I have the "dest. selector" and have tried to use nth-of-type(1), etc. - but the kitchen generator gives an error for these tags. Is there another way of doing it?

xauxatz avatar Mar 31 '16 07:03 xauxatz

@xauxatz "dest_selector" is not jQuery thing, only syntax is similar (it instructs kitchen's internal HTML parser on where to put the content), so only three forms are supported: select by tag name, by class name and by element id.

So, I guess you need to know your button's parent element id or class in order to correctly place the button.

perak avatar Mar 31 '16 07:03 perak

For the life of me I can't figure out how to do it. But I'm not a CSS expert either.

Meteorkitchen autogenerates this html:

{{get_current_plan current_customer.plan}}{{>UserSettingsBillingEditPlan}}

{{get_payment_method current_customer.payment_method}}

{{>UserSettingsBillingUpdateCard}}

The button UserSettingsBillingEditPlan is correctly positioned, since it refers to the first occurrence of .form-control-static.

For the second button, UserSettingsBillingUpdateCard, there is no unique tag on the innermost "div", so how can I correctly place the button there?

It seems impossible...

On 3/31/2016 9:19 AM, Petar Korponaić wrote:

@xauxatz https://github.com/xauxatz "dest_selector" is not jQuery thing, only syntax is similar (it instructs kitchen's internal HTML parser on where to put the content), so only three forms are supported: select by tag name, by class name and by element id.

So, I guess you need to know your button's parent element id or class in order to correctly place the button.

— You are receiving this because you were mentioned. Reply to this email directly or view it on GitHub https://github.com/perak/kitchen-site/issues/271#issuecomment-203793448

xauxatz avatar Mar 31 '16 09:03 xauxatz

@xauxatz I added it to next version. Until then, here is dirty fix:

  1. edit your ~/.meteor-kitchen/templates/blaze/ui/bootstrap/components/form.html add control-FIELD_ID into <p class="form-control-static control-FIELD_ID"> somewhere in line 56, it will look like this:
<div id="form-input-read-only" class="form-group FIELD_GROUP_CLASS FIELD_ID">
    <label for="FIELD_NAME">FIELD_TITLE</label>
    <div class="input-div">
        <p class="form-control-static control-FIELD_ID" >FIELD_VALUE</p>
    </div>
</div>

Then, your button's dest_selector set to ".control-field-payment_method"

perak avatar Mar 31 '16 09:03 perak

Thanks :-)

On 3/31/2016 11:49 AM, Petar Korponaić wrote:

@xauxatz https://github.com/xauxatz I added it to next version. Until then, here is dirty fix:

  1. edit your |~/.meteor-kitchen/templates/blaze/ui/bootstrap/components/form.html| add |control-FIELD_ID| into |

    | somewhere in line 56, it will look like this:

|

<p class="form-control-static control-FIELD_ID"

FIELD_VALUE

|

Then, your button's |dest_selector| set to |".control-field-payment_method"|

— You are receiving this because you were mentioned. Reply to this email directly or view it on GitHub https://github.com/perak/kitchen-site/issues/271#issuecomment-203856749

xauxatz avatar Mar 31 '16 09:03 xauxatz

:+1:

perak avatar Mar 31 '16 09:03 perak