-
Notifications
You must be signed in to change notification settings - Fork 727
Conversation
binded calendar config and event model. added and exposed of destroy and init controll
the test fixes was to try out the binding with config instead of the ui-calendar. but as i said in the op. not the most important thing. the tests are back to their old state again. |
My last commit adds an interface object which increases readability of the resulting code when using this directive and increases this directives controll over the fullcalendar object. this would be desirable for the following things. when the calendar has been binded to myCalendar you can call myCalendar.refetchEvents() instead of mycalendar.fullCalendar('refetchEvents'). This improves readability. The directive could add behaviour (event calls, cleanups) to the calls. by adding it as a value there also exists the possibility for the user to create its own fullcalendar object bind it to the value and have the same controll without a directive being in the way. function CalendarCtrl($scope,calendar){
calendar._calendar = $('#mycalendar');
calendar.init(options);
calendar.refetchEvents():
} |
Do we need the |
Its a proposal so no. But my reason is this: If you have a better way/solution please don't hesitate. I have by no means set things in stone. for the example it could be changed a bit by adding a bind function.... function CalendarCtrl($scope,calendar){
calendar.bind($('#mycalendar'));
calendar.init(options);
calendar.refetchEvents():
} and the bind function internally then does something like function bind(element){
this._calendar = element;
} and can manipulate the element before binding if necesary (check if its empty and thus can safely be made to fullcalendar or throw a warning if not empty) |
If I am understanding, this only allows 1 calendar per outer scope? |
I am saying it only allows 1, because all directive instances would share the same instance of the .value (and therefore ._calendar), correct me if I'm wrong |
If there is more than one calendar than maybe what we need is a factory which provides the right calendar based on the scope? Could you please explain a bit more how this works? Thanks :) |
I think a factory would be a great Idea. I'm trying it out right now. I'll let you know how that works out. to explain it a bit more. My understanding of .value was a bit limited and wrong which is corrected now. and I can see the issue that it only has one instance. Thanks for the input. you made me richer :) (in knowledge ;) ) |
there we go no more mystic _ :) and a better providing of the Calendar object. |
I see. So you were on there right track, but just a bit confused by lack of angularjs documentation (very common). |
So does this mean |
I'm not entirely sure it's the lack of documentation or lack of navigational intuitivity in their documentation... XD sorry clicked the wrong button... Yes but again I have not found a way to make it optional... would be better optional I think? |
refetchEvents is unnecessary now that all data is tracked automatically (there is a version that rerenders precisely the changes here, so for most people accessing fullCalendar directly will not be necessary. It would be great if it is optional. |
You can make it optional by using a local variable internally (e.g. |
that would work but i see its a real issue in angular itself too? |
You can use |
@joshkurz What is ui-calendar's minimal compatibility target for angularjs? |
yeah good question. since the |
Awesome. |
yeah that's fine we can stay on the head of the angular repo. I dont have a @yourilima this is looking really nice. I really like the calendar factory. We will go with this branch for sure. Thanks for proving me wrong. Ill play with it for a while and let you know if I find any issues. If not Good Job. On Thu, Apr 11, 2013 at 7:14 PM, yourilima [email protected] wrote:
Josh Kurz |
Although I am not sure about the wrapper methods, because that means we have to support an ever-changing API. Lower maintenance overhead if we use it directly, right? |
Maybe a thin wrapper, such as |
Then if we make that the main way to access fullCalendar, we can expose other stuff in that factory too (like subscribing to changes in events) |
first of all I would like to point out that whats most important here is Further more we are going into finite details when we talk about wrapping The whole point of the wrapper is to make the code look more readable But for sure we should just focus on the isolated scope related code in Make sense? On Thu, Apr 11, 2013 at 7:57 PM, Gleb Mazovetskiy
Josh Kurz |
Of course |
ok cool well then Ill rebase in just the code that has to do with the On Thu, Apr 11, 2013 at 8:07 PM, Gleb Mazovetskiy
Josh Kurz |
Awesome |
That makes good sense. Got a bit carried away and polluted the PR a bit. sorry about that |
its ok NP. you are on the right track. Once we get the rebase in with the On Thu, Apr 11, 2013 at 8:18 PM, yourilima [email protected] wrote:
Josh Kurz |
@@ -13,7 +13,7 @@ | |||
<script src="http://code.angularjs.org/1.0.4/angular.js"></script> | |||
<script src="https://raw.github.com/angular-ui/angular-ui.github.com/master/lib/calendar/fullcalendar.js"></script> | |||
<script src="http://arshaw.com/js/fullcalendar-1.5.3/fullcalendar/gcal.js"></script> | |||
<script src="https://raw.github.com/angular-ui/ui-calendar/master/src/calendar.js"></script> | |||
<script src="https://raw.github.com/yourilima/ui-calendar/master/src/calendar.js"></script> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
you dont need to change this because it would check it in tothe head of the repo. What I do is just take the whole calendar model and put it in the calendarDemo.js file while im deving on the calendar. I just comment this line out until im ready to commit.
I left a couple of the commits in the merge, so that we can show the differences in the test files and the calendar file. Thanks again |
with the config to be still in the ui-calendar tag.
that is not a very important thing but it might be nice to have that be in a config binding (as my last commit removed to be compatible with the tests