mirror of
https://github.com/samsonjs/samhuri.net-ios.git
synced 2026-03-25 09:25:47 +00:00
fix titles & dates in post list
This commit is contained in:
parent
427d6303b6
commit
1ed0faa9f2
4 changed files with 6 additions and 14 deletions
|
|
@ -1,12 +1,12 @@
|
|||
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
||||
<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="7702" systemVersion="14E17e" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" initialViewController="H1p-Uh-vWS">
|
||||
<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="7706" systemVersion="14D136" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" initialViewController="H1p-Uh-vWS">
|
||||
<dependencies>
|
||||
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="7701"/>
|
||||
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="7703"/>
|
||||
<capability name="Aspect ratio constraints" minToolsVersion="5.1"/>
|
||||
<capability name="Constraints to layout margins" minToolsVersion="6.0"/>
|
||||
</dependencies>
|
||||
<customFonts key="customFonts">
|
||||
<mutableArray key="FontAwesome.otf">
|
||||
<mutableArray key="FontAwesome.ttf">
|
||||
<string>FontAwesome</string>
|
||||
<string>FontAwesome</string>
|
||||
</mutableArray>
|
||||
|
|
|
|||
|
|
@ -23,7 +23,6 @@
|
|||
@property (nonatomic, readonly, getter=isDraft) BOOL draft;
|
||||
@property (nonatomic, readonly, getter=isLink) BOOL link;
|
||||
@property (nonatomic, readonly, getter=isNew) BOOL new;
|
||||
@property (nonatomic, readonly) NSString *formattedDate;
|
||||
|
||||
+ (instancetype)newDraftWithTitle:(NSString *)title body:(NSString *)body url:(NSURL *)url;
|
||||
- (instancetype)copyWithBody:(NSString *)body;
|
||||
|
|
|
|||
|
|
@ -18,7 +18,6 @@
|
|||
@synthesize author = _author;
|
||||
@synthesize time = _time;
|
||||
@synthesize path = _path;
|
||||
@synthesize formattedDate = _formattedDate;
|
||||
|
||||
+ (NSDictionary *)JSONKeyPathsByPropertyKey {
|
||||
return @{
|
||||
|
|
@ -146,13 +145,6 @@
|
|||
return _time;
|
||||
}
|
||||
|
||||
- (NSString *)formattedDate {
|
||||
if (!_formattedDate && self.time) {
|
||||
_formattedDate = [NSString stringWithFormat:@"%ld-%02ld-%02ld", (long)self.time.mm_year, (long)self.time.mm_month, (long)self.time.mm_day];
|
||||
}
|
||||
return _formattedDate;
|
||||
}
|
||||
|
||||
- (NSString *)path {
|
||||
if (!_path) {
|
||||
if (self.draft) {
|
||||
|
|
|
|||
|
|
@ -547,8 +547,9 @@ static NSString *const StateRestorationBlogStatusTextKey = @"blogStatusText";
|
|||
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
|
||||
PostCell *cell = [tableView dequeueReusableCellWithIdentifier:@"Cell" forIndexPath:indexPath];
|
||||
Post *post = [self postForIndexPath:indexPath];
|
||||
NSString *title = post.title.length ? post.title : @"Untitled";
|
||||
NSString *date = post.draft ? @"" : post.formattedDate;
|
||||
NSString *prefix = post.link ? @"→ " : @"";
|
||||
NSString *title = [NSString stringWithFormat:@"%@%@", prefix, post.title.length ? post.title : @"Untitled"];
|
||||
NSString *date = post.draft ? @"" : post.date;
|
||||
[cell configureWithTitle:title date:date];
|
||||
return cell;
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue