In ember.js I need to trigger a modal box create when I enter inside an URL, and to trigger its destruction when i leave it.
Do you know what events i can observe?
Will they be triggered in the controller or in the route?
And, finally, where can i find the documentation for this? I couldn't find any in ember.js site
I tried the enter and leave event, but they are triggered only once, and in the wrong moment
Thanks in advance
Look at activate and deactivate hooks on the Ember.Route.
http://emberjs.com/api/classes/Ember.Route.html
Related
Looking for a bit of direction after struggling to find anything googling..
I have implemented full calendar.io using django to store the events.
I can show the events and when the events are clicked, they open a modal, showing the data for that event.
In this modal, I want to include a delete button, I can pass the id of the event from django to the modal but I cannot figure out how to delete the entry from the django dB when the delete button is clicked..
Can someone please help?
Any direction would be appreciated!
Is there a way to distinguish access through external link (e.g. from history, or from other site) or access by link from other page of the same app in beforeModel handler?
Here is my case:
If user accesses my app by direct link and requests route requiring authenticated user, I make a transition to index route and show popup with an authorization form.
If user is already on my site and trying to access the requested route requiring authenticated user, I abort transition and show the popup on a previous page.
I have no separate page for authentication.
My current work around is to check some strange private property called sequence of transition object which has been passed to beforeModel handler, if transition.sequence === 0, then user came from "outside", otherwise user follow by link "inside" my app.
I think this is a bad way to achieve the goal, core developers can remove sequence property any time.
So, is there any clean way to distinguish whether current route was requested from "outside" or "inside" of my app?
I'll appreciate any help, thanks!
P.S. EmberJS v1.10.0
P.S.S. Sorry for my English
If you want to avoid using an internal call you could keep track of the history in the application route something like this Implementing a "conditional" back button in ember.js
But in your router would probably be better since controllers are going away soonish.
You could probably use http://emberjs.com/api/classes/Ember.Route.html#event_didTransition
UPDATE after chatting
Logic for counting, aborting, etc transitions can be done in the willTransition action in application route http://emberjs.com/guides/routing/preventing-and-retrying-transitions/
Besides log every location changes, I would also like to log these click events as a lot of the time user would click on sth and that click would not update location hash. It would be helpful if it's possible to log these events by intercepting calls made to action helper. I've tried hacking around and no luck so far. I can still log them in the event handlers. It's just feels a little bit verbose. Does anyone have similar problem? Any ideas?
To make it clear, for example instead of in the route or controller having some code like below, the call made to google analytics could being triggered whenever action event fired.
clickMe: function(){
App.Analytics.logEvent({category: "userEvent", action: "click", label:"click me", value: 1});
},
I've tried to define a customized helper which is basically a wrapper around action helper, it makes a call to log down google analytic events using the information got from its caller and then internally call ember's action helper. I use my own helper in the template to try out, but log events only happened the first time that template rendered. If I keep click on the view no user activity gets logged.
You can use the event bubbling mechanism of javascript to do this. In any Ember view adding a handler named for an event will setup a listener for that event automatically.
By placing such a click handler on the ApplicationView you can listen in on all clicks for all it's nested views.
App.ApplicationView = Em.View.extend({
click: function(event) {
console.log('ApplicationView.click', event);
}
});
From here you can use this.get('controller').send(event) to notify the controller, route, etc to get to the function that calls the google analytics code.
I mean, there's any generic app that you can use to make notifications like when in Facebook, someone adds you as friend, or invite you to an event?
Basically, I need to show to the user this type of notification for different contents type, with the possibility to do some custom actions (ignore, accept, etc) different for each one.
I wonder if someone have done this before, so I can plug it and create a type of notification simply passing the text of the notification, the options that must show and the views to call for each option.
Thanks.
django-notifications is a GitHub notifications alike app, and it's based on Django Activity Stream.
If you familia with django-activity-stream, the the usage of django-notifications almost the same.
django-notifications also provide notifications_unread templatetag to display unread notifications of current login user.
Django Activity Stream does this, for the most part. It's a generic relationship manager that watches for save events in the datbase, and when a condition is met it puts an "event happened!" record into its own tables.
It would be incumbent upon you to then present that feed of events to the user, along with links to the actions (specific to your project) that you want him to take.
Even if it's not what you want, it's an excellent example of how to start.
Maybe this is more closer to my needs:
django-notification
https://github.com/jtauber/django-notification
any experience with that?
There is also django-notify: http://code.google.com/p/django-notify/
I'm trying to invoke a Task UI in Siebel 8 and don't get anywhere.
I've added a button to an applet, with Method Invoked "LaunchTask" and
the following Control User Prop:
Name: Task Name
Value:
That button doesn't even show up in the UI. When I change the Method
Invoked to something else the button is displayed.
Does anybody have an idea why the button is not shown?
I've activated and deployed the task, and am running this on the
dedicated client against my local database.
I also tried invoking the Task from an applet server script, as
described in the bookshelf. That crashes the Siebel client.
Any help will be appreciated.
Thanks,
Thomas
Hm, I found the problem.
My responsibility didn't have access to the Task.
Problem solved.
Syntax to invoke from Button, Method Invoked should be "TaskLaunch".
Please update the method invoked and try it.