Преглед изворни кода

[search] Switch facet type icons for widgets

Romain Rigaux пре 11 година
родитељ
комит
8f53979

+ 1 - 1
apps/search/src/search/api.py

@@ -212,7 +212,7 @@ class SolrApi(object):
         elif facet['type'] == 'field':
           params += (
               ('facet.field', '{!ex=%s}%s' % (facet['field'], facet['field'])),
-              ('f.%s.facet.limit' % facet['field'], facet['properties']['limit']))
+              ('f.%s.facet.limit' % facet['field'], facet['properties'].get('limit', 10)))
 
     for fq in query['fqs']:
       #model_facet = [facet for facet in collection['facets'] if facet['id'] == fq['id']][0]

+ 6 - 15
apps/search/src/search/templates/search2.mako

@@ -418,11 +418,8 @@ ${ commonheader(_('Search'), "search", user, "60px") | n,unicode }
   <!-- ko if: $root.getFacetFromQuery(id()) -->
   <div class="row-fluid" data-bind="with: $root.getFacetFromQuery(id())">
     <div data-bind="visible: $root.isEditing, with: $root.collection.getFacetById($parent.id())" style="margin-bottom: 20px">      
-      ${ _('Label') }: <input type="text" data-bind="value: label" />
-      <br/>      
-      ${ _('Start') }: <input type="text" data-bind="value: properties.start" />
-      ${ _('End') }: <input type="text" data-bind="value: properties.end" />
-      ${ _('Gap') }: <input type="text" data-bind="value: properties.gap" />
+      <span data-bind="template: { name: 'facet-toggle' }">
+      </span>
     </div>  
 
     ##<a href="javascript:void(0)"><i class="fa fa-plus"></i></a>
@@ -454,11 +451,8 @@ ${ commonheader(_('Search'), "search", user, "60px") | n,unicode }
   <!-- ko if: $root.getFacetFromQuery(id()) -->
   <div class="row-fluid" data-bind="with: $root.getFacetFromQuery(id())">
     <div data-bind="visible: $root.isEditing, with: $root.collection.getFacetById($parent.id())" style="margin-bottom: 20px">      
-      ${ _('Label') }: <input type="text" data-bind="value: label" />
-      <br/>
-      ${ _('Start') }: <input type="text" data-bind="value: properties.start" />
-      ${ _('End') }: <input type="text" data-bind="value: properties.end" />
-      ${ _('Gap') }: <input type="text" data-bind="value: properties.gap" />
+      <span data-bind="template: { name: 'facet-toggle' }">
+      </span>
     </div> 
 
     <div data-bind="barChart: {datum: {counts: counts, widget_id: $parent.id(), label: label}, stacked: false, field: field, label: label,
@@ -484,11 +478,8 @@ ${ commonheader(_('Search'), "search", user, "60px") | n,unicode }
   <!-- ko if: $root.getFacetFromQuery(id()) -->
   <div class="row-fluid" data-bind="with: $root.getFacetFromQuery(id())">
     <div data-bind="visible: $root.isEditing, with: $root.collection.getFacetById($parent.id())" style="margin-bottom: 20px">
-      ${ _('Label') }: <input type="text" data-bind="value: label" />
-      <br/>
-      ${ _('Start') }: <input type="text" data-bind="value: properties.start" />
-      ${ _('End') }: <input type="text" data-bind="value: properties.end" />
-      ${ _('Gap') }: <input type="text" data-bind="value: properties.gap" />
+      <span data-bind="template: { name: 'facet-toggle' }">
+      </span>
     </div>
 
     <div data-bind="lineChart: {datum: {counts: counts, widget_id: $parent.id(), label: label}, field: field, label: label,

+ 1 - 1
apps/search/static/js/search.ko.js

@@ -575,7 +575,7 @@ var SearchViewModel = function (collection_json, query_json, initial_json) {
 
   if (initial_json.collections) {
     self.collection.name.subscribe(function (newValue) {
-	  self.collection.label(newValue);alert(newValue);
+	  self.collection.label(newValue);
     });
   }