Commit b27d9fd4 authored by 神楽坂玲奈's avatar 神楽坂玲奈

战网部分样式HTML规范化

parent 6a349380
$(document).ready(function(){ $(document).ready(function(){
$('.main1').show(500); $('#main').show(500);
}) })
function test(){ \ No newline at end of file
}
\ No newline at end of file
body {
background: url(http://sh.convnet.net:7955/images/duel%20ranking.jpg) no-repeat top center #000000;
margin: 0px;
font-size:14px;
color: white
}
\ No newline at end of file
...@@ -3,7 +3,14 @@ class CardsController < ApplicationController ...@@ -3,7 +3,14 @@ class CardsController < ApplicationController
# GET /cards # GET /cards
# GET /cards.json # GET /cards.json
def index def index
@cards = Card.joins(:duel_user_cards) if params[:user_id]
@user = User.find params[:user_id]
@cards = @user.cards
@actions = ["YGO战网", @user, "常用卡片"]
else
@cards = Card.joins(:duel_user_cards)
@actions = ["YGO战网", "卡片排行"]
end
respond_to do |format| respond_to do |format|
format.html # index.html.erb format.html # index.html.erb
......
#encoding: UTF-8 #encoding: UTF-8
class DuelsController < ApplicationController class DuelsController < ApplicationController
layout 'ygo' layout 'ygo'
# GET /duels # GET /duels
# GET /duels.json # GET /duels.json
def index def index
if params[:user_id] if params[:user_id]
@user = User.find params[:user_id] @user = User.find params[:user_id]
@duels = @user.duels @duels = @user.duels
else @actions = ["YGO战网", @user, '对战列表']
@duels = Duel else
end @duels = Duel.where(true)
@duels = @duels.reverse_order.page(params[:page]) @actions = ["YGO战网", '对战列表']
@actions = [@user, '对战明细'] end
respond_to do |format| @duels = @duels.reverse_order.page(params[:page])
format.html # index.html.erb respond_to do |format|
format.json { render json: @duels } format.html # index.html.erb
end format.json { render json: @duels }
end end
end
# GET /duels/1
# GET /duels/1.json # GET /duels/1
def show # GET /duels/1.json
@duel = Duel.find(params[:id]) def show
@duel = Duel.find(params[:id])
respond_to do |format| @actions = ["YGO战网", '对战列表', @duel]
format.html # show.html.erb respond_to do |format|
format.json { render json: @duel } format.html # show.html.erb
end format.json { render json: @duel }
end end
end
# GET /duels/new
# GET /duels/new.json # GET /duels/new
def new # GET /duels/new.json
@duel = Duel.new def new
@duel = Duel.new
respond_to do |format|
format.html # new.html.erb respond_to do |format|
format.json { render json: @duel } format.html # new.html.erb
end format.json { render json: @duel }
end end
end
# GET /duels/1/edit
def edit # GET /duels/1/edit
@duel = Duel.find(params[:id]) def edit
end @duel = Duel.find(params[:id])
end
# POST /duels
# POST /duels.json # POST /duels
def create # POST /duels.json
@duel = Duel.new(params[:duel]) def create
@duel = Duel.new(params[:duel])
respond_to do |format|
if @duel.save respond_to do |format|
format.html { redirect_to @duel, notice: 'Duel was successfully created.' } if @duel.save
format.json { render json: @duel, status: :created, location: @duel } format.html { redirect_to @duel, notice: 'Duel was successfully created.' }
else format.json { render json: @duel, status: :created, location: @duel }
format.html { render action: "new" } else
format.json { render json: @duel.errors, status: :unprocessable_entity } format.html { render action: "new" }
end format.json { render json: @duel.errors, status: :unprocessable_entity }
end end
end end
end
# PUT /duels/1
# PUT /duels/1.json # PUT /duels/1
def update # PUT /duels/1.json
@duel = Duel.find(params[:id]) def update
case @current_user @duel = Duel.find(params[:id])
when @duel.user1 case @current_user
params[:duel] = {:user1_public => params[:duel][:user1_public]} when @duel.user1
when @duel.user2 params[:duel] = {:user1_public => params[:duel][:user1_public]}
params[:duel] = {:user2_public => params[:duel][:user2_public]} when @duel.user2
else params[:duel] = {:user2_public => params[:duel][:user2_public]}
params[:duel] = {} else
end params[:duel] = {}
respond_to do |format| end
if @duel.update_attributes(params[:duel]) respond_to do |format|
format.html { redirect_to @duel, notice: 'Duel was successfully updated.' } if @duel.update_attributes(params[:duel])
format.json { head :no_content } format.html { redirect_to @duel, notice: 'Duel was successfully updated.' }
else format.json { head :no_content }
format.html { render action: "edit" } else
format.json { render json: @duel.errors, status: :unprocessable_entity } format.html { render action: "edit" }
end format.json { render json: @duel.errors, status: :unprocessable_entity }
end end
end end
end
# DELETE /duels/1
# DELETE /duels/1.json # DELETE /duels/1
def destroy # DELETE /duels/1.json
@duel = Duel.find(params[:id]) def destroy
@duel.destroy @duel = Duel.find(params[:id])
@duel.destroy
respond_to do |format|
format.html { redirect_to duels_url } respond_to do |format|
format.json { head :no_content } format.html { redirect_to duels_url }
end format.json { head :no_content }
end end
def user_deck(user_pos) end
@duel = Duel.find(params[:duel_id]) def user_deck(user_pos)
unless (user_pos and @duel.user1_public or @duel.user1 == @current_user) or (!user_pos and @duel.user2_public or @duel.user2 == @current_user) @duel = Duel.find(params[:duel_id])
return respond_to do |format| unless (user_pos and @duel.user1_public or @duel.user1 == @current_user) or (!user_pos and @duel.user2_public or @duel.user2 == @current_user)
format.ydk { redirect_to :format => :html} return respond_to do |format|
format.html{ render :text => "卡组未公开"} format.ydk { redirect_to :format => :html}
end format.html{ render :text => "卡组未公开"}
end end
if user_pos end
main = @duel.user1_main if user_pos
extra = @duel.user1_extra main = @duel.user1_main
else extra = @duel.user1_extra
main = @duel.user2_main else
extra = @duel.user2_extra main = @duel.user2_main
end extra = @duel.user2_extra
end
respond_to do |format|
format.html{ render :text => (["#created by ...", "#main"] + main.collect{|card|card.number} + ["#extra"] + extra.collect{|card|card.number} + ["!side"]).join("\r\n")} respond_to do |format|
format.ydk { render :text => (["#created by ...", "#main"] + main.collect{|card|card.number} + ["#extra"] + extra.collect{|card|card.number} + ["!side"]).join("\r\n")} format.html{ render :text => (["#created by ...", "#main"] + main.collect{|card|card.number} + ["#extra"] + extra.collect{|card|card.number} + ["!side"]).join("\r\n")}
end format.ydk { render :text => (["#created by ...", "#main"] + main.collect{|card|card.number} + ["#extra"] + extra.collect{|card|card.number} + ["!side"]).join("\r\n")}
end end
def user1_deck end
user_deck(true) def user1_deck
end user_deck(true)
def user2_deck end
user_deck(false) def user2_deck
end user_deck(false)
end end
end
...@@ -13,4 +13,13 @@ class MycardController < ApplicationController ...@@ -13,4 +13,13 @@ class MycardController < ApplicationController
format.json { render json: result } format.json { render json: result }
end end
end end
def download
file = Dir.glob('public/mycard/mycard-*-win32.7z').last
if file
file = File.basename(file)
respond_to do |format|
format.html {redirect_to "/mycard/#{file}" }
end
end
end
end end
\ No newline at end of file
...@@ -9,7 +9,7 @@ class UsersController < ApplicationController ...@@ -9,7 +9,7 @@ class UsersController < ApplicationController
# GET /users.xml # GET /users.xml
def index def index
@users = User.all @users = User.all
@actions = ["YGO战网", "用户排行"]
respond_to do |format| respond_to do |format|
format.html # index.html.erb format.html # index.html.erb
format.xml { render :xml => @users } format.xml { render :xml => @users }
...@@ -20,17 +20,17 @@ class UsersController < ApplicationController ...@@ -20,17 +20,17 @@ class UsersController < ApplicationController
# GET /users/1.xml # GET /users/1.xml
def show def show
@user = User.find(params[:id]) @user = User.find(params[:id])
@actions = [@user.name] @actions = ["YGO战网", @user]
respond_to do |format| respond_to do |format|
format.html # show.html.erb format.html # show.html.erb
format.xml { render :xml => @user } #format.xml { render :xml => @user }
end end
end end
# GET /users/new # GET /users/new
# GET /users/new.xml # GET /users/new.xml
def new def new
@actions = [:register] @actions = ["注册"]
@user = User.new @user = User.new
respond_to do |format| respond_to do |format|
...@@ -106,11 +106,11 @@ class UsersController < ApplicationController ...@@ -106,11 +106,11 @@ class UsersController < ApplicationController
end end
end end
def login def login
@actions = [:login] @actions = ["登陆"]
@user = User.new @user = User.new
end end
def login_do def login_do
@actions = [:login] @actions = ["登陆"]
user = User.find_by_name(params[:user][:name]) user = User.find_by_name(params[:user][:name])
if user and params[:user][:password] == user.password if user and params[:user][:password] == user.password
@user = user @user = user
...@@ -135,7 +135,7 @@ class UsersController < ApplicationController ...@@ -135,7 +135,7 @@ class UsersController < ApplicationController
if @user if @user
session[:user_id] = @user.id session[:user_id] = @user.id
@user.update_attribute(:lastloginip, request.remote_ip) @user.update_attribute(:lastloginip, request.remote_ip)
format.html { redirect_to(:root, :notice => 'Login Successfully.') } format.html { redirect_to(@user, :notice => 'Login Successfully.') }
format.xml { head :ok } format.xml { head :ok }
else else
@user = User.new(params[:user]) @user = User.new(params[:user])
......
...@@ -24,4 +24,7 @@ class Duel < ActiveRecord::Base ...@@ -24,4 +24,7 @@ class Duel < ActiveRecord::Base
def user2_extra def user2_extra
user_cards(user2, false) user_cards(user2, false)
end end
def to_s
"决斗详情"
end
end end
<h1>热门卡排行</h1>
<p> <p>
<b>常用怪兽:</b> <b>常用怪兽:</b>
<%= render @cards.main_monsters.top(10) %> <%= render @cards.main_monsters.top(10) %>
......
...@@ -7,53 +7,56 @@ ...@@ -7,53 +7,56 @@
padding-top:10px; padding-top:10px;
padding-buttom:10px; padding-buttom:10px;
width:600px; width:600px;
text-align: center;
} }
#duels{width: 600px;text-align: center}
#duels thead {line-height:25px; background-color:#1c1b1b; height:25px; color:#d6edff; font-weight:bold; }
#duels tbody {line-height:25px; padding-top:3px; font-weight:bold;}
#duels .index {color:white}
#duels .win {color:#58db3e}
#duels .lose {color:red}
#duels .current {color:red}
</style> </style>
<div align="center" style="padding-top:150px; cursor:pointer;"> <table id="duels">
<div align="right" style="width:600px; font-size:30px; padding-bottom:20px; color:#ffcc66"><%= @user.name %> </div> <thead>
<div style="width:750px; font-size:14px; padding-bottom:10px; line-height:40px; color:#ffcc66" align="left" ><a href="#" style=" color:#ffcc66">YGO战网</a> >> <%= link_to @user.name, @user, :style=>"color:#ffcc66" %> >> <a href="" style=" color:#ffcc66">对战列表</a></div> <tr>
<div style="width:600px; display:none; " id="mian1" class="main1" > <% if @user %>
<div style="line-height:25px; background-color:#1c1b1b; height:25px; color:#d6edff; font-weight:bold; "> <th>场次</th>
<div style='width:50px; float:left;'><em>场次</em></div> <th>对手</th>
<div style='width:200px; float:left;'><em>对手</em></div> <th>胜负</th>
<div style='width:100px; float:left;' align='center'><em>胜负</em></div> <th>得分</th>
<div style='width:100px; float:left;' align='center'><em>得分</em></div> <% else %>
<!--<div style='width:100px; float:left;' align='center'><em>战斗终分</em></div>--> <th>场次</th>
</div> <th>玩家1</th>
<!--这里的效率很低,待优化--> <th>玩家2</th>
<% first_index = @user.duels.where("id<=?",@duels.to_enum.first.id).count %> <th>玩家1得分</th>
<%# final_credits = Duels.where("id<=?",@duels.to_enum.first.id).sum %> <th>玩家2得分</th>
<% end %>
</tr>
</thead>
<tfoot>
<tr><td colspan="7"><%= will_paginate @duels %></td></tr>
</tfoot>
<tbody>
<% first_index = @user.duels.where("id<=?",@duels.to_enum.first.id).count if @user %><!--这里的效率很低,待优化-->
<% @duels.each_with_index do |duel, index| %> <% @duels.each_with_index do |duel, index| %>
<div style='clear:both;'></div> <tr>
<div style='line-height:25px; padding-top:3px; font-weight:bold; ' align='center'> <% if @user %>
<td class="index"><%= link_to (first_index - index), duel %></td>
<!--场次--> <td class="user opponent"><% opponent = duel.user1 == @user ? duel.user2 : duel.user1 %><%= link_to opponent.name, opponent %></td>
<div style='width:50px; float:left; color:white ' > <td class="result <%= duel.winner == @user ? "win" : "lose" %>"><%= duel.winner == @user ? "WIN" : "LOSE" %></td>
<%= link_to (first_index - index), duel, :style=>"color:white" %> <td class="credits <%= duel.winner == @user ? "win" : "lose" %>"><%= duel.user1 == @user ? duel.user1_credits : duel.user2_credits %></td>
</div> <% else %>
<!--对手--> <td class="index"><%= link_to duel.id, duel %></td>
<div style='width:200px; float:left; ' align='left'> <td class="user user1"><%= link_to duel.user1.name, duel.user1 %></td>
<% opponent = duel.user1 == @user ? duel.user2 : duel.user1 %> <td class="user user2"><%= link_to duel.user2.name, duel.user2 %></td>
<%= link_to opponent.name, opponent, :style => 'color:#ffe793; text-decoration:none' %> <td class="credits user1 <%= duel.winner == duel.user1 ? "win" : "lose" %>"><%= duel.user1_credits %></td>
</div> <td class="credits user2 <%= duel.winner == duel.user2 ? "win" : "lose" %>"><%= duel.user2_credits %></td>
<!--胜负--> <% end %>
<div style='width:100px; float:left; color:<% if duel.winner == @user %>#58db3e<% else %>red<% end %>'> </tr>
<%= duel.winner == @user ? "WIN" : "LOSE" %>
</div>
<!--得分-->
<div style='width:100px; float:left; color:<% if duel.winner == @user %>#58db3e<% else %>red<% end %>'>
<%= duel.user1 == @user ? duel.user1_credits : duel.user2_credits %>
</div>
<!--战斗终分-->
<!--<div style='width:100px; float:left; color:<% if index.zero? %>red<% else %>#d6edff<% end %>; '>
<%#= final_credits %>
<%# final_credits -= duel.user1 == @user ? duel.user1_credits : duel.user2_credits %>
</div>-->
</div>
<% end %> <% end %>
</div> </tbody>
</div> </table>
<div style="clear:both"/>
<div align="center">
<%= will_paginate @duels %>
</div>
<div id="replay">录像下载</div>
<style type="text/css"> <style type="text/css">
<!-- <!--
...@@ -36,84 +37,76 @@ ...@@ -36,84 +37,76 @@
} }
} }
</script> </script>
<div style="padding-top:150px; " align="center"> <div style="color: white; width:750px;" align="left">
<div style="width:600px; font-size:30px; padding-bottom:10px; color:#ffcc66;font-weight: bold;" align="right">DUEL INFO </div> <div class="user_act" id="user1" onClick="show(1)">
<%= @duel.user1.name %>
<div style="width:750px; font-size:14px; padding-bottom:10px; line-height:40px; color:#ffcc66" align="left" ><a href="#" style=" color:#ffcc66">YGO战网</a> >> <a href="#" style=" color:#ffcc66">对战列表</a> >> <%=l @duel.created_at %> <span class="STYLE2"><a href="#" style=" color:#33CCFF">录像下载</a></span></div> <% if @duel.winner == @duel.user1 %>
<span class="STYLE3">WINNER</span>
<div style="color: white; width:750px;" align="left"> <% else %>
<div class="user_act" id="user1" onClick="show(1)"> <span class="STYLE4">LOSER</span>
<%= @duel.user1.name %> <% end %>
<% if @duel.winner == @duel.user1 %> <span class="STYLE2"><% if @duel.user1_public or @current_user == @duel.user1 %><%= link_to image_tag('deck_download.png', :border=>false, :style => 'float:right;padding:12px 12px 0 0'), "/duels/#{@duel.id}/user1_deck.ydk" %><% end %> </span>
<span class="STYLE3">WINNER</span> <% if @current_user == @duel.user1 %>
<% else %> <%= form_for(@duel, :html => {:style => "display:inline"}) do |f| %>
<span class="STYLE4">LOSER</span> <span style="font-size:12px;color:white;float:right;padding-right:24px">公开卡组<%= f.check_box :user1_public, :onclick=>"submit()" %></span>
<% end %> <% end %>
<span class="STYLE2"><% if @duel.user1_public or @current_user == @duel.user1 %><%= link_to image_tag('deck_download.png', :border=>false, :style => 'float:right;padding:12px 12px 0 0'), "/duels/#{@duel.id}/user1_deck.ydk" %><% end %> </span> <% end %>
<% if @current_user == @duel.user1 %> </div>
<%= form_for(@duel, :html => {:style => "display:inline"}) do |f| %> <div class="user" id="user2" onClick="show(2)" >
<span style="font-size:12px;color:white;float:right;padding-right:24px">公开卡组<%= f.check_box :user1_public, :onclick=>"submit()" %></span> <%= @duel.user2.name %>
<% end %> <% if @duel.winner == @duel.user2 %>
<% end %> <span class="STYLE3">WINNER</span>
</div> <% else %>
<div class="user" id="user2" onClick="show(2)" > <span class="STYLE4">LOSER</span>
<%= @duel.user2.name %> <% end %>
<% if @duel.winner == @duel.user2 %> <% if @duel.user2_public or @current_user == @duel.user2 %><%= link_to image_tag('deck_download.png', :border=>false, :style => 'float:right;padding:12px 12px 0 0'), "/duels/#{@duel.id}/user2_deck.ydk" %><% end %>
<span class="STYLE3">WINNER</span> <% if @current_user == @duel.user2 %>
<% else %> <%= form_for(@duel, :html => {:style => "display:inline"}) do |f| %>
<span class="STYLE4">LOSER</span> <%= f.check_box :user2_public, :onclick=>"submit()" %> <span style="font-size:12px;color:white">公开卡组</span>
<% end %>
<% end %>
</div>
<div style="clear:both"/>
<div id="cards1">
<% if @duel.user1_public or @current_user == @duel.user1 %>
<p><b>主卡组:</b> </p>
<% @duel.user1_main.each do |card| %>
<div class="card">
<%= link_to image_tag(card.image, :title => card.name), card %>
</div>
<% end %> <% end %>
<% if @duel.user2_public or @current_user == @duel.user2 %><%= link_to image_tag('deck_download.png', :border=>false, :style => 'float:right;padding:12px 12px 0 0'), "/duels/#{@duel.id}/user2_deck.ydk" %><% end %>
<% if @current_user == @duel.user2 %>
<%= form_for(@duel, :html => {:style => "display:inline"}) do |f| %>
<%= f.check_box :user2_public, :onclick=>"submit()" %> <span style="font-size:12px;color:white">公开卡组</span>
<% end %>
<% end %>
</div>
<div style="clear:both"/>
<div id="cards1">
<% if @duel.user1_public or @current_user == @duel.user1 %>
<p><b>主卡组:</b> </p>
<% @duel.user1_main.each do |card| %>
<div class="card">
<%= link_to image_tag(card.image, :title => card.name), card %>
</div>
<% end %>
<div style="clear:both"/> <div style="clear:both"/>
<p><b>额外:</b> </p> <p><b>额外:</b> </p>
<% @duel.user1_extra.each do |card| %> <% @duel.user1_extra.each do |card| %>
<div class="card"> <div class="card">
<%= link_to image_tag(card.image, :title => card.name), card %> <%= link_to image_tag(card.image, :title => card.name), card %>
</div> </div>
<% end %>
<% else %>
卡组未公开
<% end %> <% end %>
</div> <% else %>
卡组未公开
<% end %>
</div> </div>
<div style="clear:both"/> </div>
<div style="color: white; width:700px; " align="left"> <div style="clear:both"/>
<div id="cards2"> <div style="color: white; width:700px; " align="left">
<% if @duel.user2_public or @current_user == @duel.user2 %> <div id="cards2">
<p><b>主卡组:</b> </p> <% if @duel.user2_public or @current_user == @duel.user2 %>
<% @duel.user2_main.each do |card| %> <p><b>主卡组:</b> </p>
<div class="card"> <% @duel.user2_main.each do |card| %>
<%= link_to image_tag(card.image, :title => card.name, :width => 54, :height => 81), card %> <div class="card">
</div> <%= link_to image_tag(card.image, :title => card.name, :width => 54, :height => 81), card %>
<% end %> </div>
<div style="clear:both"/>
<p><b>额外:</b> </p>
<% @duel.user2_extra.each do |card| %>
<div class="card">
<%= link_to image_tag(card.image, :title => card.name, :width => 54, :height => 81), card %>
</div>
<% end %>
<% else %>
卡组未公开
<% end %> <% end %>
</div> <div style="clear:both"/>
<p><b>额外:</b> </p>
<% @duel.user2_extra.each do |card| %>
<div class="card">
<%= link_to image_tag(card.image, :title => card.name, :width => 54, :height => 81), card %>
</div>
<% end %>
<% else %>
卡组未公开
<% end %>
</div> </div>
<div align="center"></div>
</div> </div>
\ No newline at end of file
<div id="action">
<%= @site %> <%= @site %>
<% @actions.each do |action| %> <% @actions.each do |action| %>
&raquo; <%= action %> &raquo; <span class="action"><%= action %></span>
<% end %> <% end %>
</div> \ No newline at end of file
\ No newline at end of file
<!DOCTYPE html> <!DOCTYPE html>
<html> <html>
<head> <head>
<!--[if lte IE 9]><script src="http://html5shiv.googlecode.com/svn/trunk/html5.js"></script><![endif]-->
<title> <%= @site.name %><% if @actions && !@actions.empty? %> - <%= @actions.last.respond_to?(:name) ? @actions.last.name : @actions.last %> <% end %> </title> <title> <%= @site.name %><% if @actions && !@actions.empty? %> - <%= @actions.last.respond_to?(:name) ? @actions.last.name : @actions.last %> <% end %> </title>
<%#= stylesheet_link_tag 'application' %> <%#= stylesheet_link_tag 'application' %>
<%= stylesheet_link_tag 'ygo' %> <%= stylesheet_link_tag 'ygo' %>
...@@ -9,12 +10,36 @@ ...@@ -9,12 +10,36 @@
<%= javascript_include_tag 'ygo' %> <%= javascript_include_tag 'ygo' %>
<%= javascript_include_tag params[:controller] %> <%= javascript_include_tag params[:controller] %>
<%= csrf_meta_tags %> <%= csrf_meta_tags %>
<style>
body {
background: url(http://sh.convnet.net:7955/images/duel%20ranking.jpg) no-repeat top center #000000;
margin: 0px;
font-size:14px;
color: white
}
a:link { text-decoration: none; color: #ffcc66;}
a:visited{ color: #ffcc66;}
a:hover { text-decoration:underline }
nav {width: 750px; font-size: 14px; padding-bottom: 10px; line-height: 40px; color: #ffcc66; text-align: left; margin-left: auto; margin-right: auto;}
nav a{color:#ffcc66}
#footer {line-height: 50px; padding-top: 20px; padding-bottom: 10px; font-size: 12px; color: #0099FF; clear: both; text-align: center; margin-left: auto; margin-right: auto;}
#header{width:600px; margin-left: auto; margin-right: auto;}
#title {width: 600px; font-size: 30px; padding-bottom: 20px; color: #ffcc66; text-align: right; padding-top: 150px;}
#main {width:600px; margin-left: auto; margin-right: auto;; display: none;}
</style>
</head> </head>
<body> <body>
<div id="body"> <header id="header">
<div id="title"><%= @actions.last %></div>
</header>
<nav id="actions">
<%= render 'entries/action' %>
</nav>
<div id="main">
<%= yield %> <%= yield %>
</div> </div>
<div style="clear:both"/> <footer id="footer">
<div style="line-height:50px; padding-top:20px; padding-bottom:10px; font-size:12px; color:#0099FF" align="center" >YGO DULE BATTLENET</div> YGO DULE BATTLENET
</footer>
</body> </body>
</html> </html>
...@@ -15,18 +15,18 @@ ...@@ -15,18 +15,18 @@
</div> </div>
<!--胜率--> <!--胜率-->
<div style='width:40px; float:left; color:#58db3e' align='left'> <div style='width:40px; float:left; color:#58db3e' align='left'>
<%= user.win.zero? && user.lost.zero? ? 0 : user.win * 100 / (user.win + user.lost) %>%
</div> </div>
<!--胜场--> <!--胜场-->
<div style='width:30px; float:left; color:red' align='right'> <div style='width:30px; float:left; color:red' align='right'>
<%= user.win %>
</div> </div>
<!--负场--> <!--负场-->
<div style='width:30px; float:left; color:blue' align='right'> <div style='width:30px; float:left; color:blue' align='right'>
<%= user.lost %>
</div> </div>
<!--详情--> <!--详情-->
<div style='width:100px; float:left; color:#dfc84b; font-weight:100; cursor:pointer' > <div style='width:100px; float:left; color:#dfc84b; font-weight:100; cursor:pointer' >
<%= link_to '详情', user, :style=>'color:#ffe793; text-decoration:none' %> , :style=>'color:#ffe793; text-decoration:none' %>
</div> </div>
</div> </div>
<div align="center" style="padding-top:130px;"> <style>
<div align="right" style="width:600px; font-size:50px; padding-bottom:20px; color:#ffffff">TOP10</div> #users {width:600px;text-align: center}
<div style="width:600px; display:none; " id="mian1" class="main1" > #users thead {line-height:25px; background-color:#1c1b1b; height:25px; color:#d6edff; font-weight:bold;}
<div style="line-height:25px; background-color:#1c1b1b; height:25px; color:#d6edff; font-weight:bold; "> #users tbody {line-height:25px; padding-top:3px; font-weight:bold; }
<div style='width:90px; float:left;'><em>名次</em></div> #users .index {color:#d6edff}
<div style='width:200px; float:left;'><em>决斗者</em></div> #users .name a {color:#FFE793}
<div style='width:100px; float:left;' align='center'><em>积分</em></div> #users .credits {color:#FF6468}
<div style='width:100px; float:left;' align='center'><em>胜率/胜/负</em></div> #users .ratio {color:#58DB3E; text-align:right}
<div style='width:100px; float:left;' align='center'><em>得分纪录</em></div> #users .win {color:red; text-align:right}
</div> #users .lost {color:blue; text-align:right}
#users .show a {color:#DFC84B}
</style>
<table id="users">
<thead>
<tr>
<th>名次</th>
<th>决斗者</th>
<th>积分</th>
<th colspan="3">胜率/胜/负</th>
<th>得分纪录</th>
</tr>
</thead>
<tbody>
<% top_users = User.order(:credits).reverse_order.limit(10) %> <% top_users = User.order(:credits).reverse_order.limit(10) %>
<% top_users.each_with_index do |user, index| %>
<%= render :partial => "record", :locals => { :user => user, :index => index } %>
<% end %>
<% if logged? && !top_users.include?(@current_user) %> <% if logged? && !top_users.include?(@current_user) %>
<%= render :partial => "record", :locals => { :user => @current_user, :index => User.where("credits>?", @current_user.credits).count } %> <% top_users += @current_user %>
<% my_index = User.where("credits>=?", @current_user.credits).count %>
<% end %>
<% top_users.each_with_index do |user, index| %>
<tr>
<td class="index"><%= user == @current_user ? my_index : index.next %></td>
<td class="name"><%= link_to user.name, user %></td>
<td class="credits"><%= user.credits %></td>
<td class="ratio"><%= user.win.zero? && user.lost.zero? ? 0 : user.win * 100 / (user.win + user.lost) %>%</td>
<td class="win"><%= user.win %></td>
<td class="lost"><%= user.lost %></td>
<td class="show"><%= link_to '详情', user %></td>
</tr>
<% end %> <% end %>
</div> </tbody>
</div> </table>
\ No newline at end of file
...@@ -19,6 +19,11 @@ ...@@ -19,6 +19,11 @@
background: -moz-linear-gradient(#58A2DA, #147EBD);background: -ms-linear-gradient(#58A2DA, #147EBD); background: -moz-linear-gradient(#58A2DA, #147EBD);background: -ms-linear-gradient(#58A2DA, #147EBD);
background: -o-linear-gradient(#58A2DA, #147EBD);background: linear-gradient(#58A2DA, #147EBD);} background: -o-linear-gradient(#58A2DA, #147EBD);background: linear-gradient(#58A2DA, #147EBD);}
.film_bit_download:active{margin:1px 0 0 75px;-moz-box-shadow:none; -webkit-box-shadow:none; box-shadow:none;} .film_bit_download:active{margin:1px 0 0 75px;-moz-box-shadow:none; -webkit-box-shadow:none; box-shadow:none;}
#title{display:none}
#actions{display:none}
#footer{display:none}
#main{display:block}
</style> </style>
<script type="text/javascript"> <script type="text/javascript">
......
<div align="center" style="padding-top:150px; cursor:pointer;"> <style>
<div align="right" style="width:600px; font-size:30px; padding-bottom:20px; color:#ffcc66"><%= @user.name %> </div> #duels{width: 600px;text-align: center}
#duels thead {line-height:25px; background-color:#1c1b1b; height:25px; color:#d6edff; font-weight:bold; }
#duels tbody {line-height:25px; padding-top:3px; font-weight:bold;}
<div style="color: white"> #duels .index {color:white}
<p> #duels .win {color:#58db3e}
<%= @user.wins.count %>:负<%= @user.losts.count %> 总场次:<%= @user.duels.count %> #duels .lose {color:red}
</p> #duels .current {color:red}
<p> </style>
<b>常用怪兽:</b>
<%= render @user.cards.main_monsters.top(10) %>
</p> <div id="duels">
<p> <%= @user.wins.count %>:负<%= @user.losts.count %> 总场次:<%= @user.duels.count %>
<b>常用额外:</b> </div>
<%= render @user.cards.extra.top(5) %>
</p> <div id="cards">
<p> <p>
<b>常用魔法:</b> <b>常用怪兽:</b>
<%= render @user.cards.magics.top(5) %> <%= render @user.cards.main_monsters.top(10) %>
</p> </p>
<p> <p>
<b>常用陷阱:</b> <b>常用额外:</b>
<%= render @user.cards.traps.top(5) %> <%= render @user.cards.extra.top(5) %>
</p> </p>
</div> <p>
<b>常用魔法:</b>
<%= render @user.cards.magics.top(5) %>
</p>
<div style="width:600px; display:none; " id="mian1" class="main1" > <p>
<div style="line-height:25px; background-color:#1c1b1b; height:25px; color:#d6edff; font-weight:bold; "> <b>常用陷阱:</b>
<div style='width:50px; float:left;'><em>场次</em></div> <%= render @user.cards.traps.top(5) %>
<div style='width:200px; float:left;'><em>对手</em></div> </p>
<div style='width:100px; float:left;' align='center'><em>胜负</em></div> </div>
<div style='width:100px; float:left;' align='center'><em>得分</em></div>
<div style='width:100px; float:left;' align='center'><em>战斗终分</em></div> <table id="duels">
</div> <thead>
<tr>
<th>场次</th>
<th>对手</th>
<th>胜负</th>
<th>得分</th>
<th>战斗终分</th>
</tr>
</thead>
<tfoot>
<tr>
<%= link_to "更多...", {:controller => :duels, :action => :index, :user_id => @user.id} %>
</tr>
</tfoot>
<tbody>
<% final_credits = @user.credits %> <% final_credits = @user.credits %>
<% @user.top_duels(20).each_with_index do |duel, index| %> <% @user.top_duels(20).each_with_index do |duel, index| %>
<div style='clear:both;'></div> <tr>
<div style='line-height:25px; padding-top:3px; font-weight:bold; ' align='center'> <td class="index"><%= link_to (@user.duels.count - index), duel %></td>
<td class="opponent"><% opponent = duel.user1 == @user ? duel.user2 : duel.user1 %><%= link_to opponent.name, opponent %></td>
<!--场次--> <td class="result <%= duel.winner == @user ? "win" : "lose" %>"><%= duel.winner == @user ? "WIN" : "LOSE" %></td>
<div style='width:50px; float:left; color:white ' > <td class="credits <%= duel.winner == @user ? "win" : "lose" %>"><%= duel.user1 == @user ? duel.user1_credits : duel.user2_credits %></td>
<%= link_to (@user.duels.count - index), duel, :style=>"color:white" %> <td class="final_credits <%= "current" if index.zero? %>"><%= final_credits %><% final_credits -= duel.user1 == @user ? duel.user1_credits : duel.user2_credits %></td>
</div> </tr>
<!--对手-->
<div style='width:200px; float:left; ' align='left'>
<% opponent = duel.user1 == @user ? duel.user2 : duel.user1 %>
<%= link_to opponent.name, opponent, :style => 'color:#ffe793; text-decoration:none' %>
</div>
<!--胜负-->
<div style='width:100px; float:left; color:<% if duel.winner == @user %>#58db3e<% else %>red<% end %>'>
<%= duel.winner == @user ? "WIN" : "LOSE" %>
</div>
<!--得分-->
<div style='width:100px; float:left; color:<% if duel.winner == @user %>#58db3e<% else %>red<% end %>'>
<%= duel.user1 == @user ? duel.user1_credits : duel.user2_credits %>
</div>
<!--战斗终分-->
<div style='width:100px; float:left; color:<% if index.zero? %>red<% else %>#d6edff<% end %>; '>
<%= final_credits %>
<% final_credits -= duel.user1 == @user ? duel.user1_credits : duel.user2_credits %>
</div>
</div>
<% end %> <% end %>
</div> </tbody>
</div> </table>
<div style="clear:both"></div>
<div align="center"><%= link_to "更多...", {:controller => :duels, :action => :index, :user_id => @user.id}, :style=>"color:white" %></div>
\ No newline at end of file
...@@ -2,6 +2,7 @@ MycardServerHttp::Application.routes.draw do ...@@ -2,6 +2,7 @@ MycardServerHttp::Application.routes.draw do
get "rooms/index" get "rooms/index"
get "mycard/update" get "mycard/update"
get "mycard/download"
root :to => "boards#index" root :to => "boards#index"
...@@ -12,6 +13,7 @@ MycardServerHttp::Application.routes.draw do ...@@ -12,6 +13,7 @@ MycardServerHttp::Application.routes.draw do
resources :cards resources :cards
resources :users do resources :users do
resources :duels resources :duels
resources :cards
end end
resources :boards resources :boards
resources :topics resources :topics
......
...@@ -5,7 +5,7 @@ mycard ygocore 服务器测试主页 <br /> ...@@ -5,7 +5,7 @@ mycard ygocore 服务器测试主页 <br />
<a href="login">用户登陆</a> <br /> <a href="login">用户登陆</a> <br />
<a href="rooms">在线大厅</a> <br /> <a href="rooms">在线大厅</a> <br />
<a href="downloads/mycard-0.4.5-win32.7z">mycard下载</a> <a href="mycard/download">mycard下载</a>
<br /><br /><br /> <br /><br /><br />
以功能开发中,可能会出现程序出错、界面乱糟糟等情况 请自备氪金狗眼<br /> 以功能开发中,可能会出现程序出错、界面乱糟糟等情况 请自备氪金狗眼<br />
<a href="users">用户排行</a> <br /> <a href="users">用户排行</a> <br />
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment