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

战网部分样式HTML规范化

parent 6a349380
$(document).ready(function(){
$('.main1').show(500);
})
function test(){
}
\ No newline at end of file
$(document).ready(function(){
$('#main').show(500);
})
\ 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
# GET /cards
# GET /cards.json
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|
format.html # index.html.erb
......
#encoding: UTF-8
class DuelsController < ApplicationController
layout 'ygo'
# GET /duels
# GET /duels.json
def index
if params[:user_id]
@user = User.find params[:user_id]
@duels = @user.duels
else
@duels = Duel
end
@duels = @duels.reverse_order.page(params[:page])
@actions = [@user, '对战明细']
respond_to do |format|
format.html # index.html.erb
format.json { render json: @duels }
end
end
# GET /duels/1
# GET /duels/1.json
def show
@duel = Duel.find(params[:id])
respond_to do |format|
format.html # show.html.erb
format.json { render json: @duel }
end
end
# GET /duels/new
# GET /duels/new.json
def new
@duel = Duel.new
respond_to do |format|
format.html # new.html.erb
format.json { render json: @duel }
end
end
# GET /duels/1/edit
def edit
@duel = Duel.find(params[:id])
end
# POST /duels
# POST /duels.json
def create
@duel = Duel.new(params[:duel])
respond_to do |format|
if @duel.save
format.html { redirect_to @duel, notice: 'Duel was successfully created.' }
format.json { render json: @duel, status: :created, location: @duel }
else
format.html { render action: "new" }
format.json { render json: @duel.errors, status: :unprocessable_entity }
end
end
end
# PUT /duels/1
# PUT /duels/1.json
def update
@duel = Duel.find(params[:id])
case @current_user
when @duel.user1
params[:duel] = {:user1_public => params[:duel][:user1_public]}
when @duel.user2
params[:duel] = {:user2_public => params[:duel][:user2_public]}
else
params[:duel] = {}
end
respond_to do |format|
if @duel.update_attributes(params[:duel])
format.html { redirect_to @duel, notice: 'Duel was successfully updated.' }
format.json { head :no_content }
else
format.html { render action: "edit" }
format.json { render json: @duel.errors, status: :unprocessable_entity }
end
end
end
# DELETE /duels/1
# DELETE /duels/1.json
def destroy
@duel = Duel.find(params[:id])
@duel.destroy
respond_to do |format|
format.html { redirect_to duels_url }
format.json { head :no_content }
end
end
def user_deck(user_pos)
@duel = Duel.find(params[:duel_id])
unless (user_pos and @duel.user1_public or @duel.user1 == @current_user) or (!user_pos and @duel.user2_public or @duel.user2 == @current_user)
return respond_to do |format|
format.ydk { redirect_to :format => :html}
format.html{ render :text => "卡组未公开"}
end
end
if user_pos
main = @duel.user1_main
extra = @duel.user1_extra
else
main = @duel.user2_main
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")}
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
user_deck(true)
end
def user2_deck
user_deck(false)
end
end
#encoding: UTF-8
class DuelsController < ApplicationController
layout 'ygo'
# GET /duels
# GET /duels.json
def index
if params[:user_id]
@user = User.find params[:user_id]
@duels = @user.duels
@actions = ["YGO战网", @user, '对战列表']
else
@duels = Duel.where(true)
@actions = ["YGO战网", '对战列表']
end
@duels = @duels.reverse_order.page(params[:page])
respond_to do |format|
format.html # index.html.erb
format.json { render json: @duels }
end
end
# GET /duels/1
# GET /duels/1.json
def show
@duel = Duel.find(params[:id])
@actions = ["YGO战网", '对战列表', @duel]
respond_to do |format|
format.html # show.html.erb
format.json { render json: @duel }
end
end
# GET /duels/new
# GET /duels/new.json
def new
@duel = Duel.new
respond_to do |format|
format.html # new.html.erb
format.json { render json: @duel }
end
end
# GET /duels/1/edit
def edit
@duel = Duel.find(params[:id])
end
# POST /duels
# POST /duels.json
def create
@duel = Duel.new(params[:duel])
respond_to do |format|
if @duel.save
format.html { redirect_to @duel, notice: 'Duel was successfully created.' }
format.json { render json: @duel, status: :created, location: @duel }
else
format.html { render action: "new" }
format.json { render json: @duel.errors, status: :unprocessable_entity }
end
end
end
# PUT /duels/1
# PUT /duels/1.json
def update
@duel = Duel.find(params[:id])
case @current_user
when @duel.user1
params[:duel] = {:user1_public => params[:duel][:user1_public]}
when @duel.user2
params[:duel] = {:user2_public => params[:duel][:user2_public]}
else
params[:duel] = {}
end
respond_to do |format|
if @duel.update_attributes(params[:duel])
format.html { redirect_to @duel, notice: 'Duel was successfully updated.' }
format.json { head :no_content }
else
format.html { render action: "edit" }
format.json { render json: @duel.errors, status: :unprocessable_entity }
end
end
end
# DELETE /duels/1
# DELETE /duels/1.json
def destroy
@duel = Duel.find(params[:id])
@duel.destroy
respond_to do |format|
format.html { redirect_to duels_url }
format.json { head :no_content }
end
end
def user_deck(user_pos)
@duel = Duel.find(params[:duel_id])
unless (user_pos and @duel.user1_public or @duel.user1 == @current_user) or (!user_pos and @duel.user2_public or @duel.user2 == @current_user)
return respond_to do |format|
format.ydk { redirect_to :format => :html}
format.html{ render :text => "卡组未公开"}
end
end
if user_pos
main = @duel.user1_main
extra = @duel.user1_extra
else
main = @duel.user2_main
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")}
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
user_deck(true)
end
def user2_deck
user_deck(false)
end
end
......@@ -13,4 +13,13 @@ class MycardController < ApplicationController
format.json { render json: result }
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
\ No newline at end of file
......@@ -9,7 +9,7 @@ class UsersController < ApplicationController
# GET /users.xml
def index
@users = User.all
@actions = ["YGO战网", "用户排行"]
respond_to do |format|
format.html # index.html.erb
format.xml { render :xml => @users }
......@@ -20,17 +20,17 @@ class UsersController < ApplicationController
# GET /users/1.xml
def show
@user = User.find(params[:id])
@actions = [@user.name]
@actions = ["YGO战网", @user]
respond_to do |format|
format.html # show.html.erb
format.xml { render :xml => @user }
#format.xml { render :xml => @user }
end
end
# GET /users/new
# GET /users/new.xml
def new
@actions = [:register]
@actions = ["注册"]
@user = User.new
respond_to do |format|
......@@ -106,11 +106,11 @@ class UsersController < ApplicationController
end
end
def login
@actions = [:login]
@actions = ["登陆"]
@user = User.new
end
def login_do
@actions = [:login]
@actions = ["登陆"]
user = User.find_by_name(params[:user][:name])
if user and params[:user][:password] == user.password
@user = user
......@@ -135,7 +135,7 @@ class UsersController < ApplicationController
if @user
session[:user_id] = @user.id
@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 }
else
@user = User.new(params[:user])
......
......@@ -24,4 +24,7 @@ class Duel < ActiveRecord::Base
def user2_extra
user_cards(user2, false)
end
def to_s
"决斗详情"
end
end
<h1>热门卡排行</h1>
<p>
<b>常用怪兽:</b>
<%= render @cards.main_monsters.top(10) %>
......
......@@ -7,53 +7,56 @@
padding-top:10px;
padding-buttom:10px;
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>
<div align="center" style="padding-top:150px; cursor:pointer;">
<div align="right" style="width:600px; font-size:30px; padding-bottom:20px; color:#ffcc66"><%= @user.name %> </div>
<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>
<div style="width:600px; display:none; " id="mian1" class="main1" >
<div style="line-height:25px; background-color:#1c1b1b; height:25px; color:#d6edff; font-weight:bold; ">
<div style='width:50px; float:left;'><em>场次</em></div>
<div style='width:200px; float:left;'><em>对手</em></div>
<div style='width:100px; float:left;' align='center'><em>胜负</em></div>
<div style='width:100px; float:left;' align='center'><em>得分</em></div>
<!--<div style='width:100px; float:left;' align='center'><em>战斗终分</em></div>-->
</div>
<!--这里的效率很低,待优化-->
<% first_index = @user.duels.where("id<=?",@duels.to_enum.first.id).count %>
<%# final_credits = Duels.where("id<=?",@duels.to_enum.first.id).sum %>
<table id="duels">
<thead>
<tr>
<% if @user %>
<th>场次</th>
<th>对手</th>
<th>胜负</th>
<th>得分</th>
<% else %>
<th>场次</th>
<th>玩家1</th>
<th>玩家2</th>
<th>玩家1得分</th>
<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| %>
<div style='clear:both;'></div>
<div style='line-height:25px; padding-top:3px; font-weight:bold; ' align='center'>
<!--场次-->
<div style='width:50px; float:left; color:white ' >
<%= link_to (first_index - index), duel, :style=>"color:white" %>
</div>
<!--对手-->
<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>
<tr>
<% 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>
<td class="result <%= duel.winner == @user ? "win" : "lose" %>"><%= duel.winner == @user ? "WIN" : "LOSE" %></td>
<td class="credits <%= duel.winner == @user ? "win" : "lose" %>"><%= duel.user1 == @user ? duel.user1_credits : duel.user2_credits %></td>
<% else %>
<td class="index"><%= link_to duel.id, duel %></td>
<td class="user user1"><%= link_to duel.user1.name, duel.user1 %></td>
<td class="user user2"><%= link_to duel.user2.name, duel.user2 %></td>
<td class="credits user1 <%= duel.winner == duel.user1 ? "win" : "lose" %>"><%= duel.user1_credits %></td>
<td class="credits user2 <%= duel.winner == duel.user2 ? "win" : "lose" %>"><%= duel.user2_credits %></td>
<% end %>
</tr>
<% end %>
</div>
</div>
<div style="clear:both"/>
<div align="center">
<%= will_paginate @duels %>
</div>
</tbody>
</table>
<div id="replay">录像下载</div>
<style type="text/css">
<!--
......@@ -36,84 +37,76 @@
}
}
</script>
<div style="padding-top:150px; " align="center">
<div style="width:600px; font-size:30px; padding-bottom:10px; color:#ffcc66;font-weight: bold;" align="right">DUEL INFO </div>
<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>
<div style="color: white; width:750px;" align="left">
<div class="user_act" id="user1" onClick="show(1)">
<%= @duel.user1.name %>
<% if @duel.winner == @duel.user1 %>
<span class="STYLE3">WINNER</span>
<% else %>
<span class="STYLE4">LOSER</span>
<div style="color: white; width:750px;" align="left">
<div class="user_act" id="user1" onClick="show(1)">
<%= @duel.user1.name %>
<% if @duel.winner == @duel.user1 %>
<span class="STYLE3">WINNER</span>
<% else %>
<span class="STYLE4">LOSER</span>
<% 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>
<% if @current_user == @duel.user1 %>
<%= form_for(@duel, :html => {:style => "display:inline"}) do |f| %>
<span style="font-size:12px;color:white;float:right;padding-right:24px">公开卡组<%= f.check_box :user1_public, :onclick=>"submit()" %></span>
<% 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>
<% if @current_user == @duel.user1 %>
<%= form_for(@duel, :html => {:style => "display:inline"}) do |f| %>
<span style="font-size:12px;color:white;float:right;padding-right:24px">公开卡组<%= f.check_box :user1_public, :onclick=>"submit()" %></span>
<% end %>
<% end %>
</div>
<div class="user" id="user2" onClick="show(2)" >
<%= @duel.user2.name %>
<% if @duel.winner == @duel.user2 %>
<span class="STYLE3">WINNER</span>
<% else %>
<span class="STYLE4">LOSER</span>
<% end %>
</div>
<div class="user" id="user2" onClick="show(2)" >
<%= @duel.user2.name %>
<% if @duel.winner == @duel.user2 %>
<span class="STYLE3">WINNER</span>
<% else %>
<span class="STYLE4">LOSER</span>
<% 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 %>
<% 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"/>
<p><b>额外:</b> </p>
<% @duel.user1_extra.each do |card| %>
<div class="card">
<%= link_to image_tag(card.image, :title => card.name), card %>
</div>
<% end %>
<% else %>
卡组未公开
<div style="clear:both"/>
<p><b>额外:</b> </p>
<% @duel.user1_extra.each do |card| %>
<div class="card">
<%= link_to image_tag(card.image, :title => card.name), card %>
</div>
<% end %>
</div>
<% else %>
卡组未公开
<% end %>
</div>
<div style="clear:both"/>
<div style="color: white; width:700px; " align="left">
<div id="cards2">
<% if @duel.user2_public or @current_user == @duel.user2 %>
<p><b>主卡组:</b> </p>
<% @duel.user2_main.each do |card| %>
<div class="card">
<%= link_to image_tag(card.image, :title => card.name, :width => 54, :height => 81), card %>
</div>
<% end %>
<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 %>
卡组未公开
</div>
<div style="clear:both"/>
<div style="color: white; width:700px; " align="left">
<div id="cards2">
<% if @duel.user2_public or @current_user == @duel.user2 %>
<p><b>主卡组:</b> </p>
<% @duel.user2_main.each do |card| %>
<div class="card">
<%= link_to image_tag(card.image, :title => card.name, :width => 54, :height => 81), card %>
</div>
<% 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 align="center"></div>
</div>
\ No newline at end of file
<div id="action">
<%= @site %>
<% @actions.each do |action| %>
&raquo; <%= action %>
<% end %>
</div>
\ No newline at end of file
&raquo; <span class="action"><%= action %></span>
<% end %>
\ No newline at end of file
<!DOCTYPE html>
<html>
<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>
<%#= stylesheet_link_tag 'application' %>
<%= stylesheet_link_tag 'ygo' %>
......@@ -9,12 +10,36 @@
<%= javascript_include_tag 'ygo' %>
<%= javascript_include_tag params[:controller] %>
<%= 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>
<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 %>
</div>
<div style="clear:both"/>
<div style="line-height:50px; padding-top:20px; padding-bottom:10px; font-size:12px; color:#0099FF" align="center" >YGO DULE BATTLENET</div>
<footer id="footer">
YGO DULE BATTLENET
</footer>
</body>
</html>
......@@ -15,18 +15,18 @@
</div>
<!--胜率-->
<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 style='width:30px; float:left; color:red' align='right'>
<%= user.win %>
</div>
<!--负场-->
<div style='width:30px; float:left; color:blue' align='right'>
<%= user.lost %>
</div>
<!--详情-->
<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 align="center" style="padding-top:130px;">
<div align="right" style="width:600px; font-size:50px; padding-bottom:20px; color:#ffffff">TOP10</div>
<div style="width:600px; display:none; " id="mian1" class="main1" >
<div style="line-height:25px; background-color:#1c1b1b; height:25px; color:#d6edff; font-weight:bold; ">
<div style='width:90px; float:left;'><em>名次</em></div>
<div style='width:200px; float:left;'><em>决斗者</em></div>
<div style='width:100px; float:left;' align='center'><em>积分</em></div>
<div style='width:100px; float:left;' align='center'><em>胜率/胜/负</em></div>
<div style='width:100px; float:left;' align='center'><em>得分纪录</em></div>
</div>
<style>
#users {width:600px;text-align: center}
#users thead {line-height:25px; background-color:#1c1b1b; height:25px; color:#d6edff; font-weight:bold;}
#users tbody {line-height:25px; padding-top:3px; font-weight:bold; }
#users .index {color:#d6edff}
#users .name a {color:#FFE793}
#users .credits {color:#FF6468}
#users .ratio {color:#58DB3E; text-align:right}
#users .win {color:red; text-align:right}
#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.each_with_index do |user, index| %>
<%= render :partial => "record", :locals => { :user => user, :index => index } %>
<% end %>
<% 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 %>
</div>
</div>
</tbody>
</table>
\ No newline at end of file
......@@ -19,6 +19,11 @@
background: -moz-linear-gradient(#58A2DA, #147EBD);background: -ms-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;}
#title{display:none}
#actions{display:none}
#footer{display:none}
#main{display:block}
</style>
<script type="text/javascript">
......
<div align="center" style="padding-top:150px; cursor:pointer;">
<div align="right" style="width:600px; font-size:30px; padding-bottom:20px; color:#ffcc66"><%= @user.name %> </div>
<div style="color: white">
<p>
<%= @user.wins.count %>:负<%= @user.losts.count %> 总场次:<%= @user.duels.count %>
</p>
<p>
<b>常用怪兽:</b>
<%= render @user.cards.main_monsters.top(10) %>
</p>
<p>
<b>常用额外:</b>
<%= render @user.cards.extra.top(5) %>
</p>
<p>
<b>常用魔法:</b>
<%= render @user.cards.magics.top(5) %>
</p>
<p>
<b>常用陷阱:</b>
<%= render @user.cards.traps.top(5) %>
</p>
</div>
<div style="width:600px; display:none; " id="mian1" class="main1" >
<div style="line-height:25px; background-color:#1c1b1b; height:25px; color:#d6edff; font-weight:bold; ">
<div style='width:50px; float:left;'><em>场次</em></div>
<div style='width:200px; float:left;'><em>对手</em></div>
<div style='width:100px; float:left;' align='center'><em>胜负</em></div>
<div style='width:100px; float:left;' align='center'><em>得分</em></div>
<div style='width:100px; float:left;' align='center'><em>战斗终分</em></div>
</div>
<style>
#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>
<div id="duels">
<%= @user.wins.count %>:负<%= @user.losts.count %> 总场次:<%= @user.duels.count %>
</div>
<div id="cards">
<p>
<b>常用怪兽:</b>
<%= render @user.cards.main_monsters.top(10) %>
</p>
<p>
<b>常用额外:</b>
<%= render @user.cards.extra.top(5) %>
</p>
<p>
<b>常用魔法:</b>
<%= render @user.cards.magics.top(5) %>
</p>
<p>
<b>常用陷阱:</b>
<%= render @user.cards.traps.top(5) %>
</p>
</div>
<table id="duels">
<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 %>
<% @user.top_duels(20).each_with_index do |duel, index| %>
<div style='clear:both;'></div>
<div style='line-height:25px; padding-top:3px; font-weight:bold; ' align='center'>
<!--场次-->
<div style='width:50px; float:left; color:white ' >
<%= link_to (@user.duels.count - index), duel, :style=>"color:white" %>
</div>
<!--对手-->
<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>
<tr>
<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>
<td class="credits <%= duel.winner == @user ? "win" : "lose" %>"><%= duel.user1 == @user ? duel.user1_credits : duel.user2_credits %></td>
<td class="final_credits <%= "current" if index.zero? %>"><%= final_credits %><% final_credits -= duel.user1 == @user ? duel.user1_credits : duel.user2_credits %></td>
</tr>
<% end %>
</div>
</div>
<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
</tbody>
</table>
......@@ -2,6 +2,7 @@ MycardServerHttp::Application.routes.draw do
get "rooms/index"
get "mycard/update"
get "mycard/download"
root :to => "boards#index"
......@@ -12,6 +13,7 @@ MycardServerHttp::Application.routes.draw do
resources :cards
resources :users do
resources :duels
resources :cards
end
resources :boards
resources :topics
......
......@@ -5,7 +5,7 @@ mycard ygocore 服务器测试主页 <br />
<a href="login">用户登陆</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 />
<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