Add subjects to notice + Background color two notice type + Remove empty notice fields
authorChloe Laisne <chloe.laisne@gmail.com>
Thu, 25 Aug 2016 18:44:50 +0200
changeset 269 9659e91242e1
parent 268 19313f7c04ab
child 270 6ddc52965fb8
Add subjects to notice + Background color two notice type + Remove empty notice fields
cms/app-client/app/models/document.js
cms/app-client/app/styles/app.scss
cms/app-client/app/styles/components/notice-component.scss
cms/app-client/app/templates/components/notice-component.hbs
--- a/cms/app-client/app/models/document.js	Wed Aug 24 18:32:41 2016 +0200
+++ b/cms/app-client/app/models/document.js	Thu Aug 25 18:44:50 2016 +0200
@@ -15,6 +15,27 @@
     contributors: DS.attr({ defaultValue: function() { return []; } }),
     geoInfo: DS.attr({ defaultValue: function() { return {}; } }),
     mediaArray: DS.attr({ defaultValue: function() { return []; } }),
+    subjects: DS.attr({ defaultValue: function() { return []; } }),
+
+    computedSubjects: Ember.computed('subjects', function() {
+        var array = [];
+        this.get('subjects').forEach(function(subject) {
+            var object = {};
+            if(typeof subject === 'object') {
+                if(subject.datatype) {
+                    object['url'] = subject.datatype;
+                }
+                if(subject.value) {
+                    object['name'] = subject.value;
+                }
+            } else {
+                object['url'] = subject;
+            }
+            array.push(object);
+        });
+        return array;
+    }),
+
 
     duration_ms: DS.attr('number', {
         defaultValue: function() {
--- a/cms/app-client/app/styles/app.scss	Wed Aug 24 18:32:41 2016 +0200
+++ b/cms/app-client/app/styles/app.scss	Thu Aug 25 18:44:50 2016 +0200
@@ -66,11 +66,8 @@
     text-align: center;
 }
 
-.corpus-app-modal {
-    background-color: $medium-white;
-    border-right: 1px solid $dark-grey;
-    padding: 20px 40px;
-    z-index: 1;
+.corpus-app-modal .notice-component {
+    background-color: inherit;
 }
 
 .corpus-app-container {
@@ -90,7 +87,8 @@
     font-size: 14px;
 }
 
-.corpus-app-container h2 {
+.corpus-app-container h2,
+.corpus-app-modal h2 {
     line-height: 30px;
     margin: 12px auto;
 }
@@ -146,6 +144,10 @@
     position: absolute;
     top: 0px;
     left: 0px;
+    background-color: $medium-white;
+    border-right: 1px solid $dark-grey;
+    overflow-y: scroll;
+    z-index: 1;
 }
 
 .corpus-app-container {
--- a/cms/app-client/app/styles/components/notice-component.scss	Wed Aug 24 18:32:41 2016 +0200
+++ b/cms/app-client/app/styles/components/notice-component.scss	Thu Aug 25 18:44:50 2016 +0200
@@ -1,3 +1,7 @@
+.corpus-app-container.window {
+    background-color: $light-blue;
+}
+
 .notice-component {
     padding: 20px 40px;
     color: $dark-grey;
@@ -54,6 +58,7 @@
 .notice-component table tr td.title {
     font-weight: bold;
     color: $dark-blue;
+    width: 25%;
 }
 
 .notice-component table tr td ul {
--- a/cms/app-client/app/templates/components/notice-component.hbs	Wed Aug 24 18:32:41 2016 +0200
+++ b/cms/app-client/app/templates/components/notice-component.hbs	Thu Aug 25 18:44:50 2016 +0200
@@ -6,12 +6,12 @@
 <h3>{{ item.title }}</h3>
 <table>
 <tr>
-	<td class="title">Editeur(s)</td>
+	<td class="title">Editeur{{#if (if-operator item.publishers.length '>' 1)}}s{{/if}}</td>
 	<td>
 		<ul>
-			{{#each item.publishers as |publisher|}}
+		{{#each item.publishers as |publisher|}}
 			<li>{{ publisher }}</li>
-			{{/each}}
+		{{/each}}
 		</ul>
 	</td>
 </tr>
@@ -20,22 +20,36 @@
 	<td>{{ doc-language url=item.language class="language"}}</td>
 </tr>
 <tr>
-	<td class="title">Enregistré en</td>
-	<td>{{ short-date item.issued }}</td>
-</tr>
-<tr>
-	<td class="title">Participants</td>
+	<td class="title">Sujet{{#if (if-operator item.computedSubjects.length '>' 1)}}s{{/if}}</td>
 	<td>
 		<ul>
-		{{#each participants as |participant|}}
-		<li>{{ participant.name }} ({{ participant.role }})</li>
+		{{#each item.computedSubjects as |subject|}}
+			<li>
+			{{#if subject.url}}
+				<a href="{{subject.url}}" target="_blank">
+					{{#if subject.name}}{{subject.name}}{{else}}{{component (getLinkType subject.url) url=subject.url}}{{/if}}
+				</a>
+			{{else}}
+				{{subject.name}}
+			{{/if}}
+			</li>
 		{{/each}}
 		</ul>
 	</td>
 </tr>
 <tr>
-	<td class="title">Description(s)</td>
-	<td></td>
+	<td class="title">Enregistré en</td>
+	<td>{{ short-date item.issued }}</td>
+</tr>
+<tr>
+	<td class="title">Participant{{#if (if-operator participants.length '>' 1)}}s{{/if}}</td>
+	<td>
+		<ul>
+		{{#each participants as |participant|}}
+			<li>{{ participant.name }} ({{ participant.role }})</li>
+		{{/each}}
+		</ul>
+	</td>
 </tr>
 <tr>
 	<td class="title">Lieu</td>
@@ -45,8 +59,4 @@
 	<td class="title">Durée</td>
 	<td>{{to-minutes item.duration}}</td>
 </tr>
-<tr>
-	<td class="title">Droits</td>
-	<td></td>
-</tr>
 </table>
\ No newline at end of file