Skip to content

Commit

Permalink
#101 closed: "Rename Banned to Disabled and move to profile"
Browse files Browse the repository at this point in the history
  • Loading branch information
ignatov committed Aug 3, 2011
1 parent b668911 commit 1ad68d8
Show file tree
Hide file tree
Showing 5 changed files with 26 additions and 16 deletions.
14 changes: 1 addition & 13 deletions src/main/scala/scala/tools/colladoc/model/mapper/User.scala
Original file line number Diff line number Diff line change
Expand Up @@ -79,22 +79,10 @@ class User extends ProtoUser[User] with OneToMany[Long, User] {
def profileHyperlink = <a target="template" href={profileUrl}>{userName}</a>

/** Grid entry. */
def toGridRow = {
val row =
def toGridRow =
<row id={id.toString}>
<cell>{profileHyperlink.toString}</cell>
<cell><row:banned /></cell>
</row>

bind("row", row,
"banned" -> SHtml.ajaxCheckbox(
banned, bool => {
banned(bool)
save
Noop
}).toString
)
}
}

/**
Expand Down
1 change: 1 addition & 0 deletions src/main/scala/scala/tools/colladoc/page/Profile.scala
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@ class Profile(rootPack: Package) extends scala.tools.colladoc.page.Template(root
<profile:change_password />
<profile:delete_profile />
<profile:superuser />
<profile:available />
</div>
<div id="comments_tab">
<profile:comments />
Expand Down
14 changes: 14 additions & 0 deletions src/main/scala/scala/tools/colladoc/snippet/ProfileOps.scala
Original file line number Diff line number Diff line change
Expand Up @@ -245,6 +245,19 @@ class ProfileOps {
</div>
}

def available(user: User) = {
<div id="available_wrapper">
<label for="available">Available</label>
{
SHtml.ajaxCheckbox(
!user.banned.is, bool => {
user.banned(!bool).save
Noop
}, ("id", "available"))
}
</div>
}

def body(xhtml: NodeSeq): NodeSeq = {
val user = getUser

Expand Down Expand Up @@ -279,6 +292,7 @@ class ProfileOps {
"change_password" -> { if (!public_?) changePasswordForm(user) else NodeSeq.Empty },
"delete_profile" -> { if (!public_?) deleteProfile(user) else NodeSeq.Empty },
"superuser" -> { if (User.validSuperUser_?) superuser(user) else NodeSeq.Empty },
"available" -> { if (User.validSuperUser_?) available(user) else NodeSeq.Empty },
"discussion_comments" -> { if (User.loggedIn_?) discussionComments else NodeSeq.Empty },
"fullname" -> Text(fullname),
"comments" -> comments
Expand Down
8 changes: 8 additions & 0 deletions src/main/webapp/coprofile.css
Original file line number Diff line number Diff line change
Expand Up @@ -82,4 +82,12 @@

#superuser_wrapper > label {
font-weight: bold;
}

#available_wrapper {
margin-top: 8px;
}

#available_wrapper > label {
font-weight: bold;
}
5 changes: 2 additions & 3 deletions src/main/webapp/scripts/cosettings.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,10 +27,9 @@ $(document).ready(function() {
$("#userlist").jqGrid({
url:'grid/users?',
datatype: "xml",
colNames:['Username', 'Banned'],
colNames:['Username'],
colModel:[
{name: 'profile', index: 'profile'},
{name: 'banned', index: 'banned', width: 60}
{name: 'profile', index: 'profile'}
],
rowList:[5,10,20,30],
pager: '#userpager',
Expand Down

0 comments on commit 1ad68d8

Please sign in to comment.