Skip to content

Commit

Permalink
#2611 Reworked dependency loading of inline code. Introduced all inli…
Browse files Browse the repository at this point in the history
…ne code having IDs so we can load multiple of one inline code at once (dungeonroute table looking at you).

Fixed default role selection showing up when you wouldn't have permissions to change it anyway.
  • Loading branch information
Wotuu committed Nov 15, 2024
1 parent 18370be commit 8ed0c73
Show file tree
Hide file tree
Showing 20 changed files with 230 additions and 134 deletions.
4 changes: 2 additions & 2 deletions resources/assets/js/custom/inline/base/searchinlinebase.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
class SearchInlineBase extends InlineCode {

constructor(searchHandler, options) {
super(options);
constructor(searchHandler, id, bladePath, options) {
super(id, bladePath, options);

/** @type {SearchHandler} */
this.searchHandler = searchHandler;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
class CommonMapsAdmineditsidebar extends InlineCode {
constructor(options) {
super(options);
constructor(id, bladePath, options) {
super(id, bladePath, options);

this.sidebar = new SidebarNavigation(options);

Expand Down Expand Up @@ -52,4 +52,4 @@ class CommonMapsAdmineditsidebar extends InlineCode {
this.sidebar.cleanup();
getState().unregister('focusedenemy:changed', this);
}
}
}
4 changes: 2 additions & 2 deletions resources/assets/js/custom/inline/common/maps/embedtopbar.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
class CommonMapsEmbedtopbar extends InlineCode {


constructor(options) {
super(options);
constructor(id, bladePath, options) {
super(id, bladePath, options);

this.sidebar = new SidebarNavigation(options);
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
class CommonMapsHeatmapsearchsidebar extends SearchInlineBase {


constructor(options) {
constructor(id, bladePath, options) {
super(new SearchHandlerHeatmap($.extend({}, {
loaderSelector: options.loaderSelector,
}, options)), options);
}, options)), id, bladePath, options);

this.sidebar = new Sidebar(options);

Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
class CommonMapsKillzonessidebar extends InlineCode {


constructor(options) {
super(options);
constructor(id, bladePath, options) {
super(id, bladePath, options);

this.sidebar = new Sidebar(options);
this.pullWorkBench = new PullWorkBench(this);
Expand Down
4 changes: 2 additions & 2 deletions resources/assets/js/custom/inline/common/maps/map.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
class CommonMapsMap extends InlineCode {

constructor(options) {
super(options);
constructor(id, bladePath, options) {
super(id, bladePath, options);
this._dungeonMap = null;

this.settingsTabMap = new SettingsTabMap(options);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
class DungeonrouteDiscoverSearch extends SearchInlineBase {

constructor(options) {
constructor(id, bladePath, options) {
super(new SearchHandlerDungeonRoute(
options.targetContainerSelector,
options.loadMoreSelector,
$.extend({}, {
limit: options.limit,
loaderSelector: options.loaderSelector,
}, options)
), options);
), id, bladePath, options);

this.filters = {
'season': new SearchFilterManualSeason(this._search.bind(this)),
Expand Down
4 changes: 2 additions & 2 deletions resources/assets/js/custom/inline/dungeonroute/edit.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
class DungeonrouteEdit extends InlineCode {

constructor(options) {
super(options);
constructor(id, bladePath, options) {
super(id, bladePath, options);


this.settingsTabRoute = new SettingsTabRoute(options);
Expand Down
27 changes: 13 additions & 14 deletions resources/assets/js/custom/inline/dungeonroute/table.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
class DungeonrouteTable extends InlineCode {

constructor(options) {
super(options);
constructor(id, bladePath, options) {
super(id, bladePath, options);
this._viewMode = 'biglist';
this._dt = null;

Expand Down Expand Up @@ -31,7 +31,7 @@ class DungeonrouteTable extends InlineCode {

let self = this;

$(this.options.filterButtonId).unbind('click').bind('click', function () {
$(this.options.filterButtonSelector).unbind('click').bind('click', function () {
// Build the search parameters
let dungeonId = $(self.options.dungeonSelectId).val();
let affixes = $(self.options.affixSelectId).val();
Expand Down Expand Up @@ -109,8 +109,6 @@ class DungeonrouteTable extends InlineCode {
* Binds a datatables instance to a jquery element.
**/
refreshTable() {
console.warn('refreshtable', this.options.tableSelector);

let self = this;

// Send cookie
Expand Down Expand Up @@ -429,6 +427,7 @@ class DungeonrouteTable extends InlineCode {
actions: {
'title': lang.get('messages.actions_label'),
'render': function (data, type, row, meta) {

let template = Handlebars.templates['dungeonroute_table_profile_actions_template'];

let rowHasAffix = function (row, targetAffix) {
Expand All @@ -447,9 +446,9 @@ class DungeonrouteTable extends InlineCode {
}

// 9 = Shadowlands, 10 = Dragonflight
let seasonId = row.affixes.length === 0 ? false : row.affixes[0].expansion_id;
let isShadowlandsRoute = seasonId === 9;
let isDragonflightRoute = seasonId === 10;
let expansion = row.dungeon.expansion.shortname;
let isShadowlandsRoute = expansion === EXPANSION_SHADOWLANDS;
// let isDragonflightRoute = expansion === EXPANSION_DRAGONFLIGHT;

let rowHasEncryptedAffix = rowHasAffix(row, AFFIX_ENCRYPTED);
let rowHasShroudedAffix = rowHasAffix(row, AFFIX_SHROUDED);
Expand All @@ -467,7 +466,7 @@ class DungeonrouteTable extends InlineCode {
addremoveroute: {
'title': lang.get('messages.actions_label'),
'render': function (data, type, row, meta) {
let result = null;
let result;
if (row.has_team) {
let template = Handlebars.templates['team_dungeonroute_table_route_actions_template'];
result = template($.extend({}, getHandlebarsDefaultVariables(), {public_key: row.public_key}));
Expand Down Expand Up @@ -525,7 +524,7 @@ class DungeonrouteTable extends InlineCode {
success: function (json) {
showSuccessNotification(lang.get('messages.route_published_state_changed'));
// Refresh the table
$(self.options.filterButtonId).trigger('click');
$(self.options.filterButtonSelector).trigger('click');
}
});
}
Expand All @@ -548,7 +547,7 @@ class DungeonrouteTable extends InlineCode {
success: function (json) {
showSuccessNotification(lang.get('messages.route_delete_successful'));
// Refresh the table
$(self.options.filterButtonId).trigger('click');
$(self.options.filterButtonSelector).trigger('click');
}
});
});
Expand Down Expand Up @@ -603,7 +602,7 @@ class DungeonrouteTable extends InlineCode {
success: function (json) {
showSuccessNotification(lang.get('messages.route_clone_successful'));
// Refresh the table
$(self.options.filterButtonId).trigger('click');
$(self.options.filterButtonSelector).trigger('click');
}
});
}, null, {closeWith: ['button']});
Expand Down Expand Up @@ -650,7 +649,7 @@ class DungeonrouteTable extends InlineCode {
success: function (json) {
showSuccessNotification(lang.get('messages.route_migration_successful'));
// Refresh the table
$(self.options.filterButtonId).trigger('click');
$(self.options.filterButtonSelector).trigger('click');
}
});
}, null, {closeWith: ['button']});
Expand Down Expand Up @@ -692,7 +691,7 @@ class DungeonrouteTable extends InlineCode {
$(this.options.tagsSelectId).val(tags);

// Refresh the list of routes
$(this.options.filterButtonId).trigger('click');
$(this.options.filterButtonSelector).trigger('click');
}

/**
Expand Down
6 changes: 4 additions & 2 deletions resources/assets/js/custom/inline/inlinecode.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
class InlineCode {


constructor(options) {
constructor(id, bladePath, options) {
this.id = id;
this.bladePath = bladePath;
this.options = options;

this._activated = false;
Expand All @@ -28,4 +30,4 @@ class InlineCode {
cleanup() {

}
}
}
Loading

0 comments on commit 8ed0c73

Please sign in to comment.