Notification system
This commit is contained in:
1 parent
2323136221
commit
15175a0330
25 files changed
+1313
-165
No files matched your search
@@ -0,0 +1,43 @@
|
||||
Block.Menu = new Class({
|
||||
|
||||
Extends: BlockBase,
|
||||
|
||||
options: {
|
||||
'class': 'menu'
|
||||
},
|
||||
|
||||
create: function(){
|
||||
var self = this;
|
||||
|
||||
self.el = new Element('div', {
|
||||
'class': 'more_menu '+self.options['class']
|
||||
}).adopt(
|
||||
self.more_option_ul = new Element('ul'),
|
||||
new Element('a.button.onlay', {
|
||||
'events': {
|
||||
'click': function(){
|
||||
self.el.toggleClass('show')
|
||||
self.fireEvent(self.el.hasClass('show') ? 'open' : 'close')
|
||||
|
||||
if(self.el.hasClass('show'))
|
||||
this.addEvent('outerClick', function(){
|
||||
self.el.removeClass('show')
|
||||
this.removeEvents('outerClick');
|
||||
})
|
||||
else
|
||||
this.removeEvents('outerClick');
|
||||
|
||||
}
|
||||
}
|
||||
})
|
||||
)
|
||||
|
||||
},
|
||||
|
||||
addLink: function(tab, position){
|
||||
var self = this;
|
||||
var el = new Element('li').adopt(tab).inject(self.more_option_ul, position || 'bottom');
|
||||
return el;
|
||||
}
|
||||
|
||||
});
|
||||
@@ -1,54 +0,0 @@
|
||||
Block.More = new Class({
|
||||
|
||||
Extends: BlockBase,
|
||||
|
||||
create: function(){
|
||||
var self = this;
|
||||
|
||||
self.el = new Element('div.more_menu').adopt(
|
||||
self.more_option_ul = new Element('ul').adopt(
|
||||
new Element('li').adopt(
|
||||
new Element('a.orange', {
|
||||
'text': 'Restart',
|
||||
'events': {
|
||||
'click': App.restart.bind(App)
|
||||
}
|
||||
})
|
||||
),
|
||||
new Element('li').adopt(
|
||||
new Element('a.red', {
|
||||
'text': 'Shutdown',
|
||||
'events': {
|
||||
'click': App.shutdown.bind(App)
|
||||
}
|
||||
})
|
||||
)
|
||||
),
|
||||
new Element('a.button.onlay', {
|
||||
'events': {
|
||||
'click': function(){
|
||||
self.el.toggleClass('show')
|
||||
|
||||
if(self.el.hasClass('show'))
|
||||
this.addEvent('outerClick', function(){
|
||||
self.el.removeClass('show')
|
||||
this.removeEvents('outerClick');
|
||||
})
|
||||
else
|
||||
this.removeEvents('outerClick');
|
||||
|
||||
}
|
||||
}
|
||||
})
|
||||
)
|
||||
|
||||
},
|
||||
|
||||
addLink: function(tab, position){
|
||||
var self = this
|
||||
|
||||
return new Element('li').adopt(tab).inject(self.more_option_ul, position || 'bottom')
|
||||
|
||||
}
|
||||
|
||||
});
|
||||
@@ -43,7 +43,7 @@ var CouchPotato = new Class({
|
||||
pushState: function(e){
|
||||
var self = this;
|
||||
if((!e.meta && Browser.Platform.mac) || (!e.control && !Browser.Platform.mac)){
|
||||
(e).stop();
|
||||
(e).preventDefault();
|
||||
var url = e.target.get('href');
|
||||
if(History.getPath() != url)
|
||||
History.push(url);
|
||||
@@ -60,19 +60,34 @@ var CouchPotato = new Class({
|
||||
new Element('div').adopt(
|
||||
self.block.navigation = new Block.Navigation(self, {}),
|
||||
self.block.search = new Block.Search(self, {}),
|
||||
self.block.more = new Block.More(self, {})
|
||||
self.block.more = new Block.Menu(self, {})
|
||||
)
|
||||
),
|
||||
self.content = new Element('div.content'),
|
||||
self.block.footer = new Block.Footer(self, {})
|
||||
);
|
||||
|
||||
self.block.more.addLink(new Element('a', {
|
||||
[new Element('a.orange', {
|
||||
'text': 'Restart',
|
||||
'events': {
|
||||
'click': App.restart.bind(App)
|
||||
}
|
||||
}),
|
||||
new Element('a.red', {
|
||||
'text': 'Shutdown',
|
||||
'events': {
|
||||
'click': App.shutdown.bind(App)
|
||||
}
|
||||
}),
|
||||
new Element('a', {
|
||||
'text': 'Check for updates',
|
||||
'events': {
|
||||
'click': self.checkForUpdate.bind(self)
|
||||
}
|
||||
}))
|
||||
})].each(function(a){
|
||||
self.block.more.addLink(a)
|
||||
})
|
||||
|
||||
|
||||
new ScrollSpy({
|
||||
min: 10,
|
||||
@@ -207,6 +222,13 @@ var CouchPotato = new Class({
|
||||
|
||||
createUrl: function(action, params){
|
||||
return this.options.base_url + (action ? action+'/' : '') + (params ? '?'+Object.toQueryString(params) : '')
|
||||
},
|
||||
|
||||
notify: function(options){
|
||||
return this.growl.notify({
|
||||
title: "this scrolls away",
|
||||
text: "test - hello there. mouseover to pause away action"
|
||||
});
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
File diff suppressed because it is too large.
Load diff
@@ -628,7 +628,7 @@ Option.Directory = new Class({
|
||||
self.dir_list = new Element('ul', {
|
||||
'events': {
|
||||
'click:relay(li)': function(e, el){
|
||||
(e).stop();
|
||||
(e).preventDefault();
|
||||
self.selectDirectory(el.get('data-value'))
|
||||
},
|
||||
'mousewheel': function(e){
|
||||
@@ -678,7 +678,7 @@ Option.Directory = new Class({
|
||||
|
||||
hideBrowser: function(e, save){
|
||||
var self = this;
|
||||
(e).stop();
|
||||
(e).preventDefault();
|
||||
|
||||
if(save)
|
||||
self.save()
|
||||
@@ -1241,7 +1241,7 @@ Option.Combined = new Class({
|
||||
|
||||
deleteCombinedItem: function(e){
|
||||
var self = this;
|
||||
(e).stop();
|
||||
(e).preventDefault();
|
||||
|
||||
var item = e.target.getParent();
|
||||
|
||||
|
||||
@@ -49,7 +49,7 @@ window.addEvent('domready', function(){
|
||||
|
||||
editMovie: function(e){
|
||||
var self = this;
|
||||
(e).stop();
|
||||
(e).preventDefault();
|
||||
|
||||
if(!self.options_container){
|
||||
self.options_container = new Element('div.options').adopt(
|
||||
@@ -89,7 +89,7 @@ window.addEvent('domready', function(){
|
||||
},
|
||||
|
||||
save: function(e){
|
||||
(e).stop();
|
||||
(e).preventDefault();
|
||||
var self = this;
|
||||
|
||||
Api.request('movie.edit', {
|
||||
@@ -129,7 +129,7 @@ window.addEvent('domready', function(){
|
||||
|
||||
doRefresh: function(e){
|
||||
var self = this;
|
||||
(e).stop();
|
||||
(e).preventDefault();
|
||||
|
||||
Api.request('movie.refresh', {
|
||||
'data': {
|
||||
@@ -160,7 +160,7 @@ window.addEvent('domready', function(){
|
||||
|
||||
showConfirm: function(e){
|
||||
var self = this;
|
||||
(e).stop();
|
||||
(e).preventDefault();
|
||||
|
||||
if(!self.delete_container){
|
||||
self.delete_container = new Element('div.delete_container').adopt(
|
||||
@@ -188,13 +188,13 @@ window.addEvent('domready', function(){
|
||||
|
||||
hideConfirm: function(e){
|
||||
var self = this;
|
||||
(e).stop();
|
||||
(e).preventDefault();
|
||||
|
||||
self.movie.slide('out');
|
||||
},
|
||||
|
||||
del: function(e){
|
||||
(e).stop();
|
||||
(e).preventDefault();
|
||||
var self = this;
|
||||
|
||||
var movie = $(self.movie);
|
||||
@@ -253,7 +253,7 @@ window.addEvent('domready', function(){
|
||||
|
||||
showFiles: function(e){
|
||||
var self = this;
|
||||
(e).stop();
|
||||
(e).preventDefault();
|
||||
|
||||
if(!self.options_container){
|
||||
self.options_container = new Element('div.options').adopt(
|
||||
|
||||
Reference in new issue
Block a user