Tuesday, June 9, 2015

Two big things, one post

Today was a fun day. A lot of the hard work I put in @ Apple paid off, and during WWDC the pages I worked on came live! YAY

Also, for the massage app, got a lot done... specifically I was happy to get much of the logic down for the Admin users. I still have not created the day-of event specs, but that is for tomorrow.

Some things I am proud of:

def admin_user
if !logged_in?
flash[:info] = "please log in"
elsif !current_user.admin?
redirect_to(root_url) && flash[:info] = "Not an admin, cannot create events"
elsif current_user.admin?
flash.now[:info] = "create your event here"
end
end

This is actually part of a before_action I have on my events controller. I was trying to remember a way to ensure only certain classes of users could make it to a page, and thanks again to Hartl's Tutorial it came back. Check out the controller

Oh, and some super simple jQuery to hide some flash messages (like the ones above)

$('document').ready(function() {
setTimeout(function() {
$('.alert-info').slideUp();
}, 3000);
setTimeout(function() {
$('.alert-success').slideUp();
}, 3500);
});

I liked that... nice to get those to go away 

No comments:

Post a Comment