From f9a4ee4e998f5f113565a93802c041108e9a180d Mon Sep 17 00:00:00 2001 From: AndrewMurrell Date: Wed, 2 Apr 2014 14:53:10 -0400 Subject: now ran generate without ger --- app/assets/javascripts/remote_usernames.js.coffee | 3 + app/assets/stylesheets/remote_usernames.css.scss | 3 + app/controllers/remote_usernames_controller.rb | 74 +++++++++++++++++++++++ app/controllers/tournaments_controller.rb | 2 +- app/helpers/remote_usernames_helper.rb | 2 + app/views/remote_usernames/_form.html.erb | 29 +++++++++ app/views/remote_usernames/edit.html.erb | 6 ++ app/views/remote_usernames/index.html.erb | 31 ++++++++++ app/views/remote_usernames/index.json.jbuilder | 4 ++ app/views/remote_usernames/new.html.erb | 5 ++ app/views/remote_usernames/show.html.erb | 19 ++++++ app/views/remote_usernames/show.json.jbuilder | 1 + app/views/tournaments/_form.html.erb | 20 ++++++ app/views/tournaments/index.html.erb | 10 +++ app/views/tournaments/index.json.jbuilder | 2 +- app/views/tournaments/show.html.erb | 25 ++++++++ app/views/tournaments/show.json.jbuilder | 2 +- 17 files changed, 235 insertions(+), 3 deletions(-) create mode 100644 app/assets/javascripts/remote_usernames.js.coffee create mode 100644 app/assets/stylesheets/remote_usernames.css.scss create mode 100644 app/controllers/remote_usernames_controller.rb create mode 100644 app/helpers/remote_usernames_helper.rb create mode 100644 app/views/remote_usernames/_form.html.erb create mode 100644 app/views/remote_usernames/edit.html.erb create mode 100644 app/views/remote_usernames/index.html.erb create mode 100644 app/views/remote_usernames/index.json.jbuilder create mode 100644 app/views/remote_usernames/new.html.erb create mode 100644 app/views/remote_usernames/show.html.erb create mode 100644 app/views/remote_usernames/show.json.jbuilder (limited to 'app') diff --git a/app/assets/javascripts/remote_usernames.js.coffee b/app/assets/javascripts/remote_usernames.js.coffee new file mode 100644 index 0000000..24f83d1 --- /dev/null +++ b/app/assets/javascripts/remote_usernames.js.coffee @@ -0,0 +1,3 @@ +# Place all the behaviors and hooks related to the matching controller here. +# All this logic will automatically be available in application.js. +# You can use CoffeeScript in this file: http://coffeescript.org/ diff --git a/app/assets/stylesheets/remote_usernames.css.scss b/app/assets/stylesheets/remote_usernames.css.scss new file mode 100644 index 0000000..b9e841e --- /dev/null +++ b/app/assets/stylesheets/remote_usernames.css.scss @@ -0,0 +1,3 @@ +// Place all the styles related to the remote_usernames controller here. +// They will automatically be included in application.css. +// You can use Sass (SCSS) here: http://sass-lang.com/ diff --git a/app/controllers/remote_usernames_controller.rb b/app/controllers/remote_usernames_controller.rb new file mode 100644 index 0000000..fecf01f --- /dev/null +++ b/app/controllers/remote_usernames_controller.rb @@ -0,0 +1,74 @@ +class RemoteUsernamesController < ApplicationController + before_action :set_remote_username, only: [:show, :edit, :update, :destroy] + + # GET /remote_usernames + # GET /remote_usernames.json + def index + @remote_usernames = RemoteUsername.all + end + + # GET /remote_usernames/1 + # GET /remote_usernames/1.json + def show + end + + # GET /remote_usernames/new + def new + @remote_username = RemoteUsername.new + end + + # GET /remote_usernames/1/edit + def edit + end + + # POST /remote_usernames + # POST /remote_usernames.json + def create + @remote_username = RemoteUsername.new(remote_username_params) + + respond_to do |format| + if @remote_username.save + format.html { redirect_to @remote_username, notice: 'Remote username was successfully created.' } + format.json { render action: 'show', status: :created, location: @remote_username } + else + format.html { render action: 'new' } + format.json { render json: @remote_username.errors, status: :unprocessable_entity } + end + end + end + + # PATCH/PUT /remote_usernames/1 + # PATCH/PUT /remote_usernames/1.json + def update + respond_to do |format| + if @remote_username.update(remote_username_params) + format.html { redirect_to @remote_username, notice: 'Remote username was successfully updated.' } + format.json { head :no_content } + else + format.html { render action: 'edit' } + format.json { render json: @remote_username.errors, status: :unprocessable_entity } + end + end + end + + # DELETE /remote_usernames/1 + # DELETE /remote_usernames/1.json + def destroy + @remote_username.destroy + respond_to do |format| + format.html { redirect_to remote_usernames_url } + format.json { head :no_content } + end + end + + private + # Use callbacks to share common setup or constraints between actions. + def set_remote_username + @remote_username = RemoteUsername.find(params[:id]) + end + + # Never trust parameters from the scary internet, only allow the white list through. + def remote_username_params + params.require(:remote_username).permit(:game_id, :user_id, :user_name) + end +end diff --git a/app/controllers/tournaments_controller.rb b/app/controllers/tournaments_controller.rb index c4c41ab..d7db632 100644 --- a/app/controllers/tournaments_controller.rb +++ b/app/controllers/tournaments_controller.rb @@ -69,6 +69,6 @@ class TournamentsController < ApplicationController # Never trust parameters from the scary internet, only allow the white list through. def tournament_params - params.require(:tournament).permit(:name, :game_id, :status, :randomized_teams) + params.require(:tournament).permit(:name, :game_id, :status, :min_players_per_team, :max_players_per_team, :min_teams_per_match, :max_teams_per_match, :set_rounds, :randomized_teams) end end diff --git a/app/helpers/remote_usernames_helper.rb b/app/helpers/remote_usernames_helper.rb new file mode 100644 index 0000000..3240c4f --- /dev/null +++ b/app/helpers/remote_usernames_helper.rb @@ -0,0 +1,2 @@ +module RemoteUsernamesHelper +end diff --git a/app/views/remote_usernames/_form.html.erb b/app/views/remote_usernames/_form.html.erb new file mode 100644 index 0000000..5da1f8f --- /dev/null +++ b/app/views/remote_usernames/_form.html.erb @@ -0,0 +1,29 @@ +<%= form_for(@remote_username) do |f| %> + <% if @remote_username.errors.any? %> +
+

