- What You Will Learn
- Examples in This Chapter
- 2.1 Exploring the Samples
- 2.2 About You-Your Home Page
- 2.3 Your Keychain and Service Providers
- 2.4 Creating Your First Service: LoanPaymentService
- 2.5 Creating Your First Widget: LoanPaymentWidget
- 2.6 Drafts, Versions, and Timelines
- 2.7 Putting It All Together-Using the WeatherBug API
2.6 Drafts, Versions, and Timelines
When editing a service or widget, zembly records the changes you make as intermediate drafts. zembly automatically saves a new draft every time you make a change, such as adding a parameter or editing the code. A draft is a clone of the entire state of your service or widget. A draft comes to an end when you publish a service or widget. You can see which version you are looking at or editing below your object’s title, as shown in Figure 2.36.
Figure 2.36 Draft and version number of object’s current edit session
A stack on the right side of the edit zone (small boxes) shows the history of your published versions and drafts, as shown in Figure 2.37. The oldest versions are on the bottom of the stack and, if you hover the mouse over a box, you can see when zembly saved the draft (light box) or the published version (dark box).
Figure 2.37 Edit history is a stack of published versions and drafts
If you look quickly when you make a change to the service or widget, or when you click around on the page after making a change, you’ll see a new box being added to the top of the stack, as shown in Figure 2.38.
Figure 2.38 Saving a new draft
When you click on one of the boxes, the current changes are saved (as a new draft) and the old draft or version you clicked on is loaded. This lets you move back and forth within your edit history seamlessly. Once you begin editing by changing something, zembly creates a new draft based on the draft you changed.
Any changes you make are related to your current draft, which is the thing you’re working on before you’ve published. You can keep multiple drafts for any length of time. You only create a new version of a service or widget when you publish. Then your edit history for the draft is wiped out (along with the current draft, which converts to a published version). At this point, you start over and any changes are saved as new drafts based on the latest published version.
You can also remove all current drafts of a service or widget if you don’t want to keep any of the changes saved for your code. Select Erase and start over, as shown in Figure 2.39. zembly confirms the action before removing the drafts.
Figure 2.39 Erase and start over removes all saved drafts
The timeline lets you look at older versions of widgets or services as shown in Figure 2.40.
Figure 2.40 Finding a previous version of a published object
When you click on one of the points on the timeline, zembly reloads the page with that version.
You can bring a published service or widget offline by toggling its online/offline status indicator as shown in Figure 2.41. Currently, this affects all published versions of the item. In the future, you will be able to specify individual versions for offline publishing.
Figure 2.41 Online/offline toggle for a service or widget