<commit_before>package code.snippet

import net.liftweb.common.Full
import net.liftweb.util.Helpers._
import xml.{Text, NodeSeq}
import code.model.UserDoc

/**
 * Created by IntelliJ IDEA.
 * User: den
 * Date: 24.09.11
 * Time: 15:40
 * To change this template use File | Settings | File Templates.
 */

class MyMenu {
  def your = {
    "li *" #> (UserDoc.currentUser match {
      case Full(u) => <a href={"/" + u.login.get}>Your page</a>
      case _ => Text("")
    })
  }

  def admin = {
    "li *" #> (UserDoc.currentUser match {
      case Full(u) => <a href={"/admin/" + u.login.get}>Admin</a>
      case _ => Text("")
    })
  }

  def signIn = {
    "li *" #> (UserDoc.currentUser match {
      case Full(u) => Text("")
      case _ => <a href="/user/m/signin">Sign In</a>
    })

  }
}<commit_msg>Added Logout, Register, login links to top menu<commit_after>package code.snippet

import net.liftweb.common._
import net.liftweb.http._
import net.liftweb.util.Helpers._
import xml.{Text, NodeSeq}
import code.model.UserDoc

/**
 * Created by IntelliJ IDEA.
 * User: den
 * Date: 24.09.11
 * Time: 15:40
 * To change this template use File | Settings | File Templates.
 */

class MyMenu {
  def your = {
    "li *" #> (UserDoc.currentUser match {
      case Full(u) => <a href={"/" + u.login.get}>Your page</a>
      case _ => Text("")
    })
  }

  def admin = {
    "li *" #> (UserDoc.currentUser match {
      case Full(u) => <a href={"/admin/" + u.login.get}>Admin</a>
      case _ => Text("")
    })
  }

  def signIn = {
    UserDoc.currentUser match {
      case Full(u) => "li *" #> SHtml.a(()=> { UserDoc.logoutCurrentUser; S.redirectTo(S.referer openOr "") }, Text("Log Out"))
      case _ => "li" #> (<li><a href="/user/m/login">Log In</a></li> ++ <li><a href="/user/m/new">Register</a></li>)
    }

  }
}
{'fraction_non_alphanumeric': 0.18948521358159912, 'fraction_numerical': 0.01095290251916758, 'mean_word_length': 2.7134146341463414, 'pattern_counts': {'":': 0, '<': 21, '<?xml version=': 0, '>': 41, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 2}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4656462', 'n_tokens_mistral': 693, 'n_tokens_neox': 666, 'n_words': 155}