<%= pluralize(@remote_username.errors.count, "error") %> prohibited this remote_username from being saved:

+ + +
+ <% end %> + +
+ <%= f.label :game_id %>
+ <%= f.text_field :game_id %> +
+
+ <%= f.label :user_id %>
+ <%= f.text_field :user_id %> +
+
+ <%= f.label :user_name %>
+ <%= f.text_field :user_name %> +
+
+ <%= f.submit %> +
+<% end %> diff --git a/app/views/remote_usernames/edit.html.erb b/app/views/remote_usernames/edit.html.erb new file mode 100644 index 0000000..52d4b37 --- /dev/null +++ b/app/views/remote_usernames/edit.html.erb @@ -0,0 +1,6 @@ +

Editing remote_username

+ +<%= render 'form' %> + +<%= link_to 'Show', @remote_username %> | +<%= link_to 'Back', remote_usernames_path %> diff --git a/app/views/remote_usernames/index.html.erb b/app/views/remote_usernames/index.html.erb new file mode 100644 index 0000000..14f5876 --- /dev/null +++ b/app/views/remote_usernames/index.html.erb @@ -0,0 +1,31 @@ +

Listing remote_usernames

+ + + + + + + + + + + + + + + <% @remote_usernames.each do |remote_username| %> + + + + + + + + + <% end %> + +
GameUserUser name
<%= remote_username.game %><%= remote_username.user %><%= remote_username.user_name %><%= link_to 'Show', remote_username %><%= link_to 'Edit', edit_remote_username_path(remote_username) %><%= link_to 'Destroy', remote_username, method: :delete, data: { confirm: 'Are you sure?' } %>
+ +
+ +<%= link_to 'New Remote username', new_remote_username_path %> diff --git a/app/views/remote_usernames/index.json.jbuilder b/app/views/remote_usernames/index.json.jbuilder new file mode 100644 index 0000000..c9fbc0f --- /dev/null +++ b/app/views/remote_usernames/index.json.jbuilder @@ -0,0 +1,4 @@ +json.array!(@remote_usernames) do |remote_username| + json.extract! remote_username, :id, :game_id, :user_id, :user_name + json.url remote_username_url(remote_username, format: :json) +end diff --git a/app/views/remote_usernames/new.html.erb b/app/views/remote_usernames/new.html.erb new file mode 100644 index 0000000..b9cfcf4 --- /dev/null +++ b/app/views/remote_usernames/new.html.erb @@ -0,0 +1,5 @@ +

New remote_username

+ +<%= render 'form' %> + +<%= link_to 'Back', remote_usernames_path %> diff --git a/app/views/remote_usernames/show.html.erb b/app/views/remote_usernames/show.html.erb new file mode 100644 index 0000000..416ca9d --- /dev/null +++ b/app/views/remote_usernames/show.html.erb @@ -0,0 +1,19 @@ +

