From 4534ba5de882e42ee9eb95ce2d5812145a3aca63 Mon Sep 17 00:00:00 2001 From: Steffen van Bergerem Date: Sun, 14 Jun 2015 13:08:10 +0200 Subject: [PATCH] Fix Bootstrap3 regression: close account --- app/assets/javascripts/mobile/mobile.js | 1 + app/views/users/_close_account_modal.haml | 69 ++++++++++++----------- app/views/users/{_edit.haml => edit.haml} | 56 +----------------- app/views/users/edit.html.haml | 1 - app/views/users/edit.mobile.haml | 1 - features/desktop/closes_account.feature | 3 +- features/mobile/closes_account.feature | 4 +- 7 files changed, 45 insertions(+), 90 deletions(-) rename app/views/users/{_edit.haml => edit.haml} (77%) delete mode 100644 app/views/users/edit.html.haml delete mode 100644 app/views/users/edit.mobile.haml diff --git a/app/assets/javascripts/mobile/mobile.js b/app/assets/javascripts/mobile/mobile.js index 0915480ad..124cb86fd 100644 --- a/app/assets/javascripts/mobile/mobile.js +++ b/app/assets/javascripts/mobile/mobile.js @@ -13,6 +13,7 @@ //= require fileuploader-custom //= require rails-timeago //= require underscore +//= require bootstrap //= require diaspora //= require helpers/i18n //= require widgets/timeago diff --git a/app/views/users/_close_account_modal.haml b/app/views/users/_close_account_modal.haml index 18d422c84..15ef12935 100644 --- a/app/views/users/_close_account_modal.haml +++ b/app/views/users/_close_account_modal.haml @@ -1,41 +1,44 @@ -.modal.hide.fade{ id: "closeAccountModal", tabindex: "-1", role: "dialog", aria: { labelledby: "closeAccountModalLabel", hidden: "true" }} - .modal-header - %button.close{type: "button", data: {dismiss: "modal"}, aria: {hidden: "true" }} - × - %h3{ id:"closeAccountModalLabel"} - = t("users.edit.close_account.dont_go") - .modal-body - .row-fluid - .text-center - = image_tag "sadcat.jpg" - %h4 - %strong - = t("users.edit.close_account.mr_wiggles") +.modal.fade{ id: "closeAccountModal", + tabindex: "-1", + role: "dialog", + aria: { labelledby: "closeAccountModalLabel", hidden: "true" }} + .modal-dialog + .modal-content + .modal-header + %button.close{type: "button", data: {dismiss: "modal"}, aria: {hidden: "true" }} + × + %h3.modal-title{ id:"closeAccountModalLabel"} + = t("users.edit.close_account.dont_go") + = form_for "user", url: user_path, html: { method: :delete } do |f| + .modal-body + .text-center + = image_tag "sadcat.jpg", class: "img-responsive center-block" + %h4 + %strong + = t("users.edit.close_account.mr_wiggles") - .small-horizontal-spacer + = t("users.edit.close_account.make_diaspora_better") - .row-fluid - .span12 - = t("users.edit.close_account.make_diaspora_better") + %ol + %li + = t("users.edit.close_account.what_we_delete") + %li + = t("users.edit.close_account.locked_out") + %li + = t("users.edit.close_account.lock_username") - .small-horizontal-spacer - - %ul - %li - = t("users.edit.close_account.what_we_delete") - %li - = t("users.edit.close_account.locked_out") - %li - = t("users.edit.close_account.lock_username") - %p %strong = t("users.edit.close_account.no_turning_back") - = form_for "user", url: user_path, html: { method: :delete } do |f| + .small-horizontal-spacer = f.error_messages - - %p + .form-group = f.label :close_account_password, t("users.edit.current_password"), for: :close_account_password - = f.password_field :current_password, id: :close_account_password - %p - = f.submit t('users.edit.close_account_text'), class: "btn btn-danger", id: "close_account_confirm", data: { confirm: t("are_you_sure_delete_account") } + = f.password_field :current_password, id: :close_account_password, class: "form-control" + .modal-footer + .btn.btn-default{type: "button", data: {dismiss: "modal"}, aria: {hidden: "true"}} + = t("cancel") + = f.submit t("users.edit.close_account_text"), + class: "btn btn-danger", + id: "close_account_confirm", + data: { confirm: t("are_you_sure_delete_account") } diff --git a/app/views/users/_edit.haml b/app/views/users/edit.haml similarity index 77% rename from app/views/users/_edit.haml rename to app/views/users/edit.haml index b7a564b93..14fc6c2e2 100644 --- a/app/views/users/_edit.haml +++ b/app/views/users/edit.haml @@ -191,56 +191,6 @@ .col-lg-5 %h3.text-right = t('.close_account_text') - - - if mobile - = form_for "user", url: user_path, html: { method: :delete } do |f| - = f.error_messages - .form-group - .clearfix= f.label :close_account_password, t("users.edit.current_password"), for: :close_account_password, - class: "pull-right", style: "padding-top: 9px;" - .small-horizontal-spacer - .clearfix= f.password_field :current_password, id: :close_account_password, class: "form-control" - %p - .clearfix= f.submit t('users.edit.close_account_text'), class: "btn btn-danger pull-right", - id: "close_account_confirm", data: { confirm: t("are_you_sure_delete_account") } - - - if not mobile - =link_to t('.close_account_text'), '#close_account_pane', rel: 'facebox', - class: "btn btn-danger pull-right", id: "close_account" - - .hidden#close_account_pane{rel: 'facebox'} - #inner_account_delete - %h1 - = t('.close_account.dont_go') - %p - = t('.close_account.make_diaspora_better') - .row - .col-md-6 - = image_tag 'sadcat.jpg' - .small-horizontal-spacer - %small - %b - = t('.close_account.mr_wiggles') - .col-md-6 - %ul - %li - = t('.close_account.what_we_delete') - %li - = t('.close_account.locked_out') - %li - = t('.close_account.lock_username') - %p - %b - = t('.close_account.no_turning_back') - - = form_for 'user', url: user_path, html: { method: :delete } do |f| - = f.error_messages - - %p - = f.label :close_account_password, t('.current_password'), for: :close_account_password - = f.password_field :current_password, id: :close_account_password - %p - .small-horizontal-spacer - = f.submit t('.close_account_text'), class: "btn btn-danger", id: "close_account_confirm", - data: { confirm: t('are_you_sure_delete_account') } -.small-horizontal-spacer + .btn.btn-danger.pull-right{ id: "close_account", data: {toggle: "modal", target: "#closeAccountModal"}} + = t(".close_account_text") + = render "close_account_modal" diff --git a/app/views/users/edit.html.haml b/app/views/users/edit.html.haml deleted file mode 100644 index b67173ee4..000000000 --- a/app/views/users/edit.html.haml +++ /dev/null @@ -1 +0,0 @@ -= render "edit", mobile: false diff --git a/app/views/users/edit.mobile.haml b/app/views/users/edit.mobile.haml deleted file mode 100644 index 2dfc771ef..000000000 --- a/app/views/users/edit.mobile.haml +++ /dev/null @@ -1 +0,0 @@ -= render "edit", mobile: true diff --git a/features/desktop/closes_account.feature b/features/desktop/closes_account.feature index 3f8cf71ab..26b93607c 100644 --- a/features/desktop/closes_account.feature +++ b/features/desktop/closes_account.feature @@ -8,7 +8,8 @@ Feature: Close account Given I am signed in When I go to the users edit page And I click on selector "#close_account" - And I put in my password in "close_account_password" + Then I should see "Hey, please don’t go!" within "#closeAccountModal" + When I put in my password in "close_account_password" And I press "close_account_confirm" And I confirm the alert Then I should be on the new user session page diff --git a/features/mobile/closes_account.feature b/features/mobile/closes_account.feature index 1d3f4d6f4..f2458dba6 100644 --- a/features/mobile/closes_account.feature +++ b/features/mobile/closes_account.feature @@ -7,7 +7,9 @@ Feature: Close account Scenario: user closes account Given I am signed in When I go to the users edit page - And I put in my password in "close_account_password" + And I click on selector "#close_account" + Then I should see "Hey, please don’t go!" within "#closeAccountModal" + When I put in my password in "close_account_password" And I press "close_account_confirm" And I confirm the alert