2525#import " TaskCommentTopCell.h"
2626#import " TaskCommentBlankCell.h"
2727#import " ActionSheetDatePicker.h"
28- #import " TaskDescriptionCell.h"
2928#import " TaskDescriptionViewController.h"
3029
3130@interface EditTaskViewController ()
@@ -69,7 +68,7 @@ - (void)viewDidLoad
6968 _myMsgInputView.isAlwaysShow = YES ;
7069 _myMsgInputView.delegate = self;
7170
72- if (_myCopyTask.needRefreshDetail ) { // || _myCopyTask.has_description.boolValue
71+ if (_myCopyTask.needRefreshDetail || _myCopyTask.has_description .boolValue ) {
7372 [self queryToRefreshTaskDetail ];
7473 }else {
7574 _myMsgInputView.curProject = _myCopyTask.project ;
@@ -92,7 +91,6 @@ - (void)viewDidLoad
9291 [tableView registerClass: [TaskCommentCell class ] forCellReuseIdentifier: kCellIdentifier_TaskComment ];
9392 [tableView registerClass: [TaskCommentBlankCell class ] forCellReuseIdentifier: kCellIdentifier_TaskCommentBlank ];
9493 [tableView registerClass: [TaskCommentTopCell class ] forCellReuseIdentifier: kCellIdentifier_TaskCommentTop ];
95- [tableView registerClass: [TaskDescriptionCell class ] forCellReuseIdentifier: kCellIdentifier_TaskDescription ];
9694 tableView.separatorStyle = UITableViewCellSeparatorStyleNone;
9795 [self .view addSubview: tableView];
9896 [tableView mas_makeConstraints: ^(MASConstraintMaker *make) {
@@ -192,7 +190,7 @@ - (void)queryToRefreshTaskDetail{
192190 weakSelf.myMsgInputView .commentOfId = weakSelf.myCopyTask .id ;
193191 weakSelf.myMsgInputView .toUser = nil ;
194192
195- [weakSelf.myTableView reloadSections: [ NSIndexSet indexSetWithIndexesInRange: NSMakeRange ( 0 , 2 )] withRowAnimation: UITableViewRowAnimationAutomatic ];
193+ [weakSelf.myTableView reloadData ];
196194 [weakSelf queryToRefreshCommentList ];
197195 }
198196 }];
@@ -299,8 +297,6 @@ - (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger
299297 NSInteger row = 0 ;
300298 if (section == 0 ) {
301299 row = 1 ;
302- // }else if (section == 2){
303- // row = 1;
304300 }else if (section == 1 ){
305301 row = (self.myCopyTask .handleType == TaskHandleTypeAdd)? 3 : 4 ;
306302 }else {
@@ -324,32 +320,22 @@ - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(N
324320 cell.textViewBecomeFirstResponderBlock = ^(){
325321 [weakSelf.myMsgInputView isAndResignFirstResponder ];
326322 };
327- if (_myCopyTask. handleType == TaskHandleTypeAdd) {
328- cell. deleteBtnClickedBlock = nil ;
329- } else {
330- cell. deleteBtnClickedBlock = ^(Task *toDelete) {
331- [weakSelf.view endEditing: YES ];
332- UIActionSheet *actionSheet = [UIActionSheet bk_actionSheetCustomWithTitle: @" 删除此任务 " buttonTitles: nil destructiveTitle: @" 确认删除 " cancelTitle: @" 取消 " andDidDismissBlock: ^(UIActionSheet *sheet, NSInteger index) {
333- if (index == 0 ) {
334- [weakSelf deleteTask: toDelete ];
335- }
336- }];
337- [actionSheet showInView: kKeyWindow ];
338- };
339- }
323+ cell. deleteBtnClickedBlock = ^(Task *toDelete) {
324+ [weakSelf.view endEditing: YES ] ;
325+ UIActionSheet *actionSheet = [UIActionSheet bk_actionSheetCustomWithTitle: @" 删除此任务 " buttonTitles: nil destructiveTitle: @" 确认删除 " cancelTitle: @" 取消 " andDidDismissBlock: ^(UIActionSheet *sheet, NSInteger index) {
326+ if (index == 0 ) {
327+ [weakSelf deleteTask: toDelete ];
328+ }
329+ }];
330+ [actionSheet showInView: kKeyWindow ];
331+ };
332+ cell. descriptionBtnClickedBlock = ^(Task *toDelete){
333+ [weakSelf goToDescriptionVC ];
334+ };
335+
340336 cell.backgroundColor = kColorTableBG ;
341337 [tableView addLineforPlainCell: cell forRowAtIndexPath: indexPath withLeftSpace: 20 ];
342338 return cell;
343- // }else if (indexPath.section == 2){
344- // TaskDescriptionCell *cell = [tableView dequeueReusableCellWithIdentifier:kCellIdentifier_TaskDescription forIndexPath:indexPath];
345- // if (_myCopyTask.has_description && !_myCopyTask.has_description.boolValue) {
346- // //没有描述
347- // [cell setDescriptionStr:@""];
348- // }else{
349- // [cell setDescriptionStr:_myCopyTask.task_description.description_mine];
350- // }
351- // [cell addLineUp:YES andDown:NO andColor:tableView.separatorColor];
352- // return cell;
353339 }else if (indexPath.section == 1 ){
354340 LeftImage_LRTextCell *cell = [tableView dequeueReusableCellWithIdentifier: kCellIdentifier_LeftImage_LRText forIndexPath: indexPath];
355341 [cell setObj: _myCopyTask type: indexPath.row];
@@ -386,8 +372,6 @@ - (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPa
386372 CGFloat cellHeight = 0 ;
387373 if (indexPath.section == 0 ) {
388374 cellHeight = [TaskContentCell cellHeightWithObj: _myCopyTask];
389- // }else if (indexPath.section == 2){
390- // cellHeight = [TaskDescriptionCell cellHeight];
391375 }else if (indexPath.section == 1 ){
392376 cellHeight = [LeftImage_LRTextCell cellHeight ];
393377 }else {
@@ -432,26 +416,11 @@ - (UIView *)tableView:(UITableView *)tableView viewForHeaderInSection:(NSInteger
432416 return headerView;
433417}
434418
435- // - (UIView *)tableView:(UITableView *)tableView viewForFooterInSection:(NSInteger)section{
436- // UIView *footerView = [[UIView alloc] initWithFrame:CGRectMake(0, 0, kScreen_Width, 1)];
437- // footerView.backgroundColor = (section == 2)? [UIColor whiteColor]: [UIColor clearColor];
438- // return footerView;
439- // }
440-
441419- (void )tableView : (UITableView *)tableView didSelectRowAtIndexPath : (NSIndexPath *)indexPath {
442420 [tableView deselectRowAtIndexPath: indexPath animated: YES ];
443421 ESWeakSelf;
444422 if (indexPath.section == 0 ) {
445423
446- // }else if (indexPath.section == 2) {
447- // TaskDescriptionViewController *vc = [[TaskDescriptionViewController alloc] init];
448- // vc.markdown = _myCopyTask.task_description.markdown;
449- // vc.savedNewMDBlock = ^(NSString *mdStr, NSString *mdHtmlStr){
450- // ESStrongSelf;
451- // _self.myCopyTask.task_description.markdown = mdStr;
452- // _self.myCopyTask.task_description.description_mine = mdHtmlStr;
453- // };
454- // [self.navigationController pushViewController:vc animated:YES];
455424 }else if (indexPath.section == 1 ){
456425 if (indexPath.row == LeftImage_LRTextCellTypeTaskOwner) {
457426 ProjectMemberListViewController *vc = [[ProjectMemberListViewController alloc ] init ];
@@ -502,7 +471,23 @@ - (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath
502471 [self doCommentToComment: curComment sender: [tableView cellForRowAtIndexPath: indexPath]];
503472 }
504473 }
474+ }
505475
476+ - (void )goToDescriptionVC {
477+ if (!_myCopyTask.task_description ) {
478+ _myCopyTask.task_description = [Task_Description defaultDescription ];
479+ }
480+ ESWeakSelf;
481+ TaskDescriptionViewController *vc = [[TaskDescriptionViewController alloc ] init ];
482+ vc.markdown = _myCopyTask.task_description .markdown ;
483+ vc.savedNewMDBlock = ^(NSString *mdStr, NSString *mdHtmlStr){
484+ ESStrongSelf;
485+ _self.myCopyTask .has_description = [NSNumber numberWithBool: (mdStr.length > 0 )];
486+ _self.myCopyTask .task_description .markdown = mdStr;
487+ _self.myCopyTask .task_description .description_mine = mdHtmlStr;
488+ [_self.myTableView reloadData ];
489+ };
490+ [self .navigationController pushViewController: vc animated: YES ];
506491}
507492
508493- (void )doCommentToComment : (TaskComment *)toComment sender : (id )sender {
0 commit comments