mirror of
https://github.com/LemmyNet/lemmy.git
synced 2024-11-10 10:08:58 +00:00
Add community refine by searching on new post creation. Fixes #521
This commit is contained in:
parent
774518e4fe
commit
0b69974e49
6
ui/assets/css/main.css
vendored
6
ui/assets/css/main.css
vendored
|
@ -181,3 +181,9 @@ hr {
|
|||
-webkit-transform: scale(1.2);
|
||||
-ms-transform: scale(1.2);
|
||||
}
|
||||
|
||||
.selectr-selected, .selectr-options-container {
|
||||
background-color: var(--secondary);
|
||||
color: var(--white);
|
||||
border: unset;
|
||||
}
|
||||
|
|
7
ui/assets/css/selectr.min.css
vendored
Normal file
7
ui/assets/css/selectr.min.css
vendored
Normal file
File diff suppressed because one or more lines are too long
1
ui/package.json
vendored
1
ui/package.json
vendored
|
@ -33,6 +33,7 @@
|
|||
"markdown-it": "^10.0.0",
|
||||
"markdown-it-container": "^2.0.0",
|
||||
"markdown-it-emoji": "^1.4.0",
|
||||
"mobius1-selectr": "^2.4.13",
|
||||
"moment": "^2.24.0",
|
||||
"prettier": "^1.18.2",
|
||||
"reconnecting-websocket": "^4.4.0",
|
||||
|
|
8
ui/src/components/post-form.tsx
vendored
8
ui/src/components/post-form.tsx
vendored
|
@ -35,6 +35,7 @@ import {
|
|||
} from '../utils';
|
||||
import autosize from 'autosize';
|
||||
import Tribute from 'tributejs/src/Tribute.js';
|
||||
import Selectr from 'mobius1-selectr';
|
||||
import { i18n } from '../i18next';
|
||||
|
||||
const MAX_POST_TITLE_LENGTH = 200;
|
||||
|
@ -514,6 +515,13 @@ export class PostForm extends Component<PostFormProps, PostFormState> {
|
|||
this.state.postForm.community_id = data.communities[0].id;
|
||||
}
|
||||
this.setState(this.state);
|
||||
|
||||
// Set up select searching
|
||||
let selectId: any = document.getElementById('post-community');
|
||||
let selector = new Selectr(selectId, {});
|
||||
selector.on('selectr.select', option => {
|
||||
this.state.postForm.community_id = Number(option.value);
|
||||
});
|
||||
} else if (res.op == UserOperation.CreatePost) {
|
||||
let data = res.data as PostResponse;
|
||||
if (data.post.creator_id == UserService.Instance.user.id) {
|
||||
|
|
1
ui/src/index.html
vendored
1
ui/src/index.html
vendored
|
@ -13,6 +13,7 @@
|
|||
<!-- Styles -->
|
||||
<link rel="stylesheet" type="text/css" href="/static/assets/css/tribute.css" />
|
||||
<link rel="stylesheet" type="text/css" href="/static/assets/css/toastify.css" />
|
||||
<link rel="stylesheet" type="text/css" href="/static/assets/css/selectr.min.css" />
|
||||
<link rel="stylesheet" type="text/css" href="/static/assets/css/themes/darkly.min.css" id="darkly" />
|
||||
<link rel="stylesheet" type="text/css" href="/static/assets/css/main.css" />
|
||||
|
||||
|
|
5
ui/yarn.lock
vendored
5
ui/yarn.lock
vendored
|
@ -3076,6 +3076,11 @@ mkdirp@^0.5.1:
|
|||
dependencies:
|
||||
minimist "0.0.8"
|
||||
|
||||
mobius1-selectr@^2.4.13:
|
||||
version "2.4.13"
|
||||
resolved "https://registry.yarnpkg.com/mobius1-selectr/-/mobius1-selectr-2.4.13.tgz#0019dfd9f984840d6e40f70683ab3ec78ce3b5df"
|
||||
integrity sha512-Mk9qDrvU44UUL0EBhbAA1phfQZ7aMZPjwtL7wkpiBzGh8dETGqfsh50mWoX9EkjDlkONlErWXArHCKfoxVg0Bw==
|
||||
|
||||
moment@^2.24.0:
|
||||
version "2.24.0"
|
||||
resolved "https://registry.yarnpkg.com/moment/-/moment-2.24.0.tgz#0d055d53f5052aa653c9f6eb68bb5d12bf5c2b5b"
|
||||
|
|
Loading…
Reference in a new issue