done add journals function

This commit is contained in:
Rueshyna 2012-11-20 14:58:15 +08:00
parent 398432d0fc
commit 95a3831dce
2 changed files with 43 additions and 15 deletions

View File

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

View File

@ -7,21 +7,22 @@
<div class="hh2 hp sdm"> <div class="hh2 hp sdm">
<div class="sdm_t hh2">Entry Year</div> <div class="sdm_t hh2">Entry Year</div>
<div class="admbg sdm_o"> <div class="admbg sdm_o">
<ul> <!--<ul>
<li><a class="hp hh2 admtxt" href="">2012</a></li> <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="">2011</a></li>
<li><a class="hp hh2 admtxt" href="">2010</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="">2009</a></li>
<li><a class="hp hh2 admtxt" href="">2008</a></li> <li><a class="hp hh2 admtxt" href="">2008</a></li>
</ul> </ul>
-->
</div> </div>
</div> </div>
<div class="hh2 hp sdm"> <div class="hh2 hp sdm">
<div class="sdm_t hh2">Language</div> <div class="sdm_t hh2">Language</div>
<div class="admbg sdm_o"> <div class="admbg sdm_o">
<ul> <ul>
<li><a class="hp hh2 admtxt" href="">English</a></li> <!--<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="">Chinese</a></li>-->
</ul> </ul>
</div> </div>
</div> </div>
@ -136,23 +137,50 @@
</select> </select>
</li> </li>
<li class="s_grid_row"> <ul>
<%= 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"%> <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_4 s_grid'} %> <%= label_tag("", "Date of Publication", class: "s_grid_4 s_grid") %>
</li>--> </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"> <li class="s_grid_row">
<%= f.text_field :keyword, size: "20", value: "Keywords", class: "s_grid_6 s_grid"%> <%= f.text_field :keyword, size: "20", value: "Keywords", class: "s_grid_6 s_grid"%>
</li> </li>
<li class="s_grid_row"> <li class="s_grid_row">
<%= f.text_field :tag, size: "20", value: "Tag", class: "s_grid_6 s_grid"%> <div><%= f.label :year ,:class => "s_grid_2 s_grid" %></div>
<span class="icon-plus input_append"></span> <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>
<li class="s_grid_row"> <li class="s_grid_row">
<%= label_tag("", "Full Text", class: "s_grid_2 s_grid") %> <div><%= f.label :language ,:class => "s_grid_2 s_grid" %></div>
<%= f.file_field :writing_journal_files, size: "20", class: "s_grid_4 s_grid"%> <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>
<li class="s_grid_row"> <li class="s_grid_row">
<%= f.text_area :note, size: "20x2", value: "Note", class: "s_grid_6 s_grid"%> <%= f.text_area :note, size: "20x2", value: "Note", class: "s_grid_6 s_grid"%>