From 2a1388990ceea46791517943423e44947abb6472 Mon Sep 17 00:00:00 2001 From: Aarni Date: Mon, 15 Aug 2016 19:22:05 +0300 Subject: [PATCH] JS app moved to appconfig. Noty notifications added --- members/static/js/appconfig.js | 6 + members/static/js/jquery.noty.packaged.js | 1442 +++++++++++++++++++++ members/static/js/members_controllers.js | 18 +- members/static/js/members_routers.js | 8 - members/templates/members_index.html | 12 +- 5 files changed, 1467 insertions(+), 19 deletions(-) create mode 100644 members/static/js/appconfig.js create mode 100644 members/static/js/jquery.noty.packaged.js diff --git a/members/static/js/appconfig.js b/members/static/js/appconfig.js new file mode 100644 index 0000000..878eb93 --- /dev/null +++ b/members/static/js/appconfig.js @@ -0,0 +1,6 @@ +var app = angular.module('memberApp', ['ngRoute', 'ngAnimate', 'ui.bootstrap']); + +app.config(['$httpProvider', function ($httpProvider) { + $httpProvider.defaults.xsrfCookieName = 'csrftoken'; + $httpProvider.defaults.xsrfHeaderName = 'X-CSRFToken'; +}]); \ No newline at end of file diff --git a/members/static/js/jquery.noty.packaged.js b/members/static/js/jquery.noty.packaged.js new file mode 100644 index 0000000..c799814 --- /dev/null +++ b/members/static/js/jquery.noty.packaged.js @@ -0,0 +1,1442 @@ +!function(root, factory) { + if (typeof define === 'function' && define.amd) { + define(['jquery'], factory); + } else if (typeof exports === 'object') { + module.exports = factory(require('jquery')); + } else { + factory(root.jQuery); + } +}(this, function($) { + +/*! + @package noty - jQuery Notification Plugin + @version version: 2.3.8 + @contributors https://github.com/needim/noty/graphs/contributors + + @documentation Examples and Documentation - http://needim.github.com/noty/ + + @license Licensed under the MIT licenses: http://www.opensource.org/licenses/mit-license.php + */ + + if(typeof Object.create !== 'function') { + Object.create = function(o) { + function F() { + } + + F.prototype = o; + return new F(); + }; + } + + var NotyObject = { + + init: function(options) { + + // Mix in the passed in options with the default options + this.options = $.extend({}, $.noty.defaults, options); + + this.options.layout = (this.options.custom) ? $.noty.layouts['inline'] : $.noty.layouts[this.options.layout]; + + if($.noty.themes[this.options.theme]) + this.options.theme = $.noty.themes[this.options.theme]; + else + this.options.themeClassName = this.options.theme; + + this.options = $.extend({}, this.options, this.options.layout.options); + this.options.id = 'noty_' + (new Date().getTime() * Math.floor(Math.random() * 1000000)); + + // Build the noty dom initial structure + this._build(); + + // return this so we can chain/use the bridge with less code. + return this; + }, // end init + + _build: function() { + + // Generating noty bar + var $bar = $('
').attr('id', this.options.id); + $bar.append(this.options.template).find('.noty_text').html(this.options.text); + + this.$bar = (this.options.layout.parent.object !== null) ? $(this.options.layout.parent.object).css(this.options.layout.parent.css).append($bar) : $bar; + + if(this.options.themeClassName) + this.$bar.addClass(this.options.themeClassName).addClass('noty_container_type_' + this.options.type); + + // Set buttons if available + if(this.options.buttons) { + + // If we have button disable closeWith & timeout options + this.options.closeWith = []; + this.options.timeout = false; + + var $buttons = $('
').addClass('noty_buttons'); + + (this.options.layout.parent.object !== null) ? this.$bar.find('.noty_bar').append($buttons) : this.$bar.append($buttons); + + var self = this; + + $.each(this.options.buttons, function(i, button) { + var $button = $('