Profile: group member listing is moved under current feed controller

--- client/Social/Members/AppController.coffee
+++ client/Social/Members/AppController.coffee
@@ -2,12 +2,15 @@

   KD.registerAppClass this,
     name         : "Members"
-    route        : "/:name?/Members"
+    routes       :
+      "/:name?/Members" : ({params, query}) ->
+        {router, appManager} = KD.singletons
+        KD.getSingleton('groupsController').ready ->
+          group = KD.getSingleton('groupsController').getCurrentGroup()
+          KD.getSingleton("appManager").tell 'Members', 'createContentDisplay', group, (contentDisplay) ->
+            contentDisplay.emit "handleQuery", {filter: "members"}
+
     hiddenHandle : yes
-    # navItem      :
-    #   title      : "Members"
-    #   path       : "/Members"
-    #   order      : 30

   {externalProfiles} = KD.config

@@ -24,7 +27,7 @@

     @on "LazyLoadThresholdReached", => @feedController?.loadFeed()

-  createContentDisplay:(account, callback)->
+  createContentDisplay:(account, callback=->)->
     KD.singletons.appManager.setFrontApp this
     contentDisplay = new KDView
       cssClass : 'member content-display'
@@ -32,8 +35,15 @@
     contentDisplay.on 'handleQuery', (query)=>
       @ready => @feedController?.handleQuery? query

-    @addProfileView contentDisplay, account
-    @addActivityView contentDisplay, account
+    contentDisplay.once 'KDObjectWillBeDestroyed', ->
+      KD.singleton('appManager').tell 'Activity', 'resetProfileLastTo'
+
+    {JAccount} = KD.remote.api
+    if account instanceof JAccount
+      @addProfileView contentDisplay, account
+      @addActivityView contentDisplay, account
+    else
+      @addActivityView contentDisplay, KD.whoami()
     @showContentDisplay contentDisplay
     @utils.defer -> callback contentDisplay

@@ -95,6 +105,25 @@
           dataSource        : (selector, options, callback)->
             selector = {sourceName: $in: ['JNewStatusUpdate']}
             account.fetchLikedContents options, selector, callback
+        members              :
+          noItemFoundText    : "There is no member."
+          optional_title     : if @_searchValue then "" else null
+          itemClass          : GroupMembersPageListItemView
+          listControllerClass: MembersListViewController
+          dataSource         : (selector, options, callback)=>
+            {JAccount} = KD.remote.api
+            if @_searchValue
+              @setCurrentViewHeader "Searching for #{@_searchValue}..."
+              JAccount.byRelevance @_searchValue, options, callback
+            else
+              group = KD.getSingleton('groupsController').getCurrentGroup()
+              group.fetchMembers selector, options, (err, res)=>
+                KD.mixpanel "Load member list, success"  unless err
+                callback err, res
+
+              group.countMembers (err, count) =>
+                count = 0 if err
+                @setCurrentViewNumber 'all', count
       sort                  :
         'modifiedAt'        :
           title             : "Latest activity"
@@ -128,54 +157,6 @@
       options.bind = "mouseenter" unless KD.isMine member

     return view.addSubView memberProfile = new ProfileView options, member
-
-  createFeed:(view, loadFeed = no)->
-    @appManager.tell 'Feeder', 'createContentFeedController', {
-      feedId                : 'members.main'
-      itemClass             : GroupMembersPageListItemView
-      listControllerClass   : MembersListViewController
-      useHeaderNav          : yes
-      noItemFoundText       : "There is no member."
-      limitPerPage          : 20
-      delegate              : this
-      help                  :
-        subtitle            : "Learn About Members"
-        bookIndex           : 11
-        tooltip             :
-          title             : "
These people are all members of koding.com. Learn more about them and their interests, activity and coding prowess here.
"
-          placement         : "above"
-      filter                :
-        everything          :
-          title             : ""
-          optional_title    : if @_searchValue then "" else null
-          dataSource        : (selector, options, callback)=>
-            {JAccount} = KD.remote.api
-            if @_searchValue
-              @setCurrentViewHeader "Searching for #{@_searchValue}..."
-              JAccount.byRelevance @_searchValue, options, callback
-            else
-              group = KD.getSingleton('groupsController').getCurrentGroup()
-              group.fetchMembers selector, options, (err, res)=>
-                callback err, res
-
-              group.countMembers (err, count) =>
-                count = 0 if err
-                @setCurrentViewNumber 'all', count
-
-      sort                  :
-        'meta.modifiedAt'   :
-          title             : "Latest activity"
-          direction         : -1
-    }, (controller)=>
-      @feedController = controller
-      @feedController.loadFeed() if loadFeed
-      view.addSubView @_lastSubview = controller.getView()
-      @emit 'ready'
-      controller.on "FeederListViewItemCountChanged", (count, filter)=>
-        if @_searchValue and filter is 'everything'
-          @setCurrentViewHeader count
-
-      KD.mixpanel "Load member list, success"

   loadView:(mainView, firstRun = yes, loadFeed = no)->
     if firstRun


