commit
3fabfdb039
@ -0,0 +1,17 @@
|
|||||||
|
<% all_count = @user.favorite_courses.visible.where("is_delete =?", 0).count%>
|
||||||
|
<div id="homepageLeftMenuCourses">
|
||||||
|
<ul class="user_sub_menu" id="user_courses_li">
|
||||||
|
<%= render :partial => 'layouts/user_courses', :locals => {:courses => courses,:user => @user,:all_count => all_count,:page => 0} %>
|
||||||
|
</ul>
|
||||||
|
</div>
|
||||||
|
<% if !courses.empty? %>
|
||||||
|
<a class="user_navmorebox" href="javascript:void(0);" id="user_hide_course" onclick="leftCourseslistChange();">
|
||||||
|
<span id="hide_show_courseicon" class="user_icons_closeclass"></span>
|
||||||
|
</a>
|
||||||
|
<% end %>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
$(function() {
|
||||||
|
$('#user_hide_course').hide();
|
||||||
|
})
|
||||||
|
</script>
|
@ -0,0 +1,17 @@
|
|||||||
|
<% all_count = @user.favorite_projects.visible.count%>
|
||||||
|
<div id="homepageLeftMenuForge">
|
||||||
|
<ul class="user_sub_menu" id="user_projects_li">
|
||||||
|
<%= render :partial => 'layouts/user_projects', :locals => {:projects => projects,:user => @user, :all_count => all_count, :page => 0} %>
|
||||||
|
</ul>
|
||||||
|
</div>
|
||||||
|
<% if !projects.empty? %>
|
||||||
|
<a class="user_navmorebox" href="javascript:void(0);" id="user_hide_project" onclick="leftProjectslistChange();">
|
||||||
|
<span id="hide_show_projecticon" class="user_icons_closeclass"></span>
|
||||||
|
</a>
|
||||||
|
<% end %>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
$(function() {
|
||||||
|
$('#user_hide_project').hide();
|
||||||
|
})
|
||||||
|
</script>
|
@ -0,0 +1,44 @@
|
|||||||
|
<div>
|
||||||
|
<div><a href="javascript:hideModal();" class="box_close"></a></div>
|
||||||
|
<div class="cl"></div>
|
||||||
|
<div class="pro_new">
|
||||||
|
<h3 class="box_h3 mb10">头像设置</h3>
|
||||||
|
<div class="uppicBox">
|
||||||
|
<input type="button" class="uppic_btn" onclick="$('#upload_avatar').click();" value="浏览.."/>
|
||||||
|
<%= file_field_tag 'avatar[image]',
|
||||||
|
:id => "upload_avatar",
|
||||||
|
:style => 'display:none;',#added by young
|
||||||
|
:size => "1",
|
||||||
|
:multiple => false,
|
||||||
|
:onchange => 'addInputAvatar(this);',
|
||||||
|
:data => {
|
||||||
|
:max_file_size => Setting.attachment_max_size.to_i.kilobytes,
|
||||||
|
:max_file_size_message => l(:error_attachment_too_big, :max_size => number_to_human_size(Setting.attachment_max_size.to_i.kilobytes)),
|
||||||
|
:max_concurrent_uploads => Redmine::Configuration['max_concurrent_ajax_uploads'].to_i,
|
||||||
|
:file_type => Redmine::Configuration['pic_types'].to_s,
|
||||||
|
:type_support_message => l(:error_pic_type),
|
||||||
|
:upload_path => upload_avatar_path(:format => 'js'),
|
||||||
|
:description_placeholder => nil ,# l(:label_optional_description)
|
||||||
|
:source_type => source.class.to_s,
|
||||||
|
:source_id => source.id.to_s,
|
||||||
|
:is_direct => 1
|
||||||
|
} %>
|
||||||
|
<!--<br/>-->
|
||||||
|
<!--<span>只支持jpg,png,gif,大小不超过5M</span>-->
|
||||||
|
</div>
|
||||||
|
<div class="showpicBox">
|
||||||
|
<p>预览</p>
|
||||||
|
<%= image_tag(url_to_avatar(source), :style=>"width:96px;height:96px;",:class=>"mb5 mt10",:nhname=>'avatar_image') %>
|
||||||
|
<br/>
|
||||||
|
<span >96px*96px</span> <br />
|
||||||
|
<div class="mb20"></div>
|
||||||
|
<%= image_tag(url_to_avatar(source), :style=>"width:48px;height:48px;",:class=>"mb5",:nhname=>'avatar_image') %>
|
||||||
|
<br />
|
||||||
|
<span>48px*48px</span> <br />
|
||||||
|
</div>
|
||||||
|
<div class="cl mb10"></div>
|
||||||
|
<a href="javascript:hideModal();" class=" fr grey_btn mr15 f14"> 取 消</a>
|
||||||
|
<a href="<%= url_for(:controller => 'my', :action => 'save_user_avatar', :source_id => source.id, :source_type => source.class.to_s) %>" data-remote="true" class="blue_btn fr mr10 f14">确 定</a>
|
||||||
|
</div><!--talknew end-->
|
||||||
|
<div class="cl"></div>
|
||||||
|
</div><!--floatbox end-->
|
@ -1,3 +1,14 @@
|
|||||||
$("#nh_user_tx").replaceWith('<%= image_tag(url_to_avatar(@user), :id=>'nh_user_tx',:style=>"width:78px;height:78px;overflow:hidden",:alt=>"头像") %>');
|
<% if @user %>
|
||||||
|
$("#nh_source_tx").replaceWith('<%= image_tag(url_to_avatar(@user), :id=>'nh_source_tx',:style=>"width:78px;height:78px;overflow:hidden",:alt=>"头像") %>');
|
||||||
$("#nh_user_logo").replaceWith('<%= image_tag(url_to_avatar(@user), :id=>'nh_user_logo',:width =>"40",:height => "40",:alt=>"头像") %>');
|
$("#nh_user_logo").replaceWith('<%= image_tag(url_to_avatar(@user), :id=>'nh_user_logo',:width =>"40",:height => "40",:alt=>"头像") %>');
|
||||||
|
<% elsif @course %>
|
||||||
|
$("#nh_source_tx").replaceWith('<%= image_tag(url_to_avatar(@course), :id=>'nh_source_tx',:style=>"width:96px;height:96px;overflow:hidden",:alt=>"班级logo") %>');
|
||||||
|
if($("#course_avatar_form").length > 0) {
|
||||||
|
window.location.href = "<%=settings_course_path(@course) %>";
|
||||||
|
}
|
||||||
|
<% elsif @project %>
|
||||||
|
$("#nh_source_tx").replaceWith('<%= image_tag(url_to_avatar(@project), :id=>'nh_source_tx',:style=>"width:60px;height:60px;overflow:hidden",:alt=>"项目logo") %>');
|
||||||
|
if($("#project_avatar_form").length > 0) {
|
||||||
|
window.location.href = "<%=settings_project_path(@project) %>";
|
||||||
|
}<% end %>
|
||||||
hideModal();
|
hideModal();
|
@ -0,0 +1,10 @@
|
|||||||
|
<% member = Member.where("user_id = #{@user.id} and course_id = #{course.id}").first %>
|
||||||
|
<% if User.current == @user %>
|
||||||
|
<% if member %>
|
||||||
|
<%= link_to "", cancel_or_collect_user_path(@user, :course => course.id), :class => "#{member.is_collect == 1 ? 'icons_sy_favorite' : 'icons_sy_star'}",:target => '_blank', :remote => true, :title => "#{member.is_collect == 1 ? '点击将其从个人主页的班级列表中移除' : '点击将其添加至个人主页的班级列表中'}" %>
|
||||||
|
<% end %>
|
||||||
|
<% else %>
|
||||||
|
<% if member %>
|
||||||
|
<span class="<%= member.is_collect == 1 ? 'icons_sy_favorite' : 'icons_sy_star'%>"></span>
|
||||||
|
<% end %>
|
||||||
|
<% end %>
|
@ -0,0 +1,10 @@
|
|||||||
|
<% member = Member.where("user_id = #{@user.id} and project_id = #{project.id}").first %>
|
||||||
|
<% if User.current == @user %>
|
||||||
|
<% if member %>
|
||||||
|
<%= link_to "", cancel_or_collect_user_path(@user, :project => project.id), :class => "#{member.is_collect == 1 ? 'icons_project_favorite mt3' : 'icons_project_star mt3'}",:target => '_blank', :remote => true, :title => "#{member.is_collect == 1 ? '点击将其从个人主页的班级列表中移除' : '点击将其添加至个人主页的班级列表中'}" %>
|
||||||
|
<% end %>
|
||||||
|
<% else %>
|
||||||
|
<% if member %>
|
||||||
|
<span class="<%= member.is_collect == 1 ? 'icons_project_favorite mt3' : 'icons_project_star mt3'%>"></span>
|
||||||
|
<% end %>
|
||||||
|
<% end %>
|
@ -0,0 +1,11 @@
|
|||||||
|
<% if @course %>
|
||||||
|
$("#homepage_left_course_list").html("<%= escape_javascript(render :partial => 'layouts/homepage_left_course_list', :locals => {:courses => @courses}) %>");
|
||||||
|
if($("#collect_course_icon_<%=@course.id %>").length > 0){
|
||||||
|
$("#collect_course_icon_<%=@course.id %>").html("<%= escape_javascript(render :partial => 'users/collect_course', :locals => {:course => @course}) %>");
|
||||||
|
}
|
||||||
|
<% elsif @project %>
|
||||||
|
$("#homepage_left_project_list").html("<%= escape_javascript(render :partial => 'layouts/homepage_left_project_list', :locals => {:projects => @projects}) %>");
|
||||||
|
if($("#collect_project_icon_<%=@project.id %>").length > 0){
|
||||||
|
$("#collect_project_icon_<%=@project.id %>").html("<%= escape_javascript(render :partial => 'users/collect_project', :locals => {:project => @project}) %>");
|
||||||
|
}
|
||||||
|
<% end %>
|
@ -0,0 +1,5 @@
|
|||||||
|
class AddIsCollectToMembers < ActiveRecord::Migration
|
||||||
|
def change
|
||||||
|
add_column :members, :is_collect, :integer, :default => 1
|
||||||
|
end
|
||||||
|
end
|
@ -0,0 +1,14 @@
|
|||||||
|
<div class="post-container">
|
||||||
|
<div loading-spinner></div>
|
||||||
|
|
||||||
|
<div class="blue-title">{{current_course.name}}</div>
|
||||||
|
<div class="course-list-row f13 c-grey3 mt30"><span class="fl ml15 c-grey3">标题</span><input class="new-class-input ml25" ng-model="issuetitle" placeholder="发起讨论,请先输入标题(限128字符)" maxlength="128"></div>
|
||||||
|
<div class="full-width-wrap mt15 mb50"><textarea class="full-width-textarea" ng-model="issue" placeholder="请输入您的讨论内容~"></textarea></div>
|
||||||
|
<div class="bottom-tab-wrap mt10">
|
||||||
|
<a ng-click="cancel()" class="weixin-tab c-grey border-top">取消</a>
|
||||||
|
<a ng-click="publishIssue()" class="weixin-tab link-blue2 border-top">确定</a>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<!--<div ng-show="!current_course" class="blue-title">{{tip_1}}</div>-->
|
||||||
|
<my-alert message="alertService.message" title="alertService.title" visible="alertService.visible" cb="alertService.cb"></my-alert>
|
||||||
|
</div>
|
@ -0,0 +1,14 @@
|
|||||||
|
<div class="post-container">
|
||||||
|
<div loading-spinner></div>
|
||||||
|
|
||||||
|
<div class="blue-title">{{current_course.name}}</div>
|
||||||
|
<div class="course-list-row f13 c-grey3 mt30"><span class="fl ml15 c-grey3">标题</span><input class="new-class-input ml25" ng-model="noticetitle" placeholder="发布通知,请先输入标题(限64字符)" maxlength="64"></div>
|
||||||
|
<div class="full-width-wrap mt15 mb50"><textarea class="full-width-textarea" ng-model="notice" placeholder="请输入您的通知内容~"></textarea></div>
|
||||||
|
<div class="bottom-tab-wrap mt10">
|
||||||
|
<a ng-click="cancel()" class="weixin-tab c-grey border-top">取消</a>
|
||||||
|
<a ng-click="publishNotice()" class="weixin-tab link-blue2 border-top">确定</a>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<!--<div ng-show="!current_course" class="blue-title">{{tip_1}}</div>-->
|
||||||
|
<my-alert message="alertService.message" title="alertService.title" visible="alertService.visible" cb="alertService.cb"></my-alert>
|
||||||
|
</div>
|
@ -0,0 +1,14 @@
|
|||||||
|
<div class="post-container">
|
||||||
|
<div loading-spinner></div>
|
||||||
|
|
||||||
|
<div class="blue-title">{{current_project.name}}</div>
|
||||||
|
<div class="course-list-row f13 c-grey3 mt30"><span class="fl ml15 c-grey3">标题</span><input class="new-class-input ml25" ng-model="notetitle" placeholder="发布帖子,请先输入帖子标题(限128字符)" maxlength="128"></div>
|
||||||
|
<div class="full-width-wrap mt15 mb50"><textarea class="full-width-textarea" ng-model="note" placeholder="请输入您的帖子内容~"></textarea></div>
|
||||||
|
<div class="bottom-tab-wrap mt10">
|
||||||
|
<a ng-click="cancel()" class="weixin-tab c-grey border-top">取消</a>
|
||||||
|
<a ng-click="publishNote()" class="weixin-tab link-blue2 border-top">确定</a>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<!--<div ng-show="!current_course" class="blue-title">{{tip_1}}</div>-->
|
||||||
|
<my-alert message="alertService.message" title="alertService.title" visible="alertService.visible" cb="alertService.cb"></my-alert>
|
||||||
|
</div>
|
After Width: | Height: | Size: 18 KiB |
@ -0,0 +1,73 @@
|
|||||||
|
app.controller('ClassPublishIssueController', ['$scope', '$http', 'auth', 'config', 'alertService','$location','$routeParams','rms','common', function($scope, $http, auth, config, alertService, $location,$routeParams, rms,common){
|
||||||
|
// common.checkLogin();
|
||||||
|
|
||||||
|
var vm = $scope;
|
||||||
|
vm.current_course = rms.get('current_course');
|
||||||
|
|
||||||
|
vm.issuetitle = "";
|
||||||
|
vm.issue = "";
|
||||||
|
var course_id = $routeParams.id;
|
||||||
|
|
||||||
|
vm.alertService = alertService.create();
|
||||||
|
|
||||||
|
if(!vm.current_course){
|
||||||
|
$http.get(config.apiUrl+ 'courses/'+course_id+"?token="+auth.token()).then(
|
||||||
|
function(response) {
|
||||||
|
console.log(response.data);
|
||||||
|
if (response.data.status == 0){
|
||||||
|
vm.current_course = response.data.data;
|
||||||
|
console.log("courses");
|
||||||
|
console.log(response.data.data);
|
||||||
|
}
|
||||||
|
else{
|
||||||
|
vm.alertService.showMessage('提示', response.data.message);
|
||||||
|
}
|
||||||
|
if(!vm.current_course){
|
||||||
|
vm.tip_1 = "该班级不存在或已被删除";
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
vm.cancel = function(){
|
||||||
|
window.history.back();
|
||||||
|
};
|
||||||
|
|
||||||
|
//发布问题 即项目讨论区
|
||||||
|
vm.publishIssue = function(){
|
||||||
|
if(vm.issuetitle.length == 0)
|
||||||
|
{
|
||||||
|
vm.alertService.showMessage('提示', '标题不能为空');
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if(vm.issue.length == 0)
|
||||||
|
{
|
||||||
|
vm.alertService.showMessage('提示', '内容不能为空');
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
var text = vm.issue.replace(/\n/g,'<br/>');
|
||||||
|
|
||||||
|
$http.post(config.apiUrl + "courses/"+course_id+"/publishissue",
|
||||||
|
{token: auth.token(),title: vm.issuetitle, text: text}
|
||||||
|
).then(function(response){
|
||||||
|
if(response.data.status == 0)
|
||||||
|
{
|
||||||
|
vm.alertService.showMessage('提示', '您已成功发布问题',function(){
|
||||||
|
rms.save('course_activities_page',0);
|
||||||
|
rms.save("course_activities",[]);
|
||||||
|
rms.save("course_has_more",false);
|
||||||
|
$location.path("/class").search({id: course_id});
|
||||||
|
});
|
||||||
|
}
|
||||||
|
else{
|
||||||
|
vm.alertService.showMessage('提示', response.data.message);
|
||||||
|
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
}] );
|
@ -0,0 +1,72 @@
|
|||||||
|
app.controller('ClassPublishNoticeController', ['$scope', '$http', 'auth', 'config', 'alertService','$location','$routeParams','rms','common', function($scope, $http, auth, config, alertService, $location,$routeParams, rms,common){
|
||||||
|
// common.checkLogin();
|
||||||
|
|
||||||
|
var vm = $scope;
|
||||||
|
vm.current_course = rms.get('current_course');
|
||||||
|
|
||||||
|
var course_id = $routeParams.id;
|
||||||
|
|
||||||
|
vm.alertService = alertService.create();
|
||||||
|
|
||||||
|
vm.noticetitle = "";
|
||||||
|
vm.notice = "";
|
||||||
|
|
||||||
|
if(!vm.current_course){
|
||||||
|
$http.get(config.apiUrl+ 'courses/'+course_id+"?token="+auth.token()).then(
|
||||||
|
function(response) {
|
||||||
|
console.log(response.data);
|
||||||
|
if (response.data.status == 0){
|
||||||
|
vm.current_course = response.data.data;
|
||||||
|
console.log("courses");
|
||||||
|
console.log(response.data.data);
|
||||||
|
}
|
||||||
|
else{
|
||||||
|
vm.alertService.showMessage('提示', response.data.message);
|
||||||
|
}
|
||||||
|
if(!vm.current_course){
|
||||||
|
vm.tip_1 = "该班级不存在或已被删除";
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
);
|
||||||
|
}
|
||||||
|
vm.cancel = function(){
|
||||||
|
window.history.back();
|
||||||
|
};
|
||||||
|
|
||||||
|
//发布通知 只有老师能发布
|
||||||
|
vm.publishNotice = function(){
|
||||||
|
if(vm.noticetitle.length == 0)
|
||||||
|
{
|
||||||
|
vm.alertService.showMessage('提示', '标题不能为空');
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if(vm.notice.length == 0)
|
||||||
|
{
|
||||||
|
vm.alertService.showMessage('提示', '内容不能为空');
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
var text = vm.notice.replace(/\n/g,'<br/>');
|
||||||
|
|
||||||
|
$http.post(config.apiUrl + "courses/"+course_id+"/publishnotice",
|
||||||
|
{token: auth.token(),title: vm.noticetitle, text: text}
|
||||||
|
).then(function(response){
|
||||||
|
if(response.data.status == 0)
|
||||||
|
{
|
||||||
|
vm.alertService.showMessage('提示', '您已成功发布通知',function(){
|
||||||
|
rms.save('course_activities_page',0);
|
||||||
|
rms.save("course_activities",[]);
|
||||||
|
rms.save("course_has_more",false);
|
||||||
|
$location.path("/class").search({id: course_id});
|
||||||
|
});
|
||||||
|
}
|
||||||
|
else{
|
||||||
|
vm.alertService.showMessage('提示', response.data.message);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
}] );
|
@ -0,0 +1,74 @@
|
|||||||
|
app.controller('ProjectPublishNoteController', ['$scope', '$http', 'auth', 'config', 'alertService','$location','$routeParams','rms','common', function($scope, $http, auth, config, alertService, $location,$routeParams, rms,common){
|
||||||
|
// common.checkLogin();
|
||||||
|
|
||||||
|
var vm = $scope;
|
||||||
|
vm.current_project = rms.get('current_project');
|
||||||
|
|
||||||
|
var project_id = $routeParams.id;
|
||||||
|
|
||||||
|
vm.alertService = alertService.create();
|
||||||
|
|
||||||
|
vm.notetitle = "";
|
||||||
|
vm.note = "";
|
||||||
|
|
||||||
|
if(!vm.current_project){
|
||||||
|
$http.get(config.apiUrl+ 'projects/'+project_id+"?token="+auth.token()).then(
|
||||||
|
function(response) {
|
||||||
|
console.log(response.data);
|
||||||
|
if (response.data.status == 0){
|
||||||
|
vm.current_project = response.data.data;
|
||||||
|
console.log("projects");
|
||||||
|
console.log(response.data.data);
|
||||||
|
}
|
||||||
|
else{
|
||||||
|
vm.alertService.showMessage('提示', response.data.message);
|
||||||
|
}
|
||||||
|
|
||||||
|
if(!vm.current_project){
|
||||||
|
vm.tip_1 = "该项目不存在或已被删除";
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
);
|
||||||
|
}
|
||||||
|
vm.cancel = function(){
|
||||||
|
window.history.back();
|
||||||
|
};
|
||||||
|
|
||||||
|
//发布通知 只有老师能发布
|
||||||
|
vm.publishNote = function(){
|
||||||
|
if(vm.notetitle.length == 0)
|
||||||
|
{
|
||||||
|
vm.alertService.showMessage('提示', '标题不能为空');
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if(vm.note.length == 0)
|
||||||
|
{
|
||||||
|
vm.alertService.showMessage('提示', '内容不能为空');
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
var text = vm.note.replace(/\n/g,'<br/>');
|
||||||
|
|
||||||
|
$http.post(config.apiUrl + "projects/"+project_id+"/publishnote",
|
||||||
|
{token: auth.token(),title: vm.notetitle, text: text}
|
||||||
|
).then(function(response){
|
||||||
|
if(response.data.status == 0)
|
||||||
|
{
|
||||||
|
vm.alertService.showMessage('提示', '您已成功发布帖子',function(){
|
||||||
|
rms.save('project_activities_page',0);
|
||||||
|
rms.save("project_activities",[]);
|
||||||
|
rms.save("project_has_more",false);
|
||||||
|
rms.save('tab_num',null);
|
||||||
|
$location.path("/project").search({id: project_id});
|
||||||
|
});
|
||||||
|
}
|
||||||
|
else{
|
||||||
|
vm.alertService.showMessage('提示', response.data.message);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
}] );
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in new issue