add filter on created date in notice
authorymh <ymh.work@gmail.com>
Thu, 16 Feb 2017 16:10:07 +0100
changeset 513 dad9471f0d63
parent 512 cf4653cf88f2
child 514 d2f6792f199a
add filter on created date in notice
cms/app-client/app/components/notice-component.js
cms/app-client/app/styles/components/notice-component.scss
cms/app-client/app/templates/components/notice-component.hbs
common/corpus-common-addon/addon/components/doc-created.js
server/src/app/Console/Commands/ImportCocoonRDF.php
--- a/cms/app-client/app/components/notice-component.js	Wed Feb 15 22:53:52 2017 +0100
+++ b/cms/app-client/app/components/notice-component.js	Thu Feb 16 16:10:07 2017 +0100
@@ -56,6 +56,11 @@
 
         addTypeFilter: function(id) {
             this.get('filter').setFilter('theme', id);
+        },
+
+        addCreatedFilter: function(dateStr) {
+          const date = new Date(dateStr);
+          this.get('filter').setFilter('date', date.getFullYear().toString());
         }
     }
 
--- a/cms/app-client/app/styles/components/notice-component.scss	Wed Feb 15 22:53:52 2017 +0100
+++ b/cms/app-client/app/styles/components/notice-component.scss	Thu Feb 16 16:10:07 2017 +0100
@@ -162,5 +162,9 @@
     display: inline-block;
   }
 
+  .notice-created {
+    cursor: pointer;
+  }
+
 }
 
--- a/cms/app-client/app/templates/components/notice-component.hbs	Wed Feb 15 22:53:52 2017 +0100
+++ b/cms/app-client/app/templates/components/notice-component.hbs	Thu Feb 16 16:10:07 2017 +0100
@@ -55,7 +55,7 @@
   </tr>
   <tr>
     <td class="title">Enregistré en</td>
-    <td>{{ doc-created value=item.created }}</td>
+    <td>{{#if item.created }}{{ doc-created value=item.created action=(action "addCreatedFilter" item.created) class="notice-created"}}{{/if}}</td>
   </tr>
   <tr>
     <td class="title">Participant{{#if (if-operator participants.length '>' 1)}}s{{/if}}</td>
--- a/common/corpus-common-addon/addon/components/doc-created.js	Wed Feb 15 22:53:52 2017 +0100
+++ b/common/corpus-common-addon/addon/components/doc-created.js	Thu Feb 16 16:10:07 2017 +0100
@@ -87,7 +87,13 @@
     // from the periodMatches function we know that we have a valid end date
     return this.formatDate(periodMatches.end.str, periodMatches.end.date);
 
-  })
+  }),
+  click() {
+    const action = this.get('action');
 
+    if (action) {
+      action();
+    }
+  }
 
 });
--- a/server/src/app/Console/Commands/ImportCocoonRDF.php	Wed Feb 15 22:53:52 2017 +0100
+++ b/server/src/app/Console/Commands/ImportCocoonRDF.php	Thu Feb 16 16:10:07 2017 +0100
@@ -306,14 +306,6 @@
             $progressBar->finish();
         }
 
-        // $collectionDocsUris = $this->gs_raw->query("SELECT distinct ?uri WHERE {
-        //     GRAPH ?uri {
-        //         ?s ?p ?o.
-        //         ?s <http://purl.org/dc/elements/1.1/type> <http://purl.org/dc/dcmitype/Collection>.
-        //         FILTER(?o IN (<http://purl.org/dc/dcmitype/Sound>, <http://purl.org/dc/dcmitype/MovingImage>))
-        //     }
-        // }");
-
         if($clear) {
             $this->gs->clear("all");
         }