Skip to content

Commit

Permalink
refactor: InfyOmLabs#18 Replace {!! with {{ to escape the data in loc…
Browse files Browse the repository at this point in the history
…ale templates (InfyOmLabs#52)
  • Loading branch information
ajayinfyom authored Nov 30, 2019
1 parent 0a191a1 commit ca246dc
Show file tree
Hide file tree
Showing 11 changed files with 61 additions and 17 deletions.
2 changes: 1 addition & 1 deletion templates/scaffold/auth/email_locale.stub
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@
@endif

<form method="post" action="{{ url('/password/email') }}">
{!! csrf_field() !!}
@csrf

<div class="form-group has-feedback {{ $errors->has('email') ? ' has-error' : '' }}">
<input type="email" class="form-control" name="email" value="{{ old('email') }}" placeholder="@lang('auth.email')">
Expand Down
2 changes: 1 addition & 1 deletion templates/scaffold/auth/login_locale.stub
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@
<p class="login-box-msg">@lang('auth.login.title')</p>

<form method="post" action="{{ url('/login') }}">
{!! csrf_field() !!}
@csrf

<div class="form-group has-feedback {{ $errors->has('email') ? ' has-error' : '' }}">
<input type="email" class="form-control" name="email" value="{{ old('email') }}" placeholder="@lang('auth.email')">
Expand Down
3 changes: 1 addition & 2 deletions templates/scaffold/auth/register_locale.stub
Original file line number Diff line number Diff line change
Expand Up @@ -41,8 +41,7 @@
<p class="login-box-msg">@lang('auth.registration.title')</p>

<form method="post" action="{{ url('/register') }}">

{!! csrf_field() !!}
@csrf

<div class="form-group has-feedback{{ $errors->has('name') ? ' has-error' : '' }}">
<input type="text" class="form-control" name="name" value="{{ old('name') }}" placeholder="@lang('auth.full_name')">
Expand Down
2 changes: 1 addition & 1 deletion templates/scaffold/auth/reset_locale.stub
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@
<p class="login-box-msg">@lang('auth.reset_password.title')</p>

<form method="post" action="{{ url('/password/reset') }}">
{!! csrf_field() !!}
@csrf

<input type="hidden" name="token" value="{{ $token }}">

Expand Down
55 changes: 50 additions & 5 deletions templates/scaffold/layouts/app_locale.stub
Original file line number Diff line number Diff line change
Expand Up @@ -56,16 +56,16 @@
<img src="http://infyom.com/images/logo/blue_logo_150x150.jpg"
class="user-image" alt="User Image"/>
<!-- hidden-xs hides the username on small devices so only the image appears. -->
<span class="hidden-xs">{!! Auth::user()->name !!}</span>
<span class="hidden-xs">{{ Auth::user()->name }}</span>
</a>
<ul class="dropdown-menu">
<!-- The user image in the menu -->
<li class="user-header">
<img src="http://infyom.com/images/logo/blue_logo_150x150.jpg"
class="img-circle" alt="User Image"/>
<p>
{!! Auth::user()->name !!}
<small>@lang('auth.app.member_since') {!! Auth::user()->created_at->format('M. Y') !!}</small>
{{ Auth::user()->name }}
<small>@lang('auth.app.member_since') {{ Auth::user()->created_at->format('M. Y') }}</small>
</p>
</li>
<!-- Menu Footer-->
Expand All @@ -74,13 +74,13 @@
<a href="#" class="btn btn-default btn-flat">@lang('auth.app.profile')</a>
</div>
<div class="pull-right">
<a href="{!! url('/logout') !!}" class="btn btn-default btn-flat"
<a href="{{ url('/logout') }}" class="btn btn-default btn-flat"
onclick="event.preventDefault(); document.getElementById('logout-form').submit();">
@lang('auth.sign_out')
</a>
<form id="logout-form" action="{{ url('/logout') }}" method="POST"
style="display: none;">
{{ csrf_field() }}
@csrf
</form>
</div>
</li>
Expand All @@ -104,6 +104,51 @@
</footer>

</div>
@else
<nav class="navbar navbar-default navbar-static-top">
<div class="container">
<div class="navbar-header">

<!-- Collapsed Hamburger -->
<button type="button" class="navbar-toggle collapsed" data-toggle="collapse"
data-target="#app-navbar-collapse">
<span class="sr-only">Toggle Navigation</span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</button>

<!-- Branding Image -->
<a class="navbar-brand" href="{{ url('/') }}">
InfyOm Generator
</a>
</div>

<div class="collapse navbar-collapse" id="app-navbar-collapse">
<!-- Left Side Of Navbar -->
<ul class="nav navbar-nav">
<li><a href="{{ url('/home') }}">Home</a></li>
</ul>

<!-- Right Side Of Navbar -->
<ul class="nav navbar-nav navbar-right">
<!-- Authentication Links -->
<li><a href="{{ url('/login') }}">Login</a></li>
<li><a href="{{ url('/register') }}">Register</a></li>
</ul>
</div>
</div>
</nav>

<div id="page-content-wrapper">
<div class="container-fluid">
<div class="row">
<div class="col-lg-12">
@yield('content')
</div>
</div>
</div>
</div>
@endif

<!-- jQuery 3.1.1 -->
Expand Down
2 changes: 1 addition & 1 deletion templates/scaffold/layouts/menu_template_locale.stub
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
<li class="{{ Request::is('$ROUTE_PREFIX$$MODEL_NAME_PLURAL_CAMEL$*') ? 'active' : '' }}">
<a href="{!! route('$ROUTE_NAMED_PREFIX$$MODEL_NAME_PLURAL_CAMEL$.index') !!}"><i class="fa fa-edit"></i><span>@lang('models/$MODEL_NAME_PLURAL_CAMEL$.plural')</span></a>
<a href="{{ route('$ROUTE_NAMED_PREFIX$$MODEL_NAME_PLURAL_CAMEL$.index') }}"><i class="fa fa-edit"></i><span>@lang('models/$MODEL_NAME_PLURAL_CAMEL$.plural')</span></a>
</li>
4 changes: 2 additions & 2 deletions templates/scaffold/views/blade_table_body_locale.stub
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@
<td>
{!! Form::open(['route' => ['$ROUTE_NAMED_PREFIX$$MODEL_NAME_PLURAL_CAMEL$.destroy', $$MODEL_NAME_CAMEL$->$PRIMARY_KEY_NAME$], 'method' => 'delete']) !!}
<div class='btn-group'>
<a href="{!! route('$ROUTE_NAMED_PREFIX$$MODEL_NAME_PLURAL_CAMEL$.show', [$$MODEL_NAME_CAMEL$->$PRIMARY_KEY_NAME$]) !!}" class='btn btn-default btn-xs'><i class="glyphicon glyphicon-eye-open"></i></a>
<a href="{!! route('$ROUTE_NAMED_PREFIX$$MODEL_NAME_PLURAL_CAMEL$.edit', [$$MODEL_NAME_CAMEL$->$PRIMARY_KEY_NAME$]) !!}" class='btn btn-default btn-xs'><i class="glyphicon glyphicon-edit"></i></a>
<a href="{{ route('$ROUTE_NAMED_PREFIX$$MODEL_NAME_PLURAL_CAMEL$.show', [$$MODEL_NAME_CAMEL$->$PRIMARY_KEY_NAME$]) }}" class='btn btn-default btn-xs'><i class="glyphicon glyphicon-eye-open"></i></a>
<a href="{{ route('$ROUTE_NAMED_PREFIX$$MODEL_NAME_PLURAL_CAMEL$.edit', [$$MODEL_NAME_CAMEL$->$PRIMARY_KEY_NAME$]) }}" class='btn btn-default btn-xs'><i class="glyphicon glyphicon-edit"></i></a>
{!! Form::button('<i class="glyphicon glyphicon-trash"></i>', ['type' => 'submit', 'class' => 'btn btn-danger btn-xs', 'onclick' => 'return confirm("'.__('crud.are_you_sure').'")']) !!}
</div>
{!! Form::close() !!}
Expand Down
2 changes: 1 addition & 1 deletion templates/scaffold/views/fields_locale.stub
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,5 @@ $FIELDS$
<!-- Submit Field -->
<div class="form-group col-sm-12">
{!! Form::submit(__('crud.save'), ['class' => 'btn btn-primary']) !!}
<a href="{!! route('$ROUTE_NAMED_PREFIX$$MODEL_NAME_PLURAL_CAMEL$.index') !!}" class="btn btn-default">@lang('crud.cancel')</a>
<a href="{{ route('$ROUTE_NAMED_PREFIX$$MODEL_NAME_PLURAL_CAMEL$.index') }}" class="btn btn-default">@lang('crud.cancel')</a>
</div>
2 changes: 1 addition & 1 deletion templates/scaffold/views/index_locale.stub
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
@lang('models/$MODEL_NAME_PLURAL_CAMEL$.plural')
</h1>
<h1 class="pull-right">
<a class="btn btn-primary pull-right" style="margin-top: -10px;margin-bottom: 5px" href="{!! route('$ROUTE_NAMED_PREFIX$$MODEL_NAME_PLURAL_CAMEL$.create') !!}">@lang('crud.add_new')</a>
<a class="btn btn-primary pull-right" style="margin-top: -10px;margin-bottom: 5px" href="{{ route('$ROUTE_NAMED_PREFIX$$MODEL_NAME_PLURAL_CAMEL$.create') }}">@lang('crud.add_new')</a>
</h1>
</section>
<div class="content">
Expand Down
2 changes: 1 addition & 1 deletion templates/scaffold/views/show_field_locale.stub
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<!-- $FIELD_NAME_TITLE$ Field -->
<div class="form-group">
{!! Form::label('$FIELD_NAME$', __('models/$TABLE_NAME$.fields.$FIELD_NAME$').':') !!}
<p>{!! $$MODEL_NAME_CAMEL$->$FIELD_NAME$ !!}</p>
<p>{{ $$MODEL_NAME_CAMEL$->$FIELD_NAME$ }}</p>
</div>
2 changes: 1 addition & 1 deletion templates/scaffold/views/show_locale.stub
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
<div class="box-body">
<div class="row" style="padding-left: 20px">
@include('$VIEW_PREFIX$$MODEL_NAME_PLURAL_SNAKE$.show_fields')
<a href="{!! route('$ROUTE_NAMED_PREFIX$$MODEL_NAME_PLURAL_CAMEL$.index') !!}" class="btn btn-default">
<a href="{{ route('$ROUTE_NAMED_PREFIX$$MODEL_NAME_PLURAL_CAMEL$.index') }}" class="btn btn-default">
@lang('crud.back')
</a>
</div>
Expand Down

0 comments on commit ca246dc

Please sign in to comment.