Skip to content
This repository has been archived by the owner on Jun 13, 2023. It is now read-only.

Commit

Permalink
initial checkin
Browse files Browse the repository at this point in the history
  • Loading branch information
rubbingalcoholic committed Aug 14, 2014
0 parents commit b9be7b5
Show file tree
Hide file tree
Showing 377 changed files with 58,317 additions and 0 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
node_modules/
73 changes: 73 additions & 0 deletions Gruntfile.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
module.exports = function(grunt) {
grunt.initConfig({
concat: {
js : {
src : [
'config/*.js',
'notifications.js',
'controllers/**/*.js',
'handlers/*.js',
'models/*.js'
],
dest : 'js/notifications.min.js'
}
},
uglify : {
js: {
files: {
'js/notifications.min.js' : [ 'js/notifications.min.js' ]
}
}
},
less: {
development: {
options: {
compress: true,
yuicompress: true,
optimization: 2
},
files: {
// target.css file: source.less file
"css/notifications.css": "css/less/notifications.less"
}
}
},
watch: {
styles: {
files: [
'css/less/*.less',
], // which files to watch
tasks: [
'less'
],
options: {
nospawn: true,
debounceDelay: 250
}
},
scripts: {
files: [
'config/*.js',
'notifications.js',
'controllers/**/*.js',
'handlers/*.js',
'models/*.js'
], // which files to watch
tasks: [
'concat' // , 'uglify'
],
options: {
nospawn: true,
debounceDelay: 250
}
}
}
});

grunt.loadNpmTasks('grunt-contrib-less');
grunt.loadNpmTasks('grunt-contrib-watch');
grunt.loadNpmTasks('grunt-contrib-concat');
grunt.loadNpmTasks('grunt-contrib-uglify');

grunt.registerTask('default', ['watch']);
};
7 changes: 7 additions & 0 deletions config/routes.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
var routes = {
'/': ['pages', 'home'],
'/account': ['accounts', 'edit'],
'/messages/view/([0-9]+)': ['messages', 'view'],
// easy way to do a catch-all
'.*': ['pages', 'not_found']
}
48 changes: 48 additions & 0 deletions controllers/accounts/edit.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
var AccountsEditController = Composer.Controller.extend({
inject: notifications.main_container_selector,
el: false,
className: 'accounts',

elements: {

},

events: {

},

_tmp_data: false,


init: function(data)
{
this.with_bind(notifications.account, 'change:addon_data', this.render.bind(this));
this.render();

return this;
},


render: function()
{
data = {}



console.log('addon_data: ', notifications.account.get('addon_data'));
if (!notifications.account.get('addon_data').access_token)
{
var html = notifications.render_template('pages_loading', data);
}
else
{
var html = notifications.render_template('accounts_edit', data);
}


this.html(html);

return this;
},
});

56 changes: 56 additions & 0 deletions controllers/accounts/nav_bar.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
var AccountsNavBarController = Composer.Controller.extend({
inject: '#nav',
el: false,
template: 'accounts_nav_bar',

elements: {

},

events: {

},

_tmp_data: false,


init: function(data)
{
console.log('data: ', this.id);

this.with_bind(notifications.account, 'change:addon_exists', this.render.bind(this));

this.render();

return this;
},


render: function()
{
console.log('RENDERING NAV BAR');

data = {
id: this.id
}

var html = notifications.render_template(this.template, data);
this.html(html);

if (notifications.account.get('addon_exists') == false)
this.track_subcontroller('right_nav', function() {
return new DownloadButtonController({
style: 'nav',
inject: '#nav_right'
});
});
else
this.track_subcontroller('right_nav', function() {
return new AccountsNavBarDropdownController();
});


return this;
},
});

41 changes: 41 additions & 0 deletions controllers/accounts/nav_bar_dropdown.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
var AccountsNavBarDropdownController = Composer.Controller.extend({
inject: '#nav_right',
tag: 'li',
el: false,
template: 'accounts_nav_bar_dropdown',

elements: {

},

events: {
'click a': 'handle_dropdown'
},

_tmp_data: false,


init: function(data)
{
this.render();

return this;
},


render: function()
{
var html = notifications.render_template(this.template, data);
this.html(html);

return this;
},

handle_dropdown: function(e) {
/*
e.preventDefault();
return false;
*/
}
});

80 changes: 80 additions & 0 deletions controllers/download/button.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,80 @@
var DownloadButtonController = Composer.Controller.extend({
inject: null, // overridden
style: null, // 'nav' | 'big'
el: false,
tag: 'li',

elements: {

},

events: {
'click a': 'do_install'
},

_tmp_data: false,


init: function(data)
{
this.render();

return this;
},


render: function()
{
console.log('RENDERING NAV BAR');

data = {
browser: this.get_browser()
}

switch(this.style) {
case 'nav':

if (data.browser == 'Other')
return console.log('Other browser not supported here :(');

var template = 'download_button_nav'
break;
case 'big':

var template = 'download_button_big'
break;
}

var html = notifications.render_template(template, data);
this.html(html);

return this;
},

do_install: function(e) {

e.preventDefault();

if (this.get_browser() == 'Chrome')
{
console.log('Trying to install from webstore')
chrome.webstore.install();
}
else
{
alert('This browser is not supported yet. Try Chrome.');
}

return false;
},

get_browser: function() {
if (window.chrome)
return 'Chrome';
else if (navigator.userAgent.toLowerCase().indexOf('firefox') > -1)
return 'Firefox';
else
return 'Other';
}
});

38 changes: 38 additions & 0 deletions controllers/messages/view.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
var MessagesViewController = Composer.Controller.extend({
inject: notifications.main_container_selector,
el: false,
template: 'messages_view',

elements: {

},

events: {

},

_tmp_data: false,


init: function(data)
{
console.log('data: ', this.id);
this.render();

return this;
},


render: function()
{
data = {
id: this.id
}

var html = notifications.render_template(this.template, data);
this.html(html);

return this;
},
});

Loading

0 comments on commit b9be7b5

Please sign in to comment.