gprs byebye, location have two language, must have picture, long, lang have limit

This commit is contained in:
Rueshyna 2013-01-15 17:47:00 +08:00
parent c888d9cae4
commit f1b6771b34
81 changed files with 196 additions and 167 deletions

View File

@ -69,8 +69,8 @@
<%= content_tag :li, link_to(t(:tags), panel_calendar_back_end_tags_path), :class => active_for_action('/panel/calendar/back_end/tags', 'index')if (is_manager? rescue nil) %> <%= content_tag :li, link_to(t(:tags), panel_calendar_back_end_tags_path), :class => active_for_action('/panel/calendar/back_end/tags', 'index')if (is_manager? rescue nil) %>
<% end -%> <% end -%>
<% end %> <% end %>
<%= content_tag :li, :class => active_for_controllers('locations') || active_for_app_auth("gprs") do -%> <%= content_tag :li, :class => active_for_controllers('locations') do -%>
<%= link_to content_tag(:i, nil, :class => 'icons-location') + content_tag(:span, t(:location)), panel_gprs_back_end_locations_path %> <%= link_to content_tag(:i, nil, :class => 'icons-location') + content_tag(:span, t(:location)), panel_location_back_end_locations_path %>
<%= content_tag :ul, :class => ("nav nav-list " + visible_for_controllers('locations') ) do -%> <%= content_tag :ul, :class => ("nav nav-list " + visible_for_controllers('locations') ) do -%>
<% end -%> <% end -%>
<% end %> <% end %>
@ -79,4 +79,4 @@
<% flash.each do |key, msg| %> <% flash.each do |key, msg| %>
<%= content_tag :span, msg, :class => [key, "notice label label-warning"] %> <%= content_tag :span, msg, :class => [key, "notice label label-warning"] %>
<% end %> <% end %>
</div> </div>

View File

@ -1,3 +0,0 @@
= Gprs
This project rocks and uses MIT-LICENSE.

View File

@ -1,2 +0,0 @@
module Panel::Gprs::BackEnd::LocationsHelper
end

View File

@ -1,11 +0,0 @@
class Location
include Mongoid::Document
include Mongoid::Timestamps
mount_uploader :file, GprsUploader
field :name
field :description
field :longitude, type: Float
field :latitude, type: Float
end

View File

@ -1,30 +0,0 @@
<div class="control-group">
<label class="control-label" for="">Name</label>
<div class="controls">
<%= f.text_field :name, :class=>"span4", :placeholder => "Area" %>
</div>
</div>
<div class="control-group">
<label class="control-label" for="">Picture</label>
<div class="controls">
<%= f.file_field :file %>
</div>
</div>
<div class="control-group">
<label class="control-label" for="">Coordinates</label>
<div class="controls">
<%= f.text_field :longitude, :class=>"span2", :placeholder => "Longitude" %>
<%= f.text_field :latitude, :class=>"span2", :placeholder => "Langitude" %>
</div>
</div>
<div class="control-group">
<label class="control-label" for="">Description</label>
<div class="controls">
<%= f.text_area :description, :class=>"span4", :cols=>"30", :row=>"5" %>
</div>
</div>
<div class="control-group">
<div class="controls">
<%= f.submit "Save", :class=>"btn" %>
</div>
</div>

View File

@ -1,4 +0,0 @@
<%= form_for @location, :url=> panel_gprs_back_end_location_path(@location), :html => { :class=>"form-horizontal"} do |f| %>
<%= render :partial => 'form', :locals => {:f => f} %>
<% end %>

View File

@ -1,3 +0,0 @@
<%= form_for @location, :url=> panel_gprs_back_end_locations_path, :html => { :class=>"form-horizontal"} do |f| %>
<%= render :partial => 'form', :locals => {:f => f} %>
<% end %>

View File

@ -1,4 +0,0 @@
require "gprs/engine"
module Gprs
end

View File

@ -1,7 +0,0 @@
require 'test_helper'
class GprsTest < ActiveSupport::TestCase
test "truth" do
assert_kind_of Module, Gprs
end
end

View File

