diff options
-rw-r--r-- | app/assets/stylesheets/custom.css.scss | 13 | ||||
-rw-r--r-- | app/assets/stylesheets/pms.css.scss | 8 | ||||
-rw-r--r-- | app/assets/stylesheets/scaffolds.css.scss | 2 | ||||
-rw-r--r-- | app/assets/stylesheets/tournaments.css.scss | 10 | ||||
-rw-r--r-- | app/controllers/pms_controller.rb | 6 | ||||
-rw-r--r-- | app/controllers/search_controller.rb | 19 | ||||
-rw-r--r-- | app/controllers/users_controller.rb | 17 | ||||
-rw-r--r-- | app/models/remote_username.rb | 2 | ||||
-rw-r--r-- | app/views/common/_show_tournament.html.erb | 4 | ||||
-rw-r--r-- | app/views/common/_show_user.html.erb | 4 | ||||
-rw-r--r-- | app/views/pms/index.html.erb | 51 | ||||
-rw-r--r-- | app/views/search/go.html.erb | 16 | ||||
-rw-r--r-- | app/views/tournaments/new.html.erb | 2 | ||||
-rw-r--r-- | app/views/users/show.html.erb | 8 |
14 files changed, 146 insertions, 16 deletions
diff --git a/app/assets/stylesheets/custom.css.scss b/app/assets/stylesheets/custom.css.scss index d299dda..4104235 100644 --- a/app/assets/stylesheets/custom.css.scss +++ b/app/assets/stylesheets/custom.css.scss @@ -1,5 +1,11 @@ @import "bootstrap"; +$page-color: #444; +$toolbar-color: black; +$orange: #DD9125; +$darker-orange: #9D4102; +$link-yellow: #FFC50D; + header > nav { @extend .navbar; @extend .navbar-inverse; @@ -41,6 +47,13 @@ input[type="text"], input[type="password"]{ margin: 0 0 5px 0; } +select { + background-color: #333; + padding: 5px; + border: none; + color: #DD9125 !important; +} + p.errors { background-color: rgba(0,0,0,0.5);; color: red; diff --git a/app/assets/stylesheets/pms.css.scss b/app/assets/stylesheets/pms.css.scss index 5106093..a14299e 100644 --- a/app/assets/stylesheets/pms.css.scss +++ b/app/assets/stylesheets/pms.css.scss @@ -1,3 +1,11 @@ // Place all the styles related to the pms controller here. // They will automatically be included in application.css. // You can use Sass (SCSS) here: http://sass-lang.com/ + +p, li { + color: #DD9125; +} +td, th { + padding: 0px; + color: #DD9125; +}
\ No newline at end of file diff --git a/app/assets/stylesheets/scaffolds.css.scss b/app/assets/stylesheets/scaffolds.css.scss index e8fe9c5..eb1f751 100644 --- a/app/assets/stylesheets/scaffolds.css.scss +++ b/app/assets/stylesheets/scaffolds.css.scss @@ -19,7 +19,7 @@ body { height: 100%; } -h1, h2, h3, h4, h5, p, li{ +h1, h2, h3, h4, h5, p, li, label{ color: $orange; } diff --git a/app/assets/stylesheets/tournaments.css.scss b/app/assets/stylesheets/tournaments.css.scss index 41d6023..cc55253 100644 --- a/app/assets/stylesheets/tournaments.css.scss +++ b/app/assets/stylesheets/tournaments.css.scss @@ -75,6 +75,16 @@ div.tournament-listing { padding: 5px 0 0 0; } } + + .t-game{ + font-weight: bold; + text-align: center; + } + + .t-image{ + display: block; + margin:auto; + } } div.leave-buttons { diff --git a/app/controllers/pms_controller.rb b/app/controllers/pms_controller.rb index 1279fdf..2cb55f8 100644 --- a/app/controllers/pms_controller.rb +++ b/app/controllers/pms_controller.rb @@ -24,10 +24,12 @@ class PmsController < ApplicationController def create @pm = Pm.new(pm_params) @pm.author = current_user - require 'pp' - pp pm_params['recipient_id'] + #require 'pp' + #pp pm_params['recipient_id'] @pm.recipient = User.find_by_user_name(pm_params['recipient_id']) + @pm.author.send_message(@pm.recipient, @pm.message, 'Default') + respond_to do |format| if @pm.save format.html { redirect_to @pm, notice: 'Pm was successfully created.' } diff --git a/app/controllers/search_controller.rb b/app/controllers/search_controller.rb index 51aee9e..d312623 100644 --- a/app/controllers/search_controller.rb +++ b/app/controllers/search_controller.rb @@ -1,13 +1,28 @@ class SearchController < ApplicationController def go + stringMade = false; + @games = Game.all @query = params[:query] + @gametype = params[:game_type] - if (@query.nil?) then + if ( @gametype.nil? and (@query.nil? or @query.empty?)) then return end - @tournaments = Tournament.where("name LIKE '%#{@query}%'") + qstring = "" + if (!@query.empty?) + qstring += "name LIKE '%#{@query}%'" + stringMade = true + end + if (!@gametype.nil? and !@gametype.empty?) + if (stringMade) + qstring += " AND " + end + qstring += "game_id=#{@gametype}" + end + + @tournaments = Tournament.where(qstring) @players = User.where("name LIKE '%#{@query}%'") end diff --git a/app/controllers/users_controller.rb b/app/controllers/users_controller.rb index c3261b8..cfa5d67 100644 --- a/app/controllers/users_controller.rb +++ b/app/controllers/users_controller.rb @@ -1,5 +1,8 @@ class UsersController < ApplicationController + require 'httparty' + require 'json' + # GET /users # GET /users.json @@ -74,6 +77,20 @@ class UsersController < ApplicationController end end + def set_remote + game = Game.find_by_name("League of Legends") + + remote_username = HTTParty.get("https://prod.api.pvp.net/api/lol/na/v1.3/summoner/by-name/#{@name.downcase}?api_key=ad539f86-22fd-474d-9279-79a7a296ac38") + + remote = @user.find_remote_username(game) + if remote.nil? + @user.remote_username.create(game: game, value: remote_username) + else + remote.value = remote_username + remote.save + end + end + private # Use callbacks to share common setup or constraints between actions. def set_user diff --git a/app/models/remote_username.rb b/app/models/remote_username.rb index e5d0a8c..c2c3d20 100644 --- a/app/models/remote_username.rb +++ b/app/models/remote_username.rb @@ -9,4 +9,4 @@ class RemoteUsername < ActiveRecord::Base def value=(v) self.json_value = v.to_json end -end +end diff --git a/app/views/common/_show_tournament.html.erb b/app/views/common/_show_tournament.html.erb index 89d8f53..0f60fad 100644 --- a/app/views/common/_show_tournament.html.erb +++ b/app/views/common/_show_tournament.html.erb @@ -1,5 +1,7 @@ <div class="row tournament-listing"> - <div class="col-md-2 col-sm-3 col-xs-6"><%= image_tag ('http://www.gravatar.com/avatar/' + Digest::MD5.hexdigest(target.hosts.first.email) + '?s=100&d=mm') %></div> + <div class="col-md-2 col-sm-3 col-xs-6"><%= image_tag('http://www.gravatar.com/avatar/' + Digest::MD5.hexdigest(target.hosts.first.email) + '?s=100&d=mm', class: "t-image") %> + <p class="t-game"> <%= Game.find(target.game_id).name %></p> + </div> <div class="col-md-8 col-sm-7 col-xs-6"> <%# "header" %> <%= link_to(target) do %><h3><%= target.name %></h3><% end %> diff --git a/app/views/common/_show_user.html.erb b/app/views/common/_show_user.html.erb index 70f1ca4..dd136a0 100644 --- a/app/views/common/_show_user.html.erb +++ b/app/views/common/_show_user.html.erb @@ -1,8 +1,8 @@ <div class="row user-listing"> - <div class="col-md-3 col-sm-3 col-xs-6"><%= image_tag ('http://www.gravatar.com/avatar/' + Digest::MD5.hexdigest(target.email) + '?s=100&d=mm') %></div> + <div class="col-md-3 col-sm-4 col-xs-4"><%= image_tag ('http://www.gravatar.com/avatar/' + Digest::MD5.hexdigest(target.email) + '?s=100&d=mm') %></div> - <div class="col-md-9 col-sm-9 col-xs-6"> + <div class="col-md-9 col-sm-8 col-xs-8"> <%# "header" %> <%= link_to(target) do %><h3><%= target.user_name %></h3><% end %> diff --git a/app/views/pms/index.html.erb b/app/views/pms/index.html.erb index ceb1a40..73c7a87 100644 --- a/app/views/pms/index.html.erb +++ b/app/views/pms/index.html.erb @@ -25,8 +25,8 @@ <td><%= pm.recipient.user_name %></td> <td><%= pm.message %></td> <td><%= link_to 'Show', pm %></td> - <td><%= link_to 'Edit', edit_pm_path(pm) %></td> - <td><%= link_to 'Destroy', pm, method: :delete, data: { confirm: 'Are you sure?' } %></td> + <td><%# link_to 'Edit', edit_pm_path(pm) %></td> + <td><%= link_to 'Delete', pm, method: :delete, data: { confirm: 'Are you sure (also deletes the author\'s copy)?' } %></td> </tr> <% end %> <% else %> @@ -44,13 +44,56 @@ <td><%= pm.recipient.user_name %></td> <td><%= pm.message %></td> <td><%= link_to 'Show', pm %></td> - <td><%= link_to 'Edit', edit_pm_path(pm) %></td> - <td><%= link_to 'Destroy', pm, method: :delete, data: { confirm: 'Are you sure?' } %></td> + <td><%# link_to 'Edit', edit_pm_path(pm) %></td> + <td><%= link_to 'Delete', pm, method: :delete, data: { confirm: 'Are you sure (also deletes the recipient\'s copy)?'} %></td> </tr> <% end %> <% else %> <td><h3>No New Messages</h3></td> <% end %> + + <tr> + <td><h2>Conversations<h2></td> + </tr> + <tr> + <td><h3>Inbox<h3></td> + </tr> + <tr> + <% conversation1 = current_user.mailbox.inbox.first %> + <% if !conversation1.nil? %> + <% receipts1 = conversation1.receipts_for current_user %> + <% receipts1.each do |receipt1| %> + <% message1 = receipt1.message %> + <td><%= message1.subject %></td> + <td><%= message1.body %></td> + <% end %> + <% else %> + <td><p> No Messages </p></td> + <% end %> + </tr> + + <tr> + <td><h3>Outbox<h3></td> + </tr> + <tr> + <% conversation1 = current_user.mailbox.sentbox.first %> + <% if !conversation1.nil? %> + <tr> + <td><b>From</b></td> + <td><b>Subject</b></td> + <td><b>Body</b></td> + </tr> + <% receipts1 = conversation1.receipts_for current_user %> + <% receipts1.each do |receipt1| %> + <% message1 = receipt1.message %> + <td><%= message1.subject %></td> + <td><%= message1.body %></td> + <% end %> + <% else %> + <td><p> No Messages </p></td> + <% end %> + </tr> + </tbody> </table> diff --git a/app/views/search/go.html.erb b/app/views/search/go.html.erb index d2bf8f3..ea2dabf 100644 --- a/app/views/search/go.html.erb +++ b/app/views/search/go.html.erb @@ -4,12 +4,24 @@ </div> <div class="expanded"> <h5><a href="#collapse">Advanced Search [hide]</a></h5> - <p>This is where the advancedsearch will go.</p> + <%= form_tag("/search", method: "get") do %> + <div class="form-group"> + <%= label_tag :query, 'Find:' %> + <%= text_field_tag(:query, params[:query]) %> + </div> + <div class="form-group"> + <%= label_tag :game_type, 'Game Type:' %> + <%= select_tag(:game_type, options_from_collection_for_select(@games, 'id', 'name'), :prompt => 'All Games') %> + </div> + <div> + <%= submit_tag("Search", :name=>nil) %> + </div> + <% end %> </div> </div> <%# Show search results if a query was not nill %> -<% if !@query.empty? %> +<% if !@query.nil? and !@query.empty? %> <% if @tournaments.empty? and @players.empty? %> <h3> No results found for "<%= @query %>" </h3> diff --git a/app/views/tournaments/new.html.erb b/app/views/tournaments/new.html.erb index 66149fe..2837708 100644 --- a/app/views/tournaments/new.html.erb +++ b/app/views/tournaments/new.html.erb @@ -4,7 +4,7 @@ <%= select_tag('tournament[game_id]', options_from_collection_for_select(@games, 'id', 'name', @tournament.game.nil? || @tournament.game.id), :prompt => "Select a Game Type") %> - <%= submit_tag("Select", :class => "btn btn-success btn-xs") %> + <%= submit_tag("Select", :class => "btn") %> <% end %> <div id='ajax-form'> diff --git a/app/views/users/show.html.erb b/app/views/users/show.html.erb index b85cbda..81eee6f 100644 --- a/app/views/users/show.html.erb +++ b/app/views/users/show.html.erb @@ -20,6 +20,14 @@ too single </p> +<p> + <%= label :username %><br> + <%= text_field %> + + <br><input type="submit" value="Submit"><br> + +</p> + <div class="row"> <div class="col-md-6"> <h3> Recent Tournaments Played </h3> |