mirror of
https://github.com/overleaf/overleaf.git
synced 2024-11-21 20:47:08 -05:00
Allow selecting of theme
This commit is contained in:
parent
7c2f944fad
commit
5cef41fdbd
6 changed files with 104 additions and 29 deletions
|
@ -13,6 +13,7 @@ SubscriptionLocator = require("../Subscription/SubscriptionLocator")
|
||||||
_ = require("underscore")
|
_ = require("underscore")
|
||||||
Settings = require("settings-sharelatex")
|
Settings = require("settings-sharelatex")
|
||||||
SecurityManager = require("../../managers/SecurityManager")
|
SecurityManager = require("../../managers/SecurityManager")
|
||||||
|
fs = require "fs"
|
||||||
|
|
||||||
module.exports = ProjectController =
|
module.exports = ProjectController =
|
||||||
|
|
||||||
|
@ -196,6 +197,7 @@ module.exports = ProjectController =
|
||||||
chatUrl: Settings.apis.chat.url
|
chatUrl: Settings.apis.chat.url
|
||||||
anonymous: anonymous
|
anonymous: anonymous
|
||||||
languages: Settings.languages
|
languages: Settings.languages
|
||||||
|
themes: THEME_LIST
|
||||||
timer.done()
|
timer.done()
|
||||||
|
|
||||||
_buildProjectList: (ownedProjects, sharedProjects, readOnlyProjects)->
|
_buildProjectList: (ownedProjects, sharedProjects, readOnlyProjects)->
|
||||||
|
@ -257,3 +259,11 @@ defaultSettingsForAnonymousUser = (user_id)->
|
||||||
dropbox: false
|
dropbox: false
|
||||||
trackChanges: false
|
trackChanges: false
|
||||||
|
|
||||||
|
THEME_LIST = []
|
||||||
|
do generateThemeList = () ->
|
||||||
|
files = fs.readdirSync __dirname + '/../../../../public/js/ace/theme'
|
||||||
|
for file in files
|
||||||
|
if file.slice(-2) == "js"
|
||||||
|
cleanName = file.slice(0,-3)
|
||||||
|
THEME_LIST.push cleanName
|
||||||
|
|
||||||
|
|
|
@ -42,11 +42,3 @@ module.exports =
|
||||||
fontSizes: ['10','11','12','13','14','16','20','24']
|
fontSizes: ['10','11','12','13','14','16','20','24']
|
||||||
languages: Settings.languages,
|
languages: Settings.languages,
|
||||||
accountSettingsTabActive: true
|
accountSettingsTabActive: true
|
||||||
|
|
||||||
THEME_LIST = []
|
|
||||||
do generateThemeList = () ->
|
|
||||||
files = fs.readdirSync __dirname + '/../../../../public/js/ace/theme'
|
|
||||||
for file in files
|
|
||||||
if file.slice(-2) == "js"
|
|
||||||
cleanName = file.slice(0,-3)
|
|
||||||
THEME_LIST.push name: cleanName
|
|
|
@ -33,8 +33,34 @@ block content
|
||||||
.alert.alert-warning.small(ng-if="connection.reconnecting")
|
.alert.alert-warning.small(ng-if="connection.reconnecting")
|
||||||
strong Reconnecting...
|
strong Reconnecting...
|
||||||
|
|
||||||
|
aside#left-menu(
|
||||||
|
ng-class="{ 'shown': ui.leftMenuShown }"
|
||||||
|
ng-cloak
|
||||||
|
)
|
||||||
|
h4 Settings
|
||||||
|
form
|
||||||
|
.form-controls
|
||||||
|
label(for="theme") Theme
|
||||||
|
select.form-control(
|
||||||
|
name="theme"
|
||||||
|
ng-model="settings.theme"
|
||||||
|
)
|
||||||
|
each theme in themes
|
||||||
|
option(value=theme) #{theme}
|
||||||
|
|
||||||
|
#left-menu-mask(
|
||||||
|
ng-show="ui.leftMenuShown",
|
||||||
|
ng-click="ui.leftMenuShown = false"
|
||||||
|
ng-cloak
|
||||||
|
)
|
||||||
|
|
||||||
header.toolbar.toolbar-header(ng-cloak, ng-hide="state.loading")
|
header.toolbar.toolbar-header(ng-cloak, ng-hide="state.loading")
|
||||||
a.btn.btn-full-height(href='#', tooltip="Menu", tooltip-placement="bottom")
|
a.btn.btn-full-height(
|
||||||
|
href,
|
||||||
|
ng-click="ui.leftMenuShown = true"
|
||||||
|
tooltip="Menu",
|
||||||
|
tooltip-placement="bottom"
|
||||||
|
)
|
||||||
i.fa.fa-bars
|
i.fa.fa-bars
|
||||||
|
|
||||||
span.name {{ project.name }}
|
span.name {{ project.name }}
|
||||||
|
@ -60,7 +86,7 @@ block content
|
||||||
#editor(
|
#editor(
|
||||||
ace-editor,
|
ace-editor,
|
||||||
ng-show="!!editor.sharejs_doc && !editor.opening"
|
ng-show="!!editor.sharejs_doc && !editor.opening"
|
||||||
theme="'cobalt'",
|
theme="settings.theme",
|
||||||
show-print-margin="false",
|
show-print-margin="false",
|
||||||
sharejs-doc="editor.sharejs_doc",
|
sharejs-doc="editor.sharejs_doc",
|
||||||
last-updated="editor.last_updated"
|
last-updated="editor.last_updated"
|
||||||
|
|
|
@ -3,6 +3,7 @@ define [
|
||||||
"ide/file-tree/FileTreeManager"
|
"ide/file-tree/FileTreeManager"
|
||||||
"ide/connection/ConnectionManager"
|
"ide/connection/ConnectionManager"
|
||||||
"ide/editor/EditorManager"
|
"ide/editor/EditorManager"
|
||||||
|
"ide/settings/SettingsManager"
|
||||||
"ide/directives/layout"
|
"ide/directives/layout"
|
||||||
"ide/services/ide"
|
"ide/services/ide"
|
||||||
"directives/focus"
|
"directives/focus"
|
||||||
|
@ -13,12 +14,16 @@ define [
|
||||||
FileTreeManager
|
FileTreeManager
|
||||||
ConnectionManager
|
ConnectionManager
|
||||||
EditorManager
|
EditorManager
|
||||||
|
SettingsManager
|
||||||
) ->
|
) ->
|
||||||
App.controller "IdeController", ["$scope", "$timeout", "ide", ($scope, $timeout, ide) ->
|
App.controller "IdeController", ["$scope", "$timeout", "ide", ($scope, $timeout, ide) ->
|
||||||
$scope.state = {
|
$scope.state = {
|
||||||
loading: true
|
loading: true
|
||||||
load_progress: 40
|
load_progress: 40
|
||||||
}
|
}
|
||||||
|
$scope.ui = {
|
||||||
|
leftMenuShown: false
|
||||||
|
}
|
||||||
|
|
||||||
window._ide = ide
|
window._ide = ide
|
||||||
|
|
||||||
|
@ -28,6 +33,7 @@ define [
|
||||||
ide.connectionManager = new ConnectionManager(ide, $scope)
|
ide.connectionManager = new ConnectionManager(ide, $scope)
|
||||||
ide.fileTreeManager = new FileTreeManager(ide, $scope)
|
ide.fileTreeManager = new FileTreeManager(ide, $scope)
|
||||||
ide.editorManager = new EditorManager(ide, $scope)
|
ide.editorManager = new EditorManager(ide, $scope)
|
||||||
|
ide.settingsManager = new SettingsManager(ide, $scope)
|
||||||
]
|
]
|
||||||
|
|
||||||
angular.bootstrap(document.body, ["SharelatexApp"])
|
angular.bootstrap(document.body, ["SharelatexApp"])
|
|
@ -0,0 +1,12 @@
|
||||||
|
define [], () ->
|
||||||
|
class SettingsManager
|
||||||
|
constructor: (@ide, @$scope) ->
|
||||||
|
@$scope.settings = window.userSettings
|
||||||
|
|
||||||
|
@$scope.$watch "settings.theme", (theme, oldTheme) =>
|
||||||
|
if theme != oldTheme
|
||||||
|
@saveSettings({theme: theme})
|
||||||
|
|
||||||
|
saveSettings: (data) ->
|
||||||
|
data._csrf = window.csrfToken
|
||||||
|
@ide.$http.post "/user/settings", data
|
|
@ -1,3 +1,11 @@
|
||||||
|
.full-size {
|
||||||
|
position: absolute;
|
||||||
|
top: 0;
|
||||||
|
bottom: 0;
|
||||||
|
left: 0;
|
||||||
|
right: 0;
|
||||||
|
}
|
||||||
|
|
||||||
.global-alerts {
|
.global-alerts {
|
||||||
position: absolute;
|
position: absolute;
|
||||||
z-index: 20;
|
z-index: 20;
|
||||||
|
@ -154,27 +162,16 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
#ide-body {
|
#ide-body {
|
||||||
position: absolute;
|
.full-size;
|
||||||
top: 40px;
|
top: 40px;
|
||||||
bottom: 0;
|
|
||||||
left: 0;
|
|
||||||
right: 0;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#editor {
|
#editor {
|
||||||
position: absolute;
|
.full-size;
|
||||||
top: 0;
|
|
||||||
bottom: 0;
|
|
||||||
left: 0;
|
|
||||||
right: 0;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
.loading {
|
.loading {
|
||||||
position: absolute;
|
.full-size;
|
||||||
top: 0;
|
|
||||||
bottom: 0;
|
|
||||||
left: 0;
|
|
||||||
right: 0;
|
|
||||||
padding-top: 10rem;
|
padding-top: 10rem;
|
||||||
font-family: @font-family-serif;
|
font-family: @font-family-serif;
|
||||||
text-align: center;
|
text-align: center;
|
||||||
|
@ -183,11 +180,7 @@
|
||||||
|
|
||||||
// The internal components of the aceEditor directive
|
// The internal components of the aceEditor directive
|
||||||
.ace-editor-wrapper {
|
.ace-editor-wrapper {
|
||||||
position: absolute;
|
.full-size;
|
||||||
top: 0;
|
|
||||||
bottom: 0;
|
|
||||||
left: 0;
|
|
||||||
right: 0;
|
|
||||||
.undo-conflict-warning {
|
.undo-conflict-warning {
|
||||||
position: absolute;
|
position: absolute;
|
||||||
top: 0;
|
top: 0;
|
||||||
|
@ -239,3 +232,39 @@
|
||||||
.ui-layout-resizer-dragging {
|
.ui-layout-resizer-dragging {
|
||||||
background-color: #ddd;
|
background-color: #ddd;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#left-menu {
|
||||||
|
position: absolute;
|
||||||
|
width: 210px;
|
||||||
|
padding: 10px;
|
||||||
|
top: 0;
|
||||||
|
bottom: 0;
|
||||||
|
background-color: #f4f4f4;
|
||||||
|
z-index: 100;
|
||||||
|
overflow: auto;
|
||||||
|
-webkit-transition: left ease-in-out 0.35s;
|
||||||
|
transition: left ease-in-out 0.35s;
|
||||||
|
|
||||||
|
left: -280px;
|
||||||
|
&.shown {
|
||||||
|
left: 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
h4 {
|
||||||
|
font-family: @font-family-serif;
|
||||||
|
font-weight: 400;
|
||||||
|
font-size: 1rem;
|
||||||
|
margin: (@line-height-computed / 2) 0;
|
||||||
|
padding-bottom: (@line-height-computed / 4);
|
||||||
|
color: @gray-light;
|
||||||
|
border-bottom: 1px solid @gray-light;
|
||||||
|
text-transform: uppercase;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
#left-menu-mask {
|
||||||
|
.full-size;
|
||||||
|
opacity: 0.4;
|
||||||
|
background-color: #999;
|
||||||
|
z-index: 99;
|
||||||
|
}
|
Loading…
Reference in a new issue