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