From ada0ad6eb53fa70ca005daee40feeb50f8ae705e Mon Sep 17 00:00:00 2001
From: Steffen van Bergerem <svbergerem@online.de>
Date: Sat, 6 Feb 2016 13:53:42 +0100
Subject: [PATCH] Unify settings ui

---
 .../user_applications/index.html.haml         |  5 +-
 app/views/profiles/edit.haml                  |  6 +-
 app/views/services/index.html.haml            | 19 +++--
 app/views/shared/_settings_nav.haml           | 18 +++--
 app/views/users/_edit.haml                    | 72 +++++++++----------
 app/views/users/_privacy_settings.haml        | 50 ++++++-------
 app/views/users/edit.html.haml                |  6 +-
 app/views/users/edit.mobile.haml              |  8 ++-
 app/views/users/privacy_settings.html.haml    |  6 +-
 app/views/users/privacy_settings.mobile.haml  |  8 ++-
 10 files changed, 103 insertions(+), 95 deletions(-)

diff --git a/app/views/api/openid_connect/user_applications/index.html.haml b/app/views/api/openid_connect/user_applications/index.html.haml
index 5fbec9219c..a6ed67d698 100644
--- a/app/views/api/openid_connect/user_applications/index.html.haml
+++ b/app/views/api/openid_connect/user_applications/index.html.haml
@@ -3,10 +3,9 @@
 
 .container-fluid.applications-page
   .row
-    .col-md-12
+    .col-md-3
       = render "shared/settings_nav"
-  .row
-    .col-md-12
+    .col-md-9
       %h3= t(".title")
       .row
         .col-md-12
diff --git a/app/views/profiles/edit.haml b/app/views/profiles/edit.haml
index c050065134..844af392b0 100644
--- a/app/views/profiles/edit.haml
+++ b/app/views/profiles/edit.haml
@@ -4,11 +4,9 @@
 
 .container-fluid
   .row
-    .col-md-12
+    .col-md-3
       = render "shared/settings_nav"
-
-  .row
-    .col-md-12
+    .col-md-9
       - content_for :submit_block do
         = link_to t("cancel"), local_or_remote_person_path(current_user.person), class: "btn btn-default"
         = submit_tag t(".update_profile"), class: "btn btn-primary pull-right", id: "update_profile"
diff --git a/app/views/services/index.html.haml b/app/views/services/index.html.haml
index 0caff17fdc..8afad2b83c 100644
--- a/app/views/services/index.html.haml
+++ b/app/views/services/index.html.haml
@@ -7,16 +7,15 @@
 
 .container-fluid
   .row
-    .col-md-12
+    .col-md-3
       = render "shared/settings_nav"
-
-  .row
-    .col-md-12
+    .col-md-9
       %h3= t(".title")
-  .row
-    .col-md-7
-      = render "add_remove_services"
+      .row
+        .col-md-12
+          = render "add_remove_services"
 
-    .col-md-5
-      %p
-        = t(".services_explanation")
+      .row
+        .col-md-12
+          %p
+            = t(".services_explanation")
diff --git a/app/views/shared/_settings_nav.haml b/app/views/shared/_settings_nav.haml
index ceba4baa04..561a499207 100644
--- a/app/views/shared/_settings_nav.haml
+++ b/app/views/shared/_settings_nav.haml
@@ -1,10 +1,14 @@
 #section_header
   %h2
     = t("settings")
