- Timestamp:
- 07/06/16 15:00:37 (8 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
SRUAggregator/trunk/src/main/resources/assets/js/search.jsx
r7026 r7034 467 467 hits: this.nohits, 468 468 searchId: null, 469 displayADV: layerId == "fcs" ? true : false, 469 470 corpora: this.state.corpora, // === this.state.corpora.update(); 470 471 }); … … 501 502 langCode === null; 502 503 }), 504 advancedLayers: noLangFiltering ? corpusHit.advancedLayers : 505 corpusHit.advancedLayers.filter(function(layer) { 506 return layer.language === langCode || 507 langCode === multipleLanguageCode || 508 langCode === null; 509 }), 503 510 }; 504 511 }); … … 784 791 return { 785 792 displayKwic: false, 793 displayADV: false, 786 794 }; 787 795 }, … … 789 797 toggleKwic: function() { 790 798 this.setState({displayKwic:!this.state.displayKwic}); 799 }, 800 801 toggleADV: function() { 802 this.setState({displayADV:!this.state.displayADV}); 791 803 }, 792 804 … … 824 836 }, 825 837 826 renderRowsAsAdv: function(hit,i) { 827 var sleft={textAlign:"left", verticalAlign:"top", width:"50%"}; 828 var scenter={textAlign:"center", verticalAlign:"top", maxWidth:"50%"}; 829 var sright={textAlign:"right", verticalAlign:"top", maxWidth:"50%"}; 830 return <tr key={i} className="hitrow"> 831 <td>{this.renderRowLanguage(hit)}</td> 832 <td style={sright}>{hit.left}</td> 833 <td style={scenter} className="keyword">{hit.keyword}</td> 834 <td style={sleft}>{hit.right}</td> 835 </tr>; 838 renderRowsAsADV: function(hit,i) { 839 var sleft={textAlign:"left", verticalAlign:"top", width:"50%"}; 840 var scenter={textAlign:"center", verticalAlign:"top", maxWidth:"50%"}; 841 var sright={textAlign:"right", verticalAlign:"top", maxWidth:"50%"}; 842 843 function renderSpans(span, idx) { 844 return <td key={idx} className={span.hit?"keyword":""}>{span.text}</td>; 845 } 846 return <tr key={i} className="hitrow"> 847 {this.renderRowLanguage(hit)} 848 <td style={sleft}>{hit.pid}</td> 849 <td style={sleft}>{hit.reference}</td> 850 {hit.spans.map(renderSpans)} 851 </tr>; 836 852 }, 837 853 … … 866 882 867 883 renderPanelBody: function(corpusHit) { 868 var fulllength = {width:"100%"}; 869 if (this.state.displayKwic) { 870 return <div> 871 {this.renderErrors(corpusHit)} 872 {this.renderDiagnostics(corpusHit)} 873 <table className="table table-condensed table-hover" style={fulllength}> 874 <tbody>{corpusHit.kwics.map(this.renderRowsAsKwic)}</tbody> 875 </table> 876 </div>; 877 } else { 878 return <div> 879 {this.renderErrors(corpusHit)} 880 {this.renderDiagnostics(corpusHit)} 881 {corpusHit.kwics.map(this.renderRowsAsHits)} 882 </div>; 883 } 884 var fulllength = {width:"100%"}; 885 886 if (this.state.displayADV) { 887 return <div> 888 {this.renderErrors(corpusHit)} 889 {this.renderDiagnostics(corpusHit)} 890 <table className="table table-condensed table-hover" style={fulllength}> 891 <tbody>{corpusHit.advancedLayers.map(this.renderRowsAsADV)}</tbody> 892 </table> 893 </div>; 894 } else if (this.state.displayKwic) { 895 return <div> 896 {this.renderErrors(corpusHit)} 897 {this.renderDiagnostics(corpusHit)} 898 <table className="table table-condensed table-hover" style={fulllength}> 899 <tbody>{corpusHit.kwics.map(this.renderRowsAsKwic)}</tbody> 900 </table> 901 </div>; 902 } else { 903 return <div> 904 {this.renderErrors(corpusHit)} 905 {this.renderDiagnostics(corpusHit)} 906 {corpusHit.kwics.map(this.renderRowsAsHits)} 907 </div>; 908 } 884 909 }, 885 910 … … 898 923 899 924 renderDisplayADV: function() { 900 return <div className="inline btn-group" style={{display:"inline-block"}}>901 <label forHtml="inputKwic" className="btn btn-flat">902 { this.state.displayKwic?903 <input id="inputKwic" type="checkbox" value="kwic" checked onChange={this.toggleKwic} /> :904 <input id="inputKwic" type="checkbox" value="kwic" onChange={this.toggleKwic} />905 }906 907 Display as AdvancedDataView908 </label>909 </div>;925 return <div className="inline btn-group" style={{display:"inline-block"}}> 926 <label forHtml="inputADV" className="btn btn-flat"> 927 { this.state.displayADV ? 928 <input id="inputADV" type="checkbox" value="adv" checked onChange={this.toggleADV} /> : 929 <input id="inputADV" type="checkbox" value="adv" onChange={this.toggleADV} /> 930 } 931 932 Display as AdvancedDataView (ADV) 933 </label> 934 </div>; 910 935 }, 911 936 … … 1041 1066 <div className="float-right"> 1042 1067 <div> 1043 { this.renderDisplayKWIC() } 1068 {this.renderDisplayKWIC()} 1069 {this.renderDisplayADV()} 1044 1070 <div className="inline"> {this.renderDownloadLinks(corpusHit.corpus.id)} </div> 1045 1071 <div className="inline"> {this.renderToWeblichtLinks(corpus.id, forceLanguage, wlerror)} </div> … … 1136 1162 <div className="float-right"> 1137 1163 <div> 1138 { this.renderDisplayKWIC() } 1164 {this.renderDisplayKWIC()} 1165 {this.renderDisplayADV()} 1139 1166 { collhits.inProgress === 0 ? 1140 1167 <div className="inline"> {this.renderDownloadLinks()} </div>
Note: See TracChangeset
for help on using the changeset viewer.