Uploaded on

 

More in: Technology
  • Full Name Full Name Comment goes here.
    Are you sure you want to
    Your message goes here
    Be the first to comment
    Be the first to like this
No Downloads

Views

Total Views
1,687
On Slideshare
0
From Embeds
0
Number of Embeds
4

Actions

Shares
Downloads
0
Comments
0
Likes
0

Embeds 0

No embeds

Report content

Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel
    No notes for slide

Transcript

  • 1. Scala & MongoDB Community Widgetsbased on Scala2.8.x , Lift 2.2 and RogueVersion 0.1.0 - 2011/3/6Fungoing LLC / Satoshi MiyauchiTwitter : @bibrost
  • 2. Outline 1. Story 2. Product features 3. Concept 4. Architecture 5. Code Examples 6. Future Page : 1
  • 3. One day, I hope to get this likes ... Page : 2
  • 4. But... Good library is not found in scala community ... Page : 3
  • 5. Yes. Ill make this. Page : 4
  • 6. Product http://croquis.fungoing.jp/ Page : 5
  • 7. Current Features + Simple Posts & Feed + Simple Comments + Topic Tag ( #topicname ) + Pretty Date ( e.g. “x minutes ago” ) ... and Demo Application Page : 6
  • 8. Concept Modern communication features. ( likes Facebook, Twitter and other social platform. ) Nice user experience. Easy plugged to your own system. Page : 7
  • 9. Architecture Your ApplicationLogic My Croquis Class Your User ModelLibrary Croquis CoreDSL RogueMapper Mongo Record(Lift 2.2) Mapper or MongoRecordDatastore CroquisData(MongoDB) Your User Database Croquis Page : 8
  • 10. Code Examples - class - import com.fungoing.croquis._ Class MyCroquis extends Croquis{ override val userModel:Box[MyUser] = MyUser.currentUser override val userId:Box[String] = userModel match{ case Full(user) => Full(user.id.toString) case _ => Empty } /* ~ your functions ~ */ } 1. Import library 2. Create class by inherit “Croquis” 3. Override your User Identifier Page : 9
  • 11. Code Examples - Setting - MongoDB.defineDb(DefaultMongoIdentifier, MongoAddress(MongoHost(Props.get("mongodb.host").openOr(""), Props.get("mongodb.port").openOr("0").toInt), Props.get("mongodb.db").openOr(""))) LiftRules.rewrite.prepend(NamedPF("CroquisRewrite") { case RewriteRequest( ParsePath( "demo" :: Nil, _, true , false ), _, _) => RewriteResponse( List ( "base" , "index" ) ) case RewriteRequest( ParsePath( "demo" :: mode :: id :: Nil, _, true , false ), _, _) => RewriteResponse( List ( "base" , "index" ) , Map( "mode" -> mode, "id" -> id ) ) }) Page : 10
  • 12. Code Examples - view - <lift:MyCroquis:feed> <div class="article clearfix"> <div class="photo"><img src="/common/img/icon50.jpg" width="50" height="50" alt="" style="background-color: #CCCCCC" /></div> <div class="comments"> <div class="maintext"> <p class="name"><a href="#"><d:name /></a> <a href="topic.html" class="topicname"><d:labels /></a></p> <p><d:body /></p> <p><span class="time"><d:post /></span></p> </div> <div class="comment clearfix"> <div class="photo"><img src="/common/img/icon32.jpg" width="32" height="32" alt="" style="background-color: #CCCCCC" /> </div> <div class="text"> <p><span class="name"><a href="member.html">miyauchi</a></span>Good</p> <p><span class="time"></span></p> </div> </div> <d:commentForm form="post"> <div class="comment clearfix"> <form action="" method="get"> <div class="formtext"> <textarea name="test2" class="help" title="input"></textarea> </div> <div class="formbuttom"> <input type="submit" value="comment" /> </div> </form> </div> </d:commentForm> </div> </div> </lift:MyCroquis:feed> Page : 11
  • 13. Future + Favorite Topics + Favorite Posts + Like Button + Subscribe User Posts + Private Messaging + Post with contents ( Photo, Link, etc... ) + Ajax Support Page : 12
  • 14. See demohttp://croquis.fungoing.jp/ Page : 13