mirror of
https://github.com/discourse/discourse.git
synced 2025-02-25 18:55:32 -06:00
FEATURE: Highlight None option by default for bookmarks (#16949)
Since the default for the bookmark modal is to have no reminder if you create a bookmark by clicking out of the modal or pressing the Save button, this commit highlights None by default. Also changes the bookmark component to not use @on for Ember lifecycle, we don't use that style
This commit is contained in:
parent
6ad6e1223d
commit
662c713347
@ -12,7 +12,7 @@ import {
|
|||||||
import { action } from "@ember/object";
|
import { action } from "@ember/object";
|
||||||
import { ajax } from "discourse/lib/ajax";
|
import { ajax } from "discourse/lib/ajax";
|
||||||
import bootbox from "bootbox";
|
import bootbox from "bootbox";
|
||||||
import discourseComputed, { bind, on } from "discourse-common/utils/decorators";
|
import discourseComputed, { bind } from "discourse-common/utils/decorators";
|
||||||
import { formattedReminderTime } from "discourse/lib/bookmark";
|
import { formattedReminderTime } from "discourse/lib/bookmark";
|
||||||
import { and, notEmpty } from "@ember/object/computed";
|
import { and, notEmpty } from "@ember/object/computed";
|
||||||
import { popupAjaxError } from "discourse/lib/ajax-error";
|
import { popupAjaxError } from "discourse/lib/ajax-error";
|
||||||
@ -42,8 +42,9 @@ export default Component.extend({
|
|||||||
model: null,
|
model: null,
|
||||||
afterSave: null,
|
afterSave: null,
|
||||||
|
|
||||||
@on("init")
|
init() {
|
||||||
_setup() {
|
this._super(...arguments);
|
||||||
|
|
||||||
this.setProperties({
|
this.setProperties({
|
||||||
errorMessage: null,
|
errorMessage: null,
|
||||||
selectedReminderType: TIME_SHORTCUT_TYPES.NONE,
|
selectedReminderType: TIME_SHORTCUT_TYPES.NONE,
|
||||||
@ -71,8 +72,9 @@ export default Component.extend({
|
|||||||
this._loadPostLocalDates();
|
this._loadPostLocalDates();
|
||||||
},
|
},
|
||||||
|
|
||||||
@on("didInsertElement")
|
didInsertElement() {
|
||||||
_prepareUI() {
|
this._super(...arguments);
|
||||||
|
|
||||||
later(() => {
|
later(() => {
|
||||||
if (this.site.isMobileDevice) {
|
if (this.site.isMobileDevice) {
|
||||||
document.getElementById("bookmark-name").blur();
|
document.getElementById("bookmark-name").blur();
|
||||||
@ -83,6 +85,8 @@ export default Component.extend({
|
|||||||
// knows they have set these options previously.
|
// knows they have set these options previously.
|
||||||
if (this.model.id) {
|
if (this.model.id) {
|
||||||
this.set("showOptions", true);
|
this.set("showOptions", true);
|
||||||
|
} else {
|
||||||
|
document.getElementById("tap_tile_none").classList.add("active");
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
|
@ -111,6 +111,10 @@ acceptance("Bookmarking", function (needs) {
|
|||||||
exists("#bookmark-reminder-modal"),
|
exists("#bookmark-reminder-modal"),
|
||||||
"it shows the bookmark modal"
|
"it shows the bookmark modal"
|
||||||
);
|
);
|
||||||
|
assert.ok(
|
||||||
|
exists("#tap_tile_none.active"),
|
||||||
|
"it highlights the None option by default"
|
||||||
|
);
|
||||||
});
|
});
|
||||||
|
|
||||||
test("Bookmarks modal selecting reminder type", async function (assert) {
|
test("Bookmarks modal selecting reminder type", async function (assert) {
|
||||||
|
Loading…
Reference in New Issue
Block a user