<commit_before>define [
	"utils/Modal"
	"account/AccountManager"
	"underscore"
], (Modal, accountManager, _) ->
	_.templateSettings = interpolate : /\{\{(.+?)\}\}/g
	POLLING_INTERVAL = 15
	ONE_MIN_MILI = 1000*60
	USER_LINKED_TEMPLATE = _.template($('#userLinkedToDropboxTemplate').html())

	class DropboxSettingsManger
		constructor: (@ide)->

			setup = _.once =>
				@tab = $("#dropboxProjectSettings")
				tabLink = $('#manageDropboxSettiingsTabLink').on 'click', (event)=>
					@tab.empty()
					if !@ide.isAllowedToDoIt "owner"
					else if !@project.get('features').dropbox
						ga('send', 'event', 'subscription-funnel', 'askToUpgrade', "dropdown")
						accountManager.askToUpgrade @ide,
							onUpgrade: =>
								@checkIfUserIsLinkedToDropbox()
								ga('send', 'event', 'subscription-funnel', 'upgraded-free-trial', "dropdown")
					else
						@checkIfUserIsLinkedToDropbox()

			@ide.on "afterJoinProject", (project) =>
				@project = project
				setup()

		checkIfUserIsLinkedToDropbox : =>
				@ide.socket.emit "getUserDropboxLinkStatus", @project.get("owner").id, (err, status)=>
					if status.registered
						@buildLinkedView()
					else
						@buildNonLinkedView()
		
		buildLinkedView: ->
			self = @<commit_msg>rename dropdown -> dropbox<commit_after>define [
	"utils/Modal"
	"account/AccountManager"
	"underscore"
], (Modal, accountManager, _) ->
	_.templateSettings = interpolate : /\{\{(.+?)\}\}/g
	POLLING_INTERVAL = 15
	ONE_MIN_MILI = 1000*60
	USER_LINKED_TEMPLATE = _.template($('#userLinkedToDropboxTemplate').html())

	class DropboxSettingsManger
		constructor: (@ide)->

			setup = _.once =>
				@tab = $("#dropboxProjectSettings")
				tabLink = $('#manageDropboxSettiingsTabLink').on 'click', (event)=>
					@tab.empty()
					if !@ide.isAllowedToDoIt "owner"
					else if !@project.get('features').dropbox
						ga('send', 'event', 'subscription-funnel', 'askToUpgrade', "dropbox")
						accountManager.askToUpgrade @ide,
							onUpgrade: =>
								@checkIfUserIsLinkedToDropbox()
								ga('send', 'event', 'subscription-funnel', 'upgraded-free-trial', "dropbox")
					else
						@checkIfUserIsLinkedToDropbox()

			@ide.on "afterJoinProject", (project) =>
				@project = project
				setup()

		checkIfUserIsLinkedToDropbox : =>
				@ide.socket.emit "getUserDropboxLinkStatus", @project.get("owner").id, (err, status)=>
					if status.registered
						@buildLinkedView()
					else
						@buildNonLinkedView()
		
		buildLinkedView: ->
			self = @
{'fraction_non_alphanumeric': 0.16096579476861167, 'fraction_numerical': 0.006438631790744467, 'mean_word_length': 3.8460038986354776, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 22, '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': '3522557', 'n_tokens_mistral': 1032, 'n_tokens_neox': 811, 'n_words': 140}