作业详情页面

This commit is contained in:
Yiang Gan 2016-03-31 20:43:06 +08:00
parent 1c5b22abf4
commit 392c5708f2
8 changed files with 209 additions and 289 deletions

View File

@ -22,7 +22,7 @@ module Mobile
activities = UserActivity.where("(container_type = 'Project' and container_id in #{user_project_ids} and act_type in #{project_types})" +
"or (container_type = 'Course' and container_id in #{user_course_ids} and act_type in #{course_types}) "+
"or (container_type = 'Principal' and act_type= '#{principal_types}' and container_id = #{user.id}) " +
"or (container_type = 'Blog' and act_type= 'BlogComment' and container_id in #{blog_ids})").order('updated_at desc').limit(10).offset(page * 10)
"or (container_type = 'Blog' and act_type= 'BlogComment' and container_id in #{blog_ids})").order('updated_at desc').limit(200).offset(page * 10)
present :data, activities, with: Mobile::Entities::Activity
present :status, 0
end

View File

@ -1,4 +1,3 @@
<<<<<<< HEAD
require File.expand_path('../boot', __FILE__)
require 'rails/all'
@ -94,102 +93,4 @@ module RedmineApp
end
end
end
=======
require File.expand_path('../boot', __FILE__)
require 'rails/all'
require 'sprockets/railtie'
require 'elasticsearch/model'
if defined?(Bundler)
# If you precompile assets before deploying to production, use this line
Bundler.require(*Rails.groups(:assets => %w(development test)))
# If you want your assets lazily compiled in production, use this line
# Bundler.require(:default, :assets, Rails.env)
end
module RedmineApp
class Application < Rails::Application
# Settings in config/environments/* take precedence over those specified here.
# Application configuration should go into files in config/initializers
# -- all .rb files in that directory are automatically loaded.
#verifier if email is real
config.generators do |g|
g.test_framework :rspec,
fixtures: true,
view_specs: false,
helper_specs: false,
routing_specs: false,
controller_specs: true,
request_specs: false
g.fixture_replacement :factory_girl, dir: "spec/factories"
end
# Custom directories with classes and modules you want to be autoloadable.
config.autoload_paths += %W(#{config.root}/lib)
config.autoload_paths += %w(#{RAILS_ROOT}/app/sweepers)
# Only load the plugins named here, in the order given (default is alphabetical).
# :all can be used as a placeholder for all plugins not explicitly named.
# config.plugins = [ :exception_notification, :ssl_requirement, :all ]
# Activate observers that should always be running.
config.active_record.observers = :journals_for_message_observer, :issue_observer, :journal_observer, :wiki_content_observer
config.active_record.store_full_sti_class = true
config.active_record.default_timezone = :local
config.time_zone = 'Beijing'
# Set Time.zone default to the specified zone and make Active Record auto-convert to this zone.
# Run "rake -D time" for a list of tasks for finding time zone names. Default is UTC.
# config.time_zone = 'Central Time (US & Canada)'
# The default locale is :en and all translations from config/locales/*.rb,yml are auto loaded.
# config.i18n.load_path += Dir[Rails.root.join('my', 'locales', '*.{rb,yml}').to_s]
config.i18n.default_locale = :zh
#config.i18n.enforce_available_locales = true
#I18n.config.enforce_available_locales = true
# Configure the default encoding used in templates for Ruby 1.9.
config.encoding = "utf-8"
# Configure sensitive parameters which will be filtered from the log file.
config.filter_parameters += [:password]
# Enable the asset pipeline
config.assets.enabled = false
# Version of your assets, change this if you want to expire all your assets
config.assets.version = '1.0'
config.action_mailer.perform_deliveries = false
# Do not include all helpers
config.action_controller.include_all_helpers = false
config.action_view.sanitized_allowed_tags = 'div', 'p', 'span', 'img', 'embed'
config.before_initialize do
end
config.after_initialize do
if RbConfig::CONFIG['target_os'] == 'mingw32'
Elasticsearch::Client.new hosts: ['localhost:9200'], retry_on_failure: true,log:true
elsif RbConfig::CONFIG['target_os'] == 'linux' && ["fast76"].include?(`hostname`.gsub("\n",""))
Elasticsearch::Client.new hosts: ['localhost:9200'], retry_on_failure: true,log:true
elsif RbConfig::CONFIG['target_os'] == 'linux' && ["testtrustie11","agent12"].include?(`hostname`.gsub("\n",""))
Elasticsearch::Client.new hosts: ['localhost:9200','192.168.80.11:9200','192.168.80.12:9200'], retry_on_failure: true
elsif RbConfig::CONFIG['target_os'] == 'linux' && ["trustie168","trustieserver14","trustieserver16","Trustie18"].include?(`hostname`.gsub("\n",""))
Elasticsearch::Client.new hosts: ['localhost:9200','192.168.80.168:9200'], retry_on_failure: true
else
Elasticsearch::Client.new hosts: ['localhost:9200'], retry_on_failure: true
end
end
if File.exists?(File.join(File.dirname(__FILE__), 'additional_environment.rb'))
instance_eval File.read(File.join(File.dirname(__FILE__), 'additional_environment.rb'))
end
end
end
>>>>>>> 77e11fe0fec7f8f0537940863e78c4d7d483aff1
end

View File

@ -43,7 +43,7 @@
<div class="cl"></div>
</div>
<div class="post-interactive">
<div class="post-interactive-column c-grey2">回复 (<!=activities[i].reply_count!>)</div>
<div class="post-interactive-column c-grey2"><a href="javascript:void(0);" onclick="window.open('homework_detail.html?id=<!=i!>');" class="c-grey">回复 (<!=activities[i].reply_count!>)</a></div>
<div class="post-interactive-column c-grey2">赞 (<!=activities[i].activity_praise_count!>)</div>
</div>
</div>
@ -55,7 +55,7 @@
<div class="post-main">
<div class="post-avatar fl"><img src="<!=activities[i].author.img_url!>" width="45" height="45" class="border-radius" /></div>
<div class="post-title hidden mb5"><span class="c-grey3 f15 fb"><!=activities[i].subject!></span></div>
<div class="post-title hidden"><a herf="javascript:void(0);" class="mr10"><!=activities[i].author.nickname!></a>to<!=activities[i].course_project_name!>&nbsp;&nbsp;|&nbsp;&nbsp;<!=activities[i].activity_type_name!></div>
<div class="post-title hidden"><a herf="javascript:void(0);" class="mr10"><!=activities[i].author.nickname!></a>to<a herf="javascript:void(0);" class="ml10"><!=activities[i].course_project_name!>&nbsp;&nbsp;|&nbsp;&nbsp;<!=activities[i].activity_type_name!></a></div>
<div class="cl"></div>
<div class="post-content c-grey2 mt10">
<div class="post-all-content"><!:=activities[i].description!></div>
@ -97,7 +97,7 @@
<div class="post-wrapper">
<div class="post-main">
<div class="post-avatar fl"><img src="<!=activities[i].author.img_url!>" width="45" height="45" class="border-radius" /></div>
<div class="post-title hidden mb5"><span class="c-grey3 f15 fb"><!=activities[i].author.nickname!></span>创建了<span class="c-grey3 f15 fb">我的私有课程 | 课程</span></div>
<div class="post-title hidden mb5"><span class="c-grey3 f15 fb"><!=activities[i].author.nickname!></span>创建了<span class="c-grey3 f15 fb"><!=activities[i].course_project_name!></span></div>
<div class="post-title hidden"><a herf="javascript:void(0);" class="mr10"><!=activities[i].latest_update!></a></div>
<div class="cl"></div>
</div>
@ -112,11 +112,11 @@
<div class="post-main">
<div class="post-avatar fl"><img src="<!=activities[i].author.img_url!>" width="45" height="45" class="border-radius" /></div>
<div class="post-title hidden mb5"><span class="c-grey3 f15 fb"><!=activities[i].subject!></span></div>
<div class="post-title hidden"><a herf="javascript:void(0);" class="mr10"><!=activities[i].author.nickname!></a>to<!=activities[i].course_project_name!>&nbsp;&nbsp;|&nbsp;&nbsp;<!=activities[i].activity_type_name!></div>
<div class="post-title hidden"><a herf="javascript:void(0);" class="mr10"><!=activities[i].author.nickname!></a>to<a herf="javascript:void(0);" class="ml10"><!=activities[i].course_project_name!>&nbsp;&nbsp;|&nbsp;&nbsp;<!=activities[i].activity_type_name!></a></div>
<div class="cl"></div>
<div class="post-content c-grey2 mt10">
<div class="post-all-content"><!:=activities[i].description!><br />
<span class="mr15">状态:<!:=activities[i].issue_detail.issue_status!></span> <span class="mr15">优先级:<!:=activities[i].issue_detail.issue_priority!></span> <br /> <span class="mr15">指派给:<!:=activities[i].issue_detail.issue_assigned_to!></span> <span class="mr15">完成度:<!:=activities[i].issue_detail.done_ratio!></span></div>
<span class="mr15">状态:<!:=activities[i].issue_detail.issue_status!></span> <span class="mr15">优先级:<!:=activities[i].issue_detail.issue_priority!></span> <br /> <span class="mr15">指派给:<!:=activities[i].issue_detail.issue_assigned_to!></span> <span class="mr15">完成度:<!:=activities[i].issue_detail.done_ratio!>%</span></div>
</div>
<a herf="javascript:void(0);" class="link-blue f13 fl mt5 post-more undis" style="text-decoration:underline">点击展开</a>
<div class="cl"></div>
@ -124,7 +124,7 @@
<div class="cl"></div>
</div>
<div class="post-interactive">
<div class="post-interactive-column c-grey2">回复 (<!=activities[i].reply_count!>)</div>
<div class="post-interactive-column c-grey2"><a href="javascript:void(0);" onclick="window.open('issue_detail.html?id=<!=i!>');" class="c-grey"> 回复 (<!=activities[i].reply_count!>)</a></div>
<div class="post-interactive-column c-grey2">赞 (<!=activities[i].activity_praise_count!>)</div>
</div>
</div>
@ -136,7 +136,7 @@
<div class="post-main">
<div class="post-avatar fl"><img src="<!=activities[i].author.img_url!>" width="45" height="45" class="border-radius" /></div>
<div class="post-title hidden mb5"><span class="c-grey3 f15 fb"><!=activities[i].subject!></span></div>
<div class="post-title hidden"><a herf="javascript:void(0);" class="mr10"><!=activities[i].author.nickname!></a>to<!=activities[i].course_project_name!>&nbsp;&nbsp;|&nbsp;&nbsp;<!=activities[i].activity_type_name!></div>
<div class="post-title hidden"><a herf="javascript:void(0);" class="mr10"><!=activities[i].author.nickname!></a>to<a herf="javascript:void(0);" class="ml10"><!=activities[i].course_project_name!>&nbsp;&nbsp;|&nbsp;&nbsp;<!=activities[i].activity_type_name!></a></div>
<div class="cl"></div>
<div class="post-content c-grey2 mt10">
<div class="post-all-content"><!:=activities[i].description!></div>
@ -158,7 +158,7 @@
<div class="post-wrapper">
<div class="post-main">
<div class="post-avatar fl"><img src="<!=activities[i].author.img_url!>" width="45" height="45" class="border-radius" /></div>
<div class="post-title hidden mb5"><span class="c-grey3 f15 fb"><!=activities[i].author.nickname!></span>创建了<span class="c-grey3 f15 fb">我的私有课程 | 课程</span></div>
<div class="post-title hidden mb5"><span class="c-grey3 f15 fb"><!=activities[i].author.nickname!></span>创建了<span class="c-grey3 f15 fb"><!=activities[i].course_project_name!></span></div>
<div class="post-title hidden"><a herf="javascript:void(0);" class="mr10"><!=activities[i].latest_update!></a></div>
<div class="cl"></div>
</div>
@ -211,11 +211,13 @@
</div>
<! } !>
<! } !>
<div class="more-events mt10">更多</div>
</script>
<script src="/javascripts/jquery-1.3.2.js"></script>
<script src="/javascripts/baiduTemplate.js"></script>
<script src="/javascripts/wechat/wechat-dev.js"></script>
<script src="/javascripts/wechat/homework-detail.js"></script>
<script src="/javascripts/wechat/auth.js"></script>
</body>
</html>

