Merge branch 'weixin_guange' into develop

This commit is contained in:
yuanke 2016-09-09 16:05:32 +08:00
commit 80ab8801ce
6 changed files with 17 additions and 5 deletions

View File

@ -372,7 +372,8 @@ class ApplicationController < ActionController::Base
return true
end
if allowed
if allowed || (params[:type] && params[:type] == "wechat" )
true
else
if @project && @project.archived?

View File

@ -130,7 +130,12 @@ class AttachmentsController < ApplicationController
def download
# modify by nwb
# 下载添加权限设置
candown = attachment_candown @attachment
if (params[:type] && params[:type] == "wechat" )
candown = true
else
candown = attachment_candown @attachment
end
if candown || User.current.admin? || User.current.id == @attachment.author_id
if stale?(:etag => @attachment.digest)
if params[:preview] == 'true'
@ -710,7 +715,7 @@ class AttachmentsController < ApplicationController
def has_login
unless (@attachment && @attachment.container_type == "Organization").nil?
unless (@attachment && @attachment.container_type == "PhoneAppVersion").nil?
render_403 if !User.current.logged? && !(@attachment.container_type == 'OrgSubfield' && @attachment.container.organization.allow_guest_download) && !(@attachment.container_type == 'OrgDocumentComment' && @attachment.container.organization.allow_guest_download)
render_403 if (!User.current.logged? && !(params[:type] && params[:type] == "wechat")) && !(@attachment.container_type == 'OrgSubfield' && @attachment.container.organization.allow_guest_download) && !(@attachment.container_type == 'OrgDocumentComment' && @attachment.container.organization.allow_guest_download)
end
end
end

View File

@ -230,7 +230,7 @@
</div>
<div ng-class="{'undis': !showResources}">
<div ng-repeat="r in resources|filter:searchText" ng-class="['class-detail-row', 'f13', 'c-grey3', {'border-top': $first}]"><img src="/images/wechat/courseware.png" width="15" class="ml10 fl" /><span class="fl ml10 resource-width">{{r.filename}}</span><a ng-show="isTeacher" herf="javascript:void(0);" class="fr mr10 link-blue2" ng-click="sendFile(r,1)">发送</a><div class="cl"></div></div>
<div ng-repeat="r in resources|filter:searchText" ng-class="['class-detail-row', 'f13', 'c-grey3', {'border-top': $first}]"><img src="/images/wechat/courseware.png" width="15" class="ml10 fl" /><a ng-href="{{g_localhost}}/attachments/download/{{r.id}}/{{r.filename}}?type=wechat" target="_blank" class="fl ml10 resource-width">{{r.filename}}</a><a ng-show="isTeacher" herf="javascript:void(0);" class="fr mr10 link-blue2" ng-click="sendFile(r,1)">发送</a><div class="cl"></div></div>
<p ng-show="resources_tag == true && resources.length<=0" class="class-test-tip">暂无课件,<br />
请登录Trustie网站在PC浏览器中上传课件。</p>
</div>

View File

@ -12,7 +12,7 @@
<div ng-class="{'undis': currentTab!=1}">
<div ng-repeat="r in resources|filter:{filename:searchText}" ng-class="['class-detail-row', 'f13', 'c-grey3', {'border-top': $first}]">
<img src="/images/wechat/courseware.png" width="15" class="ml10 fl" /> <span class="fl ml10 resource-width">{{r.filename}}</span><a ng-show="r.current_user_is_teacher" ng-click="sendFile(r,1)" class="fr mr10 link-blue2">发送</a><div class="cl"></div>
<img src="/images/wechat/courseware.png" width="15" class="ml10 fl" /> <a ng-href="{{g_localhost}}/attachments/download/{{r.id}}/{{r.filename}}?type=wechat" target="_blank" class="fl ml10 resource-width">{{r.filename}}</a><a ng-show="r.current_user_is_teacher" ng-click="sendFile(r,1)" class="fr mr10 link-blue2">发送</a><div class="cl"></div>
<span class="f12 mt5 ml35 c-grey4 fl courseware-from-width hidden">课件来源:{{r.coursename}}</span><span class="f12 ml10 mt5 c-grey4 fl">大小:{{r.attafile_size}}</span><div class="cl"></div>
</div>
<div ng-if="has_more">

View File

@ -6,6 +6,9 @@ app.controller('ClassController', ['$scope', 'config','$http', 'auth','$location
};
var vm = $scope;
vm.g_localhost = window.g_localhost;
var courseid = $routeParams.id;
var tag = $routeParams.tag;

View File

@ -3,6 +3,9 @@ app.controller('MyResourceController', ['$scope', '$http', 'auth', 'config', '$l
var vm = $scope;
// vm.menus = ['课件', '作业', '测验'];
vm.g_localhost = window.g_localhost;
vm.menus = ['课件', '作业'];
vm.resources = [];