Added lead mod, developer and trainingmod as suffixes

Added lead mod, developer and trainingmod as suffixes so that you can
have two of them together (if needed)
This commit is contained in:
Jonas Folvik
2015-12-29 12:16:28 +01:00
parent d5edeca666
commit ccac3fc975
3 changed files with 32 additions and 10 deletions

View File

@@ -35,6 +35,18 @@ class User < ActiveRecord::Base
!!self.donor
end
def developer?
!!self.developer
end
def trainingmod?
!!self.trainingmod
end
def lead_mod?
!!self.lead_mod
end
def confirmed?
!!self.confirmed
end
@@ -61,14 +73,6 @@ class User < ActiveRecord::Base
!!(self.role >= :normal)
end
def trainingmod?
!!(self.role >= :trainingmod)
end
def developer?
!!(self.role >= :developer)
end
def mod?
!!(self.role >= :mod)
end

View File

@@ -40,6 +40,26 @@
</td>
</tr>
<% end %>
<% if admin? %>
<tr>
<td>Developer</td>
<td>
<%= f.select :developer, [["No", false], ["Yes", true]], {}, { disabled: !can_edit? } %>
</td>
</tr>
<tr>
<td>TrainingMod</td>
<td>
<%= f.select :trainingmod, [["No", false], ["Yes", true]], {}, { disabled: !can_edit? } %>
</td>
</tr>
<tr>
<td>Lead Mod</td>
<td>
<%= f.select :lead_mod, [["No", false], ["Yes", true]], {}, { disabled: !can_edit? } %>
</td>
</tr>
<% end %>
<tr>
<td>Skype username</td>
<td>

View File

@@ -5,8 +5,6 @@ Role.create!([
{name: "disabled", value: 1, color: "#ccc"},
{name: "banned", value: 2, color: "#ccc"},
{name: "normal", value: 10, color: "#282"},
{name: "trainingmod", value: 40, color: "#fa5"},
{name: "developer", value: 70, color: "#a0a"},
{name: "mod", value: 100, color: "#6af"},
{name: "admin", value: 200, color: "#d22"},
{name: "superadmin", value: 500, color: "#d22"}