thecodeholic/lobibox

Notify soundPath is not changing.

krlicmuhamed opened this issue · 10 comments

When I try to change notify options I do this :

Lobibox.notify.OPTIONS = {
    'class': 'animated-fast',
    soundPath: 'sounds/',

    // You can override options for large notifications from here
    large: {
        width: 500
    },

    // You can override options for small notifications from here
    mini: {
        'class': 'notify-mini'
    },

    // Default options of different style notifications
    success: {
        'class': 'lobibox-notify-success',
        'title': 'Success',
        'icon': 'glyphicon glyphicon-ok-sign',
        sound: 'sound2'
    },
    error: {
        'class': 'lobibox-notify-error',
        'title': 'Error',
        'icon': 'glyphicon glyphicon-remove-sign',
        sound: 'sound3'
    },
    warning: {
        'class': 'lobibox-notify-warning',
        'title': 'Warning',
        'icon': 'glyphicon glyphicon-exclamation-sign',
        sound: 'sound5'
    },
    info: {
        'class': 'lobibox-notify-info',
        'title': 'Information',
        'icon': 'glyphicon glyphicon-info-sign',
        sound: 'sound2'
    }
};

This works but, soundPath is not changing. I get the same default 'src/sounds/' soundPath.

I managed to fix this by placing soundPath directly in Lobibox.notify like this:

      Lobibox.notify(

        // 'warning', 'info', 'success', 'error'
        arguments.type,
        {
            title:true,
             ... 
            soundPath: 'sounds/',
            sound: true,
            position: 'bottom right'
        }

      );

I will look at this and fix ASAP.
On Nov 2, 2015 4:30 PM, "Muhamed Krlic" notifications@github.com wrote:

When I try to change notify options I do this :

Lobibox.notify.OPTIONS = {
'class': 'animated-fast',
soundPath: 'sounds/',

// You can override options for large notifications from here
large: {
    width: 500
},

// You can override options for small notifications from here
mini: {
    'class': 'notify-mini'
},

// Default options of different style notifications
success: {
    'class': 'lobibox-notify-success',
    'title': 'Success',
    'icon': 'glyphicon glyphicon-ok-sign',
    sound: 'sound2'
},
error: {
    'class': 'lobibox-notify-error',
    'title': 'Error',
    'icon': 'glyphicon glyphicon-remove-sign',
    sound: 'sound3'
},
warning: {
    'class': 'lobibox-notify-warning',
    'title': 'Warning',
    'icon': 'glyphicon glyphicon-exclamation-sign',
    sound: 'sound5'
},
info: {
    'class': 'lobibox-notify-info',
    'title': 'Information',
    'icon': 'glyphicon glyphicon-info-sign',
    sound: 'sound2'
}

};

This works but, soundPath is not changing. I get the same default
'src/sounds/' soundPath.

I managed to fix this by placing soundPath directly in Lobibox.notify like
this:

  Lobibox.notify(

    // 'warning', 'info', 'success', 'error'
    arguments.type,
    {
        title:true,
         ...
        soundPath: 'sounds/',
        sound: true,
        position: 'bottom right'
    }

  );


Reply to this email directly or view it on GitHub
arboshiki#1.

If you want to change default parameters of the plugin, try the following thing

Lobibox.notify.DEFAULTS = $.extend({}, Lobibox.notify.DEFAULTS, {
    soundPath: 'sounds/',
    //write down all parameters you want to override
});

Hello @l0oky , let me know if my answer helped you.

Sorry for a delayed response, yes It worked!
But what's the main difference between Lobibox.notify.DEFAULTS and Lobibox.notify.OPTIONS?
It didn't change If I were to put it in Lobibox.notify.OPTIONS but works on Lobibox.notify.DEFAULTS?

Lobibox.notify.DEFAULTS are default options for single notification. You can override any default options when calling

Lobibox.notify(type,{
   //options
});

But Lobibox.notify.OPTIONS are general available options for different size and color notifications.

For example: By default title is enabled in Lobibox.notify.DEFAULTS but actual title value is taken from Lobibox.notify.DEFAULTS according to the type of notification.

soundPath is option of only DEFAULTS not OPTIONS. So if in example or in documentation soundPath is shown in OPTIONS it is mistake

Thanks. I think, though, I am not sure (because I am not very familiarized with your source code), that you don't need DEFAULTS and OPTIONS but only one of them OPTIONS or DEFAULTS. Because both serve a very similar or the same purpose to change default settings. Only in Lobibox.notify( you can change options for this instance of notify. Am I correct?

Yes maybe you are correct and OPTIONS and DEFAULTS can be combined in
one. This plugin needs more work to improve and become hight level
notification plugin. Now it's like said in between beta and stabe
versions. Unfortunatelly I do not have time to work on it. I am going to
continue improving this plugin, but I do not know exactly when.
On Nov 7, 2015 11:55 AM, "Muhamed Krlic" notifications@github.com wrote:

Thanks. I think, though, I am not sure (because I am not very familiarized
with your source code), that you don't need DEFAULTS and OPTIONS but only
one of them OPTIONS or DEFAULTS. Because both serve a very similar or the
same purpose to change default settings. Only in Lobibox.notify( you can
change options for this instance of notify. Am I correct?


Reply to this email directly or view it on GitHub
arboshiki#1 (comment).

The plugin is good as is, slight modifications can only make It more developer friendly but other than that, great work! I'm already using this for commercial purposes :)

I am glad that you are using it and you like it. For any other questions I
am ready to help you.

On Sun, Nov 8, 2015 at 12:30 AM, Muhamed Krlic notifications@github.com
wrote:

Closed #1 arboshiki#1.


Reply to this email directly or view it on GitHub
arboshiki#1 (comment).