修改竞赛通知等tab-menu的显示状态

This commit is contained in:
wanglinchun 2014-06-03 21:52:16 +08:00
parent 6a8d697582
commit 9d783a7caa
8 changed files with 282 additions and 222 deletions

View File

@ -4,18 +4,28 @@ class ContestnotificationsController < ApplicationController
layout 'base_newcontest'
default_search_scope :contestnotifications
# model_object Contestnotifications
before_filter :find_model_object_contest, :except => [:new, :create, :index]
before_filter :find_contest_from_association, :except => [:new, :create, :index]
before_filter :find_contest_by_contest_id, :only => [:new, :create]
before_filter :authorize, :except => [:index]
# before_filter :find_model_object_contest, :except => [:new, :create, :index]
# before_filter :find_contest_from_association, :except => [:new, :create, :index]
# before_filter :find_contest_by_contest_id, :only => [:new, :create]
before_filter :find_contest
before_filter :find_author
# before_filter :authorize, :except => [:index]
before_filter :find_optional_contest, :only => [:index]
accept_rss_auth :index
accept_api_auth :index
def find_author
@user = @contest.author
render_404 if @user.nil?
end
def find_contest
@contest = Contest.find(params[:contest_id])
render_404 if @contest.nil?
end
def index
@user = @contest.author
# @contestnotifications = Contestnotification.all
#
# respond_to do |format|

View File

@ -1,55 +0,0 @@
<!-- <%= form_for(@contestnotification) do |f| %>
<% if @contestnotification.errors.any? %>
<div id="error_explanation">
<h2><%= pluralize(@contestnotification.errors.count, "error") %> prohibited this contestnotification from being saved:</h2>
<ul>
<% @contestnotification.errors.full_messages.each do |msg| %>
<li><%= msg %></li>
<% end %>
</ul>
</div>
<% end %>
<div class="field">
<%= f.label :contest_id %><br />
<%= f.number_field :contest_id %>
</div>
<div class="field">
<%= f.label :title %><br />
<%= f.text_field :title %>
</div>
<div class="field">
<%= f.label :summary %><br />
<%= f.text_field :summary %>
</div>
<div class="field">
<%= f.label :description %><br />
<%= f.text_field :description %>
</div>
<div class="field">
<%= f.label :author_id %><br />
<%= f.number_field :author_id %>
</div>
<div class="field">
<%= f.label :comments_count %><br />
<%= f.number_field :comments_count %>
</div>
<div class="actions">
<%= f.submit %>
</div>
<% end %> -->
<%= error_messages_for @contestnotifications %>
<div class="add_frame_header" >
<% str =l(:label_news_new) %>
</div>
<div class="box tabular">
<p><%= f.text_field :title, :required => true, :size => 60, :style => "width:488px;" %></p>
<!-- <p style="margin-left:-10px;"><%= f.text_area :summary, :cols => 60, :rows => 2, :style => "width:490px;margin-left:10px;" %></p> -->
<p><%= f.text_area :description, :required => true, :cols => 60, :rows => 11, :class => 'wiki-edit', :style => "width:490px;" %></p>
<p id="attachments_form" style="margin-left:-10px;"><label style="padding-right: 15px;"><%= l(:label_attachment_plural) %></label><%= render :partial => 'attachments/form', :locals => {:container => @contestnotifications} %></p>
</div>
<%= wikitoolbar_for 'news_description' %>

View File

@ -72,10 +72,6 @@
</ul>
</div>
<% other_formats_links do |f| %>
<%= f.link_to 'Atom', :url => {:contest_id => @contest, :key => User.current.rss_key} %>
<% end %>
<% content_for :header_tags do %>
<%= auto_discovery_link_tag(:atom, params.merge({:format => 'atom', :page => nil, :key => User.current.rss_key})) %>
<%= stylesheet_link_tag 'scm' %>

View File