-  %ul.nav.nav-tabs#settings_nav
-    %li{class: current_page?(edit_profile_path) && "active"}= link_to t("profile"), edit_profile_path
-    %li{class: current_page?(edit_user_path) && "active"}= link_to t("account"), edit_user_path
-    %li{class: current_page?(privacy_settings_path) && "active"}= link_to t("privacy"), privacy_settings_path
-    %li{class: current_page?(services_path) && "active"}= link_to t("_services"), services_path
-    %li{class: current_page?(api_openid_connect_user_applications_path) && "active"}
-      = link_to t("_applications"), api_openid_connect_user_applications_path
+  .list-group#settings_nav
+    = link_to t("profile"), edit_profile_path,
+      class: current_page?(edit_profile_path) ? "list-group-item active" : "list-group-item"
+    = link_to t("account"), edit_user_path,
+      class: current_page?(edit_user_path) ? "list-group-item active" : "list-group-item"
+    = link_to t("privacy"), privacy_settings_path,
+      class: current_page?(privacy_settings_path) ? "list-group-item active" : "list-group-item"
+    = link_to t("_services"), services_path,
+      class: current_page?(services_path) ? "list-group-item active" : "list-group-item"
+    = link_to t("_applications"), api_openid_connect_user_applications_path,
+      class: current_page?(api_openid_connect_user_applications_path) ? "list-group-item active" : "list-group-item"
diff --git a/app/views/users/_edit.haml b/app/views/users/_edit.haml
index cde2620c5c..6719cc6aa9 100644
--- a/app/views/users/_edit.haml
+++ b/app/views/users/_edit.haml
@@ -5,10 +5,6 @@
 - content_for :page_title do
   = t(".edit_account")
 
-.row
-  .col-md-12
-    = render "shared/settings_nav"
-
 .row
   .col-md-12
     .row
@@ -173,42 +169,40 @@
     %hr
 
     .row
-      .col-md-12#account_data
-        .row
-          .col-md-6
-            %h3= t(".export_data")
-            .form-group
-              - if current_user.exporting
-                .export-in-progress= t(".export_in_progress")
-              - elsif current_user.export.present?
-                = link_to t(".request_export_update"), export_profile_user_path, method: :post,
-                  class: "btn btn-default btn-block"
-                .small-horizontal-spacer
-                = link_to t(".download_export"), download_profile_user_path,
-                  class: "btn btn-success btn-block"
-                .small-horizontal-spacer
-                %h6
-                  = t(".last_exported_at", timestamp: current_user.exported_at)
-              - else
-                = link_to t(".request_export"), export_profile_user_path, method: :post,
-                  class: "btn btn-default btn-block"
-
-            .form-group
-              - if current_user.exporting_photos
-                .export-in-progress= t(".export_photos_in_progress")
-              - elsif current_user.exported_photos_file.present?
-                = link_to t(".request_export_photos_update"), export_photos_user_path, method: :post,
-                  class: "btn btn-default btn-block"
-                .small-horizontal-spacer
-                = link_to t(".download_export_photos"), download_photos_user_path, class: "btn btn-success btn-block"
-                .small-horizontal-spacer
-                %h6
-                  = t(".last_exported_at", timestamp: current_user.exported_photos_at)
-              - else
-                = link_to t(".request_export_photos"), export_photos_user_path, method: :post,
-                  class: "btn btn-default btn-block"
+      .col-md-6#account_data
+        %h3= t(".export_data")
+        .form-group
+          - if current_user.exporting
+            .export-in-progress= t(".export_in_progress")
+          - elsif current_user.export.present?
+            = link_to t(".request_export_update"), export_profile_user_path, method: :post,
+              class: "btn btn-default"
+            .small-horizontal-spacer
+            = link_to t(".download_export"), download_profile_user_path,
+              class: "btn btn-success"
+            .small-horizontal-spacer
+            %h6
+              = t(".last_exported_at", timestamp: current_user.exported_at)
+          - else
+            = link_to t(".request_export"), export_profile_user_path, method: :post,
+              class: "btn btn-default"
 
-      .col-md-12
+        .form-group
+          - if current_user.exporting_photos
+            .export-in-progress= t(".export_photos_in_progress")
+          - elsif current_user.exported_photos_file.present?
+            = link_to t(".request_export_photos_update"), export_photos_user_path, method: :post,
+              class: "btn btn-default"
+            .small-horizontal-spacer
+            = link_to t(".download_export_photos"), download_photos_user_path, class: "btn btn-success"
+            .small-horizontal-spacer
+            %h6
+              = t(".last_exported_at", timestamp: current_user.exported_photos_at)
+          - else
+            = link_to t(".request_export_photos"), export_photos_user_path, method: :post,
+              class: "btn btn-default"
+
+      .col-md-6
         %h3
           = t(".close_account_text")
         .form-group
