[Trunk | Admin]: div-help-contents.component & page-help-contents.component: Search by keyword in content and class name or page name accordingly | Add regexp missing in page-help-contents.
git-svn-id: https://svn.driver.research-infrastructures.eu/driver/dnet40/modules/uoa-admin-portal/trunk@56786 d315682c-612b-4755-9ff5-7f18f6832af3
This commit is contained in:
parent
4098e68852
commit
f707d6f00e
|
@ -32,7 +32,7 @@
|
|||
<form target="BSFormPanel_Admin_1" class="search">
|
||||
<!-- <input #inputstring (keyup.enter)="filterBySearch(inputstring.value)" placeholder="Class Help text..." type="text" class="uk-input uk-width-medium"/>
|
||||
<button class="uk-button" type="submit">Search</button> -->
|
||||
<input type="text" class="uk-input uk-width-medium" placeholder="Class Help text..." aria-describedby="sizing-addon2" [(ngModel)]="keyword" name="keyword" >
|
||||
<input type="text" class="uk-input uk-width-medium" placeholder="Class name, content..." aria-describedby="sizing-addon2" [(ngModel)]="keyword" name="keyword" >
|
||||
<button (click)="filterBySearch(keyword)" type="submit" class=" uk-button">
|
||||
<span class="uk-icon">
|
||||
<svg width="20" height="20" viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg" icon="search" ratio="1"><circle fill="none" stroke="#000" stroke-width="1.1" cx="9" cy="9" r="7"></circle><path fill="none" stroke="#000" stroke-width="1.1" d="M14,14 L18,18 L14,14 Z"></path></svg>
|
||||
|
|
|
@ -288,7 +288,8 @@ export class DivHelpContentsComponent implements OnInit {
|
|||
|
||||
let idFlag = filters.id == '' || /*(<Page[]>divId.pages)._id == filters.id*/ pageIds.includes(filters.id);
|
||||
let activeFlag = filters.active == null || divHelpContent.isActive == filters.active;
|
||||
let textFlag = filters.text.toString() == '' || (divHelpContent.content).match(filters.text) != null;
|
||||
let textFlag = filters.text.toString() == '' || (divHelpContent.content).match(filters.text) != null
|
||||
|| ((<DivId>divHelpContent.divId).name).match(filters.text) != null;
|
||||
return idFlag && activeFlag && textFlag;
|
||||
}
|
||||
|
||||
|
|
|
@ -30,7 +30,7 @@
|
|||
<form target="BSFormPanel_Admin_1" class="search">
|
||||
<!-- <input #inputstring (keyup.enter)="filterBySearch(inputstring.value)" placeholder="Page Help Text..." type="text" class="uk-input uk-width-medium"/>
|
||||
<button class="uk-button" type="submit">Search</button> -->
|
||||
<input type="text" class="uk-input uk-width-medium" placeholder="Page name..." aria-describedby="sizing-addon2" [(ngModel)]="keyword" name="keyword" >
|
||||
<input type="text" class="uk-input uk-width-medium" placeholder="Page name, content..." aria-describedby="sizing-addon2" [(ngModel)]="keyword" name="keyword" >
|
||||
<button (click)="filterBySearch(keyword)" type="submit" class=" uk-button">
|
||||
<span class="uk-icon">
|
||||
<svg width="20" height="20" viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg" icon="search" ratio="1"><circle fill="none" stroke="#000" stroke-width="1.1" cx="9" cy="9" r="7"></circle><path fill="none" stroke="#000" stroke-width="1.1" d="M14,14 L18,18 L14,14 Z"></path></svg>
|
||||
|
|
|
@ -295,16 +295,17 @@ export class PageHelpContentsComponent implements OnInit {
|
|||
|
||||
|
||||
public filterPageHelpContent(pageHelpContent : PageHelpContent, filters : PageHelpContentFilterOptions) : boolean {
|
||||
let idFlag = filters.id == '' || (<Page>pageHelpContent.page)._id == filters.id;
|
||||
let activeFlag = filters.active == null || pageHelpContent.isActive == filters.active;
|
||||
let textFlag = filters.text.toString() == '' || (pageHelpContent.content).match(filters.text) != null;
|
||||
return idFlag && activeFlag && textFlag;
|
||||
let idFlag = filters.id == '' || (<Page>pageHelpContent.page)._id == filters.id;
|
||||
let activeFlag = filters.active == null || pageHelpContent.isActive == filters.active;
|
||||
let textFlag = filters.text.toString() == '' || (pageHelpContent.content).match(filters.text) != null
|
||||
|| ((<Page>pageHelpContent.page).name).match(filters.text) != null;
|
||||
return idFlag && activeFlag && textFlag;
|
||||
}
|
||||
|
||||
public cutContent(pageHelpContent: PageHelpContent) {
|
||||
pageHelpContent.content = pageHelpContent.content.replace(/<[^>]*>/g, '');
|
||||
pageHelpContent.content = pageHelpContent.content.replace(/(\r\n|\n|\r| +(?= ))/gm," ");
|
||||
console.info(pageHelpContent.content.length, pageHelpContent.content);
|
||||
pageHelpContent.content = pageHelpContent.content.replace(/(\r\n|\n|\r| +(?= ))|\s\s+/gm," ");
|
||||
|
||||
if(pageHelpContent.content.length > 200) {
|
||||
pageHelpContent.content = pageHelpContent.content.substr(0, 200) + "...";
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue