forum/memo fix

This commit is contained in:
yanxd 2013-11-29 18:14:49 +08:00
parent 3700294890
commit 9aa7294f5a
10 changed files with 2107 additions and 2064 deletions

View File

@ -22,6 +22,7 @@ class ForumsController < ApplicationController
# GET /forums/1 # GET /forums/1
# GET /forums/1.json # GET /forums/1.json
def show def show
@memo = Memo.new
@offset, @limit = api_offset_and_limit({:limit => 10}) @offset, @limit = api_offset_and_limit({:limit => 10})
@forum = Forum.find(params[:id]) @forum = Forum.find(params[:id])
@memos_all = @forum.topics @memos_all = @forum.topics

View File

@ -3,4 +3,4 @@
<%= render 'form' %> <%= render 'form' %>
<%= link_to l :button_back, forums_path %> <%= link_to l(:button_back), forums_path %>

View File

@ -2,14 +2,42 @@
<p id="notice"> <p id="notice">
<%= notice %> <%= notice %>
</p> </p>
<p> <div id="add-memo" style="display:none;">
<%= %> <h3><%=l(:label_memo_new)%></h3>
</p> <% if User.current.logged? %>
<p> <%= labelled_form_for(@memo, :url => forum_memos_path(@forum)) do |f| %>
<%= %> <% if @memo.errors.any? %>
</p> <div id="error_explanation">
<h2><%= pluralize(@memo.errors.count, "error") %> prohibited this memo from being saved:</h2>
<ul>
<% @memo.errors.full_messages.each do |msg| %>
<li><%= msg %></li>
<% end %>
</ul>
</div>
<% end %>
<div class="actions" style="style="max-width:680px"">
<p><%= f.text_field :subject, :required => true, :size => 95 %></p>
<p style="max-width:680px"><%= f.text_area :content, :required => true, :id => 'editor02' %></p>
<script type="text/javascript">var ckeditor=CKEDITOR.replace('editor02');</script>
<br/>
<p>
<%= l(:label_attachment_plural) %><br />
<%= render :partial => 'attachments/form', :locals => {:container => @memo} %>
</p>
<%= f.submit :value => l(:label_memo_create) %>
<%= link_to l(:button_cancel), "#", :onclick => '$("#add-memo").hide(); return false;' %></p>
</div>
<% end %>
<% end %>
</div>
<!--modified by huang--> <!--modified by huang-->
<%= link_to '发布帖子', new_forum_memo_path(@forum), :class => 'icon icon-add' %> <% #= link_to '发布帖子', new_forum_memo_path(@forum), :class => 'icon icon-add' %>
<span>
<%= link_to l(:label_memo_new_from_forum), new_forum_memo_path(@forum), :class => 'icon icon-add',
:onclick => 'showAndScrollTo("add-memo", "memo_subject"); return false;' if User.current.logged? %>
</span>
<% if User.current.admin?||User.current.login==@forum.creator.login %> | <% if User.current.admin?||User.current.login==@forum.creator.login %> |
<%= link_to '编辑帖子', edit_forum_path(@forum), :class => 'icon icon-edit' %> <%= link_to '编辑帖子', edit_forum_path(@forum), :class => 'icon icon-edit' %>
<% end %> <% end %>

View File

@ -12,6 +12,7 @@
<%= stylesheet_link_tag 'rtl', :media => 'all' if l(:direction) == 'rtl' %> <%= stylesheet_link_tag 'rtl', :media => 'all' if l(:direction) == 'rtl' %>
<%= javascript_heads %> <%= javascript_heads %>
<%= heads_for_theme %> <%= heads_for_theme %>
<%= javascript_include_tag "ckeditor/ckeditor.js" %>
<%= call_hook :view_layouts_base_html_head %> <%= call_hook :view_layouts_base_html_head %>
<!-- page specific tags --> <!-- page specific tags -->
<%= yield :header_tags -%> <%= yield :header_tags -%>

View File

@ -66,7 +66,8 @@
</div> </div>
<!--tags--> <!--tags-->
<% if User.current.logged? || User.current.admin? %> <% if User.current.logged? || User.current.admin? %>
<div class="forums-tags"><%= render :partial => 'tags/tag', :locals => {:obj => @forum.creator,:object_flag => "1"} %></div> <!-- <div class="forums-tags">< %= render :partial => 'tags/tag', :locals => {:obj => @forum.creator,:object_flag => "1"} %></div> -->
<div class="forums-tags"><%= render :partial => 'tags/tag', :locals => {:obj => @forum,:object_flag => "5"} %></div>
<% end %> <% end %>
</div> </div>
</div> </div>

View File

@ -10,10 +10,15 @@
</ul> </ul>
</div> </div>
<% end %> <% end %>
<div class="actions"> <div class="actions" style="style="max-width:680px"">
<p><%= f.text_field :subject, :required => true %></p> <p><%= f.text_field :subject, :required => true, :size => 95 %></p>
<p><%= f.text_field :content, :required => true, :size => 80 %></p> <p style="max-width:680px"><%= f.text_area :content, :required => true, :id => 'editor01' %></p>
<script type="text/javascript">var ckeditor=CKEDITOR.replace('editor01');</script>
<br/> <br/>
<p>
<%= l(:label_attachment_plural) %><br />
<%= render :partial => 'attachments/form', :locals => {:container => @memo} %>
</p>
<%= f.submit :value => l(:label_memo_create) %> <%= f.submit :value => l(:label_memo_create) %>
</div> </div>
<% end %> <% end %>

View File

@ -1,4 +1,5 @@
<!-- <h1>New memo</h1> --> <!-- <h1>New memo</h1> -->
<%= javascript_include_tag "ckeditor/ckeditor.js" %>
<h3><%=l(:label_memo_new)%></h3> <h3><%=l(:label_memo_new)%></h3>
<div class="box tabular" > <div class="box tabular" >
<%= render :partial => 'memos/topic_form' %> <%= render :partial => 'memos/topic_form' %>

View File

@ -99,7 +99,12 @@
<div class="memo-content"> <div class="memo-content">
<!-- < %= textilizable(@memo, :content) %> --> <!-- < %= textilizable(@memo, :content) %> -->
<%= raw @memo.content %> <%= raw @memo.content %>
<p> <%= link_to_attachments @memo, :author => false %> </p> <p>
<% if @memo.attachments.any?%>
<% options = {:author => true} %>
<%= render :partial => 'attachments/links', :locals => {:attachments => @memo.attachments, :options => options} %>
<% end %>
</p>
</div> </div>
<div class="memo-timestamp"> <%= authoring @memo.created_at, @memo.author.show_name %></div> <div class="memo-timestamp"> <%= authoring @memo.created_at, @memo.author.show_name %></div>

View File

@ -1734,3 +1734,4 @@ zh:
label_memo_edit: 修改主题 label_memo_edit: 修改主题
label_borad_project: 项目讨论区 label_borad_project: 项目讨论区
label_borad_course: 课程讨论区 label_borad_course: 课程讨论区
label_memo_new_from_forum: 发布帖子

View File

@ -7,7 +7,7 @@
*/ */
@import "http://fonts.googleapis.com/css?family=PT+Sans:400,700|Source+Code+Pro"; /*@import "http://fonts.googleapis.com/css?family=PT+Sans:400,700|Source+Code+Pro";*/
@import "../../../stylesheets/application.css"; @import "../../../stylesheets/application.css";
@font-face { @font-face {