View File

@ -0,0 +1,75 @@
<!DOCTYPE html>
<html>
<head>
<title>作业详情</title>
<meta charset='utf-8' />
<meta name="keywords" content="" />
<meta name="description" content="" />
<meta name="apple-mobile-web-app-capable" content="no">
<meta content='True' name='HandheldFriendly' />
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no" />
<link type="text/css" rel="stylesheet" href="/stylesheets/weui/weixin.css" />
</head>
<body>
<div id="homework-container"></div>
<!-- 模板1开始可以使用scripttype设置为text/html来存放模板片段并且用id标示 -->
<script id="t:homework-detail" type="text/html">
<div class="undis homework-id"><!=homeworkID!></div>
<div class="post-container">
<div class="post-wrapper">
<div class="post-main">
<div class="post-avatar fl"><img src="<!=homework.author.img_url!>" width="45" height="45" class="border-radius" /></div>
<div class="post-title hidden mb5"><span class="c-grey3 f15 fb"><!=homework.name!></span></div>
<div class="post-title hidden"><a herf="javascript:void(0);" class="mr10"><!=homework.author.nickname!></a>to<a herf="javascript:void(0);" class="ml10"><!=homework.course_name!>&nbsp;&nbsp;|&nbsp;&nbsp;课程作业</a></div>
<div class="cl"></div>
<div class="post-content c-grey2 mt10" style="height:auto;">
<div class="post-all-content"><!:=homework.description!><br />
<span class="mr15">迟交扣分:<!:=homework.late_penalty!></span> 匿评开启时间:<!:=homework.evaluation_start!><br />
<span class="mr15">缺评扣分:<!:=homework.absence_penalty!>分/作品</span> 匿评关闭时间:<!:=homework.evaluation_end!></div>
</div>
<div class="cl"></div>
<span class="c-grey f13 mt10 fl"><!=homework.publish_time!></span>
<div class="cl"></div>
</div>
<div class="post-interactive border-bottom">
<div class="post-interactive-column c-grey2">回复 (<!=homework.whomework_journal_count!>)</div>
<div class="post-interactive-column c-grey2">赞 (<!=homework.whomework_praise_count!>)</div>
</div>
<div class="post-reply-wrap border-bottom">
<div class="post-reply-row">
<div class="post-reply-avatar fl"><img src="<!=homework.journals_for_messages[0].user.img_url!>" width="45" height="45" class="border-radius" /></div>
<div class="ml55">
<div class="post-reply-user hidden"><!=homework.journals_for_messages[0].user.realname!></div>
<div class="post-reply-content c-grey2 mb10"><!=homework.journals_for_messages[0].notes!></div>
<div class="post-reply-date fl"><!=homework.journals_for_messages[0].lasted_comment!></div>
<div class="post-reply-trigger fr undis">回复</div>
</div>
<div class="cl"></div>
</div>
</div>
<div class="post-input-wrap">
<div class="post-reply-row">
<div class="post-reply-avatar fl"><img src="images/post-avatar.jpg" width="30" height="30" /></div>
<div class="ml55">
<input type="text" class="post-reply-input" id="postInput" />
<input type="submit" value="回复" class="post-reply-submit fr mt10" onclick="replyInsert()" />
<div class="cl"></div>
</div>
</div>
</div>
</div>
</div>
</script>
<script src="/javascripts/jquery-1.3.2.js"></script>
<script src="/javascripts/baiduTemplate.js"></script>
<script src="/javascripts/wechat/homework-detail.js"></script>
<script src="/javascripts/wechat/auth.js"></script>
</body>
</html>

