diff --git a/Client.html b/Client.html index 5ba9775f1..fbb7cec52 100644 --- a/Client.html +++ b/Client.html @@ -1,4 +1,4 @@ - + @@ -8,15 +8,15 @@ Client <body> <hr /> - <h2>һͼƬ</h2> + <h2>这是一张图片</h2> <p>photo<a href="http://10.0.47.15:3000/shares/new?access_token='2d3dda45dsd'&comment='verygood'&title=davide&share_type=1&url=http://www.baidu.com"> Share A </a></p> <hr /> - <h2>һƵ</h2> + <h2>这是一段视频</h2> <p>Text<a href="http://10.0.47.15:3000/shares/new?access_token=2d3dda45dsd&comment=verygood&title=kaka&share_type=2&url=http://www.sina.com"> Share B </a></p> <hr /> - <h2>һƪ</h2> + <h2>这是一篇文章</h2> <p>Text<a href="http://10.0.47.15:3000/shares/new?access_token=2d3dda45dsd&comment=verygood&title=pepe&share_type=3&url=http://www.sina.com"> Share C </a></p> <hr /> diff --git a/app/controllers/attachments_controller.rb b/app/controllers/attachments_controller.rb index 900487364..d6c90ccf4 100644 --- a/app/controllers/attachments_controller.rb +++ b/app/controllers/attachments_controller.rb @@ -224,4 +224,11 @@ private referer = request.headers['Referer'] require_login unless referer =~ /softapplication/ end + + def renderTag + @attachmentNew = Attachment.find(params[:attchmentId]) + respond_to do |format| + format.js + end + end end diff --git a/app/views/attachments/_form.html.erb b/app/views/attachments/_form.html.erb index f05c4e9b0..bdf65a96f 100644 --- a/app/views/attachments/_form.html.erb +++ b/app/views/attachments/_form.html.erb @@ -6,6 +6,7 @@ <%= text_field_tag("attachments[p#{i}][description]", attachment.description, :maxlength => 255, :placeholder => l(:label_optional_description), :class => 'description', :style=>"display: inline-block;") + link_to(' '.html_safe, attachment_path(attachment, :attachment_id => "p#{i}", :format => 'js'), :method => 'delete', :remote => true, :class => 'remove-upload') %> + <%= render :partial => 'tags/tag', :locals => {:obj => attachment, :object_flag => "6"} %> <%= hidden_field_tag "attachments[p#{i}][token]", "#{attachment.token}" %> </span> <% end %> diff --git a/app/views/attachments/renderTag.js.erb b/app/views/attachments/renderTag.js.erb new file mode 100644 index 000000000..7e45299d5 --- /dev/null +++ b/app/views/attachments/renderTag.js.erb @@ -0,0 +1,3 @@ +<%if @attachmentNew != nil%> +$("#div-attachments[" + @attachmentNew.id + "]").html('<%= j(render :partial => 'tags/tag', :locals => {:obj => @attachmentNew, :object_flag => "6"})%>'); +<%end%> diff --git a/app/views/attachments/upload.js.erb b/app/views/attachments/upload.js.erb index 82b79bb63..63492688a 100644 --- a/app/views/attachments/upload.js.erb +++ b/app/views/attachments/upload.js.erb @@ -11,4 +11,6 @@ fileSpan.find('a.remove-upload') "href": '<%= j attachment_path(@attachment, :attachment_id => params[:attachment_id], :format => 'js') %>' }) .off('click'); +var divattach = fileSpan.find('div.div_attachments'); +divattach.html('<%= j(render :partial => 'tags/tag', :locals => {:obj => @attachment, :object_flag => "6"})%>'); <% end %> diff --git a/app/views/layouts/_base_footer.html.erb b/app/views/layouts/_base_footer.html.erb index ee7bcecf0..baf438cb2 100644 --- a/app/views/layouts/_base_footer.html.erb +++ b/app/views/layouts/_base_footer.html.erb @@ -1,6 +1,6 @@ <!--add by huang--> <div class="clearfix"></div> -<div id="footer" style="margin-left:-5px;padding-top: 150px;clear: both;font-size: 12px;"> +<div id="footer" style="margin-left:-5px;padding-top: 20px;clear: both;font-size: 12px;"> <div style="border-top:solid 1px #C6E9F1;"></div> <div class="base_footer"> <div align="center"> diff --git a/app/views/tags/_tag.html.erb b/app/views/tags/_tag.html.erb index 205143924..dc94b3571 100644 --- a/app/views/tags/_tag.html.erb +++ b/app/views/tags/_tag.html.erb @@ -47,7 +47,7 @@ <%= form_for "tag_for_save",:remote=>true,:url=>tag_path, :update => "tags_show", :complete => "$(\"#put-tag-form-#{obj.class}-#{obj.id}\").hide();" do |f| %> - <%= f.text_field :name ,:id => "name",:size=>"28",:require=>true,:maxlength => Setting.tags_max_length,:minlength=>Setting.tags_min_length %> + <%= f.text_field :name ,:id => "name",:size=>"28",:require=>true,:maxlength => Setting.tags_max_length,:minlength=>Setting.tags_min_length,:style=>"width: 100px;"%> <%= f.text_field :object_id,:value=> obj.id,:style=>"display:none"%> <%= f.text_field :object_flag,:value=> object_flag,:style=>"display:none"%> <%= f.submit l(:button_project_tags_add),:class => "small" %> diff --git a/app/views/welcome/contest.html.erb b/app/views/welcome/contest.html.erb index 65c96e4d0..ab56e4f73 100644 --- a/app/views/welcome/contest.html.erb +++ b/app/views/welcome/contest.html.erb @@ -9,8 +9,23 @@ $(function(){ $("#main").find("a").attr("target", "_blank"); + setCss(); }); - + + //设置div居中 + function setCss() + { + var mainBar = $('#main-content-bar')[0]; + var topHeight = mainBar.offsetHeight; + var welcomeLeft = $('#welcome_left')[0]; + var leftHeight = welcomeLeft.offsetHeight; + var searchbar = $('#J_Slide')[0]; + var searchHeight = searchbar.offsetHeight; + welcomeLeft.style.marginTop = (topHeight - leftHeight)/2 + "px"; + searchbar.style.marginTop = (topHeight - searchHeight)/2 + "px"; + //alert((topHeight - leftHeight)/2 ); + } + function showInfo(id, content) { var text = $('#' + id); if (text.val() == '') { @@ -96,12 +111,12 @@ <%= image_tag '/images/qrweixin.jpg', size: '150x150', alt: 'trustie', class: "weixin" %> <div class="weixin-content">微信扫码</div> </div> - <div class="main-content-bar"> + <div class="main-content-bar" id="main-content-bar"> <!--文字--> <div style="float: left"> <%= image_tag '/images/transparent.png', size: "75x75" %> </div> - <div class="welcome_left" > + <div class="welcome_left" id="welcome_left"> <span class="font_welcome_trustie"><%= l(:label_welcome_trustie) %><%= l(:label_welcome_trustie_contest) %></span> <span class="font_welcome_tdescription">, <%= l(:label_welcome_trustie_contest_description) %></span> </div> diff --git a/app/views/welcome/course.html.erb b/app/views/welcome/course.html.erb index eef2401f8..8b1a9d9ee 100644 --- a/app/views/welcome/course.html.erb +++ b/app/views/welcome/course.html.erb @@ -5,8 +5,22 @@ $(function(){ $("#main").find("a").attr("target", "_blank"); + setCss(); }); + //设置div居中 + function setCss() + { + var mainBar = $('#main-content-bar')[0]; + var topHeight = mainBar.offsetHeight; + var welcomeLeft = $('#welcome_left')[0]; + var leftHeight = welcomeLeft.offsetHeight; + var searchbar = $('#search-bar')[0]; + var searchHeight = searchbar.offsetHeight; + welcomeLeft.style.marginTop = (topHeight - leftHeight)/2 + "px"; + searchbar.style.marginTop = (topHeight - searchHeight)/2 + "px"; + //alert((topHeight - leftHeight)/2 ); + } // 给主页用户弹新页面 $(document).ready(function($) { $("#loggedas").find("a").attr("target", "_blank"); @@ -19,13 +33,12 @@ <%= image_tag '/images/qrweixin.jpg', size: '150x150', alt: 'trustie', class: "weixin" %> <div class="weixin-content">微信扫码</div> </div> - <div class="main-content-bar"> + <div class="main-content-bar" id="main-content-bar"> <div style="float: left"> <%= image_tag(@logoLink, size:'75x75') %> </div> - <div class="course welcome_left" > - <br /> + <div class="course welcome_left" id="welcome_left" > <span class="font_welcome_school"> <% if params[:school_id].nil? and User.current.user_extensions.school.nil? %> <% else%> <% if params[:school_id] == "0" %> @@ -48,7 +61,7 @@ <% end %> <% end %> </div> - <div class="search-bar"> + <div class="search-bar" id="search-bar"> <%= render :partial => "search_project", :locals => {:project_type => Project::ProjectType_course}%> </div> <div style="clear: both;"></div> diff --git a/app/views/welcome/index.html.erb b/app/views/welcome/index.html.erb index 0a69b1f78..bb2d6cd36 100644 --- a/app/views/welcome/index.html.erb +++ b/app/views/welcome/index.html.erb @@ -4,8 +4,21 @@ $(function(){ $("#main").find("a").attr("target", "_blank"); + setCss(); }); - + //设置div居中 + function setCss() + { + var mainBar = $('#main-content-bar')[0]; + var topHeight = mainBar.offsetHeight; + var welcomeLeft = $('#welcome_left')[0]; + var leftHeight = welcomeLeft.offsetHeight; + var searchbar = $('#search-bar')[0]; + var searchHeight = searchbar.offsetHeight; + welcomeLeft.style.marginTop = (topHeight - leftHeight)/2 + "px"; + searchbar.style.marginTop = (topHeight - searchHeight)/2 + "px"; + //alert((topHeight - leftHeight)/2 ); + } // 给主页用户弹新页面 $(document).ready(function($) { $("#loggedas").find("a").attr("target", "_blank"); @@ -18,14 +31,14 @@ <%= link_to image_tag('/images/qrweixin.jpg', size: '150x150', alt: 'trustie', class: "weixin" ), home_path %> <div class="weixin-content">微信扫码</div> </div> - <div class="main-content-bar"> + <div class="main-content-bar" id="main-content-bar"> <div style="float: left"> <%= image_tag '/images/transparent.png', size: "75x75" %> </div> - <div class="welcome_left" > + <div class="welcome_left" id="welcome_left"> <span class="font_welcome_trustie"><%= l(:label_welcome_trustie) %><%= l(:label_welcome_trustie_project) %></span> <span class="font_welcome_tdescription">, <%= l(:label_welcome_trustie_project_description) %></span> </div> - <div class="search-bar"> + <div class="search-bar" id="search-bar"> <%= render :partial => "search_project", :locals => {:project_type => 0}%> </div> <div style="clear: both;"></div> diff --git a/config/routes.rb b/config/routes.rb index ea1b70e35..fe8be3ee8 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -40,6 +40,7 @@ RedmineApp::Application.routes.draw do end mount SeemsRateable::Engine => '/rateable', :as => :rateable + namespace :zipdown do match 'assort' end @@ -461,9 +462,11 @@ RedmineApp::Application.routes.draw do get 'attachments/autocomplete' match 'attachments/autocomplete', :to => 'attachments#autocomplete', via: [:post] post 'attachments/relationfile', to: 'attachments#add_exist_file_to_project', as: 'attach_relation' + get 'attachments/renderTag/:attchmentId', :to => 'attachments#renderTag', :attchmentId => /\d+/ resources :attachments, :only => [:show, :destroy] do collection do match "updateType" , via: [:get, :post] + match "renderTag" , via: [:get, :post] end end diff --git a/public/javascripts/attachments.js b/public/javascripts/attachments.js index 3d1520f84..663183b9a 100644 --- a/public/javascripts/attachments.js +++ b/public/javascripts/attachments.js @@ -1,6 +1,17 @@ /* Redmine - project management software Copyright (C) 2006-2013 Jean-Philippe Lang */ +function postUpMsg(attachmentId) +{ + $.ajax({ + url: '/attachments/renderTag', + type: "GET", + data: { + attachmentId: attachmentId + } + + }) +} function addFile(inputEl, file, eagerUpload) { if ($('#attachments_fields').children().length < 10) { @@ -12,14 +23,15 @@ function addFile(inputEl, file, eagerUpload) { fileSpan.append( $('<input>', { 'type': 'text', 'class': 'filename readonly', 'name': 'attachments[' + attachmentId + '][filename]', 'readonly': 'readonly'} ).val(file.name), $('<input>', { 'type': 'text', 'class': 'description', 'name': 'attachments[' + attachmentId + '][description]', 'maxlength': 255, 'placeholder': $(inputEl).data('description-placeholder') } ).toggle(!eagerUpload), - $('<a> </a>').attr({ 'href': "#", 'class': 'remove-upload', 'data-confirm' : "您确定要删除吗?" }).click(removeFile).toggle(!eagerUpload) + $('<a> </a>').attr({ 'href': "#", 'class': 'remove-upload', 'data-confirm' : "您确定要删除吗?" }).click(removeFile).toggle(!eagerUpload), + $('<div>', { 'class': 'div_attachments', 'name': 'div_'+'attachments_' + attachmentId} ) ).appendTo('#attachments_fields'); - - if(eagerUpload) { - ajaxUpload(file, attachmentId, fileSpan, inputEl); - } - return attachmentId; + if(eagerUpload) { + ajaxUpload(file, attachmentId, fileSpan, inputEl); + + } + return attachmentId; } return null; } @@ -66,7 +78,7 @@ function ajaxUpload(file, attachmentId, fileSpan, inputEl) { //gcm files count and add delete_all link - var count=$('#attachments_fields>span').length; + var count=$('#attachments_fields>span').length; $('#upload_file_count').html("已上传"+"<span id=\"count\">"+count+"</span>"+"个文件"); if(count>=1){ diff --git a/public/stylesheets/application.css b/public/stylesheets/application.css index d786101b1..1a1c1b2ea 100644 --- a/public/stylesheets/application.css +++ b/public/stylesheets/application.css @@ -1829,7 +1829,7 @@ fieldset#notified_events .parent { padding-left: 20px; } span.required {color: #bb0000;} .summary {font-style: italic;} -#attachments_fields input.description {margin-left:4px; width:340px; } +#attachments_fields input.description {margin-left:4px; width:100px; } #attachments_fields span {display:block; white-space:nowrap; font-family:'微软雅黑';} #attachments_fields input.filename {border:0; height:1.8em; width:150px; color:#555; background-color:inherit; background:url(../images/attachment.png) no-repeat 1px 50%; padding-left:18px;}/*Modified by young*/ #attachments_fields .ajax-waiting input.filename {background:url(../images/hourglass.png) no-repeat 0px 50%;} diff --git a/public/stylesheets/welcome.css b/public/stylesheets/welcome.css index f7756e5b8..4393c1dbc 100644 --- a/public/stylesheets/welcome.css +++ b/public/stylesheets/welcome.css @@ -312,11 +312,11 @@ a.attachments_list_color { } .main-content-bar{ margin: 0; - margin-top: 35px; + margin-top: 12px; padding: 0; - margin-bottom: 35px; - width: 100%; - height: auto; + margin-bottom: 2px; + width: 100%; + height: 78; } .weixin-content{