Starting today I'm going to add a title to each blog post instead of the generic title of "DayXX WeekXX" so that I can tell from the title roughly what I'd be writing about.

I also successfully built the mailer function and allowed it to be previewed locally using gem letter_openter. But because the homework instruction has asked that we "complete the formatting" for the emails, I have not submitted the mail function screenshots. I learned that emails cannot be formatted as easily because once it's sent out it cannot read a separate .css file for formatting so all of the CSS need to be written inline. This would take forever given my lack of experience writing CSS, so I took some time figuring out how to use gems to help... but still working on it so more on that later when I have it all figured out.

I built the admin/orders page to view all orders without referencing any previous homework instructions, but by referencing the previous job-listing and rails103 homeworks codes.


The highlight today was when I logically figured out how to route admin/orders destroy action correctly between the Controller and Views. So up to this point, I would often copy/paste an CRUD action definition from another controller or a previous project, and test whether it would work for the current controller by trial-and-error. But this time I understood that because destroy method works on a single order, thus the order must be found, and the finding should be based on the token which was pre-generated when each order is created, so find_by_token(params[:id])

The low point today was when I tried to look up how to use gem roadie to figure out how email formatting works, it was not immediately clear to me how to do so. I found this website (https://cookieshq.co.uk/posts/how-to-style-emails-with-rails-and-roadie/) that seemed to have a very good instruction on how to build good-looking emails, but I couldn't follow the instructions entirely. I couldn't understand the following lines:

3. Separate HTML (I've put it into HAML for readability) from the CSS. Put the HAML file in your app/views/layouts folder and the CSS on your app/assets/stylesheets folder.

4. Add email.css to the asset precompilation line on your application.rb.

5. Tell your mailer, or some of your emails methods, to use the layout you just created. This is very easy and explained on the Rails Guides

6. Get your layout to yield for the contents in your email views. As you will be working with tables, it could be a good a idea to have the main table in the layout, and the rows corresponding for the header and the footer in the layout as well. In the gist linked before, you can see an example, but it will vary depending on your template.

7. Adapt your mailer views to work as (or within) a table.

I will get some help on using gem roadie and see if I can get it working once I've completed the other development-oriented tasks.


One thing I realized is that working on beautifying an app can take a very long time. Bootstrap is great, but it has one theme, a very "bootstrapped" theme. So while its functions can be tested, it could never make the kind of visual impact I'd like without some level of customization, or better yet, an entirely new theme from a shrewd designer.


Tomorrow I will work more efficiently and try to catch up with the tasks given. I think deployment will cause some headaches (with the mailer, key, and everything else that's different from developmeent environment).