This commit is contained in:
z9hang 2014-08-13 17:14:01 +08:00
commit b8acd13f25
11 changed files with 94 additions and 35 deletions

View File

@ -5,12 +5,18 @@ class StoresController < ApplicationController
layout 'base_stores'
def search
begin
q = "%#{params[:name].strip}%"
(redirect_to stores_path, :notice => l(:label_sumbit_empty);return) if params[:name].blank?
result = find_public_attache q
@searched_attach = paginateHelper result
@result_all_count = result.count;
rescue Exception => e
#render 'stores'
redirect_to stores_path
end
end
def find_public_attache keywords

View File

@ -685,7 +685,7 @@ module ApplicationHelper
when 2
obj = args.shift
attr = args.shift
text = obj.send(attr).to_s
text = obj.send(attr).html_safe.to_s
else
raise ArgumentError, 'invalid arguments to textilizable'
end
@ -716,6 +716,48 @@ module ApplicationHelper
text.html_safe
end
#
#格式化字符串不转义html代码
def textAreailizable(*args)
options = args.last.is_a?(Hash) ? args.pop : {}
case args.size
when 1
obj = options[:object]
text = args.shift
when 2
obj = args.shift
attr = args.shift
text = obj.send(attr).html_safe.to_s
else
raise ArgumentError, 'invalid arguments to textilizable'
end
return '' if text.blank?
project = options[:project] || @project || (obj && obj.respond_to?(:project) ? obj.project : nil)
only_path = options.delete(:only_path) == false ? false : true
text = text.dup
macros = catch_macros(text)
text = Redmine::WikiFormatting.to_html("CKEditor", text, :object => obj, :attribute => attr)
@parsed_headings = []
@heading_anchors = {}
@current_section = 0 if options[:edit_section_links]
parse_sections(text, project, obj, attr, only_path, options)
text = parse_non_pre_blocks(text, obj, macros) do |text|
[:parse_inline_attachments, :parse_wiki_links, :parse_redmine_links].each do |method_name|
send method_name, text, project, obj, attr, only_path, options
end
end
parse_headings(text, project, obj, attr, only_path, options)
if @parsed_headings.any?
replace_toc(text, @parsed_headings)
end
text.html_safe
end
def parse_non_pre_blocks(text, obj, macros)
s = StringScanner.new(text)
tags = []

View File

@ -73,7 +73,7 @@ module IssuesHelper
ancestors.each do |ancestor|
s << '<div>' + content_tag('p', link_to_issue(ancestor, :project => (issue.project_id != ancestor.project_id)))
end
s << '<div>'
s << '<div style="word-wrap: break-word; word-break: normal;">'
subject = h(issue.subject)
if issue.is_private?
subject = content_tag('span', l(:field_is_private), :class => 'private') + ' ' + subject

View File

@ -40,4 +40,14 @@ module WikiHelper
link_to(h(parent.pretty_title), {:controller => 'wiki', :action => 'show', :id => parent.title, :project_id => parent.project, :version => nil})
})
end
def wiki_content_format wiki
text = wiki.text.html_safe
text = parse_non_pre_blocks(text, wiki, text) do |text|
[:parse_inline_attachments, :parse_wiki_links, :parse_redmine_links].each do |method_name|
send method_name, text, project, wiki, attr, only_path, options
end
end
text
end
end

View File

