FirehoseCommunity / DEFCON

6 stars 4 forks source link

Setup a Badge System so Admin can grant users custom badges #88

Open kenmazaika opened 8 years ago

kenmazaika commented 8 years ago

Allow custom and canned badges.

VictoriaBrouard commented 8 years ago

@robertsapunarich

Hi Robert - I was wondering if you wanted to pair on this as I think I need a little guidance - I was hoping your extra few months in the coding world would help. I've done some digging online and I can see quite a bit about adding merits and reputations badges for gaming, which is close to what's needed but not quite as the badge will be admin added, not dependent on scores/levels.

I've been looking at the Merit Gem....

Do you have any pointers @kenmazaika?

kenmazaika commented 8 years ago

Looks like an interesting gem, super useful. I was thinking you could build it from scratch. All I was thinking initially was having a separate database model for "Badge" that belongs to user, and then have standard CRUD to manage it. Using the gem might be a good idea though.

VictoriaBrouard commented 8 years ago

I've started on this and I was going to work on the basis that I could add a form/button for modal form to the user's profile page only visible to admin. The admin could then select and apply a badge to be shown on the user profile page.

However....do we have a user profile show page yet? I can see we have the user dashboard, but this will only be viewable by the user not admin or anyone else.

Thanks

kenmazaika commented 8 years ago

I believe the user dashboard is the file in app/views/users/show.html.haml. You should be able to access it by: /users/:id, if I remember correctly.

VictoriaBrouard commented 8 years ago

I understand this but I mean from a use perspective, the badges are given by admins to users right? so if I add the form/button to the user dashboard, this isn't (or won't be) accessible by admins, only the user to who it belongs to, so how would an admin use the function?

kenmazaika commented 8 years ago

Sure they could. You could add a check on a non-admin page for the thing.

<% if current_user && current_user.admin %>
  --- custom logic here
<% end %>
VictoriaBrouard commented 8 years ago

I've moved this forward but am stuck with my controller. I think I have a problem with user params... can you check out my branch - issue 88.

Thank you and sorry I couldn't make the call - I would have asked this question then.

VictoriaBrouard commented 8 years ago

Hi Ken

I just wondered if you'd been able to look at this?

kenmazaika commented 8 years ago

I made some notes over on this Pull Request a few days ago: https://github.com/FirehoseCommunity/DEFCON/pull/146

That has the notes I had on your code. It's easier to comment about the code directly inline, seeing the code side-by-side, so I made a PR.