//- Item mixins
//- @param {boolean=} error If an error occured.
//- @param {string=} errorMsg
//- @param {Object|Error=} errorObj
//- @param {boolean=} success
//- @param {Object=} successObj

//- Show a single item.
//- @param {mongoose.Document} item
//- @param {mongoose.Model.schema.path} schema
//- @param {Object=} opts Options for rendering.
mixin viewItem(item, schema, opts)
  h4
    a(href="#{item[opts.urlField]}", title="#{item[opts.nameField]}")
      | #{item[opts.nameField]}

  table.table.table-bordered
    each schemaItem, key in schema
      - if (schemaItem.canShow && opts.viewExcludePaths.indexOf(key) === -1)
        tr
          th
            - if (opts.labels[schemaItem.name])
              | #{opts.labels[schemaItem.name]}
            - else
              | #{schemaItem.name}
          td #{fn.getValue(item, schemaItem)}

  .row-fluid
    .span12
      a(href="#{item[opts.urlField]}/edit").btn.btn-small.btn-primary Edit
