the User model could use some simpler helpers, which would dramatically simplify some template code for showing things only to moderators or admins, like this:
Instead, let's make a user model method like:
user.is_role(:admin)
Then that code could become:
if user.is_role(:admin, :moderator)
But we need to be able to specify if it's AND or OR -- any ideas?
Maybe:
user.is_one_of_roles(:admin, :moderator)
We could also simplify by making an application_helper method like:
user_has_role(:admin, :moderator)
where we also check if there is a current_user, further simplifying the code!
We'd love some help with this, and ideally the new methods would be tested as well! Thanks!
Reposting from part of #268
Ack! We actually have this! So this issue could be for switching to this system:
This could be broken into many first-timers-only issues using search results from this:
This has been marked as a good candidate for becoming a first-timers-only issue like these, meaning that it's simple, self-contained, and with some extra formatting, could be a great entry point for a new contributor. If you're familiar enough with this code, please consider reformatting or reposting it as a first-timers-only issue, and then ping @publiclab/reviewers to get it labelled. Or, if this is not your first time, try to solve it yourself!
Made https://github.com/publiclab/plots2/issues/5306 for admin_controller.rb!
@jywarren I am a ROR developer and I am new to open source. I would like to work on this.
We will love to have your help
On Fri, Apr 19, 2019, 4:53 AM Srinandan Pai notifications@github.com
wrote:
@jywarren https://github.com/jywarren I am a ROR developer and I am new
to open source. I would like to work on this.—
You are receiving this because you are on a team that was mentioned.
Reply to this email directly, view it on GitHub
https://github.com/publiclab/plots2/issues/5259#issuecomment-484721123,
or mute the thread
https://github.com/notifications/unsubscribe-auth/AFAAEQZENCA5DGQDLLAG4LDPRD7H7ANCNFSM4HA6BSOQ
.