Skip to content

Commit

Permalink
Add title, article URL, and details URL to SZNAltmetricArticle
Browse files Browse the repository at this point in the history
Update unit tests
Update demo apps to display title
  • Loading branch information
vtourraine committed Apr 3, 2013
1 parent 6370e68 commit 2c4f156
Show file tree
Hide file tree
Showing 9 changed files with 241 additions and 23 deletions.
Expand Up @@ -14,6 +14,7 @@


@property (strong, nonatomic) SZNAltmetricArticle *article; @property (strong, nonatomic) SZNAltmetricArticle *article;


@property (weak, nonatomic) IBOutlet UILabel *titleLabel;
@property (weak, nonatomic) IBOutlet UILabel *scoreLabel; @property (weak, nonatomic) IBOutlet UILabel *scoreLabel;
@property (weak, nonatomic) IBOutlet UIImageView *imageView; @property (weak, nonatomic) IBOutlet UIImageView *imageView;


Expand Down
Expand Up @@ -33,6 +33,7 @@ - (void)setArticle:(SZNAltmetricArticle *)article


- (void)configureViewWithArticle:(SZNAltmetricArticle *)article - (void)configureViewWithArticle:(SZNAltmetricArticle *)article
{ {
self.titleLabel.text = self.article.title;
self.scoreLabel.text = [self.article.score stringValue]; self.scoreLabel.text = [self.article.score stringValue];
[self.imageView setImageWithURL:self.article.imageLargeURL]; [self.imageView setImageWithURL:self.article.imageLargeURL];
} }
Expand Down
Expand Up @@ -62,31 +62,46 @@
<rect key="frame" x="0.0" y="64" width="320" height="504"/> <rect key="frame" x="0.0" y="64" width="320" height="504"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/> <autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
<subviews> <subviews>
<label opaque="NO" clipsSubviews="YES" userInteractionEnabled="NO" contentMode="left" text="Score:" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" id="wYA-Sh-47O"> <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="29" width="167" height="21"/> <rect key="frame" x="20" y="63" width="57" height="21"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/> <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"/> <color key="textColor" cocoaTouchSystemColor="darkTextColor"/>
<nil key="highlightedColor"/> <nil key="highlightedColor"/>
</label> </label>
<label opaque="NO" clipsSubviews="YES" userInteractionEnabled="NO" contentMode="left" text="##.##" textAlignment="right" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" id="4GO-6u-g0G"> <label opaque="NO" clipsSubviews="YES" userInteractionEnabled="NO" contentMode="left" text="##.##" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" id="4GO-6u-g0G">
<rect key="frame" x="195" y="20" width="105" height="39"/> <rect key="frame" x="85" y="55" width="215" height="32"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" flexibleMaxY="YES"/> <autoresizingMask key="autoresizingMask" widthSizable="YES" flexibleMaxY="YES"/>
<fontDescription key="fontDescription" type="boldSystem" pointSize="24"/> <fontDescription key="fontDescription" type="boldSystem" pointSize="24"/>
<color key="textColor" cocoaTouchSystemColor="darkTextColor"/> <color key="textColor" cocoaTouchSystemColor="darkTextColor"/>
<nil key="highlightedColor"/> <nil key="highlightedColor"/>
</label> </label>
<imageView userInteractionEnabled="NO" contentMode="scaleToFill" id="FpD-Rw-IZc"> <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"/> <autoresizingMask key="autoresizingMask" flexibleMinX="YES" flexibleMaxX="YES" flexibleMaxY="YES"/>
</imageView> </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> </subviews>
<color key="backgroundColor" white="1" alpha="1" colorSpace="custom" customColorSpace="calibratedWhite"/> <color key="backgroundColor" white="1" alpha="1" colorSpace="custom" customColorSpace="calibratedWhite"/>
</view> </view>
<navigationItem key="navigationItem" title="Altmetric Article" id="6MR-HA-0oo"/> <navigationItem key="navigationItem" title="Altmetric Article" id="6MR-HA-0oo"/>
<connections> <connections>
<outlet property="imageView" destination="FpD-Rw-IZc" id="ZbI-wS-chB"/> <outlet property="imageView" destination="FpD-Rw-IZc" id="ZbI-wS-chB"/>
<outlet property="scoreLabel" destination="4GO-6u-g0G" id="0Il-Rn-Bsl"/> <outlet property="scoreLabel" destination="4GO-6u-g0G" id="0Il-Rn-Bsl"/>
<outlet property="titleLabel" destination="xnC-62-9CF" id="xdn-OF-Sd7"/>
</connections> </connections>
</viewController> </viewController>
<placeholder placeholderIdentifier="IBFirstResponder" id="ece-e8-NeC" userLabel="First Responder" sceneMemberID="firstResponder"/> <placeholder placeholderIdentifier="IBFirstResponder" id="ece-e8-NeC" userLabel="First Responder" sceneMemberID="firstResponder"/>
Expand Down Expand Up @@ -118,6 +133,7 @@
<relationships> <relationships>
<relationship kind="outlet" name="imageView" candidateClass="UIImageView"/> <relationship kind="outlet" name="imageView" candidateClass="UIImageView"/>
<relationship kind="outlet" name="scoreLabel" candidateClass="UILabel"/> <relationship kind="outlet" name="scoreLabel" candidateClass="UILabel"/>
<relationship kind="outlet" name="titleLabel" candidateClass="UILabel"/>
</relationships> </relationships>
</class> </class>
<class className="SZNSearchViewController" superclassName="UIViewController"> <class className="SZNSearchViewController" superclassName="UIViewController">
Expand Down
Expand Up @@ -8,13 +8,17 @@


#import <Cocoa/Cocoa.h> #import <Cocoa/Cocoa.h>


@class SZNAltmetricArticle;

@interface SZNAppDelegate : NSObject <NSApplicationDelegate> @interface SZNAppDelegate : NSObject <NSApplicationDelegate>


@property (assign) IBOutlet NSWindow *window; @property (assign) IBOutlet NSWindow *window;
@property (nonatomic, weak) IBOutlet NSTextField *DOITextField; @property (nonatomic, weak) IBOutlet NSTextField *DOITextField;
@property (nonatomic, weak) IBOutlet NSTextField *scoreTextField; @property (nonatomic, weak) IBOutlet NSTextField *scoreTextField;
@property (nonatomic, weak) IBOutlet NSImageView *scoreImageView; @property (nonatomic, weak) IBOutlet NSImageView *scoreImageView;


@property (nonatomic, strong) SZNAltmetricArticle *representedArticle;

- (IBAction)fetchArticle:(id)sender; - (IBAction)fetchArticle:(id)sender;


@end @end
Expand Up @@ -19,7 +19,7 @@ - (void)applicationDidFinishLaunching:(NSNotification *)aNotification
- (IBAction)fetchArticle:(id)sender - (IBAction)fetchArticle:(id)sender
{ {
[[SZNAltmetricAPIClient sharedClient] fetchArticleWithDOI:self.DOITextField.stringValue success:^(SZNAltmetricArticle *article) { [[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]; self.scoreImageView.image = [[NSImage alloc] initWithContentsOfURL:article.imageLargeURL];
} failure:^(NSError *error) { } failure:^(NSError *error) {
NSLog(@"%s %@", __PRETTY_FUNCTION__, [error description]); NSLog(@"%s %@", __PRETTY_FUNCTION__, [error description]);
Expand Down

0 comments on commit 2c4f156

Please sign in to comment.