groups: default readme synced w/ backend and frontend

--- client/app/Applications/Groups.kdapplication/Views/readmeview.coffee
+++ client/app/Applications/Groups.kdapplication/Views/readmeview.coffee
@@ -59,11 +59,24 @@
     @readmeSaveButton.show()
     @readmeCancelLink.show()

+  defaultGroupReadme = (title)->
+    """
+
Hello!

+
Welcome to the #{title} group on Koding.

+
Talk.

+
Looking for people who share your interest? You are in the right place. And you can discuss your ideas, questions and problems with them easily.

+
Share.

+
Here you will be able to find and share interesting content. Experts share their wisdom through links or tutorials, professionals answer the questions of those who want to learn.

+
Collaborate.

+
You will be able to share your code, thoughts and designs with like-minded enthusiasts, discussing and improving it with a community dedicated to improving each other's work.

+
Go ahead, the members of #{title} are waiting for you.

+    """
+
   viewAppended:->
     group = @getData()
     group.fetchReadme (err, readme)=>
-      unless err
-        partial = readme?.content or "This group does not have any associated readme data yet."
+      if not err and readme?
+        partial = readme.content or getDefaultGroupReadme group.title
         group.canEditGroup (err, allowed)=>
           @readmeEditButton.show() if allowed
       else


code cleanup

code cleanup

--- client/landing/app/CommonViews/SkillTagAutoCompleteController.coffee
+++ client/landing/app/CommonViews/SkillTagAutoCompleteController.coffee
@@ -13,8 +13,7 @@
         title   : 1
     , (err, tags) =>
         unless err and not tags
-          @setDefaultValue tags
-        else
-          warn "There was a problem fetching default tags!", err, tags
+        then @setDefaultValue tags
+        else warn "There was a problem fetching default tags!", err, tags

   getCollectionPath: -> 'skillTags'


fixed bug with not showing colors

fixed bug with not showing colors

--- src/scripts/display.canvas.coffee
+++ src/scripts/display.canvas.coffee
@@ -35,6 +35,7 @@
   images = []
   numColors = 0
   srcPath = ""
+  imagePath = ""

   ###*
   # @method init init the module
@@ -59,6 +60,8 @@
     numColors = _options.numColors
     availableColoursCount = _options.availableColours
     imageSize = _options.imageSize
+
+    imagePath = srcPath + "images/forms_" + imageSize + ".png"

     canvas = document.createElement("canvas")
     ctx = canvas.getContext("2d")
@@ -265,7 +268,7 @@
   # @param {Array} guessColors
   ###
   drawSolution = (guessColors) ->
-    image = images["images/forms_" + imageSize + ".png"]
+    image = images[imagePath]
     len = guessColors.length

     for x in [0..len-1]
@@ -284,7 +287,7 @@
   # @method drawAvailableColours draws the available colours
   ###
   drawAvailableColours = () ->
-    image = images[srcPath + "images/forms_" + imageSize + ".png"]
+    image = images[imagePath]

     for x in [0..availableColoursCount-1]
       availableColorsCtx.drawImage(image, x*imageSize, 0, imageSize, imageSize, x * imageSize, 0, imageSize, imageSize)
@@ -336,7 +339,7 @@
       return null

     # draw image
-    image = images["images/forms_" + imageSize + ".png"];
+    image = images[imagePath];
     ctx.drawImage(image, type * imageSize, 0, imageSize, imageSize, x * imageSize, y*imageSize, imageSize, imageSize)
     return null


fix for 963_coffee_parsing_error

fix for 963_coffee_parsing_error

