diff --git a/Web/Presenters/GroupPresenter.php b/Web/Presenters/GroupPresenter.php index 2933ecda..399a424e 100644 --- a/Web/Presenters/GroupPresenter.php +++ b/Web/Presenters/GroupPresenter.php @@ -250,13 +250,16 @@ final class GroupPresenter extends OpenVKPresenter $this->flash("succ", "Изменения сохранены", "Новые данные появятся в вашей группе."); } } - function renderEditAvatar(int $id) + + function renderEditAvatar(int $id): void { $this->assertUserLoggedIn(); $this->willExecuteWriteAction(); + $club = $this->clubs->get($id); - if(!$club ||!$club->canBeModifiedBy($this->user->identity)) + if(!$club || !$club->canBeModifiedBy($this->user->identity)) { + $this->flashFail("err", "Неизвестная ошибка", "Не удалось сохранить фотографию."); } if($_FILES["ava"]["error"] === UPLOAD_ERR_OK) { @@ -278,9 +281,11 @@ final class GroupPresenter extends OpenVKPresenter (new Albums)->getClubAvatarAlbum($club)->addPhoto($photo); } catch(ISE $ex) { $name = $album->getName(); + $this->flashFail("err", "Неизвестная ошибка", "Не удалось сохранить фотографию."); } } + $this->flash("succ", "Фотография сохранена", "Новые данные появятся в вашей группе."); $this->redirect("/club$id"); } diff --git a/Web/Presenters/templates/Group/View.xml b/Web/Presenters/templates/Group/View.xml index 9189664e..c5977318 100644 --- a/Web/Presenters/templates/Group/View.xml +++ b/Web/Presenters/templates/Group/View.xml @@ -96,30 +96,18 @@
{var $avatarPhoto = $club->getAvatarPhoto()} {var $avatarLink = ((is_null($avatarPhoto) ? FALSE : $avatarPhoto->isAnonymous()) ? "/photo" . ("s/" . base_convert((string) $avatarPhoto->getId(), 10, 32)) : $club->getAvatarLink())} -
+
{if !is_null($thisUser) && $club->canBeModifiedBy($thisUser)} {if is_null($avatarPhoto) == true} - {_add_photo} + {_add_photo} {else} - +
+ -
    +
+ @@ -130,10 +118,11 @@ {/if}>
diff --git a/Web/Presenters/templates/User/View.xml b/Web/Presenters/templates/User/View.xml index 7d26d60e..17e96b52 100644 --- a/Web/Presenters/templates/User/View.xml +++ b/Web/Presenters/templates/User/View.xml @@ -70,38 +70,19 @@
-
getId() == $thisUser->getId()} onmouseover=" - {if is_null($user->getAvatarPhoto()) == false && $user->getAvatarPhoto()->getURL() != "$serverUrl/assets/packages/static/openvk/img/camera_200.png"} - _avatarDelete.style.backgroundColor='rgba(0, 0, 0, 0.7)'; - deleteButton.style.opacity='0.7'; - {/if} - avatarChange.style.backgroundColor='rgba(0, 0, 0, 0.7)'; - avatarChange.style.opacity='100%'; - " - onmouseleave=" - {if is_null($user->getAvatarPhoto()) == false && $user->getAvatarPhoto()->getURL() != "$serverUrl/assets/packages/static/openvk/img/camera_200.png"} - _avatarDelete.style.backgroundColor='rgba(0, 0, 0, 0)'; - deleteButton.style.opacity='0'; - {/if} - avatarChange.style.backgroundColor='rgba(0, 0, 0, 0)'; - avatarChange.style.opacity='0'; - "{/if}> -
-
- diff --git a/Web/static/css/avataredit.css b/Web/static/css/avataredit.css index 6b003576..a72228d6 100644 --- a/Web/static/css/avataredit.css +++ b/Web/static/css/avataredit.css @@ -1,46 +1,53 @@ /*avatar controls*/ -#avatarEdit +#deleteButton +{ + opacity:0.8; +} +#avatarOptionsBlock, #avatarDeleteBlock, #_newPicture, #_newAvatarPicture { + -webkit-transition: all 200ms ease-in-out; + -moz-transition: all 200ms ease-in-out; + -o-transition: all 200ms ease-in-out; + transition: all 200ms ease-in-out; +} +#avatarDeleteBlock { position: relative; + background-color:rgba(27, 27, 27, 0.8); + opacity:0; +} +#avatarOptionsBlock +{ + position:absolute; + width:100px; + background-color:rgba(27, 27, 27, 0.8); + list-style-type: none; + font-size:11px; + margin-bottom:20px; + padding-top:10px; + padding-bottom:10px; + opacity:0; } #_avatarDelete { position:absolute; right:0; top:0; - background-color:rgba(51, 51, 51, 0); + background-color:rgba(0, 0, 0, 0.7); border-radius: 0px 0px 3px 3px; padding:2px; padding-left:3px; + opacity:1; } -#deleteButton -{ - opacity:0; +div#avatarAll:hover #avatarDeleteBlock { + opacity: 1 !important; + visibility: visible; } -#avatarChange, #_avatarDelete, #_newPicture, #deleteButton, #_avatarDelete { - -webkit-transition: all 200ms ease-in-out; - -moz-transition: all 200ms ease-in-out; - -o-transition: all 200ms ease-in-out; - transition: all 200ms ease-in-out; -} -#avatarChange -{ - position:absolute; - width:100px; - background-color:rgba(51, 51, 51, 0); - list-style-type: none; - font-size:11px; - padding-top:10px; - padding-bottom:10px; - opacity:0%; -} -div#avatarAll:hover #avatarChange { +div#avatarAll:hover #avatarOptionsBlock { opacity: 1 !important; visibility: visible; } #uploadIcon { - opacity:50%; position:absolute; left:0; margin-left:20px; @@ -59,8 +66,19 @@ div#avatarAll:hover #avatarChange { text-align:center; left:20%; top:75%; + color:#5680a0 !important; } -.newpict:hover +#_newAvatarPicture2 { - color:#5680a0; -} \ No newline at end of file + position:absolute; + left:0; + margin-left:20px; +} +#_newAvatarPicture +{ + color:#B2B2B2; +} +#_newAvatarPicture:hover +{ + color:#D9D9D9; +}