Commit d9b5777db182ba3ee2341b19246feba86adb5708

Authored by Drew Blessing
1 parent d476ac7d

Allow user to hide the message to add an ssh key permanently

Favor links instead of buttons

Remove unnecessary class

Remove extra space
app/models/user.rb
... ... @@ -41,6 +41,7 @@
41 41 # confirmed_at :datetime
42 42 # confirmation_sent_at :datetime
43 43 # unconfirmed_email :string(255)
  44 +# hide_no_ssh_key :boolean default(FALSE), not null
44 45 #
45 46  
46 47 require 'carrierwave/orm/activerecord'
... ... @@ -52,7 +53,7 @@ class User < ActiveRecord::Base
52 53  
53 54 attr_accessible :email, :password, :password_confirmation, :remember_me, :bio, :name, :username,
54 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 57 as: [:default, :admin]
57 58  
58 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 2 .no-ssh-key-message
3 3 .container
4 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 @@
  1 +class AddHideNoSshKeyToUsers < ActiveRecord::Migration
  2 + def change
  3 + add_column :users, :hide_no_ssh_key, :boolean, :default => false
  4 + end
  5 +end
... ...