##// END OF EJS Templates
frontend: topics implementation needs to live in CE edition
ergo -
r340:2e3f4ad7 default
parent child Browse files
Show More
@@ -0,0 +1,50 b''
1 // # Copyright (C) 2010-2016 RhodeCode GmbH
2 // #
3 // # This program is free software: you can redistribute it and/or modify
4 // # it under the terms of the GNU Affero General Public License, version 3
5 // # (only), as published by the Free Software Foundation.
6 // #
7 // # This program is distributed in the hope that it will be useful,
8 // # but WITHOUT ANY WARRANTY; without even the implied warranty of
9 // # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
10 // # GNU General Public License for more details.
11 // #
12 // # You should have received a copy of the GNU Affero General Public License
13 // # along with this program. If not, see <http://www.gnu.org/licenses/>.
14 // #
15 // # This program is dual-licensed. If you wish to learn more about the
16 // # RhodeCode Enterprise Edition, including its added features, Support services,
17 // # and proprietary license terms, please see https://rhodecode.com/licenses/
18
19
20 var topics = {};
21 jQuery.Topic = function (id) {
22 var callbacks, method,
23 topic = id && topics[id];
24
25 if (!topic) {
26 callbacks = jQuery.Callbacks();
27 topic = {
28 unhandledData: [],
29 publish: callbacks.fire,
30 prepare: function(){
31 for(var i=0; i< arguments.length; i++){
32 this.unhandledData.push(arguments[i]);
33 }
34 },
35 processPrepared: function(){
36 var data = this.unhandledData;
37 this.unhandledData = [];
38 for(var i=0; i< data.length; i++){
39 this.publish(data[i]);
40 }
41 },
42 subscribe: callbacks.add,
43 unsubscribe: callbacks.remove
44 };
45 if (id) {
46 topics[id] = topic;
47 }
48 }
49 return topic;
50 };
@@ -1,139 +1,140 b''
1 1 module.exports = function(grunt) {
2 2 grunt.initConfig({
3 3
4 4 dirs: {
5 5 css: "rhodecode/public/css",
6 6 js: {
7 7 "src": "rhodecode/public/js/src",
8 8 "dest": "rhodecode/public/js"
9 9 }
10 10 },
11 11
12 12 concat: {
13 13 dist: {
14 14 src: [
15 15 // Base libraries
16 16 '<%= dirs.js.src %>/jquery-1.11.1.min.js',
17 17 '<%= dirs.js.src %>/logging.js',
18 18 '<%= dirs.js.src %>/bootstrap.js',
19 19 '<%= dirs.js.src %>/mousetrap.js',
20 20 '<%= dirs.js.src %>/moment.js',
21 21 '<%= dirs.js.src %>/appenlight-client-0.4.1.min.js',
22 22 '<%= dirs.js.src %>/i18n_utils.js',
23 23
24 24 // Plugins
25 25 '<%= dirs.js.src %>/plugins/jquery.pjax.js',
26 26 '<%= dirs.js.src %>/plugins/jquery.dataTables.js',
27 27 '<%= dirs.js.src %>/plugins/flavoured_checkbox.js',
28 28 '<%= dirs.js.src %>/plugins/jquery.auto-grow-input.js',
29 29 '<%= dirs.js.src %>/plugins/jquery.autocomplete.js',
30 30 '<%= dirs.js.src %>/plugins/jquery.debounce.js',
31 31 '<%= dirs.js.src %>/plugins/jquery.mark.js',
32 32 '<%= dirs.js.src %>/plugins/jquery.timeago.js',
33 33 '<%= dirs.js.src %>/plugins/jquery.timeago-extension.js',
34 34
35 35 // Select2
36 36 '<%= dirs.js.src %>/select2/select2.js',
37 37
38 38 // Code-mirror
39 39 '<%= dirs.js.src %>/codemirror/codemirror.js',
40 40 '<%= dirs.js.src %>/codemirror/codemirror_loadmode.js',
41 41 '<%= dirs.js.src %>/codemirror/codemirror_hint.js',
42 42 '<%= dirs.js.src %>/codemirror/codemirror_overlay.js',
43 43 '<%= dirs.js.src %>/codemirror/codemirror_placeholder.js',
44 44 // TODO: mikhail: this is an exception. Since the code mirror modes
45 45 // are loaded "on the fly", we need to keep them in a public folder
46 46 '<%= dirs.js.dest %>/mode/meta.js',
47 47 '<%= dirs.js.dest %>/mode/meta_ext.js',
48 48 '<%= dirs.js.dest %>/rhodecode/i18n/select2/translations.js',
49 49
50 50 // Rhodecode utilities
51 51 '<%= dirs.js.src %>/rhodecode/utils/array.js',
52 52 '<%= dirs.js.src %>/rhodecode/utils/string.js',
53 53 '<%= dirs.js.src %>/rhodecode/utils/pyroutes.js',
54 54 '<%= dirs.js.src %>/rhodecode/utils/ajax.js',
55 55 '<%= dirs.js.src %>/rhodecode/utils/autocomplete.js',
56 56 '<%= dirs.js.src %>/rhodecode/utils/colorgenerator.js',
57 57 '<%= dirs.js.src %>/rhodecode/utils/ie.js',
58 58 '<%= dirs.js.src %>/rhodecode/utils/os.js',
59 '<%= dirs.js.src %>/rhodecode/utils/topics.js',
59 60
60 61 // Rhodecode widgets
61 62 '<%= dirs.js.src %>/rhodecode/widgets/multiselect.js',
62 63
63 64 // Rhodecode components
64 65 '<%= dirs.js.src %>/rhodecode/init.js',
65 66 '<%= dirs.js.src %>/rhodecode/codemirror.js',
66 67 '<%= dirs.js.src %>/rhodecode/comments.js',
67 68 '<%= dirs.js.src %>/rhodecode/constants.js',
68 69 '<%= dirs.js.src %>/rhodecode/files.js',
69 70 '<%= dirs.js.src %>/rhodecode/followers.js',
70 71 '<%= dirs.js.src %>/rhodecode/menus.js',
71 72 '<%= dirs.js.src %>/rhodecode/notifications.js',
72 73 '<%= dirs.js.src %>/rhodecode/permissions.js',
73 74 '<%= dirs.js.src %>/rhodecode/pjax.js',
74 75 '<%= dirs.js.src %>/rhodecode/pullrequests.js',
75 76 '<%= dirs.js.src %>/rhodecode/settings.js',
76 77 '<%= dirs.js.src %>/rhodecode/select2_widgets.js',
77 78 '<%= dirs.js.src %>/rhodecode/tooltips.js',
78 79 '<%= dirs.js.src %>/rhodecode/users.js',
79 80 '<%= dirs.js.src %>/rhodecode/appenlight.js',
80 81
81 82 // Rhodecode main module
82 83 '<%= dirs.js.src %>/rhodecode.js'
83 84 ],
84 85 dest: '<%= dirs.js.dest %>/scripts.js',
85 86 nonull: true
86 87 }
87 88 },
88 89
89 90 less: {
90 91 development: {
91 92 options: {
92 93 compress: false,
93 94 yuicompress: false,
94 95 optimization: 0
95 96 },
96 97 files: {
97 98 "<%= dirs.css %>/style.css": "<%= dirs.css %>/main.less"
98 99 }
99 100 },
100 101 production: {
101 102 options: {
102 103 compress: true,
103 104 yuicompress: true,
104 105 optimization: 2
105 106 },
106 107 files: {
107 108 "<%= dirs.css %>/style.css": "<%= dirs.css %>/main.less"
108 109 }
109 110 }
110 111 },
111 112
112 113 watch: {
113 114 less: {
114 115 files: ["<%= dirs.css %>/*.less"],
115 116 tasks: ["less:production"]
116 117 },
117 118 js: {
118 119 files: ["<%= dirs.js.src %>/**/*.js"],
119 120 tasks: ["concat:dist"]
120 121 }
121 122 },
122 123
123 124 jshint: {
124 125 rhodecode: {
125 126 src: '<%= dirs.js.src %>/rhodecode/**/*.js',
126 127 options: {
127 128 jshintrc: '.jshintrc'
128 129 }
129 130 }
130 131 }
131 132 });
132 133
133 134 grunt.loadNpmTasks('grunt-contrib-less');
134 135 grunt.loadNpmTasks('grunt-contrib-concat');
135 136 grunt.loadNpmTasks('grunt-contrib-watch');
136 137 grunt.loadNpmTasks('grunt-contrib-jshint');
137 138
138 139 grunt.registerTask('default', ['less:production', 'concat:dist']);
139 140 };
General Comments 0
You need to be logged in to leave comments. Login now