[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-header">
 | 
			
		||||
        <label><%= scope.textFind %></label>
 | 
			
		||||
        <label><%= headerText %></label>
 | 
			
		||||
        <div id="search-btn-close"></div>
 | 
			
		||||
    </div>
 | 
			
		||||
    <div id="search-results">
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -152,7 +152,8 @@ define([
 | 
			
		|||
        },
 | 
			
		||||
 | 
			
		||||
        onOpenPanel: function () {
 | 
			
		||||
 | 
			
		||||
            this.hide();
 | 
			
		||||
            this.fireEvent('search:show', [true]);
 | 
			
		||||
        },
 | 
			
		||||
 | 
			
		||||
        textFind: 'Find'
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -50,12 +50,17 @@ define([
 | 
			
		|||
        initialize: function(options) {
 | 
			
		||||
            _.extend(this, options);
 | 
			
		||||
            Common.UI.BaseView.prototype.initialize.call(this, arguments);
 | 
			
		||||
 | 
			
		||||
            this.isEdit = options.mode.isEdit;
 | 
			
		||||
        },
 | 
			
		||||
 | 
			
		||||
        render: function(el) {
 | 
			
		||||
            if (!this.rendered) {
 | 
			
		||||
                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.buttonClose = new Common.UI.Button({
 | 
			
		||||
| 
						 | 
				
			
			@ -90,6 +95,7 @@ define([
 | 
			
		|||
        },
 | 
			
		||||
 | 
			
		||||
        textFind: 'Find',
 | 
			
		||||
        textFindAndReplace: 'Find and replace',
 | 
			
		||||
        textCloseSearch: 'Close search'
 | 
			
		||||
 | 
			
		||||
    }, Common.Views.SearchPanel || {}));
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -110,6 +110,9 @@ define([
 | 
			
		|||
                },
 | 
			
		||||
                'ViewTab': {
 | 
			
		||||
                    'viewtab:navigation': _.bind(this.onShowHideNavigation, this)
 | 
			
		||||
                },
 | 
			
		||||
                'SearchBar': {
 | 
			
		||||
                    'search:show': _.bind(this.onShowHideSearch, this)
 | 
			
		||||
                }
 | 
			
		||||
            });
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			@ -172,6 +175,8 @@ define([
 | 
			
		|||
            if (this.mode.canUseHistory)
 | 
			
		||||
                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('Search').setApi(this.api).setMode(this.mode);
 | 
			
		||||
            this.leftMenu.setOptionsPanel('advancedsearch', this.getApplication().getController('Search').getView('Common.Views.SearchPanel'));
 | 
			
		||||
            return this;
 | 
			
		||||
        },
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			@ -192,8 +197,6 @@ define([
 | 
			
		|||
        },
 | 
			
		||||
 | 
			
		||||
        createDelayedElements: function() {
 | 
			
		||||
            this.leftMenu.setOptionsPanel('searchbar', this.getApplication().getController('Search').getView('Common.Views.SearchPanel'));
 | 
			
		||||
 | 
			
		||||
            /** coauthoring begin **/
 | 
			
		||||
            if ( this.mode.canCoAuthoring ) {
 | 
			
		||||
                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() {
 | 
			
		||||
            return this.leftMenu && this.leftMenu.panelComments && this.leftMenu.panelComments.isVisible();
 | 
			
		||||
        },
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -63,8 +63,10 @@ define([
 | 
			
		|||
        },
 | 
			
		||||
        onLaunch: function () {
 | 
			
		||||
            this._state = {};
 | 
			
		||||
        },
 | 
			
		||||
 | 
			
		||||
            this.view = this.createView('Common.Views.SearchPanel');
 | 
			
		||||
        setMode: function (mode) {
 | 
			
		||||
            this.view = this.createView('Common.Views.SearchPanel', { mode: mode });
 | 
			
		||||
        },
 | 
			
		||||
 | 
			
		||||
        setApi: function (api) {
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -103,7 +103,7 @@ define([
 | 
			
		|||
            });
 | 
			
		||||
 | 
			
		||||
            this.btnSearchBar = new Common.UI.Button({
 | 
			
		||||
                action: 'searchbar',
 | 
			
		||||
                action: 'advancedsearch',
 | 
			
		||||
                el: $markup.elementById('#left-btn-searchbar'),
 | 
			
		||||
                hint: this.tipSearch + Common.Utils.String.platformKey('Ctrl+F'),
 | 
			
		||||
                disabled: true,
 | 
			
		||||
| 
						 | 
				
			
			@ -303,7 +303,7 @@ define([
 | 
			
		|||
            if (name == 'thumbnails') {
 | 
			
		||||
                this.panelThumbnails = panel.render('#left-panel-thumbnails');
 | 
			
		||||
            }
 | 
			
		||||
            if (name == 'searchbar') {
 | 
			
		||||
            if (name == 'advancedsearch') {
 | 
			
		||||
                this.panelSearch = panel.render('#left-panel-search');
 | 
			
		||||
            }
 | 
			
		||||
        },
 | 
			
		||||
| 
						 | 
				
			
			@ -411,6 +411,13 @@ define([
 | 
			
		|||
                        this.onBtnMenuClick(this.btnNavigation);
 | 
			
		||||
                        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 **/
 | 
			
		||||
            }
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
		Reference in a new issue