[DE] New search: make show search panel from search window
This commit is contained in:
		
							parent
							
								
									c44fdfc61e
								
							
						
					
					
						commit
						e7b1f74f57
					
				| 
						 | 
					@ -1,6 +1,6 @@
 | 
				
			||||||
<div id="search-box" class="layout-ct vbox">
 | 
					<div id="search-box" class="layout-ct vbox">
 | 
				
			||||||
    <div id="search-header">
 | 
					    <div id="search-header">
 | 
				
			||||||
        <label><%= scope.textFind %></label>
 | 
					        <label><%= headerText %></label>
 | 
				
			||||||
        <div id="search-btn-close"></div>
 | 
					        <div id="search-btn-close"></div>
 | 
				
			||||||
    </div>
 | 
					    </div>
 | 
				
			||||||
    <div id="search-results">
 | 
					    <div id="search-results">
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -152,7 +152,8 @@ define([
 | 
				
			||||||
        },
 | 
					        },
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        onOpenPanel: function () {
 | 
					        onOpenPanel: function () {
 | 
				
			||||||
 | 
					            this.hide();
 | 
				
			||||||
 | 
					            this.fireEvent('search:show', [true]);
 | 
				
			||||||
        },
 | 
					        },
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        textFind: 'Find'
 | 
					        textFind: 'Find'
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -50,12 +50,17 @@ define([
 | 
				
			||||||
        initialize: function(options) {
 | 
					        initialize: function(options) {
 | 
				
			||||||
            _.extend(this, options);
 | 
					            _.extend(this, options);
 | 
				
			||||||
            Common.UI.BaseView.prototype.initialize.call(this, arguments);
 | 
					            Common.UI.BaseView.prototype.initialize.call(this, arguments);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					            this.isEdit = options.mode.isEdit;
 | 
				
			||||||
        },
 | 
					        },
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        render: function(el) {
 | 
					        render: function(el) {
 | 
				
			||||||
            if (!this.rendered) {
 | 
					            if (!this.rendered) {
 | 
				
			||||||
                el = el || this.el;
 | 
					                el = el || this.el;
 | 
				
			||||||
                $(el).html(this.template({scope: this}));
 | 
					                $(el).html(this.template({
 | 
				
			||||||
 | 
					                    scope: this,
 | 
				
			||||||
 | 
					                    headerText: this.isEdit ? this.textFindAndReplace : this.textFind
 | 
				
			||||||
 | 
					                }));
 | 
				
			||||||
                this.$el = $(el);
 | 
					                this.$el = $(el);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
                this.buttonClose = new Common.UI.Button({
 | 
					                this.buttonClose = new Common.UI.Button({
 | 
				
			||||||
| 
						 | 
					@ -90,6 +95,7 @@ define([
 | 
				
			||||||
        },
 | 
					        },
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        textFind: 'Find',
 | 
					        textFind: 'Find',
 | 
				
			||||||
 | 
					        textFindAndReplace: 'Find and replace',
 | 
				
			||||||
        textCloseSearch: 'Close search'
 | 
					        textCloseSearch: 'Close search'
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    }, Common.Views.SearchPanel || {}));
 | 
					    }, Common.Views.SearchPanel || {}));
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -110,6 +110,9 @@ define([
 | 
				
			||||||
                },
 | 
					                },
 | 
				
			||||||
                'ViewTab': {
 | 
					                'ViewTab': {
 | 
				
			||||||
                    'viewtab:navigation': _.bind(this.onShowHideNavigation, this)
 | 
					                    'viewtab:navigation': _.bind(this.onShowHideNavigation, this)
 | 
				
			||||||
 | 
					                },
 | 
				
			||||||
 | 
					                'SearchBar': {
 | 
				
			||||||
 | 
					                    'search:show': _.bind(this.onShowHideSearch, this)
 | 
				
			||||||
                }
 | 
					                }
 | 
				
			||||||
            });
 | 
					            });
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					@ -172,6 +175,8 @@ define([
 | 
				
			||||||
            if (this.mode.canUseHistory)
 | 
					            if (this.mode.canUseHistory)
 | 
				
			||||||
                this.getApplication().getController('Common.Controllers.History').setApi(this.api).setMode(this.mode);
 | 
					                this.getApplication().getController('Common.Controllers.History').setApi(this.api).setMode(this.mode);
 | 
				
			||||||
            this.getApplication().getController('PageThumbnails').setApi(this.api).setMode(this.mode);
 | 
					            this.getApplication().getController('PageThumbnails').setApi(this.api).setMode(this.mode);
 | 
				
			||||||
 | 
					            this.getApplication().getController('Search').setApi(this.api).setMode(this.mode);
 | 
				
			||||||
 | 
					            this.leftMenu.setOptionsPanel('advancedsearch', this.getApplication().getController('Search').getView('Common.Views.SearchPanel'));
 | 
				
			||||||
            return this;
 | 
					            return this;
 | 
				
			||||||
        },
 | 
					        },
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					@ -192,8 +197,6 @@ define([
 | 
				
			||||||
        },
 | 
					        },
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        createDelayedElements: function() {
 | 
					        createDelayedElements: function() {
 | 
				
			||||||
            this.leftMenu.setOptionsPanel('searchbar', this.getApplication().getController('Search').getView('Common.Views.SearchPanel'));
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
            /** coauthoring begin **/
 | 
					            /** coauthoring begin **/
 | 
				
			||||||
            if ( this.mode.canCoAuthoring ) {
 | 
					            if ( this.mode.canCoAuthoring ) {
 | 
				
			||||||
                this.leftMenu.btnComments[(this.mode.canViewComments && !this.mode.isLightVersion) ? 'show' : 'hide']();
 | 
					                this.leftMenu.btnComments[(this.mode.canViewComments && !this.mode.isLightVersion) ? 'show' : 'hide']();
 | 
				
			||||||
| 
						 | 
					@ -915,6 +918,16 @@ define([
 | 
				
			||||||
            }
 | 
					            }
 | 
				
			||||||
        },
 | 
					        },
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        onShowHideSearch: function (state) {
 | 
				
			||||||
 | 
					            if (state) {
 | 
				
			||||||
 | 
					                Common.UI.Menu.Manager.hideAll();
 | 
				
			||||||
 | 
					                this.leftMenu.showMenu('advancedsearch');
 | 
				
			||||||
 | 
					            } else {
 | 
				
			||||||
 | 
					                this.leftMenu.btnSearchBar.toggle(false, true);
 | 
				
			||||||
 | 
					                this.leftMenu.onBtnMenuClick(this.leftMenu.btnSearchBar);
 | 
				
			||||||
 | 
					            }
 | 
				
			||||||
 | 
					        },
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        isCommentsVisible: function() {
 | 
					        isCommentsVisible: function() {
 | 
				
			||||||
            return this.leftMenu && this.leftMenu.panelComments && this.leftMenu.panelComments.isVisible();
 | 
					            return this.leftMenu && this.leftMenu.panelComments && this.leftMenu.panelComments.isVisible();
 | 
				
			||||||
        },
 | 
					        },
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -63,8 +63,10 @@ define([
 | 
				
			||||||
        },
 | 
					        },
 | 
				
			||||||
        onLaunch: function () {
 | 
					        onLaunch: function () {
 | 
				
			||||||
            this._state = {};
 | 
					            this._state = {};
 | 
				
			||||||
 | 
					        },
 | 
				
			||||||
 | 
					
 | 
				
			||||||
            this.view = this.createView('Common.Views.SearchPanel');
 | 
					        setMode: function (mode) {
 | 
				
			||||||
 | 
					            this.view = this.createView('Common.Views.SearchPanel', { mode: mode });
 | 
				
			||||||
        },
 | 
					        },
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        setApi: function (api) {
 | 
					        setApi: function (api) {
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -103,7 +103,7 @@ define([
 | 
				
			||||||
            });
 | 
					            });
 | 
				
			||||||
 | 
					
 | 
				
			||||||
            this.btnSearchBar = new Common.UI.Button({
 | 
					            this.btnSearchBar = new Common.UI.Button({
 | 
				
			||||||
                action: 'searchbar',
 | 
					                action: 'advancedsearch',
 | 
				
			||||||
                el: $markup.elementById('#left-btn-searchbar'),
 | 
					                el: $markup.elementById('#left-btn-searchbar'),
 | 
				
			||||||
                hint: this.tipSearch + Common.Utils.String.platformKey('Ctrl+F'),
 | 
					                hint: this.tipSearch + Common.Utils.String.platformKey('Ctrl+F'),
 | 
				
			||||||
                disabled: true,
 | 
					                disabled: true,
 | 
				
			||||||
| 
						 | 
					@ -303,7 +303,7 @@ define([
 | 
				
			||||||
            if (name == 'thumbnails') {
 | 
					            if (name == 'thumbnails') {
 | 
				
			||||||
                this.panelThumbnails = panel.render('#left-panel-thumbnails');
 | 
					                this.panelThumbnails = panel.render('#left-panel-thumbnails');
 | 
				
			||||||
            }
 | 
					            }
 | 
				
			||||||
            if (name == 'searchbar') {
 | 
					            if (name == 'advancedsearch') {
 | 
				
			||||||
                this.panelSearch = panel.render('#left-panel-search');
 | 
					                this.panelSearch = panel.render('#left-panel-search');
 | 
				
			||||||
            }
 | 
					            }
 | 
				
			||||||
        },
 | 
					        },
 | 
				
			||||||
| 
						 | 
					@ -411,6 +411,13 @@ define([
 | 
				
			||||||
                        this.onBtnMenuClick(this.btnNavigation);
 | 
					                        this.onBtnMenuClick(this.btnNavigation);
 | 
				
			||||||
                        this.onCoauthOptions();
 | 
					                        this.onCoauthOptions();
 | 
				
			||||||
                    }
 | 
					                    }
 | 
				
			||||||
 | 
					                } else if (menu == 'advancedsearch') {
 | 
				
			||||||
 | 
					                    if (this.btnSearchBar.isVisible() &&
 | 
				
			||||||
 | 
					                        !this.btnSearchBar.isDisabled() && !this.btnSearchBar.pressed) {
 | 
				
			||||||
 | 
					                        this.btnSearchBar.toggle(true);
 | 
				
			||||||
 | 
					                        this.onBtnMenuClick(this.btnSearchBar);
 | 
				
			||||||
 | 
					                        this.onCoauthOptions();
 | 
				
			||||||
 | 
					                    }
 | 
				
			||||||
                }
 | 
					                }
 | 
				
			||||||
                /** coauthoring end **/
 | 
					                /** coauthoring end **/
 | 
				
			||||||
            }
 | 
					            }
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
		Reference in a new issue