@ -1,4 +0,0 @@
require 'test_helper'
class Panel::Gprs::BackEnd::LocationsHelperTest < ActionView::TestCase
end

View File

@ -1,6 +1,6 @@
source "http://rubygems.org" source "http://rubygems.org"
# Declare your gem's dependencies in gprs.gemspec. # Declare your gem's dependencies in location.gemspec.
# Bundler will treat runtime dependencies like base dependencies, and # Bundler will treat runtime dependencies like base dependencies, and
# development dependencies will be added by default to the :development group. # development dependencies will be added by default to the :development group.
gemspec gemspec

View File

@ -0,0 +1,3 @@
= Location
This project rocks and uses MIT-LICENSE.

View File

@ -14,7 +14,7 @@ end
RDoc::Task.new(:rdoc) do |rdoc| RDoc::Task.new(:rdoc) do |rdoc|
rdoc.rdoc_dir = 'rdoc' rdoc.rdoc_dir = 'rdoc'
rdoc.title = 'Gprs' rdoc.title = 'Location'
rdoc.options << '--line-numbers' rdoc.options << '--line-numbers'
rdoc.rdoc_files.include('README.rdoc') rdoc.rdoc_files.include('README.rdoc')
rdoc.rdoc_files.include('lib/**/*.rb') rdoc.rdoc_files.include('lib/**/*.rb')

View File

@ -1,13 +1,11 @@
class Panel::Gprs::BackEnd::LocationsController < OrbitBackendController class Panel::Location::BackEnd::LocationsController < OrbitBackendController
include AdminHelper
#before_filter :clean_values, :only => [:create, :update] before_filter :force_order_for_visitor,:only => [:index, :new, :edit, :create, :update, :delete]
before_filter :force_order_for_visitor,:only => [:index, :new, :edit, :delete]
before_filter :force_order_for_user,:except => [:get_locations,:index] before_filter :force_order_for_user,:except => [:get_locations,:index]
#before_filter :for_app_sub_manager,:except => [:index, :new, :edit, :delete, :get_locations]
def index def index
@locations = Location.all @location_infos = LocationInfo.all
respond_to do |format| respond_to do |format|
format.html # new.html.erb format.html # new.html.erb
format.json { render json: @locations } format.json { render json: @locations }
@ -15,7 +13,7 @@ class Panel::Gprs::BackEnd::LocationsController < OrbitBackendController
end end
def new def new
@location = Location.new @location_info = LocationInfo.new
respond_to do |format| respond_to do |format|
format.html # new.html.erb format.html # new.html.erb
@ -24,11 +22,11 @@ class Panel::Gprs::BackEnd::LocationsController < OrbitBackendController
end end
def edit def edit
@location = Location.find(params[:id]) @location_info = LocationInfo.find(params[:id])
end end
def show def show
@location = Location.find(params[:id]) @location_info = LocationInfo.find(params[:id])
respond_to do |format| respond_to do |format|
format.html format.html
format.json { render json: @location } format.json { render json: @location }
@ -36,29 +34,34 @@ class Panel::Gprs::BackEnd::LocationsController < OrbitBackendController
end end
def create def create
@location = Location.new(params[:location]) @location_info = LocationInfo.new(params[:location_info])
@location.save! if @location_info.save
redirect_to panel_gprs_back_end_locations_url flash[:success] = "Success!!"
redirect_to panel_location_back_end_locations_url
else
error_msg = @location_info.errors.full_messages
render 'new'
end
end end
def update def update
@location = Location.find(params[:id]) @location_info = LocationInfo.find(params[:id])
@location.update_attributes(params[:location]) @location_info.update_attributes(params[:location_info])
redirect_to panel_gprs_back_end_locations_url redirect_to panel_location_back_end_locations_url
end end
def destroy def destroy
@location = Location.find(params[:id]) @location_info = LocationInfo.find(params[:id])
@location.destroy @location_info.destroy
redirect_to panel_gprs_back_end_locations_url redirect_to panel_location_back_end_locations_url
end end
def get_locations def get_locations
locations = Location.all location_infos = LocationInfo.all
@data = Array.new @data = Array.new
locations.each do |location| location_infos.each do |location|
picurl = location.file.blank? ? '' : "http://#{request.host_with_port + location.file.url}" picurl = location.file.blank? ? '' : "http://#{request.host_with_port + location.file.url}"
thumburl = location.file.blank? ? '' : "http://#{request.host_with_port + location.file.thumb.url}" thumburl = location.file.blank? ? '' : "http://#{request.host_with_port + location.file.thumb.url}"
@data << { name: location.name, @data << { name: location.name,
@ -69,9 +72,6 @@ class Panel::Gprs::BackEnd::LocationsController < OrbitBackendController
description: location.description } description: location.description }
end end
#print readable json
render :json => JSON.pretty_generate({location: @data}) render :json => JSON.pretty_generate({location: @data})
#render :json => {location: @data}.to_json
end end
end end

