Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
everything is basically working...on to formatting and bugfixing
- Loading branch information
Showing
10 changed files
with
107 additions
and
103 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
package com.retwis.snippet | ||
|
||
import com.retwis.model._ | ||
import _root_.net.liftweb._ | ||
import http._ | ||
import mapper._ | ||
import S._ | ||
import SHtml._ | ||
import Req._ | ||
import common._ | ||
import util._ | ||
import Helpers._ | ||
import _root_.scala.xml.{NodeSeq, Text, Group, NodeBuffer} | ||
|
||
class FollowSnippet { | ||
object targetUser extends RequestVar("") | ||
|
||
def followButton (xhtml : NodeSeq) : NodeSeq = { | ||
val curUser = User.getLoggedInUser | ||
targetUser(S.param("u").openTheBox) | ||
|
||
def processFollow () { | ||
curUser.followUsername(targetUser.is) | ||
} | ||
|
||
if(curUser == null || curUser.getUsername == targetUser.is) { | ||
bind("follow", xhtml, | ||
"button" -> "") | ||
} | ||
else { | ||
var followButtonText = new NodeBuffer &+ "Follow" | ||
if(curUser.isFollowing(targetUser.is)) | ||
followButtonText = new NodeBuffer &+ "Unfollow" | ||
|
||
bind("follow", xhtml, | ||
"button" -> SHtml.link("index", processFollow, followButtonText)) | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters