diff options
| author | mo khan <mo@mokhan.ca> | 2015-06-22 19:26:21 -0600 |
|---|---|---|
| committer | mo khan <mo@mokhan.ca> | 2015-06-22 19:26:21 -0600 |
| commit | 340c9f0893f73d7540eaa9efa5b741b0ee272f6b (patch) | |
| tree | 0a30d14cb04256ae93d3caf513884791449d7a00 /app/assets/javascripts | |
| parent | 9f6460898f0d4a4d5f763f32d2e6943316bb6145 (diff) | |
add specs for the google button view.
Diffstat (limited to 'app/assets/javascripts')
| -rw-r--r-- | app/assets/javascripts/views/google_sync_button.js.coffee | 17 |
1 files changed, 10 insertions, 7 deletions
diff --git a/app/assets/javascripts/views/google_sync_button.js.coffee b/app/assets/javascripts/views/google_sync_button.js.coffee index 193d501..1170623 100644 --- a/app/assets/javascripts/views/google_sync_button.js.coffee +++ b/app/assets/javascripts/views/google_sync_button.js.coffee @@ -1,13 +1,16 @@ Stronglifters.GoogleSyncButton = Ractive.extend template: "<button on-click='synchronize'><i class='fa {{icon}}'></i> {{text}}</button>", oninit: -> - @set(text: 'Sync With Google', icon: 'fa-camera-retro') - @drive = new Stronglifters.GoogleDrive - client_id: @get('client_id') - drive_upload_path: @get('drive_upload_path') + @set(text: 'Sync with Google', icon: 'fa-camera-retro') @on 'synchronize', (event) -> - @synchronize(@drive) + @synchronize() - synchronize: (drive) -> + synchronize: -> @set(text: 'Syncing...', icon: 'fa-spin fa-spinner') - drive.syncFile() + @drive().syncFile() + + drive: -> + @drive ||= new Stronglifters.GoogleDrive + client_id: @get('client_id') + drive_upload_path: @get('drive_upload_path') + |