View File

@ -0,0 +1,2 @@
module Panel::Location::BackEnd::LocationsHelper
end

View File

@ -0,0 +1,19 @@
class LocationInfo
include Mongoid::Document
include Mongoid::Timestamps
mount_uploader :file, LocationsUploader
field :name, localize: true
field :description, localize: true
field :longitude, type: Float
field :latitude, type: Float
validates :file, presence: true
validates :longitude,
numericality: { less_than_or_equal_to: 180.0, greater_than_or_equal_to: -180.0 },
unless: Proc.new{self.longitude.blank?}
validates :latitude,
numericality: { less_than_or_equal_to: 90.0, greater_than_or_equal_to: -90.0 },
unless: Proc.new{self.latitude.blank?}
end

View File

@ -1,4 +1,4 @@
class GprsUploader < CarrierWave::Uploader::Base class LocationsUploader < CarrierWave::Uploader::Base
# Include RMagick or ImageScience support: # Include RMagick or ImageScience support:
# include CarrierWave::RMagick # include CarrierWave::RMagick
@ -12,7 +12,7 @@ class GprsUploader < CarrierWave::Uploader::Base
# Override the directory where uploaded files will be stored. # Override the directory where uploaded files will be stored.
# This is a sensible default for uploaders that are meant to be mounted: # This is a sensible default for uploaders that are meant to be mounted:
def store_dir def store_dir
"gprs/#{model.class.to_s.underscore}/#{mounted_as}/#{model.id}" "location/#{model.class.to_s.underscore}/#{mounted_as}/#{model.id}"
end end
# Provide a default URL as a default if there hasn't been a file uploaded: # Provide a default URL as a default if there hasn't been a file uploaded:

View File

@ -0,0 +1,38 @@
<% @location_info.errors.full_messages.each do |msg| %>
<li>* <%= msg %></li>
<% end %>
<div class="control-group">
<label class="control-label" for=""><%= t "name" %></label>
<div class="controls">
<%= f.fields_for :name_translations do |f| %>
<%= f.text_field locale, :class=>'span4', :value => (@location_info.name_translations[locale.to_s] rescue nil) %>
<% end %>
</div>
</div>
<div class="control-group">
<label class="control-label" for=""><%= t 'picture' %></label>
<div class="controls">
<%= @location_info.file? ? ( link_to t(:view), @location_info.file.url, {:class => 'for_preview btn', :target => '_blank', :title => t(:view)}) : '' %>
<%= f.file_field :file %>
</div>
</div>
<div class="control-group">
<label class="control-label" for=""><%= t 'coordinates' %></label>
<div class="controls">
<%= f.text_field :longitude, :class=>"span2", :placeholder => "Longitude" %>
<%= f.text_field :latitude, :class=>"span2", :placeholder => "Langitude" %>
</div>
</div>
<div class="control-group">
<label class="control-label" for=""><%= t 'description' %></label>
<div class="controls">
<%= f.fields_for :description_translations do |f| %>
<%= f.text_area locale, :class=>'span4', :cols=>"30", :row=>"5", :value => (@location_info.description_translations[locale.to_s] rescue nil) %>
<% end %>
</div>
</div>
<div class="control-group">
<div class="controls">
<%= f.submit t("submit"), :class=>"btn" %>
</div>
</div>

