diff options
Diffstat (limited to 'app/views/users')
-rw-r--r-- | app/views/users/_form.html.erb | 40 | ||||
-rw-r--r-- | app/views/users/already_signed_in.html.erb | 1 | ||||
-rw-r--r-- | app/views/users/edit.html.erb | 2 | ||||
-rw-r--r-- | app/views/users/index.html.erb | 6 | ||||
-rw-r--r-- | app/views/users/new.html.erb | 35 | ||||
-rw-r--r-- | app/views/users/show.html.erb | 48 |
6 files changed, 109 insertions, 23 deletions
diff --git a/app/views/users/_form.html.erb b/app/views/users/_form.html.erb index 4d28738..1feebf8 100644 --- a/app/views/users/_form.html.erb +++ b/app/views/users/_form.html.erb @@ -1,29 +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 %> + <%= f.text_field(:email, type: "email") %> </div> + <div class="field"> <%= f.label :user_name %><br> <%= f.text_field :user_name %> </div> + + <div> + <%= f.label(:password, "New Password (or use old)") %><br> + <%= f.password_field :password %> + </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 %> diff --git a/app/views/users/already_signed_in.html.erb b/app/views/users/already_signed_in.html.erb new file mode 100644 index 0000000..04b4248 --- /dev/null +++ b/app/views/users/already_signed_in.html.erb @@ -0,0 +1 @@ +<h1>You are currently signed in</h1> diff --git a/app/views/users/edit.html.erb b/app/views/users/edit.html.erb index 99bd4cc..52f32a2 100644 --- a/app/views/users/edit.html.erb +++ b/app/views/users/edit.html.erb @@ -3,4 +3,4 @@ <%= render 'form' %> <%= link_to 'Show', @user %> | -<%= link_to 'Back', users_path %> +<%= link_to 'Users', users_path %> diff --git a/app/views/users/index.html.erb b/app/views/users/index.html.erb index 3692112..e4251cd 100644 --- a/app/views/users/index.html.erb +++ b/app/views/users/index.html.erb @@ -1,8 +1,9 @@ <h1>Listing users</h1> -<table> +<table class="table table-hover"> <thead> <tr> + <th>Username</th> <th>Name</th> <th>Email</th> <th>User name</th> @@ -15,8 +16,9 @@ <tbody> <% @users.each do |user| %> <tr> + <td><%= image_tag('http://www.gravatar.com/avatar/' + Digest::MD5.hexdigest(user.email) + '?s=30&d=identicon') %> <%= link_to("#{user.user_name}", user, nil) %></td> <td><%= user.name %></td> - <td><%= user.email %></td> + <td> ******* </td> <td><%= user.user_name %></td> <td><%= link_to 'Show', user %></td> <td><%= link_to 'Edit', edit_user_path(user) %></td> diff --git a/app/views/users/new.html.erb b/app/views/users/new.html.erb index efc0404..5c88945 100644 --- a/app/views/users/new.html.erb +++ b/app/views/users/new.html.erb @@ -1,5 +1,34 @@ -<h1>New user</h1> +<h1> Sign Up </h1> -<%= render 'form' %> +<%= form_for @user do |f| %> + <%= render "common/error_messages", :target => @user %> + <p> + <%= f.label :name %><br> + <%= f.text_field :name %> + </p> + <p> + <%= f.label :email %><br> + <%= f.text_field(:email, type: "email") %> + </p> + <p> + <%= f.label :user_name %><br> + <%= f.text_field :user_name %> + </p> + <p> + <%= f.label :password %><br> + <%= f.password_field :password %> + </p> + <p> + <%= f.label(:password_confirmation, "Confirm Password") %><br> + <%= f.password_field :password_confirmation %> + </p> + <p> + <%= show_simple_captcha %> + + <%= f.submit("Be a Leaguer", :class => "signup") %> + </p> +<% end %> + + +<%= link_to 'Already Have an Account? Log in', new_session_path, :class => "signin" %> -<%= link_to 'Back', users_path %> diff --git a/app/views/users/show.html.erb b/app/views/users/show.html.erb index 9455a3c..b247b7d 100644 --- a/app/views/users/show.html.erb +++ b/app/views/users/show.html.erb @@ -1,8 +1,8 @@ -<p id="notice"><%= notice %></p> + +<h1> <%= @user.user_name %>'s Profile </h1> <p> - <strong>Name:</strong> - <%= @user.name %> + <%= image_tag 'http://www.gravatar.com/avatar/' + Digest::MD5.hexdigest(@user.email) + '?s=100&d=identicon' %> </p> <p> @@ -11,9 +11,47 @@ </p> <p> - <strong>User name:</strong> + <strong>Preferred name:</strong> <%= @user.user_name %> </p> +<p> + <strong>Relationship Status:</strong> + too single +</p> + + +<p> +<% if @user.remote_usernames[0].nil? %> + <%= form_for @user do |f| %> + <label>Have a League of Legends Account? + <input type=text name="user[remote_usernames][League of Legends]"> + </label> + <%= f.submit "Add Username", :class => 'signup' %> + <% end %> +<% end %> +</p> + + +<div class="row"> + <div class="col-md-6"> + <h3> Recent Tournaments Played </h3> + <ul> + <% @user.tournaments_played.each do |t| %> + <li><%= t.name %></li> + <% end %> + </ul> + </div> + <div class="col-md-6"> + <h3> Recent Tournaments Hosted </h3> + <% if @user.tournaments_hosted.count == 0 %> <p> <%= @user.user_name %> has never hosted a tournament </p> <%end %> + <ul> + <% @user.tournaments_hosted.each do |t| %> + <li><%= t.name %></li> + <% end %> + </ul> + </div> +</div> + <%= link_to 'Edit', edit_user_path(@user) %> | -<%= link_to 'Back', users_path %> +<%= link_to 'All Users', users_path %> |