FIX: don’t break browser history on dashboard visit (#6186)

This commit is contained in:
Joffrey JAFFEUX 2018-07-26 14:59:28 -04:00 committed by GitHub
parent a74024b1c9
commit 330cf78c83
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
10 changed files with 16 additions and 24 deletions

View File

@ -2,8 +2,6 @@ import computed from "ember-addons/ember-computed-decorators";
import PeriodComputationMixin from "admin/mixins/period-computation";
export default Ember.Controller.extend(PeriodComputationMixin, {
exceptionController: Ember.inject.controller("exception"),
@computed
flagsStatusOptions() {
return {

View File

@ -6,7 +6,7 @@ const AdminDashboardNext = Discourse.Model.extend({});
AdminDashboardNext.reopenClass({
fetch() {
return ajax("/admin/dashboard-next.json").then(json => {
return ajax("/admin/dashboard.json").then(json => {
const model = AdminDashboardNext.create();
model.set("version_check", json.version_check);
return model;

View File

@ -5,19 +5,5 @@ export default Discourse.Route.extend({
this.controllerFor("admin-dashboard-next").fetchProblems();
this.controllerFor("admin-dashboard-next").fetchDashboard();
scrollTop();
},
afterModel(model, transition) {
if (transition.targetName === "admin.dashboardNext.index") {
this.transitionTo("admin.dashboardNext.general");
}
},
actions: {
willTransition(transition) {
if (transition.targetName === "admin.dashboardNext.index") {
this.transitionTo("admin.dashboardNext.general");
}
}
}
});

View File

@ -3,8 +3,11 @@ export default function() {
this.route("dashboard", { path: "/dashboard-old" });
this.route("dashboardNext", { path: "/" }, function() {
this.route("general", { path: "/dashboard/general" });
this.route("moderation", { path: "/dashboard/moderation" });
this.route("general", { path: "/" });
this.route("admin.dashboardNextModeration", {
path: "/dashboard/moderation",
resetNamespace: true
});
});
this.route(

View File

@ -17,7 +17,7 @@
{{/link-to}}
</li>
<li class="navigation-item moderation">
{{#link-to "admin.dashboardNext.moderation" class="navigation-link"}}
{{#link-to "admin.dashboardNextModeration" class="navigation-link"}}
{{i18n "admin.dashboard.moderation_tab"}}
{{/link-to}}
</li>

View File

@ -31,7 +31,7 @@
border-bottom: 10px solid $secondary;
}
&.moderation .navigation-item.moderation {
&.dashboard-next-moderation .navigation-item.moderation {
@include active-navigation-item;
}

View File

@ -11,6 +11,9 @@ class Admin::DashboardNextController < Admin::AdminController
render json: data
end
def moderation
end
def general
data = AdminDashboardNextGeneralData.fetch_cached_stats

View File

@ -236,9 +236,11 @@ Discourse::Application.routes.draw do
get "version_check" => "versions#show"
get "dashboard-next" => "dashboard_next#index"
get "dashboard-old" => "dashboard#index"
get "dashboard" => "dashboard_next#index"
get "dashboard/general" => "dashboard_next#general"
get "dashboard/moderation" => "dashboard_next#moderation"
get "dashboard-old" => "dashboard#index"
resources :dashboard, only: [:index] do
collection do

View File

@ -1,5 +1,5 @@
export default {
"/admin/dashboard-next.json": {
"/admin/dashboard.json": {
updated_at: "2018-04-25T08:06:11.292Z"
}
};