mirror of
https://github.com/discourse/discourse.git
synced 2025-04-02 04:55:54 +08:00
FIX: don’t break browser history on dashboard visit (#6186)
This commit is contained in:
parent
a74024b1c9
commit
330cf78c83
@ -2,8 +2,6 @@ import computed from "ember-addons/ember-computed-decorators";
|
|||||||
import PeriodComputationMixin from "admin/mixins/period-computation";
|
import PeriodComputationMixin from "admin/mixins/period-computation";
|
||||||
|
|
||||||
export default Ember.Controller.extend(PeriodComputationMixin, {
|
export default Ember.Controller.extend(PeriodComputationMixin, {
|
||||||
exceptionController: Ember.inject.controller("exception"),
|
|
||||||
|
|
||||||
@computed
|
@computed
|
||||||
flagsStatusOptions() {
|
flagsStatusOptions() {
|
||||||
return {
|
return {
|
||||||
|
@ -6,7 +6,7 @@ const AdminDashboardNext = Discourse.Model.extend({});
|
|||||||
|
|
||||||
AdminDashboardNext.reopenClass({
|
AdminDashboardNext.reopenClass({
|
||||||
fetch() {
|
fetch() {
|
||||||
return ajax("/admin/dashboard-next.json").then(json => {
|
return ajax("/admin/dashboard.json").then(json => {
|
||||||
const model = AdminDashboardNext.create();
|
const model = AdminDashboardNext.create();
|
||||||
model.set("version_check", json.version_check);
|
model.set("version_check", json.version_check);
|
||||||
return model;
|
return model;
|
||||||
|
@ -5,19 +5,5 @@ export default Discourse.Route.extend({
|
|||||||
this.controllerFor("admin-dashboard-next").fetchProblems();
|
this.controllerFor("admin-dashboard-next").fetchProblems();
|
||||||
this.controllerFor("admin-dashboard-next").fetchDashboard();
|
this.controllerFor("admin-dashboard-next").fetchDashboard();
|
||||||
scrollTop();
|
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");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
@ -3,8 +3,11 @@ export default function() {
|
|||||||
this.route("dashboard", { path: "/dashboard-old" });
|
this.route("dashboard", { path: "/dashboard-old" });
|
||||||
|
|
||||||
this.route("dashboardNext", { path: "/" }, function() {
|
this.route("dashboardNext", { path: "/" }, function() {
|
||||||
this.route("general", { path: "/dashboard/general" });
|
this.route("general", { path: "/" });
|
||||||
this.route("moderation", { path: "/dashboard/moderation" });
|
this.route("admin.dashboardNextModeration", {
|
||||||
|
path: "/dashboard/moderation",
|
||||||
|
resetNamespace: true
|
||||||
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
this.route(
|
this.route(
|
||||||
|
@ -17,7 +17,7 @@
|
|||||||
{{/link-to}}
|
{{/link-to}}
|
||||||
</li>
|
</li>
|
||||||
<li class="navigation-item moderation">
|
<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"}}
|
{{i18n "admin.dashboard.moderation_tab"}}
|
||||||
{{/link-to}}
|
{{/link-to}}
|
||||||
</li>
|
</li>
|
||||||
|
@ -31,7 +31,7 @@
|
|||||||
border-bottom: 10px solid $secondary;
|
border-bottom: 10px solid $secondary;
|
||||||
}
|
}
|
||||||
|
|
||||||
&.moderation .navigation-item.moderation {
|
&.dashboard-next-moderation .navigation-item.moderation {
|
||||||
@include active-navigation-item;
|
@include active-navigation-item;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -11,6 +11,9 @@ class Admin::DashboardNextController < Admin::AdminController
|
|||||||
render json: data
|
render json: data
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def moderation
|
||||||
|
end
|
||||||
|
|
||||||
def general
|
def general
|
||||||
data = AdminDashboardNextGeneralData.fetch_cached_stats
|
data = AdminDashboardNextGeneralData.fetch_cached_stats
|
||||||
|
|
||||||
|
@ -236,9 +236,11 @@ Discourse::Application.routes.draw do
|
|||||||
|
|
||||||
get "version_check" => "versions#show"
|
get "version_check" => "versions#show"
|
||||||
|
|
||||||
get "dashboard-next" => "dashboard_next#index"
|
get "dashboard" => "dashboard_next#index"
|
||||||
get "dashboard-old" => "dashboard#index"
|
|
||||||
get "dashboard/general" => "dashboard_next#general"
|
get "dashboard/general" => "dashboard_next#general"
|
||||||
|
get "dashboard/moderation" => "dashboard_next#moderation"
|
||||||
|
|
||||||
|
get "dashboard-old" => "dashboard#index"
|
||||||
|
|
||||||
resources :dashboard, only: [:index] do
|
resources :dashboard, only: [:index] do
|
||||||
collection do
|
collection do
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
export default {
|
export default {
|
||||||
"/admin/dashboard-next.json": {
|
"/admin/dashboard.json": {
|
||||||
updated_at: "2018-04-25T08:06:11.292Z"
|
updated_at: "2018-04-25T08:06:11.292Z"
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
Loading…
x
Reference in New Issue
Block a user