diff --git a/Rakefile b/Rakefile index 8c169681..cce9964f 100644 --- a/Rakefile +++ b/Rakefile @@ -70,7 +70,7 @@ namespace :justask do fail "user #{args[:screen_name]} not found" if user.nil? user.admin = false user.save! - puts "#{user.screen_name} no longer an admin." + puts "#{user.screen_name} is no longer an admin." end desc "Gives moderator status to an user." @@ -113,6 +113,26 @@ namespace :justask do puts "#{user.screen_name} is no longer banned." end + desc "Gives blogger status to an user." + task :blog, [:screen_name] => :environment do |t, args| + fail "screen name required" if args[:screen_name].nil? + user = User.find_by_screen_name(args[:screen_name]) + fail "user #{args[:screen_name]} not found" if user.nil? + user.blogger = true + user.save! + puts "#{user.screen_name} is now a blogger." + end + + desc "Removes blogger status from an user." + task :unblog, [:screen_name] => :environment do |t, args| + fail "screen name required" if args[:screen_name].nil? + user = User.find_by_screen_name(args[:screen_name]) + fail "user #{args[:screen_name]} not found" if user.nil? + user.blogger = false + user.save! + puts "#{user.screen_name} is no longer a blogger." + end + desc "Gives supporter status to an user." task :sup, [:screen_name] => :environment do |t, args| fail "screen name required" if args[:screen_name].nil? @@ -130,7 +150,7 @@ namespace :justask do fail "user #{args[:screen_name]} not found" if user.nil? user.supporter = false user.save! - puts "#{user.screen_name} no longer an supporter." + puts "#{user.screen_name} is no longer an supporter." end desc "Lists all users." diff --git a/app/assets/stylesheets/scss/user.scss b/app/assets/stylesheets/scss/user.scss index 55101e25..799296ac 100644 --- a/app/assets/stylesheets/scss/user.scss +++ b/app/assets/stylesheets/scss/user.scss @@ -22,27 +22,6 @@ margin: 0px 0px 0.2em; } -.profile--admin { - color: $brand-danger; - text-transform: uppercase; - font-weight: bold; - font-size: 80%; -} - -.profile--moderator { - color: $brand-success; - text-transform: uppercase; - font-weight: bold; - font-size: 80%; -} - -.profile--supporter { - color: $brand-warning; - text-transform: uppercase; - font-weight: bold; - font-size: 80%; -} - .profile--text { margin-bottom: 2px; line-height: 1.5em; @@ -106,20 +85,17 @@ color: #fff; } -.panel-badge-danger { - background-color: #E51C23; -} +$colours: danger $brand-danger, + default #BBB, + success $brand-success, + warning $brand-warning, + info $brand-info, + primary $brand-primary; -.panel-badge-default { - background-color: #BBB; -} - -.panel-badge-success { - background-color: #4CAF50; -} - -.panel-badge-warning { - background-color: #FF9800; +@each $colour in $colours { + .panel-badge-#{nth($colour, 1)} { + background-color: nth($colour, 2); + } } .user--banned { diff --git a/app/views/user/_profile_info.html.haml b/app/views/user/_profile_info.html.haml index dc310f11..5dfae7e0 100644 --- a/app/views/user/_profile_info.html.haml +++ b/app/views/user/_profile_info.html.haml @@ -12,6 +12,10 @@ .profile--panel-badge.panel-badge-warning %i.fa.fa-star Supporter + - if @user.blogger? + .profile--panel-badge.panel-badge-info + %i.fa.fa-pencil.fa-spin + Blogger - if @user.banned? .profile--panel-badge.panel-badge-default %i.fa.fa-ban