Permalink
Browse files

Add NLM Identifier and openAccess properties to SZNAltmetricArticle

Update Mac OS X demo app layout
  • Loading branch information...
vtourraine committed Apr 4, 2013
1 parent 2ce8570 commit f69b3823a2076688da020c608b11ad276d271376
@@ -16,9 +16,12 @@
@property (nonatomic, weak) IBOutlet NSTextField *DOITextField;
@property (nonatomic, weak) IBOutlet NSTextField *scoreTextField;
@property (nonatomic, weak) IBOutlet NSImageView *scoreImageView;
+@property (nonatomic, weak) IBOutlet NSProgressIndicator *progressIndicator;
@property (nonatomic, strong) SZNAltmetricArticle *representedArticle;
- (IBAction)fetchArticle:(id)sender;
+- (IBAction)openArticleURL:(id)sender;
+- (IBAction)openDetailsURL:(id)sender;
@end
@@ -18,13 +18,26 @@ - (void)applicationDidFinishLaunching:(NSNotification *)aNotification
- (IBAction)fetchArticle:(id)sender
{
+ [self.progressIndicator startAnimation:sender];
[[SZNAltmetricAPIClient sharedClient] fetchArticleWithDOI:self.DOITextField.stringValue success:^(SZNAltmetricArticle *article) {
self.representedArticle = article;
self.scoreImageView.image = [[NSImage alloc] initWithContentsOfURL:article.imageLargeURL];
+ [self.progressIndicator stopAnimation:sender];
} failure:^(NSError *error) {
NSLog(@"%s %@", __PRETTY_FUNCTION__, [error description]);
[[NSAlert alertWithError:error] runModal];
+ [self.progressIndicator stopAnimation:sender];
}];
}
+- (IBAction)openArticleURL:(id)sender
+{
+ [[NSWorkspace sharedWorkspace] openURL:self.representedArticle.articleURL];
+}
+
+- (IBAction)openDetailsURL:(id)sender
+{
+ [[NSWorkspace sharedWorkspace] openURL:self.representedArticle.detailsURL];
+}
+
@end
Oops, something went wrong.

0 comments on commit f69b382

Please sign in to comment.