--- drivers/javascript/src/net.coffee
+++ drivers/javascript/src/net.coffee
@@ -128,9 +128,8 @@
         @outstandingCallbacks = {}

     reconnect: ar (callback) ->
-        setTimeout(
-            () => @constructor.call(@, {host:@host, port:@port}, callback)
-           ,0)
+        cb = => @constructor.call(@, {host:@host, port:@port}, callback)
+        setTimeout(cb, 0)

     use: ar (db) ->
         @db = db


make logging tests work deterministically

--- tests/logging_tests.coffee
+++ tests/logging_tests.coffee
@@ -1,27 +1,31 @@
 # Server methods
 if Meteor.isServer

-  # Clear anything in logs
   Meteor.methods
-    clearLogs: -> Logs.remove({})
+    # Clear anything in logs for the given group
+    clearLogs: ->
+      Partitioner.group()
+      Logs.remove
+        _groupId: Partitioner.group()
+      return
     getLogs: (selector) ->
       return Logs.find(selector || {}).fetch()

   Tinytest.addAsync "logging - server group binding", (test, next) ->
     Partitioner.bindGroup "poop", ->
+      Meteor.call "clearLogs"
       TurkServer.log
         boo: "hoo"

-      doc = Logs.findOne(boo: "hoo")
+    doc = Logs.findOne(boo: "hoo")

-      test.equal doc.boo, "hoo"
-      test.isTrue doc._groupId
-      test.isTrue doc._timestamp
-      next()
+    test.equal doc.boo, "hoo"
+    test.isTrue doc._groupId
+    test.isTrue doc._timestamp
+    next()

 # Client methods
 if Meteor.isClient
-
   Tinytest.addAsync "logging - initialize test", (test, next) ->
     Meteor.call "clearLogs", (err, res) ->
       test.isFalse err


set session and cookie

set session and cookie

--- config.coffee
+++ config.coffee
@@ -13,6 +13,9 @@
   API_URL: "http://staging.are.na/v2"
   #API_URL: "http://arenaprototyperefactorb843.ninefold-apps.com/v3"
   #API_URL: "http://localhost:3000/v2"
+  SESSION_SECRET: 'change-me'
+  SESSION_COOKIE_MAX_AGE: 31536000000
+  SESSION_COOKIE_KEY: 'arena.session'

 # Override any values with env variables if they exist
 module.exports[key] = (process.env[key] or val) for key, val of module.exports


check for a git repo; none on heroku

check for a git repo; none on heroku

--- config.coffee
+++ config.coffee
@@ -1,3 +1,4 @@
+fs = require 'fs'
 pkg = require './package.json'
 phonetic = require 'phonetic'

@@ -20,7 +21,11 @@
   tastesDir: 'tastes'      # where are tastes stored
   git: {
     enable: true           # enable git versioning for tastes
-    remoteUrl: "#{__dirname}/.git" # enable pushing automatically to a remote
+    remoteUrl: do () ->    # enable pushing automatically to a remote
+      if fs.existsSync '.git'
+        "#{__dirname}/.git"
+      else
+        undefined
     upstream: 'tastes'     # which upstream branch to push to?
   }
   maxListCount: 100        # list only the most recent 100 tastes


OX-122 Make Active Node blue

OX-122 Make Active Node blue

