整理下,加个推荐tag

This commit is contained in:
yanxd 2014-03-31 15:36:51 +08:00
parent d2ebfca314
commit 84c5032eb2
8 changed files with 40 additions and 15 deletions

View File

@ -20,6 +20,9 @@ class TagsController < ApplicationController
# $selected_tags = Array.new
# $related_tags = Array.new
NUMBERS = Setting.tags_show_search_results
# 预设几个可以添加的tag
@preTags = %w|预设A 预设B 预设C 预设D 预设E 预设F |
# 接收参数解释:
# params[:q]这是在其他页面点击tag跳转到该页面后的结果显示 ;params[:selected_tags]这是在过滤页面增删tag进行过滤传过来的参数

View File

@ -1477,16 +1477,7 @@ module ApplicationHelper
user.watcher_users.count
end
#end
#author : nyan
def stringCut240(str)
(str.length > 240) ? (str[0,240]<<"......") : str
end
#author : xianbo
def objCut12(obj)
for obj1 in obj[0..11]
obj2 = obj1
end
end
def hadcommittedhomework(cur,curb)
@attaches=HomeworkAttach.find_by_sql("select * from homework_attaches where(bid_id = #{curb})")

View File

@ -261,12 +261,12 @@ module ProjectsHelper
def rolesToLanguage rolesArray
rolesArray = ([] << rolesArray) unless rolesArray.is_a?(Array)
rolesArray.map{ |roleName|
case roleName
when "Manager"
case roleName.to_sym
when :Manager
l :default_role_manager
when "Developer"
when :Developer
l :default_role_developer
when "Reporter"
when :Reporter
l :default_role_reporter
else
'Unkown'

View File

@ -215,6 +215,7 @@ div.pagination{
<tr>
<td class='description' colspan="5">
<div class="tags_area">
<% @preTags = %w|预设A 预设B 预设C 预设D 预设E 预设Z | %>
<%= render :partial => 'tags/tag', :locals => {:obj => file, :object_flag => "6"}%>
<div class="tags_gradint"></div>
</div>

View File

@ -48,6 +48,22 @@
<%= 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" %>
<div class='hidden'>
<% preTags = @preTags.nil? ? [] : @preTags %>
<% preTags.each do |tag|%>
<%= link_to tag, "
javascript:(function(){
var $tagInputVal = $('#put-tag-form-"+obj.class.to_s+"-"+obj.id.to_s+"').find('#name');
var tagArr = [];
tagArr = tagArr.concat( $tagInputVal[0].value.split(',') );
tagArr = tagArr.concat('"+tag.to_s+"');
tagArr = cleanArray(tagArr);
$tagInputVal.val(tagArr.join(','));
})();
"
%>
<% end%>
</div>
<%#= link_to_function l(:button_cancel), "$(\"#put-tag-form-#{obj.class}-#{obj.id}\").hide();"%>
<% end %>
</div>

View File

@ -113,7 +113,7 @@
<td colspan="2" valign="top"><strong><%= link_to(h(e.user), user_path(e.user_id)) %></strong>&nbsp;<span class="font_lighter"><%= l(:label_new_activity) %></span>&nbsp;<%= link_to format_activity_title("#{act.board.name}: #{act.subject}"), {:controller => 'messages', :action => 'show', :board_id => act.board_id}.merge(act.parent_id.nil? ? {:id => act.id} : {:id => act.parent_id, :r => act.id, :anchor => "message-#{act.id}"}) %></td>
<% end %>
</tr>
<tr> <td colspan="2" width="580" > <p class="font_description"> <%= h stringCut240(act.content) %> </p></td> </tr>
<tr> <td colspan="2" width="580" > <p class="font_description"> <%= h act.content.truncate(240, omission: '...') %> </p></td> </tr>
<tr>
<td>
<div style="display: inline-block; float: left; margin-top: 0px" width="200" align="right" class="a">

View File

@ -17,15 +17,19 @@ form #q, form #search_type{
height: 33px;
}
form #q{
font-size: 13px;
border-top-left-radius: 5px;
border-bottom-left-radius: 5px;
border-right: none;
}
form #search_type{
font-size: 13px;
color: #363739;
border-top-right-radius: 5px;
border-bottom-right-radius: 5px;
border-bottom-left-radius: 0px;
border-top-left-radius: 0px;
border-left: 1px outset #83A9A9;
margin-left: -4px;
-webkit-appearance: none;

View File

@ -1,6 +1,16 @@
/* Redmine - project management software
Copyright (C) 2006-2013 Jean-Philippe Lang */
function cleanArray (actual){
var newArray = new Array();
for (var i = 0; i< actual.length; i++){
if (actual[i]){
newArray.push(actual[i]);
}
}
return newArray;
}
function checkAll(id, checked) {
if (checked) {
$('#'+id).find('input[type=checkbox]').attr('checked', true);