Implementation of the client side 'url_for(...)' function.

Created a url_for function module to be used by different javascript
modules to use the same functionality of flask at client side.

A python module can expose the list of endpoints, used by its
javascripts, by overriding the 'get_exposed_url_endpoints(self)'
function.

In this patch, we have modified all the browser modules to use this
function. It will allow us to move the majority of the javascript
modules of browser nodes from templates directory to the static
directory.

TODO::
- Move these javascripts modules to the static directory.
- Use this function in all the applicable javascript modules.
  e.g. tools, miscellaneous modules
This commit is contained in:
Ashesh Vashi
2017-06-12 12:01:22 +05:30
parent dea850b503
commit fd3ddbeafb
67 changed files with 449 additions and 286 deletions

View File

@@ -1,8 +1,10 @@
define(['jquery',
'sources/selection/column_selector',
'sources/selection/row_selector',
'sources/selection/range_selection_helper'],
function ($, ColumnSelector, RowSelector, RangeSelectionHelper) {
'sources/selection/range_selection_helper',
'sources/url_for'
],
function ($, ColumnSelector, RowSelector, RangeSelectionHelper, url_for) {
var Slick = window.Slick;
var GridSelector = function (columnDefinitions) {
@@ -32,7 +34,7 @@ define(['jquery',
'title="Select/Deselect All">' +
'<br>' +
columnDefinitions[0].name +
'<img class="select-all-icon" src="/static/img/select-all-icon.png">' +
'<img class="select-all-icon" src="' + url_for('static', {'filename': 'img/select-all-icon.png'}) + '"></img>'
'</span>';
return columnDefinitions;
};