From d9b5777db182ba3ee2341b19246feba86adb5708 Mon Sep 17 00:00:00 2001 From: Drew Blessing Date: Sat, 14 Dec 2013 19:28:17 -0600 Subject: [PATCH] Allow user to hide the message to add an ssh key permanently --- app/models/user.rb | 3 ++- app/views/shared/_no_ssh.html.haml | 8 +++++--- db/migrate/20131214224427_add_hide_no_ssh_key_to_users.rb | 5 +++++ 3 files changed, 12 insertions(+), 4 deletions(-) create mode 100644 db/migrate/20131214224427_add_hide_no_ssh_key_to_users.rb diff --git a/app/models/user.rb b/app/models/user.rb index 25a0408..ea6ecc3 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 2a365ce..077e6c6 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 0000000..7cec79e --- /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 -- libgit2 0.21.2