Skip to content

Commit

Permalink
Split view for ease of development
Browse files Browse the repository at this point in the history
  • Loading branch information
Andrey Helldar committed Oct 20, 2020
1 parent 5103bd5 commit 068d019
Show file tree
Hide file tree
Showing 4 changed files with 163 additions and 155 deletions.
38 changes: 38 additions & 0 deletions resources/views/layout.blade.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
<!DOCTYPE html>
<html lang="{{ app()->getLocale() }}">
<head>
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no, minimal-ui">

<title>{{ trans('Routes list') }} | {{ config('app.name') }}</title>

<link
rel="shortcut icon"
type="image/svg"
sizes="16x16"
href="data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0iaXNvLTg4NTktMSI/Pg0KPCEtLSBHZW5lcmF0b3I6IEFkb2JlIElsbHVzdHJhdG9yIDE5LjAuMCwgU1ZHIEV4cG9ydCBQbHVnLUluIC4gU1ZHIFZlcnNpb246IDYuMDAgQnVpbGQgMCkgIC0tPg0KPHN2ZyB2ZXJzaW9uPSIxLjEiIGlkPSJDYXBhXzEiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyIgeG1sbnM6eGxpbms9Imh0dHA6Ly93d3cudzMub3JnLzE5OTkveGxpbmsiIHg9IjBweCIgeT0iMHB4Ig0KCSB2aWV3Qm94PSIwIDAgMzk0Ljk3MSAzOTQuOTcxIiBzdHlsZT0iZW5hYmxlLWJhY2tncm91bmQ6bmV3IDAgMCAzOTQuOTcxIDM5NC45NzE7IiB4bWw6c3BhY2U9InByZXNlcnZlIj4NCjxnPg0KCTxnPg0KCQk8Zz4NCgkJCTxwYXRoIGQ9Ik01Ni40MjQsMTQ2LjI4NmMtMjguMjc3LDAtNTEuMiwyMi45MjMtNTEuMiw1MS4yczIyLjkyMyw1MS4yLDUxLjIsNTEuMnM1MS4yLTIyLjkyMyw1MS4yLTUxLjINCgkJCQlTODQuNzAxLDE0Ni4y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9zdmc+DQo=">

<link rel="dns-prefetch" href="https://fonts.googleapis.com">
<link rel="dns-prefetch" href="https://cdn.jsdelivr.net">

<link href="https://fonts.googleapis.com/css?family=Roboto:100,300,400,500,700,900" rel="stylesheet">
<link href="https://cdn.jsdelivr.net/npm/@mdi/[email protected]/css/materialdesignicons.min.css" rel="stylesheet">
<link href="https://cdn.jsdelivr.net/npm/[email protected]/dist/vuetify.min.css" rel="stylesheet">

<style>
.spaced { margin: 2px; }
.deprecated { text-decoration: line-through; }
.link:hover { text-decoration: underline; cursor: pointer; }
</style>
</head>
<body>

<div id="app">
@include('pretty-routes::vue')
</div>

@include('pretty-routes::scripts')

</body>
</html>
154 changes: 0 additions & 154 deletions resources/views/routes.blade.php → resources/views/scripts.blade.php
Original file line number Diff line number Diff line change
@@ -1,154 +1,3 @@
<!DOCTYPE html>
<html lang="{{ app()->getLocale() }}">
<head>
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no, minimal-ui">

<title>{{ trans('Routes list') }} | {{ config('app.name') }}</title>

<link rel="dns-prefetch" href="https://fonts.googleapis.com">
<link rel="dns-prefetch" href="https://cdn.jsdelivr.net">

<link href="https://fonts.googleapis.com/css?family=Roboto:100,300,400,500,700,900" rel="stylesheet">
<link href="https://cdn.jsdelivr.net/npm/@mdi/[email protected]/css/materialdesignicons.min.css" rel="stylesheet">
<link href="https://cdn.jsdelivr.net/npm/[email protected]/dist/vuetify.min.css" rel="stylesheet">

<style>
.spaced { margin: 2px; }
.deprecated { text-decoration: line-through; }
.link:hover { text-decoration: underline; cursor: pointer; }
</style>
</head>
<body>

<div id="app">
<v-app>
<v-app-bar app>
<v-toolbar-title>
<span
v-text="trans('title')"
:class="{link: filterIsFull()}"
@click="resetFilters"
></span> (<span v-text="countRoutes"></span>)
</v-toolbar-title>

<v-spacer v-if="hasDeprecated"></v-spacer>
<v-select
v-if="hasDeprecated"
v-model="filter.deprecated"
:label="trans('show')"
:items="items.deprecated"
item-value="key"
item-text="value"
hide-details="true"
></v-select>

<v-spacer v-if="hasModules"></v-spacer>
<v-select
v-if="hasModules"
v-model="filter.modules"
:label="trans('module')"
:items="filteredModules"
item-value="key"
item-text="value"
hide-details="true"
></v-select>

<v-spacer></v-spacer>
<v-text-field
v-model="filter.value"
:label="trans('search')"
append-icon="mdi-magnify"
hide-details
clearable
></v-text-field>

<v-spacer></v-spacer>
<v-btn icon @click="openGitHubRepository">
<v-avatar size="36">
<img
:src="repository.icon"
alt="Github Project Page"
>
</v-avatar>
</v-btn>
</v-app-bar>

