I am struggling to document the router for my design of a shop. The shop consists mainly of a article/product slider. See the image below:
As you see:
on top an article navigation slider
in the center the current selected article
on the left the menu, which pages will be a popup over the current article
when the user clicks the shoppingcart, go to checkout, open up a page, log in their account, or whatever they do, there will be always an active article.
The router
So I thought - and correct me if I am wrong - to the design my router as follows:
Router.map(function() {
this.resource('articles', function() { // to fill the articles slider above
this.resource('article', function(path: ':article_id') { // to show the current selected article in the slider
// large popups - covers the current article almost
// completely with a little transparancy
this.resource('page', function(path: ':page_id')); // shows a page from the menu
this.resource('checkout', function(path: ':step_id')); // the checkout with multiple steps
// small popups at the bottom of the page
this.route('info'); // shows the additional product info popup
this.route('shipping'); // shows the shipping info popup
});
});
});
Additional information: I use Ember App Kit for developing and the slider will be Flexslider 2 mainly because they have touch support.
It looks like a valid router, however the question is whether it is the Ember way.
Related
When a visual is selected (by mouse or keyboard), the Visualizations pane will highlight the visual type icon and list the things related to the selected visual.
How do I implement such functionality?
Checking each visual.isActive() in active page is not an option, because you don't know when to check, and the html element (used for embedding) click/change event is not propagated through.
Tried buttonClicked, dataSelected events, they are not right.
https://github.com/Microsoft/PowerBI-JavaScript/wiki/Handling-Events
Is this supported or not?
Listening to the event of selection of visuals is not currently supported in Power BI Embedded. The objects on which the events are supported currently are reports, dashboards, and tiles.
However, you can get the visuals of specific page using this code.
report.on("loaded", function() {
report.getPages()
.then(function(pages) {
// Retrieve first page.
var firstPage = pages[0];
firstPage.getVisuals()
.then(function(visuals) {
console.log(visuals); // It will give you the list of visuals of the current page
})
})
});
You can also listen to the tileClicked event for the dashboards, as it will give you tile-specific information.
tile.on("tileClicked", function (event) {
Log.logText("Tile clicked event");
Log.log(event.detail);
});
Please refer : https://github.com/Microsoft/PowerBI-JavaScript/wiki/Handling-Events
I need to understand the differences between ModalController and NavController in Ionic 2. When should I choose NavController and when to choose ModalController?
In the ModalController doc:
A modal uses the NavController to present itself in the root nav
stack. It is added to the stack similar to how NavController.push
works.
So we can say, in mechanism, they are the same. Lets talk about UX.
A Modal is a content pane that goes over the user's current page
A modal actually go over the page. It is like a popup. In small device, it take all the space of screen so you can not realize the diffentce from it and page. But if you test it in tablet like a ipad you will see the modal just take a part of screen and the current page is behind it.(Image description below).
What should be used?
In most case, you can use modal or page base on what you prefer but to ensure the properly UX modal should be used in case editing, making choice or getting information, other case page should be used
The ModalController is used to create and present modals. Modals are commonly used for galleries, edit forms, and other content that should be push on top of the current page.
import { ModalController } from 'ionic-angular';
import { Page1 } from './pages';
constructor(private modalCtrl: ModalController) {}
let modal = this.modalCtrl.create(Page1);
modal.present();
modal.onDidDismiss(() => {
// Action done after dismissing the modal.
});
The NavController is used for navigation functionality (think about Tabs or just basic page navigation). This controller also contains your navigation history.
import { NavController } from 'ionic-angular';
import { Page1 } from './pages';
constructor(private navCtrl: NavController) {
}
this.navCtrl.push(Page1);
So there are two different approaches to present the desired page. For more information/options/methods please ready the provided links, containing all available features available on the Modal- and NavController components.
I have some flow on my app that, in some moment, I push a page to the stack and, on that page, I call a loading dialog for some data load. The problem is that the loading dialog didn't showed up. Then I realized that when I got back to the previous page, the loading was there, under my page that was being showed up. If in my navigation flow, instead of nav.push I use nav.setRoot, it works fine, so I think it's some glitch with that navigation stack. I really wanna use nav.pushcause it makes more sense for my app.
Any ideas?
EDIT:
my function that call the page:
onViewUnidade(unidade){
if (unidade.tipo == "Unidade Consumidora"){
this.nav.push(UnidadeConsumidoraPage, unidade);
}else if (unidade.tipo == "Usina"){
this.nav.push(UsinaPage, unidade);
}
}
my onInit method:
ngOnInit(){
console.log("show loading");
this.loading = this.loadingCtrl.create({
content: "some message"
});
this.loading.present();
}
My console.log executes, and I even didn't dismissed it, so I could see it correctly. The Loading and LoadingController are properly imported and injected.
EDIT 2:
I noticed that issue only happens when the page that redirects to my last page with the loading is a modal. If I change it for a regular page, it works correctly. Also, tried to dismiss the modal and popToRoot before navigate to new page... but still gotting same issue. Any ideas?
got my answer on documentation:
Instead of injecting navigation controller, when you wanted to navigate from an overlay component (popover, modal, alert, etc), we have to get a reference of the root NavController in our app, using the getRootNav() method:
this.appCtrl.getRootNav().push(SecondPage);
Hope this helps who got the same problem!
Have a look at LoadingOptions
export interface LoadingOptions {
spinner?: string;
content?: string;
cssClass?: string;
showBackdrop?: boolean;
dismissOnPageChange?: boolean;
delay?: number;
duration?: number;
}
You can set dismissOnPageChange(to true). Make sure you dismiss the loading dialog or set duration.
I am using Foundations Joyride plugin in my web app. What I am trying to achieve is something like where the user can say that never show me again button on each step.
For example I am on the first item their I want two buttons, Next/Don't show again.
Is there a way to get that?
I had this issue and solved it by making a separate popup in the same style which came up to prompt the user to do something else (in this case start a video) or start the joyride.
On this we also included a checkbox called 'never show me this again' and then stored the result in a cookie to make sure the box didn't auto-popup when reloading the page.
The following code should help (you will need to set or clear the 'show_joyride' cookie yourself - we use js.cookie.js):
var showJoyride = Cookies.get('show_joyride');
// Setup joyride but tell it not to auto start
$("#joyRideTipContent").joyride({
autoStart : false,
modal:true,
expose: true
});
if(showJoyride == 'true'){
// Start the joyride
$("#joyRideTipContent").joyride({
modal:true,
expose: true
});
}
Titanium SDK version: 1.6.2 (tried with 1.7 too)
iPhone SDK version: 4.2
I am developing an iPhone app and I am fetching data from my API and presenting it in a table. In this table I got a button on each row that should allow the user to add that person to his or her contacts. The only problem with the code (I think) is that only the last button responds when being clicked. Nothing happens when I click the other buttons.
This is my code: http://pastie.org/1932098
What is wrong?
You are adding the button.addEventListener outside of the for statement, and since you are overwriting the button var with each iteration, the eventListener only attaches to the last button created.
This probably isn't the best way to work this, but to fix your problem, move the button.addEventListener inside the for statement, and then check for a unique identifier in the object that gets sent to the event. Example:
for (x=0;x<5;x++) {
var button = Titanium.UI.createButton({
height:40,
width:100,
top:50*x,
id:x
});
var label = Titanium.UI.createLabel({
text:'LABEL '+x
});
button.add(label);
win1.add(button);
button.addEventListener('click', function(e){
Ti.API.info('Button clicked '+e.source.id);
});
}
The button.id property is just made up, but now you can see which button sends the event. You could also use title, or anything else that is unique.
Other options to look at are creating unique variable names for each button, but that's probably more work. Also, instead of working with putting a button in the table row, use a label or image, then listen for the event generated by the table or row.