@ -1,16 +1,6 @@
<!-- <h1>New contestnotification</h1>
<%= render 'form' %>
<%= link_to 'Back', contestnotifications_path %> -->
<!-- <h3><%=l(:label_news_new)%></h3> -->
<%= labelled_form_for @contestnotifications, :url => contest_contestnotifications_path(@contest),
:html => { :id => 'news-form', :multipart => true } do |f| %>
<%= render :partial => 'contestnotifications/form', :locals => { :f => f } %>
<%= submit_tag l(:button_create), :class => "whiteButton m3p10 h30" %>
<%#= preview_link preview_contestnotifications_path(:contest_id => @contest), 'news-form' ,target='preview',{:class => 'whiteButton m3p10'}%>
<% end %>
<%#= labelled_form_for @contestnotifications, :url => contest_contestnotifications_path(@contest), :html => { :id => 'news-form', :multipart => true } do |f| %>
<%#= render :partial => 'contestnotifications/form', :locals => { :f => f } %>
<%#= submit_tag l(:button_create), :class => "whiteButton m3p10 h30" %>
<%# end %>
<div id="preview" class="wiki"></div>

View File

@ -43,7 +43,7 @@
<td style="padding-left: 8px"><%=link_to request.host()+"/contests", :controller=>'contests', :action=>'index' %></td>
<td ><%=link_to l(:field_homepage), home_path %> >
<%=link_to l(:label_contest_innovate), :controller=>'contests', :action=>'index' %> >
<span><%= link_to @contest.name, show_contest_contest_path %></span>
<span><%= link_to @contest.name, show_contest_contest_path(@contest) %></span>
</td>
</tr>
</table>
@ -96,20 +96,16 @@
<div class="user_fans">
<table width="240" border="0">
<tr align="center" width="80px">
<!-- <td class="font_index">
<%=link_to "#{@contest.join_in_competitions.count}",:controller => "contests",:action => "show_participator" %>
</td> -->
<!--关注人数-->
<td class="font_index">
<!-- <%=link_to "#{@contest.projects.where('is_public=1').count}", :controller => 'contests', :action => 'show_project' %> -->
<%=link_to "#{@contest.watcher_users.count}", :controller => 'contests', :action => 'show_project' %>
<%=link_to "#{@contest.watcher_users.count}",show_project_contest_path(@contest) %>
</td>
<!--参赛作品数量-->
<td class="font_index">
<% if @contest.id == 2 or @contest.id == 3 or @contest.id == 6 %>
<%=link_to "#{@contest.projects.where('is_public=1').count}" %>
<% else %>
<%=link_to "#{@contest.contesting_softapplications.count}", :controller => 'contests', :action => 'show_attendingcontest' %>
<%=link_to "#{@contest.contesting_softapplications.count}",show_attendingcontest_contest_path(@contest) %>
<% end %>
</td>
@ -127,7 +123,7 @@
<div class="inf_user_image">
<table>
<tr>
<td><%= l(:lable_contest_user) %><%= link_to(@user.show_name, user_path(@user))%></td>
<td><%= l(:lable_contest_user) %><%= link_to(@user.name, user_path(@user))%></td>
</tr>
<tr>
<td><%= l(:label_bids_reward_method) %><%= @contest.budget%></td>
@ -210,25 +206,7 @@
<div class="user_underline"></div>
<!--参与者-->
<!-- <div class="user_fans">
<div class="font_title_left">
<strong><%= l(:label_participate) %></strong>
<% if show_more_participate?(@contest) %>
<span style="font-size: 12px; display: inline; float: right;" >
<%= link_to l(:label_more), :controller => "contests", :action => "show_participator"%>
</span>
<% end %>
</div>
<div class="left_wf">
<table>
<tr>
<td style="padding-top: 5px"> <%= show_participate_picture(@contest) %> </td>
</tr>
</table>
</div>
</div> -->
<div class="user_underline"></div>
</div>
@ -236,7 +214,12 @@
<div id="content">
<% if display_main_menu?(@contest) %>
<div class="tabs_new">
<%= render_menu :contest_menu %>
<%#= render_menu :contest_menu %>
<ul>
<li><a><%= link_to l(:label_user_response), show_contest_contest_path(@contest)%></a></li>
<li><a><%= link_to l(:label_attending_contest), show_attendingcontest_contest_path(@contest)%></a></li>
<li><a><%= link_to l(:label_contest_notification), contest_contestnotifications_path(@contest)%></a></li>
</ul>
</div>
<% end %>

View File

