Commit de358115 authored by Pedro Eduardo Trujillo's avatar Pedro Eduardo Trujillo
Browse files

Añade prueba con widgets de filtrado

parent 880cd236
Loading
Loading
Loading
Loading
+35 −3
Original line number Diff line number Diff line
@@ -7,6 +7,8 @@ define([
	, "templates/InitialInfo"
	, "redmic/base/Credentials"
	, 'app/home/views/SearchBarWidget'
	, 'app/home/views/SearchFastFilterWidget'
	, 'app/home/views/SearchFilterWidget'
	, 'app/home/views/SearchResultsWidget'
	, "app/home/views/SocialWidget"
	, "app/home/views/WidgetLastActivity"
@@ -20,6 +22,8 @@ define([
	, TemplateInfo
	, Credentials
	, SearchBarWidget
	, SearchFastFilterWidget
	, SearchFilterWidget
	, SearchResultsWidget
	, SocialWidget
	, WidgetLastActivity
@@ -50,9 +54,18 @@ define([
					}
				},
				searchFilter: {
					width: 6,
					height: 2,
					type: SearchFilterWidget,
					hidden: true,
					props: {
						"class": "containerDetails"
					}
				},
				searchFastFilter: {
					width: 2,
					height: 4,
					type: SearchResultsWidget,
					type: SearchFastFilterWidget,
					hidden: true,
					props: {
						"class": "containerDetails"
@@ -132,12 +145,15 @@ define([
			},{
				channel: this._widgets.searchBar.getChannel('HIDE_SEARCH_RESULTS'),
				callback: lang.hitch(this, this._hideSearchResults)
			},{
				channel: this._widgets.searchBar.getChannel('TOGGLE_ADVANCED_SEARCH'),
				callback: lang.hitch(this, this._toggleAdvancedSearch)
			}]);
		},

		_showSearchResults: function(searchDefinition) {

			this._showWidget('searchFilter');
			this._showWidget('searchFastFilter');
			this._showWidget('searchResults');
			this._reloadInteractive();

@@ -148,12 +164,28 @@ define([

			this._publish(this._widgets.searchResults.getChannel('CLEAR_DATA'), searchDefinition);

			this._hideWidget('searchFilter');
			this._hideWidget('searchFastFilter');
			this._hideWidget('searchResults');
			this._reloadInteractive();
			this._updateInteractive();
		},

		_toggleAdvancedSearch: function() {

			if (!this._advancedSearchShown) {
				this._advancedSearchShown = true;
				this._showWidget('searchFilter');
				this._reloadInteractive();
				this._updateInteractive();
			} else {
				this._advancedSearchShown = false;
				this._hideWidget('searchFilter');
				//this._publish(this._widgets.searchFilter.getChannel('TOGGLE_SHOW'));
				this._reloadInteractive();
				this._updateInteractive();
			}
		},

		_clearModules: function() {

			this._publish(this._widgets.info.getChannel("CLEAR"));
+13 −2
Original line number Diff line number Diff line
@@ -26,11 +26,13 @@ define([
				ownChannel: 'searchWidget',
				events: {
					'SHOW_SEARCH_RESULTS': 'showSearchResults',
					'HIDE_SEARCH_RESULTS': 'hideSearchResults'
					'HIDE_SEARCH_RESULTS': 'hideSearchResults',
					'TOGGLE_ADVANCED_SEARCH': 'toggleAdvancedSearch'
				},
				actions: {
					'SHOW_SEARCH_RESULTS': 'showSearchResults',
					'HIDE_SEARCH_RESULTS': 'hideSearchResults'
					'HIDE_SEARCH_RESULTS': 'hideSearchResults',
					'TOGGLE_ADVANCED_SEARCH': 'toggleAdvancedSearch'
				},
				target: redmicConfig.services.activity,
				className: 'searchBarPanel'
@@ -59,12 +61,21 @@ define([
			},{
				event: 'HIDE_SEARCH_RESULTS',
				channel: this.getChannel('HIDE_SEARCH_RESULTS')
			},{
				event: 'TOGGLE_ADVANCED_SEARCH',
				channel: this.getChannel('TOGGLE_ADVANCED_SEARCH')
			});
		},

		_afterShow: function() {

			if (this._getPreviouslyShown()) {
				return;
			}

			var parentNode = put(this.contentNode, 'div.' + this.className);
			this._toggleAdvancedNode = put(this.contentNode, 'i.fa.fa-info');
			this._toggleAdvancedNode.onclick = lang.hitch(this, this._emitEvt, 'TOGGLE_ADVANCED_SEARCH');

			this._publish(this.textSearch.getChannel("SHOW"), {
				node: parentNode
+78 −0
Original line number Diff line number Diff line
define([
	'app/home/views/_DashboardItem'
	, 'app/redmicConfig'
	, 'dojo/_base/declare'
	, 'dojo/_base/lang'
	, 'put-selector/put'
	, 'redmic/modules/base/_Filter'
	, 'redmic/modules/base/_Module'
	, 'redmic/modules/base/_Show'
	, 'redmic/modules/base/_Store'
	, 'redmic/modules/search/FacetsImpl'
], function(
	_DashboardItem
	, redmicConfig
	, declare
	, lang
	, put
	, _Filter
	, _Module
	, _Show
	, _Store
	, FacetsImpl
) {

	return declare([_Module, _Show, _Filter], {
		//	summary:
		//		Widget contenedor de resultados de búsqueda sobre actividades

		constructor: function(args) {

			this.config = {
				ownChannel: 'searchFastFilterWidget',
				target: redmicConfig.services.activity,
				className: 'facets'
			};

			lang.mixin(this, this.config, args);
		},

		_initialize: function() {

			this.facetsSearchConfig = this._merge([{
				parentChannel: this.getChannel(),
				queryChannel: this.queryChannel,
				aggs: {
					"activityType": {
						"open": true,
						"terms": {
							"field": "activityType.name",
							"size": 100
						}
					},
					"territorialScope": {
						"terms": {
							"field": "scope.name",
							"size": 20
						}
					}
				}
			}, this.compositeSearchConfig || {}]);

			this.facetsSearch = new FacetsImpl(this.facetsSearchConfig);
		},

		_afterShow: function() {

			if (this._getPreviouslyShown()) {
				return;
			}

			var facetsSearchNode = put(this.domNode, 'div.' + this.className);

			this._publish(this.facetsSearch.getChannel("SHOW"), {
				node: facetsSearchNode
			});
		}
	});
});
+63 −0
Original line number Diff line number Diff line
define([
	'app/home/views/_DashboardItem'
	, 'app/redmicConfig'
	, 'dojo/_base/declare'
	, 'dojo/_base/lang'
	, 'put-selector/put'
	, 'redmic/modules/base/_Filter'
	, 'redmic/modules/base/_Module'
	, 'redmic/modules/base/_Show'
	, 'redmic/modules/base/_Store'
	, 'redmic/modules/search/CompositeImpl'
], function(
	_DashboardItem
	, redmicConfig
	, declare
	, lang
	, put
	, _Filter
	, _Module
	, _Show
	, _Store
	, CompositeImpl
) {

	return declare([_Module, _Show, _Filter], {
		//	summary:
		//		Widget contenedor de resultados de búsqueda sobre actividades

		constructor: function(args) {

			this.config = {
				ownChannel: 'searchFilterWidget',
				target: redmicConfig.services.activity,
				className: 'composite'
			};

			lang.mixin(this, this.config, args);
		},

		_initialize: function() {

			this.compositeSearchConfig = this._merge([{
				parentChannel: this.getChannel(),
				filterChannel: this.queryChannel
			}, this.compositeSearchConfig || {}]);

			this.compositeSearch = new CompositeImpl(this.compositeSearchConfig);
		},

		_afterShow: function() {

			if (this._getPreviouslyShown()) {
				return;
			}

			var compositeSearchNode = put(this.domNode, 'div.' + this.className);

			this._publish(this.compositeSearch.getChannel("SHOW"), {
				node: compositeSearchNode
			});
		}
	});
});
+1 −1
Original line number Diff line number Diff line
@@ -106,7 +106,7 @@ define([
						text: req.searchText
					}
				},
				omitRefresh: false
				requesterId: this.getOwnChannel()
			});
		},