View File

@ -20,36 +20,12 @@
<!-- 模板1开始可以使用scripttype设置为text/html来存放模板片段并且用id标示 -->
<script id="t:result-list" type="text/html">
<! for(var i =0; i < activities.length; ++i){ !>
<! var container_type = activities[i].container_type; var act_type = activities[i].act_type; !>
<! if (container_type == "Course") { !>
<! if (act_type == "HomeworkCommon") { !>
<!--homework -->
<div class="post-container">
<div class="post-wrapper">
<div class="post-main">
<div class="post-avatar fl"><img src="<!=activities[i].author.img_url!>" width="45" height="45" class="border-radius" /></div>
<div class="post-title hidden mb5"><span class="c-grey3 f15 fb"><!=activities[i].subject!></span></div>
<div class="post-title hidden"><a herf="javascript:void(0);" class="mr10"><!=activities[i].author.nickname!></a>to<a herf="javascript:void(0);" class="ml10"><!=activities[i].course_project_name!>&nbsp;&nbsp;|&nbsp;&nbsp;<!=activities[i].activity_type_name!></a></div>
<div class="cl"></div>
<div class="post-content c-grey2 mt10">
<div class="post-all-content"><!:=activities[i].description!><br />
<span class="mr15">迟交扣分:<!:=activities[i].homework_common_detail.late_penalty!></span> 匿评开启时间:<!:=activities[i].homework_common_detail.evaluation_start!><br />
<span class="mr15">缺评扣分:<!:=activities[i].homework_common_detail.absence_penalty!>分/作品</span> 匿评关闭时间:<!:=activities[i].homework_common_detail.evaluation_end!></div>
</div>
<a herf="javascript:void(0);" class="link-blue f13 fl mt5 post-more undis" style="text-decoration:underline">点击展开</a>
<div class="cl"></div>
<span class="c-grey f13 mt10 fl"><!=activities[i].latest_update!></span>
<div class="cl"></div>
</div>
<div class="post-interactive">
<div class="post-interactive-column c-grey2">回复 (<!=activities[i].reply_count!>)</div>
<div class="post-interactive-column c-grey2">赞 (<!=activities[i].activity_praise_count!>)</div>
</div>
</div>
</div>
<! } else if (act_type == "News") { !>
<!-- course news -->
<!var searchPart = window.location.search;!>
<!if (searchPart == ""){!>
<!}else{!>
<!var spiltSearchPart = searchPart.split("=");!>
<!i = parseInt(spiltSearchPart[1]);!>
<!}!>
<div class="post-container">
<div class="post-wrapper">
<div class="post-main">
@ -57,160 +33,48 @@
<div class="post-title hidden mb5"><span class="c-grey3 f15 fb"><!=activities[i].subject!></span></div>
<div class="post-title hidden"><a herf="javascript:void(0);" class="mr10"><!=activities[i].author.nickname!></a>to<!=activities[i].course_project_name!>&nbsp;&nbsp;|&nbsp;&nbsp;<!=activities[i].activity_type_name!></div>
<div class="cl"></div>
<div class="post-content c-grey2 mt10">
<div class="post-all-content"><!:=activities[i].description!></div>
</div>
<a herf="javascript:void(0);" class="link-blue f13 fl mt5 post-more undis" style="text-decoration:underline">点击展开</a>
<div class="cl"></div>
<span class="c-grey f13 mt10 fl"><!=activities[i].latest_update!></span>
<div class="cl"></div>
</div>
<div class="post-interactive">
<div class="post-interactive-column c-grey2">回复 (<!=activities[i].reply_count!>)</div>
<div class="post-interactive-column c-grey2">赞 (<!=activities[i].activity_praise_count!>)</div>
</div>
</div>
</div>
<! } else if (act_type == "Message") { !>
<!--course message -->
<div class="post-container">
<div class="post-wrapper">
<div class="post-main">
<div class="post-avatar fl"><img src="images/post-avatar.jpg" width="45" height="45" class="border-radius" /></div>
<div class="post-title fl mb10 hidden"><a herf="javascript:void(0);" class="mr10"><!=activities[i].author.nickname!></a> <span style="vertical-align:top;">给您留言了</span><br />
<span class="c-grey"><!=activities[i].latest_update!></span> </div>
<div class="cl"></div>
<div class="post-content c-grey2 mt10">
<p class="post-all-content"><!:=activities[i].description!></p>
</div>
<a herf="javascript:void(0);" class="link-blue f13 fl mt5 post-more undis" style="text-decoration:underline;">点击展开</a>
<div class="cl"></div>
</div>
<div class="post-interactive">
<div class="post-interactive-column c-grey2">回复 (<!=activities[i].reply_count!>)</div>
<div class="post-interactive-column c-grey2">赞 (<!=activities[i].activity_praise_count!>)</div>
</div>
</div>
</div>
<! } else if (act_type == "Course") { !>
<div class="post-container">
<div class="post-wrapper">
<div class="post-main">
<div class="post-avatar fl"><img src="<!=activities[i].author.img_url!>" width="45" height="45" class="border-radius" /></div>
<div class="post-title hidden mb5"><span class="c-grey3 f15 fb"><!=activities[i].author.nickname!></span>创建了<span class="c-grey3 f15 fb">我的私有课程 | 课程</span></div>
<div class="post-title hidden"><a herf="javascript:void(0);" class="mr10"><!=activities[i].latest_update!></a></div>
<div class="cl"></div>
</div>
</div>
</div>
<! } !>
<! } else if (container_type == "Project") { !>
<! if (act_type == "Issue") { !>
<!-- activities -->
<div class="post-container">
<div class="post-wrapper">
<div class="post-main">
<div class="post-avatar fl"><img src="<!=activities[i].author.img_url!>" width="45" height="45" class="border-radius" /></div>
<div class="post-title hidden mb5"><span class="c-grey3 f15 fb"><!=activities[i].subject!></span></div>
<div class="post-title hidden"><a herf="javascript:void(0);" class="mr10"><!=activities[i].author.nickname!></a>to<!=activities[i].course_project_name!>&nbsp;&nbsp;|&nbsp;&nbsp;<!=activities[i].activity_type_name!></div>
<div class="cl"></div>
<div class="post-content c-grey2 mt10">
<div class="post-all-content"><!:=activities[i].description!><br />
<div class="post-content" style="height:auto;">
<div class="post-all-content c-grey2 mt10"><!:=activities[i].description!><br />
<span class="mr15">状态:<!:=activities[i].issue_detail.issue_status!></span> <span class="mr15">优先级:<!:=activities[i].issue_detail.issue_priority!></span> <br /> <span class="mr15">指派给:<!:=activities[i].issue_detail.issue_assigned_to!></span> <span class="mr15">完成度:<!:=activities[i].issue_detail.done_ratio!></span></div>
</div>
<a herf="javascript:void(0);" class="link-blue f13 fl mt5 post-more undis" style="text-decoration:underline">点击展开</a>
<div class="cl"></div>
<span class="c-grey f13 mt10 fl"><!=activities[i].latest_update!></span>
<div class="cl"></div>
</div>
<div class="post-interactive">
<div class="post-interactive border-bottom">
<div class="post-interactive-column c-grey2">回复 (<!=activities[i].reply_count!>)</div>
<div class="post-interactive-column c-grey2">赞 (<!=activities[i].activity_praise_count!>)</div>
</div>
</div>
</div>
<! } else if (act_type == "Message") { !>
<!-- project news -->
<div class="post-container">
<div class="post-wrapper">
<div class="post-main">
<div class="post-avatar fl"><img src="<!=activities[i].author.img_url!>" width="45" height="45" class="border-radius" /></div>
<div class="post-title hidden mb5"><span class="c-grey3 f15 fb"><!=activities[i].subject!></span></div>
<div class="post-title hidden"><a herf="javascript:void(0);" class="mr10"><!=activities[i].author.nickname!></a>to<!=activities[i].course_project_name!>&nbsp;&nbsp;|&nbsp;&nbsp;<!=activities[i].activity_type_name!></div>
<div class="cl"></div>
<div class="post-content c-grey2 mt10">
<div class="post-all-content"><!:=activities[i].description!></div>
<div class="post-reply-wrap border-bottom">
<div class="post-reply-row">
<div class="post-reply-avatar fl"><img src="images/post-avatar.jpg" width="30" height="30" /></div>
<div class="ml55">
<div class="post-reply-user hidden">Mrs. Ashford</div>
<div class="post-reply-content c-grey2 mb10">Afternoon colleges,<br />
<br />
Thank you so much for the support and resources!<br />
<br />
regards,<br />
<br />
Jackson</div>
<div class="post-reply-date fl">1分钟前</div>
<div class="post-reply-trigger fr undis">回复</div>
</div>
<div class="cl"></div>
</div>
<a herf="javascript:void(0);" class="link-blue f13 fl mt5 post-more undis" style="text-decoration:underline">点击展开</a>
<div class="cl"></div>
<span class="c-grey f13 mt10 fl"><!=activities[i].latest_update!></span>
<div class="cl"></div>
</div>
<div class="post-interactive">
<div class="post-interactive-column c-grey2">回复 (<!=activities[i].reply_count!>)</div>
<div class="post-interactive-column c-grey2">赞 (<!=activities[i].activity_praise_count!>)</div>
</div>
</div>
</div>
<! } else if (act_type == "ProjectCreateInfo") { !>
<!-- project created -->
<div class="post-container">
<div class="post-wrapper">
<div class="post-main">
<div class="post-avatar fl"><img src="<!=activities[i].author.img_url!>" width="45" height="45" class="border-radius" /></div>
<div class="post-title hidden mb5"><span class="c-grey3 f15 fb"><!=activities[i].author.nickname!></span>创建了<span class="c-grey3 f15 fb">我的私有课程 | 课程</span></div>
<div class="post-title hidden"><a herf="javascript:void(0);" class="mr10"><!=activities[i].latest_update!></a></div>
<div class="cl"></div>
</div>
</div>
</div>
<! } !>
<! } else if (container_type == "Principal") { !>
<!--留言 -->
<div class="post-container">
<div class="post-wrapper">
<div class="post-main">
<div class="post-avatar fl"><img src="images/post-avatar.jpg" width="45" height="45" class="border-radius" /></div>
<div class="post-title fl mb10 hidden"><a herf="javascript:void(0);" class="mr10"><!=activities[i].author.nickname!></a> <span style="vertical-align:top;">给您留言了</span><br />
<span class="c-grey"><!=activities[i].latest_update!></span> </div>
<div class="cl"></div>
<div class="post-content c-grey2 mt10">
<p class="post-all-content"><!:=activities[i].description!></p>
<div class="post-input-wrap">
<div class="post-reply-row">
<div class="post-reply-avatar fl"><img src="images/post-avatar.jpg" width="30" height="30" /></div>
<div class="ml55">
<input type="text" class="post-reply-input" id="postInput" />
<input type="submit" value="回复" class="post-reply-submit fr mt10" />
<div class="cl"></div>
</div>
</div>
<a herf="javascript:void(0);" class="link-blue f13 fl mt5 post-more undis" style="text-decoration:underline;">点击展开</a>
<div class="cl"></div>
</div>
<div class="post-interactive">
<div class="post-interactive-column c-grey2">回复 (<!=activities[i].reply_count!>)</div>
<div class="post-interactive-column c-grey2">赞 (<!=activities[i].activity_praise_count!>)</div>
</div>
</div>
</div>
<! } else if (container_type == "Blog") { !>
<!--blog -->
<div class="post-container">
<div class="post-wrapper">
<div class="post-main">
<div class="post-avatar fl"><img src="<!=activities[i].author.img_url!>" width="45" height="45" class="border-radius" /></div>
<div class="post-title hidden mb5"><span class="c-grey3 f15 fb"><!=activities[i].subject!></span></div>
<div class="post-title hidden"><a herf="javascript:void(0);" class="mr10"><!=activities[i].author.nickname!></a>发表博客</div>
<div class="cl"></div>
<div class="post-content c-grey2 mt10">
<div class="post-all-content"><!:=activities[i].description!></div>
</div>
<a herf="javascript:void(0);" class="link-blue f13 fl mt5 post-more undis" style="text-decoration:underline">点击展开</a>
<div class="cl"></div>
<span class="c-grey f13 mt10 fl"><!=activities[i].latest_update!></span>
<div class="cl"></div>
</div>
<div class="post-interactive">
<div class="post-interactive-column c-grey2">回复 (<!=activities[i].reply_count!>)</div>
<div class="post-interactive-column c-grey2">赞 (<!=activities[i].activity_praise_count!>)</div>
</div>
</div>
</div>
<! } !>
<! } !>
</script>
<script src="/javascripts/jquery-1.3.2.js"></script>

