##// 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 module.exports = function(grunt) {
1 module.exports = function(grunt) {
2 grunt.initConfig({
2 grunt.initConfig({
3
3
4 dirs: {
4 dirs: {
5 css: "rhodecode/public/css",
5 css: "rhodecode/public/css",
6 js: {
6 js: {
7 "src": "rhodecode/public/js/src",
7 "src": "rhodecode/public/js/src",
8 "dest": "rhodecode/public/js"
8 "dest": "rhodecode/public/js"
9 }
9 }
10 },
10 },
11
11
12 concat: {
12 concat: {
13 dist: {
13 dist: {
14 src: [
14 src: [
15 // Base libraries
15 // Base libraries
16 '<%= dirs.js.src %>/jquery-1.11.1.min.js',
16 '<%= dirs.js.src %>/jquery-1.11.1.min.js',
17 '<%= dirs.js.src %>/logging.js',
17 '<%= dirs.js.src %>/logging.js',
18 '<%= dirs.js.src %>/bootstrap.js',
18 '<%= dirs.js.src %>/bootstrap.js',
19 '<%= dirs.js.src %>/mousetrap.js',
19 '<%= dirs.js.src %>/mousetrap.js',
20 '<%= dirs.js.src %>/moment.js',
20 '<%= dirs.js.src %>/moment.js',
21 '<%= dirs.js.src %>/appenlight-client-0.4.1.min.js',
21 '<%= dirs.js.src %>/appenlight-client-0.4.1.min.js',
22 '<%= dirs.js.src %>/i18n_utils.js',
22 '<%= dirs.js.src %>/i18n_utils.js',
23
23
24 // Plugins
24 // Plugins
25 '<%= dirs.js.src %>/plugins/jquery.pjax.js',
25 '<%= dirs.js.src %>/plugins/jquery.pjax.js',
26 '<%= dirs.js.src %>/plugins/jquery.dataTables.js',
26 '<%= dirs.js.src %>/plugins/jquery.dataTables.js',
27 '<%= dirs.js.src %>/plugins/flavoured_checkbox.js',
27 '<%= dirs.js.src %>/plugins/flavoured_checkbox.js',
28 '<%= dirs.js.src %>/plugins/jquery.auto-grow-input.js',
28 '<%= dirs.js.src %>/plugins/jquery.auto-grow-input.js',
29 '<%= dirs.js.src %>/plugins/jquery.autocomplete.js',
29 '<%= dirs.js.src %>/plugins/jquery.autocomplete.js',
30 '<%= dirs.js.src %>/plugins/jquery.debounce.js',
30 '<%= dirs.js.src %>/plugins/jquery.debounce.js',
31 '<%= dirs.js.src %>/plugins/jquery.mark.js',
31 '<%= dirs.js.src %>/plugins/jquery.mark.js',
32 '<%= dirs.js.src %>/plugins/jquery.timeago.js',
32 '<%= dirs.js.src %>/plugins/jquery.timeago.js',
33 '<%= dirs.js.src %>/plugins/jquery.timeago-extension.js',
33 '<%= dirs.js.src %>/plugins/jquery.timeago-extension.js',
34
34
35 // Select2
35 // Select2
36 '<%= dirs.js.src %>/select2/select2.js',
36 '<%= dirs.js.src %>/select2/select2.js',
37
37
38 // Code-mirror
38 // Code-mirror
39 '<%= dirs.js.src %>/codemirror/codemirror.js',
39 '<%= dirs.js.src %>/codemirror/codemirror.js',
40 '<%= dirs.js.src %>/codemirror/codemirror_loadmode.js',
40 '<%= dirs.js.src %>/codemirror/codemirror_loadmode.js',
41 '<%= dirs.js.src %>/codemirror/codemirror_hint.js',
41 '<%= dirs.js.src %>/codemirror/codemirror_hint.js',
42 '<%= dirs.js.src %>/codemirror/codemirror_overlay.js',
42 '<%= dirs.js.src %>/codemirror/codemirror_overlay.js',
43 '<%= dirs.js.src %>/codemirror/codemirror_placeholder.js',
43 '<%= dirs.js.src %>/codemirror/codemirror_placeholder.js',
44 // TODO: mikhail: this is an exception. Since the code mirror modes
44 // TODO: mikhail: this is an exception. Since the code mirror modes
45 // are loaded "on the fly", we need to keep them in a public folder
45 // are loaded "on the fly", we need to keep them in a public folder
46 '<%= dirs.js.dest %>/mode/meta.js',
46 '<%= dirs.js.dest %>/mode/meta.js',
47 '<%= dirs.js.dest %>/mode/meta_ext.js',
47 '<%= dirs.js.dest %>/mode/meta_ext.js',
48 '<%= dirs.js.dest %>/rhodecode/i18n/select2/translations.js',
48 '<%= dirs.js.dest %>/rhodecode/i18n/select2/translations.js',
49
49
50 // Rhodecode utilities
50 // Rhodecode utilities
51 '<%= dirs.js.src %>/rhodecode/utils/array.js',
51 '<%= dirs.js.src %>/rhodecode/utils/array.js',
52 '<%= dirs.js.src %>/rhodecode/utils/string.js',
52 '<%= dirs.js.src %>/rhodecode/utils/string.js',
53 '<%= dirs.js.src %>/rhodecode/utils/pyroutes.js',
53 '<%= dirs.js.src %>/rhodecode/utils/pyroutes.js',
54 '<%= dirs.js.src %>/rhodecode/utils/ajax.js',
54 '<%= dirs.js.src %>/rhodecode/utils/ajax.js',
55 '<%= dirs.js.src %>/rhodecode/utils/autocomplete.js',
55 '<%= dirs.js.src %>/rhodecode/utils/autocomplete.js',
56 '<%= dirs.js.src %>/rhodecode/utils/colorgenerator.js',
56 '<%= dirs.js.src %>/rhodecode/utils/colorgenerator.js',
57 '<%= dirs.js.src %>/rhodecode/utils/ie.js',
57 '<%= dirs.js.src %>/rhodecode/utils/ie.js',
58 '<%= dirs.js.src %>/rhodecode/utils/os.js',
58 '<%= dirs.js.src %>/rhodecode/utils/os.js',
59 '<%= dirs.js.src %>/rhodecode/utils/topics.js',
59
60
60 // Rhodecode widgets
61 // Rhodecode widgets
61 '<%= dirs.js.src %>/rhodecode/widgets/multiselect.js',
62 '<%= dirs.js.src %>/rhodecode/widgets/multiselect.js',
62
63
63 // Rhodecode components
64 // Rhodecode components
64 '<%= dirs.js.src %>/rhodecode/init.js',
65 '<%= dirs.js.src %>/rhodecode/init.js',
65 '<%= dirs.js.src %>/rhodecode/codemirror.js',
66 '<%= dirs.js.src %>/rhodecode/codemirror.js',
66 '<%= dirs.js.src %>/rhodecode/comments.js',
67 '<%= dirs.js.src %>/rhodecode/comments.js',
67 '<%= dirs.js.src %>/rhodecode/constants.js',
68 '<%= dirs.js.src %>/rhodecode/constants.js',
68 '<%= dirs.js.src %>/rhodecode/files.js',
69 '<%= dirs.js.src %>/rhodecode/files.js',
69 '<%= dirs.js.src %>/rhodecode/followers.js',
70 '<%= dirs.js.src %>/rhodecode/followers.js',
70 '<%= dirs.js.src %>/rhodecode/menus.js',
71 '<%= dirs.js.src %>/rhodecode/menus.js',
71 '<%= dirs.js.src %>/rhodecode/notifications.js',
72 '<%= dirs.js.src %>/rhodecode/notifications.js',
72 '<%= dirs.js.src %>/rhodecode/permissions.js',
73 '<%= dirs.js.src %>/rhodecode/permissions.js',
73 '<%= dirs.js.src %>/rhodecode/pjax.js',
74 '<%= dirs.js.src %>/rhodecode/pjax.js',
74 '<%= dirs.js.src %>/rhodecode/pullrequests.js',
75 '<%= dirs.js.src %>/rhodecode/pullrequests.js',
75 '<%= dirs.js.src %>/rhodecode/settings.js',
76 '<%= dirs.js.src %>/rhodecode/settings.js',
76 '<%= dirs.js.src %>/rhodecode/select2_widgets.js',
77 '<%= dirs.js.src %>/rhodecode/select2_widgets.js',
77 '<%= dirs.js.src %>/rhodecode/tooltips.js',
78 '<%= dirs.js.src %>/rhodecode/tooltips.js',
78 '<%= dirs.js.src %>/rhodecode/users.js',
79 '<%= dirs.js.src %>/rhodecode/users.js',
79 '<%= dirs.js.src %>/rhodecode/appenlight.js',
80 '<%= dirs.js.src %>/rhodecode/appenlight.js',
80
81
81 // Rhodecode main module
82 // Rhodecode main module
82 '<%= dirs.js.src %>/rhodecode.js'
83 '<%= dirs.js.src %>/rhodecode.js'
83 ],
84 ],
84 dest: '<%= dirs.js.dest %>/scripts.js',
85 dest: '<%= dirs.js.dest %>/scripts.js',
85 nonull: true
86 nonull: true
86 }
87 }
87 },
88 },
88
89
89 less: {
90 less: {
90 development: {
91 development: {
91 options: {
92 options: {
92 compress: false,
93 compress: false,
93 yuicompress: false,
94 yuicompress: false,
94 optimization: 0
95 optimization: 0
95 },
96 },
96 files: {
97 files: {
97 "<%= dirs.css %>/style.css": "<%= dirs.css %>/main.less"
98 "<%= dirs.css %>/style.css": "<%= dirs.css %>/main.less"
98 }
99 }
99 },
100 },
100 production: {
101 production: {
101 options: {
102 options: {
102 compress: true,
103 compress: true,
103 yuicompress: true,
104 yuicompress: true,
104 optimization: 2
105 optimization: 2
105 },
106 },
106 files: {
107 files: {
107 "<%= dirs.css %>/style.css": "<%= dirs.css %>/main.less"
108 "<%= dirs.css %>/style.css": "<%= dirs.css %>/main.less"
108 }
109 }
109 }
110 }
110 },
111 },
111
112
112 watch: {
113 watch: {
113 less: {
114 less: {
114 files: ["<%= dirs.css %>/*.less"],
115 files: ["<%= dirs.css %>/*.less"],
115 tasks: ["less:production"]
116 tasks: ["less:production"]
116 },
117 },
117 js: {
118 js: {
118 files: ["<%= dirs.js.src %>/**/*.js"],
119 files: ["<%= dirs.js.src %>/**/*.js"],
119 tasks: ["concat:dist"]
120 tasks: ["concat:dist"]
120 }
121 }
121 },
122 },
122
123
123 jshint: {
124 jshint: {
124 rhodecode: {
125 rhodecode: {
125 src: '<%= dirs.js.src %>/rhodecode/**/*.js',
126 src: '<%= dirs.js.src %>/rhodecode/**/*.js',
126 options: {
127 options: {
127 jshintrc: '.jshintrc'
128 jshintrc: '.jshintrc'
128 }
129 }
129 }
130 }
130 }
131 }
131 });
132 });
132
133
133 grunt.loadNpmTasks('grunt-contrib-less');
134 grunt.loadNpmTasks('grunt-contrib-less');
134 grunt.loadNpmTasks('grunt-contrib-concat');
135 grunt.loadNpmTasks('grunt-contrib-concat');
135 grunt.loadNpmTasks('grunt-contrib-watch');
136 grunt.loadNpmTasks('grunt-contrib-watch');
136 grunt.loadNpmTasks('grunt-contrib-jshint');
137 grunt.loadNpmTasks('grunt-contrib-jshint');
137
138
138 grunt.registerTask('default', ['less:production', 'concat:dist']);
139 grunt.registerTask('default', ['less:production', 'concat:dist']);
139 };
140 };
General Comments 0
You need to be logged in to leave comments. Login now