Skip to content

Commit

Permalink
Merge pull request #13 from jducoeur/QI.9v5kfj3-et-al
Browse files Browse the repository at this point in the history
Qi.9v5kfj3 et al
  • Loading branch information
jducoeur authored Aug 10, 2020
2 parents 2f7e0d2 + 52f0b5a commit 1ee3b54
Show file tree
Hide file tree
Showing 7 changed files with 50 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -180,7 +180,7 @@ class InvitationTab(
table(cls:="table table-hover",
tbody(
for (member <- invitees.sortBy(_.person.displayName))
yield new PersonDisplay("warning", member, roleMap, customMap, std)
yield new PersonDisplay("warning", member, roleMap, customMap, std, page)
)
)
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ class MembersTab(
tbody(
for {
member <- members
display = new PersonDisplay("info", member, roleMap, customMap, page.std)
display = new PersonDisplay("info", member, roleMap, customMap, page.std, page)
_ = personDisplays() = { personDisplays.now :+ display }
}
yield display
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,19 +4,20 @@ import org.scalajs.dom.html
import org.querki.jquery._
import scalatags.JsDom.all._
import rx._

import org.querki.gadgets._
import querki.api.StandardThings
import querki.display.QuerkiUIUtils
import querki.globals._
import querki.pages.Page
import querki.util.ScalatagUtils

class PersonDisplay(
showCls:String,
val person:PersonInfo,
roleInfo:RoleInfo,
customInfo:RoleInfo,
std: StandardThings)(implicit val ecology: Ecology, ctx:Ctx.Owner)
std: StandardThings,
page: Page)(implicit val ecology: Ecology, ctx:Ctx.Owner)
extends Gadget[html.TableRow] with QuerkiUIUtils
{
val customDisplay = GadgetRef.of[html.Div]
Expand All @@ -43,21 +44,23 @@ class PersonDisplay(
}
}.children().click { evt:JQueryEventObject =>
// Don't let child clicks propagate to the row itself:
false
evt.stopImmediatePropagation()
}
}
}

val check = GadgetRef.of[html.Span]

def doRender() = {
val personUrl = page.PageManager.pageUrl(person.person.urlName.underlying)
tr(cls:=showCls,
cell <= td(
check <= span(visibility := "hidden", icon("ok")),
" ",
MSeq(
person.person.displayName,
" -- ",
a(href := personUrl,
person.person.displayName),
s" (${person.person.oid2.underlying}) -- ",
new RolesDisplay(person.roles, person.person.oid, roleInfo, customInfo, customDisplay, std)
),
customDisplay <= div(display := "None")
Expand Down
19 changes: 19 additions & 0 deletions querki/scalajvm/app/querki/html/UIModule.scala
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,8 @@ object UIMOIDs extends EcotIds(11) {
val UpdateableSectionOID = moid(14)
val UpdateSectionOID = moid(15)
val TextInputOID = moid(16)

val OwnedThingsPageOID = moid(17)
}

/**
Expand Down Expand Up @@ -107,6 +109,23 @@ class UIModule(e:Ecology) extends QuerkiEcot(e) with HtmlUI with querki.core.Met
RawHtmlType
)

/***********************************************
* THINGS
***********************************************/

lazy val OwnedThingsPage = ThingState(OwnedThingsPageOID, systemOID, RootOID,
toProps(
setName("_ownedThingsPage"),
PageHeaderProperty("# Things owned by [[$person]]"),
setInternal,
Basic.DisplayTextProp(
"""[[$person -> _ownedThings -> _bulleted]]""".stripMargin)
))

override lazy val things = Seq(
OwnedThingsPage
)

/***********************************************
* PROPERTIES
***********************************************/
Expand Down
16 changes: 15 additions & 1 deletion querki/scalajvm/app/querki/identity/PersonModule.scala
Original file line number Diff line number Diff line change
Expand Up @@ -202,14 +202,28 @@ class PersonModule(e:Ecology) extends QuerkiEcot(e) with Person with querki.core
setName("_Status Removed"),
setInternal
))

lazy val OwnedThings = ThingState(OwnedThingsOID, systemOID, RootOID,
toProps(
setName("_ownedThings"),
setInternal,
Summary("Given a Person, this produces the Things owned by that Person"),
Basic.ApplyMethod(
"""+$person
|Simple Thing._instances ->
|_filter(_creator -> _isNonEmpty) ->
|_filter(_creator -> _is($person))
|""".stripMargin)
))

override lazy val things = Seq(
InvitationStatusModel,
StatusInvited,
StatusRequested,
StatusMember,
StatusRejected,
StatusRemoved
StatusRemoved,
OwnedThings
)

/***********************************************
Expand Down
2 changes: 2 additions & 0 deletions querki/scalajvm/app/querki/identity/package.scala
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,8 @@ package object identity {
val CreatorFunctionOID = moid(19)
val MakeAllPersonsPublicCommandOID = moid(20)
val StatusRemovedOID = moid(21)

val OwnedThingsOID = moid(22)
}

val IdentityTag = "Users, Identities and Invitations"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -358,7 +358,10 @@ class AccessControlModule(e:Ecology)
// a Space, there might already be a Thing with that name, so we have to cope.
DeriveName.DeriveNameProp(DeriveName.DeriveAlways),
Categories(SecurityTag),
Summary("""This represents a Member of this Space.""")))
Summary("""This represents a Member of this Space."""),
Basic.DisplayTextProp(
"""### [[+$person
|_ownedThingsPage -> _withParam(""person"", $person) -> ""__Owned Things__""]]""".stripMargin)))

lazy val PublicTag = ThingState(PublicTagOID, systemOID, SecurityPrincipal,
toProps(
Expand Down

0 comments on commit 1ee3b54

Please sign in to comment.