-
Notifications
You must be signed in to change notification settings - Fork 11
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
DEV: Update modal to Component API (#20)
- update modal to component API - add updated linting rules <img width="701" alt="Screenshot 2023-12-12 at 2 49 13 PM" src="https://github.com/discourse/discourse-jitsi/assets/50783505/7fca0d4a-5579-412a-844c-9b6c4bf1e0e5">
- Loading branch information
1 parent
6b85701
commit 9808dc0
Showing
11 changed files
with
1,216 additions
and
745 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
module.exports = require("@discourse/lint-configs/eslint"); |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
module.exports = require("@discourse/lint-configs/prettier"); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1 @@ | ||
module.exports = { | ||
plugins: ["ember-template-lint-plugin-discourse"], | ||
extends: "discourse:recommended", | ||
}; | ||
module.exports = require("@discourse/lint-configs/template-lint"); |
40 changes: 0 additions & 40 deletions
40
javascripts/discourse-insert-jitsi/controllers/insert-jitsi.js
This file was deleted.
Oops, something went wrong.
102 changes: 102 additions & 0 deletions
102
javascripts/discourse/components/modal/insert-jitsi.gjs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,102 @@ | ||
import Component from "@glimmer/component"; | ||
import { tracked } from "@glimmer/tracking"; | ||
import { Input } from "@ember/component"; | ||
import { action } from "@ember/object"; | ||
import DButton from "discourse/components/d-button"; | ||
import DModal from "discourse/components/d-modal"; | ||
import TextField from "discourse/components/text-field"; | ||
import themePrefix from "discourse/helpers/theme-prefix"; | ||
import i18n from "discourse-common/helpers/i18n"; | ||
|
||
export default class InsertJitsi extends Component { | ||
@tracked mobileIframe = true; | ||
@tracked desktopIframe = true; | ||
@tracked jitsiRoom = ""; | ||
@tracked buttonText = ""; | ||
|
||
keyDown(e) { | ||
if (e.keyCode === 13) { | ||
e.preventDefault(); | ||
e.stopPropagation(); | ||
return false; | ||
} | ||
} | ||
|
||
randomID() { | ||
return Math.random().toString(36).slice(-8); | ||
} | ||
|
||
@action | ||
insert() { | ||
const btnTxt = this.buttonText ? ` label="${this.buttonText}"` : ""; | ||
const roomID = this.jitsiRoom || this.randomID(); | ||
const text = `[wrap=discourse-jitsi room="${roomID}"${btnTxt} mobileIframe="${this.mobileIframe}" desktopIframe="${this.desktopIframe}"][/wrap]`; | ||
this.args.model.toolbarEvent.addText(text); | ||
|
||
this.args.closeModal(); | ||
} | ||
|
||
@action | ||
cancel() { | ||
this.args.closeModal(); | ||
} | ||
|
||
<template> | ||
<DModal | ||
@title={{i18n (themePrefix "modal.title")}} | ||
class="insert-jitsi" | ||
@closeModal={{@closeModal}} | ||
> | ||
<:body> | ||
<div class="insert-jitsi-form"> | ||
<div class="insert-jitsi-input"> | ||
<label> | ||
{{i18n (themePrefix "room_label")}} | ||
</label> | ||
<TextField | ||
@value={{this.jitsiRoom}} | ||
@autofocus="autofocus" | ||
@autocomplete="off" | ||
/> | ||
<div class="desc">{{i18n | ||
(themePrefix "modal.room_field_description") | ||
}}</div> | ||
</div> | ||
|
||
<div class="insert-jitsi-input"> | ||
<label> | ||
{{i18n (themePrefix "button_text_label")}} | ||
</label> | ||
<TextField | ||
@value={{this.buttonText}} | ||
@placeholderKey={{themePrefix "launch_jitsi"}} | ||
/> | ||
</div> | ||
|
||
<div class="insert-jitsi-input"> | ||
<label class="checkbox-label"> | ||
<Input @type="checkbox" @checked={{this.mobileIframe}} /> | ||
{{i18n (themePrefix "modal.mobile_iframe")}} | ||
</label> | ||
</div> | ||
|
||
<div class="insert-bbb-input"> | ||
<label class="checkbox-label"> | ||
<Input @type="checkbox" @checked={{this.desktopIframe}} /> | ||
{{i18n (themePrefix "modal.desktop_iframe")}} | ||
</label> | ||
</div> | ||
</div> | ||
|
||
</:body> | ||
<:footer> | ||
<DButton | ||
class="btn-primary" | ||
@disabled={{this.insertDisabled}} | ||
@label={{themePrefix "modal.insert"}} | ||
@action={{this.insert}} | ||
/> | ||
</:footer> | ||
</DModal> | ||
</template> | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.