Commit b7fc0e81cefcc49a4bc1a60e1588c443b2af26df

Authored by Dmitriy Zaporozhets
2 parents d46dba58 d9b5777d

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
app/models/user.rb
@@ -41,6 +41,7 @@ @@ -41,6 +41,7 @@
41 # confirmed_at :datetime 41 # confirmed_at :datetime
42 # confirmation_sent_at :datetime 42 # confirmation_sent_at :datetime
43 # unconfirmed_email :string(255) 43 # unconfirmed_email :string(255)
  44 +# hide_no_ssh_key :boolean default(FALSE), not null
44 # 45 #
45 46
46 require 'carrierwave/orm/activerecord' 47 require 'carrierwave/orm/activerecord'
@@ -52,7 +53,7 @@ class User < ActiveRecord::Base @@ -52,7 +53,7 @@ class User < ActiveRecord::Base
52 53
53 attr_accessible :email, :password, :password_confirmation, :remember_me, :bio, :name, :username, 54 attr_accessible :email, :password, :password_confirmation, :remember_me, :bio, :name, :username,
54 :skype, :linkedin, :twitter, :color_scheme_id, :theme_id, :force_random_password, 55 :skype, :linkedin, :twitter, :color_scheme_id, :theme_id, :force_random_password,
55 - :extern_uid, :provider, :password_expires_at, :avatar, 56 + :extern_uid, :provider, :password_expires_at, :avatar, :hide_no_ssh_key,
56 as: [:default, :admin] 57 as: [:default, :admin]
57 58
58 attr_accessible :projects_limit, :can_create_group, 59 attr_accessible :projects_limit, :can_create_group,
app/views/shared/_no_ssh.html.haml
1 -- if cookies[:hide_no_ssh_message].blank? && current_user.require_ssh_key? 1 +- if cookies[:hide_no_ssh_message].blank? && current_user.require_ssh_key? && !current_user.hide_no_ssh_key
2 .no-ssh-key-message 2 .no-ssh-key-message
3 .container 3 .container
4 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 4 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
5 - = link_to '#', class: 'pull-right hide-no-ssh-message' do  
6 - %i.icon-remove 5 + %div.pull-right
  6 + = link_to "Don't show again", profile_path(user: {hide_no_ssh_key: true}), method: :put, class: 'hide-no-ssh-message', remote: true
  7 + |
  8 + = link_to 'Remind later', '#', class: 'hide-no-ssh-message'
db/migrate/20131214224427_add_hide_no_ssh_key_to_users.rb 0 → 100644
@@ -0,0 +1,5 @@ @@ -0,0 +1,5 @@
  1 +class AddHideNoSshKeyToUsers < ActiveRecord::Migration
  2 + def change
  3 + add_column :users, :hide_no_ssh_key, :boolean, :default => false
  4 + end
  5 +end