Browse Source

feat: add options UI for sync

Gerald 9 years ago
parent
commit
19e2454f2f

+ 16 - 0
src/_locales/cs/messages.json

@@ -429,5 +429,21 @@
   "buttonInstallFromURL": {
     "description": "Button to ask for URL of a user script.",
     "message": "Instalovat vzdálený skript"
+  },
+  "labelSync": {
+    "description": "Label for sync options.",
+    "message": ""
+  },
+  "labelSyncDropbox": {
+    "description": "Label for sync to dropbox option.",
+    "message": ""
+  },
+  "buttonAuthorize": {
+    "description": "Button to authorize permissions for sync.",
+    "message": ""
+  },
+  "buttonAuthorized": {
+    "description": "Button shown when permissions are already authorized for sync.",
+    "message": ""
   }
 }

+ 16 - 0
src/_locales/de/messages.json

@@ -429,5 +429,21 @@
   "buttonInstallFromURL": {
     "description": "Button to ask for URL of a user script.",
     "message": ""
+  },
+  "labelSync": {
+    "description": "Label for sync options.",
+    "message": ""
+  },
+  "labelSyncDropbox": {
+    "description": "Label for sync to dropbox option.",
+    "message": ""
+  },
+  "buttonAuthorize": {
+    "description": "Button to authorize permissions for sync.",
+    "message": ""
+  },
+  "buttonAuthorized": {
+    "description": "Button shown when permissions are already authorized for sync.",
+    "message": ""
   }
 }

+ 16 - 0
src/_locales/en/messages.json

@@ -429,5 +429,21 @@
   "buttonInstallFromURL": {
     "description": "Button to ask for URL of a user script.",
     "message": "Install from URL"
+  },
+  "labelSync": {
+    "description": "Label for sync options.",
+    "message": "Sync"
+  },
+  "labelSyncDropbox": {
+    "description": "Label for sync to dropbox option.",
+    "message": "Sync to Dropbox"
+  },
+  "buttonAuthorize": {
+    "description": "Button to authorize permissions for sync.",
+    "message": "Authorize"
+  },
+  "buttonAuthorized": {
+    "description": "Button shown when permissions are already authorized for sync.",
+    "message": "Authorized"
   }
 }

+ 16 - 0
src/_locales/pl/messages.json

@@ -429,5 +429,21 @@
   "buttonInstallFromURL": {
     "description": "Button to ask for URL of a user script.",
     "message": ""
+  },
+  "labelSync": {
+    "description": "Label for sync options.",
+    "message": ""
+  },
+  "labelSyncDropbox": {
+    "description": "Label for sync to dropbox option.",
+    "message": ""
+  },
+  "buttonAuthorize": {
+    "description": "Button to authorize permissions for sync.",
+    "message": ""
+  },
+  "buttonAuthorized": {
+    "description": "Button shown when permissions are already authorized for sync.",
+    "message": ""
   }
 }

+ 16 - 0
src/_locales/ru/messages.json

@@ -429,5 +429,21 @@
   "buttonInstallFromURL": {
     "description": "Button to ask for URL of a user script.",
     "message": "Установить по ссылке"
+  },
+  "labelSync": {
+    "description": "Label for sync options.",
+    "message": ""
+  },
+  "labelSyncDropbox": {
+    "description": "Label for sync to dropbox option.",
+    "message": ""
+  },
+  "buttonAuthorize": {
+    "description": "Button to authorize permissions for sync.",
+    "message": ""
+  },
+  "buttonAuthorized": {
+    "description": "Button shown when permissions are already authorized for sync.",
+    "message": ""
   }
 }

+ 17 - 1
src/_locales/zh/messages.json

@@ -429,5 +429,21 @@
   "buttonInstallFromURL": {
     "description": "Button to ask for URL of a user script.",
     "message": "通过地址安装"
+  },
+  "labelSync": {
+    "description": "Label for sync options.",
+    "message": ""
+  },
+  "labelSyncDropbox": {
+    "description": "Label for sync to dropbox option.",
+    "message": ""
+  },
+  "buttonAuthorize": {
+    "description": "Button to authorize permissions for sync.",
+    "message": ""
+  },
+  "buttonAuthorized": {
+    "description": "Button shown when permissions are already authorized for sync.",
+    "message": ""
   }
-}
+}

+ 1 - 1
src/background/sync/index.js

@@ -164,7 +164,7 @@ var sync = function () {
         getRemote.map(function (item) {
           console.log('Download script:', item.uri);
           return service.inst.get(getFilename(item.uri)).then(function (code) {
-            return vmdb.parseScript({
+            return commands.ParseScript({
               code: code,
               modified: item.modified,
             });

+ 18 - 0
src/options/templates/tab-settings.html

@@ -36,4 +36,22 @@
     <button id=bSelect data-i18n=buttonAllNone></button>
     <button id=bExport data-i18n=buttonExportData></button>
   </fieldset>
+  <fieldset class=title>
+    <legend data-i18n=labelSync></legend>
+    <div>
+      <label>
+        <input id=cbSyncDropbox type=checkbox data-check=dropboxEnabled <%=
+        it.dropboxEnabled ? 'checked' : ''
+        %> <%=
+        it.dropboxAuthorized ? '' : 'disabled'
+        %>>
+        <span data-i18n=labelSyncDropbox></span>
+      </label>
+      <button <%=
+        it.dropboxAuthorized ? 'disabled' : ''
+      %>><%=
+        it.dropboxAuthorized ? _.i18n('buttonAuthorized') : _.i18n('buttonAuthorize')
+      %></button>
+    </div>
+  </fieldset>
 </div>