##// END OF EJS Templates
polymer: introduce webcomponents to rhodecode
ergo -
r689:5d204bce default
parent child Browse files
Show More
@@ -0,0 +1,4 b''
1 <link rel="import" href="../../../../../bower_components/paper-toggle-button/paper-toggle-button.html">
2 <link rel="import" href="../../../../../bower_components/paper-toast/paper-toast.html">
3 <link rel="import" href="../../../../../bower_components/paper-tooltip/paper-tooltip.html">
4 <link rel="import" href="../../../../../bower_components/paper-button/paper-button.html">
@@ -1,59 +1,60 b''
1 1 syntax: glob
2 2 *.egg
3 3 *.egg-info
4 4 *.idea
5 5 *.orig
6 6 *.pyc
7 7 *.sqlite-journal
8 8 *.swp
9 9 *.tox
10 10 *.DS_Store*
11 11
12 12 syntax: regexp
13 13
14 14 #.filename
15 15 ^\.settings$
16 16 ^\.project$
17 17 ^\.pydevproject$
18 18 ^\.coverage$
19 19 ^\.cache.*$
20 20 ^\.rhodecode$
21 21
22 22 ^rcextensions
23 23 ^_dev
24 24 ^._dev
25 25 ^build/
26 ^bower_components/
26 27 ^coverage\.xml$
27 28 ^data$
28 29 ^\.eggs/
29 30 ^configs/data$
30 31 ^dev.ini$
31 32 ^acceptance_tests/dev.*\.ini$
32 33 ^dist/
33 34 ^fabfile.py
34 35 ^htmlcov
35 36 ^junit\.xml$
36 37 ^node_modules/
37 38 ^pylint.log$
38 39 ^rcextensions/
39 40 ^result$
40 41 ^rhodecode/public/css/style.css$
41 42 ^rhodecode/public/js/scripts.js$
42 43 ^rhodecode\.db$
43 44 ^rhodecode\.log$
44 45 ^rhodecode_dev\.log$
45 46 ^test\.db$
46 47
47 48 # ac-tests
48 49 ^acceptance_tests/\.cache.*$
49 50 ^acceptance_tests/externals
50 51 ^acceptance_tests/ghostdriver.log$
51 52 ^acceptance_tests/local(_.+)?\.ini$
52 53
53 54 # docs
54 55 ^docs/_build$
55 56 ^docs/result$
56 57 ^docs-internal/_build$
57 58
58 59 # Cythonized things
59 60 ^rhodecode/.*\.(c|so)$
@@ -1,144 +1,167 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 copy: {
12 main: {
13 expand: true,
14 cwd: 'bower_components',
15 src: 'webcomponentsjs/**',
16 dest: '<%= dirs.js.dest %>/vendors',
17 },
18 },
12 19 concat: {
13 20 dist: {
14 21 src: [
15 22 // Base libraries
16 23 '<%= dirs.js.src %>/jquery-1.11.1.min.js',
17 24 '<%= dirs.js.src %>/logging.js',
18 25 '<%= dirs.js.src %>/bootstrap.js',
19 26 '<%= dirs.js.src %>/mousetrap.js',
20 27 '<%= dirs.js.src %>/moment.js',
21 28 '<%= dirs.js.src %>/appenlight-client-0.4.1.min.js',
22 29 '<%= dirs.js.src %>/i18n_utils.js',
23 30 '<%= dirs.js.src %>/deform.js',
24 31
25 32 // Plugins
26 33 '<%= dirs.js.src %>/plugins/jquery.pjax.js',
27 34 '<%= dirs.js.src %>/plugins/jquery.dataTables.js',
28 35 '<%= dirs.js.src %>/plugins/flavoured_checkbox.js',
29 36 '<%= dirs.js.src %>/plugins/jquery.auto-grow-input.js',
30 37 '<%= dirs.js.src %>/plugins/jquery.autocomplete.js',
31 38 '<%= dirs.js.src %>/plugins/jquery.debounce.js',
32 39 '<%= dirs.js.src %>/plugins/jquery.mark.js',
33 40 '<%= dirs.js.src %>/plugins/jquery.timeago.js',
34 41 '<%= dirs.js.src %>/plugins/jquery.timeago-extension.js',
35 42 '<%= dirs.js.src %>/plugins/toastr.js',
36 43
37 44 // Select2
38 45 '<%= dirs.js.src %>/select2/select2.js',
39 46
40 47 // Code-mirror
41 48 '<%= dirs.js.src %>/codemirror/codemirror.js',
42 49 '<%= dirs.js.src %>/codemirror/codemirror_loadmode.js',
43 50 '<%= dirs.js.src %>/codemirror/codemirror_hint.js',
44 51 '<%= dirs.js.src %>/codemirror/codemirror_overlay.js',
45 52 '<%= dirs.js.src %>/codemirror/codemirror_placeholder.js',
46 53 // TODO: mikhail: this is an exception. Since the code mirror modes
47 54 // are loaded "on the fly", we need to keep them in a public folder
48 55 '<%= dirs.js.dest %>/mode/meta.js',
49 56 '<%= dirs.js.dest %>/mode/meta_ext.js',
50 57 '<%= dirs.js.dest %>/rhodecode/i18n/select2/translations.js',
51 58
52 59 // Rhodecode utilities
53 60 '<%= dirs.js.src %>/rhodecode/utils/array.js',
54 61 '<%= dirs.js.src %>/rhodecode/utils/string.js',
55 62 '<%= dirs.js.src %>/rhodecode/utils/pyroutes.js',
56 63 '<%= dirs.js.src %>/rhodecode/utils/ajax.js',
57 64 '<%= dirs.js.src %>/rhodecode/utils/autocomplete.js',
58 65 '<%= dirs.js.src %>/rhodecode/utils/colorgenerator.js',
59 66 '<%= dirs.js.src %>/rhodecode/utils/ie.js',
60 67 '<%= dirs.js.src %>/rhodecode/utils/os.js',
61 68 '<%= dirs.js.src %>/rhodecode/utils/topics.js',
62 69
63 70 // Rhodecode widgets
64 71 '<%= dirs.js.src %>/rhodecode/widgets/multiselect.js',
65 72
66 73 // Rhodecode components
67 74 '<%= dirs.js.src %>/rhodecode/init.js',
68 75 '<%= dirs.js.src %>/rhodecode/connection_controller.js',
69 76 '<%= dirs.js.src %>/rhodecode/codemirror.js',
70 77 '<%= dirs.js.src %>/rhodecode/comments.js',
71 78 '<%= dirs.js.src %>/rhodecode/constants.js',
72 79 '<%= dirs.js.src %>/rhodecode/files.js',
73 80 '<%= dirs.js.src %>/rhodecode/followers.js',
74 81 '<%= dirs.js.src %>/rhodecode/menus.js',
75 82 '<%= dirs.js.src %>/rhodecode/notifications.js',
76 83 '<%= dirs.js.src %>/rhodecode/permissions.js',
77 84 '<%= dirs.js.src %>/rhodecode/pjax.js',
78 85 '<%= dirs.js.src %>/rhodecode/pullrequests.js',
79 86 '<%= dirs.js.src %>/rhodecode/settings.js',
80 87 '<%= dirs.js.src %>/rhodecode/select2_widgets.js',
81 88 '<%= dirs.js.src %>/rhodecode/tooltips.js',
82 89 '<%= dirs.js.src %>/rhodecode/users.js',
83 90 '<%= dirs.js.src %>/rhodecode/utils/notifications.js',
84 91 '<%= dirs.js.src %>/rhodecode/appenlight.js',
85 92
86 93 // Rhodecode main module
87 94 '<%= dirs.js.src %>/rhodecode.js'
88 95 ],
89 96 dest: '<%= dirs.js.dest %>/scripts.js',
90 97 nonull: true
91 98 }
92 99 },
93 100
94 101 less: {
95 102 development: {
96 103 options: {
97 104 compress: false,
98 105 yuicompress: false,
99 106 optimization: 0
100 107 },
101 108 files: {
102 109 "<%= dirs.css %>/style.css": "<%= dirs.css %>/main.less"
103 110 }
104 111 },
105 112 production: {
106 113 options: {
107 114 compress: true,
108 115 yuicompress: true,
109 116 optimization: 2
110 117 },
111 118 files: {
112 119 "<%= dirs.css %>/style.css": "<%= dirs.css %>/main.less"
113 120 }
114 121 }
115 122 },
116 123
117 124 watch: {
118 125 less: {
119 126 files: ["<%= dirs.css %>/*.less"],
120 127 tasks: ["less:production"]
121 128 },
122 129 js: {
123 files: ["<%= dirs.js.src %>/**/*.js"],
130 files: ["<%= dirs.js.src %>/**/*.js", "<%= dirs.js.src %>/components/*.*"],
124 131 tasks: ["concat:dist"]
125 132 }
126 133 },
127 134
128 135 jshint: {
129 136 rhodecode: {
130 137 src: '<%= dirs.js.src %>/rhodecode/**/*.js',
131 138 options: {
132 139 jshintrc: '.jshintrc'
133 140 }
134 141 }
142 },
143 vulcanize: {
144 default: {
145 options: {
146 abspath: '',
147 inlineScripts: true,
148 inlineCss: true,
149 stripComments: true
150 },
151 files: {
152 '<%= dirs.js.dest %>/rhodecode-components.html': '<%= dirs.js.src %>/components/shared-components.html'
153 }
154 }
135 155 }
136 156 });
137 157
138 158 grunt.loadNpmTasks('grunt-contrib-less');
139 159 grunt.loadNpmTasks('grunt-contrib-concat');
140 160 grunt.loadNpmTasks('grunt-contrib-watch');
141 161 grunt.loadNpmTasks('grunt-contrib-jshint');
162 grunt.loadNpmTasks('grunt-vulcanize');
163 grunt.loadNpmTasks('grunt-crisper');
164 grunt.loadNpmTasks('grunt-contrib-copy');
142 165
143 grunt.registerTask('default', ['less:production', 'concat:dist']);
166 grunt.registerTask('default', ['copy','vulcanize', 'less:production', 'concat:dist']);
144 167 };
@@ -1,12 +1,17 b''
1 1 {
2 2 "name": "rhodecode-enterprise",
3 3 "version": "0.0.1",
4 4 "devDependencies": {
5 5 "grunt": "^0.4.5",
6 "grunt-contrib-copy": "^1.0.0",
6 7 "grunt-contrib-concat": "^0.5.1",
7 8 "grunt-contrib-jshint": "^0.12.0",
8 9 "grunt-contrib-less": "^1.1.0",
9 10 "grunt-contrib-watch": "^0.6.1",
11 "crisper": "^2.0.2",
12 "vulcanize": "^1.14.8",
13 "grunt-crisper": "^1.0.1",
14 "grunt-vulcanize": "^1.0.0",
10 15 "jshint": "^2.9.1-rc3"
11 16 }
12 17 }
@@ -1,138 +1,157 b''
1 1 ## -*- coding: utf-8 -*-
2 2 <!DOCTYPE html>
3 3
4 4 <%
5 5 c.template_context['repo_name'] = getattr(c, 'repo_name', '')
6 6
7 7 if hasattr(c, 'rhodecode_db_repo'):
8 8 c.template_context['repo_type'] = c.rhodecode_db_repo.repo_type
9 9 c.template_context['repo_landing_commit'] = c.rhodecode_db_repo.landing_rev[1]
10 10
11 11 if getattr(c, 'rhodecode_user', None) and c.rhodecode_user.user_id:
12 12 c.template_context['rhodecode_user']['username'] = c.rhodecode_user.username
13 13 c.template_context['rhodecode_user']['email'] = c.rhodecode_user.email
14 14 c.template_context['rhodecode_user']['notification_status'] = c.rhodecode_user.get_instance().user_data.get('notification_status', True)
15 15
16 16 c.template_context['visual']['default_renderer'] = h.get_visual_attr(c, 'default_renderer')
17 17 %>
18 18 <html xmlns="http://www.w3.org/1999/xhtml">
19 19 <head>
20 20 <title>${self.title()}</title>
21 21 <meta http-equiv="Content-Type" content="text/html;charset=utf-8" />
22 22 <%def name="robots()">
23 23 <meta name="robots" content="index, nofollow"/>
24 24 </%def>
25 25 ${self.robots()}
26 26 <link rel="icon" href="${h.asset('images/favicon.ico', ver=c.rhodecode_version_hash)}" sizes="16x16 32x32" type="image/png" />
27 27
28 28 ## CSS definitions
29 29 <%def name="css()">
30 30 <link rel="stylesheet" type="text/css" href="${h.asset('css/style.css', ver=c.rhodecode_version_hash)}" media="screen"/>
31 31 <!--[if lt IE 9]>
32 32 <link rel="stylesheet" type="text/css" href="${h.asset('css/ie.css', ver=c.rhodecode_version_hash)}" media="screen"/>
33 33 <![endif]-->
34 34 ## EXTRA FOR CSS
35 35 ${self.css_extra()}
36 36 </%def>
37 37 ## CSS EXTRA - optionally inject some extra CSS stuff needed for specific websites
38 38 <%def name="css_extra()">
39 39 </%def>
40 40
41 41 ${self.css()}
42 42
43 43 ## JAVASCRIPT
44 44 <%def name="js()">
45 45 <script src="${h.asset('js/rhodecode/i18n/%s.js' % c.language, ver=c.rhodecode_version_hash)}"></script>
46 46 <script type="text/javascript">
47 47 // register templateContext to pass template variables to JS
48 48 var templateContext = ${h.json.dumps(c.template_context)|n};
49 49
50 50 var REPO_NAME = "${getattr(c, 'repo_name', '')}";
51 51 %if hasattr(c, 'rhodecode_db_repo'):
52 52 var REPO_LANDING_REV = '${c.rhodecode_db_repo.landing_rev[1]}';
53 53 var REPO_TYPE = '${c.rhodecode_db_repo.repo_type}';
54 54 %else:
55 55 var REPO_LANDING_REV = '';
56 56 var REPO_TYPE = '';
57 57 %endif
58 58 var APPLICATION_URL = "${h.url('home').rstrip('/')}";
59 59 var ASSET_URL = "${h.asset('')}";
60 60 var DEFAULT_RENDERER = "${h.get_visual_attr(c, 'default_renderer')}";
61 61 var CSRF_TOKEN = "${getattr(c, 'csrf_token', '')}";
62 62 % if getattr(c, 'rhodecode_user', None):
63 63 var USER = {name:'${c.rhodecode_user.username}'};
64 64 % else:
65 65 var USER = {name:null};
66 66 % endif
67 67
68 68 var APPENLIGHT = {
69 69 enabled: ${'true' if getattr(c, 'appenlight_enabled', False) else 'false'},
70 70 key: '${getattr(c, "appenlight_api_public_key", "")}',
71 71 % if getattr(c, 'appenlight_server_url', None):
72 72 serverUrl: '${getattr(c, "appenlight_server_url", "")}',
73 73 % endif
74 74 requestInfo: {
75 75 % if getattr(c, 'rhodecode_user', None):
76 76 ip: '${c.rhodecode_user.ip_addr}',
77 77 username: '${c.rhodecode_user.username}'
78 78 % endif
79 79 }
80 80 };
81 81 </script>
82 82 <!--[if lt IE 9]>
83 83 <script language="javascript" type="text/javascript" src="${h.asset('js/excanvas.min.js')}"></script>
84 84 <![endif]-->
85 <script>
86 // setup Polymer options
87 window.Polymer = {lazyRegister: true, dom: 'shadow'};
88
89 // load webcomponents polyfills
90 (function() {
91 if ('registerElement' in document
92 && 'import' in document.createElement('link')
93 && 'content' in document.createElement('template')) {
94 // browser has web components
95 } else {
96 // polyfill web components
97 var e = document.createElement('script');
98 e.src = '${h.asset('js/vendors/webcomponentsjs/webcomponents-lite.min.js', ver=c.rhodecode_version_hash)}';
99 document.head.appendChild(e);
100 }
101 })();
102 </script>
103 <link rel="import" href="${h.asset('js/rhodecode-components.html', ver=c.rhodecode_version_hash)}">
85 104 <script language="javascript" type="text/javascript" src="${h.asset('js/rhodecode/routes.js', ver=c.rhodecode_version_hash)}"></script>
86 105 <script language="javascript" type="text/javascript" src="${h.asset('js/scripts.js', ver=c.rhodecode_version_hash)}"></script>
87 106 ## avoide escaping the %N
88 107 <script>CodeMirror.modeURL = "${h.asset('') + 'js/mode/%N/%N.js?ver='+c.rhodecode_version_hash}";</script>
89 108
90 109
91 110 ## JAVASCRIPT EXTRA - optionally inject some extra JS for specificed templates
92 111 ${self.js_extra()}
93 112
94 113 <script type="text/javascript">
95 114 $(document).ready(function(){
96 115 show_more_event();
97 116 timeagoActivate();
98 117 })
99 118 </script>
100 119
101 120 </%def>
102 121
103 122 ## JAVASCRIPT EXTRA - optionally inject some extra JS for specificed templates
104 123 <%def name="js_extra()"></%def>
105 124 ${self.js()}
106 125
107 126 <%def name="head_extra()"></%def>
108 127 ${self.head_extra()}
109 128 <%include file="/base/plugins_base.html"/>
110 129
111 130 ## extra stuff
112 131 %if c.pre_code:
113 132 ${c.pre_code|n}
114 133 %endif
115 134 </head>
116 135 <body id="body">
117 136 <noscript>
118 137 <div class="noscript-error">
119 138 ${_('Please enable JavaScript to use RhodeCode Enterprise')}
120 139 </div>
121 140 </noscript>
122 141 ## IE hacks
123 142 <!--[if IE 7]>
124 143 <script>$(document.body).addClass('ie7')</script>
125 144 <![endif]-->
126 145 <!--[if IE 8]>
127 146 <script>$(document.body).addClass('ie8')</script>
128 147 <![endif]-->
129 148 <!--[if IE 9]>
130 149 <script>$(document.body).addClass('ie9')</script>
131 150 <![endif]-->
132 151
133 152 ${next.body()}
134 153 %if c.post_code:
135 154 ${c.post_code|n}
136 155 %endif
137 156 </body>
138 157 </html>
General Comments 0
You need to be logged in to leave comments. Login now