View File

@ -0,0 +1,4 @@
<%= form_for @location_info, :url=> panel_location_back_end_location_path(@location_info), :html => { :class=>"form-horizontal"} do |f| %>
<%= render :partial => 'form', :locals => {:f => f} %>
<% end %>

View File

@ -13,22 +13,21 @@
</tr> </tr>
</thead> </thead>
<tbody id="tbody_locations" class="sort-holder"> <tbody id="tbody_locations" class="sort-holder">
<% @locations.each do |location| %> <% @location_infos.each do |location| %>
<tr class="with_action"> <tr class="with_action">
<td><%= image_tag(location.file, alt: location.file, size: "50x50" ) if !location.file.blank? %></td> <td><%= image_tag(location.file, alt: location.file, size: "50x50" ) if !location.file.blank? %></td>
<td><%= location.name%></td> <td><%= location.name %></td>
<td><%= location.longitude%></td> <td><%= location.longitude%></td>
<td><%= location.latitude%></td> <td><%= location.latitude%></td>
<td><%= location.description%></td> <td><%= location.description %></td>
<%if is_manager? %> <%if is_manager? %>
<td><%= link_to 'Edit', edit_panel_gprs_back_end_location_path(location) %></td> <td><%= link_to 'Edit', edit_panel_location_back_end_location_path(location) %></td>
<td><%= link_to 'Destroy', panel_gprs_back_end_location_path(location), method: :delete , :confirm => t(:sure?) %></td> <td><%= link_to 'Destroy', panel_location_back_end_location_path(location), method: :delete , :confirm => t(:sure?) %></td>
<%end%> <%end%>
</tr> </tr>
<% end %> <% end %>
</tbody> </tbody>
</table> </table>
<%if is_manager? %> <%if is_manager? %>
<td><%= link_to 'New', new_panel_gprs_back_end_location_path %></td> <td><%= link_to 'New', new_panel_location_back_end_location_path %></td>
<% end %> <% end %>

View File

@ -0,0 +1,3 @@
<%= form_for @location_info, :url=> panel_location_back_end_locations_path, :html => { :class=>"form-horizontal"} do |f| %>
<%= render :partial => 'form', :locals => {:f => f} %>
<% end %>

View File

@ -1,6 +1,6 @@
Rails.application.routes.draw do Rails.application.routes.draw do
namespace :panel do namespace :panel do
namespace :gprs do namespace :location do
namespace :back_end do namespace :back_end do
match "locations/get_locations" => "locations#get_locations" match "locations/get_locations" => "locations#get_locations"

View File

@ -0,0 +1,4 @@
require "location/engine"
module Location
end

View File

@ -1,4 +1,4 @@
module Gprs module Location
class Engine < Rails::Engine class Engine < Rails::Engine
end end
end end

View File

@ -1,3 +1,3 @@
module Gprs module Location
VERSION = "0.0.1" VERSION = "0.0.1"
end end

View File

@ -1,4 +1,4 @@
# desc "Explaining what the task does" # desc "Explaining what the task does"
# task :gprs do # task :location do
# # Task goes here # # Task goes here
# end # end

View File

@ -1,17 +1,17 @@
$:.push File.expand_path("../lib", __FILE__) $:.push File.expand_path("../lib", __FILE__)
# Maintain your gem's version: # Maintain your gem's version:
require "gprs/version" require "location/version"
# Describe your gem and declare its dependencies: # Describe your gem and declare its dependencies:
Gem::Specification.new do |s| Gem::Specification.new do |s|
s.name = "gprs" s.name = "location"
s.version = Gprs::VERSION s.version = Location::VERSION
s.authors = ["TODO: Your name"] s.authors = ["TODO: Your name"]
s.email = ["TODO: Your email"] s.email = ["TODO: Your email"]
s.homepage = "TODO" s.homepage = "TODO"
s.summary = "TODO: Summary of Gprs." s.summary = "TODO: Summary of Location."
s.description = "TODO: Description of Gprs." s.description = "TODO: Description of Location."
s.files = Dir["{app,config,db,lib}/**/*"] + ["MIT-LICENSE", "Rakefile", "README.rdoc"] s.files = Dir["{app,config,db,lib}/**/*"] + ["MIT-LICENSE", "Rakefile", "README.rdoc"]
s.test_files = Dir["test/**/*"] s.test_files = Dir["test/**/*"]

