Monday, November 24, 2014

Appmaker Template Picker Progress Update

The second last week of this semester has already begun, and between 20 other errands to accomplish in this always merry and relaxed time frame, I have managed to get a hold of Pomax and discuss with him clarifications on how to go about moving forward and accomplishing my iterative solution for Appmaker Issue #2348. His only qualm with my initial pull request was that the current URL for arriving at the custom Appmaker template gallery list page looks very unreadable and hash-like in its address. What we have agreed to in the meantime was that Pomax will initiate a separate Webmaker issue in the meantime to accommodate this request by creating functionality for the URL address "" and that will be the de-facto address that I will use when creating my next pull request. Since the expert on implementing these sort of HTTP Option handlers and custom route logic is away, I will obviously still be using the presently functional old URL to test my logic up until the final commit.

If all of the stars will align, and my google-fu research will prove immediately effective in helping me accomplish my initial task for this last milestone of getting an iframe preview to fetch the resource on a user's mouseclick event, I might even able to hop on this newly created issue and contribute to its completion.

In all likelihood, my last update for this semester will be the pull request announcement. Stay tuned, as the cliffhanger is quickly nearing its conclusion.

Friday, November 14, 2014

0.3 Milestone Completed for the Price of Potentially Digging My Own Grave

Link to the PR:

As stated earlier, landing on this issue was a bit of a fluke. Well, since most of the bugs are kind of flukey in nature, this might more of a fluke of a fluke. As mentioned previously, Mozillian Scott Downe was away this week to assist me in a bug of his that I initially wanted to work on, so within my time constraints I needed to quickly switch over to something reasonable, which ended up being this issue.

If you take a peek at the conversation about this, this is a realization of my iterative approach to providing this problem an elegant solution. Currently, I added a menu item to the top right initialization context bar that opens a new window to the user that directs them to the app template gallery to remix an app, on a click event.

Implementing logic for this was fairly simple and streamlined, since I had the original 'New App' menu item logic to follow and parrot the data flow to a great extent. The Appmaker convention herein seems to prescribe to an approach that involves an event listener attached to a JQuery connected ID field in the html, whose logic is embedded in the same file. The parent init function exposes the scope of an object in a file both called 'application', that exports a whole bunch of functionality - most importantly of which was the functionality of the menu item that I was trying to emulate:

// application.js, line 36:
    newApp: function(){
      var app = document.querySelector("ceci-app");
      var parent = app.parentNode;
      // TODO
      // we have to decouple appidChanged and initFirebase
      app.setAttribute("appid", "ceci-app-"+uuid());
      history.pushState({}, "", location.origin);

I didn't need all this fancy functionality yet either; so far, the intent was just to give the user a link to the template gallery. So a simple on an href should (and did) do the trick:

  templateApp: function(){
    // Open the link in a new tab so as to not interrupt the current instance's workflow

The module.export already takes this entire function list wholesale as part of the application scope, so simply adding this function to the list was enough to be able to invoke it on my event listener back in the html file.

The first and last part was essentially to just add the element to the dom, which for the most part was just duplicating the code used for the initial menu item. Funny enough though, the most convoluted part of this was adding the text label to my new menu item. Appmaker uses what I believe to be some sort of angular.js localization directive - l10n - which I didn't know worked in a key-value pair fashion. This is where parroting code unfortunately stopped being helpful ;)

The directive is appended to your element like so: {{'your label here' | l10}}

If your 'label' pair isn't listed in the msg.json file in the language locale directory, it doesn't simply slap the string onto the element, it actually doesn't do anything with it, and therefore your label doesn't show up at all. Documentation and examples on the web were hard to come by for me, so some last minute pointing in the right direction from David Humphrey (current professor, former project lead) cleared this issue up in a hurry.

The title for this post alludes to the hope that I don't bury myself under the weight of my own ambition for this bugfix for the final course's milestone. The stage is officially set for my last hurrah and the opportunity to call it my Appmaker's "Magnum Opus" addition.

Monday, November 10, 2014

Unintentional, yet Necessary Bug-Hopping Ensues

Shortly after FSOSS and the end of reading week, I initially requested to work on an Appmaker issue created by senior Mozillian Scott Downe, AKA 'TheCount' (Link to #2338). My mistake from the get-go was not to immediately use the comment thread to clarify my lack of context for how to find the code necessary to fix the bug, instead leaving it for a while as life happened for both parties involved with the intent of asking Sir Downe at a more convenient time for me later on down the road. As fortune often shines it everloving light on me, the gentleman is now off on some sort of vacation/time away from his work for a week as my deadline for this milestone looms and is at the end of this week. Instinct dictated me to immediately find a suitable alternative, and I believe that I have found a manageable little number that might even serve as an incremental growth to a rather impressive final 0.4 effort (no promises yet, though) - Issue #2348

As usual, updates to soon follow after the initial PR at the end of this week.