diff options
Diffstat (limited to 'app/views')
-rw-r--r-- | app/views/layouts/application.html.erb | 3 | ||||
-rw-r--r-- | app/views/matches/index.html.erb | 32 | ||||
-rw-r--r-- | app/views/servers/_form.html.erb | 19 | ||||
-rw-r--r-- | app/views/servers/edit.html.erb | 3 | ||||
-rw-r--r-- | app/views/servers/index.html.erb | 25 | ||||
-rw-r--r-- | app/views/servers/index.json.jbuilder | 4 | ||||
-rw-r--r-- | app/views/servers/new.html.erb | 5 | ||||
-rw-r--r-- | app/views/servers/show.html.erb | 8 | ||||
-rw-r--r-- | app/views/servers/show.json.jbuilder | 2 | ||||
-rw-r--r-- | app/views/users/_form.html.erb | 34 |
10 files changed, 69 insertions, 66 deletions
diff --git a/app/views/layouts/application.html.erb b/app/views/layouts/application.html.erb index 8a5f985..de9f3b8 100644 --- a/app/views/layouts/application.html.erb +++ b/app/views/layouts/application.html.erb @@ -26,6 +26,9 @@ <% if signed_in? %> <%= link_to current_user.user_name, current_user, :class => "user" %> <%= link_to "Sign out", session_path("current"), method: "delete", :class => "signout" %> + <% if current_user.can? :edit_server %> + <%= link_to "Server settings", edit_server_path, :class => "server" %> + <% end %> <% else %> <%= link_to "Log in", new_session_path, :class => "signin" %> <%= link_to "Sign up", new_user_path, :class => "signup" %> diff --git a/app/views/matches/index.html.erb b/app/views/matches/index.html.erb index 219507d..031b2a9 100644 --- a/app/views/matches/index.html.erb +++ b/app/views/matches/index.html.erb @@ -26,17 +26,39 @@ <br> - +<div id="match-tree"> <SVG version="1.1" baseProfile="full" - width="<%= 300 * @matches.count / 2 + 50 %>" height="<%= 200 * @matches.count + 50 %>" + width="<%= @width %>" height="<%= @height = [@height, 500].max %>" xmlns="http://www.w3.org/2000/svg"> - + <line x1="300" y1="0" x2="300" y2="<%= @height %>" stroke="black" /> <% (1..@matches.count).each do |i| %> <g class="svg-match"> - <rect rx="10" - + <rect height="120px" width="213px" + x="<%= @width - (i-1)*50 - 250*(Math.log2(i).floor+1) %>" + y="<%= (@height/(Math.log2(i).floor+2)) - 60 + 250*(i - 2**(Math.log2(i).floor)) %>" + fill="#ffd281" + rx="20px" + stroke-width="2" + <% case @matches[i-1].status %> + <% when 0 %> + <% if @matches[i-1].teams.count < @tournament.min_teams_per_match %> + stroke="red" + fill-opacity="0.6" + <% else %> + stroke="green" + <% end %> + <% when 1 %> + stroke="orange" + <% when 2 %> + stroke="yellow" + <% when 3 %> + stroke="grey" + <% end %> + /> </g> <% end %> + </SVG> +</div>
\ No newline at end of file diff --git a/app/views/servers/_form.html.erb b/app/views/servers/_form.html.erb index b08654b..1afde11 100644 --- a/app/views/servers/_form.html.erb +++ b/app/views/servers/_form.html.erb @@ -1,15 +1,16 @@ <%= form_for(@server) do |f| %> - <% if @server.errors.any? %> - <div id="error_explanation"> - <h2><%= pluralize(@server.errors.count, "error") %> prohibited this server from being saved:</h2> + <%= render "common/error_messages", :target => @server %> - <ul> - <% @server.errors.full_messages.each do |msg| %> - <li><%= msg %></li> + <fieldset> + <legend>Default permissions for new users</legend> + <ul> + <%= fields_for "server[default_user_abilities]", @server.default_user_abilities do |a| %> + <% @server.default_user_abilities.keys.each do |ability| %> + <li><label><%= a.check_box(ability) %> <%= ability.to_s.humanize %></label></li> <% end %> - </ul> - </div> - <% end %> + <% end %> + </ul> + </fieldset> <div class="actions"> <%= f.submit %> diff --git a/app/views/servers/edit.html.erb b/app/views/servers/edit.html.erb index a92cdb5..d37864f 100644 --- a/app/views/servers/edit.html.erb +++ b/app/views/servers/edit.html.erb @@ -2,5 +2,4 @@ <%= render 'form' %> -<%= link_to 'Show', @server %> | -<%= link_to 'Back', servers_path %> +<%= link_to server_path %> diff --git a/app/views/servers/index.html.erb b/app/views/servers/index.html.erb deleted file mode 100644 index f45d393..0000000 --- a/app/views/servers/index.html.erb +++ /dev/null @@ -1,25 +0,0 @@ -<h1>Listing servers</h1> - -<table> - <thead> - <tr> - <th></th> - <th></th> - <th></th> - </tr> - </thead> - - <tbody> - <% @servers.each do |server| %> - <tr> - <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> - </tr> - <% end %> - </tbody> -</table> - -<br> - -<%= link_to 'New Server', new_server_path %> diff --git a/app/views/servers/index.json.jbuilder b/app/views/servers/index.json.jbuilder deleted file mode 100644 index 2776abc..0000000 --- a/app/views/servers/index.json.jbuilder +++ /dev/null @@ -1,4 +0,0 @@ -json.array!(@servers) do |server| - json.extract! server, :id - json.url server_url(server, format: :json) -end diff --git a/app/views/servers/new.html.erb b/app/views/servers/new.html.erb deleted file mode 100644 index 0422009..0000000 --- a/app/views/servers/new.html.erb +++ /dev/null @@ -1,5 +0,0 @@ -<h1>New server</h1> - -<%= render 'form' %> - -<%= link_to 'Back', servers_path %> diff --git a/app/views/servers/show.html.erb b/app/views/servers/show.html.erb index 67f7647..54aaf66 100644 --- a/app/views/servers/show.html.erb +++ b/app/views/servers/show.html.erb @@ -1,2 +1,6 @@ -<%= link_to 'Edit', edit_server_path(@server) %> | -<%= link_to 'Back', servers_path %> +<p> + <strong>Default user permissions:</strong> + <%= @server.default_user_permissions %> +</p> + +<%= link_to 'Edit', edit_server_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/app/views/users/_form.html.erb b/app/views/users/_form.html.erb index ae63f06..40f8f09 100644 --- a/app/views/users/_form.html.erb +++ b/app/views/users/_form.html.erb @@ -1,37 +1,45 @@ <%= 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 %> + <%= render "common/error_messages", :target => @user %> <div class="field"> <%= f.label :name %><br> <%= f.text_field :name %> </div> + <div class="field"> <%= f.label :email %><br> <%= f.text_field :email %> </div> + <div class="field"> <%= f.label :user_name %><br> <%= f.text_field :user_name %> </div> - <p> + + <div> <%= f.label(:password, "New Password (or use old)") %><br> <%= f.password_field :password %> - </p> + </div> <div> <%= f.label(:password_confirmation, "Confirm Password") %><br> <%= f.password_field :password_confirmation %> </div> + + <% if current_user.can? :edit_permissions %> + <fieldset> + <legend>User permissions</legend> + <ul> + <%= fields_for "user[abilities]", @user.abilities do |abilities_fields| %> + <% @user.abilities.keys.each do |ability| %> + <li><label><%= abilities_fields.check_box(ability) %> <%= ability.to_s.humanize %></label></li> + <% end %> + <% end %> + </ul> + </fieldset> + <% end %> + <div class="actions"> <%= f.submit %> </div> + <% end %> |