[devdocsgjs/main: 634/1867] Simplify layouts array




commit d63487d9738c2afa215d10f61e3ab047048cb82e
Author: Jasper van Merle <jaspervmerle gmail com>
Date:   Tue Jun 18 23:46:24 2019 +0200

    Simplify layouts array

 assets/javascripts/app/settings.coffee                | 7 ++-----
 assets/javascripts/views/content/settings_page.coffee | 2 +-
 2 files changed, 3 insertions(+), 6 deletions(-)
---
diff --git a/assets/javascripts/app/settings.coffee b/assets/javascripts/app/settings.coffee
index 5068a76c..daf3379a 100644
--- a/assets/javascripts/app/settings.coffee
+++ b/assets/javascripts/app/settings.coffee
@@ -19,7 +19,7 @@ class app.Settings
     'news'
   ]
 
-  LAYOUTS = ['_max-width', '_sidebar-hidden', '_native-scrollbars']
+  LAYOUTS: ['_max-width', '_sidebar-hidden', '_native-scrollbars']
   SIDEBAR_HIDDEN_LAYOUT = '_sidebar-hidden'
 
   @defaults:
@@ -87,9 +87,6 @@ class app.Settings
     layout = (@store.get('layout') || '').split(' ')
     layout.indexOf(name) isnt -1
 
-  getAllLayouts: ->
-    return LAYOUTS
-
   setSize: (value) ->
     @set 'size', value
     return
@@ -116,7 +113,7 @@ class app.Settings
 
   initLayout: ->
     @toggleDark(@get('dark'))
-    @toggleLayout(layout, @hasLayout(layout)) for layout in LAYOUTS
+    @toggleLayout(layout, @hasLayout(layout)) for layout in @LAYOUTS
 
   toggleDark: (enable) ->
     classList = document.documentElement.classList
diff --git a/assets/javascripts/views/content/settings_page.coffee 
b/assets/javascripts/views/content/settings_page.coffee
index 147c01ba..c1027e9c 100644
--- a/assets/javascripts/views/content/settings_page.coffee
+++ b/assets/javascripts/views/content/settings_page.coffee
@@ -14,7 +14,7 @@ class app.views.SettingsPage extends app.View
     settings.dark = app.settings.get('dark')
     settings.smoothScroll = !app.settings.get('fastScroll')
     settings.arrowScroll = app.settings.get('arrowScroll')
-    settings[layout] = app.settings.hasLayout(layout) for layout in app.settings.getAllLayouts()
+    settings[layout] = app.settings.hasLayout(layout) for layout in app.settings.LAYOUTS
     settings
 
   getTitle: ->


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]