From a937bfb6d8ca5e7d451338a35c19d91295f09049 Mon Sep 17 00:00:00 2001 From: Maurice Breit Date: Sun, 6 Aug 2017 19:32:27 +0200 Subject: [PATCH] hide buttons if user is not coach --- .../app/events/EventDetailViewController.swift | 13 ++++--------- 1 file changed, 4 insertions(+), 9 deletions(-) diff --git a/CoachPlus/app/events/EventDetailViewController.swift b/CoachPlus/app/events/EventDetailViewController.swift index d929560..d50b0d5 100644 --- a/CoachPlus/app/events/EventDetailViewController.swift +++ b/CoachPlus/app/events/EventDetailViewController.swift @@ -15,7 +15,6 @@ class EventDetailViewController: CoachPlusViewController, UITableViewDelegate, U case news = 0 case participation = 1 } - var event:Event? var news = [News]() @@ -46,8 +45,7 @@ class EventDetailViewController: CoachPlusViewController, UITableViewDelegate, U override func viewDidLoad() { super.viewDidLoad() - - + self.view.heroID = self.heroId self.nameLbl.heroID = "\(self.heroId)/name" @@ -61,9 +59,11 @@ class EventDetailViewController: CoachPlusViewController, UITableViewDelegate, U if (self.membership?.isCoach())! { self.editBtn.setIcon(icon: .googleMaterialDesign(.modeEdit), iconSize: 20, color: .coachPlusLightGrey, backgroundColor: .clear, forState: .normal) self.sendReminderBtn.setIcon(icon: .googleMaterialDesign(.alarm), iconSize: 20, color: .coachPlusLightGrey, backgroundColor: .clear, forState: .normal) + } else { + self.editBtn.isHidden = true + self.sendReminderBtn.isHidden = true } - self.tableView.rowHeight = UITableViewAutomaticDimension self.tableView.estimatedRowHeight = 70 @@ -73,7 +73,6 @@ class EventDetailViewController: CoachPlusViewController, UITableViewDelegate, U } override func viewWillAppear(_ animated: Bool) { - super.viewWillAppear(animated) self.nameLbl.text = self.event?.name @@ -88,11 +87,7 @@ class EventDetailViewController: CoachPlusViewController, UITableViewDelegate, U } self.descriptionLbl.text = description - self.locationLbl.text = self.event?.getLocationString() - - - } func loadParticipations() {