Simple Schedule Dev Diary - Week 4. Profile, Settings, Passwords and Attendees.
As January closed and February begun, I was hoping to have the beta ready. Plans are plans and are always changing, although some of it was out my control.
I’m happy with the progress during the week and am pleased that I’m learning a lot and getting more confident with using Rails. Did I ever mention that Ruby is also a really nice language?
Profile and Settings
Earlier this week I purely concentrated on getting the profile and settings pages complete. This allows you to update certain things like email, display name and a URL for you or your organisation. Those two will show publicly on the Event page. It was my plan to add a profile image but decided to wait for ‘ActiveStorage’ to be released so I don’t have to rely on a gem to get this done. ActiveStorage basically integrates with many online hosting solutions like AWS S3, which I’ll use. Can't wait to see it in Rails 5.2!
When the email is changed, it sends out an email, using Mailgun, to that email to confirm it. Just want to make sure it’s correct and can be verified as I plan on using magic links for log in. I’ve got a few other features planned so I’d like to keep emails verified. If it doesn’t get confirmed and you try to login, it will use the old email. I may change the way this works though.
Profile and settings don’t have many options at the moment, but I have a few in mind after beta, for example I want to add the option for optionally logging into the system with a password, send out email digests for signups (daily, weekly etc) and a few others like setting a standard ‘time zone’. Oh and not to forget the profile image.
During the week, I actually reworked this section a few times. I usually get something working and then refactor to make it that much nicer (that I can live with).
Another feature I added was account deletion. This sends out a link to the registered and verified email address with a delete link, which is active for 15 mins. After 15mins it will no longer work and you will also have to be logged in, in order to delete the account. There is similar logic to the email verification link and login.
Passwords
When you spend time logging in and out all the time to test things, you sort of realise that having a password option would actually be nice! Emails usually take a bit of time to arrive, not too long… but long enough. I don’t expect many people to always log out of their sessions, they are set with a long cookie (20 years)… however, I just don’t know.
I’ve had a quick think about this and will probably implement this during beta. At the moment, during registration, I’ll create the account and log the user in straight away, this fires off a ‘email verification’ email. Here I'd like to work on an on-boarding section (optional) which will also give the user a choice to use a password instead.
Similar to Basecamp, when you log in with the email, it will check if you prefer a password to login and present the user with the password field.
I think giving the option would work quite well.
Attendees
With the above account sections complete I got to work on the ‘My Attendees’ page. This is something I wanted to do before getting to work on ‘My Events’ to ease me into it nicely. True, I usually like diving into the deep end but thought it best to start with something a bit easier.
I’m happy that I’m following my design and I’m also glad that it is something I have done beforehand. It just makes it that much better to work on the code part and concentrate on getting that to work.
The design isn’t perfect and didn’t accommodate too much for errors and other things, so I worked hard on getting all those to work too. As I already had most of the groundwork done, it was easy to add design elements that I didn’t consider. Also, learning about “object” errors in Rails was good.
You can see here that I added the information of what went wrong and highlighted the field.
I also wanted to make sure that every attendee is unique for the current logged in user. Nothing like having multiple entires for the same attendee. This was quite easy to achieve using ‘scope’ on the Attendee model within Rails.
validates :email, uniqueness: { case_sensitive: false, scope: :user_id }
I shortened the above code somewhat to display here, but this works really well! The screenshot above shows me trying to add a user that already exists for my logged in account.
Pretty happy with how that works.
Depending on how many attendees there are, it will also show you a search box. No point in showing search when you only have 5 attendees in total. I think it’s nice to be able to hide elements when you don’t need them. Search shows up when there are 10 or more, a good number I hope.
Here is the search:
Hope to add something a bit more dynamic as you type, to update the list below. This form just posts data and displays results.
If there are no users found… I show the create modal:
Happy with the way it worked out at the end. Once I finish ‘My Events’ I’ll be coming back to this section to complete it.
Hope to also add a bit more fuzzy search. For searching I use the ‘pg_search’ gem. Works great and I’m happy with it!
With this section near complete I also worked on re-working some logic of previously coded section, thanks to me getting wiser with Rails.
Another neat trick, as I wanted to highlight the current page your are on in the navigation and also show certain options depending on the controller or ‘action’.
That was quite easy to implement and am finally happy with using something like below:
You can see that I look for the current ‘action_name’ as I’m posting values for ‘search’ in order to render the search bar when there are no results or less than 10. Really handy!
For the header bar I now use the same logic to highlight the button depending on the section you are on:
<% if controller.controller_name == "attendees" %>class="active"<% end %>
Please don’t ask me what I used before that!
current_page?(root_url)
Bleh. Didn’t work out so well… especially when posting data and others. Although... useful!
Next steps
I wrote down the Events database/model which also includes Bookings, Dates and Times. They will be their own model and will help me with figuring out multi day events with time slots. I left it out from my frontend design as I didn’t know how to tackle it. I think I know how to now. It will need to be designed at some stage.
All going well, I’ll make a start with Events tonight and continue this throughout the week, inching ever so closer to the first beta release. I don’t want to put a date on it just yet but hoping for either by the weekend or the next. Let’s see. Loads to do.
Trello board is being kept up to date and I’ll also be creating a new one for the Beta release.
There are a few tiny design changes that I’d love to do but perhaps I leave these until the end of beta.
If you like to contribute, please email me or let me know via Micro.blog. There is also the Simple Schedule holding site where you can sign up for a beta. On top, there is now a public Trello board with dev site progress. You can visit the 'pre-alpha' website to play around.
For other posts on the challenge, check out the links below:
- Code challenge - from zero to web app in 60 days.
- Code challenge - Prelude and Day 1 - Setting things up.
- Code challenge - Day 2.
- Code challenge - Day 3. Holding page.
- Code Challenge - Day 4. A login page and a few tweaks.
- Code Challenge - Day 5. Registration page and preliminary app navigation.
- Code Challenge - Day 6. Getting in the groove, new events, MVP considerations.
- Code Challenge - Day 7. 'My Events' view.
- Code Challenge - Day 8. Burning the midnight oil, loud music and good progress.
- Code Challenge - Day 9. Progress, changes and regrets.
- Code Challenge - Day 10. There are no events, pricing thoughts and badges.
- Code Challenge - Day 11. New logo, further changes to event details and a tiny tweak.
- Code Challenge - Day 12. Final frontend stretch.
- Code Challenge - Day 13. Choosing Rails, getting into the swing and thoughts on a multi tenancy app.
- Code Challenge - Day 14 & 15. Blog post thoughts, passwords and learning.
- Simple Schedule - Day 16 & 17. Register, Login and sharing progress.