mirror of
https://github.com/wassname/side-by-side.git
synced 2026-09-09 11:34:24 +08:00
Better meta attributes listing
This commit is contained in:
@@ -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
|
||||
|
||||
@@ -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()
|
||||
|
||||
|
||||
@@ -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)
|
||||
, []
|
||||
|
||||
@
|
||||
|
||||
Reference in New Issue
Block a user