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

This commit is contained in:
guange 2015-04-29 23:17:45 +08:00
commit ccc004aa03
18 changed files with 117 additions and 55 deletions

View File

@ -228,6 +228,18 @@ module Mobile
present :status, 0
end
desc '课程课件'
params do
requires :token, type: String
requires :course_id,type: Integer,desc: '课程id'
end
get ":course_id/attachments" do
cs = CoursesService.new
count = cs.course_attachments params
present :data, count, with: Mobile::Entities::Attachment
present :status, 0
end
end
end
end

View File

@ -16,8 +16,11 @@ module Mobile
end
end
end
attachment_expose :id
attachment_expose :filename
attachment_expose :description
attachment_expose :downloads
attachment_expose :quotes
end
end
end

View File

@ -329,11 +329,12 @@ module ApplicationHelper
imagesize = attachment.thumbnail(:size => "200*200")
imagepath = named_attachment_path(attachment, attachment.filename)
if imagesize
link_to image_tag(thumbnail_path(attachment), height: '73', width: '100'),
link_to image_tag(thumbnail_path(attachment), height: '73', width: '100', name: 'issue_attachment_picture'),
imagepath,
:title => attachment.filename
else
link_to image_tag(imagepath , height: '73', width: '100'),
link_to image_tag(imagepath , height: '73', width: '100', name: 'issue_attachment_picture'),
imagepath,
:title => attachment.filename
end

View File

@ -428,6 +428,17 @@ class CoursesService
result
end
# 课程课件
def course_attachments params
result = []
@course = Course.find(params[:course_id])
@attachments = @course.attachments.order("created_on desc")
@attachments.each do |atta|
result << {:filename => atta.filename,:description => atta.description,:downloads => atta.downloads,:quotes => atta.quotes.nil? ? 0 :atta.quotes }
end
result
end
private
def show_homework_info course,bid,current_user,is_course_teacher
author_real_name = bid.author.lastname + bid.author.firstname

View File

@ -1,3 +1,35 @@
<script type="text/javascript">
document.addEventListener('DOMContentLoaded',function(){
var img = document.getElementsByName('issue_attachment_picture');
function getImgNaturalStyle(img,callback) {
var nWidth, nHeight
if (typeof img.naturalWidth == "undefined"|| img.naturalWidth == 0) { // 现代浏览器
var image = new Image();
image.src = img.src;
nWidth = image.width;
nHeight = image.height;
} else {
nWidth = img.naturalWidth;
nHeight = img.naturalHeight;
}
return [nWidth, nHeight]
}
for(i=0;i<img.length;i++)
{
imgNatural = getImgNaturalStyle(img[i]);
var width = imgNatural[0];
var height = imgNatural[1];
if (width<100)
{
img[i].width = width;
}
if (height<73) {
img[i].height = height;
}
}
});
</script>
<div class="attachments" style="font-weight:normal;">
<% is_float ||= false %>
<% for attachment in attachments %>

View File

@ -66,10 +66,10 @@
</p>
<% end %>
<div class="ni_btn">
<a href="javascript:" class="tijiao" onclick="clickOK();" >
<a href="javascript:" class="tijiao" onclick="clickOK();" style="margin-bottom: 20px;" >
确&nbsp;&nbsp;定
</a>
<a href="javascript:" class="tijiao" onclick="clickCanel();">
<a href="javascript:" class="tijiao" onclick="clickCanel();" style="margin-bottom: 20px;">
取&nbsp;&nbsp;消
</a>
</div>

View File

@ -1,6 +1,6 @@
$('#ajax-modal').html('<%= escape_javascript(render :partial => 'alert_anonyoms', locals: { bid: @bid, totle_size:@totle_size, cur_size:@cur_size, percent:@percent}) %>');
showModal('ajax-modal', '500px');
$('#ajax-modal').css('height','180px');
//$('#ajax-modal').css('height','180px');
$('#ajax-modal').siblings().remove();
$('#ajax-modal').before("<span style='float: right;cursor:pointer;'>" +
"<a href='javascript:' onclick='clickCanel();'><img src='/images/bid/close.png' width='26px' height='26px' /></a></span>");

View File

