summaryrefslogtreecommitdiff
path: root/app
diff options
context:
space:
mode:
authorDavisLWebb <davislwebb@ymail.com>2014-03-01 20:23:29 -0500
committerDavisLWebb <davislwebb@ymail.com>2014-03-01 20:23:29 -0500
commit2eb242f3e5b1f1ab66d84556cabcad965fe387aa (patch)
treed80e7422f39ef2b49801dbefd586e8e48500e43b /app
parent318d7649200fd51c7b1582c3f93534de9f2a3cf5 (diff)
changed the user section of the generate
Diffstat (limited to 'app')
-rw-r--r--app/controllers/users_controller.rb72
-rw-r--r--app/models/tournament_option.rb2
-rw-r--r--app/models/tournament_options.rb2
-rw-r--r--app/views/users/_form.html.erb29
-rw-r--r--app/views/users/edit.html.erb6
-rw-r--r--app/views/users/index.html.erb31
-rw-r--r--app/views/users/index.json.jbuilder4
-rw-r--r--app/views/users/new.html.erb5
-rw-r--r--app/views/users/show.html.erb19
-rw-r--r--app/views/users/show.json.jbuilder1
10 files changed, 2 insertions, 169 deletions
diff --git a/app/controllers/users_controller.rb b/app/controllers/users_controller.rb
index 4db617e..3e74dea 100644
--- a/app/controllers/users_controller.rb
+++ b/app/controllers/users_controller.rb
@@ -1,74 +1,2 @@
class UsersController < ApplicationController
- before_action :set_user, only: [:show, :edit, :update, :destroy]
-
- # GET /users
- # GET /users.json
- def index
- @users = User.all
- end
-
- # GET /users/1
- # GET /users/1.json
- def show
- end
-
- # GET /users/new
- def new
- @user = User.new
- end
-
- # GET /users/1/edit
- def edit
- end
-
- # POST /users
- # POST /users.json
- def create
- @user = User.new(user_params)
-
- respond_to do |format|
- if @user.save
- format.html { redirect_to @user, notice: 'User was successfully created.' }
- format.json { render action: 'show', status: :created, location: @user }
- else
- format.html { render action: 'new' }
- format.json { render json: @user.errors, status: :unprocessable_entity }
- end
- end
- end
-
- # PATCH/PUT /users/1
- # PATCH/PUT /users/1.json
- def update
- respond_to do |format|
- if @user.update(user_params)
- format.html { redirect_to @user, notice: 'User was successfully updated.' }
- format.json { head :no_content }
- else
- format.html { render action: 'edit' }
- format.json { render json: @user.errors, status: :unprocessable_entity }
- end
- end
- end
-
- # DELETE /users/1
- # DELETE /users/1.json
- def destroy
- @user.destroy
- respond_to do |format|
- format.html { redirect_to users_url }
- format.json { head :no_content }
- end
- end
-
- private
- # Use callbacks to share common setup or constraints between actions.
- def set_user
- @user = User.find(params[:id])
- end
-
- # Never trust parameters from the scary internet, only allow the white list through.
- def user_params
- params.require(:user).permit(:name, :pw_hash, :groups)
- end
end
diff --git a/app/models/tournament_option.rb b/app/models/tournament_option.rb
new file mode 100644
index 0000000..950b351
--- /dev/null
+++ b/app/models/tournament_option.rb
@@ -0,0 +1,2 @@
+class TournamentOption < ActiveRecord::Base
+end
diff --git a/app/models/tournament_options.rb b/app/models/tournament_options.rb
deleted file mode 100644
index 8ed6433..0000000
--- a/app/models/tournament_options.rb
+++ /dev/null
@@ -1,2 +0,0 @@
-class TournamentOptions < ActiveRecord::Base
-end
diff --git a/app/views/users/_form.html.erb b/app/views/users/_form.html.erb
deleted file mode 100644
index 2d1ad24..0000000
--- a/app/views/users/_form.html.erb
+++ /dev/null
@@ -1,29 +0,0 @@
-<%= 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_area :name %>
- </div>
- <div class="field">
- <%= f.label :pw_hash %><br>
- <%= f.text_area :pw_hash %>
- </div>
- <div class="field">
- <%= f.label :groups %><br>
- <%= f.number_field :groups %>
- </div>
- <div class="actions">
- <%= f.submit %>
- </div>
-<% end %>
diff --git a/app/views/users/edit.html.erb b/app/views/users/edit.html.erb
deleted file mode 100644
index 99bd4cc..0000000
--- a/app/views/users/edit.html.erb
+++ /dev/null
@@ -1,6 +0,0 @@
-<h1>Editing user</h1>
-
-<%= render 'form' %>
-
-<%= link_to 'Show', @user %> |
-<%= link_to 'Back', users_path %>
diff --git a/app/views/users/index.html.erb b/app/views/users/index.html.erb
deleted file mode 100644
index 14739ae..0000000
--- a/app/views/users/index.html.erb
+++ /dev/null
@@ -1,31 +0,0 @@
-<h1>Listing users</h1>
-
-<table>
- <thead>
- <tr>
- <th>Name</th>
- <th>Pw hash</th>
- <th>Groups</th>
- <th></th>
- <th></th>
- <th></th>
- </tr>
- </thead>
-
- <tbody>
- <% @users.each do |user| %>
- <tr>
- <td><%= user.name %></td>
- <td><%= user.pw_hash %></td>
- <td><%= user.groups %></td>
- <td><%= link_to 'Show', user %></td>
- <td><%= link_to 'Edit', edit_user_path(user) %></td>
- <td><%= link_to 'Destroy', user, method: :delete, data: { confirm: 'Are you sure?' } %></td>
- </tr>
- <% end %>
- </tbody>
-</table>
-
-<br>
-
-<%= link_to 'New User', new_user_path %>
diff --git a/app/views/users/index.json.jbuilder b/app/views/users/index.json.jbuilder
deleted file mode 100644
index 58c42c1..0000000
--- a/app/views/users/index.json.jbuilder
+++ /dev/null
@@ -1,4 +0,0 @@
-json.array!(@users) do |user|
- json.extract! user, :id, :name, :pw_hash, :groups
- json.url user_url(user, format: :json)
-end
diff --git a/app/views/users/new.html.erb b/app/views/users/new.html.erb
deleted file mode 100644
index efc0404..0000000
--- a/app/views/users/new.html.erb
+++ /dev/null
@@ -1,5 +0,0 @@
-<h1>New user</h1>
-
-<%= render 'form' %>
-
-<%= link_to 'Back', users_path %>
diff --git a/app/views/users/show.html.erb b/app/views/users/show.html.erb
deleted file mode 100644
index 05150f5..0000000
--- a/app/views/users/show.html.erb
+++ /dev/null
@@ -1,19 +0,0 @@
-<p id="notice"><%= notice %></p>
-
-<p>
- <strong>Name:</strong>
- <%= @user.name %>
-</p>
-
-<p>
- <strong>Pw hash:</strong>
- <%= @user.pw_hash %>
-</p>
-
-<p>
- <strong>Groups:</strong>
- <%= @user.groups %>
-</p>
-
-<%= link_to 'Edit', edit_user_path(@user) %> |
-<%= link_to 'Back', users_path %>
diff --git a/app/views/users/show.json.jbuilder b/app/views/users/show.json.jbuilder
deleted file mode 100644
index 968b383..0000000
--- a/app/views/users/show.json.jbuilder
+++ /dev/null
@@ -1 +0,0 @@
-json.extract! @user, :id, :name, :pw_hash, :groups, :created_at, :updated_at