给应用添加开发人员字段及显示
This commit is contained in:
parent
f9e5dd47f6
commit
98b6493b91
|
@ -0,0 +1,15 @@
|
||||||
|
|
||||||
|
class ContestingSoftapplication < ActiveRecord::Base
|
||||||
|
attr_accessible :contest_id, :description, :softapplication_id, :user_id
|
||||||
|
|
||||||
|
belongs_to :contest
|
||||||
|
belongs_to :softapplication
|
||||||
|
belongs_to :user
|
||||||
|
|
||||||
|
|
||||||
|
def self.create_softapplication_contesting(contest_id, softapplication_id, description = nil)
|
||||||
|
self.create(:user_id => User.current.id, :contest_id => contest_id,
|
||||||
|
:softapplication_id => softapplication_id, :description => description)
|
||||||
|
end
|
||||||
|
|
||||||
|
end
|
|
@ -1,5 +1,5 @@
|
||||||
class Softapplication < ActiveRecord::Base
|
class Softapplication < ActiveRecord::Base
|
||||||
attr_accessible :android_min_version_available, :app_type_id, :app_type_name, :description, :name, :user_id, :contest_id
|
attr_accessible :android_min_version_available, :app_type_id, :app_type_name, :description, :name, :user_id, :contest_id, :application_developers
|
||||||
acts_as_attachable
|
acts_as_attachable
|
||||||
has_many :journals_for_messages, :as => :jour, :dependent => :destroy
|
has_many :journals_for_messages, :as => :jour, :dependent => :destroy
|
||||||
has_many :contesting_softapplications, :dependent => :destroy
|
has_many :contesting_softapplications, :dependent => :destroy
|
||||||
|
|
|
@ -0,0 +1,40 @@
|
||||||
|
|
||||||
|
<% contesting_softapplication.each do |c_softapplication|%>
|
||||||
|
<% if c_softapplication.softapplication %>
|
||||||
|
<table width="90%" border="0" align='center'>
|
||||||
|
<tr>
|
||||||
|
<td>
|
||||||
|
<table width="660px" border="0" align='center'>
|
||||||
|
<tr>
|
||||||
|
|
||||||
|
<td width="65%" valign="top">
|
||||||
|
<table width="100%" valign="top" align="left">
|
||||||
|
<tr>
|
||||||
|
<td colspan="2" valign="top" width="50%">
|
||||||
|
<strong>
|
||||||
|
<%= link_to(c_softapplication.softapplication.name, softapplication_path(c_softapplication.softapplication)) %>
|
||||||
|
</strong>
|
||||||
|
<span class="font_lighter"><%= l(:label_joined_contest)%></span>
|
||||||
|
</td>
|
||||||
|
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td valign="top" width="50%" style=" word-wrap: break-word; word-break: break-all"><%= c_softapplication.softapplication.description %></td>
|
||||||
|
</tr>
|
||||||
|
|
||||||
|
<tr>
|
||||||
|
<td valign="top"><span class="font_lighter">
|
||||||
|
<%=format_time c_softapplication.created_at %>
|
||||||
|
</span></td>
|
||||||
|
</tr>
|
||||||
|
</table>
|
||||||
|
</td>
|
||||||
|
|
||||||
|
</tr>
|
||||||
|
</table>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
</table>
|
||||||
|
<% end %>
|
||||||
|
<% end %>
|
||||||
|
|
|
@ -0,0 +1,4 @@
|
||||||
|
$('#contesting_softapplication_list').html('<%= escape_javascript(render(:partial => 'softapplication_list', :locals => {:contesting_softapplication => @contesting_softapplication})) %>');
|
||||||
|
$("#softapplication_id").val("请选择参赛应用");
|
||||||
|
$("#contest_message").val( "<%= l(:label_bid_reason) %>" );
|
||||||
|
$("#put-bid-form").hide();
|
|
@ -0,0 +1,32 @@
|
||||||
|
<% reply_allow = JournalsForMessage.create_by_user? User.current %>
|
||||||
|
|
||||||
|
|
||||||
|
<div id='leave-message'>
|
||||||
|
<%= render :partial => 'new_message', :locals => {:softapplication => @softapplication, :sta => @state} %>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
|
||||||
|
<% if journals.size >0 %>
|
||||||
|
<ul class="message-for-user">
|
||||||
|
<% for journal in journals%>
|
||||||
|
<li id='word_li_<%= journal.id.to_s %>' class="outer-message-for-user">
|
||||||
|
<span class="portrait"><%= image_tag(url_to_avatar(journal.user), :class => "avatar") %></span>
|
||||||
|
<span class="body">
|
||||||
|
<span class="user"><%= link_to journal.user, user_path(journal.user)%></span>
|
||||||
|
<span class="font_lighter"><% label = l(:label_contest_requirement) %></span>
|
||||||
|
<div> <%= textilizable journal.notes%> </div>
|
||||||
|
<span class="font_lighter"><%= l(:label_bids_published) %> <%= time_tag(journal.created_on).html_safe %> <%= l(:label_bids_published_ago) %></span>
|
||||||
|
|
||||||
|
<% ids = 'project_respond_form_'+ journal.id.to_s%>
|
||||||
|
|
||||||
|
<span>
|
||||||
|
<% if @user==User.current|| User.current.admin? %>
|
||||||
|
<%= link_to(l(:label_bid_respond_delete), {:controller => 'words', :action => 'destroy', :object_id => journal, :user_id => @user}, :remote => true, :confirm => l(:text_are_you_sure), :method => 'delete', :class => "delete", :title => l(:button_delete)) %>
|
||||||
|
<% end %>
|
||||||
|
</span>
|
||||||
|
</span>
|
||||||
|
<div style="clear: both;"></div>
|
||||||
|
</li>
|
||||||
|
<% end %>
|
||||||
|
</ul>
|
||||||
|
<% end %>
|
|
@ -0,0 +1,53 @@
|
||||||
|
|
||||||
|
<script type="text/javascript" language="javascript">
|
||||||
|
function clearInfo(id, content) {
|
||||||
|
var text = $('#' + id);
|
||||||
|
if (text.val() == content) {
|
||||||
|
$('#' + id).val('');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function showInfo(id, content) {
|
||||||
|
var text = $('#' + id);
|
||||||
|
if (text.val() == '') {
|
||||||
|
$('#' + id).val(content);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<%= form_for('softapplication_message',
|
||||||
|
:remote => true, :method => :post,
|
||||||
|
:url => {:controller => 'softapplications',
|
||||||
|
:action => 'create_message',
|
||||||
|
:id => softapplication,
|
||||||
|
:sta => sta}
|
||||||
|
) do |f|%>
|
||||||
|
|
||||||
|
<div id = 'pre_show'>
|
||||||
|
<%= render :partial => 'pre_show', :locals => {:content => @content} %>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<% if User.current.logged? %>
|
||||||
|
<table border="0" width="525px" align="center" >
|
||||||
|
<tr>
|
||||||
|
<td><%= f.text_area 'message', :rows => 3, :cols => 65, :placeholder => l(:label_my_respond), :style => "resize: none;", :class => 'noline'%></td>
|
||||||
|
</tr>
|
||||||
|
</table>
|
||||||
|
|
||||||
|
<%= f.text_field :reference_user_id, :style=>"display:none"%> <!--what function?-->
|
||||||
|
|
||||||
|
<!-- modified by bai -->
|
||||||
|
<table border="0" width="525px" align="center">
|
||||||
|
<tr>
|
||||||
|
<td align="right"> <%= submit_tag l(:button_leave_meassge), :name => nil , :class => "softapplication_btn", :onmouseout => "this.style.backgroundPosition = 'left top'", :onmouseover => "this.style.backgroundPosition = 'left -31px'"%>
|
||||||
|
<%= submit_tag l(:button_clear), :name => nil, :onclick => "clearMessage('softapplication_message_message');", :type => 'button', :class => "bid_btn", :onmouseout => "this.style.backgroundPosition = 'left top'", :onmouseover => "this.style.backgroundPosition = 'left -31px'" %> </td>
|
||||||
|
</tr>
|
||||||
|
</table>
|
||||||
|
<!-- end -->
|
||||||
|
<% else %>
|
||||||
|
<div style="font-size: 14px;margin:10px;">
|
||||||
|
<%= l(:label_user_login_tips) %>
|
||||||
|
<%= link_to l(:label_user_login_new), signin_path %>
|
||||||
|
</div>
|
||||||
|
<% end %>
|
||||||
|
<% end %>
|
|
@ -0,0 +1,13 @@
|
||||||
|
<!-- fq -->
|
||||||
|
<% unless content.nil?%>
|
||||||
|
<table width="60%" style="margin-left: 60px;">
|
||||||
|
<tr>
|
||||||
|
<td> <%= textilizable content %></td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td><%= hidden_field_tag 'reference_content', params[:reference_content], :value => content%></td>
|
||||||
|
</tr>
|
||||||
|
</table>
|
||||||
|
<% end %>
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1,2 @@
|
||||||
|
$('#message_history').html('<%= escape_javascript(render(:partial => 'history_message', :locals => {:softapplication => @softapplication, :journals => @jour, :state => @state})) %>');
|
||||||
|
$('#softapplication_message_reference_user_id').val("");
|
|
@ -0,0 +1,4 @@
|
||||||
|
$('#history').html('<%= escape_javascript(render(:partial => 'softapplications/message_history', :locals => {:contest => @softapplication, :journals => @jour, :state => true})) %>');
|
||||||
|
$('#pre_show').html('<%= escape_javascript(render(:partial => 'pre_show', :locals => {:content => nil})) %>');
|
||||||
|
$('#softapplication_message_message').val("");
|
||||||
|
$('#softapplication_message_reference_user_id').val("");
|
|
@ -0,0 +1,2 @@
|
||||||
|
$('#message_history').html('<%= escape_javascript(render(:partial => 'message_history', :locals => {:softapplication => @softapplication, :journals => @jour, :state => @state})) %>');
|
||||||
|
$('#softapplication_message_reference_user_id').val("");
|
|
@ -42,6 +42,13 @@
|
||||||
<br />
|
<br />
|
||||||
<br />
|
<br />
|
||||||
|
|
||||||
|
<tr style="width:800px;">
|
||||||
|
<td><%= l(:label_softapplication_developers) %></td>
|
||||||
|
<td style="require, color: #bb0000"> * </td>: <td style="width: 100px"><%= f.text_field :application_developers, :required => true, :size => 60, :style => "width:400px;" %></td>
|
||||||
|
|
||||||
|
</tr></ br>
|
||||||
|
<br />
|
||||||
|
<br />
|
||||||
<fieldset style="width: 500px">
|
<fieldset style="width: 500px">
|
||||||
<legend>上传应用软件包或应用截图</legend>
|
<legend>上传应用软件包或应用截图</legend>
|
||||||
<%= render_flash_messages %>
|
<%= render_flash_messages %>
|
||||||
|
|
|
@ -0,0 +1,12 @@
|
||||||
|
<h3><%=l(:label_release_softapplication)%></h3>
|
||||||
|
<!-- <%= render 'form' %>
|
||||||
|
|
||||||
|
<%= link_to 'Back', softapplications_path %> -->
|
||||||
|
|
||||||
|
<%= labelled_form_for @softapplication, :url => {:controller => 'softapplications', :action => 'create'}, method: :post do |f| %>
|
||||||
|
<div class="box tabular">
|
||||||
|
<%= render :partial => 'form', :locals => { :f => f } %>
|
||||||
|
<%= submit_tag l(:button_create) %>
|
||||||
|
|
||||||
|
<% end %>
|
||||||
|
</div>
|
|
@ -0,0 +1,12 @@
|
||||||
|
<h3><%=l(:label_release_softapplication)%></h3>
|
||||||
|
<!-- <%= render 'form' %>
|
||||||
|
|
||||||
|
<%= link_to 'Back', softapplications_path %> -->
|
||||||
|
|
||||||
|
<%= labelled_form_for @softapplication, :url => {:controller => 'softapplications', :action => 'create'}, method: :post do |f| %>
|
||||||
|
<div class="box tabular">
|
||||||
|
<%= render :partial => 'form', :locals => { :f => f } %>
|
||||||
|
<%= submit_tag l(:button_create) %>
|
||||||
|
<!-- <%= javascript_tag "$('#bid_name').focus();" %> -->
|
||||||
|
<% end %>
|
||||||
|
</div>
|
|
@ -0,0 +1,64 @@
|
||||||
|
<h3><%= l(:label_release_softapplication)%></h3> <!-- <%= render 'form' %>
|
||||||
|
|
||||||
|
<%= link_to 'Back', softapplications_path %> -->
|
||||||
|
|
||||||
|
|
||||||
|
<div id="put-bid-form" style="">
|
||||||
|
<%= form_for Softapplication.new, :url => {:controller => 'softapplications', :action => 'create'}, :update => "bidding_project_list", :complete => '$("#put-bid-form").hide();', :html => {:multipart => true, :id => 'add_homework_form'} do |f| %>
|
||||||
|
<fieldset>
|
||||||
|
<legend>
|
||||||
|
<%= l(:label_attachment_plural) %>
|
||||||
|
</legend>
|
||||||
|
<tr style="width:700px; margin-left: -10px">
|
||||||
|
<td><%= l(:label_softapplication_name) %></td>
|
||||||
|
<td style="require, color: #bb0000"> * </td>: <td ><%= f.text_field :name, :required => true, :size => 60, :style => "width:400px;" %></td>
|
||||||
|
<td><%= l(:label_softapplication_name_condition)%></td>
|
||||||
|
</tr></ br>
|
||||||
|
<br />
|
||||||
|
<br />
|
||||||
|
|
||||||
|
<tr style="width:800px;">
|
||||||
|
<td><%= l(:label_softapplication_version_available) %></td>
|
||||||
|
<td style="require, color: #bb0000"> * </td>: <td style="width: 100px"><%= f.text_field :android_min_version_available, :required => true, :size => 60, :style => "width:400px;" %></td>
|
||||||
|
|
||||||
|
</tr></ br>
|
||||||
|
<br />
|
||||||
|
<br />
|
||||||
|
|
||||||
|
<tr style="width:800px;">
|
||||||
|
<td><%= l(:label_softapplication_type) %></td>
|
||||||
|
|
||||||
|
<td style="require, color: #bb0000"> * </td>: <td style="width: 100px"><%= f.text_field :app_type_name, :required => true, :size => 60, :style => "width:400px;" %></td>
|
||||||
|
|
||||||
|
</tr></ br>
|
||||||
|
<br />
|
||||||
|
<br />
|
||||||
|
|
||||||
|
<tr style="width:800px;">
|
||||||
|
<td><%= l(:label_softapplication_description) %></td>
|
||||||
|
<td style="require, color: #bb0000"> * </td>: <td style="width: 100px"><%= f.text_field :description, :required => true, :size => 60, :style => "width:400px;" %></td>
|
||||||
|
|
||||||
|
</tr></ br>
|
||||||
|
<br />
|
||||||
|
<br />
|
||||||
|
<%= render_flash_messages %>
|
||||||
|
<p id="put-bid-form-partial">
|
||||||
|
<%= render :partial => 'attachments/form' %>
|
||||||
|
</p>
|
||||||
|
</fieldset>
|
||||||
|
<%= submit_tag l(:button_create), :onclick => "return true" %>
|
||||||
|
<script type="text/javascript">
|
||||||
|
function j_submit () {
|
||||||
|
alert('start')
|
||||||
|
var submit_homework = function(){
|
||||||
|
$('#add_homework_form').clone().attr('action', '<%= url_for({:controller => "softapplications", :action => "create"})+".js" %>').ajaxSubmit()
|
||||||
|
};
|
||||||
|
alert('stop')
|
||||||
|
$.globalEval(submit_homework());
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<% end %>
|
||||||
|
</div>
|
|
@ -0,0 +1,5 @@
|
||||||
|
$('#pre_show').html('<%= escape_javascript(render(:partial => 'pre_show', :locals => {:content => @content})) %>');
|
||||||
|
$('#softapplication_message_reference_user_id').val("<%= @id%>");
|
||||||
|
showAndScrollTo("pre_show", "softapplication_message_reference_user_id");
|
||||||
|
|
||||||
|
|
|
@ -9,7 +9,7 @@
|
||||||
|
|
||||||
<p id="notice"><%= notice %></p>
|
<p id="notice"><%= notice %></p>
|
||||||
|
|
||||||
<%= image_tag(url_to_avatar(@user), :class => "avatar2") %>
|
<!-- <%= image_tag(url_to_avatar(@user), :class => "avatar2") %> -->
|
||||||
<div style="height: 120px">
|
<div style="height: 120px">
|
||||||
<tr>
|
<tr>
|
||||||
<td colspan="2" valign="top" width="50" >
|
<td colspan="2" valign="top" width="50" >
|
||||||
|
@ -24,10 +24,13 @@
|
||||||
<td>发布时间:<%=format_time @softapplication.created_at %></span></td>
|
<td>发布时间:<%=format_time @softapplication.created_at %></span></td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<td>开发者:<%= @softapplication.user.name %></td>
|
<td>发布人员:<%= @softapplication.user.name %></td>
|
||||||
<td>系统支持:<%= @softapplication.android_min_version_available %></td>
|
<td>系统支持:<%= @softapplication.android_min_version_available %></td>
|
||||||
</tr>
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td>应用下载: </td>
|
||||||
|
<td>开发人员:<%= @softapplication.application_developers %></td>
|
||||||
|
</tr>
|
||||||
|
|
||||||
</table>
|
</table>
|
||||||
</td>
|
</td>
|
||||||
|
|
|
@ -1837,7 +1837,9 @@ zh:
|
||||||
label_softapplication_description: 应用简介
|
label_softapplication_description: 应用简介
|
||||||
label_softapplication_type: 应用分类
|
label_softapplication_type: 应用分类
|
||||||
label_softapplication_version_available: 适配版本
|
label_softapplication_version_available: 适配版本
|
||||||
label_softapplication_developer: 开发者
|
label_softapplication_developer: 上传人员
|
||||||
|
label_softapplication_developers: 开发人员
|
||||||
label_softapplication_name_condition: 25个汉字以内(50个字符)
|
label_softapplication_name_condition: 25个汉字以内(50个字符)
|
||||||
label_user_login_softapplication_board: 您还没有登录,请登录后参与应用评价。
|
label_user_login_softapplication_board: 您还没有登录,请登录后参与应用评价。
|
||||||
label_contest_description_no: 暂无描述。
|
label_contest_description_no: 暂无描述。
|
||||||
|
|
|
@ -0,0 +1,5 @@
|
||||||
|
class AddContestIdToSoftapplications < ActiveRecord::Migration
|
||||||
|
def change
|
||||||
|
add_column :softapplications, :contest_id, :integer
|
||||||
|
end
|
||||||
|
end
|
|
@ -0,0 +1,5 @@
|
||||||
|
class AddSoftapplicationIdToSoftapplications < ActiveRecord::Migration
|
||||||
|
def change
|
||||||
|
add_column :softapplications, :softapplication_id, :integer
|
||||||
|
end
|
||||||
|
end
|
|
@ -0,0 +1,12 @@
|
||||||
|
class CreateContestingSoftapplications < ActiveRecord::Migration
|
||||||
|
def change
|
||||||
|
create_table :contesting_softapplications do |t|
|
||||||
|
t.integer :softapplication_id
|
||||||
|
t.integer :contest_id
|
||||||
|
t.integer :user_id
|
||||||
|
t.string :description
|
||||||
|
|
||||||
|
t.timestamps
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
|
@ -0,0 +1,5 @@
|
||||||
|
class AddRewardToContestingSoftapplications < ActiveRecord::Migration
|
||||||
|
def change
|
||||||
|
add_column :contesting_softapplications, :reward, :string
|
||||||
|
end
|
||||||
|
end
|
|
@ -0,0 +1,5 @@
|
||||||
|
class AddIsPublicToSoftapplications < ActiveRecord::Migration
|
||||||
|
def change
|
||||||
|
add_column :softapplications, :is_public, :integer
|
||||||
|
end
|
||||||
|
end
|
|
@ -0,0 +1,5 @@
|
||||||
|
class AddApplicationdevelopersToSoftapplications < ActiveRecord::Migration
|
||||||
|
def change
|
||||||
|
add_column :softapplications, :application_developers, :string
|
||||||
|
end
|
||||||
|
end
|
13
db/schema.rb
13
db/schema.rb
|
@ -11,7 +11,7 @@
|
||||||
#
|
#
|
||||||
# It's strongly recommended to check this file into your version control system.
|
# It's strongly recommended to check this file into your version control system.
|
||||||
|
|
||||||
ActiveRecord::Schema.define(:version => 20140411005214) do
|
ActiveRecord::Schema.define(:version => 20140414012423) do
|
||||||
|
|
||||||
create_table "activities", :force => true do |t|
|
create_table "activities", :force => true do |t|
|
||||||
t.integer "act_id", :null => false
|
t.integer "act_id", :null => false
|
||||||
|
@ -696,6 +696,7 @@ ActiveRecord::Schema.define(:version => 20140411005214) do
|
||||||
t.integer "contest_id"
|
t.integer "contest_id"
|
||||||
t.integer "softapplication_id"
|
t.integer "softapplication_id"
|
||||||
t.integer "is_public"
|
t.integer "is_public"
|
||||||
|
t.string "application_developers"
|
||||||
end
|
end
|
||||||
|
|
||||||
create_table "students_for_courses", :force => true do |t|
|
create_table "students_for_courses", :force => true do |t|
|
||||||
|
@ -811,6 +812,16 @@ ActiveRecord::Schema.define(:version => 20140411005214) do
|
||||||
|
|
||||||
add_index "user_preferences", ["user_id"], :name => "index_user_preferences_on_user_id"
|
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", :null => false
|
||||||
|
t.integer "collaboration"
|
||||||
|
t.integer "influence"
|
||||||
|
t.integer "skill"
|
||||||
|
t.integer "active"
|
||||||
|
t.datetime "created_at", :null => false
|
||||||
|
t.datetime "updated_at", :null => false
|
||||||
|
end
|
||||||
|
|
||||||
create_table "user_statuses", :force => true do |t|
|
create_table "user_statuses", :force => true do |t|
|
||||||
t.integer "changesets_count"
|
t.integer "changesets_count"
|
||||||
t.integer "watchers_count"
|
t.integer "watchers_count"
|
||||||
|
|
|
@ -0,0 +1,13 @@
|
||||||
|
# Read about fixtures at http://api.rubyonrails.org/classes/ActiveRecord/Fixtures.html
|
||||||
|
|
||||||
|
one:
|
||||||
|
softapplication_id: 1
|
||||||
|
contest_id: 1
|
||||||
|
user_id: 1
|
||||||
|
description: MyString
|
||||||
|
|
||||||
|
two:
|
||||||
|
softapplication_id: 1
|
||||||
|
contest_id: 1
|
||||||
|
user_id: 1
|
||||||
|
description: MyString
|
|
@ -0,0 +1,7 @@
|
||||||
|
require 'test_helper'
|
||||||
|
|
||||||
|
class ContestingSoftapplicationTest < ActiveSupport::TestCase
|
||||||
|
# test "the truth" do
|
||||||
|
# assert true
|
||||||
|
# end
|
||||||
|
end
|
Loading…
Reference in New Issue