Skip to content

Commit

Permalink
Merge pull request #35084 from dimagi/rc/remove-dead-LandingPageAppView
Browse files Browse the repository at this point in the history
kill LandingPageAppView (dead code)
  • Loading branch information
Robert-Costello authored Sep 9, 2024
2 parents b579d29 + 2ecc3b3 commit 08b8bc9
Show file tree
Hide file tree
Showing 8 changed files with 1 addition and 83 deletions.
5 changes: 1 addition & 4 deletions corehq/apps/cloudcare/static/cloudcare/js/formplayer/app.js
Original file line number Diff line number Diff line change
Expand Up @@ -337,17 +337,14 @@ hqDefine("cloudcare/js/formplayer/app", [
if (Backbone.history) {
Backbone.history.start();
FormplayerFrontend.showRestoreAs(user);
if (user.displayOptions.singleAppMode || user.displayOptions.landingPageAppMode) {
if (user.displayOptions.singleAppMode) {
appId = apps[0]['_id'];
}

if (self.getCurrentRoute() === "") {
if (user.displayOptions.singleAppMode) {
FormplayerFrontend.trigger('setAppDisplayProperties', apps[0]);
FormplayerFrontend.trigger("app:singleApp", appId);
} else if (user.displayOptions.landingPageAppMode) {
FormplayerFrontend.trigger('setAppDisplayProperties', apps[0]);
FormplayerFrontend.trigger("app:landingPageApp", appId);
} else {
FormplayerFrontend.trigger("apps:list", apps);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,14 +45,6 @@ hqDefine("cloudcare/js/formplayer/apps/controller", [
FormplayerFrontend.regions.getRegion('main').show(singleAppView);
});
},
landingPageApp: function (appId) {
$.when(AppsAPI.getAppEntities()).done(function () {
var landingPageAppView = views.LandingPageAppView({
appId: appId,
});
FormplayerFrontend.regions.getRegion('main').show(landingPageAppView);
});
},
listSettings: function () {
var currentUser = UsersModels.getCurrentUser(),
slugs = settingsViews.slugs,
Expand Down
42 changes: 0 additions & 42 deletions corehq/apps/cloudcare/static/cloudcare/js/formplayer/apps/views.js
Original file line number Diff line number Diff line change
Expand Up @@ -182,54 +182,12 @@ hqDefine("cloudcare/js/formplayer/apps/views", [
},
});

var LandingPageAppView = Marionette.View.extend({
template: _.template($("#landing-page-app-template").html() || ""),
className: 'landing-page-app-view',

events: _.extend({
'click .js-start-app': 'startApp',
'keydown .js-start-app': 'keyAction',
}, BaseAppView.events),
incompleteSessionsClick: _.extend(BaseAppView.incompleteSessionsClick),
syncClick: _.extend(BaseAppView.syncClick),
onClickRestoreAs: _.extend(BaseAppView.onClickRestoreAs),
onClickSettings: _.extend(BaseAppView.onClickSettings),
incompleteSessionsKeyAction: _.extend(BaseAppView.incompleteSessionsKeyAction),
syncKeyAction: _.extend(BaseAppView.syncKeyAction),
restoreAsKeyAction: _.extend(BaseAppView.restoreAsKeyAction),
settingsKeyAction: _.extend(BaseAppView.settingsKeyAction),

initialize: function (options) {
this.appId = options.appId;
},
templateContext: function () {
var currentApp = AppsAPI.getAppEntity(this.appId),
appName = currentApp.get('name'),
imageUri = currentApp.get('imageUri');
return {
appName: appName,
imageUrl: imageUri && this.appId ? FormplayerFrontend.getChannel().request('resourceMap', imageUri, this.appId) : "",
};
},
startApp: function () {
FormplayerFrontend.trigger("app:select", this.appId);
},
keyAction: function (e) {
if (e.keyCode === 13) {
this.startApp();
}
},
});

return {
GridView: function (options) {
return new GridView(options);
},
SingleAppView: function (options) {
return new SingleAppView(options);
},
LandingPageAppView: function (options) {
return new LandingPageAppView(options);
},
};
});
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,6 @@ hqDefine("cloudcare/js/formplayer/router", [
appRoutes: {
"apps": "listApps", // list all apps available to this user
"single_app/:id": "singleApp", // Show app in phone mode (SingleAppView)
"home/:id": "landingPageApp", // Show app in landing page mode (LandingPageAppView)
"sessions": "listSessions", //list all this user's current sessions (incomplete forms)
"sessions/:id": "getSession",
"restore_as/:page/:query": "listUsers",
Expand All @@ -59,9 +58,6 @@ hqDefine("cloudcare/js/formplayer/router", [
user.previewAppId = appId;
appsController.singleApp(appId);
},
landingPageApp: function (appId) {
appsController.landingPageApp(appId);
},
selectApp: function (appId, isInitial) {
menusController.selectMenu({
'appId': appId,
Expand Down Expand Up @@ -165,11 +161,6 @@ hqDefine("cloudcare/js/formplayer/router", [
API.singleApp(appId);
});

FormplayerFrontend.on('app:landingPageApp', function (appId) {
utils.navigate("/home/" + appId);
API.landingPageApp(appId);
});

FormplayerFrontend.on("menu:select", function (index) {
var urlObject = utils.currentUrlToObject();
if (index === undefined) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,6 @@ hqDefine("cloudcare/js/formplayer/spec/user_spec", [
assert.deepEqual(user.displayOptions, {
phoneMode: undefined, // we don't store this option
singleAppMode: undefined,
landingPageAppMode: undefined,
oneQuestionPerScreen: true,
language: 'sindarin',
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,6 @@ hqDefine("cloudcare/js/formplayer/users/models", [
);
userInstance.displayOptions = _.defaults(savedDisplayOptions, {
singleAppMode: options.singleAppMode,
landingPageAppMode: options.landingPageAppMode,
phoneMode: options.phoneMode,
oneQuestionPerScreen: options.oneQuestionPerScreen,
language: options.language,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,6 @@
{% include 'cloudcare/partials/form_entry/sub_group.html' %}

{% include 'cloudcare/partials/grid_view/grid.html' %}
{% include 'cloudcare/partials/grid_view/landing_page_app.html' %}
{% include 'cloudcare/partials/grid_view/row.html' %}
{% include 'cloudcare/partials/grid_view/single_app.html' %}

Expand Down

This file was deleted.

0 comments on commit 08b8bc9

Please sign in to comment.