@ -138,10 +138,10 @@ class Issue < ActiveRecord::Base
nil
when 'default'
user_ids = [user.id] + user.groups.map(&:id)
"(#{table_name}.is_private = #{connection.quoted_false} OR #{table_name}.author_id = #{user.id} OR #{table_name}.assigned_to_id IN (#{user_ids.join(',')}))"
"(#{table_name}.is_private = #{connection.quoted_false}) OR (#{table_name}.author_id = #{user.id} OR #{table_name}.tracker_id IN (#{user_ids.join(',')}) OR #{table_name}.assigned_to_id IN (#{user_ids.join(',')}))"
when 'own'
user_ids = [user.id] + user.groups.map(&:id)
"(#{table_name}.author_id = #{user.id} OR #{table_name}.assigned_to_id IN (#{user_ids.join(',')}))"
"(#{table_name}.author_id = #{user.id} OR #{table_name}.tracker_id IN (#{user_ids.join(',')}) OR #{table_name}.assigned_to_id IN (#{user_ids.join(',')}))"
else
'1=0'
end
@ -159,9 +159,9 @@ class Issue < ActiveRecord::Base
when 'all'
true
when 'default'
!self.is_private? || (self.author == user || user.is_or_belongs_to?(assigned_to))
when 'own'
self.author == user || user.is_or_belongs_to?(assigned_to)
(!self.is_private? ||self.tracker == user) || (self.author == user || user.is_or_belongs_to?(assigned_to))
when 'own'
self.tracker == user || self.author == user || user.is_or_belongs_to?(assigned_to)
else
false
end
@ -1009,9 +1009,10 @@ class Issue < ActiveRecord::Base
s << ' overdue' if overdue?
s << ' child' if child?
s << ' parent' unless leaf?
s << ' private' if is_private?
#s << ' private' if is_private?
s << ' created-by-me' if User.current.logged? && author_id == User.current.id
s << ' assigned-to-me' if User.current.logged? && assigned_to_id == User.current.id
s << ' tracker-id' if User.current.logged? && tracker_id == User.current.id
s
end

View File

@ -9,7 +9,7 @@
<% end %>
</div>
<h2><%=h @document.title %></h2>
<h2 style="word-wrap: break-word; word-break: normal;"><%=h @document.title %></h2>
<p><em><%#=h @document.category.name %><br />
<%= format_date @document.created_on %></em></p>

View File

@ -161,8 +161,8 @@
<td class="comments">
<div class="wiki">
<%#= textilizable message,:content,:attachments => message.attachments %>
<%= message.content.html_safe %>
<%= textAreailizable message,:content,:attachments => message.attachments %>
<%#= message.content.html_safe %>
</div>
<%= link_to_attachments message, :author => false %> </td>
</tr>

View File

@ -21,7 +21,7 @@
<% k.each do |c1|%>
<div class="table_row1 <%= cycle 'odd', 'even' %>">
<div class="filename table_cell1 filename1" >
<%= link_to c1.filename, (attachFromUrl c1), {:title => c1.filename, :target => "_blank"} %>
<%= link_to c1.filename, (attachFromUrl c1), {:title => c1.filename, :target => "_blank"} %>
</div>
<div class="table_cell1 filedown1">
<%= c1.downloads %>
@ -32,7 +32,7 @@
</div>
<% end -%>
</div>
</div>
<% end; reset_cycle %>
</div>

View File