diff --git a/app/views/users/_privacy_settings.haml b/app/views/users/_privacy_settings.haml
index b805372249..86038417b8 100644
--- a/app/views/users/_privacy_settings.haml
+++ b/app/views/users/_privacy_settings.haml
@@ -1,34 +1,28 @@
 .row
   .col-md-12
-    = render "shared/settings_nav"
+    %h3
+      = t(".title")
 
-.row
-  .col-md-12
-    .row
-      .col-md-12
-        %h3
-          = t(".title")
-
-        = form_for current_user, url: user_path, html: {method: :put} do |f|
-          = f.error_messages
+    = form_for current_user, url: user_path, html: {method: :put} do |f|
+      = f.error_messages
 
-          = f.fields_for :stream_preferences do
-            .checkbox#stream_prefs
-              = f.label :strip_exif do
-                = f.check_box :strip_exif
-                = t(".strip_exif")
-              = f.submit t("users.edit.change"), class: "btn btn-primary pull-right"
-    %hr
+      = f.fields_for :stream_preferences do
+        .checkbox#stream_prefs
+          = f.label :strip_exif do
+            = f.check_box :strip_exif
+            = t(".strip_exif")
+          = f.submit t("users.edit.change"), class: "btn btn-primary pull-right"
+%hr
 
-    .row
-      .col-md-12
-        %h3
-          = t(".ignored_users")
+.row
+  .col-md-12
+    %h3
+      = t(".ignored_users")
 
-        - if @blocks.length.zero?
-          %p
-            = t(".no_user_ignored_message")
-        - else
-          #blocked_people
-            - @blocks.each do |block|
-              = render partial: "blocked_person", locals: {block: block, person: block.person}
+    - if @blocks.length.zero?
+      %p
+        = t(".no_user_ignored_message")
+    - else
+      #blocked_people
+        - @blocks.each do |block|
+          = render partial: "blocked_person", locals: {block: block, person: block.person}
diff --git a/app/views/users/edit.html.haml b/app/views/users/edit.html.haml
index 57479c6191..3c56ff7c88 100644
--- a/app/views/users/edit.html.haml
+++ b/app/views/users/edit.html.haml
@@ -1,2 +1,6 @@
 .container-fluid
-  = render "edit"
+  .row
+    .col-md-3
+      = render "shared/settings_nav"
+    .col-md-9
+      = render "edit"
diff --git a/app/views/users/edit.mobile.haml b/app/views/users/edit.mobile.haml
index d72d13931b..77f9bb52d2 100644
--- a/app/views/users/edit.mobile.haml
+++ b/app/views/users/edit.mobile.haml
@@ -1,2 +1,8 @@
 .settings_container.container-fluid
-  = render "edit"
+  .row
+    .col-md-12
+      = render "shared/settings_nav"
+
+  .row
+    .col-md-12
+      = render "edit"
diff --git a/app/views/users/privacy_settings.html.haml b/app/views/users/privacy_settings.html.haml
index 16db316be4..ef4f865a42 100644
--- a/app/views/users/privacy_settings.html.haml
+++ b/app/views/users/privacy_settings.html.haml
@@ -6,4 +6,8 @@
   = t('.title')
 
 .container-fluid
-  = render "privacy_settings"
+  .row
+    .col-md-3
+      = render "shared/settings_nav"
+    .col-md-9
+      = render "privacy_settings"
diff --git a/app/views/users/privacy_settings.mobile.haml b/app/views/users/privacy_settings.mobile.haml
index 31e2feaee9..231f164dc5 100644
--- a/app/views/users/privacy_settings.mobile.haml
+++ b/app/views/users/privacy_settings.mobile.haml
@@ -6,4 +6,10 @@
   = t(".title")
 
 .settings_container.container-fluid
-  = render "privacy_settings"
+  .row
+    .col-md-12
+      = render "shared/settings_nav"
+
+  .row
+    .col-md-12
+      = render "privacy_settings"
-- 
GitLab