@ -18,7 +18,7 @@
RedmineApp::Application.routes.draw do
match '/contests/:id/contestnotifications', :controller => 'contestnotifications', :action => 'index'
#match '/contests/:id/contestnotifications', :controller => 'contestnotifications', :action => 'index'
resources :homework_users
@ -72,6 +72,7 @@ RedmineApp::Application.routes.draw do
## new added by linchun #新竞赛相关
resources :contests, only: [:index] do
resources :contestnotifications#, except: [:index]
collection do
match 'new_contest' , via: :get
match 'join_in_contest' , via: :post
@ -80,11 +81,11 @@ RedmineApp::Application.routes.draw do
match 'new_join' , via: :post
match 'new' , via: :post
end
resources :contestnotifications
member do
delete 'destroy_contest'
match 'add_softapplication'
match 'update_contest' , via: [:put]
match 'show_contest' , via: :get
match 'show_contest' , via: [:get, :post]
match 'show_project' , via: :get
match 'show_softapplication' , via: :get
match 'show_attendingcontest' , via: :get

View File

@ -23,16 +23,6 @@ ActiveRecord::Schema.define(:version => 20140530010015) do
add_index "activities", ["user_id", "act_type"], :name => "index_activities_on_user_id_and_act_type"
add_index "activities", ["user_id"], :name => "index_activities_on_user_id"
create_table "andoidcontests", :force => true do |t|
t.datetime "created_at", :null => false
t.datetime "updated_at", :null => false
end
create_table "applied_projects", :force => true do |t|
t.integer "project_id", :null => false
t.integer "user_id", :null => false
end
create_table "apply_project_masters", :force => true do |t|
t.integer "user_id"
t.string "apply_type"
@ -55,18 +45,12 @@ ActiveRecord::Schema.define(:version => 20140530010015) do
t.datetime "created_on"
t.string "description"
t.string "disk_directory"
t.integer "attachtype", :default => 1
end
add_index "attachments", ["author_id"], :name => "index_attachments_on_author_id"
add_index "attachments", ["container_id", "container_type"], :name => "index_attachments_on_container_id_and_container_type"
add_index "attachments", ["created_on"], :name => "index_attachments_on_created_on"
create_table "attachmentstypes", :force => true do |t|
t.integer "typeId", :null => false
t.string "typeName", :limit => 50
end
create_table "auth_sources", :force => true do |t|
t.string "type", :limit => 30, :default => "", :null => false
t.string "name", :limit => 60, :default => "", :null => false
@ -87,6 +71,20 @@ ActiveRecord::Schema.define(:version => 20140530010015) do
add_index "auth_sources", ["id", "type"], :name => "index_auth_sources_on_id_and_type"
create_table "bak_mentioned", :primary_key => "Id", :force => true do |t|
t.string "this_real_name", :limit => 1000
t.integer "is_mentioned_in"
t.string "context", :limit => 2000
end
add_index "bak_mentioned", ["this_real_name", "is_mentioned_in"], :name => "name_mention", :length => {"this_real_name"=>900, "is_mentioned_in"=>nil}
add_index "bak_mentioned", ["this_real_name"], :name => "this_real_name"
add_index "bak_mentioned", ["this_real_name"], :name => "this_real_name_2"
add_index "bak_mentioned", ["this_real_name"], :name => "this_real_name_3", :length => {"this_real_name"=>900}
add_index "bak_mentioned", ["this_real_name"], :name => "this_real_name_4"
add_index "bak_mentioned", ["this_real_name"], :name => "this_real_name_5"
add_index "bak_mentioned", ["this_real_name"], :name => "this_real_name_6"
create_table "biding_projects", :force => true do |t|
t.integer "project_id"
t.integer "bid_id"
@ -126,12 +124,9 @@ ActiveRecord::Schema.define(:version => 20140530010015) do
add_index "boards", ["last_message_id"], :name => "index_boards_on_last_message_id"
add_index "boards", ["project_id"], :name => "boards_project_id"
create_table "bug_to_osps", :force => true do |t|
t.integer "osp_id"
t.integer "relative_memo_id"
t.string "description"
t.datetime "created_at", :null => false
t.datetime "updated_at", :null => false
create_table "categories", :primary_key => "Id", :force => true do |t|
t.integer "proj_id", :default => 0, :null => false
t.text "proj_categories"
end
create_table "changes", :force => true do |t|
@ -309,6 +304,14 @@ ActiveRecord::Schema.define(:version => 20140530010015) do
add_index "documents", ["created_on"], :name => "index_documents_on_created_on"
add_index "documents", ["project_id"], :name => "documents_project_id"
create_table "eco_projects", :force => true do |t|
t.integer "proj_id", :default => 0, :null => false
t.integer "eco_proj_id"
t.datetime "date_collected"
end
add_index "eco_projects", ["proj_id"], :name => "proj_id"
create_table "enabled_modules", :force => true do |t|
t.integer "project_id"
t.string "name", :null => false
@ -330,6 +333,137 @@ ActiveRecord::Schema.define(:version => 20140530010015) do
add_index "enumerations", ["id", "type"], :name => "index_enumerations_on_id_and_type"
add_index "enumerations", ["project_id"], :name => "index_enumerations_on_project_id"
create_table "events", :primary_key => "event_id", :force => true do |t|
t.string "job_name"
t.datetime "event_time"
t.string "event_type", :limit => 20
end
create_table "fm_article", :force => true do |t|
t.integer "proj_id", :default => 0, :null => false
t.text "article_title", :limit => 16777215
t.text "article_link", :limit => 16777215
t.text "article_time", :limit => 16777215
t.datetime "date_collected"
end
add_index "fm_article", ["proj_id"], :name => "proj_id"
create_table "fm_bugtracker_link", :force => true do |t|
t.integer "proj_id", :default => 0, :null => false
t.text "description", :limit => 16777215
t.datetime "date_collected"
end
add_index "fm_bugtracker_link", ["proj_id"], :name => "proj_id"
create_table "fm_datametric_link", :force => true do |t|
t.integer "proj_id", :default => 0, :null => false
t.text "description", :limit => 16777215
t.datetime "date_collected"
end
add_index "fm_datametric_link", ["proj_id"], :name => "proj_id"
create_table "fm_dependency_link", :force => true do |t|
t.integer "proj_id", :default => 0, :null => false
t.text "description", :limit => 16777215
t.datetime "date_collected"
end
add_index "fm_dependency_link", ["proj_id"], :name => "proj_id"
create_table "fm_download_link", :force => true do |t|
t.integer "proj_id", :default => 0, :null => false
t.text "download_link", :limit => 16777215
t.datetime "date_collected"
end
add_index "fm_download_link", ["proj_id"], :name => "proj_id"
create_table "fm_heartbeat", :force => true do |t|
t.integer "proj_id", :default => 0, :null => false
t.float "popularity_score", :limit => 12
t.float "vitality_score", :limit => 12
t.integer "subscription"
t.integer "voting_score"
t.integer "voting_count"
t.datetime "date_collected"
end
add_index "fm_heartbeat", ["proj_id"], :name => "proj_id"
create_table "fm_license", :force => true do |t|
t.integer "proj_id", :default => 0, :null => false
t.text "description", :limit => 16777215
t.datetime "date_collected"
end
add_index "fm_license", ["proj_id"], :name => "proj_id"
create_table "fm_mailinglist_link", :force => true do |t|
t.integer "proj_id", :default => 0, :null => false
t.text "description", :limit => 16777215
t.datetime "date_collected"
end
add_index "fm_mailinglist_link", ["proj_id"], :name => "proj_id"
create_table "fm_operating_system", :force => true do |t|
t.integer "proj_id", :default => 0, :null => false
t.text "description", :limit => 16777215
t.datetime "date_collected"
end
add_index "fm_operating_system", ["proj_id"], :name => "proj_id"
create_table "fm_programming_language", :force => true do |t|
t.integer "proj_id", :default => 0, :null => false
t.text "description", :limit => 16777215
t.datetime "date_collected"
end
add_index "fm_programming_language", ["proj_id"], :name => "proj_id"
create_table "fm_project_spotlight", :force => true do |t|
t.integer "proj_id", :default => 0, :null => false
t.text "description", :limit => 16777215
t.text "project_name", :limit => 16777215
t.text "project_spotlight_link", :limit => 16777215
t.datetime "date_collected"
end
add_index "fm_project_spotlight", ["proj_id"], :name => "proj_id"
create_table "fm_release", :force => true do |t|
t.integer "proj_id", :default => 0, :null => false
t.text "description", :limit => 16777215
t.text "release_version", :limit => 16777215
t.text "release_time", :limit => 16777215
t.text "release_tag", :limit => 16777215
t.datetime "date_collected"
end
add_index "fm_release", ["proj_id"], :name => "proj_id"
create_table "fm_submit", :force => true do |t|
t.integer "proj_id", :default => 0, :null => false
t.text "submitter", :limit => 16777215
t.text "submitter_link", :limit => 16777215
t.text "submit_time", :limit => 16777215
t.datetime "date_collected"
end
add_index "fm_submit", ["proj_id"], :name => "proj_id"
create_table "fm_summary", :force => true do |t|
t.integer "proj_id", :default => 0, :null => false
t.text "description", :limit => 16777215
t.datetime "date_collected"
end
add_index "fm_summary", ["proj_id"], :name => "proj_id"
create_table "forums", :force => true do |t|
t.string "name", :null => false
t.string "description", :default => ""
@ -354,9 +488,6 @@ ActiveRecord::Schema.define(:version => 20140530010015) do
t.datetime "created_at", :null => false
t.datetime "updated_at", :null => false
t.string "reward"
t.string "name"
t.string "description"
t.integer "state"
end
create_table "homework_for_courses", :force => true do |t|
@ -364,13 +495,6 @@ ActiveRecord::Schema.define(:version => 20140530010015) do
t.integer "bid_id"
end
create_table "homework_users", :force => true do |t|
t.string "homework_attach_id"
t.string "user_id"
t.datetime "created_at", :null => false
t.datetime "updated_at", :null => false
end
create_table "issue_categories", :force => true do |t|
t.integer "project_id", :default => 0, :null => false
t.string "name", :limit => 30, :default => "", :null => false
@ -580,6 +704,14 @@ ActiveRecord::Schema.define(:version => 20140530010015) do
t.datetime "updated_at", :null => false
end
create_table "ohloh_tagged", :force => true do |t|
t.integer "proj_id", :default => 0, :null => false
t.string "description", :limit => 100, :null => false
t.datetime "date_collected"
end
add_index "ohloh_tagged", ["proj_id"], :name => "proj_id"
create_table "open_id_authentication_associations", :force => true do |t|
t.integer "issued"
t.integer "lifetime"
@ -603,7 +735,7 @@ ActiveRecord::Schema.define(:version => 20140530010015) do
t.integer "users_count", :default => 0
t.date "last_commit_time"
t.string "url"
t.date "date_collected"
t.datetime "date_collected"
t.datetime "created_at", :null => false
t.datetime "updated_at", :null => false
end
@ -644,14 +776,6 @@ ActiveRecord::Schema.define(:version => 20140530010015) do
add_index "project_statuses", ["grade"], :name => "index_project_statuses_on_grade"
create_table "projecting_softapplictions", :force => true do |t|
t.integer "user_id"
t.integer "softapplication_id"
t.integer "project_id"
t.datetime "created_at", :null => false
t.datetime "updated_at", :null => false
end
create_table "projects", :force => true do |t|
t.string "name", :default => "", :null => false
t.text "description"
@ -667,8 +791,6 @@ ActiveRecord::Schema.define(:version => 20140530010015) do
t.boolean "inherit_members", :default => false, :null => false
t.integer "project_type"
t.boolean "hidden_repo", :default => false, :null => false
t.integer "user_id"
t.integer "attachmenttype", :default => 1
end
add_index "projects", ["lft"], :name => "index_projects_on_lft"
@ -697,13 +819,6 @@ ActiveRecord::Schema.define(:version => 20140530010015) do
add_index "queries", ["project_id"], :name => "index_queries_on_project_id"
add_index "queries", ["user_id"], :name => "index_queries_on_user_id"
create_table "relative_memo_to_open_source_projects", :force => true do |t|
t.integer "osp_id"
t.integer "relative_memo_id"
t.datetime "created_at", :null => false
t.datetime "updated_at", :null => false
end
create_table "relative_memos", :force => true do |t|
t.integer "osp_id", :null => false
t.integer "parent_id"
@ -720,10 +835,6 @@ ActiveRecord::Schema.define(:version => 20140530010015) do
t.integer "viewed_count_crawl", :default => 0
t.integer "viewed_count_local", :default => 0
t.string "url"
t.string "username"
t.string "userhomeurl"
t.date "date_collected"
t.string "topic_resource"
end
create_table "repositories", :force => true do |t|
@ -756,7 +867,6 @@ ActiveRecord::Schema.define(:version => 20140530010015) do
t.string "province"
t.datetime "created_at", :null => false
t.datetime "updated_at", :null => false
t.string "logo_link"
end
create_table "seems_rateable_cached_ratings", :force => true do |t|
@ -812,9 +922,6 @@ ActiveRecord::Schema.define(:version => 20140530010015) do
t.integer "softapplication_id"
t.integer "is_public"
t.string "application_developers"
t.string "deposit_project_url"
t.string "deposit_project"
t.integer "project_id"
end
create_table "students_for_courses", :force => true do |t|
@ -824,6 +931,14 @@ ActiveRecord::Schema.define(:version => 20140530010015) do
t.datetime "updated_at", :null => false
end
create_table "t_project_to_os_projects", :force => true do |t|
t.integer "crawl_proj_id"
t.string "crawl_proj_web"
t.integer "trustie_osp_id"
t.datetime "created_at", :null => false
t.datetime "updated_at", :null => false
end
create_table "taggings", :force => true do |t|
t.integer "tag_id"
t.integer "taggable_id"
@ -882,6 +997,22 @@ ActiveRecord::Schema.define(:version => 20140530010015) do
add_index "tokens", ["user_id"], :name => "index_tokens_on_user_id"
add_index "tokens", ["value"], :name => "tokens_value", :unique => true
create_table "tprojects", :force => true do |t|
t.string "name", :limit => 1000, :default => "0"
t.text "description", :limit => 16777215
t.string "commit_count", :limit => 100, :default => "0"
t.string "code_line", :limit => 100
t.string "last_commit_time", :limit => 100
t.string "url", :limit => 1000
t.datetime "date_collected"
t.string "created_at", :limit => 100
t.string "updated_at", :limit => 100
t.integer "proj_id", :null => false
t.string "user_count", :limit => 100
end
add_index "tprojects", ["proj_id"], :name => "proj_id"
create_table "trackers", :force => true do |t|
t.string "name", :limit => 30, :default => "", :null => false
t.boolean "is_in_chlog", :default => false, :null => false
@ -922,11 +1053,6 @@ ActiveRecord::Schema.define(:version => 20140530010015) do
add_index "user_grades", ["project_id"], :name => "index_user_grades_on_project_id"
add_index "user_grades", ["user_id"], :name => "index_user_grades_on_user_id"
create_table "user_levels", :force => true do |t|
t.integer "user_id"
t.integer "level"
end
create_table "user_preferences", :force => true do |t|
t.integer "user_id", :default => 0, :null => false
t.text "others"
@ -937,11 +1063,16 @@ ActiveRecord::Schema.define(:version => 20140530010015) do
add_index "user_preferences", ["user_id"], :name => "index_user_preferences_on_user_id"
create_table "user_scores", :force => true do |t|
t.integer "user_id"
t.integer "user_id", :null => false
t.integer "collaboration"
t.integer "influence"
t.integer "skill"
t.integer "activity"
t.integer "active"
t.datetime "created_at", :null => false
t.datetime "updated_at", :null => false
t.integer "level"
t.integer "file"
t.integer "issue"
end
create_table "user_statuses", :force => true do |t|

View File

@ -2072,6 +2072,7 @@ button.tab-left, button.tab-right {
padding:4px;
width: 20px;
bottom: -1px;
}
button.tab-left {
@ -2115,6 +2116,9 @@ button.tab-right {
font-weight:bold;
border-top-left-radius:4px;
border-top-right-radius:4px;
/*new added*/
margin-top: 16px;
/*end*/
}
#content .tabs_new ul li a:hover {