<%= notice %>

+ +

+ Game: + <%= @remote_username.game %> +

+ +

+ User: + <%= @remote_username.user %> +

+ +

+ User name: + <%= @remote_username.user_name %> +

+ +<%= link_to 'Edit', edit_remote_username_path(@remote_username) %> | +<%= link_to 'Back', remote_usernames_path %> diff --git a/app/views/remote_usernames/show.json.jbuilder b/app/views/remote_usernames/show.json.jbuilder new file mode 100644 index 0000000..1a0f6f9 --- /dev/null +++ b/app/views/remote_usernames/show.json.jbuilder @@ -0,0 +1 @@ +json.extract! @remote_username, :id, :game_id, :user_id, :user_name, :created_at, :updated_at diff --git a/app/views/tournaments/_form.html.erb b/app/views/tournaments/_form.html.erb index 3dadbf7..38855a0 100644 --- a/app/views/tournaments/_form.html.erb +++ b/app/views/tournaments/_form.html.erb @@ -23,6 +23,26 @@ <%= f.label :status %>
<%= f.number_field :status %> +
+ <%= f.label :min_players_per_team %>
+ <%= f.number_field :min_players_per_team %> +
+
+ <%= f.label :max_players_per_team %>
+ <%= f.number_field :max_players_per_team %> +
+
+ <%= f.label :min_teams_per_match %>
+ <%= f.number_field :min_teams_per_match %> +
+
+ <%= f.label :max_teams_per_match %>
+ <%= f.number_field :max_teams_per_match %> +
+
+ <%= f.label :set_rounds %>
+ <%= f.number_field :set_rounds %> +
<%= f.label :randomized_teams %>
<%= f.check_box :randomized_teams %> diff --git a/app/views/tournaments/index.html.erb b/app/views/tournaments/index.html.erb index 4c1d0ff..f8f21e7 100644 --- a/app/views/tournaments/index.html.erb +++ b/app/views/tournaments/index.html.erb @@ -6,6 +6,11 @@ Name Game Status + Min players per team + Max players per team + Min teams per match + Max teams per match + Set rounds Randomized teams @@ -19,6 +24,11 @@ <%= tournament.name %> <%= tournament.game %> <%= tournament.status %> + <%= tournament.min_players_per_team %> + <%= tournament.max_players_per_team %> + <%= tournament.min_teams_per_match %> + <%= tournament.max_teams_per_match %> + <%= tournament.set_rounds %> <%= tournament.randomized_teams %> <%= link_to 'Show', tournament %> <%= link_to 'Edit', edit_tournament_path(tournament) %> diff --git a/app/views/tournaments/index.json.jbuilder b/app/views/tournaments/index.json.jbuilder index 32587df..4038f04 100644 --- a/app/views/tournaments/index.json.jbuilder +++ b/app/views/tournaments/index.json.jbuilder @@ -1,4 +1,4 @@ json.array!(@tournaments) do |tournament| - json.extract! tournament, :id, :name, :game_id, :status, :randomized_teams + json.extract! tournament, :id, :name, :game_id, :status, :min_players_per_team, :max_players_per_team, :min_teams_per_match, :max_teams_per_match, :set_rounds, :randomized_teams json.url tournament_url(tournament, format: :json) end diff --git a/app/views/tournaments/show.html.erb b/app/views/tournaments/show.html.erb index d58452b..3cb6179 100644 --- a/app/views/tournaments/show.html.erb +++ b/app/views/tournaments/show.html.erb @@ -15,6 +15,31 @@ <%= @tournament.status %>

+

+ Min players per team: + <%= @tournament.min_players_per_team %> +

+ +

+ Max players per team: + <%= @tournament.max_players_per_team %> +

+ +

+ Min teams per match: + <%= @tournament.min_teams_per_match %> +

+ +

+ Max teams per match: + <%= @tournament.max_teams_per_match %> +

+ +

+ Set rounds: + <%= @tournament.set_rounds %> +

+

Randomized teams: <%= @tournament.randomized_teams %> diff --git a/app/views/tournaments/show.json.jbuilder b/app/views/tournaments/show.json.jbuilder index d543c76..27fd5c0 100644 --- a/app/views/tournaments/show.json.jbuilder +++ b/app/views/tournaments/show.json.jbuilder @@ -1 +1 @@ -json.extract! @tournament, :id, :name, :game_id, :status, :randomized_teams, :created_at, :updated_at +json.extract! @tournament, :id, :name, :game_id, :status, :min_players_per_team, :max_players_per_team, :min_teams_per_match, :max_teams_per_match, :set_rounds, :randomized_teams, :created_at, :updated_at -- cgit v1.2.3