Skip to content

Commit 9d253fc

Browse files
sumengsumeng
authored andcommitted
Merge remote-tracking branch 'upstream/master'
2 parents b6aca57 + 835b3cf commit 9d253fc

8 files changed

Lines changed: 66 additions & 19 deletions

File tree

Coding_iOS/Models/ProjectTopic.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616

1717
@interface ProjectTopic : NSObject
1818

19-
@property (readwrite, nonatomic, strong) NSNumber *id, *child_count, *current_user_role_id, *owner_id, *project_id, *parent_id;
19+
@property (readwrite, nonatomic, strong) NSNumber *id, *child_count, *current_user_role_id, *owner_id, *project_id, *parent_id, *number;
2020
@property (readwrite, nonatomic, strong) NSDate *created_at;
2121
@property (readwrite, nonatomic, strong) NSDate *updated_at;
2222
@property (readwrite, nonatomic, strong) NSString *title, *content, *path;

Coding_iOS/Models/Task.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ typedef NS_ENUM(NSInteger, TaskHandleType) {
2828
@property (readwrite, nonatomic, strong) NSDate *created_at, *updated_at;
2929
@property (readonly, nonatomic, strong) NSDate *deadline_date;
3030
@property (readwrite, nonatomic, strong) Project *project;
31-
@property (readwrite, nonatomic, strong) NSNumber *id, *status, *owner_id, *priority, *comments, *has_description;
31+
@property (readwrite, nonatomic, strong) NSNumber *id, *status, *owner_id, *priority, *comments, *has_description, *number;
3232
@property (readwrite, nonatomic, strong) NSDictionary *propertyArrayMap;
3333
@property (readwrite, nonatomic, strong) NSMutableArray *activityList, *labels;
3434
@property (nonatomic, assign) TaskHandleType handleType;

Coding_iOS/Models/Task.m

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -109,6 +109,7 @@ - (void)copyDataFrom:(Task *)task{
109109
self.comments = task.comments;
110110
self.needRefreshDetail = task.needRefreshDetail;
111111
self.deadline = task.deadline;
112+
self.number = task.number;
112113

113114
self.has_description = task.has_description;
114115
self.task_description = task.task_description;

Coding_iOS/Views/Cell/ProjectCodeListCell.m

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ - (void)layoutSubviews{
6565

6666
- (NSAttributedString *)subTitleStr{
6767
NSString *nameStr = _file.info.lastCommitter.name? _file.info.lastCommitter.name: @"...";
68-
NSString *timeStr = _file.info.lastCommitDate? [_file.info.lastCommitDate stringDisplay_HHmm]: @"...";
68+
NSString *timeStr = _file.info.lastCommitDate? [_file.info.lastCommitDate stringDisplay_MMdd]: @"...";
6969
NSMutableAttributedString *attrString = [[NSMutableAttributedString alloc] initWithString:[NSString stringWithFormat:@"%@ %@", nameStr, timeStr]];
7070
[attrString addAttributes:@{NSFontAttributeName : [UIFont boldSystemFontOfSize:12],
7171
NSForegroundColorAttributeName : [UIColor colorWithHexString:@"0x222222"]}

Coding_iOS/Views/Cell/ProjectTaskListViewCell.m

Lines changed: 15 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@
2727
@interface ProjectTaskListViewCell ()
2828
@property (strong, nonatomic) UIImageView *userIconView, *commentIconView, *timeClockIconView, *mdIconView, *taskPriorityView;
2929
@property (strong, nonatomic) UITapImageView *checkView;
30-
@property (strong, nonatomic) UILabel *contentLabel, *userNameLabel, *timeLabel, *commentCountLabel, *mdLabel;
30+
@property (strong, nonatomic) UILabel *contentLabel, *userNameLabel, *timeLabel, *commentCountLabel, *mdLabel, *numLabel;
3131
@property (strong, nonatomic) ProjectTaskListViewCellTagsView *tagsView;
3232
@end
3333

@@ -74,6 +74,12 @@ - (id)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reus
7474
_tagsView = [ProjectTaskListViewCellTagsView new];
7575
[self.contentView addSubview:_tagsView];
7676
}
77+
if (!_numLabel) {
78+
_numLabel = [UILabel new];
79+
_numLabel.font = [UIFont systemFontOfSize:10];
80+
_numLabel.textColor = [UIColor colorWithHexString:@"0x222222"];
81+
[self.contentView addSubview:_numLabel];
82+
}
7783
if (!_userNameLabel) {
7884
_userNameLabel = [UILabel new];
7985
_userNameLabel.font = [UIFont systemFontOfSize:10];
@@ -144,11 +150,16 @@ - (id)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reus
144150
make.height.mas_equalTo(25);
145151
make.right.equalTo(self.contentView).offset(-kPaddingLeftWidth);
146152
}];
147-
[_userNameLabel mas_makeConstraints:^(MASConstraintMaker *make) {
153+
[_numLabel mas_makeConstraints:^(MASConstraintMaker *make) {
148154
make.bottom.equalTo(self.contentView).offset(-10);
149155
make.left.equalTo(self.userIconView.mas_right).offset(10);
150156
make.height.mas_equalTo(15);
151157
}];
158+
[_userNameLabel mas_makeConstraints:^(MASConstraintMaker *make) {
159+
make.left.equalTo(self.numLabel.mas_right).offset(5);
160+
make.centerY.equalTo(self.numLabel);
161+
make.height.mas_equalTo(15);
162+
}];
152163
[_timeClockIconView mas_makeConstraints:^(MASConstraintMaker *make) {
153164
make.left.equalTo(self.userNameLabel.mas_right).offset(10);
154165
make.centerY.equalTo(self.userNameLabel);
@@ -206,8 +217,9 @@ - (void)layoutSubviews{
206217
_tagsView.hidden = YES;
207218
}
208219
//Bottom
220+
_numLabel.text = [NSString stringWithFormat:@"#%@", _task.number.stringValue];
209221
_userNameLabel.text = _task.creator.name;
210-
_timeLabel.text = [_task.created_at stringDisplay_HHmm];
222+
_timeLabel.text = [_task.created_at stringDisplay_MMdd];
211223
_commentCountLabel.text = _task.comments.stringValue;
212224
_mdIconView.hidden = _mdLabel.hidden = !_task.has_description.boolValue;
213225
}

Coding_iOS/Views/Cell/ProjectTopicCell.m

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020
#import "ProjectTagLabel.h"
2121

2222
@interface ProjectTopicCell ()
23-
@property (strong, nonatomic) UILabel *titleLabel, *userNameLabel, *timeLabel, *commentCountLabel;
23+
@property (strong, nonatomic) UILabel *titleLabel, *userNameLabel, *timeLabel, *commentCountLabel, *numLabel;
2424
@property (strong, nonatomic) UIImageView *userIconView, *timeClockIconView, *commentIconView;
2525
@property (strong, nonatomic) ProjectTopicCellTagsView *tagsView;
2626

@@ -52,6 +52,13 @@ - (id)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reus
5252
[self.contentView addSubview:_tagsView];
5353
}
5454

55+
if (!_numLabel) {
56+
_numLabel = [[UILabel alloc] initWithFrame:CGRectMake(kProjectTopicCell_PadingLeft, 0, 150, 15)];
57+
_numLabel.backgroundColor = [UIColor clearColor];
58+
_numLabel.font = [UIFont systemFontOfSize:10];
59+
_numLabel.textColor = [UIColor colorWithHexString:@"0x222222"];
60+
[self.contentView addSubview:_numLabel];
61+
}
5562
if (!_userNameLabel) {
5663
_userNameLabel = [[UILabel alloc] initWithFrame:CGRectMake(kProjectTopicCell_PadingLeft, 0, 150, 15)];
5764
_userNameLabel.backgroundColor = [UIColor clearColor];
@@ -103,14 +110,19 @@ - (void)layoutSubviews{
103110

104111
curBottomY += [ProjectTopicCellTagsView getHeightForTags:_curTopic.labels];
105112

113+
[_numLabel setOrigin:CGPointMake(curRightX, curBottomY)];
114+
_numLabel.text = [NSString stringWithFormat:@"#%@", _curTopic.number.stringValue];
115+
[_numLabel sizeToFit];
116+
117+
curRightX = _numLabel.maxXOfFrame + 10;
106118
[_userNameLabel setOrigin:CGPointMake(curRightX, curBottomY)];
107119
_userNameLabel.text = _curTopic.owner.name;
108120
[_userNameLabel sizeToFit];
109121

110122
curRightX = _userNameLabel.maxXOfFrame+ 10;
111123
[_timeClockIconView setOrigin:CGPointMake(curRightX, curBottomY)];
112124
[_timeLabel setOrigin:CGPointMake(curRightX + 15, curBottomY)];
113-
_timeLabel.text = [_curTopic.created_at stringDisplay_HHmm];
125+
_timeLabel.text = [_curTopic.created_at stringDisplay_MMdd];
114126
[_timeLabel sizeToFit];
115127

116128
curRightX = _timeLabel.maxXOfFrame + 10;

Coding_iOS/Views/Cell/TaskContentCell.m

Lines changed: 18 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ @interface TaskContentCell ()
2020

2121
@property (strong, nonatomic) UITextView *taskContentView;
2222
@property (strong, nonatomic) UIButton *deleteBtn;
23-
@property (strong, nonatomic) UILabel *creatorLabel;
23+
@property (strong, nonatomic) UILabel *creatorLabel, *numLabel;
2424
@property (strong, nonatomic) UIView *downLineView, *upLineView;
2525
@end
2626

@@ -60,6 +60,14 @@ - (id)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reus
6060
_taskContentView.delegate = self;
6161
[self.contentView addSubview:_taskContentView];
6262
}
63+
if (!_numLabel) {
64+
if (!_numLabel) {
65+
_numLabel = [[UILabel alloc] init];
66+
_numLabel.font = [UIFont systemFontOfSize:12];
67+
_numLabel.textColor = [UIColor colorWithHexString:@"0x222222"];
68+
[self.contentView addSubview:_numLabel];
69+
}
70+
}
6371
if (!_creatorLabel) {
6472
_creatorLabel = [[UILabel alloc] init];
6573
_creatorLabel.font = [UIFont systemFontOfSize:12];
@@ -94,9 +102,14 @@ - (id)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reus
94102
make.right.equalTo(self.contentView).offset(-(kPaddingLeftWidth-kTextView_Pading));
95103
make.height.mas_equalTo(kTaskContentCell_ContentHeightMin);
96104
}];
97-
[_creatorLabel mas_makeConstraints:^(MASConstraintMaker *make) {
105+
[_numLabel mas_makeConstraints:^(MASConstraintMaker *make) {
98106
make.left.equalTo(self.contentView.mas_left).offset(kPaddingLeftWidth);
99-
make.right.equalTo(_deleteBtn.mas_left).offset(10);
107+
make.bottom.equalTo(self.contentView.mas_bottom).offset(-10);
108+
make.height.mas_equalTo(20);
109+
}];
110+
[_creatorLabel mas_makeConstraints:^(MASConstraintMaker *make) {
111+
make.left.equalTo(self.numLabel.mas_right);
112+
make.right.lessThanOrEqualTo(_deleteBtn.mas_left).offset(10);
100113
make.bottom.equalTo(self.contentView.mas_bottom).offset(-10);
101114
make.height.mas_equalTo(20);
102115
}];
@@ -133,7 +146,9 @@ - (void)layoutSubviews{
133146
if (_task.handleType > TaskHandleTypeEdit) {
134147
_creatorLabel.text = [NSString stringWithFormat:@"%@ 现在", _task.creator.name];
135148
_deleteBtn.hidden = YES;
149+
_numLabel.hidden = YES;
136150
}else{
151+
_numLabel.text = [NSString stringWithFormat:@"#%@ ", _task.number.stringValue];
137152
_creatorLabel.text = [NSString stringWithFormat:@"%@ 创建于 %@", _task.creator.name, [_task.created_at stringDisplay_HHmm]];
138153
_deleteBtn.hidden = !([_task.creator.global_key isEqualToString:[Login curLoginUser].global_key] || _task.project.owner_id.integerValue == [Login curLoginUser].id.integerValue);
139154
}

Coding_iOS/Views/Cell/TopicContentCell.m

Lines changed: 15 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -138,7 +138,7 @@ - (void)setCurTopic:(ProjectTopic *)curTopic
138138
[_userIconView sd_setImageWithURL:[_curTopic.owner.avatar urlImageWithCodePathResizeToView:_userIconView] placeholderImage:kPlaceholderMonkeyRoundView(_userIconView)];
139139
[_userIconView setY:curBottomY];
140140
[_timeLabel setY:curBottomY];
141-
_timeLabel.attributedText = [self getStringWithName:_curTopic.owner.name andTime:[_curTopic.created_at stringDisplay_HHmm]];
141+
_timeLabel.attributedText = [self getAttributedTimeText];
142142

143143
curBottomY += 16 + 20;
144144

@@ -188,16 +188,23 @@ - (void)deleteTag:(ProjectTag *)curTag
188188
}
189189
}
190190

191-
- (NSMutableAttributedString*)getStringWithName:(NSString *)nameStr andTime:(NSString *)timeStr
192-
{
193-
NSMutableAttributedString *attrString = [[NSMutableAttributedString alloc] initWithString:[NSString stringWithFormat:@"%@ 发布于 %@", nameStr, timeStr]];
191+
- (NSMutableAttributedString *)getAttributedTimeText{
192+
NSString *nameStr = _curTopic.owner.name;
193+
NSString *timeStr = [NSString stringWithFormat:@" 发布于 %@ ", [_curTopic.created_at stringDisplay_HHmm]];
194+
NSString *numStr = [NSString stringWithFormat:@"#%@", _curTopic.number.stringValue];
195+
NSString *displayStr = [NSString stringWithFormat:@"%@%@%@", nameStr, timeStr, numStr];
196+
197+
NSMutableAttributedString *attrString = [[NSMutableAttributedString alloc] initWithString:displayStr];
198+
[attrString addAttributes:@{NSFontAttributeName : [UIFont boldSystemFontOfSize:12],
199+
NSForegroundColorAttributeName : [UIColor colorWithHexString:@"0x222222"]}
200+
range:[displayStr rangeOfString:nameStr]];
194201
[attrString addAttributes:@{NSFontAttributeName : [UIFont boldSystemFontOfSize:12],
195-
NSForegroundColorAttributeName : [UIColor colorWithHexString:@"0x222222"]}
196-
range:NSMakeRange(0, nameStr.length)];
202+
NSForegroundColorAttributeName : [UIColor colorWithHexString:@"0x222222"]}
203+
range:[displayStr rangeOfString:numStr]];
197204

198205
[attrString addAttributes:@{NSFontAttributeName : [UIFont systemFontOfSize:12],
199-
NSForegroundColorAttributeName : [UIColor colorWithHexString:@"0x999999"]}
200-
range:NSMakeRange(nameStr.length, attrString.length - nameStr.length)];
206+
NSForegroundColorAttributeName : [UIColor colorWithHexString:@"0x999999"]}
207+
range:[displayStr rangeOfString:timeStr]];
201208
return attrString;
202209
}
203210

0 commit comments

Comments
 (0)