added moderator to users
This commit is contained in:
parent
f403a0a2f8
commit
2530d6a83f
20
Rakefile
20
Rakefile
|
@ -72,6 +72,26 @@ namespace :justask do
|
|||
user.save!
|
||||
puts "#{user.screen_name} no longer an admin."
|
||||
end
|
||||
|
||||
desc "Gives moderator status to an user."
|
||||
task :mod, [: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.moderator = true
|
||||
user.save!
|
||||
puts "#{user.screen_name} is now an moderator."
|
||||
end
|
||||
|
||||
desc "Removes moderator status from an user."
|
||||
task :demod, [: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.moderator = false
|
||||
user.save!
|
||||
puts "#{user.screen_name} no longer an moderator."
|
||||
end
|
||||
|
||||
desc "Lists all users."
|
||||
task lusers: :environment do
|
||||
|
|
|
@ -22,6 +22,13 @@
|
|||
font-size: 80%;
|
||||
}
|
||||
|
||||
.profile--moderator {
|
||||
color: $brand-warning;
|
||||
text-transform: uppercase;
|
||||
font-weight: bold;
|
||||
font-size: 80%;
|
||||
}
|
||||
|
||||
.profile--text {
|
||||
margin-bottom: 2px;
|
||||
}
|
||||
|
|
|
@ -13,6 +13,10 @@
|
|||
%p.profile--admin
|
||||
%i.fa.fa-flask
|
||||
Admin
|
||||
- if @user.moderator?
|
||||
%p.profile--moderator
|
||||
%i.fa.fa-users
|
||||
Mod
|
||||
- unless @user.bio.blank?
|
||||
%p.profile--text= @user.bio
|
||||
- unless @user.website.blank?
|
||||
|
|
|
@ -11,7 +11,7 @@
|
|||
#
|
||||
# It's strongly recommended that you check this file into your version control system.
|
||||
|
||||
ActiveRecord::Schema.define(version: 20141213182609) do
|
||||
ActiveRecord::Schema.define(version: 20141226115905) do
|
||||
|
||||
# These are extensions that must be enabled in order to support this database
|
||||
enable_extension "plpgsql"
|
||||
|
@ -127,6 +127,7 @@ ActiveRecord::Schema.define(version: 20141213182609) do
|
|||
t.string "website", default: "", null: false
|
||||
t.string "location", default: "", null: false
|
||||
t.text "bio", default: "", null: false
|
||||
t.boolean "moderator", default: false, null: false
|
||||
end
|
||||
|
||||
add_index "users", ["email"], name: "index_users_on_email", unique: true, using: :btree
|
||||
|
|
Loading…
Reference in New Issue