summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--app/controllers/servers_controller.rb2
-rw-r--r--app/views/servers/_form.html.erb4
-rw-r--r--app/views/servers/index.html.erb2
-rw-r--r--app/views/servers/index.json.jbuilder2
-rw-r--r--app/views/servers/show.html.erb5
-rw-r--r--app/views/servers/show.json.jbuilder2
-rw-r--r--db/migrate/20140406131442_create_simple_captcha_data.rb (renamed from db/migrate/20140405215315_create_simple_captcha_data.rb)0
-rw-r--r--db/migrate/20140406171445_create_servers.rb (renamed from db/migrate/20140406015318_create_servers.rb)1
-rw-r--r--db/migrate/20140406171448_create_matches.rb (renamed from db/migrate/20140406015321_create_matches.rb)0
-rw-r--r--db/migrate/20140406171451_create_teams.rb (renamed from db/migrate/20140406015324_create_teams.rb)0
-rw-r--r--db/migrate/20140406171453_create_alerts.rb (renamed from db/migrate/20140406015327_create_alerts.rb)0
-rw-r--r--db/migrate/20140406171456_create_pms.rb (renamed from db/migrate/20140406015330_create_pms.rb)0
-rw-r--r--db/migrate/20140406171459_create_tournaments.rb (renamed from db/migrate/20140406015332_create_tournaments.rb)0
-rw-r--r--db/migrate/20140406171502_create_games.rb (renamed from db/migrate/20140406015335_create_games.rb)0
-rw-r--r--db/migrate/20140406171505_create_users.rb (renamed from db/migrate/20140406015338_create_users.rb)0
-rw-r--r--db/migrate/20140406171508_create_sessions.rb (renamed from db/migrate/20140406015341_create_sessions.rb)0
-rw-r--r--db/migrate/20140406171510_create_server_settings.rb (renamed from db/migrate/20140406015344_create_server_settings.rb)0
-rw-r--r--db/migrate/20140406171513_create_game_settings.rb (renamed from db/migrate/20140406015347_create_game_settings.rb)0
-rw-r--r--db/migrate/20140406171516_create_tournament_preferences.rb (renamed from db/migrate/20140406015350_create_tournament_preferences.rb)0
-rw-r--r--db/migrate/20140406171519_create_scores.rb (renamed from db/migrate/20140406015353_create_scores.rb)0
-rw-r--r--db/migrate/20140406171522_create_remote_usernames.rb (renamed from db/migrate/20140406015356_create_remote_usernames.rb)0
-rw-r--r--db/migrate/20140406171525_create_tournament_players_join_table.rb (renamed from db/migrate/20140406015359_create_tournament_players_join_table.rb)0
-rw-r--r--db/migrate/20140406171527_create_tournament_hosts_join_table.rb (renamed from db/migrate/20140406015401_create_tournament_hosts_join_table.rb)0
-rw-r--r--db/migrate/20140406171530_create_team_user_join_table.rb (renamed from db/migrate/20140406015404_create_team_user_join_table.rb)0
-rw-r--r--db/migrate/20140406171532_create_match_team_join_table.rb (renamed from db/migrate/20140406015406_create_match_team_join_table.rb)0
-rw-r--r--db/migrate/20140406171543_add_hidden_attrs_to_user.rb (renamed from db/migrate/20140406015417_add_hidden_attrs_to_user.rb)0
-rw-r--r--db/schema.rb3
-rwxr-xr-xgenerate.sh2
-rw-r--r--test/controllers/servers_controller_test.rb4
-rw-r--r--test/fixtures/servers.yml14
30 files changed, 25 insertions, 16 deletions
diff --git a/app/controllers/servers_controller.rb b/app/controllers/servers_controller.rb
index 43999c4..4c12c7e 100644
--- a/app/controllers/servers_controller.rb
+++ b/app/controllers/servers_controller.rb
@@ -69,6 +69,6 @@ class ServersController < ApplicationController
# Never trust parameters from the scary internet, only allow the white list through.
def server_params
- params[:server]
+ params.require(:server).permit(:default_user_permissions)
end
end
diff --git a/app/views/servers/_form.html.erb b/app/views/servers/_form.html.erb
index b08654b..6211f9a 100644
--- a/app/views/servers/_form.html.erb
+++ b/app/views/servers/_form.html.erb
@@ -11,6 +11,10 @@
</div>
<% end %>
+ <div class="field">
+ <%= f.label :default_user_permissions %><br>
+ <%= f.number_field :default_user_permissions %>
+ </div>
<div class="actions">
<%= f.submit %>
</div>
diff --git a/app/views/servers/index.html.erb b/app/views/servers/index.html.erb
index f45d393..b3064f4 100644
--- a/app/views/servers/index.html.erb
+++ b/app/views/servers/index.html.erb
@@ -3,6 +3,7 @@
<table>
<thead>
<tr>
+ <th>Default user permissions</th>
<th></th>
<th></th>
<th></th>
@@ -12,6 +13,7 @@
<tbody>
<% @servers.each do |server| %>
<tr>
+ <td><%= server.default_user_permissions %></td>
<td><%= link_to 'Show', server %></td>
<td><%= link_to 'Edit', edit_server_path(server) %></td>
<td><%= link_to 'Destroy', server, method: :delete, data: { confirm: 'Are you sure?' } %></td>
diff --git a/app/views/servers/index.json.jbuilder b/app/views/servers/index.json.jbuilder
index 2776abc..3c9df60 100644
--- a/app/views/servers/index.json.jbuilder
+++ b/app/views/servers/index.json.jbuilder
@@ -1,4 +1,4 @@
json.array!(@servers) do |server|
- json.extract! server, :id
+ json.extract! server, :id, :default_user_permissions
json.url server_url(server, format: :json)
end
diff --git a/app/views/servers/show.html.erb b/app/views/servers/show.html.erb
index 039cd8f..b18f09f 100644
--- a/app/views/servers/show.html.erb
+++ b/app/views/servers/show.html.erb
@@ -1,4 +1,9 @@
<p id="notice"><%= notice %></p>
+<p>
+ <strong>Default user permissions:</strong>
+ <%= @server.default_user_permissions %>
+</p>
+
<%= link_to 'Edit', edit_server_path(@server) %> |
<%= link_to 'Back', servers_path %>
diff --git a/app/views/servers/show.json.jbuilder b/app/views/servers/show.json.jbuilder
index 972b1c0..c566f76 100644
--- a/app/views/servers/show.json.jbuilder
+++ b/app/views/servers/show.json.jbuilder
@@ -1 +1 @@
-json.extract! @server, :id, :created_at, :updated_at
+json.extract! @server, :id, :default_user_permissions, :created_at, :updated_at
diff --git a/db/migrate/20140405215315_create_simple_captcha_data.rb b/db/migrate/20140406131442_create_simple_captcha_data.rb
index 4573b20..4573b20 100644
--- a/db/migrate/20140405215315_create_simple_captcha_data.rb
+++ b/db/migrate/20140406131442_create_simple_captcha_data.rb
diff --git a/db/migrate/20140406015318_create_servers.rb b/db/migrate/20140406171445_create_servers.rb
index f33241a..fbe1b02 100644
--- a/db/migrate/20140406015318_create_servers.rb
+++ b/db/migrate/20140406171445_create_servers.rb
@@ -1,6 +1,7 @@
class CreateServers < ActiveRecord::Migration
def change
create_table :servers do |t|
+ t.integer :default_user_permissions
t.timestamps
end
diff --git a/db/migrate/20140406015321_create_matches.rb b/db/migrate/20140406171448_create_matches.rb
index 31eea12..31eea12 100644
--- a/db/migrate/20140406015321_create_matches.rb
+++ b/db/migrate/20140406171448_create_matches.rb
diff --git a/db/migrate/20140406015324_create_teams.rb b/db/migrate/20140406171451_create_teams.rb
index fdf9a68..fdf9a68 100644
--- a/db/migrate/20140406015324_create_teams.rb
+++ b/db/migrate/20140406171451_create_teams.rb
diff --git a/db/migrate/20140406015327_create_alerts.rb b/db/migrate/20140406171453_create_alerts.rb
index 68a8e10..68a8e10 100644
--- a/db/migrate/20140406015327_create_alerts.rb
+++ b/db/migrate/20140406171453_create_alerts.rb
diff --git a/db/migrate/20140406015330_create_pms.rb b/db/migrate/20140406171456_create_pms.rb
index 93bb5c6..93bb5c6 100644
--- a/db/migrate/20140406015330_create_pms.rb
+++ b/db/migrate/20140406171456_create_pms.rb
diff --git a/db/migrate/20140406015332_create_tournaments.rb b/db/migrate/20140406171459_create_tournaments.rb
index c0d8929..c0d8929 100644
--- a/db/migrate/20140406015332_create_tournaments.rb
+++ b/db/migrate/20140406171459_create_tournaments.rb
diff --git a/db/migrate/20140406015335_create_games.rb b/db/migrate/20140406171502_create_games.rb
index 5e4f56f..5e4f56f 100644
--- a/db/migrate/20140406015335_create_games.rb
+++ b/db/migrate/20140406171502_create_games.rb
diff --git a/db/migrate/20140406015338_create_users.rb b/db/migrate/20140406171505_create_users.rb
index 8032870..8032870 100644
--- a/db/migrate/20140406015338_create_users.rb
+++ b/db/migrate/20140406171505_create_users.rb
diff --git a/db/migrate/20140406015341_create_sessions.rb b/db/migrate/20140406171508_create_sessions.rb
index f667f1e..f667f1e 100644
--- a/db/migrate/20140406015341_create_sessions.rb
+++ b/db/migrate/20140406171508_create_sessions.rb
diff --git a/db/migrate/20140406015344_create_server_settings.rb b/db/migrate/20140406171510_create_server_settings.rb
index dfdd91b..dfdd91b 100644
--- a/db/migrate/20140406015344_create_server_settings.rb
+++ b/db/migrate/20140406171510_create_server_settings.rb
diff --git a/db/migrate/20140406015347_create_game_settings.rb b/db/migrate/20140406171513_create_game_settings.rb
index b1caf5d..b1caf5d 100644
--- a/db/migrate/20140406015347_create_game_settings.rb
+++ b/db/migrate/20140406171513_create_game_settings.rb
diff --git a/db/migrate/20140406015350_create_tournament_preferences.rb b/db/migrate/20140406171516_create_tournament_preferences.rb
index 991d659..991d659 100644
--- a/db/migrate/20140406015350_create_tournament_preferences.rb
+++ b/db/migrate/20140406171516_create_tournament_preferences.rb
diff --git a/db/migrate/20140406015353_create_scores.rb b/db/migrate/20140406171519_create_scores.rb
index 4ca0b0b..4ca0b0b 100644
--- a/db/migrate/20140406015353_create_scores.rb
+++ b/db/migrate/20140406171519_create_scores.rb
diff --git a/db/migrate/20140406015356_create_remote_usernames.rb b/db/migrate/20140406171522_create_remote_usernames.rb
index e265985..e265985 100644
--- a/db/migrate/20140406015356_create_remote_usernames.rb
+++ b/db/migrate/20140406171522_create_remote_usernames.rb
diff --git a/db/migrate/20140406015359_create_tournament_players_join_table.rb b/db/migrate/20140406171525_create_tournament_players_join_table.rb
index be240e8..be240e8 100644
--- a/db/migrate/20140406015359_create_tournament_players_join_table.rb
+++ b/db/migrate/20140406171525_create_tournament_players_join_table.rb
diff --git a/db/migrate/20140406015401_create_tournament_hosts_join_table.rb b/db/migrate/20140406171527_create_tournament_hosts_join_table.rb
index 7521d89..7521d89 100644
--- a/db/migrate/20140406015401_create_tournament_hosts_join_table.rb
+++ b/db/migrate/20140406171527_create_tournament_hosts_join_table.rb
diff --git a/db/migrate/20140406015404_create_team_user_join_table.rb b/db/migrate/20140406171530_create_team_user_join_table.rb
index f3b57fc..f3b57fc 100644
--- a/db/migrate/20140406015404_create_team_user_join_table.rb
+++ b/db/migrate/20140406171530_create_team_user_join_table.rb
diff --git a/db/migrate/20140406015406_create_match_team_join_table.rb b/db/migrate/20140406171532_create_match_team_join_table.rb
index c2ed1b7..c2ed1b7 100644
--- a/db/migrate/20140406015406_create_match_team_join_table.rb
+++ b/db/migrate/20140406171532_create_match_team_join_table.rb
diff --git a/db/migrate/20140406015417_add_hidden_attrs_to_user.rb b/db/migrate/20140406171543_add_hidden_attrs_to_user.rb
index 9b5c505..9b5c505 100644
--- a/db/migrate/20140406015417_add_hidden_attrs_to_user.rb
+++ b/db/migrate/20140406171543_add_hidden_attrs_to_user.rb
diff --git a/db/schema.rb b/db/schema.rb
index 829ad0e..53bc413 100644
--- a/db/schema.rb
+++ b/db/schema.rb
@@ -11,7 +11,7 @@
#
# It's strongly recommended that you check this file into your version control system.
-ActiveRecord::Schema.define(version: 20140406015417) do
+ActiveRecord::Schema.define(version: 20140406171543) do
create_table "alerts", force: true do |t|
t.integer "author_id"
@@ -115,6 +115,7 @@ ActiveRecord::Schema.define(version: 20140406015417) do
end
create_table "servers", force: true do |t|
+ t.integer "default_user_permissions"
t.datetime "created_at"
t.datetime "updated_at"
end
diff --git a/generate.sh b/generate.sh
index e6385bf..18d0f63 100755
--- a/generate.sh
+++ b/generate.sh
@@ -9,7 +9,7 @@ set -xe
srcdir=$(dirname "$(readlink -f "$0")")
cd "$srcdir"
-git rm -rf app test config/routes.rb db/migrate
+git rm -rf -- app test config/routes.rb db/migrate || true
git checkout clean-start -- app test config/routes.rb
bundle exec rails generate simple_captcha
diff --git a/test/controllers/servers_controller_test.rb b/test/controllers/servers_controller_test.rb
index 5891bb0..3a01d56 100644
--- a/test/controllers/servers_controller_test.rb
+++ b/test/controllers/servers_controller_test.rb
@@ -18,7 +18,7 @@ class ServersControllerTest < ActionController::TestCase
test "should create server" do
assert_difference('Server.count') do
- post :create, server: { }
+ post :create, server: { default_user_permissions: @server.default_user_permissions }
end
assert_redirected_to server_path(assigns(:server))
@@ -35,7 +35,7 @@ class ServersControllerTest < ActionController::TestCase
end
test "should update server" do
- patch :update, id: @server, server: { }
+ patch :update, id: @server, server: { default_user_permissions: @server.default_user_permissions }
assert_redirected_to server_path(assigns(:server))
end
diff --git a/test/fixtures/servers.yml b/test/fixtures/servers.yml
index 937a0c0..3001059 100644
--- a/test/fixtures/servers.yml
+++ b/test/fixtures/servers.yml
@@ -1,11 +1,7 @@
# Read about fixtures at http://api.rubyonrails.org/classes/ActiveRecord/FixtureSet.html
-# This model initially had no columns defined. If you add columns to the
-# model remove the '{}' from the fixture names and add the columns immediately
-# below each fixture, per the syntax in the comments below
-#
-one: {}
-# column: value
-#
-two: {}
-# column: value
+one:
+ default_user_permissions: 1
+
+two:
+ default_user_permissions: 1