View File

@ -0,0 +1,57 @@
/**
* Created by root on 3/31/16.
*/
$(document).ready(function(){
var bt=baidu.template;
bt.LEFT_DELIMITER='<!';
bt.RIGHT_DELIMITER='!>';
var apiUrl = '/api/v1/';
var setTemplate = function(data){
console.log(data);
var html=bt('t:homework-detail',{homework: data});
$('#homework-container').prepend(html);
$('.post-reply-submit').click(function(){
replyInsert();
});
};
var loadDataFromServer = function(id){
//getOpenId(function(openid){
$.ajax({
url: apiUrl + 'whomeworks/' + id,
dataType: 'json',
success: function(data){
setTemplate(data.data);
},
error: function(xhr,status,err){
console.log(err);
}
});
//})
};
loadDataFromServer(808);
//点击回复按钮,插入回复内容
var replyInsert = function(){
var replyContent = $("#postInput").val();
if (!replyContent){
alert("请输入回复");
}else{
$(".post-reply-wrap:last").after('<div class="post-reply-wrap border-bottom"><div class="post-reply-row"><div class="post-reply-avatar fl"><img src="images/post-avatar.jpg" width="30" height="30" /></div><div class="ml55"><div class="post-reply-user hidden">Mrs. Ashford</div><div class="post-reply-content c-grey2 mb10"></div><div class="post-reply-date fl">1分钟前</div><div class="post-reply-trigger fr">回复</div></div><div class="cl"></div></div> </div>');
$(".post-reply-content:last").append(replyContent);
$("#postInput").val("");}
}
var getID = function(){
var homeworkID = $("#homework-id").html();
alert(homeworkID);
return homeworkID;
}
});

