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

Add option to dashboard widget to show all submissions, or just for the current user #203

Open
engram-design opened this issue Feb 6, 2024 · 2 comments
Labels
feature request New feature or request

Comments

@engram-design
Copy link
Member

engram-design commented Feb 6, 2024

Currently, all submissions are shown in the dashboard widget, including ones users might not have access to, which isn't a good look. Add the option to show all, or just the ones that the current user is the editor/reviewer/publisher on.

@engram-design engram-design added the feature request New feature or request label Feb 6, 2024
@engram-design engram-design changed the title Add option to widget to show all submissions, or just for the current user Add option to dashboard widget to show all submissions, or just for the current user Feb 6, 2024
@MoritzLost
Copy link

@engram-design That would be great!

We already needed this, so we built it as a custom widget that extends the built-in widget. Just leaving this here in case someone needs it:

use Craft;
use verbb\workflow\elements\Submission;
use verbb\workflow\widgets\Submissions;

class OwnSubmissions extends Submissions
{
    public static function displayName(): string
    {
        return Craft::t('custom_workflows', 'My submissions');
    }

    public function getBodyHtml(): ?string
    {
        $user = Craft::$app->user?->getIdentity();
        if (!$user) {
            return '';
        }
        $submissions = Submission::find()
            ->status($this->status)
            ->limit($this->limit)
            ->editorId($user->id)
            ->all();

        return Craft::$app->getView()->renderTemplate('workflow/_widget/body', [
            'submissions' => $submissions,
        ]);
    }
}

Might make sense to have it as a separate widget (as opposed to an option in the existing widget) so we can provide some users access to only this limited widget.

@engram-design
Copy link
Member Author

Thanks for that! Yep, might be it's own separate widget, or just adding some settings to chose what to show. Appreciate it 👍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature request New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants