Introduced a mechanism to load required javascripts at runtime

(lazy loading) using the require.js. This allows us to load the
javascript required for any node, only when it was loaded in the browser
tree. Also, introduced the mechanism to show/edit/create of any node in
a tab panel (wcDocker.Panel).
This commit is contained in:
Ashesh Vashi
2015-06-30 11:21:55 +05:30
parent 35d01bea3e
commit aa150030eb
77 changed files with 24504 additions and 1395 deletions

View File

@@ -18,23 +18,58 @@
<link type="text/css" rel="stylesheet" href="{{ url_for('static', filename='css/bootstrap.css' if config.DEBUG else 'css/bootstrap.min.css')}}"/>
<link type="text/css" rel="stylesheet" href="{{ url_for('static', filename='css/alertifyjs/alertify.css' if config.DEBUG else 'css/alertifyjs/alertify.min.css') }}" />
<link type="text/css" rel="stylesheet" href="{{ url_for('static', filename='css/alertifyjs/themes/bootstrap.css' if config.DEBUG else 'css/alertifyjs/themes/bootstrap.min.css') }}" />
<link type="text/css" rel="stylesheet" href="{{ url_for('static', filename='css/bootstrap-theme.min.css' if config.DEBUG else 'css/bootstrap-theme.css') }}">
<link type="text/css" rel="stylesheet" href="{{ url_for('static', filename='css/overrides.css') }}">
<link type="text/css" rel="stylesheet" href="{{ url_for('static', filename='css/bootstrap-theme.css' if config.DEBUG else 'css/bootstrap-theme.min.css') }}"/>
<link type="text/css" rel="stylesheet" href="{{ url_for('static', filename='css/font-awesome.css' if config.DEBUG else 'css/font-awesome.min.css') }}"/>
<link type="text/css" rel="stylesheet" href="{{ url_for('static', filename='css/font-mfizz.css') }}"/>
<link type="text/css" rel="stylesheet" href="{{ url_for('static', filename='css/overrides.css') }}"/>
<link type="text/css" rel="stylesheet" href="{{ url_for('static', filename='css/bootstrap-datepicker3.css')}}"/>
<!-- View specified stylesheets -->
{% for stylesheet in current_app.stylesheets %}
<link type="text/css" rel="stylesheet" href="{{ stylesheet }}">
{% endfor %}
<!-- Base template scripts -->
<script type="text/javascript" src="{{ url_for('static', filename='js/modernizr-2.6.2-respond-1.1.0.min.js') }}"></script>
<script type="text/javascript" src="{{ url_for('static', filename='js/jquery-1.11.2.js' if config.DEBUG else 'js/jquery-1.11.2.min.js') }}"></script>
<script type="text/javascript" src="{{ url_for('static', filename='js/bootstrap.js' if config.DEBUG else 'js/bootstrap.min.js') }}"></script>
<script type="text/javascript" src="{{ url_for('static', filename='js/alertifyjs/alertify.js' if config.DEBUG else 'js/alertifyjs/alertify.min.js') }}"></script>
<script type="text/javascript" src="{{ url_for('static', filename='js/alertifyjs/pgadmin.defaults.js') }}"></script>
<script type="text/javascript" src="{{ url_for('static', filename='js/require.js' if config.DEBUG else 'js/require.min.js') }}"></script>
<script type="text/javascript">
require.config({
baseUrl: '',
shim: {
"backbone": {
"deps": ['underscore', 'jquery'],
"exports": 'Backbone'
},
"bootstrap": {
"deps": ['jquery'],
},
"bootstrap.datepicker": {
"deps": ['jquery', 'bootstrap'],
"exports": 'jQuery.fn.datepicker'
}{% for script in current_app.javascripts %}{% if 'deps' in script or 'exports' in script %},
'{{ script.name }}': {
{% if 'deps' in script %}"deps": [ {% set comma = False %}{% for dep in script['deps'] %} {% if comma %},{% else %}{% set comma = True %}{% endif %} '{{ dep }}'{% endfor %}],{% endif %}
{% if 'exports' in script %}"exports": "{{ script['exports'] }}"{% endif %}
}{% endif %}{% endfor %}
},
paths: {
pgadmin: "{{ url_for('static', filename='js/pgadmin') }}",
modernizr: "{{ url_for('static', filename='js/modernizr-2.6.2-respond-1.1.0.min') }}",
jquery: "{{ url_for('static', filename='js/' + 'jquery-1.11.2' if config.DEBUG else 'jquery-1.11.2.min') }}",
underscore: "{{ url_for('static', filename='js/' + 'underscore' if config.DEBUG else 'underscore.min') }}",
"underscore.string": "{{ url_for('static', filename='js/' + 'underscore.string' if config.DEBUG else 'underscore.string.min') }}",
bootstrap: "{{ url_for('static', filename='js/' + 'bootstrap' if config.DEBUG else 'bootstrap.min') }}",
alertifyjs: "{{ url_for('static', filename='js/alertifyjs/' + 'alertify' if config.DEBUG else 'alertify.min') }}",
'pgadmin.alertifyjs': "{{ url_for('static', filename='js/alertifyjs/pgadmin.defaults') }}",
backbone: "{{ url_for('static', filename='js/' + 'backbone' if config.DEBUG else 'backbone.min') }}",
"bootstrap.datepicker": "{{ url_for('static', filename='js/' + 'bootstrap-datepicker' if config.DEBUG else 'bootstrap-datepicker.min') }}",
backform: "{{ url_for('static', filename='js/' + 'backform') }}",
'pgadmin.backform': "{{ url_for('static', filename='js/' + 'backform.pgadmin') }}"{% for script in current_app.javascripts %},
'{{ script.name }}': "{{ script.path }}"{% endfor %}
}
});
</script>
<!-- View specified scripts -->
{% for script in current_app.javascripts %}
<script type="text/javascript" src="{{ script }}"></script>
{% endfor %}
</head>
<body>
<!--[if lt IE 7]>
@@ -42,6 +77,9 @@
<![endif]-->
{% block body %}{% endblock %}
<script>
{% block init_script %}{% endblock %}
</script>
</body>
</html>

View File

@@ -1,6 +1,6 @@
{% macro render_field_with_errors(field, type) %}
<div class="form-group{% if field.errors %} has-error{% endif %}">
<input class="form-control" placeholder="{{ field.label.text }}" name="{{ field.name }}" type="{{ type }}">
<input class="form-control" placeholder="{{ field.label.text }}" name="{{ field.name }}" type="{% if type %}{{ type }}{% else %}{{ field.type }}{% endif %}">
</div>
{% if field.errors %}
{% for error in field.errors %}