<commit_before>###
Handler for Fermentable GET calls

@author <NAME>
@copyright 2015 Microbrew.it
###

RouteHandler = require '../../core/RouteHandler'

class SingleHandler extends RouteHandler

	_getBrewers: (beer) ->
		brewers = []
		for brewer in beer.brewers
			brewers.push "<a href=\"users/#{brewer.username}\">#{brewer.username}</a>"

	_createSubNav: (beer, user) ->
		if user
			subNav = [
				{href: "/beers/#{beer.id}", label: 'Recipe', activeState: 'recipe'}
				{href: "/beers/#{beer.id}/fork", label: 'Fork', activeState: 'fork'}
			]

			if @userUtils.canEdit(user, beer)
				subNav.push {href: "/beers/#{beer.id}/edit", label: 'Edit', activeState: 'edit'}

	getRoute: () ->
		super [
			{ 
				path: '/beers/add'
				method: 'GET'
				handler: (req, reply) => 
					@onRequest(req, reply, 'Add new beer', 'recipe')
			}
			{ 
				path: '/beers/{id}/edit'
				method: 'GET'
				handler: (req, reply) => 
					@onRequest(req, reply, "Edit #{req.params.id}", 'recipe')
			}
			{ 
				path: '/beers/{id}/fork'
				method: 'GET'
				handler: (req, reply) => 
					@onRequest(req, reply,  "Fork #{req.params.id}", 'beers')<commit_msg>Require authentication in recipe routes<commit_after>###
Handler for Fermentable GET calls

@author <NAME>
@copyright 2015 Microbrew.it
###

RouteHandler = require '../../core/RouteHandler'

class SingleHandler extends RouteHandler

	_getBrewers: (beer) ->
		brewers = []
		for brewer in beer.brewers
			brewers.push "<a href=\"users/#{brewer.username}\">#{brewer.username}</a>"

	_createSubNav: (beer, user) ->
		if user
			subNav = [
				{href: "/beers/#{beer.id}", label: 'Recipe', activeState: 'recipe'}
				{href: "/beers/#{beer.id}/fork", label: 'Fork', activeState: 'fork'}
			]

			if @userUtils.canEdit(user, beer)
				subNav.push {href: "/beers/#{beer.id}/edit", label: 'Edit', activeState: 'edit'}

	getRoute: () ->
		super [
			{ 
				path: '/beers/add'
				method: 'GET'
				auth: true
			}
			{ 
				path: '/beers/{id}/edit'
				method: 'GET'
				auth: true
				handler: (req, reply) => 
					@onRequest(req, reply, "Edit #{req.params.id}", 'recipe')
			}
			{ 
				path: '/beers/{id}/fork'
				method: 'GET'
				auth: true
				handler: (req, reply) => 
					@onRequest(req, reply,  "Fork #{req.params.id}", 'beers')
{'fraction_non_alphanumeric': 0.1948966124065112, 'fraction_numerical': 0.0035195776506819184, 'mean_word_length': 3.1420765027322406, 'pattern_counts': {'":': 0, '<': 9, '<?xml version=': 0, '>': 20, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, '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': '4138845', 'n_tokens_mistral': 1002, 'n_tokens_neox': 841, 'n_words': 190}