From 4a51f080099a5eb2e05b5a794171e8b6e1cb2b77 Mon Sep 17 00:00:00 2001 From: yanxd Date: Sat, 23 Nov 2013 20:02:15 +0800 Subject: [PATCH] memos unfinish. --- app/models/memo.rb | 11 +++ app/views/layouts/base_memos.html.erb | 59 +++++++++++++ app/views/memos/_form.html.erb | 6 ++ app/views/memos/show.html.erb | 120 +++++++++++++++++++------- 4 files changed, 163 insertions(+), 33 deletions(-) create mode 100644 app/views/layouts/base_memos.html.erb create mode 100644 app/views/memos/_form.html.erb diff --git a/app/models/memo.rb b/app/models/memo.rb index efe521f1c..09a562bb4 100644 --- a/app/models/memo.rb +++ b/app/models/memo.rb @@ -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 diff --git a/app/views/layouts/base_memos.html.erb b/app/views/layouts/base_memos.html.erb new file mode 100644 index 000000000..f97b69351 --- /dev/null +++ b/app/views/layouts/base_memos.html.erb @@ -0,0 +1,59 @@ + + + + + <%= h html_title %> + + + <%= 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 %> + + <%= yield :header_tags -%> + + +
+
+
+ <%= render :partial => 'layouts/base_header'%> +
+
+ +
+ <%= render_flash_messages %> + <%= yield %> + <%= call_hook :view_layouts_base_content %> +
+ <%= render_flash_messages %> +
+ <%= render :partial => 'layouts/base_footer'%> +
+
+
+ + + + + <%= debug(params) if Rails.env.development? %> +
+
+ <%= call_hook :view_layouts_base_body_bottom %> + + + \ No newline at end of file diff --git a/app/views/memos/_form.html.erb b/app/views/memos/_form.html.erb new file mode 100644 index 000000000..9e012a16c --- /dev/null +++ b/app/views/memos/_form.html.erb @@ -0,0 +1,6 @@ +<%= error_messages_for 'bid' %> + +

<%= l(:label_homeworks_form_new_description) %>

+ +

<%= f.text_field :content, :required => true, :size => 60, :style => "width:150px;" %>

+

<%= hidden_field_tag 'subject', ||=@memo.subject %> \ No newline at end of file diff --git a/app/views/memos/show.html.erb b/app/views/memos/show.html.erb index e0fc7cbbd..05da1db1a 100644 --- a/app/views/memos/show.html.erb +++ b/app/views/memos/show.html.erb @@ -1,36 +1,90 @@ -

- <%= notice %> -

-

- <%= %> -

-

- <%= %> -

- - - - - - - - - - - -
subjectcontentauthor
<%= link_to @memo.subject, forum_memo_path(@memo) %><%= @memo.content %><%= @memo.author %>
+ +