Got uploading working
This commit is contained in:
14
app/views/layouts/application.html.erb
Normal file
14
app/views/layouts/application.html.erb
Normal file
@@ -0,0 +1,14 @@
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<title>Dooraccess</title>
|
||||
<%= stylesheet_link_tag "application", :media => "all" %>
|
||||
<%= javascript_include_tag "application" %>
|
||||
<%= csrf_meta_tags %>
|
||||
</head>
|
||||
<body>
|
||||
|
||||
<%= yield %>
|
||||
|
||||
</body>
|
||||
</html>
|
||||
33
app/views/users/_form.html.erb
Normal file
33
app/views/users/_form.html.erb
Normal file
@@ -0,0 +1,33 @@
|
||||
<%= form_for(@user) do |f| %>
|
||||
<% if @user.errors.any? %>
|
||||
<div id="error_explanation">
|
||||
<h2><%= pluralize(@user.errors.count, "error") %> prohibited this user from being saved:</h2>
|
||||
|
||||
<ul>
|
||||
<% @user.errors.full_messages.each do |msg| %>
|
||||
<li><%= msg %></li>
|
||||
<% end %>
|
||||
</ul>
|
||||
</div>
|
||||
<% end %>
|
||||
|
||||
<div class="field">
|
||||
<%= f.label :name %><br />
|
||||
<%= f.text_field :name %>
|
||||
</div>
|
||||
<div class="field">
|
||||
<%= f.label :card_id, "Card DB ID" %><br />
|
||||
<%= f.number_field :card_id, :in => 10...201 %>
|
||||
</div>
|
||||
<div class="field">
|
||||
<%= f.label :card_number, "Card Number" %><br />
|
||||
<%= f.text_field :card_number %>
|
||||
</div>
|
||||
<div class="field">
|
||||
<%= f.label :card_permissions %><br />
|
||||
<%= f.select :card_permissions, [["Enabled",1],["Disabled",255]] %>
|
||||
</div>
|
||||
<div class="actions">
|
||||
<%= f.submit %>
|
||||
</div>
|
||||
<% end %>
|
||||
6
app/views/users/edit.html.erb
Normal file
6
app/views/users/edit.html.erb
Normal file
@@ -0,0 +1,6 @@
|
||||
<h1>Editing user</h1>
|
||||
|
||||
<%= render 'form' %>
|
||||
|
||||
<%= link_to 'Show', @user %> |
|
||||
<%= link_to 'Back', users_path %>
|
||||
29
app/views/users/index.html.erb
Normal file
29
app/views/users/index.html.erb
Normal file
@@ -0,0 +1,29 @@
|
||||
<h1>Listing users</h1>
|
||||
|
||||
<table>
|
||||
<tr>
|
||||
<th>Name</th>
|
||||
<th>Card DB ID</th>
|
||||
<th>Card Number</th>
|
||||
<th>Permissions</th>
|
||||
<th></th>
|
||||
<th></th>
|
||||
<th></th>
|
||||
</tr>
|
||||
|
||||
<% @users.each do |user| %>
|
||||
<tr>
|
||||
<td><%= user.name %></td>
|
||||
<td><%= user.card_id %></td>
|
||||
<td><%= user.card_number %></td>
|
||||
<td><%= user.card_permissions %></td>
|
||||
<td><%= link_to 'Upload', upload_path(user) %></td>
|
||||
<td><%= link_to 'Edit', edit_user_path(user) %></td>
|
||||
<td><%= link_to 'Destroy', user, :confirm => 'Are you sure?', :method => :delete %></td>
|
||||
</tr>
|
||||
<% end %>
|
||||
</table>
|
||||
|
||||
<br />
|
||||
|
||||
<%= link_to 'New User', new_user_path %>
|
||||
5
app/views/users/new.html.erb
Normal file
5
app/views/users/new.html.erb
Normal file
@@ -0,0 +1,5 @@
|
||||
<h1>New user</h1>
|
||||
|
||||
<%= render 'form' %>
|
||||
|
||||
<%= link_to 'Back', users_path %>
|
||||
25
app/views/users/show.html.erb
Normal file
25
app/views/users/show.html.erb
Normal file
@@ -0,0 +1,25 @@
|
||||
<p id="notice"><%= notice %></p>
|
||||
|
||||
<p>
|
||||
<b>Name:</b>
|
||||
<%= @user.name %>
|
||||
</p>
|
||||
|
||||
<p>
|
||||
<b>Card DB ID:</b>
|
||||
<%= @user.card_id %>
|
||||
</p>
|
||||
|
||||
<p>
|
||||
<b>Card Number:</b>
|
||||
<%= @user.card_number %>
|
||||
</p>
|
||||
|
||||
<p>
|
||||
<b>Card Permissions:</b>
|
||||
<%= @user.card_permissions %>
|
||||
</p>
|
||||
|
||||
|
||||
<%= link_to 'Edit', edit_user_path(@user) %> |
|
||||
<%= link_to 'Back', users_path %>
|
||||
15
app/views/users/upload.html.erb
Normal file
15
app/views/users/upload.html.erb
Normal file
@@ -0,0 +1,15 @@
|
||||
<p id="notice"><%= notice %></p>
|
||||
|
||||
<% if @upload_result %>
|
||||
<p>
|
||||
<b>Upload result:</b>
|
||||
<%= @user.name %> uploaded successfully.
|
||||
</p>
|
||||
<% else %>
|
||||
<p>
|
||||
<b>Upload result:</b>
|
||||
Error uploading <%= @user.name %>.
|
||||
</p>
|
||||
<% end %>
|
||||
|
||||
<%= link_to 'Back', users_path %>
|
||||
13
app/views/users/upload_all.html.erb
Normal file
13
app/views/users/upload_all.html.erb
Normal file
@@ -0,0 +1,13 @@
|
||||
<p id="notice"><%= notice %></p>
|
||||
|
||||
<p>
|
||||
<b>Upload results:</b>
|
||||
<ul>
|
||||
<% @upload_result.each do |r| %>
|
||||
<li><%= r[0] %> <%= r[1] %></li>
|
||||
<% end %>
|
||||
</ul>
|
||||
</p>
|
||||
|
||||
|
||||
<%= link_to 'Back', users_path %>
|
||||
Reference in New Issue
Block a user