View File

@ -0,0 +1,12 @@
{
"title": "location",
"version": "0.1",
"organization": "Rulingcom",
"author": "RD dep",
"intro": "A simple blog……",
"update_info": "Some info",
"create_date": "11-11-2011",
"widgets": [],
"category": [],
"enable_frontend": false
}

View File

@ -3,7 +3,7 @@ require File.expand_path('../boot', __FILE__)
require 'rails/all' require 'rails/all'
Bundler.require Bundler.require
require "gprs" require "location"
module Dummy module Dummy
class Application < Rails::Application class Application < Rails::Application

View File

@ -1,6 +1,6 @@
require 'test_helper' require 'test_helper'
class Panel::Gprs::BackEnd::LocationsControllerTest < ActionController::TestCase class Panel::Location::BackEnd::LocationsControllerTest < ActionController::TestCase
test "should get index" do test "should get index" do
get :index get :index
assert_response :success assert_response :success

View File

@ -0,0 +1,7 @@
require 'test_helper'
class LocationTest < ActiveSupport::TestCase
test "truth" do
assert_kind_of Module, Location
end
end

View File

@ -0,0 +1,4 @@
require 'test_helper'
class Panel::Location::BackEnd::LocationsHelperTest < ActionView::TestCase
end

View File

@ -1,2 +0,0 @@
class Panel::PersonalJournal::Desktop::JournalListsController < ApplicationController
end

View File

@ -6,23 +6,6 @@
<%= submit_tag "Cancel", :type => "button", class: "bt-cancel ini_input hp hh2 thmadm thmtxt" %> <%= submit_tag "Cancel", :type => "button", class: "bt-cancel ini_input hp hh2 thmadm thmtxt" %>
<% end %> <% end %>
</div> </div>
<!--<div class="hh2 hp sdm">
<div class="sdm_t hh2">Entry Year</div>
<div class="admbg sdm_o">
<ul>
<li><a class="hp hh2 admtxt" href="">2012</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>
</ul>
</div>
</div>-->
<div class="hh2 hp sdm"> <div class="hh2 hp sdm">
<div class="sdm_t hh2">Share</div> <div class="sdm_t hh2">Share</div>
<div class="admbg sdm_o"> <div class="admbg sdm_o">
@ -46,15 +29,28 @@
<div class="s_grid_con s_form"> <div class="s_grid_con s_form">
<ul> <ul>
<li class="s_grid_row"> <li class="s_grid_row">
<%= f.text_area :paper_title, size: "20x2", placeholder: "Paper Title", class: "s_grid_6 s_grid"%> <%= f.fields_for :paper_title_translations do |f| %>
<%= f.text_area locale,
class: "s_grid_6 s_grid",
size: "20x2",
placeholder: t("personal_journal.paper_title"),
value: (@writing_journal.paper_title_translations[locale] rescue nil) %>
<% end %>
</li> </li>
<li class="s_grid_row"> <li class="s_grid_row">
<%= f.text_field :journal_title, size: "20", placeholder: "Journal Title", class: "s_grid_6 s_grid", "autocomplete-list" => "journal_title_autocomplete_list" %> <%= f.fields_for :journal_title_translations do |f| %>
<%= f.text_field locale,
size: "20",
placeholder: t("personal_journal.journal_title"),
class: "s_grid_6 s_grid",
"autocomplete-list" => "journal_title_autocomplete_list",
value: (@writing_journal.journal_title_translations[locale] rescue nil) %>
<% end %>
<span class="icon-plus input_append"></span> <span class="icon-plus input_append"></span>
</li> </li>
<li class="s_grid_row"> <li class="s_grid_row">
<div class="check_box_g"> <div class="check_box_g">
<%= label_tag("", "Journal Level") %> <%= label_tag("", t("personal_journal.level_type")) %>
<ul> <ul>
<% @level_types.each_with_index do |level_type, i| %> <% @level_types.each_with_index do |level_type, i| %>
<li> <li>
@ -66,23 +62,19 @@
</li> </li>
<% end %> <% end %>
</ul> </ul>
<!--<label for="">Journal Level</label>
<ul>
<li><input type="checkbox"><label for="">SCI</label></li>
</ul>-->
</div> </div>
</li> </li>
<li class="s_grid_row"> <li class="s_grid_row">
<%= label_tag("", "ISSN(ISBN)", class: "s_grid_2 s_grid") %><%= f.text_field :isbn, size: "20", placeholder: "829872987", class: "s_grid_4 s_grid"%> <%= label_tag("", t("personal_journal.isbn"), class: "s_grid_2 s_grid") %><%= f.text_field :isbn, size: "20", placeholder: "829872987", class: "s_grid_4 s_grid"%>
</li> </li>
<li class="s_grid_row"> <li class="s_grid_row">
<%= label_tag("", "Volume No.", class: "s_grid_2 s_grid") %><%= f.text_field :vol_no, size: "20", placeholder: "829872987", class: "s_grid_4 s_grid"%> <%= label_tag("", t("personal_journal.vol_no"), class: "s_grid_2 s_grid") %><%= f.text_field :vol_no, size: "20", placeholder: "829872987", class: "s_grid_4 s_grid"%>
</li> </li>
<li class="s_grid_row"> <li class="s_grid_row">
<%= label_tag("", "Issue No.", class: "s_grid_2 s_grid") %><%= f.text_field :issue_no, size: "20", placeholder:"829872987", class: "s_grid_4 s_grid"%> <%= label_tag("", t("personal_journal.issue_no"), class: "s_grid_2 s_grid") %><%= f.text_field :issue_no, size: "20", placeholder:"829872987", class: "s_grid_4 s_grid"%>
</li> </li>
<li class="s_grid_row"> <li class="s_grid_row">
@ -90,20 +82,28 @@
</li> </li>
<li class="s_grid_row"> <li class="s_grid_row">
<%= label_tag("", "Pages", class: "s_grid_2 s_grid") %><%= label_tag("", "from", class: "s_grid_1 s_grid") %><%= f.text_field :form_to_start, size: "10", placeholder: "1", class: "s_grid_1 s_grid"%><%= label_tag("", "to", class: "s_grid_1 s_grid") %><%= f.text_field :form_to_end, size: "10", placeholder: "20", class: "s_grid_1 s_grid"%> <%= label_tag("", t("personal_journal.total_pages"), class: "s_grid_2 s_grid") %><%= label_tag("", "from", class: "s_grid_1 s_grid") %><%= f.text_field :form_to_start, size: "10", placeholder: "1", class: "s_grid_1 s_grid"%><%= label_tag("", "to", class: "s_grid_1 s_grid") %><%= f.text_field :form_to_end, size: "10", placeholder: "20", class: "s_grid_1 s_grid"%>
</li> </li>
</ul> </ul>
</div> </div>
<div class="s_grid_con s_form"> <div class="s_grid_con s_form">
<ul> <ul>
<li class="s_grid_row"> <li class="s_grid_row">
<%= f.text_area :authors, size: "20x2", placeholder: "Authors", class: "s_grid_6 s_grid", "autocomplete-list" => "coauthor_autocomplete_list"%> <%= f.fields_for :authors_translations do |f| %>
<%= f.text_area locale,
class: "s_grid_6 s_grid",
size: "20x2",
placeholder: t("web_resource.authors"),
"autocomplete-list" => "coauthor_autocomplete_list",
value: (@writing_journal.authors_translations[locale] rescue nil) %>
<% end %>
<span class="icon-plus input_append"></span> <span class="icon-plus input_append"></span>
</li> </li>
<li class="s_grid_row"> <li class="s_grid_row">
<select name="writing_journal[journal_author_type_ids][]" id="" class="s_grid s_grid_4"> <select name="writing_journal[journal_author_type_ids][]" id="" class="s_grid s_grid_4">
<%= options_for_select( <%= options_for_select(
[t("personal_journal.author_type")] +
@author_types.map do |author_type| @author_types.map do |author_type|
[author_type.title, author_type.id] [author_type.title, author_type.id]
end end
@ -113,34 +113,32 @@
<select name="writing_journal[journal_paper_type_ids][]" id="" class="s_grid s_grid_2"> <select name="writing_journal[journal_paper_type_ids][]" id="" class="s_grid s_grid_2">
<%= options_for_select( <%= options_for_select(
@paper_types.map do |paper_type| [t("personal_journal.level_type")] +
[paper_type.title, paper_type.id] @paper_types.map do |paper_type|
end [paper_type.title, paper_type.id]
) end
%> )
%>
</select> </select>
</li> </li>
<li class="s_grid_row"> <li class="s_grid_row">
<%= label_tag("", "Date of Publication", class: "s_grid_3 s_grid") %> <%= label_tag("", t("personal_journal.publication_date"), class: "s_grid_3 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_1 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_1 s_grid'} %>
</li> </li>
<li class="s_grid_row"> <li class="s_grid_row">
<%= f.text_field :keywords, size: "20", value: @writing_journal.keywords ||= "Keywords", class: "s_grid_6 s_grid"%> <%= f.text_field :keywords, size: "20", placeholder: t("personal_journal.keywords"), class: "s_grid_6 s_grid"%>
</li> </li>
<li class="s_grid_row"> <li class="s_grid_row">
<%= f.label :year ,:class => "s_grid_2 s_grid" %> <%= f.label :year, t("personal_journal.year"), :class => "s_grid_2 s_grid" %>
<%= 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"} ) %> <%= 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"} ) %>
</li> </li>
<li class="s_grid_row"> <li class="s_grid_row">
<%= f.label :language ,:class => "s_grid_2 s_grid" %> <%= f.label :language, t("personal_journal.language"),:class => "s_grid_2 s_grid" %>
<select name="writing_journal[language][]" id="" class="s_grid s_grid_4"> <%= f.select :language,
<%= options_for_select( WritingJournal::LANGUAGE_TYPES,
[["Chinese", "Chinese"], class: "s_grid s_grid_4" %>
["English", "English"]]
)
%>
</select> </select>
</li> </li>
@ -214,8 +212,6 @@
orbitDesktop.prototype.initializeJournalPapers.coauthor_autocomplete_list = <%= @co_author_candidate.to_json.html_safe %>; orbitDesktop.prototype.initializeJournalPapers.coauthor_autocomplete_list = <%= @co_author_candidate.to_json.html_safe %>;
</script> </script>
<%= javascript_include_tag "archive_plugin_form" %>
<script> <script>
$('#add_plugin_file a.add').click(function(){ $('#add_plugin_file a.add').click(function(){
var new_id = $(this).prev().attr('value'); var new_id = $(this).prev().attr('value');

View File

@ -1,11 +1,18 @@
<tr id="<%= "plugin_file_#{form_file.id}" if !form_file.new_record? %>" class="list_item"> <tr id="<%= "plugin_file_#{form_file.id}" if !form_file.new_record? %>" class="list_item">
<td> <td>
<div> <div>
<%= f.file_field :file, class: "s_grid_2 s_grid" %> <% if form_file.new_record? %>
<%= f.file_field :file, class: "s_grid_2 s_grid" %>
<% end %>
</div> </div>
</td> </td>
<td> <td>
<%= f.text_field :title, :class=>'s_grid_3 s_grid' %> <%= f.text_field :title %>
<%= f.fields_for :file_title_translations do |f| %>
<%= f.text_field locale,
class: 's_grid_3 s_grid',
value: (form_file.file_title_translations[locale] rescue nil) %>
<% end %>
</td> </td>
<td> <td>
@ -21,3 +28,4 @@
</span> </span>
</td> </td>
</tr> </tr>