--- app/assets/javascripts/geometries/skeleton.coffee
+++ app/assets/javascripts/geometries/skeleton.coffee
@@ -38,7 +38,7 @@
     @activeNode = new THREE.Mesh(
         new THREE.SphereGeometry(1 / @model.Route.scaleX),
         new THREE.MeshLambertMaterial({
-          color : 0xff0000
+          color : 0x0000ff
           #transparent: true
           #opacity: 0.5 })
           })
@@ -132,11 +132,16 @@
   setActiveNode : () =>
     id = @model.Route.getActiveNodeId()
     position = @model.Route.getActiveNodePos()
+    if @activeNodeSphere
+      @activeNodeSphere.visible = true
     # May be null
     @lastNodePosition = position
     if position
       @activeNode.visible = true
       @activeNodeSphere = @getSphereIndexFromId(id)
+      # Hide activeNodeSphere, because activeNode is visible anyway
+      if @activeNodeSphere
+        @activeNodeSphere.visible = false
       @setNodeRadius(@model.Route.getActiveNodeRadius())
       @activeNode.position = new THREE.Vector3(position[0], position[1], position[2])
     else
@@ -250,4 +255,5 @@
   setDisplaySpheres : (value) ->
     @disSpheres = value
     for sphere in @nodesSpheres
-      sphere.visible = value
+      if sphere != @activeNodeSphere
+        sphere.visible = value


Events append colored, instead of needing update

--- app/assets/javascripts/matches/eventlog.js.coffee
+++ app/assets/javascripts/matches/eventlog.js.coffee
@@ -59,14 +59,10 @@
     # fadeout highlight over 30 in-game seconds
     # hsl(50,1,0.5).brighter(x) turns to white between x=1.9 and x=2
     #events.filter((d) -> this.style.backgroundColor isnt "rgb(255,255,255)")
-    events.style('background-color', (d) -> d3.hsl(50, 1, 0.5).brighter((time - d.time) / 15))

     # add new events to the top of the eventlog div
     new_event = events.enter().insert('p', ":first-child")
-      #.style('background-color', 'yellow')
-    #new_event.transition()
-    #  .duration(15000)
-    #  .style('background-color', 'white')
+    events.style('background-color', (d) -> d3.hsl(50, 1, 0.5).brighter((time - d.time) / 15))
     new_event.append('small')
       .text((d) -> window.DOTA2RAILS.matches.utils.formatTime(d.time))
       .style('padding-right', '2em')


Bugfix, check all

Bugfix, check all

--- app/assets/javascripts/responsibilities.js.coffee
+++ app/assets/javascripts/responsibilities.js.coffee
@@ -1,5 +1,5 @@
-# Autocomplete search for responsibilities
 $ ->
+  # Autocomplete search for responsibilities
   $("#search-responsibility #term").focus().autocomplete
     source: $("#search-responsibility").attr("action")
     minLength: 2


fixed a typo

fixed a typo

--- assets/coffee/jquery.alphabet-soup.coffee
+++ assets/coffee/jquery.alphabet-soup.coffee
@@ -11,7 +11,7 @@
   transitions: [
     "linear",
     "ease",
-    "easIn",
+    "easeIn",
     "easeOut",
     "easeInOut",
     "easeInQuad",


Remove console.log of language.

Remove console.log of language.

--- assets/scripts/app/views/repo/show.coffee
+++ assets/scripts/app/views/repo/show.coffee
@@ -239,7 +239,6 @@
     ).property('tab')

     displayCodeClimate: (->
-      console.log @get('repo.githubLanguage')
       Travis.config.code_climate == "true" and @get('repo.githubLanguage') == 'Ruby'
     ).property('repo.githubLanguage')


query() tests for Server

query() tests for Server

--- src/tests/spec/server.spec.coffee
+++ src/tests/spec/server.spec.coffee
@@ -189,3 +189,33 @@
 								])
 							allNodes = server.getNodes()
 							expect(allNodes.length).toEqual(3)
+
+					describe 'when queried', ->
+						it 'should reply "pong" to a "ping" query', ->
+							result = server.query('ping')
+							expect(result).toBe('pong')
+
+						it 'should reply all serialized nodes on a "nodes" query', ->
+							fakeNode1 = {
+								a: 1
+								b: 2
+								id: '1'
+								serialize: =>
+									return '[1]'
+							}
+							fakeNode2 = {
+								c: 3
+								d: 4
+								id: '2'
+								serialize: =>
+									return '[2]'
+							}
+							server.addNode(fakeNode1)
+							server.addNode(fakeNode2)
+
+							result = server.query('nodes')
+
+							expect(result).toEqual([
+									'[1]'
+									'[2]'
+								])


closes #311

closes #311

--- src/textwrap/helpers/tspan.coffee
+++ src/textwrap/helpers/tspan.coffee
@@ -15,7 +15,7 @@
       .attr "dx", dx + "px"
       .attr "dy", dy + "px"
       .style "baseline-shift", "0%"
-      .attr "dominant-baseline", "alphabetical"
+      .attr "dominant-baseline", "alphabetic"
       .text w

   mirror = vars.rotate.value is -90 or vars.rotate.value is 90


Add autocomplete-emojis package to Atom

Add autocomplete-emojis package to Atom

