Better meta attributes listing

This commit is contained in:
Vit Brunner
2014-12-28 14:02:48 +01:00
parent 230ad02df4
commit 02f3904cd1
3 changed files with 8 additions and 2 deletions
+2 -2
View File
@@ -11,9 +11,9 @@
.pick-in
table
tr
th(ng-repeat="(attribute, value) in all[0].meta" ng-if="attribute != 'Active'" ng-bind-html="attribute")
th(ng-repeat="attribute in metaKeys" ng-if="attribute != 'Active'" ng-bind-html="attribute")
tr(ng-repeat="poem in all" class="switch" ng-class="{disabled: !poem.meta.Active}" ng-click="switchActive(poem)")
td(ng-repeat="(attribute, value) in poem.meta" ng-if="attribute != 'Active'" ng-bind-html="value")
td(ng-repeat="attribute in metaKeys" ng-if="attribute != 'Active'" ng-bind-html="poem.meta[attribute]")
// verses
#content
+1
View File
@@ -41,6 +41,7 @@ angular.module("sideBySide.controllers", [])
headingKey = poems.config.heading or "Author"
$scope.headings = (version[headingKey] for version in transformed.meta)
$scope.metaKeys = poems.getMetaKeys()
$scope.all = poems.all
scroll()
+5
View File
@@ -23,4 +23,9 @@ angular.module("sideBySide").service "poems", ->
@getInactive = ->
(poem for poem in @all when poem.meta.Active != true)
@getMetaKeys = ->
@all.reduce (all, one) ->
_.uniq all.concat (key for key of one.meta)
, []
@