组织logo点击可编辑
This commit is contained in:
parent
15ba4a6136
commit
45f0234ff7
|
@ -40,7 +40,7 @@ class AvatarController < ApplicationController
|
|||
@urlfile='/' << File.join("images","avatars",avatar_directory(@source_type),avatar_filename(@source_id,@image_file))
|
||||
|
||||
# 用户头像上传时进行特别处理
|
||||
if @is_direct == '1' && (@source_type == 'User' || @source_type == 'Course' || @source_type == 'Project')
|
||||
if @is_direct == '1' && (@source_type == 'User' || @source_type == 'Course' || @source_type == 'Project' || @source_type == 'Organization')
|
||||
diskfile += "temp"
|
||||
@urlfile += "temp"
|
||||
end
|
||||
|
|
|
@ -96,6 +96,9 @@ class MyController < ApplicationController
|
|||
elsif params[:project]
|
||||
@project = Project.find params[:project]
|
||||
diskfile = disk_filename('Project', @project.id)
|
||||
elsif params[:organization]
|
||||
@organization = Organization.find params[:organization]
|
||||
diskfile = disk_filename('Organization', @organization.id)
|
||||
else
|
||||
@user = User.current
|
||||
diskfile = disk_filename('User', @user.id)
|
||||
|
@ -116,6 +119,9 @@ class MyController < ApplicationController
|
|||
when 'Project'
|
||||
@project = Project.find params[:source_id]
|
||||
diskfile = disk_filename('Project', @project.id)
|
||||
when 'Organization'
|
||||
@organization = Organization.find params[:source_id]
|
||||
diskfile = disk_filename('Organization', @organization.id)
|
||||
end
|
||||
end
|
||||
diskfile1 = diskfile + 'temp'
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
<% if @is_direct == '1' && (@source_type=='User'|| @source_type == 'Course' || @source_type == 'Project') %>
|
||||
<% if @is_direct == '1' && (@source_type=='User'|| @source_type == 'Course' || @source_type == 'Project' || @source_type == 'Organization') %>
|
||||
var imgSpan = $("img[nhname='avatar_image']");
|
||||
imgSpan.attr({"src":'<%= "#{@urlfile.to_s}?#{Time.now.to_i}" %>'});
|
||||
<% else %>
|
||||
|
|
|
@ -13,7 +13,7 @@
|
|||
<%= javascript_heads %>
|
||||
<%= heads_for_theme %>
|
||||
<%= stylesheet_link_tag 'prettify','jquery/jquery-ui-1.9.2','css/common','css/structure','css/public','repository','css/courses','css/org','css/project', 'css/popup' %>
|
||||
<%= javascript_include_tag 'cookie','project', 'organization','header','prettify','select_list_move','org'%>
|
||||
<%= javascript_include_tag 'cookie','project',"avatars", 'organization','header','prettify','select_list_move','org'%>
|
||||
<%= javascript_include_tag 'attachments' %>
|
||||
<%= call_hook :view_layouts_base_html_head %>
|
||||
<!-- page specific tags -->
|
||||
|
@ -78,16 +78,14 @@
|
|||
<!--<%#= image_tag(url_to_avatar(@organization), :width=>"60", :height=>"60", :alt=>"组织logo") %>-->
|
||||
<!--</div>-->
|
||||
<div class="pr_info_logo fl fl mr10 mb5" id="homepage_portrait_image">
|
||||
<%= image_tag(url_to_avatar(@organization),width:"60", height: "60", :id=>'nh_user_tx') %>
|
||||
<% if User.current.logged?%>
|
||||
<% if User.current.id == @organization.creator_id%>
|
||||
<div id="edit_org_file_btn" class="none">
|
||||
<div class="homepageEditProfile">
|
||||
<a href="<%= clear_org_avatar_temp_organization_path(@organization) %>" data-remote="true" class="homepageEditProfileIcon"></a>
|
||||
</div>
|
||||
</div>
|
||||
<% end %>
|
||||
<% end%>
|
||||
<% if User.current.logged? && User.current.admin_of_org?(@organization)%>
|
||||
<%=link_to image_tag(url_to_avatar(@organization),width:"60", height: "60", :id=>'nh_source_tx'), my_clear_user_avatar_temp_path(:organization => @organization.id), :remote => true%>
|
||||
<div class="homepageEditProfile undis">
|
||||
<%=link_to '', my_clear_user_avatar_temp_path(:organization => @organization.id), :remote => true, :class => 'homepageEditProfileIcon', :title => '点击编辑Logo' %>
|
||||
</div>
|
||||
<% else %>
|
||||
<%= image_tag(url_to_avatar(@organization), :width => "60", :height => "60", :alt => "组织logo") %>
|
||||
<% end %>
|
||||
</div>
|
||||
<!--<div class="orgName fl mb5 f14">组织id:<%#= @organization.id %></div>-->
|
||||
<div class="orgName fl mb5 f14" title="<%= @organization.name %>">
|
||||
|
@ -172,6 +170,10 @@
|
|||
<span><%= l(:label_loading) %></span>
|
||||
</div>
|
||||
|
||||
<div id="nh_tx_dialog_html" class="white_content" style="display:none;">
|
||||
<%=render :partial => 'layouts/upload_avatar', :locals => {:source => @organization} %>
|
||||
</div>
|
||||
|
||||
<script type="text/javascript">
|
||||
$("#courseMenu").mouseenter(function(){
|
||||
$("#topnav_course_menu").show();
|
||||
|
|
|
@ -34,9 +34,12 @@
|
|||
<%# 弹框 %>
|
||||
<div id="ajax-modal" style="display:none;"></div>
|
||||
<div id="ajax-indicator" style="display:none;"><span><%= l(:label_loading) %></span></div>
|
||||
<div id="nh_tx_dialog_html" class="white_content" style="display:none;">
|
||||
<%=render :partial => 'layouts/upload_avatar', :locals => {:source => @organization} %>
|
||||
</div>
|
||||
<%= call_hook :view_layouts_base_body_bottom %>
|
||||
<%# JS提前加载 %>
|
||||
<%= javascript_include_tag 'cookie','project', 'organization','header','prettify','select_list_move','org'%>
|
||||
<%= javascript_include_tag 'cookie','project',"avatars", 'organization','header','prettify','select_list_move','org'%>
|
||||
<%= javascript_include_tag 'attachments' %>
|
||||
</body>
|
||||
</html>
|
||||
|
|
|
@ -10,5 +10,15 @@ if($("#course_avatar_form").length > 0) {
|
|||
$("#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 %>
|
||||
}
|
||||
<% elsif @organization %>
|
||||
<% if @organization.show_mode == 1 %>
|
||||
$("#nh_source_tx").replaceWith('<%= image_tag(url_to_avatar(@organization), :id=>'nh_source_tx',:style=>"width:51px;height:51px;overflow:hidden",:alt=>"组织logo") %>');
|
||||
<% else %>
|
||||
$("#nh_source_tx").replaceWith('<%= image_tag(url_to_avatar(@organization), :id=>'nh_source_tx',:style=>"width:60px;height:60px;overflow:hidden",:alt=>"组织logo") %>');
|
||||
<% end %>
|
||||
if($("#org_avatar_form").length > 0) {
|
||||
window.location.href = "<%=setting_organization_path(@organization) %>";
|
||||
}
|
||||
<% end %>
|
||||
hideModal();
|
|
@ -24,7 +24,8 @@
|
|||
: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
|
||||
:source_id => source.id.to_s,
|
||||
:is_direct => 0
|
||||
} %>
|
||||
<!--</span>-->
|
||||
<% content_for :header_tags do %>
|
||||
|
|
|
@ -1,7 +1,15 @@
|
|||
|
||||
<div class="por_header_top">
|
||||
<div class="por_header_con" >
|
||||
<%= image_tag(url_to_avatar(@organization), width:"51", height: "51", :id => 'nh_user_tx', :class => "por_logo fl mt1", :target => "_blank") %>
|
||||
<% if User.current.logged? && User.current.admin_of_org?(@organization)%>
|
||||
<%=link_to image_tag(url_to_avatar(@organization),width:"51", height: "51", :id=>'nh_source_tx'), my_clear_user_avatar_temp_path(:organization => @organization.id), :remote => true%>
|
||||
<div class="homepageEditProfile undis">
|
||||
<%=link_to '', my_clear_user_avatar_temp_path(:organization => @organization.id), :remote => true, :class => 'homepageEditProfileIcon', :title => '点击编辑Logo' %>
|
||||
</div>
|
||||
<% else %>
|
||||
<%= image_tag(url_to_avatar(@organization), :width => "51", :height => "51", :alt => "组织logo") %>
|
||||
<% end %>
|
||||
<%#= image_tag(url_to_avatar(@organization), width:"51", height: "51", :id => 'nh_user_tx', :class => "por_logo fl mt1", :target => "_blank") %>
|
||||
<% if User.current.logged? %>
|
||||
<div class="navHomepageProfile" id="navHomepageProfile">
|
||||
<ul>
|
||||
|
|
|
@ -47,7 +47,9 @@
|
|||
<!--<a href="javascript:void(0);" class="logoEnter fl linkGrey4">上传图片</a>-->
|
||||
<%#= form_for( @organization,{:controller => 'organizations',:action => 'update',:id=>@organization,:html=>{:id=>'update_org_form',:method=>'put'}}) do %>
|
||||
<%= labelled_form_for @organization do |f|%>
|
||||
<%= render :partial=>"new_org_avatar_form",:locals=> {source:@organization} %>
|
||||
<div id="org_avatar_form">
|
||||
<%= render :partial=>"new_org_avatar_form",:locals=> {source:@organization} %>
|
||||
</div>
|
||||
<!--<div class="cl"></div>-->
|
||||
<!--</div>-->
|
||||
<div class="orgRow mb10"><span class="c_red">* </span>组织名称:<input type="text" name="organization[name]" id="organization_name" maxlength="100" onblur="check_uniq(<%=@organization.id %>);" onfocus="$('#check_name_hint').hide()" class="orgNameInput" value="<%= @organization.name%>" />
|
||||
|
|
Loading…
Reference in New Issue