summaryrefslogtreecommitdiff
path: root/app/views
diff options
context:
space:
mode:
authorDmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>2015-06-15 11:29:36 +0000
committerDmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>2015-06-15 11:29:36 +0000
commit7300729190f4e61c4e71f18d0a81ea044eaad98a (patch)
tree03cef3fbfd21712f1b19ea21c84ab62253940671 /app/views
parent168d5eabd40f5767d1287fe194e57ed05ef5d990 (diff)
parent9eec51d914bc79fed479a4e3e7b86fda58ad77c8 (diff)
downloadgitlab-ce-7300729190f4e61c4e71f18d0a81ea044eaad98a.tar.gz
Merge branch 'rs-dev-issue-2228' into 'master'
Allow user to customize default Dashboard page Renames the "Design" profile page to "Preferences" and adds a field to customize the default Dashboard page: > ![Screen_Shot_2015-06-11_at_11.12.53_PM](https://gitlab.com/gitlab-org/gitlab-ce/uploads/b5282a3be7861d1148528c6bc9e7a0e0/Screen_Shot_2015-06-11_at_11.12.53_PM.png) See merge request !778
Diffstat (limited to 'app/views')
-rw-r--r--app/views/layouts/application.html.haml6
-rw-r--r--app/views/layouts/devise.html.haml2
-rw-r--r--app/views/layouts/errors.html.haml2
-rw-r--r--app/views/layouts/nav/_dashboard.html.haml4
-rw-r--r--app/views/layouts/nav/_profile.html.haml7
-rw-r--r--app/views/profiles/design.html.haml56
-rw-r--r--app/views/profiles/preferences/show.html.haml42
-rw-r--r--app/views/profiles/preferences/update.js.erb9
-rw-r--r--app/views/profiles/update.js.erb3
9 files changed, 62 insertions, 69 deletions
diff --git a/app/views/layouts/application.html.haml b/app/views/layouts/application.html.haml
index 173033f7eab..678ed3c2c1f 100644
--- a/app/views/layouts/application.html.haml
+++ b/app/views/layouts/application.html.haml
@@ -1,10 +1,10 @@
!!! 5
%html{ lang: "en"}
= render "layouts/head"
- %body{class: "#{app_theme}", :'data-page' => body_data_page}
- / Ideally this would be inside the head, but turbolinks only evaluates page-specific JS in the body.
+ %body{class: "#{user_application_theme}", 'data-page' => body_data_page}
+ -# Ideally this would be inside the head, but turbolinks only evaluates page-specific JS in the body.
= yield :scripts_body_top
-
+
- if current_user
= render "layouts/header/default", title: header_title
- else
diff --git a/app/views/layouts/devise.html.haml b/app/views/layouts/devise.html.haml
index d406f5764a7..1987bf1592a 100644
--- a/app/views/layouts/devise.html.haml
+++ b/app/views/layouts/devise.html.haml
@@ -1,7 +1,7 @@
!!! 5
%html{ lang: "en"}
= render "layouts/head"
- %body.ui_mars.login-page.application
+ %body.ui_charcoal.login-page.application
= render "layouts/header/empty"
= render "layouts/broadcast"
.container.navless-container
diff --git a/app/views/layouts/errors.html.haml b/app/views/layouts/errors.html.haml
index 2e3a2b16eb7..2af265a2296 100644
--- a/app/views/layouts/errors.html.haml
+++ b/app/views/layouts/errors.html.haml
@@ -1,7 +1,7 @@
!!! 5
%html{ lang: "en"}
= render "layouts/head"
- %body{class: "#{app_theme} application"}
+ %body{class: "#{user_application_theme} application"}
= render "layouts/header/empty"
.container.navless-container
= render "layouts/flash"
diff --git a/app/views/layouts/nav/_dashboard.html.haml b/app/views/layouts/nav/_dashboard.html.haml
index d46dba4a240..687c1fc3dd2 100644
--- a/app/views/layouts/nav/_dashboard.html.haml
+++ b/app/views/layouts/nav/_dashboard.html.haml
@@ -1,6 +1,6 @@
%ul.nav.nav-sidebar
- = nav_link(path: 'dashboard#show', html_options: {class: 'home'}) do
- = link_to root_path, title: 'Home', class: 'shortcuts-activity', data: {placement: 'right'} do
+ = nav_link(path: ['dashboard#show', 'root#show'], html_options: {class: 'home'}) do
+ = link_to dashboard_path, title: 'Home', class: 'shortcuts-activity', data: {placement: 'right'} do
= icon('dashboard fw')
%span
Your Projects
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/design.html.haml b/app/views/profiles/design.html.haml
deleted file mode 100644
index f450ec1c018..00000000000
--- a/app/views/profiles/design.html.haml
+++ /dev/null
@@ -1,56 +0,0 @@
-- page_title "Design"
-%h3.page-title
- = page_title
-%p.light
- Appearance settings will be saved to your profile and made available across all devices.
-%hr
-
-= form_for @user, url: profile_path, remote: true, method: :put do |f|
- .panel.panel-default.application-theme
- .panel-heading
- Application theme
- .panel-body
- .themes_opts
- = label_tag do
- .prev.default
- = f.radio_button :theme_id, 1
- Graphite
-
- = label_tag do
- .prev.classic
- = f.radio_button :theme_id, 2
- Charcoal
-
- = label_tag do
- .prev.modern
- = f.radio_button :theme_id, 3
- Green
-
- = label_tag do
- .prev.gray
- = f.radio_button :theme_id, 4
- Gray
-
- = label_tag do
- .prev.violet
- = f.radio_button :theme_id, 5
- Violet
-
- = label_tag do
- .prev.blue
- = f.radio_button :theme_id, 6
- Blue
- %br
- .clearfix
-
- .panel.panel-default.code-preview-theme
- .panel-heading
- Code preview theme
- .panel-body
- .code_highlight_opts
- - color_schemes.each do |color_scheme_id, color_scheme|
- = label_tag do
- .prev
- = image_tag "#{color_scheme}-scheme-preview.png"
- = f.radio_button :color_scheme_id, color_scheme_id
- = color_scheme.gsub(/[-_]+/, ' ').humanize
diff --git a/app/views/profiles/preferences/show.html.haml b/app/views/profiles/preferences/show.html.haml
new file mode 100644
index 00000000000..aa99280fde6
--- /dev/null
+++ b/app/views/profiles/preferences/show.html.haml
@@ -0,0 +1,42 @@
+- page_title 'Preferences'
+%h3.page-title
+ = page_title
+%p.light
+ These settings allow you to customize the appearance and behavior of the site.
+ They are saved with your account and will persist to any device you use to
+ access the site.
+%hr
+
+= form_for @user, url: profile_preferences_path, remote: true, method: :put, html: {class: 'js-preferences-form form-horizontal'} do |f|
+ .panel.panel-default.application-theme
+ .panel-heading
+ Application theme
+ .panel-body
+ - Gitlab::Themes.each do |theme|
+ = label_tag do
+ .preview{class: theme.css_class}
+ = f.radio_button :theme_id, theme.id
+ = theme.name
+
+ .panel.panel-default.syntax-theme
+ .panel-heading
+ Syntax highlighting theme
+ .panel-body
+ - color_schemes.each do |color_scheme_id, color_scheme|
+ = label_tag do
+ .preview= image_tag "#{color_scheme}-scheme-preview.png"
+ = f.radio_button :color_scheme_id, color_scheme_id
+ = color_scheme.tr('-_', ' ').titleize
+
+ .panel.panel-default
+ .panel-heading
+ Behavior
+ .panel-body
+ .form-group
+ = f.label :dashboard, class: 'control-label' do
+ Default Dashboard
+ = link_to('(?)', help_page_path('profile', 'preferences') + '#default-dashboard', target: '_blank')
+ .col-sm-10
+ = f.select :dashboard, dashboard_choices, {}, class: 'form-control'
+ .panel-footer
+ = f.submit 'Save', class: 'btn btn-save'
diff --git a/app/views/profiles/preferences/update.js.erb b/app/views/profiles/preferences/update.js.erb
new file mode 100644
index 00000000000..6c4b0ce757d
--- /dev/null
+++ b/app/views/profiles/preferences/update.js.erb
@@ -0,0 +1,9 @@
+// Remove body class for any previous theme, re-add current one
+$('body').removeClass('<%= Gitlab::Themes.body_classes %>')
+$('body').addClass('<%= user_application_theme %>')
+
+// Re-enable the "Save" button
+$('input[type=submit]').enable()
+
+// Show the notice flash message
+new Flash('<%= flash.discard(:notice) %>', 'notice')
diff --git a/app/views/profiles/update.js.erb b/app/views/profiles/update.js.erb
deleted file mode 100644
index db37619136d..00000000000
--- a/app/views/profiles/update.js.erb
+++ /dev/null
@@ -1,3 +0,0 @@
-// Remove body class for any previous theme, re-add current one
-$('body').removeClass('<%= Gitlab::Theme.body_classes %>')
-$('body').addClass('<%= app_theme %> <%= theme_type %>')