Changeset 6111 for SRUAggregator


Ignore:
Timestamp:
03/17/15 14:26:34 (9 years ago)
Author:
emanuel.dima@uni-tuebingen.de
Message:
  1. beta-30: embedded page, wip
Location:
SRUAggregator/trunk
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • SRUAggregator/trunk/pom.xml

    r6097 r6111  
    88        <groupId>eu.clarin.sru.fcs</groupId>
    99        <artifactId>Aggregator2</artifactId>
    10         <version>2.0.0-beta-29</version>
     10        <version>2.0.0-beta-30</version>
    1111        <name>FCS Aggregator</name>
    1212
  • SRUAggregator/trunk/src/main/resources/assets/js/main.js

    r6093 r6111  
    33"use strict";
    44
    5 var VERSION = "VERSION 2.0.0-beta-28";
    6 var URLROOT = "/Aggregator-testing";
     5var VERSION = window.MyAggregator.VERSION = "VERSION 2.0.0-beta-30";
     6var URLROOT = window.MyAggregator.URLROOT = "/Aggregator-testing";
    77
    88var PT = React.PropTypes;
     
    7171
    7272        renderAggregator: function() {
    73                 return React.createElement(AggregatorPage, {ajax: this.ajax, corpora: this.state.corpora, languageMap: this.state.languageMap});
     73                return React.createElement(AggregatorPage, {ajax: this.ajax});
    7474        },
    7575
     
    8484        renderStatistics: function() {
    8585                return React.createElement(StatisticsPage, {ajax: this.ajax});
     86        },
     87
     88        renderEmbedded: function() {
     89                return React.createElement(AggregatorPage, {ajax: this.ajax, embedded: true});
    8690        },
    8791
     
    9296                        'about': this.renderAbout,
    9397                        'stats': this.renderStatistics,
     98                        'embed': this.renderEmbedded,
    9499                };
    95100        },
     
    110115        toAbout: function(doPushHistory) { this.gotoPage(doPushHistory, 'about'); },
    111116        toStatistics: function(doPushHistory) { this.gotoPage(doPushHistory, 'stats'); },
     117        toEmbedded: function(doPushHistory) { this.gotoPage(doPushHistory, 'embed'); },
    112118
    113119        renderCollapsible: function() {
     
    132138        },
    133139
    134         render: function() {
     140        renderTop: function() {
     141                if (this.state.navbarPageFn === this.renderEmbedded) {
     142                        return false;
     143                }
    135144                return  (
    136145                        React.createElement("div", null,
     
    156165                                ),
    157166
    158                                 React.createElement(ErrorPane, {errorMessages: this.state.errorMessages}),
     167                                React.createElement(ErrorPane, {errorMessages: this.state.errorMessages})
     168                        )
     169                );
     170        },
     171
     172        render: function() {
     173                return  (
     174                        React.createElement("div", null,
     175                                React.createElement("div", null, " ",  this.renderTop(), " "),
    159176
    160177                                React.createElement("div", {id: "push"},
     
    481498
    482499        render: function() {
     500                var path = window.location.pathname.split('/');
     501                if (path.length === 3 && path[2] === 'embed') {
     502                        return false;
     503                }
    483504                return  (
    484505                        React.createElement("div", {className: "container"},
     
    521542                } else if (p === 'stats') {
    522543                        this.toStatistics(false);
     544                } else if (p === 'embed') {
     545                        this.toEmbedded(false);
    523546                } else {
    524547                        this.toAggregator(false);
  • SRUAggregator/trunk/src/main/resources/assets/js/main.jsx

    r6097 r6111  
    33"use strict";
    44
    5 var VERSION = "VERSION 2.0.0-beta-29";
    6 var URLROOT = "/Aggregator-testing";
     5var VERSION = window.MyAggregator.VERSION = "VERSION 2.0.0-beta-30";
     6var URLROOT = window.MyAggregator.URLROOT = "/Aggregator-testing";
    77
    88var PT = React.PropTypes;
     
    7171
    7272        renderAggregator: function() {
    73                 return <AggregatorPage ajax={this.ajax} corpora={this.state.corpora} languageMap={this.state.languageMap} />;
     73                return <AggregatorPage ajax={this.ajax} />;
    7474        },
    7575
     
    8484        renderStatistics: function() {
    8585                return <StatisticsPage ajax={this.ajax} />;
     86        },
     87
     88        renderEmbedded: function() {
     89                return <AggregatorPage ajax={this.ajax} embedded={true}/>;
    8690        },
    8791
     
    9296                        'about': this.renderAbout,
    9397                        'stats': this.renderStatistics,
     98                        'embed': this.renderEmbedded,
    9499                };
    95100        },
     
    110115        toAbout: function(doPushHistory) { this.gotoPage(doPushHistory, 'about'); },
    111116        toStatistics: function(doPushHistory) { this.gotoPage(doPushHistory, 'stats'); },
     117        toEmbedded: function(doPushHistory) { this.gotoPage(doPushHistory, 'embed'); },
    112118
    113119        renderCollapsible: function() {
     
    132138        },
    133139
    134         render: function() {
     140        renderTop: function() {
     141                if (this.state.navbarPageFn === this.renderEmbedded) {
     142                        return false;
     143                }
    135144                return  (
    136145                        <div>
     
    157166
    158167                                <ErrorPane errorMessages={this.state.errorMessages} />
     168                        </div>
     169                );
     170        },
     171
     172        render: function() {
     173                return  (
     174                        <div>
     175                                <div> { this.renderTop() } </div>
    159176
    160177                                <div id="push">
     
    481498
    482499        render: function() {
     500                var path = window.location.pathname.split('/');
     501                if (path.length === 3 && path[2] === 'embed') {
     502                        return false;
     503                }
    483504                return  (
    484505                        <div className="container">
     
    521542                } else if (p === 'stats') {
    522543                        this.toStatistics(false);
     544                } else if (p === 'embed') {
     545                        this.toEmbedded(false);
    523546                } else {
    524547                        this.toAggregator(false);
  • SRUAggregator/trunk/src/main/resources/assets/js/search.js

    r6097 r6111  
    175175var AggregatorPage = window.MyAggregator.AggregatorPage = React.createClass({displayName: 'AggregatorPage',
    176176        propTypes: {
    177                 ajax: PT.func.isRequired
     177                ajax: PT.func.isRequired,
     178                embedded: PT.bool,
    178179        },
    179180
     
    223224        search: function() {
    224225                var query = this.state.query;
    225                 if (!query) {
     226                if (!query || this.props.embedded) {
    226227                        this.setState({ hits: this.nohits, searchId: null });
    227228                        return;                 
     
    429430        },
    430431
     432        renderSearchButtonOrLink: function() {
     433                if (this.props.embedded) {
     434                        var query = this.state.query;
     435                        var newurl = query ? (window.MyAggregator.URLROOT + "?search=" + query) : "#";
     436                        return (
     437                                React.createElement("a", {className: "btn btn-default input-lg", type: "button", target: "_blank", href: newurl},
     438                                        React.createElement("i", {className: "glyphicon glyphicon-search"})
     439                                )
     440                        );
     441                }
     442                return (
     443                        React.createElement("button", {className: "btn btn-default input-lg", type: "button", onClick: this.search},
     444                                React.createElement("i", {className: "glyphicon glyphicon-search"})
     445                        )
     446                );
     447        },
     448
    431449        render: function() {
    432450                var layer = layerMap[this.state.searchLayerId];
     
    444462                                                                tabIndex: "1", onChange: this.onQuery, onKeyDown: this.handleKey}),
    445463                                                        React.createElement("div", {className: "input-group-btn"},
    446                                                                 React.createElement("button", {className: "btn btn-default input-lg", type: "button", onClick: this.search},
    447                                                                         React.createElement("i", {className: "glyphicon glyphicon-search"})
    448                                                                 )
     464                                                                this.renderSearchButtonOrLink()
    449465                                                        )
    450466                                                )
     
    486502                                                        ),
    487503
     504                                                         this.props.embedded ? false :
    488505                                                        React.createElement("div", {className: "input-group"},
    489506                                                                React.createElement("span", {className: "input-group-addon nobkg"}, "in"),
     
    491508                                                                        this.state.corpora.getSelectedMessage(), " ", React.createElement("span", {className: "caret"})
    492509                                                                )
    493                                                         ),                                                     
    494 
     510                                                        ),
     511
     512                                                         this.props.embedded ? false :
    495513                                                        React.createElement("div", {className: "input-group"},
    496514                                                                React.createElement("span", {className: "input-group-addon nobkg"}, "and show up to"),
  • SRUAggregator/trunk/src/main/resources/assets/js/search.jsx

    r6097 r6111  
    175175var AggregatorPage = window.MyAggregator.AggregatorPage = React.createClass({
    176176        propTypes: {
    177                 ajax: PT.func.isRequired
     177                ajax: PT.func.isRequired,
     178                embedded: PT.bool,
    178179        },
    179180
     
    223224        search: function() {
    224225                var query = this.state.query;
    225                 if (!query) {
     226                if (!query || this.props.embedded) {
    226227                        this.setState({ hits: this.nohits, searchId: null });
    227228                        return;                 
     
    429430        },
    430431
     432        renderSearchButtonOrLink: function() {
     433                if (this.props.embedded) {
     434                        var query = this.state.query;
     435                        var newurl = query ? (window.MyAggregator.URLROOT + "?search=" + query) : "#";
     436                        return (
     437                                <a className="btn btn-default input-lg" type="button" target="_blank" href={newurl}>
     438                                        <i className="glyphicon glyphicon-search"></i>
     439                                </a>
     440                        );
     441                }
     442                return (
     443                        <button className="btn btn-default input-lg" type="button" onClick={this.search}>
     444                                <i className="glyphicon glyphicon-search"></i>
     445                        </button>
     446                );
     447        },
     448
    431449        render: function() {
    432450                var layer = layerMap[this.state.searchLayerId];
     
    444462                                                                tabIndex="1" onChange={this.onQuery} onKeyDown={this.handleKey} />
    445463                                                        <div className="input-group-btn">
    446                                                                 <button className="btn btn-default input-lg" type="button" onClick={this.search}>
    447                                                                         <i className="glyphicon glyphicon-search"></i>
    448                                                                 </button>
     464                                                                {this.renderSearchButtonOrLink()}
    449465                                                        </div>
    450466                                                </div>
     
    486502                                                        </div>
    487503
     504                                                        { this.props.embedded ? false :
    488505                                                        <div className="input-group">
    489506                                                                <span className="input-group-addon nobkg">in</span>
     
    491508                                                                        {this.state.corpora.getSelectedMessage()} <span className="caret"/>
    492509                                                                </button>
    493                                                         </div>                                                 
    494 
     510                                                        </div> }
     511
     512                                                        { this.props.embedded ? false :
    495513                                                        <div className="input-group">
    496514                                                                <span className="input-group-addon nobkg">and show up to</span>
     
    502520                                                                </div>
    503521                                                                <span className="input-group-addon nobkg">hits</span>
    504                                                         </div>
     522                                                        </div> }
    505523                                                </form>
    506524                                        </div>
Note: See TracChangeset for help on using the changeset viewer.