Ignore:
Timestamp:
07/06/16 15:00:37 (8 years ago)
Author:
Leif-Jöran
Message:

Added fully visible but unstyled ADV view. Very similar to the spreadsheet export. Updated some of the paragraphs on the help page. Preparing for new version number.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • SRUAggregator/trunk/src/main/resources/assets/js/search.jsx

    r7026 r7034  
    467467                        hits: this.nohits,
    468468                        searchId: null,
     469                        displayADV: layerId == "fcs" ? true : false,
    469470                        corpora: this.state.corpora, // === this.state.corpora.update();
    470471                });
     
    501502                                                               langCode === null;
    502503                                                }),
     504                                        advancedLayers: noLangFiltering ? corpusHit.advancedLayers :
     505                                                corpusHit.advancedLayers.filter(function(layer) {
     506                                                        return layer.language === langCode ||
     507                                                               langCode === multipleLanguageCode ||
     508                                                               langCode === null;
     509                                                }),
    503510                                };
    504511                        });
     
    784791                return {
    785792                        displayKwic: false,
     793                        displayADV: false,
    786794                };
    787795        },
     
    789797        toggleKwic: function() {
    790798                this.setState({displayKwic:!this.state.displayKwic});
     799        },
     800
     801        toggleADV: function() {
     802                this.setState({displayADV:!this.state.displayADV});
    791803        },
    792804
     
    824836        },
    825837
    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>;
    836852        },
    837853
     
    866882
    867883        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            }
    884909        },
    885910
     
    898923
    899924        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                                                 &nbsp;
    907                                                 Display as AdvancedDataView
    908                                         </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                                                &nbsp;
     932                                                Display as AdvancedDataView (ADV)
     933                                        </label>
     934                                </div>;
    910935        },
    911936
     
    10411066                                                        <div className="float-right">
    10421067                                                                <div>
    1043                                                                         { this.renderDisplayKWIC() }
     1068                                                                        {this.renderDisplayKWIC()}
     1069                                                                        {this.renderDisplayADV()}
    10441070                                                                        <div className="inline"> {this.renderDownloadLinks(corpusHit.corpus.id)} </div>
    10451071                                                                        <div className="inline"> {this.renderToWeblichtLinks(corpus.id, forceLanguage, wlerror)} </div>
     
    11361162                                                                <div className="float-right">
    11371163                                                                        <div>
    1138                                                                                 { this.renderDisplayKWIC() }
     1164                                                                                {this.renderDisplayKWIC()}
     1165                                                                                {this.renderDisplayADV()}
    11391166                                                                                { collhits.inProgress === 0 ?
    11401167                                                                                        <div className="inline"> {this.renderDownloadLinks()} </div>
Note: See TracChangeset for help on using the changeset viewer.