Merge remote-tracking branch 'origin/szzh' into szzh

This commit is contained in:
yanxd 2014-05-20 10:09:09 +08:00
commit 2aeb12616b
14 changed files with 86 additions and 37 deletions

View File

@ -26,13 +26,13 @@ class HomeworkAttachController < ApplicationController
#删除留言
def destroy
@journal_destroyed = JournalsForMessage.delete_message(params[:object_id])
@homework = HomeworkAttach.find(params[:id])
@jours = @homework.journals_for_messages.order("created_on DESC")
@limit = 10
@feedback_count = @jours.count
@feedback_pages = Paginator.new @feedback_count, @limit, params['page']
@offset ||= @feedback_pages.offset
@jour = @jours[@offset, @limit]
#@homework = HomeworkAttach.find(params[:id])
#@jours = @homework.journals_for_messages.order("created_on DESC")
#@limit = 10
#@feedback_count = @jours.count
#@feedback_pages = Paginator.new @feedback_count, @limit, params['page']
#@offset ||= @feedback_pages.offset
#@jour = @jours[@offset, @limit]
respond_to do |format|
format.js
end
@ -43,11 +43,11 @@ class HomeworkAttachController < ApplicationController
@homework = HomeworkAttach.find(params[:jour_id])
@homework.addjours User.current.id, params[:new_form][:user_message],0
@jours = @homework.journals_for_messages.order("created_on DESC")
@limit = 10
@feedback_count = @jours.count
@feedback_pages = Paginator.new @feedback_count, @limit, params['page']
@offset ||= @feedback_pages.offset
@jour = @jours[@offset, @limit]
#@limit = 10
#@feedback_count = @jours.count
#@feedback_pages = Paginator.new @feedback_count, @limit, params['page']
#@offset ||= @feedback_pages.offset
#@jour = @jours[@offset, @limit]
respond_to do |format|
format.js
end

View File

@ -0,0 +1,3 @@
class HomeworkUsersController < ApplicationController
end

View File

@ -0,0 +1,2 @@
module HomeworkUsersHelper
end

View File

@ -1,8 +1,12 @@
class HomeworkAttach < ActiveRecord::Base
include Redmine::SafeAttributes
#attr_accessible :name, :description, :state, :user_id, :bid_id
belongs_to :user
belongs_to :bid
has_many :journals_for_messages, :as => :jour, :dependent => :destroy
has_many :homework_users, :dependent => :destroy
seems_rateable :allow_update => true, :dimensions => :quality
safe_attributes "bid_id",

View File

@ -0,0 +1,6 @@
class HomeworkUser < ActiveRecord::Base
attr_accessible :homework_attach_id, :user_id
belongs_to :homework_attach
has_one :user
end

View File

@ -68,6 +68,8 @@ class User < Principal
['none', :label_user_mail_option_none]
]
has_one :homework_user
has_and_belongs_to_many :groups, :after_add => Proc.new {|user, group| group.user_added(user)},
:after_remove => Proc.new {|user, group| group.user_removed(user)}
has_many :changesets, :dependent => :nullify

View File

@ -85,12 +85,12 @@
<!--点击新建参赛作品弹出框-->
<div id="put-project-form" style="display: none; padding-left: 83px; width: 70%">
<%= form_for Softapplication.new, :remote=>true, :url => softapplications_path, :complete => '$("#put-bid-form").hide();' do |f| %>
<fieldset class="contes-new-box", style="padding-left: 36px">
<fieldset style="padding-left: 36px" class="contes-new-box">
<tr style="width:700px; margin-left: -10px">
<span><%= l(:label_softapplication_name) %></span>
<span class="contest-star"> * </span>: <td ><%= f.text_field :name, :required => true, :size => 60, :style => "width:400px;" %></td>
</tr></ br>
</tr><br/>
<br />
<br />
@ -98,7 +98,7 @@
<span><%= l(:label_softapplication_version_available) %></span>
<span class="contest-star"> * </span>: <td style="width: 100px"><%= f.text_field :android_min_version_available, :required => true, :size => 60, :style => "width:400px;" %></td>
</tr></ br>
</tr><br/>
<br />
<br />
@ -107,7 +107,7 @@
<span class="contest-star"> * </span>: <td style="width: 100px"><%= f.text_field :app_type_name, :required => true, :size => 60, :style => "width:400px;" %></td>
</tr></ br>
</tr><br/>
<br />
<br />
@ -115,7 +115,7 @@
<span><%= l(:label_softapplication_description) %></span>
<span class="contest-star"> * </span>: <td style="width: 100px"><%= f.text_field :description, :required => true, :size => 60, :style => "width:400px;" %></td>
</tr></ br>
</tr><br/>
<br />
<br />
@ -123,11 +123,11 @@
<span><%= l(:label_softapplication_developers) %></span>
<span class="contest-star"> * </span>: <td style="width: 100px"><%= f.text_field :application_developers, :required => true, :size => 60, :style => "width:400px;" %></td>
</tr></ br>
</tr><br/>
<br />
<br />
<fieldset style="width: 500px", style="padding-top: 10px">
<fieldset style="width: 500px; padding-top: 10px">
<legend>
上传应用软件包和应用截图
</legend>
@ -146,7 +146,7 @@
</fieldset>
</fieldset></br>
<div class="align-center", style="padding-top: -3px; padding-bottom: 8px">
<div class="align-center" style="padding-top: -3px; padding-bottom: 8px">
<%= submit_tag l(:button_create), :onclick => "cancel();" %>
</div>
<% end %>

