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

[7.0] [Draft] Content Submission #965

Closed
tabuna opened this issue Sep 24, 2019 · 1 comment
Closed

[7.0] [Draft] Content Submission #965

tabuna opened this issue Sep 24, 2019 · 1 comment
Assignees
Labels

Comments

@tabuna
Copy link
Member

tabuna commented Sep 24, 2019

Now all kinds of fields, layers are built for editing by the user and making any changes. But when I need to display data, I have to use my own blade templates. They are quite flexible and convenient to use.

But we could provide some set for displaying data. I see this as a subset of the layer.
For example, card:

image

code:

namespace Orchid\Screen\Contents;

use Illuminate\Support\Arr;
use Orchid\Screen\Repository;
use Orchid\Screen\Layouts\Base;
use Orchid\Access\UserInterface;
use Orchid\Platform\Models\User;
use Orchid\Screen\Actions\Button;
use Illuminate\Support\Facades\Auth;
use Orchid\Screen\Contracts\ActionContract;

class CardContent extends Base
{

    /**
     * @return string|null
     */
    protected function title(): ?string
    {
        return $this->query->get('product.name');
    }

    /**
     * @return string|null
     */
    protected function descriptions(): ?string
    {
       return $this->query->get('product.descriptions');
    }

    /**
     * @return string|null
     */
    protected function image(): ?string
    {
         return $this->query->get('product.image');
    }

    /**
     * @return mixed
     */
    protected function status()
    {
        return $this->query->get('product.status');
    }

    /**
     * @return User|User[]|\Illuminate\Contracts\Auth\Authenticatable|null
     */
    protected function users()
    {
        return [
            Auth::user(),
            Auth::user(),
            Auth::user(),
        ];
    }

    /**
     * @param UserInterface $user
     *
     * @return string
     */
    protected function linkForUser(UserInterface $user)
    {
        return route('platform.systems.users.edit', $user);
    }

    /**
     * @return array
     */
    protected function commandBar(): array
    {
        return [
            Button::make('Example Button')
                ->method('example')
                ->icon('icon-bag'),
            Button::make('Example Button')
                ->method('example')
                ->icon('icon-bag'),
        ];
    }
}

Cons or cons.

All options do not have such flexibility as their own blade templates, but provide the user with examples of construction and operation. Let's try to decide if we need this and whether they will be useful in building the application.

For example, comments:
image

We can take it out as a separate package. But I am not ready to support him. Therefore, I propose to implement this in the platform.

Let's vote and leave your thoughts and comments here


@tabuna tabuna self-assigned this Sep 24, 2019
@polls polls bot added the Polls label Sep 24, 2019
@tabuna tabuna pinned this issue Oct 20, 2019
@tabuna tabuna changed the title Content Submission [Draft] Content Submission Oct 29, 2019
tabuna added a commit that referenced this issue Dec 8, 2019
@tabuna
Copy link
Member Author

tabuna commented Dec 9, 2019

I am glad that not one person needs similar means.
For a few days I thought about the full implementation of such things in the platform. At the moment, I think that it will be a success to add "Pressenters" for classes and their interface-based work.

This now looks like this:

$contentForCard = new class implements \Orchid\Screen\Presenters\Card {

    /**
     * @return string
     */
    public function title(): string
    {
        return 'Title of a longer featured blog post';
    }

    /**
     * @return string
     */
    public function descriptions(): string
    {
        return 'This is a wider card with supporting text below as a natural lead-in to additional content.';
    }

    /**
     * @return string
     */
    public function image(): ?string
    {
        return 'https://picsum.photos/600/300';
    }

    /**
     * @return mixed
     */
    public function status()
    {
        return 'success';
    }

    /**
     * @return mixed
     */
    public function users()
    {
        return [];
    }
};


$instance = new \Orchid\Screen\Contents\Card('card', [
    Button::make('Example Button')
        ->method('example')
        ->icon('icon-bag'),
    Button::make('Example Button')
        ->method('example')
        ->icon('icon-bag'),
]);

tabuna added a commit that referenced this issue Dec 9, 2019
@tabuna tabuna changed the title [Draft] Content Submission [6.8] [Draft] Content Submission Dec 26, 2019
tabuna added a commit that referenced this issue Jan 5, 2020
tabuna added a commit that referenced this issue Jan 5, 2020
tabuna added a commit that referenced this issue Jan 5, 2020
tabuna added a commit that referenced this issue Jan 5, 2020
tabuna added a commit that referenced this issue Jan 5, 2020
tabuna added a commit that referenced this issue Jan 5, 2020
@tabuna tabuna changed the title [6.8] [Draft] Content Submission [6.9] [Draft] Content Submission Jan 6, 2020
tabuna added a commit that referenced this issue Jan 28, 2020
tabuna added a commit that referenced this issue Mar 5, 2020
@tabuna tabuna changed the title [6.9] [Draft] Content Submission [7.0] [Draft] Content Submission Mar 11, 2020
@tabuna tabuna closed this as completed Mar 11, 2020
@tabuna tabuna unpinned this issue Mar 11, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Development

No branches or pull requests

1 participant