Giter Club home page Giter Club logo

Comments (8)

yassilah avatar yassilah commented on September 23, 2024

I've been thinking about changing the position of the add button as well as it can get confusing when at the bottom. Your idea could work and wouldn't be very hard to change. However, in terms of coloring the button, I still believe it is better to have the darker primary color to not confuse it with the actual current resource actions... I'll see what works best :)

from laravel-nova-nested-form.

tobeycodes avatar tobeycodes commented on September 23, 2024

That makes sense. Darker background is good. I don't think having the same size buttons is confusing as long as it's far away from the create buttons. I just thought a small one was hard to click haha.

I do think that "No memberships" text is important to be clear that you do not currently have a resource added though.

Thanks for all your work on this. It's a lifesaver :)

from laravel-nova-nested-form.

niladam avatar niladam commented on September 23, 2024

A good idea would be to have some sort of border/separator at the END of each entity ?

from laravel-nova-nested-form.

yassilah avatar yassilah commented on September 23, 2024

Hey, please try out the updated version on the "next" branch, there are a number of improvements including this one ;) Please note that you will need to remove the NestedFormTrait from your App\Nova\Resource, which is no longer needed!

from laravel-nova-nested-form.

tobeycodes avatar tobeycodes commented on September 23, 2024

@yassipad I get the error "Object of class Closure could not be converted to string". I removed the Trait.

from laravel-nova-nested-form.

yassilah avatar yassilah commented on September 23, 2024

Can you give me some more details?

from laravel-nova-nested-form.

tobeycodes avatar tobeycodes commented on September 23, 2024

When I open the resource I get this. If I switch to the master branch (and put back the trait) then everything works again. I've tried clearing the laravel cache and in a incognito browser.

screenshot 2018-11-22 18 15 55

<?php

namespace App\Nova;

use Laravel\Nova\Fields\Avatar;
use Laravel\Nova\Fields\HasMany;
use Illuminate\Http\Request;
use Laravel\Nova\Fields\Text;
use Laravel\Nova\Http\Requests\NovaRequest;
use Yassi\NestedForm\NestedForm;

class Member extends Resource
{
    /**
     * The model the resource corresponds to.
     *
     * @var string
     */
    public static $model = 'App\Member';

    /**
     * The single value that should be used to represent the resource when being displayed.
     *
     * @var string
     */
    public static $title = 'name';

    /**
     * The columns that should be searched.
     *
     * @var array
     */
    public static $search = [
        'name',
    ];

    /**
     * Get the fields displayed by the resource.
     *
     * @param  \Illuminate\Http\Request  $request
     * @return array
     */
    public function fields(Request $request)
    {
        return [
            Avatar::make('Photo')
                ->hideWhenCreating()
                ->disk('tenant'),
            Text::make('Name')
                ->rules('required'),
            Text::make('Email')
                ->sortable()
                ->rules('required', 'email', 'max:254')
                ->creationRules('unique:tenant.members,email')
                ->updateRules('unique:tenant.members,email,{{resourceId}}'),

            HasMany::make('Memberships'),

            NestedForm::make('Memberships'),
        ];
    }

    /**
     * Get the cards available for the request.
     *
     * @param  \Illuminate\Http\Request  $request
     * @return array
     */
    public function cards(Request $request)
    {
        return [];
    }

    /**
     * Get the filters available for the resource.
     *
     * @param  \Illuminate\Http\Request  $request
     * @return array
     */
    public function filters(Request $request)
    {
        return [];
    }

    /**
     * Get the lenses available for the resource.
     *
     * @param  \Illuminate\Http\Request  $request
     * @return array
     */
    public function lenses(Request $request)
    {
        return [];
    }

    /**
     * Get the actions available for the resource.
     *
     * @param  \Illuminate\Http\Request  $request
     * @return array
     */
    public function actions(Request $request)
    {
        return [];
    }
}

from laravel-nova-nested-form.

tobeycodes avatar tobeycodes commented on September 23, 2024

@yassipad I tried this again and now it is working (no idea what the issue was). Do you think the left padding should be the same as the label of a field and right padding the same as the bottom buttons like the screenshot above? I personally feel like they are squashed right now.

Thanks so much for this change!

from laravel-nova-nested-form.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.