memos unfinish.

This commit is contained in:
yanxd 2013-11-23 20:02:15 +08:00
parent 69d3ab5bef
commit 4a51f08009
4 changed files with 163 additions and 33 deletions

View File

@ -19,4 +19,15 @@ class Memo < ActiveRecord::Base
def replies
Memo.where("parent_id = ?", id)
end
def locked?
self.lock
end
def editable_by? user
!self.lock
end
def destroyable_by? user
end
end

View File

@ -0,0 +1,59 @@
<!DOCTYPE html>
<html>
<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', :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 style="margin-top: 10px;">
<div id="main">
<div id="sidebar">
<%= yield :sidebar %>
<%= view_layouts_base_sidebar_hook_response %>
</div>
<div id="content" style="padding-top: 0px;">
<%= render_flash_messages %>
<%= yield %>
<%= call_hook :view_layouts_base_content %>
<div style="clear:both;"></div>
<%= render_flash_messages %>
</div>
<%= render :partial => 'layouts/base_footer'%>
</div>
</div>
</div>
<div id="ajax-indicator" style="display:none;">
<span><%= l(:label_loading) %></span>
</div>
<div id="ajax-modal" style="display:none;"></div>
<div id="footer">
<div class="bgl">
<div class="bgr">
Powered by <%= link_to Redmine::Info.app_name, Redmine::Info.url %> &copy; 2006-2013 Jean-Philippe Lang
</div>
</div>
</div>
<%= debug(params) if Rails.env.development? %>
</div>
</div>
<%= call_hook :view_layouts_base_body_bottom %>
</body>
</html>

View File

@ -0,0 +1,6 @@
<%= error_messages_for 'bid' %>
<!--[form:project]-->
<p><%= l(:label_homeworks_form_new_description) %></p>
<p><%= f.text_field :content, :required => true, :size => 60, :style => "width:150px;" %></p>
<p><%= hidden_field_tag 'subject', ||=@memo.subject %>

View File

@ -1,36 +1,90 @@
<p id="notice">
<!-- <p id="notice">
< %= notice %>
</p>
<p>
<%= %>
</p>
<p>
<%= %>
</p>
<table>
</p> -->
<ul class="lz" style="background:red" >
<!-- <li class="title">title ==> <%= link_to @memo.subject, forum_memo_path(@memo) %></li>
<li class="content">content ==> <%= @memo.content %></li>
<li class="author">author ==> <%= @memo.author %></li>
<li class="timestamp">
Posted <%= time_ago_in_words(@memo.created_at) if @memo.created_at %> ago.
</li> -->
<div class="aborad-title">
<!-- < %= avatar(@memo.author, :size => "24") %> -->
<%= link_to image_tag(url_to_avatar(@memo.author), :class => "avatar", :style => "width: 24px; height: 24px"), user_path(@memo.author) %></td>
<%=h @memo.subject %></div>
<div class="borad-topic-count-memo">
<%= textilizable(@memo, :content) %>
<%= authoring @memo.created_at, @memo.author %>
</div>
<br />
</ul>
<hr/>
<div class="replies">
<% @replies.each do |reply| %>
<div class="reply" id="<%= "reply-#{reply.id}" %>">
<div class="contextual-borad">
<%= link_to(
image_tag('comment.png'),
{:action => 'quote', :id => reply},
:remote => true,
:method => 'get',
:title => l(:button_quote)) if !@memo.locked? && authorize_for('messages', 'reply') %>
<%= link_to(
image_tag('edit.png'),
{:action => 'edit', :id => reply},
:title => l(:button_edit)
) if reply.editable_by?(User.current) %>
<%= link_to(
image_tag('delete.png'),
{:action => 'destroy', :id => reply},
:method => :post,
:data => {:confirm => l(:text_are_you_sure)},
:title => l(:button_delete)
) if reply.destroyable_by?(User.current) %>
</div>
<table class="borad-text-list">
<tr>
<th>subject</th>
<th>content</th>
<th>author</th>
<td rowspan="3" valign="top" width="60px">
<%= link_to image_tag(url_to_avatar(reply.author), :class => "avatar"), user_path(reply.author) %></td>
<td class="comments">
<div class="wiki"><%= textilizable reply, :content %></div>
</div>
</td>
</tr>
<!-- <tr>
<td>
< %= link_to h(reply.subject), { :controller => 'memos', :action => 'show', :board_id => @board, :id => @topic, :r => reply, :anchor => "reply-#{reply.id}" } %>
</td>
</tr> -->
<tr>
<td><%= link_to @memo.subject, forum_memo_path(@memo) %></td>
<td><%= @memo.content %></td>
<td><%= @memo.author %></td>
<td class="font_lighter" style="float:right"><%= authoring reply.created_at, reply.author %></td>
</tr>
</table>
<table>
<tr>
<th>subject</th>
<th>content</th>
<th>author</th>
</tr>
<% @replies.each do |reply| %>
<tr>
<td><%= link_to reply.subject, forum_memo_path(reply) %></td>
<td><%= reply.content %></td>
<td><%= reply.author %></td>
</tr>
<!-- <ul>
<li><div class="memo_content">content ===> <%= reply.content %></div></li>
<li>author ===> <%= link_to reply.author, user_path(reply.author) %></li>
<li class="timestamp">
Posted <%= time_ago_in_words(reply.created_at) if reply.created_at %> ago.
</li>
</ul> -->
<% end %>
</table>
</div>
<div class="" style="background:grey">
<%= labelled_form_for(@mome_new, url: forum_memos_path) do |f| %>
reply
<ul>
<%= 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 %>
<li> <%= f.text_field :content, :required => true, :size => 80 %> </li>
</ul>
<%= f.submit %>
<% end %>
</div>