@ -1,12 +1,3 @@
<script type="text/javascript" xmlns="http://www.w3.org/1999/html">
function submitProjectBoard()
{
if(regexSubject()&&regexContent())
{
$("#message-form").submit();
}
}
</script>
<div class="project_r_h">
<h2 class="project_h2">
<% if User.current.language == "zh"%>
@ -16,20 +7,6 @@
<% end %>
</h2>
</div>
<div id="add-message" class="talk_new ml15" style="display:<%= !@flag.nil?&&@flag=='true' ? '' : 'none' %>;">
<% if User.current.logged? %>
<%= form_for @message, :url => new_board_message_path(@board), :html => {:multipart => true, :id => 'message-form'} do |f| %>
<p class="talk_top"><%= l(:project_module_boards_post) %></p>
<%= render :partial => 'messages/form_project', :locals => {:f => f} %>
<p>
<a href="javascript:void(0)" onclick="submitProjectBoard();" class="blue_btn fl ml55" style="margin-left: 55px"><%= l(:button_submit)%></a>
<%= link_to l(:button_cancel), "#", :onclick => '$("#add-message").hide(); return false;', :class => 'grey_btn ml10 fl' %>
</p>
<% end %>
<div id="preview" class="wiki"></div>
<br/><br/>
<% end %>
</div>
<!--display the board-->
<% if !User.current.logged? %>

View File

@ -23,7 +23,7 @@
<a class="subnav_num">(<%= @project.boards.first.topics.count %>)</a>
<% end %>
<% if User.current.member_of?(@project) %>
<%= link_to "+"+l(:project_module_boards_post), project_boards_path(@project, :flag => true), :layout => 'base_projects', :class => "subnav_green ml105" %>
<%= link_to "+"+l(:project_module_boards_post), new_board_message_path(@project.boards.first), :layout => 'base_projects', :class => "subnav_green ml105" %>
<% end %>
</div>
<% end%>

View File

@ -12,7 +12,7 @@
<a class="subnav_num">(<%= @project.boards.first.topics.count %>)</a>
<% end %>
<% if User.current.member_of?(@project) %>
<%= link_to "+"+l(:project_module_boards_post), project_boards_path(@project, :flag => true), :layout => 'base_projects', :class => "subnav_green ml105" %>
<%= link_to "+"+l(:project_module_boards_post), new_board_message_path(@project.boards.first), :layout => 'base_projects', :class => "subnav_green ml105" %>
<% end %>
</div>
<% end%>

View File

@ -23,7 +23,7 @@
<a class="subnav_num">(<%= @project.boards.first.topics.count %>)</a>
<% end %>
<% if User.current.member_of?(@project) %>
<%= link_to "+"+l(:project_module_boards_post), project_boards_path(@project, :flag => true), :layout => 'base_projects', :class => "subnav_green ml105" %>
<%= link_to "+"+l(:project_module_boards_post), new_board_message_path(@project.boards.first), :layout => 'base_projects', :class => "subnav_green ml105" %>
<% end %>
</div>
<% end%>

View File

@ -16,8 +16,8 @@
<%= link_to "<span class='#{typeclass}'></span>#{text}".html_safe,"javascript:void(0)" ,:onClick => "show_window();", :class => "pr_join_a",:id => "setting_project_type"%>
<% end %>
<!--退出项目-->
<% if (User.current.member_of? @project) && User.current.login? &&
Member.where(:user_id => User.current.id, :project_id => @project.id).first.roles.first.to_s != "Manager" %>
<% if (User.current.member_of? @project) && User.current.login? && !User.current.admin &&
!Member.where(:user_id => User.current.id, :project_id => @project.id).first.roles.first.to_s.include?("Manager") %>
<%= exit_project_link(@project) %>
<% end %>

View File

@ -0,0 +1,28 @@
<div class="project_r_h">
<h2 class="project_h2">
<% if User.current.language == "zh"%>
<%= h @board.name %>
<% else %>
<%= l(:project_module_boards) %>
<% end %>
</h2>
</div>
<div id="cancel-message" class="talk_new ml15">
<% if User.current.logged? %>
<%= form_for @message, :url => new_board_message_path(@board), :html => {:multipart => true, :id => 'message-form'} do |f| %>
<p class="talk_top"><%= l(:project_module_boards_post) %></p>
<%= render :partial => 'messages/form_project', :locals => {:f => f} %>
<p>
<a href="javascript:void(0)" onclick="submitProjectBoard();" class="blue_btn fl ml55" style="margin-left: 55px"><%= l(:button_submit)%></a>
<%= link_to l(:button_cancel), project_boards_path(@project), :class => 'grey_btn ml10 fl' %>
</p>
<% end %>
<div id="preview" class="wiki"></div>
<br/><br/>
<% else %>
<div class="c_grey f14">
<%= l(:label_user_login_project_board) %>
<%= link_to l(:label_user_login_new), signin_path, :class => "c_blue ml5" %>
</div>
<% end %>
</div>

