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 a link input into item #103

Closed
AEK-BKF opened this issue Nov 15, 2020 · 9 comments
Closed

Add a link input into item #103

AEK-BKF opened this issue Nov 15, 2020 · 9 comments

Comments

@AEK-BKF
Copy link

AEK-BKF commented Nov 15, 2020

Hello,
First, I'd like to thank you so much for this amazing package.
Please, How can I set a link into item div, so I can click on it and go to link page.

Something like this :

'item': [{
                            'title': `
                                <div class="d-flex align-items-center">
                        	        <div class="symbol symbol-success mr-3">
                        	            <img alt="Pic" src="assets/media/users/300_24.jpg" />
                        	        </div>
                        	        <div class="d-flex flex-column align-items-start">
                        	            <span class="text-dark-50 font-weight-bold mb-1">SEO Optimization</span>
                        	            <span class="label label-inline label-light-success font-weight-bold">In progress</span>
                        	        </div>
                                         **<div> <a href="link"> View </a>**
                        	    </div>
                            `,
                        },

Thanks.

@xscode-auto-reply
Copy link

Thanks for opening a new issue. The team has been notified and will review it as soon as possible.
For urgent issues and priority support, visit https://xscode.com/riktar/jkanban

@marcosrocha85
Copy link
Contributor

What language are you using? PHP? Node.JS? You can simply concatenate the id coming from database into your href. Also you have a property called id for every item. Check it out https://jsfiddle.net/marcosrocha85/Lk9t483r/

@AEK-BKF
Copy link
Author

AEK-BKF commented Nov 15, 2020

Hi,
Thanks for quick reply,
I'm using Laravel PHP.
I set items as I mentioned above, but when I click on the link, nothing happens ! the console log is empty.

@marcosrocha85
Copy link
Contributor

Is your link ok? Is the anchor tag ok? I mean, there's no limitations about links inside item. If you take a look at my jsfiddle I set an anchor and it is working fine.

@AEK-BKF
Copy link
Author

AEK-BKF commented Nov 15, 2020

Yes! every thing is fine, I can see the correct link on mouse over.
I'm really confused.
If you can try my code above and test it.

@marcosrocha85
Copy link
Contributor

Yes! every thing is fine, I can see the correct link on mouse over.
I'm really confused.
If you can try my code above and test it.

Please take a look at your own code in this fiddle: https://jsfiddle.net/marcosrocha85/akvuqors/
It looks like you set up a property on jKanban which is preventing you from clicking on an element inside the item. Can you provide your entire jkanban configuration?

@AEK-BKF
Copy link
Author

AEK-BKF commented Nov 16, 2020

I test your example on jsfiddle and it doesn't work !
Sure !

var kanban = new jKanban({
        element: '#works_ids',
        gutter: '0',
        widthBoard : '375px',
        dragBoards : false,        
        dragItems  : canDrop,         
        /* click: function(el) {
            alert(el.innerHTML);
        }, */
        dropEl : function (el, target, source, sibling) {            
            var workid = $(el).data("eid");
            var status = target.parentElement.getAttribute('data-id');
            window.livewire.emit('changeStatus', [workid, status]);
        },
        boards: [{
                'id': 'new',
                'title': 'New ({{$news->count()}})',
                'class': 'light-dark',
                'item': [
                    @foreach($news as $new)
                    {
                        'id' : {{$new->id}},
                        'title': `
                            <div class="d-flex align-items-center">
                                <div class="symbol symbol-success mr-3">
                                    <img alt="Pic" src="{{$new->creator->getAvatar()}}" />
                                </div>
                                <div class="d-flex flex-column align-items-start">
                                    <span class="text-dark-50 font-weight-bold mb-1">{{$new->title}}</span>
                                    <span class="label label-inline label-light-{{config('aim.statuses')[$new->status][1]}} font-weight-bold">{{config('aim.statuses')[$new->status][0]}}</span>                                
                                </div>
                            </div>
                            <div class="mt-3">Number : {{$new->number}}</div>
                            <div>Unit : {{$new->unit->name}}</div>
                            <div>Assigned To : {{$new->assignedTo->name ?? ''}}</div>
                        `,
                    },
                    @endforeach                    
                ]
            },

@marcosrocha85
Copy link
Contributor

Forgive me, @AEK-BKF. Anchor tags not work properly inside jKanban items. I don't looked deeper, but I opened a project of mine and found that I just used onClick for Anchor tags in order to make them work. Please take a look again at this fiddle and you see a dialog when clicking View.

@AEK-BKF
Copy link
Author

AEK-BKF commented Nov 17, 2020

Thank you so much for your time to help me.
Yes, I've already used onlick="view(itemid) function to redirect to my URL, it's not professional but it does what I want.

function view(itemid) {
        window.location.replace("/url/"+itemid);
    }

and Thanks again for this nice package.

@AEK-BKF AEK-BKF closed this as completed Nov 17, 2020
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

No branches or pull requests

2 participants