Pārlūkot izejas kodu

[search] Edit description of a dashboard

Romain Rigaux 10 gadi atpakaļ
vecāks
revīzija
35fec5da5f

+ 2 - 0
apps/search/src/search/models.py

@@ -455,6 +455,8 @@ class Collection2(object):
 
     if self.document is not None:
       props['collection']['id'] = self.document.id
+      props['collection']['label'] = self.document.name
+      props['collection']['description'] = self.document.description
 
     # For backward compatibility
     if 'rows' not in props['collection']['template']:

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

@@ -397,6 +397,7 @@ var Collection = function (vm, collection) {
   self.uuid = ko.observable(typeof collection.uuid != "undefined" && collection.uuid != null ? collection.uuid : UUID());
   self.name = ko.mapping.fromJS(collection.name);
   self.label = ko.mapping.fromJS(collection.label);
+  self.description = ko.observable(typeof collection.description != "undefined" && collection.description != null ? collection.description : "");
   self.enabled = ko.mapping.fromJS(collection.enabled);
   self.autorefresh = ko.mapping.fromJS(collection.autorefresh);
   self.autorefreshSeconds = ko.mapping.fromJS(collection.autorefreshSeconds || 60);

+ 4 - 0
apps/search/src/search/templates/search.mako

@@ -1396,6 +1396,10 @@ ${ dashboard.layout_skeleton() }
       ${ _('Visible to everybody') } <input type="checkbox" data-bind="checked: $root.collection.enabled"/>
     </label>
 
+    <span style="margin-top: 4px">
+      ${ _('Description') } <input type="text" class="input-xlarge" data-bind="value: $root.collection.description"></input>
+    </span>
+
     <label class="checkbox" style="margin-top: 4px">
       <input type="checkbox" style="margin-top: 9px" data-bind="checked: $root.collection.autorefresh"/> ${ _('Auto-refresh every') } <input type="text" class="input-mini" style="margin-bottom: 0; margin-left: 6px" data-bind="value: $root.collection.autorefreshSeconds"/> ${ _('seconds') }
     </label>

+ 2 - 2
apps/search/src/search/views.py

@@ -168,8 +168,8 @@ def save(request):
         'collection': collection,
         'layout': layout
     })
-    dashboard_doc.name = collection['name']
-    dashboard_doc.description = collection['label']
+    dashboard_doc.name = collection['label']
+    dashboard_doc.description = collection['description']
     dashboard_doc.save()
     
     response['status'] = 0