https://twill.io logo
Join Discord
Powered by
# ❓questions
  • k

    kalle

    10/27/2022, 7:32 PM
    @uwascan Do you find side fieldsets useful in your case? You can adjust this callback to make a redirects (JS navigation or post request to custom endpoint which should redirect user to specific url).
  • u

    uwascan

    10/27/2022, 10:46 PM
    I am not sure side fieldsets are useful in my case and I do not know what callback you are referring to here. I have a read only module whose records are created from the frontend contact page. I can view those records from the Twill admin panel in read only mode, but I need to provide a feature that allows admins to reply to those messages through email. I just needed a way to provide UI that the they can type their replies in and click a button to send.
  • k

    kalle

    10/27/2022, 11:23 PM
    You can check message which I replied to. It can serve the same purpose which you want to achive.
  • u

    uwascan

    10/28/2022, 1:48 AM
    Thanks. I will do just that
  • u

    uwascan

    10/28/2022, 1:59 AM
    Wonderful. Twill is powerful no doubt but tricks like these needs to be documented to make discovery a lot easier.
  • u

    uwascan

    10/28/2022, 2:26 AM
    Thanks again because around the answer you pointed me to, I found information to for how to solve another problem about managing frontend users in twill. back to my previous issue. How would you get the value of a field in the twill form to be submitted along with custom form? I have a reply_message field in my twill form I need to submit along with the from to basically send a mail. I tried using v-model to link to a hidden field. that did not work
    Copy code
    @section('content')
        @parent
    
        {{-- Add a form for the custom POST action, outside of Twill's main form --}}
        <form action="/admin/my-custom-action" method="POST" hidden>
            <input type="hidden" ref="replyData" v-model="reply_message" />
            <button type="submit" ref="actionApproveBtn">Approve</button>
        </form>
    @stop
    p
    • 2
    • 2
  • d

    dakaalim

    10/28/2022, 3:02 AM
    Latest change route
    Copy code
    Route::get('/locations/{slug}', [LocationController::class, 'page'])->name('location');
    controller
    Copy code
    use A17\TwillTransformers\ControllerTrait;
    
        public function page($slug, LocationRepository $repo)
        {
            $data = $repo->published()->forSlug($slug)->first();
    
            return $this->view($data ?? null);
        }
    This is what working for me, please point me in the right direction if you know a 'better' way.
  • h

    Harings Rob

    10/28/2022, 7:01 AM
    This looks good
  • i

    ifox

    10/28/2022, 7:17 AM
    you can still simplify to just
    $data = $repo->forSlug($slug);
    for the same result
  • k

    kalle

    10/28/2022, 8:55 AM
    I dont have any idea which could help you here since Im not familiar that much with Vue. Those components are already compiled and it makes harder to apply some additional logic. For this usage of yours you can create custom Vue component which would resolve this usage easily. cc @pboivin for possible help 🙂
  • u

    uwascan

    10/28/2022, 10:18 AM
    Thanks. I will look for a way out
  • p

    pboivin

    10/28/2022, 1:15 PM
    custom-form-action
  • u

    uwascan

    10/30/2022, 1:14 AM
    I am trying to use native Twill vue input component in a custom vue component but I cant figure out how v-model works.
    Copy code
    <a17-textfield name="message" label="Message Body"
               type="textarea" :rows="5" v-model="form.message">
            </a17-textfield>
    Two way binding with v-model is not working. Is there any documentation of the Vue components of Twill?
  • u

    uwascan

    10/30/2022, 1:37 AM
    Ended up using @change event for now to manually sync data
  • b

    BA7YA

    10/31/2022, 9:35 AM
    Hi guys. Is there any chance to get name of parent block in repeater blade without using any helpers?
    i
    • 2
    • 21
  • h

    Hip-Hop

    10/31/2022, 9:37 AM
    Good afternoon! Please advise on my question. You need to sort the records in descending order by the created_at field. By default, I see that there is already a code protected $defaultOrders = [ 'created_at' => 'desc', ]; But for some reason it doesn't sort properly. Has anyone experienced this? There must be a newer entry first.
  • i

    ifox

    10/31/2022, 9:49 AM
    I see on your screenshot that reordering is enabled on your module. It won't sort by a column if you are enabling reorder, it will sort by position.
  • i

    ifox

    10/31/2022, 9:50 AM
    Parent block in repeater
  • h

    Hip-Hop

    10/31/2022, 10:51 AM
    @ifox Should I then remove HasNesting and HandleNesting?
  • i

    ifox

    10/31/2022, 10:55 AM
    Well that depends if you need it or not, but you can't combine it with ordering since ordering is controlled manually
  • d

    devtutorum

    10/31/2022, 4:26 PM
    What's the easiest way to turn a non-translatable module into a translatable module?
  • h

    Harings Rob

    10/31/2022, 5:20 PM
    I am afraid there is no "easy" way, you will have to write a manual migration to do that. To start with, I would generate a similar module and compare so you know which additional classes you have to create on top of your model.
  • h

    Hip-Hop

    11/01/2022, 10:04 AM
    Good afternoon! Can you tell me if the following can be done? A user with a certain role can go to the article. He is only allowed to publish it, but not to edit it (I have blocks). I only have thoughts to do it through the blade
  • h

    Harings Rob

    11/01/2022, 10:06 AM
    Hey @Hip-Hop didnt you make a support post about this?
  • h

    Hip-Hop

    11/01/2022, 10:13 AM
    @Harings Rob Wrote. But I'm interested in the point that the user with the role could not change the text in the blocks.
  • h

    Harings Rob

    11/01/2022, 10:13 AM
    you can disable the field, but there's no global way.
  • i

    ifox

    11/01/2022, 10:15 AM
    I guess if you want to only publish you could disable edit entirely for that role at the route level, and they can still publish on the index. It's a bit of a weird use case though, why would someone be allowed to publish but not have the ability to edit the content?
  • h

    Hip-Hop

    11/01/2022, 10:17 AM
    @ifox Such a task came that there are two roles. One allows you to create articles, while the other allows you to view and publish them but not edit them. I don't really like it either, but I'll have to do it for now.
  • h

    Hip-Hop

    11/01/2022, 11:19 AM
    Please tell me, Input has a default option. I'll add an example like this
    Copy code
    @formField('input', [
         'name' => 'test',
         'label' => 'test',
         'default' => 'text text',
         ])
    But the field is empty.
  • h

    Harings Rob

    11/01/2022, 11:49 AM
    If there is any value in the db for the field, even if it is an empty string, the default might not kick in.
1...421422423...484Latest