commit
cdbc26e8df
@ -0,0 +1,2 @@
|
||||
// Place all the behaviors and hooks related to the matching controller here.
|
||||
// All this logic will automatically be available in application.js.
|
@ -0,0 +1,2 @@
|
||||
// Place all the behaviors and hooks related to the matching controller here.
|
||||
// All this logic will automatically be available in application.js.
|
@ -0,0 +1,4 @@
|
||||
/*
|
||||
Place all the styles related to the matching controller here.
|
||||
They will automatically be included in application.css.
|
||||
*/
|
@ -0,0 +1,4 @@
|
||||
/*
|
||||
Place all the styles related to the matching controller here.
|
||||
They will automatically be included in application.css.
|
||||
*/
|
@ -0,0 +1,101 @@
|
||||
# added by fq
|
||||
class ForumsController < ApplicationController
|
||||
# GET /forums
|
||||
# GET /forums.json
|
||||
|
||||
def index
|
||||
@offset, @limit = api_offset_and_limit({:limit => 10})
|
||||
@forums_all = Forum.all
|
||||
@forums_count = @forums_all.count
|
||||
@forums_pages = Paginator.new @forums_count, @limit, params['page']
|
||||
|
||||
|
||||
@offset ||= @forums_pages.offset
|
||||
# @forums = @forums_all.offset(@offset).limit(@limit).all
|
||||
@forums = Forum.all
|
||||
respond_to do |format|
|
||||
format.html # index.html.erb
|
||||
format.json { render json: @forums }
|
||||
end
|
||||
end
|
||||
|
||||
# GET /forums/1
|
||||
# GET /forums/1.json
|
||||
def show
|
||||
@offset, @limit = api_offset_and_limit({:limit => 10})
|
||||
@forum = Forum.find(params[:id])
|
||||
@memos_all = @forum.topics
|
||||
@topic_count = @memos_all.count
|
||||
@topic_pages = Paginator.new @topic_count, @limit, params['page']
|
||||
|
||||
@offset ||= @topic_pages.offset
|
||||
@memos = @memos_all.offset(@offset).limit(@limit).all
|
||||
respond_to do |format|
|
||||
format.html {
|
||||
render :layout => 'base_forums'
|
||||
}# show.html.erb
|
||||
format.json { render json: @forum }
|
||||
end
|
||||
end
|
||||
|
||||
# GET /forums/new
|
||||
# GET /forums/new.json
|
||||
def new
|
||||
@forum = Forum.new
|
||||
|
||||
respond_to do |format|
|
||||
format.html # new.html.erb
|
||||
format.json { render json: @forum }
|
||||
end
|
||||
end
|
||||
|
||||
# GET /forums/1/edit
|
||||
def edit
|
||||
@forum = Forum.find(params[:id])
|
||||
end
|
||||
|
||||
# POST /forums
|
||||
# POST /forums.json
|
||||
def create
|
||||
@forum = Forum.new(params[:forum])
|
||||
@forum.creator_id = User.current.id
|
||||
|
||||
respond_to do |format|
|
||||
if @forum.save
|
||||
format.html { redirect_to @forum, notice: 'Forum was successfully created.' }
|
||||
format.json { render json: @forum, status: :created, location: @forum }
|
||||
else
|
||||
format.html { render action: "new" }
|
||||
format.json { render json: @forum.errors, status: :unprocessable_entity }
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
# PUT /forums/1
|
||||
# PUT /forums/1.json
|
||||
def update
|
||||
@forum = Forum.find(params[:id])
|
||||
|
||||
respond_to do |format|
|
||||
if @forum.update_attributes(params[:forum])
|
||||
format.html { redirect_to @forum, notice: 'Forum was successfully updated.' }
|
||||
format.json { head :no_content }
|
||||
else
|
||||
format.html { render action: "edit" }
|
||||
format.json { render json: @forum.errors, status: :unprocessable_entity }
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
# DELETE /forums/1
|
||||
# DELETE /forums/1.json
|
||||
def destroy
|
||||
@forum = Forum.find(params[:id])
|
||||
@forum.destroy
|
||||
|
||||
respond_to do |format|
|
||||
format.html { redirect_to forums_url }
|
||||
format.json { head :no_content }
|
||||
end
|
||||
end
|
||||
end
|
@ -0,0 +1,160 @@
|
||||
class MemosController < ApplicationController
|
||||
default_search_scope :messages
|
||||
before_filter :find_forum, :only => [:new, :preview]
|
||||
before_filter :find_attachments, :only => [:preview]
|
||||
before_filter :find_memo, :except => [:new, :create , :preview, :update]
|
||||
before_filter :authenticate_user_edit, :only => [:edit, :update]
|
||||
before_filter :authenticate_user_destroy, :only => [:destroy]
|
||||
|
||||
helper :attachments
|
||||
include AttachmentsHelper
|
||||
|
||||
layout 'base_memos'# ,except: [:new ]
|
||||
|
||||
def quote
|
||||
@memo = Memo.find_by_id(params[:id])
|
||||
@subject = @memo.subject
|
||||
@subject = "RE: #{@subject}" unless @subject.starts_with?('RE:')
|
||||
|
||||
@content = "#{ll(Setting.default_language, :text_user_wrote, @memo.author)} <br/> "
|
||||
@content << @memo.content.to_s.strip.gsub(%r{<pre>((.|\s)*?)</pre>}m, '[...]').gsub(/(\r?\n|\r\n?)/, "\n") + "</blockquote>\n\n<br/>"
|
||||
@content = "<blockquote>" << @content
|
||||
end
|
||||
|
||||
def new
|
||||
@forum = Forum.find(params[:forum_id])
|
||||
@memo = Memo.new
|
||||
@memo.forum_id = @forum.id
|
||||
|
||||
respond_to do |format|
|
||||
format.html {
|
||||
render action: :new ,layout: 'base'
|
||||
}# new.html.erb
|
||||
format.json { render json: @memo }
|
||||
end
|
||||
end
|
||||
|
||||
def create
|
||||
@memo = Memo.new(params[:memo])
|
||||
@memo.forum_id = params[:forum_id]
|
||||
@memo.author_id = User.current.id
|
||||
@forum = Forum.find(params[:forum_id])
|
||||
|
||||
if @memo.parent_id
|
||||
@parent_memo = Memo.find_by_id(@memo.parent_id)
|
||||
@parent_memo.replies_count += 1
|
||||
end
|
||||
|
||||
@memo.save_attachments(params[:attachments] || (params[:memo] && params[:memo][:uploads]))
|
||||
|
||||
respond_to do |format|
|
||||
if @memo.save
|
||||
@forum.memo_count += 1
|
||||
@forum.last_memo_id = @memo.id
|
||||
@back_memo_id = (@memo.parent_id.nil? ? @memo.id : @memo.parent_id)
|
||||
if @parent_memo
|
||||
@parent_memo.last_reply_id = @memo
|
||||
@parent_memo.save
|
||||
else
|
||||
@forum.topic_count += 1
|
||||
end
|
||||
@forum.save
|
||||
|
||||
format.html { redirect_to forum_memo_path(@memo.forum_id, @back_memo_id), notice: 'Memo was successfully created.' }
|
||||
format.json { render json: @memo, status: :created, location: @memo }
|
||||
else
|
||||
back_error_page = @memo.parent_id.nil? ? forum_path(@forum) : forum_memo_path(@forum, @memo.parent_id)
|
||||
format.html { redirect_to back_error_page, notice: 'Memo was failed created.' }
|
||||
format.json { render json: @memo.errors, status: :unprocessable_entity }
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
def show
|
||||
pre_count = 20
|
||||
@current_count = pre_count * (params['page'].to_i - 1) if params['page'].to_i > 0
|
||||
@memo = Memo.find_by_id(params[:id])
|
||||
@offset, @limit = api_offset_and_limit({:limit => pre_count})
|
||||
@forum = Forum.find(params[:forum_id])
|
||||
@replies_all = @memo.replies
|
||||
@reply_count = @replies_all.count
|
||||
@reply_pages = Paginator.new @reply_count, @limit, params['page']
|
||||
@offset ||= @reply_pages.offset
|
||||
@replies = @replies_all.offset(@offset).limit(@limit).all
|
||||
@mome_new = Memo.new
|
||||
|
||||
|
||||
# @memo = Memo.find_by_id(params[:id])
|
||||
# @forum = Forum.find(params[:forum_id])
|
||||
# @replies = @memo.replies
|
||||
# @mome_new = Memo.new
|
||||
|
||||
respond_to do |format|
|
||||
format.html # show.html.erb
|
||||
format.json { render json: @memo }
|
||||
end
|
||||
end
|
||||
|
||||
def edit
|
||||
end
|
||||
|
||||
def update
|
||||
@forum = Forum.find(params[:forum_id])
|
||||
@memo = Memo.find(params[:id])
|
||||
if(@memo.update_attribute(:subject, params[:memo][:subject]) &&
|
||||
@memo.update_attribute(:content, params[:memo][:content]))
|
||||
respond_to do |format|
|
||||
format.html {redirect_to forum_memo_path(@forum, (@memo.parent_id.nil? ? @memo : @memo.parent_id)), notice: 'Memo was successfully updated.'}
|
||||
#format.html redirect_to forum_memo_url(@forum, (@memo.parent_id.nil? ? @memo : @memo.parent_id)), notice: 'Memo was successfully updated.'
|
||||
end
|
||||
else
|
||||
format.html { render action: "edit" }
|
||||
format.json { render json: @person.errors, status: :unprocessable_entity }
|
||||
end
|
||||
end
|
||||
|
||||
def destroy
|
||||
@memo = Memo.find(params[:id])
|
||||
@memo.destroy
|
||||
|
||||
if @memo.parent_id
|
||||
@back_url = forum_memo_url(params[:forum_id], @memo.parent_id)
|
||||
else
|
||||
@back_url = forum_url(params[:forum_id])
|
||||
end
|
||||
|
||||
respond_to do |format|
|
||||
format.html { redirect_to @back_url }
|
||||
format.json { head :no_content }
|
||||
end
|
||||
end
|
||||
|
||||
private
|
||||
|
||||
def find_memo
|
||||
return unless find_forum
|
||||
@memo = @forum.memos.find(params[:id])
|
||||
#@memo =
|
||||
rescue ActiveRecord::RecordNotFound
|
||||
render_404
|
||||
nil
|
||||
end
|
||||
|
||||
def find_forum
|
||||
@forum = Forum.find(params[:forum_id])
|
||||
rescue ActiveRecord::RecordNotFound
|
||||
render_404
|
||||
nil
|
||||
end
|
||||
|
||||
def authenticate_user_edit
|
||||
find_memo
|
||||
render_403 unless @memo.editable_by? User.current
|
||||
end
|
||||
|
||||
def authenticate_user_destroy
|
||||
find_memo
|
||||
render_403 unless @memo.destroyable_by? User.current
|
||||
|
||||
end
|
||||
end
|
@ -0,0 +1,22 @@
|
||||
module ForumsHelper
|
||||
def forum_breadcrumb(item)
|
||||
forum = item.is_a?(Memo) ? item.forum : item
|
||||
links = [link_to(l(:label_forum_plural), forums_path(item))]
|
||||
forums = forum.ancestors.reverse
|
||||
if item.is_a?(Memo)
|
||||
forums << forum
|
||||
end
|
||||
links += forums.map {|ancestor| link_to(h(ancestor.name), forum_path(ancestor))}
|
||||
breadcrumb links
|
||||
end
|
||||
|
||||
def forums_options_for_select(forums)
|
||||
options = []
|
||||
Forum.forum_tree(forums) do |forum, level|
|
||||
label = (level > 0 ? ' ' * 2 * level + '» ' : '').html_safe
|
||||
label << forum.name
|
||||
options << [label, forum.id]
|
||||
end
|
||||
options
|
||||
end
|
||||
end
|
@ -0,0 +1,2 @@
|
||||
module MemosHelper
|
||||
end
|
@ -0,0 +1,20 @@
|
||||
class Forum < ActiveRecord::Base
|
||||
include Redmine::SafeAttributes
|
||||
has_many :topics, :class_name => 'Memo', :conditions => "#{Memo.table_name}.parent_id IS NULL", :order => "#{Memo.table_name}.created_at DESC"
|
||||
has_many :memos, :dependent => :destroy
|
||||
belongs_to :creator, :class_name => "User", :foreign_key => 'creator_id'
|
||||
safe_attributes 'name',
|
||||
'description',
|
||||
'topic_count',
|
||||
'memo_count',
|
||||
'last_memo_id',
|
||||
'creator_id'
|
||||
validates_presence_of :name, :creator_id
|
||||
validates_length_of :name, maximum: 50
|
||||
validates_length_of :description, maximum: 255
|
||||
validates :name, :uniqueness => true
|
||||
|
||||
acts_as_taggable
|
||||
scope :by_join_date, order("created_at DESC")
|
||||
|
||||
end
|
@ -0,0 +1,108 @@
|
||||
class Memo < ActiveRecord::Base
|
||||
include Redmine::SafeAttributes
|
||||
belongs_to :forums
|
||||
belongs_to :author, :class_name => "User", :foreign_key => 'author_id'
|
||||
|
||||
validates_presence_of :author_id, :forum_id, :subject
|
||||
validates :content, presence: true
|
||||
validates_length_of :subject, maximum: 50
|
||||
validates_length_of :content, maximum: 2048
|
||||
validate :cannot_reply_to_locked_topic, :on => :create
|
||||
validate :content_cannot_be_blank
|
||||
|
||||
acts_as_tree :counter_cache => :replies_count, :order => "#{Memo.table_name}.created_at ASC"
|
||||
acts_as_attachable
|
||||
belongs_to :last_reply_id, :class_name => 'Memo', :foreign_key => 'last_reply_id'
|
||||
# acts_as_searchable :column => ['subject', 'content'],
|
||||
# #:include => { :forums => :p}
|
||||
# #:project_key => "#{Forum.table_name}.project_id"
|
||||
# :date_column => "#{table_name}.created_at"
|
||||
# acts_as_event :title => Proc.new {|o| "#{o.forums.name}: #{o.subject}"},
|
||||
# :description => :content,
|
||||
# :group => :parent,
|
||||
# :type => Proc.new {|o| o.parent_id.nil? ? 'message' : 'reply'},
|
||||
# :url => Proc.new {|o| {:controller => 'memos', :action => 'show', :forum_id => o.forum_id}.merge(o.parent_id.nil? ? {:id => o.id} : {:id => o.parent_id, :r => o.id, :anchor => "memo-#{o.id}"})}
|
||||
acts_as_activity_provider :find_options => {:include => [{:board => :project}, :author]},
|
||||
:author_key => :author_id
|
||||
acts_as_watchable
|
||||
|
||||
safe_attributes "author_id",
|
||||
"subject",
|
||||
"content",
|
||||
"forum_id",
|
||||
"last_reply_id",
|
||||
"lock",
|
||||
"parent_id",
|
||||
"replies_count",
|
||||
"sticky"
|
||||
|
||||
after_create :add_author_as_watcher, :reset_counters!
|
||||
# after_update :update_memos_forum
|
||||
after_destroy :reset_counters!
|
||||
# after_create :send_notification
|
||||
|
||||
# scope :visible, lambda { |*args|
|
||||
# includes(:forum => ).where()
|
||||
# }
|
||||
|
||||
def cannot_reply_to_locked_topic
|
||||
errors.add :base, 'Topic is locked' if root.locked? && self != root
|
||||
end
|
||||
def content_cannot_be_blank
|
||||
errors.add :base, "content can't be blank." if self.content.blank?
|
||||
end
|
||||
|
||||
# def update_memos_forum
|
||||
# if forum_id_changed?
|
||||
# Message.update_all({:board_id => board_id}, ["id = ? OR parent_id = ?", root.id, root.id ])
|
||||
# Forum.reset_counters!(forum_id_was)
|
||||
# Forum.reset_counters!(forum_id)
|
||||
# end
|
||||
# end
|
||||
|
||||
def reset_counters!
|
||||
if parent && parent.id
|
||||
Memo.update_all({:last_reply_id => parent.children.maximum(:id)}, {:id => parent.id})
|
||||
end
|
||||
# forums.reset_counters!
|
||||
end
|
||||
|
||||
def sticky=(arg)
|
||||
write_attribute :sticky, (arg == true || arg.to_s == '1' ? 1 : 0)
|
||||
end
|
||||
|
||||
def sticky?
|
||||
sticky == 1
|
||||
end
|
||||
|
||||
def replies
|
||||
Memo.where("parent_id = ?", id)
|
||||
end
|
||||
|
||||
def locked?
|
||||
self.lock
|
||||
end
|
||||
|
||||
def editable_by? user
|
||||
# user && user.logged? || (self.author == usr && usr.allowed_to?(:edit_own_messages, project))
|
||||
user.admin?
|
||||
end
|
||||
|
||||
def destroyable_by? user
|
||||
user && user.logged? && Forum.find(self.forum_id).creator_id == user.id || user.admin?
|
||||
#self.author == user || user.admin?
|
||||
end
|
||||
|
||||
private
|
||||
|
||||
def add_author_as_watcher
|
||||
Watcher.create(:watchable => self.root, :user => author)
|
||||
end
|
||||
|
||||
def send_notification
|
||||
if Setting.notified_events.include?('message_posted')
|
||||
Mailer.message_posted(self).deliver
|
||||
end
|
||||
end
|
||||
|
||||
end
|
@ -0,0 +1,20 @@
|
||||
<!-- added by fq -->
|
||||
<!-- %= form_for(@forum) do |f| % -->
|
||||
<%= labelled_form_for(@forum) do |f| %>
|
||||
<% if @forum.errors.any? %>
|
||||
<div id="error_explanation">
|
||||
<h2><%= pluralize(@forum.errors.count, "error") %> prohibited this forum from being saved:</h2>
|
||||
|
||||
<ul>
|
||||
<% @forum.errors.full_messages.each do |msg| %>
|
||||
<li><%= msg %></li>
|
||||
<% end %>
|
||||
</ul>
|
||||
</div>
|
||||
<% end %>
|
||||
<div class="actions">
|
||||
<p><%= f.text_field :name, :required => true %></p>
|
||||
<p><%= f.text_field :description, :required => true, :size => 80 %></p>
|
||||
<%= f.submit %>
|
||||
</div>
|
||||
<% end %>
|
@ -0,0 +1,49 @@
|
||||
<!-- added by fq -->
|
||||
<div style="padding-top: 10px">
|
||||
<% if forums.any? %>
|
||||
<% forums.each do |forum| %>
|
||||
<table class="content-text-list">
|
||||
<tr>
|
||||
<td colspan="2" valign="top" width="50" ><%= link_to image_tag(url_to_avatar(forum.creator), :class => "avatar"), user_path(forum.creator) %></td>
|
||||
<td>
|
||||
<table width="880px" border="0">
|
||||
<tr>
|
||||
<td valign="top" width="500px"><%= link_to h(forum.name), forum_path(forum) %></td>
|
||||
<td align="right" rowspan="3">
|
||||
<table class="borad-count">
|
||||
<tr>
|
||||
<td align="center" class="borad-count-digit"><%= link_to (forum.topic_count), forum_path(forum) %></td>
|
||||
<td align="center" class="borad-count-digit"><%= link_to (forum.memo_count), forum_path(forum) %></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td align="center">帖子</td>
|
||||
<td align="center">回答</td>
|
||||
</tr>
|
||||
</table></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td colspan="2" ><span class="font_description"><%= forum.description%></span></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td colspan="2" ><span class="font_description">
|
||||
<div class="tags">
|
||||
<div id="tags">
|
||||
<%= image_tag( "/images/sidebar/tags.png") %>
|
||||
<%= render :partial => 'tags/tag_name', :locals => {:obj => forum,:object_flag => "5",:non_list_all => true }%>
|
||||
</div>
|
||||
</div></span>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td align="left" colspan="2" ><span class="font_lighter"><%= authoring forum.created_at, forum.creator %>
|
||||
<br />
|
||||
</span></td>
|
||||
</tr>
|
||||
</table></td>
|
||||
</tr>
|
||||
</table>
|
||||
<% end %>
|
||||
<div class="pagination"><%= pagination_links_full @forums_pages, @forums_count %></div>
|
||||
<% else %>
|
||||
<% end %>
|
||||
</div>
|
@ -0,0 +1,39 @@
|
||||
<!-- added by fq -->
|
||||
<!--display the board-->
|
||||
<div class="borad-topic-count">共有 <%=link_to memos.count %> 个贴子</div>
|
||||
<div style="padding-top: 10px">
|
||||
<% if memos.any? %>
|
||||
<% memos.each do |topic| %>
|
||||
<table class="content-text-list">
|
||||
<td colspan="2" valign="top" width="50" ><%= link_to image_tag(url_to_avatar(topic.author), :class => "avatar"), user_path(topic.author) %></td>
|
||||
<td>
|
||||
<table width="630px" border="0">
|
||||
<tr>
|
||||
<td valign="top" width="500px"><%= link_to h(topic.subject), forum_memo_path(@forum, topic) %></td>
|
||||
<td align="right" rowspan="3">
|
||||
<table class="borad-count">
|
||||
<tr>
|
||||
<td align="center" class="borad-count-digit"><%= link_to (topic.replies_count), forum_memo_path(@forum, topic) %></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td align="center">回答</td>
|
||||
</tr>
|
||||
</table></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td colspan="2" ><span class="font_description"> </span></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td align="left" colspan="2" ><span class="font_lighter"><%= authoring topic.created_at, topic.author %>
|
||||
<br />
|
||||
</span></td>
|
||||
</tr>
|
||||
</table></td>
|
||||
</tr>
|
||||
</table>
|
||||
<% end %>
|
||||
<div class="pagination"><%= pagination_links_full @topic_pages, @topic_count %></div>
|
||||
<% else %>
|
||||
<p class="nodata"><%= l(:label_no_data) %></p>
|
||||
<% end %>
|
||||
</div>
|
@ -0,0 +1,7 @@
|
||||
<!-- added by fq -->
|
||||
<h1>Editing forum</h1>
|
||||
|
||||
<%= render 'form' %>
|
||||
|
||||
<%= link_to 'Show', @forum %> |
|
||||
<%= link_to 'Back', forums_path %>
|
@ -0,0 +1,48 @@
|
||||
<!-- added by fq -->
|
||||
<div class="top-content">
|
||||
<table width="940px">
|
||||
<tr>
|
||||
<td class="info_font" style="width: 220px; color: #15bccf">讨论区 </td>
|
||||
<td class="location-list"><strong><%= l(:label_user_location) %> :</strong></td>
|
||||
<td rowspan="2">
|
||||
<% if User.current.logged? %>
|
||||
<%= link_to("新建讨论区", new_forum_path, :class => 'icon icon-add') %>
|
||||
<% end %>
|
||||
</td>
|
||||
<td rowspan="2" ><!-- 搜索 --></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td style="padding-left: 8px"><a><%= link_to "forge.trustie.net/forums", forums_path %> </a></td>
|
||||
<td ><%= link_to l(:field_homepage), home_path %> > <%= link_to "讨论区", forums_path %></td>
|
||||
</tr>
|
||||
</table>
|
||||
</div>
|
||||
|
||||
<%= render :partial => 'forums/forum_list', :locals => {:forums => @forums} %>
|
||||
|
||||
<!-- <h1>Listing forums</h1>
|
||||
|
||||
<table>
|
||||
<tr>
|
||||
<th>name</th>
|
||||
<th>description</th>
|
||||
<th>creator</th>
|
||||
<th></th>
|
||||
<th></th>
|
||||
<th></th>
|
||||
</tr>
|
||||
|
||||
<% @forums.each do |forum| %>
|
||||
<tr>
|
||||
<td><%= forum.name %></td>
|
||||
<td><%= forum.description %></td>
|
||||
<td><%= forum.creator.show_name %></td>
|
||||
<td><%= link_to 'Show', forum %></td>
|
||||
<td><%= link_to 'Edit', edit_forum_path(forum) %></td>
|
||||
<td><%= link_to 'Destroy', forum, method: :delete, data: { confirm: 'Are you sure?' } %></td>
|
||||
</tr>
|
||||
<% end %>
|
||||
</table>
|
||||
|
||||
<br /> -->
|
||||
|
@ -0,0 +1,6 @@
|
||||
<!-- added by fq -->
|
||||
<h1>New forum</h1>
|
||||
|
||||
<%= render 'form' %>
|
||||
|
||||
<%= link_to 'Back', forums_path %>
|
@ -0,0 +1,16 @@
|
||||
<!-- added by fq -->
|
||||
<p id="notice">
|
||||
<%= notice %>
|
||||
</p>
|
||||
<p>
|
||||
<%= %>
|
||||
</p>
|
||||
<p>
|
||||
<%= %>
|
||||
</p>
|
||||
<!--modified by huang-->
|
||||
<%= link_to '发布帖子', new_forum_memo_path(@forum), :class => 'icon icon-add' %>
|
||||
<% if User.current.admin?||User.current.login==@forum.creator.login %> |
|
||||
<%= link_to '编辑帖子', edit_forum_path(@forum), :class => 'icon icon-edit' %>
|
||||
<% end %>
|
||||
<%= render :partial => 'forums/show_topics', :locals => {:memos => @memos} %>
|
@ -0,0 +1,91 @@
|
||||
<!--added by huang-->
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="utf-8" />
|
||||
<title><%= h html_title %></title>
|
||||
<meta name="description" content="<%= Redmine::Info.app_name %>" />
|
||||
<meta name="keywords" content="issue,bug,tracker" />
|
||||
<%= csrf_meta_tag %>
|
||||
<%= favicon %>
|
||||
<%= stylesheet_link_tag 'jquery/jquery-ui-1.9.2', 'application', 'nyan', :media => 'all' %>
|
||||
<%= stylesheet_link_tag 'rtl', :media => 'all' if l(:direction) == 'rtl' %>
|
||||
<%= javascript_heads %>
|
||||
<%= heads_for_theme %>
|
||||
<%= call_hook :view_layouts_base_html_head %>
|
||||
<!-- page specific tags -->
|
||||
<%= yield :header_tags -%>
|
||||
</head>
|
||||
<body class="<%= h body_css_classes %>">
|
||||
<div id="wrapper">
|
||||
<div id="wrapper2">
|
||||
<div id="wrapper3">
|
||||
<%=render :partial => 'layouts/base_header'%>
|
||||
<div id="main">
|
||||
<div class="top-content">
|
||||
<table>
|
||||
<tr>
|
||||
<td class="info_font" style="width: 240px; color: #15bccf"">软件项目托管社区</td>
|
||||
<td style="width: 430px; color: #15bccf""><strong><%= l(:label_user_location) %> : </strong></td>
|
||||
<td rowspan="2" width="250px">
|
||||
<div class="top-content-search">
|
||||
<%= form_tag(:controller => 'projects', :action => "search", :method => :get) do %>
|
||||
<%= text_field_tag 'name', params[:name], :size => 20 %>
|
||||
<%= hidden_field_tag 'project_type', params[:project_type] %>
|
||||
<%= submit_tag l(:label_search), :class => "enterprise", :name => nil %>
|
||||
<% end %>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td style="padding-left: 8px"><a><%= link_to "forge.trustie.net/projects", :controller => 'projects', :action => 'index', :project_type => 0 %></a></td>
|
||||
<td><p
|
||||
class="top-content-list"><%=link_to l(:label_home),home_path %> > <%=link_to '讨论区', :controller => 'forums', :action => 'index' %> > <%=link_to @forum.name, forum_path(@forum) %></p></td>
|
||||
</tr>
|
||||
</table>
|
||||
</div>
|
||||
<div id="sidebar">
|
||||
<!--informations-->
|
||||
<div class="sidebar-forums">
|
||||
<div class="forums-line">
|
||||
<div class="forums-title"><%= @forum.name %></div>
|
||||
<div class="forums-description"><%= textilizable @forum.description %></div>
|
||||
</div>
|
||||
<!--informations-->
|
||||
<div class="formus-first-title" >创建人信息</div>
|
||||
<div class="forums-info">
|
||||
<div style="padding-top: 20px" >
|
||||
<span class="forums-avatar-left"><%= image_tag(url_to_avatar(@forum.creator), :class => 'avatar2') %></span>
|
||||
<span class="forums-avatar-right"><%=link_to @forum.creator.show_name, user_path(@forum.creator) %>
|
||||
<div>
|
||||
<%= link_to l(:label_user_watcher)+"("+User.watched_by(@forum.creator.id).count.to_s+")" ,:controller=>"users", :action=>"user_watchlist", :id => @forum.creator.id %>
|
||||
<%= link_to l(:label_x_user_fans, :count => User.current.watcher_users(User.current.id).count)+"("+@forum.creator.watcher_users(@forum.creator.id).count.to_s+")", :controller=>"users", :action=>"user_fanslist", :id => @forum.creator.id %></div></span>
|
||||
</div>
|
||||
</div>
|
||||
<!--tags-->
|
||||
<% if User.current.logged? || User.current.admin? %>
|
||||
<div class="forums-tags"><%= render :partial => 'tags/tag', :locals => {:obj => @forum,:object_flag => "5"}%></div>
|
||||
<% end %>
|
||||
</div>
|
||||
</div>
|
||||
<div id="content">
|
||||
|
||||
<%= render_flash_messages %>
|
||||
<%= yield %>
|
||||
<%= call_hook :view_layouts_base_content %>
|
||||
<div style="clear:both;"></div>
|
||||
|
||||
</div>
|
||||
<%= render :partial => 'layouts/base_footer'%>
|
||||
<%= debug(params) if Rails.env.development? %>
|
||||
</div>
|
||||
<div id="ajax-indicator" style="display:none;">
|
||||
<span><%= l(:label_loading) %></span>
|
||||
</div>
|
||||
<div id="ajax-modal" style="display:none;"></div>
|
||||
</div>
|
||||
</div>
|
||||
<%= call_hook :view_layouts_base_body_bottom %>
|
||||
</body>
|
||||
</html>
|
||||
|
@ -0,0 +1,93 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="utf-8" />
|
||||
<title><%= h html_title %></title>
|
||||
<meta name="description" content="<%= Redmine::Info.app_name %>" />
|
||||
<meta name="keywords" content="issue,bug,tracker" />
|
||||
<%= csrf_meta_tag %>
|
||||
<%= favicon %>
|
||||
<%= stylesheet_link_tag 'jquery/jquery-ui-1.9.2', 'application', 'nyan', :media => 'all' %>
|
||||
<%= stylesheet_link_tag 'rtl', :media => 'all' if l(:direction) == 'rtl' %>
|
||||
<%= javascript_heads %>
|
||||
<%= heads_for_theme %>
|
||||
<%= call_hook :view_layouts_base_html_head %>
|
||||
<%= javascript_include_tag "ckeditor/ckeditor.js" %>
|
||||
<!-- page specific tags -->
|
||||
<%= yield :header_tags -%>
|
||||
</head>
|
||||
<!--add by huang-->
|
||||
<body class="<%= h body_css_classes %>">
|
||||
<div id="wrapper">
|
||||
<div id="wrapper2">
|
||||
<div id="wrapper3">
|
||||
<%=render :partial => 'layouts/base_header'%>
|
||||
<div id="main">
|
||||
<!-- added by bai -->
|
||||
|
||||
<div class="top-content">
|
||||
<table>
|
||||
<tr>
|
||||
<td class="info_font" style="width: 240px; color: #15bccf">软件项目托管社区</td>
|
||||
<td style="width: 430px; color: #15bccf"><strong><%= l(:label_user_location) %> : </strong></td>
|
||||
<td rowspan="2" width="250px">
|
||||
<div class="top-content-search">
|
||||
<%= form_tag(:controller => 'projects', :action => "search", :method => :get) do %>
|
||||
<%= text_field_tag 'name', params[:name], :size => 20 %>
|
||||
<%= hidden_field_tag 'project_type', params[:project_type] %>
|
||||
<%= submit_tag l(:label_search), :class => "enterprise", :name => nil %>
|
||||
<% end %>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td style="padding-left: 8px"><a><%= link_to "forge.trustie.net/projects", :controller => 'projects', :action => 'index', :project_type => 0 %></a></td>
|
||||
<td><p class="top-content-list"><%=link_to l(:label_home),home_path %> > <%=link_to '讨论区', :controller => 'forums', :action => 'index' %> > <%=link_to @forum.name, forum_path(@forum) %> > <%=link_to @memo.subject, forum_memo_path(@forum, @memo) %></p></td>
|
||||
</tr>
|
||||
</table>
|
||||
</div>
|
||||
<div id="sidebar">
|
||||
<!--informations-->
|
||||
<div class="sidebar-forums">
|
||||
<div class="forums-line">
|
||||
<div class="forums-title"><%= @forum.name %></div>
|
||||
<div class="forums-description"><%= textilizable @forum.description %></div>
|
||||
</div>
|
||||
<!--informations-->
|
||||
<div class="formus-first-title" >创建人信息</div>
|
||||
<div class="forums-info">
|
||||
<div style="padding-top: 20px" >
|
||||
<span class="forums-avatar-left"><%= image_tag(url_to_avatar(@forum.creator), :class => 'avatar2') %></span>
|
||||
<span class="forums-avatar-right"><%=link_to @forum.creator.show_name, user_path(@forum.creator) %>
|
||||
<div>
|
||||
<%= link_to l(:label_user_watcher)+"("+User.watched_by(@forum.creator.id).count.to_s+")" ,:controller=>"users", :action=>"user_watchlist", :id => @forum.creator.id %>
|
||||
<%= link_to l(:label_x_user_fans, :count => User.current.watcher_users(User.current.id).count)+"("+@forum.creator.watcher_users(@forum.creator.id).count.to_s+")", :controller=>"users", :action=>"user_fanslist", :id => @forum.creator.id %></div></span>
|
||||
</div>
|
||||
</div>
|
||||
<!--tags-->
|
||||
<% if User.current.logged? || User.current.admin? %>
|
||||
<div class="forums-tags"><%= render :partial => 'tags/tag', :locals => {:obj => @forum.creator,:object_flag => "1"} %></div>
|
||||
<% end %>
|
||||
</div>
|
||||
</div>
|
||||
<div id="content">
|
||||
<%= render_flash_messages %>
|
||||
<%= yield %>
|
||||
<%= call_hook :view_layouts_base_content %>
|
||||
<div style="clear:both;"></div>
|
||||
</div>
|
||||
<%= render :partial => 'layouts/base_footer'%>
|
||||
<%= debug(params) if Rails.env.development? %>
|
||||
</div>
|
||||
|
||||
<div id="ajax-indicator" style="display:none;">
|
||||
<span><%= l(:label_loading) %></span>
|
||||
</div>
|
||||
<div id="ajax-modal" style="display:none;"></div>
|
||||
</div>
|
||||
</div>
|
||||
<%= call_hook :view_layouts_base_body_bottom %>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
|
@ -0,0 +1,13 @@
|
||||
<%= error_messages_for 'bid' %>
|
||||
<!--[form:project]-->
|
||||
<p><%= l(:label_homeworks_form_new_description) %></p>
|
||||
<!-- % unless @memo.parent_id %>
|
||||
<% if @memo.safe_attribute? 'sticky' %>
|
||||
<%= f.check_box :sticky %> <lable><%= l(:label_board_sticky) %></lable>
|
||||
<% end %>
|
||||
<% if @memo.safe_attribute? 'locked' %>
|
||||
<%= f.check_box :locked %> <%= label_tag 'memo_locked', l(:label_board_locked) %>
|
||||
<% end %>
|
||||
<% end % -->
|
||||
<p><%= f.text_field :content, :required => true, :size => 60, :style => "width:150px;" %></p>
|
||||
<p><%= hidden_field_tag 'subject', ||=@memo.subject %>
|
@ -0,0 +1,14 @@
|
||||
<%= form_for(@mome_new, url: forum_memos_path) do |f| %>
|
||||
<%= f.hidden_field :subject, :required => true, value: @memo.subject %>
|
||||
<%= f.hidden_field :forum_id, :required => true, value: @memo.forum_id %>
|
||||
<%= f.hidden_field :parent_id, :required => true, value: @memo.id %>
|
||||
<%= label_tag(l(:label_reply_plural)) %>:
|
||||
<!-- <p> < %= f.text_area :content, :required => true, :size => "75%", :resize => "none", id: 'editor01' %> </p> -->
|
||||
<%= f.text_area :content, :cols => 80, :rows => 15, :class => 'wiki-edit', :id => 'editor01', :value => @content %></p>
|
||||
|
||||
<script type="text/javascript">var ckeditor=CKEDITOR.replace('editor01');</script>
|
||||
<p><%= l(:label_attachment_plural) %><br />
|
||||
<%= render :partial => 'attachments/form', :locals => {:container => @mome_new} %>
|
||||
</p>
|
||||
<%= f.submit value: l(:label_reply_plural), class: "replies" %>
|
||||
<% end %>
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in new issue