From 246989bcca07e71bcec37886d0303a22e4da8420 Mon Sep 17 00:00:00 2001 From: Dmitriy Zaporozhets Date: Mon, 27 May 2013 15:43:44 +0300 Subject: [PATCH] more descriptive confirmation messages --- app/helpers/tree_helper.rb | 4 ++++ app/views/deploy_keys/_deploy_key.html.haml | 2 +- app/views/edit_tree/show.html.haml | 4 ++-- app/views/groups/edit.html.haml | 2 +- app/views/protected_branches/index.html.haml | 2 +- app/views/snippets/_form.html.haml | 2 +- 6 files changed, 10 insertions(+), 6 deletions(-) diff --git a/app/helpers/tree_helper.rb b/app/helpers/tree_helper.rb index 1f764ea10..a8491dfe3 100644 --- a/app/helpers/tree_helper.rb +++ b/app/helpers/tree_helper.rb @@ -85,4 +85,8 @@ module TreeHelper file = File.join(tree.path, "..") tree_join(tree.ref, file) end + + def leave_edit_message + "Leave edit mode?\nAll unsaved changes will be lost." + end end diff --git a/app/views/deploy_keys/_deploy_key.html.haml b/app/views/deploy_keys/_deploy_key.html.haml index b2c59c140..45f80ecd5 100644 --- a/app/views/deploy_keys/_deploy_key.html.haml +++ b/app/views/deploy_keys/_deploy_key.html.haml @@ -10,7 +10,7 @@ %i.icon-off Disable - else - = link_to 'Remove', project_deploy_key_path(@project, deploy_key), confirm: 'Are you sure?', method: :delete, class: "btn btn-remove delete-key btn-small pull-right" + = link_to 'Remove', project_deploy_key_path(@project, deploy_key), confirm: 'You are going to remove deploy key. Are you sure?', method: :delete, class: "btn btn-remove delete-key btn-small pull-right" = link_to project_deploy_key_path(deploy_key.projects.include?(@project) ? @project : deploy_key.projects.first, deploy_key) do diff --git a/app/views/edit_tree/show.html.haml b/app/views/edit_tree/show.html.haml index 94a577d8e..17d813ce7 100644 --- a/app/views/edit_tree/show.html.haml +++ b/app/views/edit_tree/show.html.haml @@ -10,7 +10,7 @@ %strong= @ref %span.options .btn-group.tree-btn-group - = link_to "Cancel", project_blob_path(@project, @id), class: "btn btn-tiny btn-cancel", confirm: "Are you sure?" + = link_to "Cancel", project_blob_path(@project, @id), class: "btn btn-tiny btn-cancel", confirm: leave_edit_message .file_content.code %pre#editor= @blob.data @@ -27,7 +27,7 @@ .message to branch %strong= @ref - = link_to "Cancel", project_blob_path(@project, @id), class: "btn btn-cancel", confirm: "Are you sure?" + = link_to "Cancel", project_blob_path(@project, @id), class: "btn btn-cancel", confirm: leave_edit_message :javascript ace.config.set("modePath", "#{Gitlab::Application.config.assets.prefix}/ace-src-noconflict") diff --git a/app/views/groups/edit.html.haml b/app/views/groups/edit.html.haml index eb4f324b3..d6a828fee 100644 --- a/app/views/groups/edit.html.haml +++ b/app/views/groups/edit.html.haml @@ -26,7 +26,7 @@ .pull-right = link_to 'Team', project_team_index_path(project), id: "edit_#{dom_id(project)}", class: "btn btn-small" = link_to 'Edit', edit_project_path(project), id: "edit_#{dom_id(project)}", class: "btn btn-small" - = link_to 'Remove', project, confirm: "REMOVE #{project.name}? Are you sure?", method: :delete, class: "btn btn-small btn-remove" + = link_to 'Remove', project, remove_project_message(project), method: :delete, class: "btn btn-small btn-remove" - if @group.projects.blank? %p.nothing_here_message This group has no projects yet diff --git a/app/views/protected_branches/index.html.haml b/app/views/protected_branches/index.html.haml index 15644de55..a338344c5 100644 --- a/app/views/protected_branches/index.html.haml +++ b/app/views/protected_branches/index.html.haml @@ -51,4 +51,4 @@ (branch was removed from repository) %td - if can? current_user, :admin_project, @project - = link_to 'Unprotect', [@project, branch], confirm: 'Are you sure?', method: :delete, class: "btn btn-remove btn-small" + = link_to 'Unprotect', [@project, branch], confirm: 'Branch will be writable for developers. Are you sure?', method: :delete, class: "btn btn-remove btn-small" diff --git a/app/views/snippets/_form.html.haml b/app/views/snippets/_form.html.haml index 77162cdcd..993a20058 100644 --- a/app/views/snippets/_form.html.haml +++ b/app/views/snippets/_form.html.haml @@ -30,7 +30,7 @@ = f.submit 'Save', class: "btn-save btn" = link_to "Cancel", project_snippets_path(@project), class: " btn" - unless @snippet.new_record? - .pull-right= link_to 'Destroy', [@project, @snippet], confirm: 'Are you sure?', method: :delete, class: "btn pull-right danger delete-snippet", id: "destroy_snippet_#{@snippet.id}" + .pull-right= link_to 'Destroy', [@project, @snippet], confirm: 'Removed snippet cannot be restored! Are you sure?', method: :delete, class: "btn pull-right danger delete-snippet", id: "destroy_snippet_#{@snippet.id}" :javascript -- 2.11.0