done add journals function

This commit is contained in:
Rueshyna 2012-11-20 14:58:15 +08:00 committed by chris
parent 0aaadbc82d
commit 5006cd2f61
2 changed files with 43 additions and 15 deletions

View File

@ -36,10 +36,10 @@ class Desktop::JournalPagesController < ApplicationController
def create
if params[:commit].eql?"Save"
if not params[:writing_journal][:publication_date].nil?
params[:writing_journal][:publication_date] = \
Date.new *(params[:writing_journal][:publication_date].split("/").map{|s| s.to_i})
end
#if not params[:writing_journal][:publication_date].nil?
# params[:writing_journal][:publication_date] = \
# Date.new *(params[:writing_journal][:publication_date].split("/").map{|s| s.to_i})
#end
params[:writing_journal][:create_user_id] = current_user.id

View File

@ -8,21 +8,22 @@
<div class="hh2 hp sdm">
<div class="sdm_t hh2">Entry Year</div>
<div class="admbg sdm_o">
<ul>
<!--<ul>
<li><a class="hp hh2 admtxt" href="">2012</a></li>
<li><a class="hp hh2 admtxt" href="">2011</a></li>
<li><a class="hp hh2 admtxt" href="">2010</a></li>
<li><a class="hp hh2 admtxt" href="">2009</a></li>
<li><a class="hp hh2 admtxt" href="">2008</a></li>
</ul>
-->
</div>
</div>
<div class="hh2 hp sdm">
<div class="sdm_t hh2">Language</div>
<div class="admbg sdm_o">
<ul>
<li><a class="hp hh2 admtxt" href="">English</a></li>
<li><a class="hp hh2 admtxt" href="">Chinese</a></li>
<!--<li><a class="hp hh2 admtxt" href="">English</a></li>
<li><a class="hp hh2 admtxt" href="">Chinese</a></li>-->
</ul>
</div>
</div>
@ -137,23 +138,50 @@
</select>
</li>
<ul>
<li class="s_grid_row">
<%= label_tag("", "Date of Publication", class: "s_grid_2 s_grid") %><%= f.text_field :publication_date, size: "20", value: "2012 / 05 / 01", class: "s_grid_4 s_grid"%>
<!--<%= f.date_select :publication_date, {:use_month_numbers => true, :start_year => Time.now.year, :end_year => 1930, :order => [:year, :month, :day] }, {:class => 's_grid_4 s_grid'} %>
</li>-->
<%= label_tag("", "Date of Publication", class: "s_grid_4 s_grid") %>
</li>
<li class="s_grid_row">
<%= f.date_select :publication_date, {:use_month_numbers => true, :start_year => Time.now.year, :end_year => 1930, :order => [:year, :month, :day] }, {:class => 's_grid_2 s_grid'} %>
</li>
</ul>
<li class="s_grid_row">
<%= f.text_field :keyword, size: "20", value: "Keywords", class: "s_grid_6 s_grid"%>
</li>
<li class="s_grid_row">
<%= f.text_field :tag, size: "20", value: "Tag", class: "s_grid_6 s_grid"%>
<span class="icon-plus input_append"></span>
<div><%= f.label :year ,:class => "s_grid_2 s_grid" %></div>
<div><%= select_year((@writing_journal.year ? @writing_journal.year.to_i : DateTime.now.year), {:start_year => DateTime.now.year, :end_year => 1930}, {:name => 'writing_journal[year]', :class => "s_grid_4 s_grid"} ) %></div>
</li>
<li class="s_grid_row">
<%= label_tag("", "Full Text", class: "s_grid_2 s_grid") %>
<%= f.file_field :writing_journal_files, size: "20", class: "s_grid_4 s_grid"%>
<div><%= f.label :language ,:class => "s_grid_2 s_grid" %></div>
<select name="writing_journal[language][]" id="" class="s_grid s_grid_4">
<%= options_for_select(
[["Chinese", "Chinese"],
["English", "English"]]
)
%>
</select>
</li>
<li class="s_grid_row">
<%= f.text_field :tag, size: "20", value: "Tag", class: "s_grid_6 s_grid"%>
<span class="icon-plus input_append"></span>
</li>
</ul>
</div>
<div class="s_grid_con s_form">
<span class="icon-plus input_append"></span>
<ul>
<li class="s_grid_row">
<div> <%= label_tag("", "Full Text", class: "s_grid_2 s_grid") %></div>
<%= f.fields_for :writing_journal_files,@writing_journal do |wjf| %>
<%= wjf.file_field :file %>
<% end %>
</li>
<li class="s_grid_row">
<%= f.text_area :note, size: "20x2", value: "Note", class: "s_grid_6 s_grid"%>