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

improve toolltip code usage with mixins #166

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

patricklx
Copy link
Contributor

Make the TooltipBoxController internal and some mixins for route and view.
Then Instead of doing

//Create some controller in your app that references _Bootstrap.TooltipBoxController_
App.TooltipBoxController = Bootstrap.TooltipBoxController

//Application route
App.ApplicationRoute = Ember.Route.extend({
    renderTemplate: function() {
        // Render default outlet
        this.render();
        // render extra outlets
        var controller = this.controllerFor('tooltip-box');
        this.render("bs-tooltip-box", {
            outlet: "bs-tooltip-box",
            controller: controller,
            into: "application" // important when using at root level
        });
    }
});

We can just do

var ApplicationRoute = Ember.Route.extend(Bootstrap.BsTooltipRouteMixin, {});

or for views

Ember.View.extend(Bootstrap.BsTooltipViewMixin, {
    bsTooltipData: function () {
        return Ember.Object.create({
            item: this.get('item'),
            titleBinding: 'item.attributes.description'
        });
    }.property(),
    bsTooltipType: 'tooltip',
}

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

Successfully merging this pull request may close these issues.

1 participant