Skip to content

Commit

Permalink
Use underscore instead of colon to prefix group fields
Browse files Browse the repository at this point in the history
  • Loading branch information
dzhus committed Mar 22, 2012
1 parent c034b47 commit a8c69b0
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
8 changes: 4 additions & 4 deletions README.org
Original file line number Diff line number Diff line change
Expand Up @@ -317,8 +317,8 @@
Every field `f` with `groupName` annotation is spliced into list
of actual group members in served model, and `groupName` property
is attached to every field in splice result, with value equal to
name of group. Name of every field in group is prepended with
`f:`, where `f` is the name of original field which was spliced
name of group. Name of every field in group is *prepended* with
`f_`, where `f` is the name of original field which was spliced
into group. Client may use this data to recognize fields from the
same group and render them specifically.

Expand All @@ -332,8 +332,8 @@
"groupName": "bar"
#+END_SRC

then `foo` will be spliced into fields named `foo:f1`, `foo:f2`
and `foo:f3`, and `groupName` for all these fields will be set to
then `foo` will be *spliced into* fields named `foo_f1`, `foo_f2`
and `foo_f3`, and `groupName` for all these fields will be set to
`bar`.

Client may also request list of readable models from
Expand Down
4 changes: 2 additions & 2 deletions src/Snap/Snaplet/Redson/Snapless/Metamodel.hs
Original file line number Diff line number Diff line change
Expand Up @@ -146,14 +146,14 @@ instance ToJSON Field where

type Groups = M.Map B.ByteString [Field]

-- | Build new name `f:gK` for every field of group `g` to which field
-- | Build new name `f_gK` for every field of group `g` to which field
-- `f` is spliced into.
groupFieldName :: FieldName
-- ^ Name of field which is spliced into group
-> FieldName
-- ^ Name of group field
-> FieldName
groupFieldName parent field = B.concat [parent, ":", field]
groupFieldName parent field = B.concat [parent, "_", field]

-- | Replace all model fields having `group` type with actual group
-- fields.
Expand Down

0 comments on commit a8c69b0

Please sign in to comment.