View File

@ -1,4 +1,4 @@
$('#message').html('<%= escape_javascript(render(:partial => 'showjour', :locals => {:jour =>@jour, :state => false} )) %>');
$('#message').html('<%= escape_javascript(render(:partial => 'showjour', :locals => {:jour =>@jours, :state => false} )) %>');
$('#pre_show').html('<%= escape_javascript(render(:partial => 'pre_show', :locals => {:content => nil})) %>');
$('#new_form_user_message').val("");
$('#new_form_reference_user_id').val("");

View File

@ -1,12 +1,8 @@
<% if @journal_destroyed.nil? %>
alert('<%=l(:notice_failed_delete)%>');
<% elsif (['Principal','Project', 'Bid', 'Contest', 'Softapplication','HomeworkAttach'].include? @journal_destroyed.jour_type)%>
var destroyedItem = $('#word_li_<%=@journal_destroyed.id%>')
destroyedItem.fadeOut(600,function(){
destroyedItem.remove();
});
<% else %>
$('#message').html('<%= escape_javascript(render(:partial => 'showjour', :locals => {:jour => @jours, :state => false})) %>');
$('#new_form_reference_user_id').val("");
var destroyedItem = $('#word_li_<%=@journal_destroyed.id%>')
destroyedItem.fadeOut(600,function(){
destroyedItem.remove();
});
<% end %>

View File

@ -16,6 +16,9 @@
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
RedmineApp::Application.routes.draw do
resources :homework_users
resources :no_uses
delete 'no_uses', :to => 'no_uses#delete'

View File

@ -0,0 +1,10 @@
class CreateHomeworkUsers < ActiveRecord::Migration
def change
create_table :homework_users do |t|
t.string :homework_attach_id
t.string :user_id
t.timestamps
end
end
end

View File

@ -0,0 +1,7 @@
class AddNameToHomeworkAttach < ActiveRecord::Migration
def change
add_column :homework_attaches, :name, :string
add_column :homework_attaches, :description, :string
add_column :homework_attaches, :state, :int
end
end

View File

@ -11,7 +11,7 @@
#
# It's strongly recommended to check this file into your version control system.
ActiveRecord::Schema.define(:version => 20140509020307) do
ActiveRecord::Schema.define(:version => 20140519070751) do
create_table "activities", :force => true do |t|
t.integer "act_id", :null => false
@ -52,14 +52,11 @@ ActiveRecord::Schema.define(:version => 20140509020307) do
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", :id => false, :force => true do |t|
t.integer "id", :null => false
t.integer "typeId"
create_table "attachmentstypes", :force => true do |t|
t.integer "typeId", :null => false
t.string "typeName", :limit => 50
end
add_index "attachmentstypes", ["id"], :name => "id"
create_table "auth_sources", :force => true do |t|
t.string "type", :limit => 30, :default => "", :null => false
t.string "name", :limit => 60, :default => "", :null => false
@ -325,9 +322,12 @@ ActiveRecord::Schema.define(:version => 20140509020307) do
create_table "homework_attaches", :force => true do |t|
t.integer "bid_id"
t.integer "user_id"
t.datetime "created_at", :null => false
t.datetime "updated_at", :null => false
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|
@ -335,6 +335,13 @@ ActiveRecord::Schema.define(:version => 20140509020307) 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

9
test/fixtures/homework_users.yml vendored Normal file
View File

@ -0,0 +1,9 @@
# Read about fixtures at http://api.rubyonrails.org/classes/ActiveRecord/Fixtures.html
one:
homework_attach_id: MyString
user_id: MyString
two:
homework_attach_id: MyString
user_id: MyString