Implement drafts and allow the use of time in publish dates.#39
Implement drafts and allow the use of time in publish dates.#39Tanner wants to merge 30 commits intoCarterA:masterfrom
Conversation
Makes the code a more readable. Made the factory methods, e.g. + (instancetype)TBPageWithURL.. into init methods, e.g. - (instancetype)initWithURL... No functional changes.
Site doesn't manage this anymore, only manages posts.
Posts are now created in root/Posts/slug/ directory. The metadata file is created in the same directory.
For whenever we need it.
The method now takes in the post's directory, e.g. root/Post/slug/.
The URL actually works.
Also adds metadata file.
Having two instances of each label in IB was making things hard to do as far as aligning text. Everything still works the same though.
Changes process and write post methods to include a parameter on whether or not to include drafts.
The placeholder text for content was not being set a color. Changes the date to be the correct color blue (as used previously). Drafts are now gray instead of red.
Set the state rather than changing the menu item.
I realized that "TB" is the class prefix for "Tribo".
|
I really appreciate all the work here, Tanner. The feature looks like a huge improvement, and it will allow many more rich additions (tags have been on my mental list for a while now!). Before I merge it, however, I'd like to see the coding style match up with the project as a whole. That means that all the extra newlines that you added should be removed (I like whitespace, but not that much whitespace), and the public -init methods should be switched to factory methods. I favor factory methods as they reduce typing (no need to type an -alloc call every time), and there is really no downside. I apologize for being a stickler about this, but this is part of open-source projects. If we can't keep a common, consistent coding style, then the code will just get progressively messier until no one can understand all of it. Thanks again for all your hard work. |
This reverts commit f22fc3a. Conflicts: Shared/TBPost.m Shared/TBSite.m
This pull request adds a drafts feature and allows the use of times, e.g. 11:53 PM EST, in publish dates.
Presentation
When any new post is created, it is a draft.
A post represents whether it is a draft or not in the posts table view. Posts now have a "draft" string in the location where the published date would be:

A draft will only show up in local previews and will not be included in the generated site during publishing.
You can switch a post between draft/published by using the contextual menu for the post:
For a published post...

And for a draft…

Hurrah!
Technical Stuff
The implementation stuck to "Method B" in the discussion for #16.
A metadata class was added so that we can manage whatever metadata goes along with a post. This data must be written to the metadata file when changed, otherwise it will not be saved.
There were no major changes per-say. Some of the changes were cleaning up the code so I could modify it (and grasp it).
Problem
There is one problem with this pull request, albeit a small one. When you resize the window while viewing the posts view, it is possible for the title and date labels to collide.

Not a huge issue, but I imagine it could be solved with some auto layout voodoo (Xcode 5?).