Added badge system

This commit is contained in:
MrYummy
2017-05-28 17:39:06 -04:00
parent 992406a20b
commit 276949c0cd
11 changed files with 124 additions and 29 deletions

View File

@@ -11,7 +11,7 @@
<li>Donator+ ($20 or more)
</ul>
<p>We also have <%= link_to "list of users who donated", users_path(role: "donor") %> already!</p>
<p>We also have <%= link_to "list of users who donated", users_path(badge: "donor") %> already!</p>
<h3>Perks for you</h3>
<p>For <i>Donator</i> and <i>Donator+</i></p>
@@ -45,4 +45,4 @@
</div>
<hr>
<p class="small">Please note that you are not buying anything. We do not guarantee for these perks, however, we will try hard to make sure you'll get them! Donations are processed manually, it can take a few hours.</p>
<p class="small">Please note that you are not buying anything. We do not guarantee for these perks, however, we will try hard to make sure you'll get them! Donations are processed manually, it can take a few hours.</p>

View File

@@ -1,4 +1,4 @@
<div class="user">
<%= link_to user.name, user, class: "role #{user.role.name} #{"banned" if user.banned?} #{"disabled" if user.disabled?} #{"unconfirmed" unless user.confirmed?}", title: "#{user.ign} #{user.role}", style: "color: #{fcolor(user.role.color)}; background-color: #{user.role.color}" %>
<%= link_to "$", donate_statics_path, class: "role donor", title: "Donator" if user.donor? %>
</div>
<%= link_to user.badge.symbol, users_path(badge: user.badge.name), class: "role badge", title: user.badge.name, style: "color: #{fcolor(user.badge.color)}; background-color: #{user.badge.color}" unless user.badge.value == 0 %>
</div>

View File

@@ -28,15 +28,17 @@
</td>
</tr>
<tr>
<td>Confirmed email address</td>
<td>Badge</td>
<td>
<%= f.select :confirmed, [["No", false], ["Yes", true]], {}, { disabled: !can_edit? } %>
<% if current_user.role >= Role.get(:mod) %>
<%= f.select :badge, Badge.all %>
<% end %>
</td>
</tr>
<tr>
<td>Donator</td>
<td>Confirmed email address</td>
<td>
<%= f.select :donor, [["No", false], ["Yes", true]], {}, { disabled: !can_edit? } %>
<%= f.select :confirmed, [["No", false], ["Yes", true]], {}, { disabled: !can_edit? } %>
</td>
</tr>
<% end %>
@@ -87,4 +89,4 @@
<span class='red-alert'>This user has not confirmed his email!</span>
<% end %>
<% end %>
<% end %>
<% end %>

View File

@@ -1,12 +1,16 @@
<h1>
<% if params[:role] %>
<% if params[:role] && !params[:badge]%>
<%= title "All '#{params[:role]}' users" %>
<% elsif params[:badge] && !params[:role] %>
<%= title "All '#{params[:badge]}' users" %>
<% elsif params[:role] && params[:badge] %>
<%= title "All '#{params[:role]}' and '#{params[:badge]}' users" %>
<% else %>
<%= title "All Users" %>
<% end %>
(<%= @count %>)
</h1>
<%= link_to "show all", users_path if params[:role] %>
<%= link_to "show all", users_path if params[:role] || params[:badge] %>
<div id="userlist">
<% @users.each do |u| %>
@@ -19,4 +23,4 @@
</div>
<% end %>
<%= paginate @users %>
</div>
</div>