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

In progress - chip dropdown component #2857

Open
wants to merge 4 commits into
base: 4.0-dev
Choose a base branch
from

Conversation

ctanveer
Copy link

Description

Chip dropdown with quickadd htmx call added

Link to ticket

Please add a link to the GitHub issue being addressed by this change.

Type

  • Fix
  • Feature
  • Cleanup

Screenshot of the result

If your change affects the user interface, you should include a screenshot of the result with the pull request.

@ctanveer ctanveer requested a review from a team as a code owner December 18, 2024 12:02
if (is_numeric($result)) {
$params['id'] = $result;
$this->tpl->setNotification($this->language->__('notification.milestone_created_successfully'), 'success');
$subject = $this->language->__('email_notifications.milestone_created_subject');
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The email notification part should actually just be in the quickAddMilestone Service. That way people will get notified event if the milestone is being created via api

id="{{ $milestoneDropdownId }}"
:style="'background-color:' . $milestoneColor"
<x-global::forms.chip
class="ticketDropdown milestoneDropdown colorized milestone show f-left"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we need those classes still? Or is this something we can move into a chip component css so that it's less tied to "tickets" and more generally applicable

<x-global::actions.dropdown.item class="nav-header border">
:parentId="$row['id']"
:quickaddOption="true"
quickaddPostUrl="{{ BASE_URL }}/hx/tickets/Milestones"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You could just pass the hx-* attributes rather than create a new attribute.
Basically just use hx-post and create the appropriate hxPost variable in your component. Maybe add hx-swap, hx-target, hx-trigger etc as well I am pretty sure you could just use the $attributes array that is available in the component and look for entries that start with hx

])

<div {{ $attributes->merge([ 'class' => '' ]) }}>
<div class="dropdown ticketDropdown {{ $type }}Dropdown colorized show px-2 py-0.5 ml-1.5 {{ $extraClass }}">
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Seems this is the old dropdown code, we should use our dropdown component for this

$inputName = $type == 'milestone' ? 'headline' : 'name';
@endphp

<div {{ $attributes->merge([ 'class' => 'mx-2' ]) }}>
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

From above: You can take the attributes array and look for keys() that start with
'hx'. Then take all those keys and add them below to the form tag.

I believe $attribute is a collection so you can do:

$hxAttributes = $attributes->filter(function($field, $key){            
    if(Str::startsWith($key, 'hx')) {
         return;
    }
});

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

PS: You would want to only show the non hx tags up here in the div tag

style="padding-top:5px; padding-bottom:5px;">

<form
hx-post={{ $postUrl }}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Then here you would just do {{ $hxAttributes }}

<i class="fas fa-plus-circle"></i> Add {{ $type }}
</a>
<div class="hideOnLoad" id="{{ $type }}_new_{{ $parentId }}"
style="padding-top:5px; padding-bottom:5px;">
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please remove inline styles

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

Successfully merging this pull request may close these issues.

2 participants