<v-main>
<v-data-table
:headers="filteredHeaders"
:items="filteredRoutes"
:items-per-page="itemsPerPage"
:search="filter.value"
:loading="loading"
:loading-text="trans('loading')"
:no-data-text="trans('noDataText')"
:no-results-text="trans('noResultsText')"
:footer-props="{
itemsPerPageAllText: trans('itemsPerPageAllText'),
itemsPerPageText: trans('itemsPerPageText'),
pageText: trans('pageText')
}"
ref="routes"
multi-sort
>
<template v-slot:item.methods="{ item }">
<v-chip
v-for="badge in item.methods"
v-text="badge.toUpperCase()"
:color="badges[badge]"
text-color="white"
label
small
class="spaced"
@click="setSearch(badge)"
></v-chip>
</template>

<template v-slot:item.path="{ item }">
<span v-html="highlightParameters(item.path)"></span>
</template>

<template v-slot:item.module="{ item }">
<v-chip
v-if="item.module !== null"
v-text="item.module"
label
small
class="spaced"
@click="setModule(item.module)"
></v-chip>
</template>

<template v-slot:item.action="{ item }">
<v-tooltip top v-if="item.deprecated">
<template v-slot:activator="{ on }">
<span
v-on="on"
v-html="highlightMethod(item.action)"
class="deprecated"
></span>
</template>
<span v-text="trans('deprecated')"></span>
</v-tooltip>

<span v-else v-html="highlightMethod(item.action)"></span>
</template>

<template v-slot:item.middlewares="{ item }">
<span
v-for="(middleware, key) in item.middlewares"
v-text="`${middleware}${key !== item.middlewares.length - 1 ? ', ' : ''}`"
@click="setSearch(middleware)"
class="link"
></span>
</template>
</v-data-table>
</v-main>
</v-app>
</div>

<script src="https://cdn.jsdelivr.net/npm/vue"></script>
<script src="https://cdn.jsdelivr.net/npm/vuetify"></script>
<script src="https://cdn.jsdelivr.net/npm/axios"></script>
Expand Down Expand Up @@ -415,6 +264,3 @@ class="link"
}
});
</script>

</body>
</html>
124 changes: 124 additions & 0 deletions resources/views/vue.blade.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,124 @@
<v-app>
<v-app-bar app>
<v-toolbar-title>
<span
v-text="trans('title')"
:class="{link: filterIsFull()}"
@click="resetFilters"
></span> (<span v-text="countRoutes"></span>)
</v-toolbar-title>

<v-spacer v-if="hasDeprecated"></v-spacer>
<v-select
v-if="hasDeprecated"
v-model="filter.deprecated"
:label="trans('show')"
:items="items.deprecated"
item-value="key"
item-text="value"
hide-details="true"
></v-select>

<v-spacer v-if="hasModules"></v-spacer>
<v-select
v-if="hasModules"
v-model="filter.modules"
:label="trans('module')"
:items="filteredModules"
item-value="key"
item-text="value"
hide-details="true"
></v-select>

<v-spacer></v-spacer>
<v-text-field
v-model="filter.value"
:label="trans('search')"
append-icon="mdi-magnify"
hide-details
clearable
></v-text-field>

<v-spacer></v-spacer>
<v-btn icon @click="openGitHubRepository">
<v-avatar size="36">
<img
:src="repository.icon"
alt="Github Project Page"
>
</v-avatar>
</v-btn>
</v-app-bar>

<v-main>
<v-data-table
:headers="filteredHeaders"
:items="filteredRoutes"
:items-per-page="itemsPerPage"
:search="filter.value"
:loading="loading"
:loading-text="trans('loading')"
:no-data-text="trans('noDataText')"
:no-results-text="trans('noResultsText')"
:footer-props="{
itemsPerPageAllText: trans('itemsPerPageAllText'),
itemsPerPageText: trans('itemsPerPageText'),
pageText: trans('pageText')
}"
ref="routes"
multi-sort
>
<template v-slot:item.methods="{ item }">
<v-chip
v-for="badge in item.methods"
v-text="badge.toUpperCase()"
:color="badges[badge]"
text-color="white"
label
small
class="spaced"
@click="setSearch(badge)"
></v-chip>
</template>

<template v-slot:item.path="{ item }">
<span v-html="highlightParameters(item.path)"></span>
</template>

<template v-slot:item.module="{ item }">
<v-chip
v-if="item.module !== null"
v-text="item.module"
label
small
class="spaced"
@click="setModule(item.module)"
></v-chip>
</template>

<template v-slot:item.action="{ item }">
<v-tooltip top v-if="item.deprecated">
<template v-slot:activator="{ on }">
<span
v-on="on"
v-html="highlightMethod(item.action)"
class="deprecated"
></span>
</template>
<span v-text="trans('deprecated')"></span>
</v-tooltip>

<span v-else v-html="highlightMethod(item.action)"></span>
</template>

<template v-slot:item.middlewares="{ item }">
<span
v-for="(middleware, key) in item.middlewares"
v-text="`${middleware}${key !== item.middlewares.length - 1 ? ', ' : ''}`"
@click="setSearch(middleware)"
class="link"
></span>
</template>
</v-data-table>
</v-main>
</v-app>
2 changes: 1 addition & 1 deletion src/Http/PrettyRoutesController.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ class PrettyRoutesController extends BaseController
*/
public function show()
{
return view('pretty-routes::routes');
return view('pretty-routes::layout');
}

/**
Expand Down

0 comments on commit 068d019

Please sign in to comment.