diff --git a/public/index.html b/public/index.html index 814a07c..7741ca1 100644 --- a/public/index.html +++ b/public/index.html @@ -5,10 +5,13 @@ Pepyatka - - + + diff --git a/public/js/app/controllers/SettingsGenericController.js b/public/js/app/controllers/SettingsGenericController.js index e161eaa..5806e6e 100644 --- a/public/js/app/controllers/SettingsGenericController.js +++ b/public/js/app/controllers/SettingsGenericController.js @@ -31,9 +31,16 @@ define(["config", }) }, + themes: ["helvetica", "fresh"], + actions: { previewProfilePicture: function (newFile) { this.set('newProfilePicture', newFile) + }, + + themeSelect: function(theme) { + document.cookie = "theme=" + theme; + Ember.$('link#theme-css').attr("href", "/css/themes/" + theme + "/app.css"); } } }) diff --git a/public/js/app/fields/ThemeSelectorView.js b/public/js/app/fields/ThemeSelectorView.js new file mode 100644 index 0000000..c297cab --- /dev/null +++ b/public/js/app/fields/ThemeSelectorView.js @@ -0,0 +1,11 @@ +define(["app/app"], function(App) { + "use strict"; + + App.ThemeSelectorView = Ember.Select.extend({ + classNames: ['form-control theme-selector'], + + change: function(event) { + this.get('controller').send('themeSelect', event.target.value); + } + }) +}) diff --git a/public/js/app/main.js b/public/js/app/main.js index d3e380e..8c60fdd 100644 --- a/public/js/app/main.js +++ b/public/js/app/main.js @@ -57,6 +57,7 @@ define([ "fields/CreateCommentView", "fields/EditCommentView", "fields/UpdateProfilePictureView", + "fields/ThemeSelectorView", "routes/ForgotPasswordRoute", "routes/GroupsHomeRoute", diff --git a/public/js/app/templates/settingsIndexTemplate.handlebars b/public/js/app/templates/settingsIndexTemplate.handlebars index 5de5beb..ac7576c 100644 --- a/public/js/app/templates/settingsIndexTemplate.handlebars +++ b/public/js/app/templates/settingsIndexTemplate.handlebars @@ -83,3 +83,8 @@ {{profilePicErrors}} {{/if}} + +
+ + {{view 'theme-selector' content=themes value=theme}} +