diff --git a/app/Http/Controllers/UserController.php b/app/Http/Controllers/UserController.php index 8c248414..4035893a 100644 --- a/app/Http/Controllers/UserController.php +++ b/app/Http/Controllers/UserController.php @@ -188,12 +188,33 @@ class UserController extends Controller return json(trans('user.verification.success'), 0); } - public function profile() + public function profile(Filter $filter) { $user = Auth::user(); + $grid = [ + 'layout' => [ + ['md-6', 'md-6'], + ], + 'widgets' => [ + [ + [ + 'user.widgets.profile.avatar', + 'user.widgets.profile.password' + ], + [ + 'user.widgets.profile.nickname', + 'user.widgets.profile.email', + 'user.widgets.profile.delete-account', + ], + ], + ], + ]; + $grid = $filter->apply('grid:user.profile', $grid); + return view('user.profile') ->with('user', $user) + ->with('grid', $grid) ->with('site_name', option_localized('site_name')); } diff --git a/resources/views/shared/grid.twig b/resources/views/shared/grid.twig new file mode 100644 index 00000000..db412d9a --- /dev/null +++ b/resources/views/shared/grid.twig @@ -0,0 +1,12 @@ +{% for row in grid.widgets %} +
+ {% set layout = grid.layout[loop.index0] %} + {% for col in row %} +
+ {% for widget in col %} + {{ include(widget) }} + {% endfor %} +
+ {% endfor %} +
+{% endfor %} diff --git a/resources/views/user/profile.twig b/resources/views/user/profile.twig index e592bc26..736b22cd 100644 --- a/resources/views/user/profile.twig +++ b/resources/views/user/profile.twig @@ -3,124 +3,7 @@ {% block title %}{{ trans('general.profile') }}{% endblock %} {% block content %} -
-
-
-
-

- {{ trans('user.profile.avatar.title') }} -

-
-
- {{ trans('user.profile.avatar.notice')|raw }} -
- -
- -
-
-

- {{ trans('user.profile.password.title') }} -

-
-
-
- - -
- -
- - -
- -
- - -
-
- -
-
-
-
-
-

- {{ trans('user.profile.nickname.title') }} -

-
-
-
- -
-
- -
- -
-
-

- {{ trans('user.profile.email.title') }} -

-
-
-
- -
-
- -
-
- -
- -
-
-

- {{ trans('user.profile.delete.title') }} -

-
-
- {% if user.admin %} -

{{ trans('user.profile.delete.admin') }}

- - {% else %} -

{{ trans('user.profile.delete.notice', { site: site_name }) }}

- - {% endif %} -
-
-
-
+ {{ include('shared.grid') }} {% endblock %} - -{% block before_foot %} - -{% endblock %} diff --git a/resources/views/user/widgets/profile/avatar.twig b/resources/views/user/widgets/profile/avatar.twig new file mode 100644 index 00000000..595bc9b2 --- /dev/null +++ b/resources/views/user/widgets/profile/avatar.twig @@ -0,0 +1,15 @@ +
+
+

+ {{ trans('user.profile.avatar.title') }} +

+
+
+ {{ trans('user.profile.avatar.notice')|raw }} +
+ +
diff --git a/resources/views/user/widgets/profile/delete-account.twig b/resources/views/user/widgets/profile/delete-account.twig new file mode 100644 index 00000000..e8ebec6b --- /dev/null +++ b/resources/views/user/widgets/profile/delete-account.twig @@ -0,0 +1,24 @@ +
+
+

+ {{ trans('user.profile.delete.title') }} +

+
+
+ {% if user.admin %} +

{{ trans('user.profile.delete.admin') }}

+ + {% else %} +

{{ trans('user.profile.delete.notice', { site: site_name }) }}

+ + {% endif %} +
+
diff --git a/resources/views/user/widgets/profile/email.twig b/resources/views/user/widgets/profile/email.twig new file mode 100644 index 00000000..78b10026 --- /dev/null +++ b/resources/views/user/widgets/profile/email.twig @@ -0,0 +1,22 @@ +
+
+

+ {{ trans('user.profile.email.title') }} +

+
+
+
+ +
+
+ +
+
+ +
diff --git a/resources/views/user/widgets/profile/nickname.twig b/resources/views/user/widgets/profile/nickname.twig new file mode 100644 index 00000000..f992cf3e --- /dev/null +++ b/resources/views/user/widgets/profile/nickname.twig @@ -0,0 +1,18 @@ +
+
+

+ {{ trans('user.profile.nickname.title') }} +

+
+
+
+ +
+
+ +
diff --git a/resources/views/user/widgets/profile/password.twig b/resources/views/user/widgets/profile/password.twig new file mode 100644 index 00000000..97ac7dc5 --- /dev/null +++ b/resources/views/user/widgets/profile/password.twig @@ -0,0 +1,30 @@ +
+
+

+ {{ trans('user.profile.password.title') }} +

+
+
+
+ + +
+ +
+ + +
+ +
+ + +
+
+ +