From c01795af2a8e2f85bd00c95c24930dd292dfa840 Mon Sep 17 00:00:00 2001 From: Blade Barringer Date: Sat, 19 Sep 2015 19:36:35 -0500 Subject: [PATCH] Move user defaults to separate module --- common/script/content/index.coffee | 25 +-------- common/script/src/content/user-defaults.js | 60 ++++++++++++++++++++++ 2 files changed, 61 insertions(+), 24 deletions(-) create mode 100644 common/script/src/content/user-defaults.js diff --git a/common/script/content/index.coffee b/common/script/content/index.coffee index 4c35375f07..ce4a551299 100644 --- a/common/script/content/index.coffee +++ b/common/script/content/index.coffee @@ -1768,30 +1768,7 @@ api.subscriptionBlocks = basic_12mo: months:12, price:48 _.each api.subscriptionBlocks, (b,k)->b.key = k -# repeat = {m:true,t:true,w:true,th:true,f:true,s:true,su:true} -api.userDefaults = - habits: [ - {type: 'habit', text: t('defaultHabit1Text'), value: 0, up: true, down: false, attribute: 'per' } - {type: 'habit', text: t('defaultHabit2Text'), value: 0, up: false, down: true, attribute: 'str'} - {type: 'habit', text: t('defaultHabit3Text'), value: 0, up: true, down: true, attribute: 'str'} - ] - - dailys: [ - ] - - todos: [ - {type: 'todo', text: t('defaultTodo1Text'), notes: t('defaultTodoNotes'), completed: false, attribute: 'int' } - ] - - rewards: [ - {type: 'reward', text: t('defaultReward1Text'), value: 10 } - ] - - tags: [ - {name: t('defaultTag1')} - {name: t('defaultTag2')} - {name: t('defaultTag3')} - ] +api.userDefaults = require('../../dist/scripts/content/user-defaults') api.faq = require "../../dist/scripts/content/faq" diff --git a/common/script/src/content/user-defaults.js b/common/script/src/content/user-defaults.js new file mode 100644 index 0000000000..b8c85d74cc --- /dev/null +++ b/common/script/src/content/user-defaults.js @@ -0,0 +1,60 @@ +let habits = [ + { + type: 'habit', + text: t('defaultHabit1Text'), + value: 0, + up: true, + down: false, + attribute: 'per', + }, { + type: 'habit', + text: t('defaultHabit2Text'), + value: 0, + up: false, + down: true, + attribute: 'str', + }, { + type: 'habit', + text: t('defaultHabit3Text'), + value: 0, + up: true, + down: true, + attribute: 'str', + } +]; + +let dailys = []; + +let todos = [ + { + type: 'todo', + text: t('defaultTodo1Text'), + notes: t('defaultTodoNotes'), + completed: false, + attribute: 'int', + } +]; + +let rewards = [ + { + type: 'reward', + text: t('defaultReward1Text'), + value: 10, + } +]; + +let tags = [ + { name: t('defaultTag1') }, + { name: t('defaultTag2') }, + { name: t('defaultTag3') }, +] + +let userDefaults = { + habits: habits, + dailys: dailys, + todos: todos, + rewards: rewards, + tags: tags +}; + +export default userDefaults;