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 

Sunday, June 7, 2015

Oh, some interesting things w/ the app

I've tried to go about this the TDD way. I haven't been testing so much at work... well I dont even use Rails at work either :)

Some examples-







Nothing terribly difficult here, at least now, but these tests have saved me from times when I thought I was only updating one thing, but actually changed the structure much deeper.

OH, another WAY cool thing is a "seed". I want to test how this site reacts with a lot of users.

The faker gem rules and allows me to seed my db:












Also know that I created some other users there for testing (some admins, some not). Ok, back to my admin work.

Massage App

So @ AKQA we have massages and the way to signup is one of two ways:

1. A signup sheet
2. An online form

The first option is not very good because an email is sent out and then there is a rush to where the form is. Of course, if you are in a meeting, dont see the email or maybe not in the office that day you totally miss out.

The second option isn't great because of some of the above reasons and that the people who see the email first get first dibs.

Essentially, its a mad rush and I feel there must be a better way.

I am going to build an app where an admin can create an event and users can select a time for that event.

You can checkout the code here (dont ask why it is called talktome)
and a live version on heroku here

There are essentially 3 phases for this:

1. Users & Admin signup (and a confirmation email is sent)
2. An admin creates an event (which is emailed to users)
3. Users signup for events

Note- the authorization has already been written, now onto getting the admin section completed