@ -14,7 +14,7 @@
$('#' + id).val('');
}
}
$(function(){
$("#main").find("a").attr("target", "_blank");
setCss();
@ -118,23 +118,23 @@
<div id="identifier-pannel" style="display:none">
<%= image_tag '/images/qrweixin.jpg', size: '150x150', alt: 'trustie', class: "weixin" %>
<div class="weixin-content"><%=l(:label_weixin)%></div>
</div>
</div>
<div class="main-content-bar" id="main-content-bar">
<!--文字-->
<!--文字-->
<div style="float: left;padding-left:15px;">
<% if get_avatar?(@contest_page) %>
<%= image_tag(url_to_avatar(@contest_page), width:@contest_page.image_width,height: @contest_page.image_height) %>
<% else %>
<%= image_tag '/images/transparent.png', width:@contest_page.image_width,height: @contest_page.image_height %>
<% end %>
</div>
</div>
<div class="welcome_left" id="welcome_left">
<% unless @contest_page.nil? %>
<span class="font_welcome_trustie"><%= @contest_page.title %></span> <span class="font_welcome_tdescription">, <%= @contest_page.description %></span>
<% end %>
</div>
<!--搜索框-->
<!--搜索框-->
<div id="J_Slide" class="d-p-index-box d-p-index-hotproject" style="float: right;">
<%= form_tag({controller: :welcome, action: :search }, method: :get) do %>
<%= text_field_tag 'name', params[:name], :placeholder => l(:label_search_intimation), name: "name", :class => 'blueinputbar', :style => 'width:240px; padding-right:50px;'%>
@ -162,7 +162,7 @@
<div class="avatar-4" style="float: left; margin-top: 7px">
<%= image_tag('/images/contest1.png')%>
</div>
<div style="float: left; margin-left: 12px; margin-top: 10px; margin-bottom: -4px; width: 380px;">
<!-- <%= link_to(contest.name, contest.event_url, :class => "d-g-blue d-p-project-name", :title => "#{contest.name}", :target => "_blank") %> -->
<%= link_to(contest.name, contest_contestnotifications_path(contest.id), :class => "d-g-blue d-p-project-name", :title => "#{contest.name}", :target => "_blank") %>
@ -172,19 +172,19 @@
<span class="font_lighter">(<span style="font-size: 13px"><%= link_to("#{contest.contesting_softapplications.count}"+l(:label_work_quantity), show_attendingcontest_contest_path(contest), :target => "_blank") %></span>)</span>
<% end %>
</div>
<div style="float: left;margin:5px; margin-left: 12px; margin-bottom: 2px; width: 380px;" class="text_nowrap">
<span class='font_lighter' title ='<%=contest.description%>'><%=contest.description.truncate(100, omission: '...')%></span>
</div><br />
<div style="padding-left: 57px; clear: left;">
<span class="font_lighter"><%=l(:label_release_time)%>:&nbsp;<%=format_time contest.created_on %></span>
</div>
</li>
<% end; reset_cycle %>
<% end; reset_cycle %>
</div>
</div>
</div>
@ -299,31 +299,31 @@
<% if Softapplication.count > 0%>
<div class="d-p-projectlist">
<% find_all_hot_softapplication.map do |softapplication| break if(softapplication == find_all_hot_softapplication[5]) %>
<li style="position:relative;height:6em;" class='<%= cycle("odd", "even") %>'>
<div class="avatar-4" style="float: left; margin-top: 7px">
<%= image_tag('/images/app1.png')%>
</div>
<div style="float: left; margin-left: 10px; margin-top: 7px;margin-bottom: -2px; width: 380px;">
<%= link_to(softapplication.name, softapplication_path(softapplication.id), :class => "d-g-blue d-p-project-name", :title => "#{softapplication.name}", :target => "_blank") %>
</div>
<div class='text_nowrap' style="float: left;margin:5px; margin-left: 10px; margin-bottom:1px; width: 380px;">
<span class='font_lighter' title =<%=softapplication.description.to_s%>><%=softapplication.description.to_s.truncate(50, omission: '...')%></span>
</div><br />
<div style="padding-left: 55px; clear: left;">
<span class="font_lighter"><%=l(:label_release_time)%>:&nbsp;<%=format_time softapplication.created_at %></span>
</div>
</li>
<% end; reset_cycle %>
<% end; reset_cycle %>
</div>
<% else %>
<p class="font_lighter"><%= l(:label_no_ftapplication) %></p>
<% end %>
</div>
</div>

View File

@ -1,5 +1,5 @@
<div class="wiki wiki-page">
<%= textilizable content, :text, :attachments => content.page.attachments,
<%= textAreailizable content, :text, :attachments => content.page.attachments,
:edit_section_links => (@sections_editable && {:controller => 'wiki', :action => 'edit', :project_id => @page.project, :id => @page.title}) %>
<%#= content.text.html_safe %>
</div>

View File

@ -16,7 +16,7 @@
<div class="actions" style="max-width:680px">
<p style="max-width:680px;"><%=text_area_tag 'content[text]', @text, :required => true, :id => 'editor02', :cols => 100, :rows => 25 %></p>
<script type="text/javascript">
var ckeditor=CKEDITOR.replace('editor02');
var ckeditor=CKEDITOR.replace('editor02',{height: '300'});
</script>
</div>