Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/app
diff options
context:
space:
mode:
authorRobert Speicher <rspeicher@gmail.com>2015-06-05 21:00:21 +0300
committerRobert Speicher <rspeicher@gmail.com>2015-06-14 00:58:15 +0300
commit821fc4b03479a193b055c91b8a655d226bc46c17 (patch)
treea768f6c4cdd039261194bbc36a40b31e61c9934f /app
parent0b3c97422136683357cdb4433a5ef0aa8858c18d (diff)
Add Profiles::PreferencesController
Diffstat (limited to 'app')
-rw-r--r--app/controllers/profiles/preferences_controller.rb29
-rw-r--r--app/views/layouts/nav/_profile.html.haml7
-rw-r--r--app/views/profiles/preferences/show.html.haml1
-rw-r--r--app/views/profiles/preferences/update.js.erb1
4 files changed, 35 insertions, 3 deletions
diff --git a/app/controllers/profiles/preferences_controller.rb b/app/controllers/profiles/preferences_controller.rb
new file mode 100644
index 00000000000..897e6fe074d
--- /dev/null
+++ b/app/controllers/profiles/preferences_controller.rb
@@ -0,0 +1,29 @@
+class Profiles::PreferencesController < Profiles::ApplicationController
+ before_action :user
+
+ def show
+ end
+
+ def update
+ if @user.update_attributes(preferences_params)
+ flash[:notice] = 'Preferences saved.'
+ else
+ # TODO (rspeicher): There's no validation on these values, so can it fail?
+ end
+
+ respond_to do |format|
+ format.html { redirect_to profile_preferences_path }
+ format.js
+ end
+ end
+
+ private
+
+ def user
+ @user = current_user
+ end
+
+ def preferences_params
+ params.require(:user).permit(:color_scheme_id, :theme_id)
+ end
+end
diff --git a/app/views/layouts/nav/_profile.html.haml b/app/views/layouts/nav/_profile.html.haml
index ac37fd4c1c1..121665bd536 100644
--- a/app/views/layouts/nav/_profile.html.haml
+++ b/app/views/layouts/nav/_profile.html.haml
@@ -38,11 +38,12 @@
%span
SSH Keys
%span.count= current_user.keys.count
- = nav_link(path: 'profiles#design') do
- = link_to design_profile_path, title: 'Design', data: {placement: 'right'} do
+ = nav_link(controller: :preferences) do
+ = link_to profile_preferences_path, title: 'Preferences', data: {placement: 'right'} do
+ -# TODO (rspeicher): Better icon?
= icon('image fw')
%span
- Design
+ Preferences
= nav_link(path: 'profiles#history') do
= link_to history_profile_path, title: 'History', data: {placement: 'right'} do
= icon('history fw')
diff --git a/app/views/profiles/preferences/show.html.haml b/app/views/profiles/preferences/show.html.haml
new file mode 100644
index 00000000000..1333ed77b7e
--- /dev/null
+++ b/app/views/profiles/preferences/show.html.haml
@@ -0,0 +1 @@
+TODO
diff --git a/app/views/profiles/preferences/update.js.erb b/app/views/profiles/preferences/update.js.erb
new file mode 100644
index 00000000000..70b786d12ed
--- /dev/null
+++ b/app/views/profiles/preferences/update.js.erb
@@ -0,0 +1 @@
+// TODO