{"action":"created","comment":{"url":"https://api.github.com/repos/opentable/objc-TimesSquare/pulls/comments/52254858","id":52254858,"diff_hunk":"@@ -8,31 +8,223 @@\n \n #import \"TSQCalendarDayButton.h\"\n \n-@implementation TSQCalendarDayButton\n+@interface TSQCalendarDayButton ()\n \n+@property (nonatomic, strong) UILabel *subtitleLabel;\n+@property (nonatomic, strong) UILabel *subtitleSymbolLabel;\n \n-/*\n-// Only override drawRect: if you perform custom drawing.\n-// An empty implementation adversely affects performance during animation.\n-- (void)drawRect:(CGRect)rect {\n-    // Drawing code\n-}\n-*/\n+@property (nonatomic, strong) UIImageView *iconImageView;\n+\n+@end\n+\n+@implementation TSQCalendarDayButton\n+\n+static const CGFloat TSQCalendarRowCellMaxSubtitleHeight = 18.0f;\n+static const CGFloat TSQCalendarRowCellSubtitleBuffer = 15.0f;\n \n - (instancetype)initWithFrame:(CGRect)frame\n {\n     self = [super initWithFrame:frame];\n     if (self) {\n+        // default button type to normal day\n+        self.type = CalendarButtonTypeNormalDay;\n+\n         [self setTitleEdgeInsets:UIEdgeInsetsMake(-10, 0, 0, 0)];\n-        self.subtitleLabel = [[UILabel alloc] initWithFrame:CGRectMake(10, 50, 65, 18)];\n+        self.subtitleLabel = [[UILabel alloc] initWithFrame:CGRectZero];\n         self.subtitleLabel.textAlignment = NSTextAlignmentCenter;\n         self.subtitleLabel.userInteractionEnabled = NO;\n+        self.subtitleLabel.adjustsFontSizeToFitWidth = NO;\n+        self.subtitleLabel.lineBreakMode = NSLineBreakByTruncatingTail;\n         [self addSubview:self.subtitleLabel];\n         \n-        self.subtitleSymbolLabel = [[UILabel alloc] initWithFrame:CGRectMake(75, 50, 8, 18)];\n+        self.subtitleSymbolLabel = [[UILabel alloc] initWithFrame:CGRectZero];\n         self.subtitleSymbolLabel.userInteractionEnabled = NO;\n         [self addSubview:self.subtitleSymbolLabel];\n+\n+        self.iconImageView = [[UIImageView alloc] initWithFrame:CGRectZero];\n+        self.iconImageView.userInteractionEnabled = NO;\n+        [self addSubview:self.iconImageView];\n     }\n     return self;\n }\n+\n+- (NSString *)subtitle\n+{\n+    return self.subtitleLabel.text;\n+}\n+\n+- (void)setSubtitle:(NSString *)subtitle;\n+{\n+    if (![self.subtitleLabel.text isEqualToString:subtitle])\n+    {\n+        self.subtitleLabel.text = subtitle;\n+        [self layoutSubviews];\n+    }\n+}\n+\n+- (NSString *)subtitleSymbol\n+{\n+    return self.subtitleSymbolLabel.text;\n+}\n+\n+- (void)setSubtitleSymbol:(NSString *)subtitleSymbol\n+{\n+    if (![self.subtitleSymbolLabel.text isEqualToString:subtitleSymbol])\n+    {\n+        self.subtitleSymbolLabel.text = subtitleSymbol;\n+        [self layoutSubviews];\n+    }\n+}\n+\n+- (UIFont *)subtitleFont\n+{\n+    return self.subtitleLabel.font;\n+}\n+\n+- (void)setSubtitleFont:(UIFont *)subtitleFont\n+{\n+    if (![self.subtitleFont isEqual:subtitleFont])\n+    {\n+        self.subtitleLabel.font = subtitleFont;\n+        self.subtitleSymbolLabel.font = subtitleFont;\n+        [self layoutSubviews];\n+    }\n+}\n+\n+- (UIColor *)subtitleColor\n+{\n+    return self.subtitleLabel.textColor;\n+}\n+\n+- (void)setSubtitleColor:(UIColor *)subtitleColor\n+{\n+    self.subtitleLabel.textColor = subtitleColor;\n+    self.subtitleSymbolLabel.textColor = subtitleColor;\n+}\n+\n+- (UIImage *)icon\n+{\n+    return self.iconImageView.image;\n+}\n+\n+- (void)setIcon:(UIImage *)icon\n+{\n+    if (![self.iconImageView.image isEqual:icon])\n+    {\n+        self.iconImageView.image = icon;\n+        [self layoutSubviews];\n+    }\n+}\n+\n+- (CGSize)maxSubtitleSize\n+{\n+    CGFloat maxWidth = self.bounds.size.width - 2 * TSQCalendarRowCellSubtitleBuffer;\n+    return CGSizeMake(maxWidth, TSQCalendarRowCellMaxSubtitleHeight);\n+}\n+\n+- (CGSize)maxSubtitleSymboleSize","path":"TimesSquare/TSQCalendarDayButton.m","position":null,"original_position":128,"commit_id":"bf7e13b167ee8dd33c5b5d71ffd1b0090769e83e","original_commit_id":"6564582f9f78dff60a1c69d5053f8e1ebb17477d","user":{"login":"krunk4ever","id":627860,"avatar_url":"https://avatars.githubusercontent.com/u/627860?v=3","gravatar_id":"","url":"https://api.github.com/users/krunk4ever","html_url":"https://github.com/krunk4ever","followers_url":"https://api.github.com/users/krunk4ever/followers","following_url":"https://api.github.com/users/krunk4ever/following{/other_user}","gists_url":"https://api.github.com/users/krunk4ever/gists{/gist_id}","starred_url":"https://api.github.com/users/krunk4ever/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/krunk4ever/subscriptions","organizations_url":"https://api.github.com/users/krunk4ever/orgs","repos_url":"https://api.github.com/users/krunk4ever/repos","events_url":"https://api.github.com/users/krunk4ever/events{/privacy}","received_events_url":"https://api.github.com/users/krunk4ever/received_events","type":"User","site_admin":false},"body":"you should be happy i didn't spell it as cymbal ;p","created_at":"2016-02-09T01:09:14Z","updated_at":"2016-02-09T01:09:14Z","html_url":"https://github.com/opentable/objc-TimesSquare/pull/1#discussion_r52254858","pull_request_url":"https://api.github.com/repos/opentable/objc-TimesSquare/pulls/1","_links":{"self":{"href":"https://api.github.com/repos/opentable/objc-TimesSquare/pulls/comments/52254858"},"html":{"href":"https://github.com/opentable/objc-TimesSquare/pull/1#discussion_r52254858"},"pull_request":{"href":"https://api.github.com/repos/opentable/objc-TimesSquare/pulls/1"}}},"pull_request":{"url":"https://api.github.com/repos/opentable/objc-TimesSquare/pulls/1","id":58688551,"html_url":"https://github.com/opentable/objc-TimesSquare/pull/1","diff_url":"https://github.com/opentable/objc-TimesSquare/pull/1.diff","patch_url":"https://github.com/opentable/objc-TimesSquare/pull/1.patch","issue_url":"https://api.github.com/repos/opentable/objc-TimesSquare/issues/1","number":1,"state":"open","locked":false,"title":"Feature/user defined colors","user":{"login":"krunk4ever","id":627860,"avatar_url":"https://avatars.githubusercontent.com/u/627860?v=3","gravatar_id":"","url":"https://api.github.com/users/krunk4ever","html_url":"https://github.com/krunk4ever","followers_url":"https://api.github.com/users/krunk4ever/followers","following_url":"https://api.github.com/users/krunk4ever/following{/other_user}","gists_url":"https://api.github.com/users/krunk4ever/gists{/gist_id}","starred_url":"https://api.github.com/users/krunk4ever/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/krunk4ever/subscriptions","organizations_url":"https://api.github.com/users/krunk4ever/orgs","repos_url":"https://api.github.com/users/krunk4ever/repos","events_url":"https://api.github.com/users/krunk4ever/events{/privacy}","received_events_url":"https://api.github.com/users/krunk4ever/received_events","type":"User","site_admin":false},"body":"","created_at":"2016-02-09T00:18:50Z","updated_at":"2016-02-09T01:09:14Z","closed_at":null,"merged_at":null,"merge_commit_sha":"92b1e171ee407d0e2674e9b08fd75d8b2792e48b","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/opentable/objc-TimesSquare/pulls/1/commits","review_comments_url":"https://api.github.com/repos/opentable/objc-TimesSquare/pulls/1/comments","review_comment_url":"https://api.github.com/repos/opentable/objc-TimesSquare/pulls/comments{/number}","comments_url":"https://api.github.com/repos/opentable/objc-TimesSquare/issues/1/comments","statuses_url":"https://api.github.com/repos/opentable/objc-TimesSquare/statuses/bf7e13b167ee8dd33c5b5d71ffd1b0090769e83e","head":{"label":"opentable:feature/user_defined_colors","ref":"feature/user_defined_colors","sha":"bf7e13b167ee8dd33c5b5d71ffd1b0090769e83e","user":{"login":"opentable","id":2653541,"avatar_url":"https://avatars.githubusercontent.com/u/2653541?v=3","gravatar_id":"","url":"https://api.github.com/users/opentable","html_url":"https://github.com/opentable","followers_url":"https://api.github.com/users/opentable/followers","following_url":"https://api.github.com/users/opentable/following{/other_user}","gists_url":"https://api.github.com/users/opentable/gists{/gist_id}","starred_url":"https://api.github.com/users/opentable/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/opentable/subscriptions","organizations_url":"https://api.github.com/users/opentable/orgs","repos_url":"https://api.github.com/users/opentable/repos","events_url":"https://api.github.com/users/opentable/events{/privacy}","received_events_url":"https://api.github.com/users/opentable/received_events","type":"Organization","site_admin":false},"repo":{"id":12258414,"name":"objc-TimesSquare","full_name":"opentable/objc-TimesSquare","owner":{"login":"opentable","id":2653541,"avatar_url":"https://avatars.githubusercontent.com/u/2653541?v=3","gravatar_id":"","url":"https://api.github.com/users/opentable","html_url":"https://github.com/opentable","followers_url":"https://api.github.com/users/opentable/followers","following_url":"https://api.github.com/users/opentable/following{/other_user}","gists_url":"https://api.github.com/users/opentable/gists{/gist_id}","starred_url":"https://api.github.com/users/opentable/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/opentable/subscriptions","organizations_url":"https://api.github.com/users/opentable/orgs","repos_url":"https://api.github.com/users/opentable/repos","events_url":"https://api.github.com/users/opentable/events{/privacy}","received_events_url":"https://api.github.com/users/opentable/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/opentable/objc-TimesSquare","description":"TimesSquare is an Objective-C calendar view for your apps.","fork":true,"url":"https://api.github.com/repos/opentable/objc-TimesSquare","forks_url":"https://api.github.com/repos/opentable/objc-TimesSquare/forks","keys_url":"https://api.github.com/repos/opentable/objc-TimesSquare/keys{/key_id}","collaborators_url":"https://api.github.com/repos/opentable/objc-TimesSquare/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/opentable/objc-TimesSquare/teams","hooks_url":"https://api.github.com/repos/opentable/objc-TimesSquare/hooks","issue_events_url":"https://api.github.com/repos/opentable/objc-TimesSquare/issues/events{/number}","events_url":"https://api.github.com/repos/opentable/objc-TimesSquare/events","assignees_url":"https://api.github.com/repos/opentable/objc-TimesSquare/assignees{/user}","branches_url":"https://api.github.com/repos/opentable/objc-TimesSquare/branches{/branch}","tags_url":"https://api.github.com/repos/opentable/objc-TimesSquare/tags","blobs_url":"https://api.github.com/repos/opentable/objc-TimesSquare/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/opentable/objc-TimesSquare/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/opentable/objc-TimesSquare/git/refs{/sha}","trees_url":"https://api.github.com/repos/opentable/objc-TimesSquare/git/trees{/sha}","statuses_url":"https://api.github.com/repos/opentable/objc-TimesSquare/statuses/{sha}","languages_url":"https://api.github.com/repos/opentable/objc-TimesSquare/languages","stargazers_url":"https://api.github.com/repos/opentable/objc-TimesSquare/stargazers","contributors_url":"https://api.github.com/repos/opentable/objc-TimesSquare/contributors","subscribers_url":"https://api.github.com/repos/opentable/objc-TimesSquare/subscribers","subscription_url":"https://api.github.com/repos/opentable/objc-TimesSquare/subscription","commits_url":"https://api.github.com/repos/opentable/objc-TimesSquare/commits{/sha}","git_commits_url":"https://api.github.com/repos/opentable/objc-TimesSquare/git/commits{/sha}","comments_url":"https://api.github.com/repos/opentable/objc-TimesSquare/comments{/number}","issue_comment_url":"https://api.github.com/repos/opentable/objc-TimesSquare/issues/comments{/number}","contents_url":"https://api.github.com/repos/opentable/objc-TimesSquare/contents/{+path}","compare_url":"https://api.github.com/repos/opentable/objc-TimesSquare/compare/{base}...{head}","merges_url":"https://api.github.com/repos/opentable/objc-TimesSquare/merges","archive_url":"https://api.github.com/repos/opentable/objc-TimesSquare/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/opentable/objc-TimesSquare/downloads","issues_url":"https://api.github.com/repos/opentable/objc-TimesSquare/issues{/number}","pulls_url":"https://api.github.com/repos/opentable/objc-TimesSquare/pulls{/number}","milestones_url":"https://api.github.com/repos/opentable/objc-TimesSquare/milestones{/number}","notifications_url":"https://api.github.com/repos/opentable/objc-TimesSquare/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/opentable/objc-TimesSquare/labels{/name}","releases_url":"https://api.github.com/repos/opentable/objc-TimesSquare/releases{/id}","deployments_url":"https://api.github.com/repos/opentable/objc-TimesSquare/deployments","created_at":"2013-08-21T01:30:11Z","updated_at":"2014-09-12T00:05:22Z","pushed_at":"2016-02-09T01:05:16Z","git_url":"git://github.com/opentable/objc-TimesSquare.git","ssh_url":"git@github.com:opentable/objc-TimesSquare.git","clone_url":"https://github.com/opentable/objc-TimesSquare.git","svn_url":"https://github.com/opentable/objc-TimesSquare","homepage":"","size":520,"stargazers_count":1,"watchers_count":1,"language":"Objective-C","has_issues":false,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":2,"mirror_url":null,"open_issues_count":1,"forks":2,"open_issues":1,"watchers":1,"default_branch":"master"}},"base":{"label":"opentable:section-headers","ref":"section-headers","sha":"a9aae18d88b64d95e69b7258a843b622c7f3b8e0","user":{"login":"opentable","id":2653541,"avatar_url":"https://avatars.githubusercontent.com/u/2653541?v=3","gravatar_id":"","url":"https://api.github.com/users/opentable","html_url":"https://github.com/opentable","followers_url":"https://api.github.com/users/opentable/followers","following_url":"https://api.github.com/users/opentable/following{/other_user}","gists_url":"https://api.github.com/users/opentable/gists{/gist_id}","starred_url":"https://api.github.com/users/opentable/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/opentable/subscriptions","organizations_url":"https://api.github.com/users/opentable/orgs","repos_url":"https://api.github.com/users/opentable/repos","events_url":"https://api.github.com/users/opentable/events{/privacy}","received_events_url":"https://api.github.com/users/opentable/received_events","type":"Organization","site_admin":false},"repo":{"id":12258414,"name":"objc-TimesSquare","full_name":"opentable/objc-TimesSquare","owner":{"login":"opentable","id":2653541,"avatar_url":"https://avatars.githubusercontent.com/u/2653541?v=3","gravatar_id":"","url":"https://api.github.com/users/opentable","html_url":"https://github.com/opentable","followers_url":"https://api.github.com/users/opentable/followers","following_url":"https://api.github.com/users/opentable/following{/other_user}","gists_url":"https://api.github.com/users/opentable/gists{/gist_id}","starred_url":"https://api.github.com/users/opentable/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/opentable/subscriptions","organizations_url":"https://api.github.com/users/opentable/orgs","repos_url":"https://api.github.com/users/opentable/repos","events_url":"https://api.github.com/users/opentable/events{/privacy}","received_events_url":"https://api.github.com/users/opentable/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/opentable/objc-TimesSquare","description":"TimesSquare is an Objective-C calendar view for your apps.","fork":true,"url":"https://api.github.com/repos/opentable/objc-TimesSquare","forks_url":"https://api.github.com/repos/opentable/objc-TimesSquare/forks","keys_url":"https://api.github.com/repos/opentable/objc-TimesSquare/keys{/key_id}","collaborators_url":"https://api.github.com/repos/opentable/objc-TimesSquare/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/opentable/objc-TimesSquare/teams","hooks_url":"https://api.github.com/repos/opentable/objc-TimesSquare/hooks","issue_events_url":"https://api.github.com/repos/opentable/objc-TimesSquare/issues/events{/number}","events_url":"https://api.github.com/repos/opentable/objc-TimesSquare/events","assignees_url":"https://api.github.com/repos/opentable/objc-TimesSquare/assignees{/user}","branches_url":"https://api.github.com/repos/opentable/objc-TimesSquare/branches{/branch}","tags_url":"https://api.github.com/repos/opentable/objc-TimesSquare/tags","blobs_url":"https://api.github.com/repos/opentable/objc-TimesSquare/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/opentable/objc-TimesSquare/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/opentable/objc-TimesSquare/git/refs{/sha}","trees_url":"https://api.github.com/repos/opentable/objc-TimesSquare/git/trees{/sha}","statuses_url":"https://api.github.com/repos/opentable/objc-TimesSquare/statuses/{sha}","languages_url":"https://api.github.com/repos/opentable/objc-TimesSquare/languages","stargazers_url":"https://api.github.com/repos/opentable/objc-TimesSquare/stargazers","contributors_url":"https://api.github.com/repos/opentable/objc-TimesSquare/contributors","subscribers_url":"https://api.github.com/repos/opentable/objc-TimesSquare/subscribers","subscription_url":"https://api.github.com/repos/opentable/objc-TimesSquare/subscription","commits_url":"https://api.github.com/repos/opentable/objc-TimesSquare/commits{/sha}","git_commits_url":"https://api.github.com/repos/opentable/objc-TimesSquare/git/commits{/sha}","comments_url":"https://api.github.com/repos/opentable/objc-TimesSquare/comments{/number}","issue_comment_url":"https://api.github.com/repos/opentable/objc-TimesSquare/issues/comments{/number}","contents_url":"https://api.github.com/repos/opentable/objc-TimesSquare/contents/{+path}","compare_url":"https://api.github.com/repos/opentable/objc-TimesSquare/compare/{base}...{head}","merges_url":"https://api.github.com/repos/opentable/objc-TimesSquare/merges","archive_url":"https://api.github.com/repos/opentable/objc-TimesSquare/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/opentable/objc-TimesSquare/downloads","issues_url":"https://api.github.com/repos/opentable/objc-TimesSquare/issues{/number}","pulls_url":"https://api.github.com/repos/opentable/objc-TimesSquare/pulls{/number}","milestones_url":"https://api.github.com/repos/opentable/objc-TimesSquare/milestones{/number}","notifications_url":"https://api.github.com/repos/opentable/objc-TimesSquare/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/opentable/objc-TimesSquare/labels{/name}","releases_url":"https://api.github.com/repos/opentable/objc-TimesSquare/releases{/id}","deployments_url":"https://api.github.com/repos/opentable/objc-TimesSquare/deployments","created_at":"2013-08-21T01:30:11Z","updated_at":"2014-09-12T00:05:22Z","pushed_at":"2016-02-09T01:05:16Z","git_url":"git://github.com/opentable/objc-TimesSquare.git","ssh_url":"git@github.com:opentable/objc-TimesSquare.git","clone_url":"https://github.com/opentable/objc-TimesSquare.git","svn_url":"https://github.com/opentable/objc-TimesSquare","homepage":"","size":520,"stargazers_count":1,"watchers_count":1,"language":"Objective-C","has_issues":false,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":2,"mirror_url":null,"open_issues_count":1,"forks":2,"open_issues":1,"watchers":1,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/opentable/objc-TimesSquare/pulls/1"},"html":{"href":"https://github.com/opentable/objc-TimesSquare/pull/1"},"issue":{"href":"https://api.github.com/repos/opentable/objc-TimesSquare/issues/1"},"comments":{"href":"https://api.github.com/repos/opentable/objc-TimesSquare/issues/1/comments"},"review_comments":{"href":"https://api.github.com/repos/opentable/objc-TimesSquare/pulls/1/comments"},"review_comment":{"href":"https://api.github.com/repos/opentable/objc-TimesSquare/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/opentable/objc-TimesSquare/pulls/1/commits"},"statuses":{"href":"https://api.github.com/repos/opentable/objc-TimesSquare/statuses/bf7e13b167ee8dd33c5b5d71ffd1b0090769e83e"}}}}