View File

@ -9,12 +9,15 @@ $(document).ready(function(){
var apiUrl = '/api/v1/';
var setTemplate = function(data){
console.log(data);
var html=bt('t:result-list',{activities: data});
$('#container').prepend(html);
descToggle();
$('.post-reply-submit').click(function(){
replyInsert();
});
};
var loadDataFromServer = function(id){
@ -36,10 +39,8 @@ $(document).ready(function(){
loadDataFromServer(8686);
//内容全部显示与部分隐藏
var descToggle = function(){
var postWidth = $(".post-wrapper").width();
var titleWidth = postWidth - 80;
$(".post-title").css("maxWidth",titleWidth);
$(".post-all-content").each(function(){
var postHeight = $(this).height();
if (postHeight > 90){
@ -55,11 +56,14 @@ $(document).ready(function(){
});
}
var timeSpilt = function(){
//点击回复按钮,插入回复内容
var replyInsert = function(){
var replyContent = $("#postInput").val();
if (!replyContent){
alert("请输入回复");
}else{
$(".post-reply-wrap:last").after('<div class="post-reply-wrap border-bottom"><div class="post-reply-row"><div class="post-reply-avatar fl"><img src="images/post-avatar.jpg" width="30" height="30" /></div><div class="ml55"><div class="post-reply-user hidden">Mrs. Ashford</div><div class="post-reply-content c-grey2 mb10"></div><div class="post-reply-date fl">1分钟前</div><div class="post-reply-trigger fr">回复</div></div><div class="cl"></div></div> </div>');
$(".post-reply-content:last").append(replyContent);
$("#postInput").val("");}
}
});

View File

@ -10,14 +10,17 @@ h1,h2,h3,h4,h5,p {padding:0px; margin:0px;}
.mt5 {margin-top:5px;}
.mt10 {margin-top:10px;}
.mb5 {margin-bottom:5px;}
.mb10 {margin-bottom:10px;}
.ml10 {margin-left:10px;}
.mr10 {margin-right:10px;}
.ml15 {margin-left:15px;}
.mr15 {margin-right:15px;}
.ml55 {margin-left:55px;}
.c-blue {color:#269ac9;}
.c-grey {color:#9a9a9a;}
.c-grey2 {color:#707070;}
.c-grey3 {color:#555555;}
a.c-grey {color:#707070;}
a:link,a:visited{text-decoration:none;}
a:hover,a:active{cursor:pointer;}
a.link-blue {color:#269ac9;}
@ -35,7 +38,21 @@ a.link-blue {color:#269ac9;}
.post-avatar {width:45px; height:45px; margin-right:10px;}
.post-title {font-size:13px; text-align:left;}
.fl {float:left;}
.fr {float:right;}
.cl {clear:both; overflow:hidden;}
.post-content {width:100%; font-size:13px; line-height:18px; height:90px; overflow:hidden;}
.post-interactive {width:100%; height:35px; line-height:35px; vertical-align:middle; border-top:1px solid #e6e6e6; background-color:#f8f9fb;}
.post-interactive-column {width:50%; text-align:center; float:left; font-size:13px;}
.post-interactive-column {width:50%; text-align:center; float:left; font-size:13px;}
.more-wrap {width:100%;}
.more-events {width:98%; font-size:13px; text-align:center; margin:0px auto; padding: 5px 0px; border:1px solid #e6e6e6; border-radius:3px; background-color:#f8f9fb; }
.border-bottom {border-bottom:1px solid #e6e6e6;}
.post-reply-wrap {width:100%; line-height:18px; background-color:#f8f9fb;}
.post-input-wrap {width:100%; line-height:18px; background-color:#f8f9fb;}
.post-reply-row {padding:10px; color:#9a9a9a;}
.post-reply-avatar {width:45px; height:30px; text-align:center; margin-right:10px;}
.post-reply-user {font-size:13px; text-align:left; margin-bottom:10px;}
.post-reply-content {font-size:13px; text-align:left;}
.post-reply-date {font-size:13px;}
.post-reply-trigger {font-size:13px;}
.post-reply-input {width:100%; height:28px; line-height:28px; border:1px solid #e6e6e6; outline:none; border-radius:3px;}
.post-reply-submit {font-size:13px; padding:3px 8px; color:#fff; background-color:#269ac9; outline:none; border:none; display:inline-block;}