summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>2013-12-16 03:25:00 -0800
committerDmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>2013-12-16 03:25:00 -0800
commitb7fc0e81cefcc49a4bc1a60e1588c443b2af26df (patch)
treeae2d8c9483a967c17ddb1a91a458185d7f480ede
parentd46dba58302a2e4aa55991f88b302dd6c15539dd (diff)
parentd9b5777db182ba3ee2341b19246feba86adb5708 (diff)
downloadgitlab-ce-b7fc0e81cefcc49a4bc1a60e1588c443b2af26df.tar.gz
Merge pull request #5849 from bke-drewb/feature/hide_no_ssh_key_message
Allow user to hide the message to add an ssh key permanently
-rw-r--r--app/models/user.rb3
-rw-r--r--app/views/shared/_no_ssh.html.haml8
-rw-r--r--db/migrate/20131214224427_add_hide_no_ssh_key_to_users.rb5
3 files changed, 12 insertions, 4 deletions
diff --git a/app/models/user.rb b/app/models/user.rb
index d71f2d8de96..d36af7a8b8a 100644
--- a/app/models/user.rb
+++ b/app/models/user.rb
@@ -41,6 +41,7 @@
# confirmed_at :datetime
# confirmation_sent_at :datetime
# unconfirmed_email :string(255)
+# hide_no_ssh_key :boolean default(FALSE), not null
#
require 'carrierwave/orm/activerecord'
@@ -52,7 +53,7 @@ class User < ActiveRecord::Base
attr_accessible :email, :password, :password_confirmation, :remember_me, :bio, :name, :username,
:skype, :linkedin, :twitter, :color_scheme_id, :theme_id, :force_random_password,
- :extern_uid, :provider, :password_expires_at, :avatar,
+ :extern_uid, :provider, :password_expires_at, :avatar, :hide_no_ssh_key,
as: [:default, :admin]
attr_accessible :projects_limit, :can_create_group,
diff --git a/app/views/shared/_no_ssh.html.haml b/app/views/shared/_no_ssh.html.haml
index 2a365ce4f63..077e6c6a808 100644
--- a/app/views/shared/_no_ssh.html.haml
+++ b/app/views/shared/_no_ssh.html.haml
@@ -1,6 +1,8 @@
-- if cookies[:hide_no_ssh_message].blank? && current_user.require_ssh_key?
+- if cookies[:hide_no_ssh_message].blank? && current_user.require_ssh_key? && !current_user.hide_no_ssh_key
.no-ssh-key-message
.container
You won't be able to pull or push project code via SSH until you #{link_to 'add an SSH key', new_profile_key_path} to your profile
- = link_to '#', class: 'pull-right hide-no-ssh-message' do
- %i.icon-remove
+ %div.pull-right
+ = link_to "Don't show again", profile_path(user: {hide_no_ssh_key: true}), method: :put, class: 'hide-no-ssh-message', remote: true
+ |
+ = link_to 'Remind later', '#', class: 'hide-no-ssh-message'
diff --git a/db/migrate/20131214224427_add_hide_no_ssh_key_to_users.rb b/db/migrate/20131214224427_add_hide_no_ssh_key_to_users.rb
new file mode 100644
index 00000000000..7cec79e7ee8
--- /dev/null
+++ b/db/migrate/20131214224427_add_hide_no_ssh_key_to_users.rb
@@ -0,0 +1,5 @@
+class AddHideNoSshKeyToUsers < ActiveRecord::Migration
+ def change
+ add_column :users, :hide_no_ssh_key, :boolean, :default => false
+ end
+end