twinssbc / Ionic-Calendar

A calendar directive for Ionic framework
http://twinssbc.github.io/Ionic-Calendar/demo
MIT License
159 stars 73 forks source link

Calendar event on-hold #91

Closed NisanurBulut closed 8 years ago

NisanurBulut commented 8 years ago

hi how can ı add on-hold function to for each event because ı want to delete a event from my database when ı touch long .. thanks

twinssbc commented 8 years ago

@NisanurBulut You need to modify the source code to add the on-hold callback. For example, in the weekview.html, you can add on-hold attribute the same as ng-click="eventSelected()" attribute. You can follow the same way as eventSelected to expose the event to the client.

But one thing to note that in the current design of weekview and dayview. The event width will become very small when there are many events happen at the same day. In this case, you can't distinguish which event when holding on a date. You may reconsider your interaction.

                                <div ng-class="{'calendar-event-wrap': tm.events}" ng-if="tm.events">
                                    <div ng-repeat="displayEvent in tm.events" class="calendar-event"
                                         ng-click="eventSelected({event:displayEvent.event})" on-hold="onTouchEvent({event:displayEvent.event})"
                                         ng-style="{top: (37*displayEvent.startOffset/hourParts)+'px',left: 100/displayEvent.overlapNumber*displayEvent.position+'%', width: 100/displayEvent.overlapNumber+'%', height: 37*(displayEvent.endIndex -displayEvent.startIndex - (displayEvent.endOffset + displayEvent.startOffset)/hourParts)+'px'}"
                                         ng-include="::normalEventTemplateUrl">
                                    </div>
                                </div>
NisanurBulut commented 8 years ago

hi yes I did how to call ontouch event ? for example you call event selected function event-selected="onEventSelected(event)" How must I do it ? again thanks

twinssbc commented 8 years ago

@NisanurBulut You need to expose that method to the user. Similar to how eventSelected is implemented.

In the scope declaration of calendar directive:

eventSelected: '&'
NisanurBulut commented 8 years ago

thanks I finish with your help good job!

twinssbc commented 8 years ago

Great. Btw, I saw your previous comment. calendar-tpl.js is generated. It's better to modify the src/rcalendar/calendar.js, then use grunt build-tpls to generate the tpl file.