Permalink
Browse files

Add title, article URL, and details URL to SZNAltmetricArticle

Update unit tests
Update demo apps to display title
  • Loading branch information...
1 parent 6370e68 commit 2c4f15631e3d0f87b047861bf448deff3b88b899 @vtourraine vtourraine committed Apr 3, 2013
@@ -14,6 +14,7 @@
@property (strong, nonatomic) SZNAltmetricArticle *article;
+@property (weak, nonatomic) IBOutlet UILabel *titleLabel;
@property (weak, nonatomic) IBOutlet UILabel *scoreLabel;
@property (weak, nonatomic) IBOutlet UIImageView *imageView;
@@ -33,6 +33,7 @@ - (void)setArticle:(SZNAltmetricArticle *)article
- (void)configureViewWithArticle:(SZNAltmetricArticle *)article
{
+ self.titleLabel.text = self.article.title;
self.scoreLabel.text = [self.article.score stringValue];
[self.imageView setImageWithURL:self.article.imageLargeURL];
}
@@ -62,31 +62,46 @@
<rect key="frame" x="0.0" y="64" width="320" height="504"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
<subviews>
- <label opaque="NO" clipsSubviews="YES" userInteractionEnabled="NO" contentMode="left" text="Score:" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" id="wYA-Sh-47O">
- <rect key="frame" x="20" y="29" width="167" height="21"/>
+ <label opaque="NO" clipsSubviews="YES" userInteractionEnabled="NO" contentMode="left" text="Score:" textAlignment="right" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" id="wYA-Sh-47O">
+ <rect key="frame" x="20" y="63" width="57" height="21"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
- <fontDescription key="fontDescription" type="system" pointSize="17"/>
+ <fontDescription key="fontDescription" type="system" pointSize="16"/>
<color key="textColor" cocoaTouchSystemColor="darkTextColor"/>
<nil key="highlightedColor"/>
</label>
- <label opaque="NO" clipsSubviews="YES" userInteractionEnabled="NO" contentMode="left" text="##.##" textAlignment="right" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" id="4GO-6u-g0G">
- <rect key="frame" x="195" y="20" width="105" height="39"/>
+ <label opaque="NO" clipsSubviews="YES" userInteractionEnabled="NO" contentMode="left" text="##.##" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" id="4GO-6u-g0G">
+ <rect key="frame" x="85" y="55" width="215" height="32"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" flexibleMaxY="YES"/>
<fontDescription key="fontDescription" type="boldSystem" pointSize="24"/>
<color key="textColor" cocoaTouchSystemColor="darkTextColor"/>
<nil key="highlightedColor"/>
</label>
<imageView userInteractionEnabled="NO" contentMode="scaleToFill" id="FpD-Rw-IZc">
- <rect key="frame" x="70" y="79" width="180" height="180"/>
+ <rect key="frame" x="70" y="114" width="180" height="180"/>
<autoresizingMask key="autoresizingMask" flexibleMinX="YES" flexibleMaxX="YES" flexibleMaxY="YES"/>
</imageView>
+ <label opaque="NO" clipsSubviews="YES" userInteractionEnabled="NO" contentMode="left" text="Title:" textAlignment="right" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" id="tbW-W0-eFo">
+ <rect key="frame" x="20" y="25" width="57" height="21"/>
+ <autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
+ <fontDescription key="fontDescription" type="system" pointSize="16"/>
+ <color key="textColor" cocoaTouchSystemColor="darkTextColor"/>
+ <nil key="highlightedColor"/>
+ </label>
+ <label opaque="NO" clipsSubviews="YES" userInteractionEnabled="NO" contentMode="left" text="##.##" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" id="xnC-62-9CF">
+ <rect key="frame" x="85" y="20" width="215" height="31"/>
+ <autoresizingMask key="autoresizingMask" widthSizable="YES" flexibleMaxY="YES"/>
+ <fontDescription key="fontDescription" type="boldSystem" pointSize="18"/>
+ <color key="textColor" cocoaTouchSystemColor="darkTextColor"/>
+ <nil key="highlightedColor"/>
+ </label>
</subviews>
<color key="backgroundColor" white="1" alpha="1" colorSpace="custom" customColorSpace="calibratedWhite"/>
</view>
<navigationItem key="navigationItem" title="Altmetric Article" id="6MR-HA-0oo"/>
<connections>
<outlet property="imageView" destination="FpD-Rw-IZc" id="ZbI-wS-chB"/>
<outlet property="scoreLabel" destination="4GO-6u-g0G" id="0Il-Rn-Bsl"/>
+ <outlet property="titleLabel" destination="xnC-62-9CF" id="xdn-OF-Sd7"/>
</connections>
</viewController>
<placeholder placeholderIdentifier="IBFirstResponder" id="ece-e8-NeC" userLabel="First Responder" sceneMemberID="firstResponder"/>
@@ -118,6 +133,7 @@
<relationships>
<relationship kind="outlet" name="imageView" candidateClass="UIImageView"/>
<relationship kind="outlet" name="scoreLabel" candidateClass="UILabel"/>
+ <relationship kind="outlet" name="titleLabel" candidateClass="UILabel"/>
</relationships>
</class>
<class className="SZNSearchViewController" superclassName="UIViewController">
@@ -8,13 +8,17 @@
#import <Cocoa/Cocoa.h>
+@class SZNAltmetricArticle;
+
@interface SZNAppDelegate : NSObject <NSApplicationDelegate>
@property (assign) IBOutlet NSWindow *window;
@property (nonatomic, weak) IBOutlet NSTextField *DOITextField;
@property (nonatomic, weak) IBOutlet NSTextField *scoreTextField;
@property (nonatomic, weak) IBOutlet NSImageView *scoreImageView;
+@property (nonatomic, strong) SZNAltmetricArticle *representedArticle;
+
- (IBAction)fetchArticle:(id)sender;
@end
@@ -19,7 +19,7 @@ - (void)applicationDidFinishLaunching:(NSNotification *)aNotification
- (IBAction)fetchArticle:(id)sender
{
[[SZNAltmetricAPIClient sharedClient] fetchArticleWithDOI:self.DOITextField.stringValue success:^(SZNAltmetricArticle *article) {
- self.scoreTextField.stringValue = [article.score stringValue];
+ self.representedArticle = article;
self.scoreImageView.image = [[NSImage alloc] initWithContentsOfURL:article.imageLargeURL];
} failure:^(NSError *error) {
NSLog(@"%s %@", __PRETTY_FUNCTION__, [error description]);
Oops, something went wrong.

0 comments on commit 2c4f156

Please sign in to comment.