View File

@ -1,16 +1,5 @@
<% if @project %>
<h3>
<%= link_to h(@board.name), :controller => 'boards', :action => 'show', :project_id => @project, :id => @board %>
&#187;
<%= l(:label_message_new) %>
</h3>
<%= form_for @message, :url => {:action => 'new'}, :html => {:multipart => true, :id => 'message-form'} do |f| %>
<%= render :partial => 'form', :locals => {:f => f,:is_new => true} %>
<%= submit_tag l(:button_create), :class => "whiteButton m3p10 h30" %>
<%= preview_link({:controller => 'messages', :action => 'preview', :board_id => @board}, 'message-form' ,target='preview',{:class => 'whiteButton m3p10'} )%>
<% end %>
<div id="preview" class="wiki"></div>
<%= render :partial => 'project_new_topic' %>
<% elsif @course %>
<%= render :partial => 'course_new' %>
<% end %>

View File

@ -18,19 +18,19 @@
<li >
<%= link_to_user_header member.principal,false,:class => "w140_h c_setting_blue fl" %>
<span class="w180_h fl">
<%= h member.roles.sort.collect(&:to_s).join(', ') %>
<%= form_for(member, {:as => :membership, :remote => true, :url => membership_path(member),
:method => :put,
:html => {:id => "member-#{member.id}-roles-form", :class => 'hol'}}
<%= h member.roles.sort.collect(&:to_s).join(', ') %>
<%= form_for(member, {:as => :membership, :remote => true, :url => membership_path(member),
:method => :put,
:html => {:id => "member-#{member.id}-roles-form", :class => 'hol'}}
) do |f| %>
<% roles.each do |role| %>
<% roles.each do |role| %>
<ul style="text-align: left;" >
<%= check_box_tag 'membership[role_ids][]', role.id, member.roles.include?(role),
:disabled => member.member_roles.detect { |mr| mr.role_id == role.id && !mr.inherited_from.nil? } %>
<label ><%= h role %></label>
</ul>
<!--<br/>-->
<% end %>
<% end %>
<%= hidden_field_tag 'membership[role_ids][]', '' %>
<div>
<a href="javascript:void(0)" class="member_btn" onclick="$('#member-<%= member.id%>-roles-form').submit();" style="margin-right: 10px;">
@ -41,7 +41,7 @@
</a>
</div>
<% end %>
</span>
</span>
<% unless member.user_id == @project.user_id %>
<a href="javascript:void(0) " class="c_setting_blue ml30 fl" onclick="$('#member-<%= member.id%>-roles-form').show();$(this).parent().height(110);">编辑</a>
<%= delete_link membership_path(member),

View File

@ -1,7 +1,7 @@
<% if @journal_destroyed.nil? %>
alert('<%=l(:notice_failed_delete)%>');
<% elsif (['Principal','Project','Course', 'Bid', 'Contest', 'Softapplication'].include? @journal_destroyed.jour_type)%>
<% if @bid && @@jours_count %>
<% if @bid && @jours_count %>
$('#jours_count').html("<%= @jours_count %>");
<% elsif @course && @jours_count%>
$('#course_jour_count').html("(<%= @jours_count %>)");

View File

@ -306,4 +306,13 @@ $(document).ready(function () {
$("pre").addClass("break_word");
}
});
});
//论坛提交
function submitProjectBoard()
{
if(regexSubject()&&regexContent())
{
$("#message-form").submit();
}
}

View File

@ -87,7 +87,7 @@ a.pro_mes_w{ height:20px; float:left;display:block; color:#999999;}
.pro_page_top{ font-size:14px; border-bottom:2px solid #64bdd9; margin-bottom:10px; padding-bottom:5px;}
.pro_page_tit{color:#3e4040; font-weight:bold;width:480px; float:left; font-size:14px; margin-bottom:5px;}
.pro_pic_box{ margin-left:60px; }
.pro_pic{ width:100px; border:2px solid #CCC; margin:10px 0;}
.pro_pic{ width:100px; height:73px;line-height:73px;border:2px solid #CCC; margin:10px 0;}
.pro_info_box{ margin-left:60px; background:#f0fbff; height:80px; padding:10px 0;}
.pro_info_box ul{}
.pro_info_box ul li{ margin-bottom:10px;}