--- atom/packages.cson
+++ atom/packages.cson
@@ -1,4 +1,5 @@
 packages: [
+  "autocomplete-emojis"
   "editorconfig"
   "file-icons"
   "highlight-selected"


added case insentive contains

added case insentive contains

--- app/coffee/drm-tablefilter/drm-tablefilter.coffee
+++ app/coffee/drm-tablefilter/drm-tablefilter.coffee
@@ -2,6 +2,13 @@
 # Filter Tabular Data
 ###############################################################################
 "use strict"
+
+# adds case insensitive contains to jQuery
+
+$.extend $.expr[":"], {
+    "containsNC": (elem, i, match, array) ->
+        (elem.textContent || elem.innerText || "").toLowerCase().indexOf((match[3] || "").toLowerCase()) >= 0
+}

 ( ($) ->
     class window.DrmTableFilter
@@ -14,16 +21,16 @@

             self.table.on 'keyup', "input.#{@searchInput}", ->
                 that = $ @
-                input = $.trim(that.val())
+                input = $.trim(that.val()).toLowerCase()
                 columnNum = that.closest('th').index()
                 self.renderTable columnNum, input

         filterRows: (columnNum, input) =>
-            rows = if input.length is 0 then @fullRows else @fullRows.has "td:eq(#{columnNum}):contains(#{input})"
+            rows = if input.length is 0 then @fullRows else @fullRows.has "td:eq(#{columnNum}):containsNC(#{input})"

         renderTable: (columnNum, input) =>
+            tableBody = @table.find('tbody').empty()
             filteredRows = @filterRows columnNum, input
-            tableBody = @table.find('tbody').empty()

             $.each filteredRows, (key, value) ->
                 tableBody.append value


fix test for ios 4.3

fix test for ios 4.3

--- test/browser/src/space/rgb.coffee
+++ test/browser/src/space/rgb.coffee
@@ -100,7 +100,9 @@
         C.rgb 1, 1, 1
       ]

-      for rgbSpaceName, rgbSpace of C.space.rgb
+      for own rgbSpaceName, rgbSpace of C.space.rgb
+        if rgbSpaceName == "prototype" # on ios 4.3 / 10.6 the prototype property gets iterable. why?
+          continue
         for rgbCol in rgbTest
           xyzCol = rgbSpace.XYZ rgbCol
           for whiteName, white of C.white


Removing the 'register' CLI command

Removing the 'register' CLI command

--- cli/commands/register.coffee
+++ cli/commands/register.coffee
@@ -1,63 +0,0 @@
-#
-# Handles the new user registration
-#
-# Copyright (C) 2011 Nikolay Nemshilov
-#
-
-stdin  = process.stdin
-stdout = process.stdout
-
-# a little helper to ask the user for data
-ask_for = (intro, format, callback) ->
-  stdin.resume()
-
-  stdout.write intro + " » ".grey
-  stdin.once 'data', (data) ->
-    data = data.toString().trim()
-
-    if format.test(data)
-      callback(data)
-    else
-      stdout.write "It should match: ".red + format.toString().yellow + "\n"
-      ask_for intro, format, callback
-
-
-exports.init = (args) ->
-  email_re    = /^[a-z0-9\-\.]+@[a-z0-9\-\.]+\.[a-z]{2,4}$/i
-  username_re = /^[a-z0-9][a-z0-9\-\_]+[a-z0-9]$/i
-  realname_re = /^[a-z0-9 ]+$/i
-
-  stdout.write(
-    "New user registration:\n" +
-    "Press Ctrl+D if you wanna stop\n\n"
-  )
-
-  ask_for "Email", email_re, (email) ->
-    ask_for "Username", username_re, (username) ->
-      ask_for "Realname", realname_re, (realname) ->
-        stdout.write """
-
-        So, your name is: #{realname}
-        your email is:    #{email}
-        and username is:  #{username}
-
-        Proceed? (#{"y/n".yellow}) #{"» ".grey}
-        """
-
-        stdin.once 'data', (data) ->
-          if data.toString().toLowerCase().trim() is 'y'
-            stdout.write "\nConnecting to the server...\n"
-
-          process.exit()
-
-
-exports.help = (args) ->
-  """
-  Registers a new user on the lovely.io site
-
-  Usage:
-      lovely register
-
-  It will talk you through it
-
-  """


Logging.

Logging.

--- src/adapters/campfire.coffee
+++ src/adapters/campfire.coffee
@@ -40,7 +40,7 @@

     withSelf = (callback) -> (id, created, room, user, body) ->
       bot.Me (selfData) ->
-        console.log selfdata
+        console.log selfData

     bot.on "TextMessage", withAuthor (id, created, room, user, body, author) ->
       unless bot.info.id == author.id


switch contact to cozydb class

switch contact to cozydb class

--- server/models/contact.coffee
+++ server/models/contact.coffee
@@ -4,20 +4,22 @@
 log = require('../utils/logging')(prefix: 'models:contact')
 stream = require 'stream'

-module.exports = Contact = cozydb.getModel 'Contact',
-    id            : String
-    fn            : String
-    n             : String
-    datapoints    : cozydb.NoSchema
-    note          : String
-    tags          : [String]
-    revision      : String
-    _attachments  : Object
+module.exports = class Contact extends cozydb.CozyModel

-Contact::includePicture = (callback) ->
-    unless @_attachments?.picture
-        callback null, this
-    else
+    @docType : 'contact'
+    @schema:
+        id            : String
+        fn            : String
+        n             : String
+        datapoints    : cozydb.NoSchema
+        note          : String
+        tags          : [String]
+        revision      : String
+        _attachments  : Object
+
+    includePicture: (callback) ->
+        return callback null, this unless @_attachments?.picture
+
         pictureStream = @getFile 'picture', (err) =>
             log.error "Contact #{@id} getting picture", err if err?

@@ -37,45 +39,45 @@

         pictureStream.pipe bufferer

-# @TODO try Couchdb ?attachments=true
-Contact.requestWithPictures = (name, options, callback) ->
-    log.info "requestWithPictures"
-    Contact.request name, options, (err, contacts) ->
-        outids = []
-        out = []
-        if contacts?
-            async.eachSeries contacts, (contact, cb)  ->
-                return cb null if contact.id in outids
-                contact.includePicture (err, contactWIthPicture) ->
-                    return cb err if err
-                    outids.push contact.id
-                    out.push contactWIthPicture
-                    cb null
+    # @TODO try Couchdb ?attachments=true
+    @requestWithPictures: (name, options, callback) ->
+        log.info "requestWithPictures"
+        Contact.request name, options, (err, contacts) ->
+            outids = []
+            out = []
+            if contacts?
+                async.eachSeries contacts, (contact, cb)  ->
+                    return cb null if contact.id in outids
+                    contact.includePicture (err, contactWIthPicture) ->
+                        return cb err if err
+                        outids.push contact.id
+                        out.push contactWIthPicture
+                        cb null

-            , (err) ->
-                callback err, out
-        else
-            callback null, []
+                , (err) ->
+                    callback err, out
+            else
+                callback null, []

-Contact.list = (callback) ->
-    Contact.request 'all', callback
+    @list: (callback) ->
+        Contact.request 'all', callback

-Contact.createNoDuplicate = (data, callback) ->
-    log.info "createNoDuplicate"
-    key = data.address
-    Contact.request 'mailByEmail',
-        key: data.address
+    @createNoDuplicate: (data, callback) ->
+        log.info "createNoDuplicate"
+        key = data.address
+        Contact.request 'mailByEmail',
+            key: data.address

-    , (err, existings) ->
-        return callback err if err
-        return callback null, existings if existings?.length > 0
+        , (err, existings) ->
+            return callback err if err
+            return callback null, existings if existings?.length > 0

-        contact =
-            fn: data.name
-            datapoints: [
-              name: "email", value: data.address
-            ]
+            contact =
+                fn: data.name
+                datapoints: [
+                  name: "email", value: data.address
+                ]

-        Contact.create contact, (err, created) ->
-            return callback err if err
-            Contact.request 'mailByEmail', key: key, callback
+            Contact.create contact, (err, created) ->
+                return callback err if err
+                Contact.request 'mailByEmail', key: key, callback


quick fix

quick fix

--- controllers/teams.coffee
+++ controllers/teams.coffee
@@ -119,7 +119,11 @@
           if yeah
             res.render2 'teams/reg_code', regCode: code, limit: limit
           else
-            res.render2 'teams/max'
+            Team.canRegister null, (err, yeah) ->
+              if yeah
+                res.redirect "/teams/new"
+              else
+                res.render2 'teams/max'
       else
         req.flash 'info', """
           Sorry, we were unable to find registration code for #{code}