Merge branch 'ouyangxuhua' into develop

This commit is contained in:
ouyangxuhua 2016-02-24 16:02:38 +08:00
commit 264c6679e0
4 changed files with 23 additions and 2 deletions

View File

@ -28,6 +28,7 @@ class Attachment < ActiveRecord::Base
belongs_to :attachmentstype, :foreign_key => "attachtype",:primary_key => "id" belongs_to :attachmentstype, :foreign_key => "attachtype",:primary_key => "id"
# 被ForgeActivity虚拟关联 # 被ForgeActivity虚拟关联
has_many :forge_acts, :class_name => 'ForgeActivity',:as =>:forge_act ,:dependent => :destroy has_many :forge_acts, :class_name => 'ForgeActivity',:as =>:forge_act ,:dependent => :destroy
has_many :forwards, :as => :from
# 课程动态 # 课程动态
has_many :course_acts, :class_name => 'CourseActivity',:as =>:course_act ,:dependent => :destroy has_many :course_acts, :class_name => 'CourseActivity',:as =>:course_act ,:dependent => :destroy
# end # end

4
app/models/forward.rb Normal file
View File

@ -0,0 +1,4 @@
class Forward < ActiveRecord::Base
validates_presence_of :from_id, :from_type, :to_id, :to_type
belongs_to :from, :polymorphic => true
end

View File

@ -59,9 +59,10 @@
<div class="w607 fr">http// <div class="w607 fr">http//
<input type="text" name="organization[domain]" id="domain" value="<%= domain.nil? ? '' : domain.subname %>" class="orgUrlInput" /> <input type="text" name="organization[domain]" id="domain" value="<%= domain.nil? ? '' : domain.subname %>" class="orgUrlInput" />
.trustie.net<a href="javascript:void(0);" class="linkBlue ml15" style="text-decoration:underline;" onclick="apply_subdomain(<%= @organization.id %>,$('#domain').val());">申请</a> .trustie.net<a href="javascript:void(0);" class="linkBlue ml15" style="text-decoration:underline;" onclick="apply_subdomain(<%= @organization.id %>,$('#domain').val());">申请</a>
<% if domain.present? and OrgMessage.where("organization_id=? and message_type='ApplySubdomain'", @organization.id).order("updated_at desc").first.content == domain.subname %> <% record = OrgMessage.where("organization_id=? and message_type='ApplySubdomain'", @organization.id).order("updated_at desc").first %>
<% if domain.present? and record.present? and record.content == domain.subname %>
<span>(已批准)</span> <span>(已批准)</span>
<% elsif OrgMessage.where("organization_id=? and message_type='ApplySubdomain'", @organization.id).count > 0 %> <% elsif record %>
<span>(您申请了子域名<%= OrgMessage.where("organization_id=? and message_type='ApplySubdomain'", @organization.id).order("updated_at desc").first.content %>,还未批准)</span> <span>(您申请了子域名<%= OrgMessage.where("organization_id=? and message_type='ApplySubdomain'", @organization.id).order("updated_at desc").first.content %>,还未批准)</span>
<% end %> <% end %>
<p class="c_green f12" id="apply_hint" ></p></div> <p class="c_green f12" id="apply_hint" ></p></div>

View File

@ -0,0 +1,15 @@
class CreateForwards < ActiveRecord::Migration
def up
create_table :forwards do|t|
t.integer :from_id
t.string :from_type
t.integer :to_id
t.string :to_type
t.timestamp :created_at
end
end
def down
drop_table :forwards
end
end