Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/cydrobolt/polr.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChaoyi Zha <summermontreal@gmail.com>2016-12-03 01:07:59 +0300
committerChaoyi Zha <summermontreal@gmail.com>2016-12-03 01:07:59 +0300
commite7b0b676e1bb5a3091f6c76e0e95d0cae2d8d382 (patch)
treeafb2e604cc18c82c00eb66d2651d245df4ec8d71 /resources
parenta025848eb7c367920cfc982418bb05082af30ac0 (diff)
Refactor into Angular functions and resolve DRY
Diffstat (limited to 'resources')
-rw-r--r--resources/views/admin.blade.php30
-rw-r--r--resources/views/snippets/user_table.blade.php29
2 files changed, 29 insertions, 30 deletions
diff --git a/resources/views/admin.blade.php b/resources/views/admin.blade.php
index cf3eea3..478a782 100644
--- a/resources/views/admin.blade.php
+++ b/resources/views/admin.blade.php
@@ -52,7 +52,35 @@
'table_id' => 'admin_links_table'
])
- <h3>Users</h3>
+ <h3 class="users-heading">Users</h3>
+ <a ng-click="state.showNewUserWell = !state.showNewUserWell" class="btn btn-primary btn-sm status-display">New</a>
+
+ <div ng-if="state.showNewUserWell" class="new-user-fields well">
+ <table class="table">
+ <tr>
+ <th>Username</th>
+ <th>Password</th>
+ <th>Email</th>
+ <th>Role</th>
+ <th></th>
+ </tr>
+ <tr>
+ <td><input type="text" class="form-control" id="new-username"></td>
+ <td><input type="password" class="form-control" id="new-user-password"></td>
+ <td><input type="email" class="form-control" id="new-user-email"></td>
+ <td>
+ <select class="form-control new-user-role" id="new-user-role">
+ @foreach ($user_roles as $role_text => $role_val)
+ <option value="{{$role_val}}">{{$role_text}}</option>
+ @endforeach
+ </select>
+ </td>
+ <td><a ng-click="addNewUser($event)" class="btn btn-primary btn-sm status-display new-user-add">Add</a></td>
+ </tr>
+ </table>
+ <div id="new-user-status"></div>
+ </div>
+
@include('snippets.user_table', [
'table_id' => 'admin_users_table',
'roles' => $user_roles
diff --git a/resources/views/snippets/user_table.blade.php b/resources/views/snippets/user_table.blade.php
index b87f8ea..8a27b6b 100644
--- a/resources/views/snippets/user_table.blade.php
+++ b/resources/views/snippets/user_table.blade.php
@@ -1,32 +1,3 @@
-<div>
- <a ng-click="toggleNewUserBox($event)" class="btn btn-primary btn-sm status-display">New</a>
- <div class="new-user-fields">
- <table class="table">
- <tr>
- <th>Username</th>
- <th>Password</th>
- <th>Email</th>
- <th>Role</th>
- <th></th>
- </tr>
- <tr>
- <td><input class="form-control" id="new-user-name"></td>
- <td><input class="form-control" id="new-user-password"></td>
- <td><input class="form-control" id="new-user-email"></td>
- <td>
- <select class="form-control new-user-role" id="new-user-role">
- @foreach ($roles as $role_text => $role_val)
- <option value="{{$role_val}}">{{$role_text}}</option>
- @endforeach
- </select>
- </td>
- <td><a ng-click="addNewUser($event)" class="btn btn-primary btn-sm status-display new-user-add">Add</a></td>
- </tr>
- </table>
- <div id="new-user-status"></div>
- </div>
-</div>
-
<table id="{{$table_id}}" class="table table-hover">
<thead>
<tr>