Skip to content
Snippets Groups Projects
Commit 295f3b3c authored by Marcelo Schmidt's avatar Marcelo Schmidt
Browse files

Settings collection and predefined records

parent 02bc97f6
No related branches found
No related tags found
No related merge requests found
@Settings = new Meteor.Collection 'settings'
@UserAndRoom = new Meteor.Collection null
@ChatMessageHistory = new Meteor.Collection null
......
......@@ -5,7 +5,7 @@ Router.configure
waitOn: ->
if Meteor.userId()
return [Meteor.subscribe('userData'), Meteor.subscribe('activeUsers'), RoomManager.init()]
return [Meteor.subscribe('userData'), Meteor.subscribe('activeUsers'), Meteor.subscribe('settings'), RoomManager.init()]
onBeforeAction: ->
Session.set('openedRoom', null)
......
Template.body.onRendered ->
dataLayerComputation = Tracker.autorun ->
w = window
d = document
s = 'script'
l = 'dataLayer'
i = Settings.findOne('API.Analytics')?.value
if i
do (w,d,s,l,i) ->
w[l] = w[l] || []
w[l].push {'gtm.start': new Date().getTime(), event:'gtm.js'}
f = d.getElementsByTagName(s)[0]
j = d.createElement(s)
dl = if l isnt 'dataLayer' then '&l=' + l else ''
j.async = true
j.src = '//www.googletagmanager.com/gtm.js?id=' + i + dl
f.parentNode.insertBefore j, f
dataLayerComputation.stop()
\ No newline at end of file
......@@ -36,11 +36,4 @@
<link rel="apple-touch-startup-image" href="/images/logo/apple-touch-startup-image-2048x1496.png" media="screen and (min-device-width: 481px) and (max-device-width: 1024px) and (orientation:landscape) and (-webkit-min-device-pixel-ratio: 2)" /><!-- iPad (Retina) (Landscape) -->
</head>
<body>
<!-- Google Tag Manager -->
<script>(function(w,d,s,l,i){w[l]=w[l]||[];w[l].push({'gtm.start':
new Date().getTime(),event:'gtm.js'});var f=d.getElementsByTagName(s)[0],
j=d.createElement(s),dl=l!='dataLayer'?'&l='+l:'';j.async=true;j.src=
'//www.googletagmanager.com/gtm.js?id='+i+dl;f.parentNode.insertBefore(j,f);
})(window,document,'script','dataLayer','GTM-MLJ76N');</script>
<!-- End Google Tag Manager -->
</body>
Meteor.publish 'settings', ->
console.log '[publish] settings'.green
if this.userId
user = Meteor.users.findOne this.userId
if user.admin
return Settings.find()
return Settings.find { where: 'client' }, { fields: _id: 1, value: 1}
\ No newline at end of file
Meteor.startup ->
Migrations.add
version: 8
up: ->
console.log 'Add default settings'
# Accounts
# LDAP
Settings.upsert({ _id: "LDAP.Url" }, { $set: { type: "string", value: "", i18n_label: "LDAP_Url", group: "Accounts", where: [ 'server' ] } })
Settings.upsert({ _id: "LDAP.Port" }, { $set: { type: "string", value: "", i18n_label: "LDAP_Port", group: "Accounts", where: [ 'server' ] } })
Settings.upsert({ _id: "LDAP.DN" }, { $set: { type: "string_or_false", value: false, i18n_label: "LDAP_DN", group: "Accounts", where: [ 'client', 'server' ] } })
# Registration
Settings.upsert({ _id: "Accounts.RegistrationRequired" }, { $set: { type: "boolean", value: true, i18n_label: "Registration_required", group: "Accounts", where: [ 'server' ] } })
Settings.upsert({ _id: "Accounts.EmailVerification" }, { $set: { type: "boolean", value: true, i18n_label: "Email_verification", group: "Accounts", where: [ 'server' ] } })
# APIs
Settings.upsert({ _id: "API.Analytics" }, { $set: { type: "string", value: "", i18n_label: "Analytics_ID", group: "API", where: [ 'client' ] } })
Settings.upsert({ _id: "API.Piwik_URL" }, { $set: { type: "string", value: "", i18n_label: "Piwik_URL", group: "API", where: [ 'client' ] } })
Settings.upsert({ _id: "API.Piwik_ID" }, { $set: { type: "string", value: "", i18n_label: "Piwik_ID", group: "API", where: [ 'client' ] } })
# SMTP settings
Settings.upsert { _id: "SMTP.Host" }, { $set: { type: "string", value: "", i18n_label: "SMTP_host", group: "SMTP", where: [ 'server' ] } }
Settings.upsert { _id: "SMTP.Port" }, { $set: { type: "string", value: "", i18n_label: "SMTP_port", group: "SMTP", where: [ 'server' ] } }
Settings.upsert { _id: "SMTP.Security" }, { $set: { type: "string", value: "", i18n_label: "SMTP_security", group: "SMTP", where: [ 'server' ] } }
Settings.upsert { _id: "SMTP.Username" }, { $set: { type: "string", value: "", i18n_label: "SMTP_username", group: "SMTP", where: [ 'server' ] } }
Settings.upsert { _id: "SMTP.Password" }, { $set: { type: "string", value: "", i18n_label: "SMTP_password", group: "SMTP", where: [ 'server' ] } }
# Message editing
Settings.upsert { _id: "Message.Edit" }, { $set: { type: "boolean", value: true, i18n_label: "Allow_message_editing", group: "Message", where: [ 'server' ] } }
Settings.upsert { _id: "Message.Delete" }, { $set: { type: "boolean", value: true, i18n_label: "Allow_message_deleting", group: "Message", where: [ 'server' ] } }
Settings.upsert { _id: "Message.ShowEditedStatus" }, { $set: { type: "boolean", value: true, i18n_label: "Show_edited_status", group: "Message", where: [ 'server' ] } }
Settings.upsert { _id: "Message.ShowDeletedStatus" }, { $set: { type: "boolean", value: true, i18n_label: "Show_deleted_status", group: "Message", where: [ 'server' ] } }
Settings.upsert { _id: "Message.KeepStatusHistory" }, { $set: { type: "boolean", value: true, i18n_label: "Keep_status_history", group: "Message", where: [ 'server' ] } }
# Embedding
Settings.upsert { _id: "Embed.Enable" }, { $set: { type: "boolean", value: true, i18n_label: "Enable_embedding", group: "Embed", where: [ 'server' ] } }
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment