diff --git a/app/controllers/personal_writings_controller.rb b/app/controllers/personal_writings_controller.rb index 2f257be..735274a 100644 --- a/app/controllers/personal_writings_controller.rb +++ b/app/controllers/personal_writings_controller.rb @@ -4,8 +4,9 @@ class PersonalWritingsController < ApplicationController writing_list = writings.collect do |writing| { "year" => writing.year, + "month" => writing.month, "writing_title" => writing.writing_title, - "location" => writing.location, + "other" => writing.other, "member" => (writing.member_profile.name rescue ""), "link_to_show" => OrbitHelper.url_to_show(writing.to_param) } @@ -15,8 +16,9 @@ class PersonalWritingsController < ApplicationController "extras" => { "widget-title" => t("module_name.personal_writing"), "th_year" => t('personal_writing.year'), + "th_month" => t('personal_writing.month'), "th_writing_title" => t('module_name.personal_writing'), - "th_location" => t('personal_writing.location'), + "th_other" => t('personal_writing.other'), "th_member" => t('users.name'), "th_detail" => t('detail') }, @@ -29,16 +31,10 @@ class PersonalWritingsController < ApplicationController plugin = Writing.where(:is_hidden=>false).find_by(uid: params[:uid]) fields_to_show = [ "year", + "month", "writing_title", - "location", - "participating_professor", - "participating_student", - "research_direction", - "facility", - "keywords", - "extension_no", + "other", "url", - "note", "file" ] diff --git a/app/helpers/admin/personal_writings_helper.rb b/app/helpers/admin/personal_writings_helper.rb index f21ec39..6bf3781 100644 --- a/app/helpers/admin/personal_writings_helper.rb +++ b/app/helpers/admin/personal_writings_helper.rb @@ -51,39 +51,13 @@ module Admin::PersonalWritingsHelper rescue value = {"zh_tw" => val} end - writing.location_translations = value + writing.other_translations = value when 6 - value = {"en" => val} - when 7 - begin - value["zh_tw"] = val - rescue - value = {"zh_tw" => val} - end - writing.participating_professor_translations = value - when 8 - value = {"en" => val} - when 9 - begin - value["zh_tw"] = val - rescue - value = {"zh_tw" => val} - end - writing.participating_student_translations = value - when 10 writing.year = val - when 11 - writing.extension_no = val - when 12 - writing.research_direction = val - when 13 - writing.facility = val - when 14 + when 7 + writing.month = val + when 8 writing.url = val - when 15 - writing.keywords = val - when 16 - writing.note = val end end writing.member_profile = mp diff --git a/app/models/writing.rb b/app/models/writing.rb index c568139..efba74b 100644 --- a/app/models/writing.rb +++ b/app/models/writing.rb @@ -3,22 +3,14 @@ class Writing include Mongoid::Timestamps include OrbitModel::Status include Slug - + include OrbitCategory::Categorizable belongs_to :member_profile field :writing_title, :as=>:slug_title, localize: true - field :location, localize: true - field :participating_professor, localize: true - field :participating_student, localize: true - + field :other, localize: true + field :month field :year - field :language - field :keywords - field :extension_no - field :research_direction - field :facility field :url - field :note field :create_user_id, :type => BSON::ObjectId field :update_user_id, :type => BSON::ObjectId @@ -45,8 +37,10 @@ class Writing fields_to_show = [ "year", + "month", "writing_title", - "location" + "other", + "url" ] fields_to_remove = [] diff --git a/app/views/admin/writings/_form.html.erb b/app/views/admin/writings/_form.html.erb index ff50bbc..23de51c 100644 --- a/app/views/admin/writings/_form.html.erb +++ b/app/views/admin/writings/_form.html.erb @@ -3,13 +3,14 @@ <%= stylesheet_link_tag "lib/main-forms" %> <%= stylesheet_link_tag "lib/fileupload" %> <%= stylesheet_link_tag "lib/main-list" %> + + <% end %> <% content_for :page_specific_javascript do %> <%= javascript_include_tag "lib/bootstrap-fileupload" %> <%= javascript_include_tag "lib/file-type" %> <%= javascript_include_tag "lib/module-area" %> <% end %> -
@@ -32,47 +33,36 @@ <% @site_in_use_locales.each_with_index do |locale, i| %>
"> - - +
- +
- <%= f.fields_for :lab_title_translations do |f| %> - <%= f.text_field locale, class: "input-block-level", placeholder: t("personal_writing.lab_title"), value: (@writing.lab_title_translations[locale] rescue nil) %> + <%= f.fields_for :writing_title_translations do |f| %> + <%= f.text_field locale, class: "input-block-level", placeholder: t("personal_writing.writing_title"), value: (@writing.writing_title_translations[locale] rescue nil) %> <% end %>
- - + +
- +
- <%= f.fields_for :location_translations do |f| %> - <%= f.text_field locale, class: "input-block-level", placeholder: t("personal_writing.location"), value: (@writing.location_translations[locale] rescue nil) %> + <%= f.fields_for :other_translations do |f| %> + <%= f.text_field locale, class: "input-block-level", placeholder: t("personal_writing.other"), value: (@writing.other_translations[locale] rescue nil) %> <% end %>
- - -
- -
- <%= f.fields_for :participating_professor_translations do |f| %> - <%= f.text_field locale, class: "input-block-level", placeholder: t("personal_writing.participating_professor"), value: (@writing.participating_professor_translations[locale] rescue nil) %> - <% end %> -
-
- - -
- -
- <%= f.fields_for :participating_student_translations do |f| %> - <%= f.text_field locale, class: "input-block-level", placeholder: t("personal_writing.participating_student"), value: (@writing.participating_student_translations[locale] rescue nil) %> - <% end %> -
-
-
<% end %> @@ -83,11 +73,11 @@
- <% if @writing && !@writing.lab_files.blank? %> + <% if @writing && !@writing.writing_files.blank? %>
- <% @writing.lab_files.each_with_index do |lab_file, i| %> - <%= f.fields_for :lab_files, lab_file do |f| %> - <%= render :partial => 'form_file', :object => lab_file, :locals => {:f => f, :i => i} %> + <% @writing.writing_files.each_with_index do |writing_file, i| %> + <%= f.fields_for :writing_files, writing_file do |f| %> + <%= render :partial => 'form_file', :object => writing_file, :locals => {:f => f, :i => i} %> <% end %> <% end %>
@@ -98,7 +88,7 @@

- <%= hidden_field_tag 'plugin_file_field_count', @writing.lab_files.count %> + <%= hidden_field_tag 'plugin_file_field_count', @writing.writing_files.count %> <%= t(:add) %>

@@ -123,7 +113,13 @@
- + +
+ +
+ <%= select_category(f, @module_app) %> +
+
<% if !@member.nil? %>
@@ -152,31 +148,13 @@ <%= select_year((@writing.year ? @writing.year.to_i : DateTime.now.year), {:start_year => (DateTime.now.year+5), :end_year => 1930}, {:name => 'writing[year]', :class => 'span1'} ) %>
- - +
- +
- <%= f.text_field :extension_no %> + <%= select_month((@writing.month ? @writing.month.to_i : DateTime.now.month) ,:field_name => 'month', :prefix => 'writing' ) %>
- - -
- -
- <%= f.text_field :research_direction %> -
-
- - -
- -
- <%= f.text_field :facility %> -
-
-
@@ -184,23 +162,6 @@ <%= f.text_field :url , :class => "span6" %>
- - -
- -
- <%= f.text_field :keywords %> -
-
- - -
- -
- <%= f.text_area :note, rows: 2, class: "input-block-level" %> -
-
-
@@ -231,11 +192,11 @@ $('.main-forms').find('.add-on').tooltip().end().on('click', '.trigger, .delete_file, .remove_existing_record', function() { if($(this).hasClass('trigger')) { var new_id = $(this).prev().attr('value'); - var old_id = new RegExp("new_lab_files", "g"); + var old_id = new RegExp("new_writing_files", "g"); var on = $('.language-nav li.active').index(); var le = $(this).parent('.add-btn').prev('.add-target').children('.start-line').length; $(this).prev().attr('value', parseInt(new_id) + 1); - $(this).parent().siblings('.add-target').append(("<%= escape_javascript(add_attribute 'form_file', f, :lab_files) %>").replace(old_id, new_id)); + $(this).parent().siblings('.add-target').append(("<%= escape_javascript(add_attribute 'form_file', f, :writing_files) %>").replace(old_id, new_id)); $(this).parent('.add-btn').prev('.add-target').children('.start-line').eq(le).children('.input-append').find('.tab-content').each(function() { $(this).children('.tab-pane').eq(on).addClass('in active').siblings().removeClass('in active'); }); @@ -249,4 +210,18 @@ } } }); + $(document).ready(function(){ + $('.help_btn').click(function(){ + $('#show_help_modal').modal('show'); + return false; + }); + $('#show_help_modal .close').off("click").on('click',function(){ + $('#show_help_modal').modal('hide'); + return false; + }); + $('#show_help_modal .modal-footer button').off("click").on('click',function(){ + $('#show_help_modal').modal('hide'); + return false; + }); + }) \ No newline at end of file diff --git a/app/views/admin/writings/_writing.html.erb b/app/views/admin/writings/_writing.html.erb index 2ccb3e7..38f9e2e 100644 --- a/app/views/admin/writings/_writing.html.erb +++ b/app/views/admin/writings/_writing.html.erb @@ -1,6 +1,8 @@ <% @writings.each do |writing| %> "> + <%= writing.category.title rescue "" %> <%= writing.year %> + <%= writing.month %> <%= link_to writing.writing_title, OrbitHelper.url_to_plugin_show(writing.to_param,'personal_writing'), target: "blank"%>
@@ -10,7 +12,6 @@
- <%= writing.location %> <%= writing.member_profile.name rescue "" %> <% end %> \ No newline at end of file diff --git a/app/views/admin/writings/edit.html.erb b/app/views/admin/writings/edit.html.erb index e893704..1033424 100644 --- a/app/views/admin/writings/edit.html.erb +++ b/app/views/admin/writings/edit.html.erb @@ -1,4 +1,4 @@ -<%= form_for @writing, url:'/admin/labs/'+@writing.id.to_s, html: {class: "form-horizontal main-forms previewable"} do |f| %> +<%= form_for @writing, url:'/admin/writings/'+@writing.id.to_s, html: {class: "form-horizontal main-forms previewable"} do |f| %>
<%= render partial: 'form', locals: {f: f} %>
diff --git a/app/views/admin/writings/frontend_setting.html.erb b/app/views/admin/writings/frontend_setting.html.erb index da2a886..9a78e9c 100644 --- a/app/views/admin/writings/frontend_setting.html.erb +++ b/app/views/admin/writings/frontend_setting.html.erb @@ -3,7 +3,7 @@ <%= stylesheet_link_tag "lib/main-list" %> <% end %> -<%= form_for(:lab_intro, :url => update_frontend_setting_admin_labs_path, :method => "post", html: {class: "form-horizontal main-forms previewable"} ) do |f| %> +<%= form_for(:writing_intro, :url => update_frontend_setting_admin_writings_path, :method => "post", html: {class: "form-horizontal main-forms previewable"} ) do |f| %>
diff --git a/app/views/admin/writings/index.html.erb b/app/views/admin/writings/index.html.erb index d25d6d9..2ba486c 100644 --- a/app/views/admin/writings/index.html.erb +++ b/app/views/admin/writings/index.html.erb @@ -1,13 +1,14 @@ + + - - + <%= render 'writing' %>
<%= t(:category) %> <%= t('personal_writing.year') %><%= t('personal_writing.month') %> <%= t('module_name.personal_writing') %><%= t('personal_writing.location') %> <%= t('users.name') %>
@@ -20,23 +21,23 @@
- <%= link_to content_tag(:i, nil, :class => 'icon-plus icon-white') + t(:new_), new_admin_lab_path, :class => 'btn btn-primary' %> + <%= link_to content_tag(:i, nil, :class => 'icon-plus icon-white') + t(:new_), new_admin_writing_path, :class => 'btn btn-primary' %> <% if params[:error] == "1" %> <% end %> \ No newline at end of file diff --git a/app/views/admin/writings/new.html.erb b/app/views/admin/writings/new.html.erb index ba0bedd..b21adfd 100644 --- a/app/views/admin/writings/new.html.erb +++ b/app/views/admin/writings/new.html.erb @@ -1,4 +1,4 @@ -<%= form_for @writing, url: admin_labs_path, html: {class: "form-horizontal main-forms previewable"} do |f| %> +<%= form_for @writing, url: admin_writings_path, html: {class: "form-horizontal main-forms previewable"} do |f| %>
<%= render partial: 'form', locals: {f: f} %>
diff --git a/app/views/plugin/personal_writing/_profile.html.erb b/app/views/plugin/personal_writing/_profile.html.erb index 0d1ecbd..1cf229a 100644 --- a/app/views/plugin/personal_writing/_profile.html.erb +++ b/app/views/plugin/personal_writing/_profile.html.erb @@ -7,17 +7,17 @@ <% if has_access? - @labs = Writing.where(member_profile_id: @member.id).desc(:year).page(params[:page]).per(10) + @writings = Writing.where(member_profile_id: @member.id).desc(:year).page(params[:page]).per(10) else - @labs = Writing.where(is_hidden: false, member_profile_id: @member.id).desc(:year).page(params[:page]).per(10) + @writings = Writing.where(is_hidden: false, member_profile_id: @member.id).desc(:year).page(params[:page]).per(10) end %> <% if has_access? %>
- <%= link_to('Hide', '#', :class => "btn btn-mini list-active-btn disabled", "data-check-action" => "list-be-hide", :rel => toggle_hide_admin_labs_path(member_profile_id: @member.id.to_s, disable: 'true') ) %> - <%= link_to('Show', '#', :class => "btn btn-mini list-active-btn disabled", "data-check-action" => "list-be-show", :rel => toggle_hide_admin_labs_path(member_profile_id: @member.id.to_s, disable: 'false') ) %> + <%= link_to('Hide', '#', :class => "btn btn-mini list-active-btn disabled", "data-check-action" => "list-be-hide", :rel => toggle_hide_admin_writings_path(member_profile_id: @member.id.to_s, disable: 'true') ) %> + <%= link_to('Show', '#', :class => "btn btn-mini list-active-btn disabled", "data-check-action" => "list-be-show", :rel => toggle_hide_admin_writings_path(member_profile_id: @member.id.to_s, disable: 'false') ) %>
<% end -%> @@ -29,12 +29,13 @@ <% end -%> <%= t('personal_writing.year') %> + <%= t('personal_writing.month') %> <%= t('module_name.personal_writing') %> - <%= t('personal_writing.location') %> + <%= t('personal_writing.other') %> - <% @labs.each do |writing| %> + <% @writings.each do |writing| %> "> <% if has_access? %> @@ -42,18 +43,19 @@ <% end %> <%= writing.year %> + <%= writing.month %> - <%= link_to writing.lab_title, OrbitHelper.url_to_plugin_show(writing.to_param,'personal_writing'), target: "blank"%> + <%= link_to writing.writing_title, OrbitHelper.url_to_plugin_show(writing.to_param,'personal_writing'), target: "blank"%>
- <%= writing.location %> + <%= writing.other %> <% end %> @@ -63,13 +65,13 @@
<% if has_access? %>
- <%= link_to content_tag(:i, nil, :class => 'icon-edit') +' '+ t('setting'),'/admin/members/'+@member.to_param+'/labs/frontend_setting', :class => 'btn btn-primary' %> + <%= link_to content_tag(:i, nil, :class => 'icon-edit') +' '+ t('setting'),'/admin/members/'+@member.to_param+'/writings/frontend_setting', :class => 'btn btn-primary' %> <%= link_to content_tag(:i, nil, :class => 'icon-plus') +' '+ t('new_'), - '/admin/members/'+@member.to_param+'/labs/new', :class => 'btn btn-primary' %> + '/admin/members/'+@member.to_param+'/writings/new', :class => 'btn btn-primary' %>
<% end %>
diff --git a/config/locales/en.yml b/config/locales/en.yml index aa7f392..a8443b3 100644 --- a/config/locales/en.yml +++ b/config/locales/en.yml @@ -2,19 +2,15 @@ en: module_name: personal_writing: Writing personal_writing: - book_title : "Book Title" - lab_title : "Writing Title" + other: Other + other_hint: 其他欄請填寫 頁數及出版社 或 期刊名及第幾頁 或 研討會名稱 或 學位名稱 等 + writing_title : "Writing Title" extracted_chapters : "Extracted Chapters" - location : "Location" - participating_professor : "Participating Professor" - participating_student : "Participating Student" - extension_no : "Extension Number" - research_direction : "Research Direction" - facility : "Facility" publishers : "Publishers" authors : "Authors" tags : "Tags" year : "Year" + month: "Month" language : "Language" isbn : "ISSN(ISBN)" vol_no : "Vol.No" @@ -22,11 +18,9 @@ en: form_to_start : "From" form_to_end : "To" total_pages : "Total Pages" - keywords : "Keywords" abstract : "Abstract" publication_date : "Date of Publication" url : "Reference URL" - note : "Note" level_type : "Level Type" author_type : "Author Type" from : "From" @@ -37,7 +31,7 @@ en: pages : "Pages" book_paper_type : "Book Paper Type" frontend: - labs: "Writing Front-end" + writings: "Writing Front-end" create_success : "Successfully Create" update_success : "Successfully Update" diff --git a/config/locales/zh_tw.yml b/config/locales/zh_tw.yml index 074167e..7399686 100644 --- a/config/locales/zh_tw.yml +++ b/config/locales/zh_tw.yml @@ -2,17 +2,14 @@ zh_tw: module_name: personal_writing: 其他著作 personal_writing: - lab_title : "實驗室名稱" + other: 其他 + other_hint: 其他欄請填寫 頁數及出版社 或 期刊名及第幾頁 或 研討會名稱 或 學位名稱 等 + writing_title : "著作名稱" extracted_chapters : "Extracted Chapters" - participating_professor : "參與教授" - participating_student : "參與學生" - research_direction : "研究方向" - facility : "設備" - extension_no : "分機" - location : "位置" authors : "作者" tags : "領域" year : "年度" + month: "月份" language : "語言" isbn : "ISSN(ISBN)" vol_no : "卷數" @@ -20,11 +17,9 @@ zh_tw: form_to_start : "起" form_to_end : "迄" total_pages : "總頁數" - keywords : "關鍵字" abstract : "摘要" publication_date : "發表日期" url : "參考連結" - note : "記事" level_type : "期刊類別" author_type : "作者類別" from : "起" @@ -33,7 +28,7 @@ zh_tw: file_name : "檔案名稱" description : "描述" frontend: - labs: "實驗室前台" + writings: "實驗室前台" create_success : "新增完成!!" update_success : "更新完成!!" diff --git a/modules/personal_writing/index.html.erb b/modules/personal_writing/index.html.erb new file mode 100644 index 0000000..01c1241 --- /dev/null +++ b/modules/personal_writing/index.html.erb @@ -0,0 +1,24 @@ + + + + + + + + + + + + + + + + + + + + + + +

{{widget-title}}

{{th_year}}{{th_month}}{{th_writing_title}}{{th_other}}{{th_member}}
{{year}}{{month}}{{writing_title}}{{other}}{{member}}{{th_detail}}
+{{pagination_goes_here}} \ No newline at end of file diff --git a/modules/personal_writing/info.json b/modules/personal_writing/info.json new file mode 100644 index 0000000..cda3d13 --- /dev/null +++ b/modules/personal_writing/info.json @@ -0,0 +1,12 @@ +{ + "frontend": [ + { + "filename" : "index", + "name" : { + "zh_tw" : "1. 列表", + "en" : "1. List" + }, + "thumbnail" : "thumb.png" + } + ] +} \ No newline at end of file diff --git a/modules/personal_writing/show.html.erb b/modules/personal_writing/show.html.erb new file mode 100644 index 0000000..b183818 --- /dev/null +++ b/modules/personal_writing/show.html.erb @@ -0,0 +1,8 @@ + + + + + + + +
{{title}}{{value}}
diff --git a/modules/personal_writing/thumbs/thumb.png b/modules/personal_writing/thumbs/thumb.png new file mode 100644 index 0000000..266af56 Binary files /dev/null and b/modules/personal_writing/thumbs/thumb.png differ