From b6c96acfe40a9b6f2efa68a5cb1a82446bfa2d99 Mon Sep 17 00:00:00 2001 From: Harry Bomrah Date: Fri, 21 Nov 2014 14:13:38 +0800 Subject: [PATCH] for desktop journal paper --- .../admin/journal_papers_controller.rb | 3 + .../desktop/journal_papers_controller.rb | 133 +----------------- 2 files changed, 6 insertions(+), 130 deletions(-) diff --git a/app/controllers/admin/journal_papers_controller.rb b/app/controllers/admin/journal_papers_controller.rb index 3fb3c4e..e284bdd 100644 --- a/app/controllers/admin/journal_papers_controller.rb +++ b/app/controllers/admin/journal_papers_controller.rb @@ -31,6 +31,9 @@ class Admin::JournalPapersController < OrbitMemberController def new @journal_paper = JournalPaper.new @member = MemberProfile.find_by(:uid=>params['uid']) rescue nil + if params[:desktop] + render :layout => false + end end def edit diff --git a/app/controllers/desktop/journal_papers_controller.rb b/app/controllers/desktop/journal_papers_controller.rb index 90452dd..df2eaff 100644 --- a/app/controllers/desktop/journal_papers_controller.rb +++ b/app/controllers/desktop/journal_papers_controller.rb @@ -1,5 +1,6 @@ class Desktop::JournalPapersController < DesktopAdminController def menu + user = OrbitHelper.current_user [ { "title" => "List", @@ -9,139 +10,11 @@ class Desktop::JournalPapersController < DesktopAdminController { "title" => "Add/Edit", "layout" => "form", - "data" => {"form" => form_data,"form_url" => "/something/"} } + "new_path" => "/admin/members/#{user.member_profile.to_param}/journal_papers/new" + } ] end - def form_data - [ - { - "type" => "text", - "id" => "text", - "label" => { - "en" => "Title English", - "zh_tw" => "Title Chinese" - }, - "placeholder" => { - "en" => "Title English", - "zh_tw" => "Title Chinese" - }, - "name" => "journal_papers[title]", - "multilanguage" => true - }, - { - "type" => "checkbox", - "label" => "Check Box", - "name" => "journal_papers[checkbox]", - "option" => [{ - "id" => "A", - "label" => { - "en" => "Check Box English", - "zh_tw" => "Check Box Chinese" - }, - "value" => { - "en" => "A_en", - "zh_tw" => "A_zh_tw" - } - }, { - "id" => "B", - "label" => { - "en" => "Check Box English", - "zh_tw" => "Check Box Chinese" - }, - "value" => { - "en" => "B_en", - "zh_tw" => "B_zh_tw" - } - }], - "multilanguage" => true - }, - { - "type" => "radio", - "label" => "Radio", - "name" => "journal_papers[radio]", - "option" => [{ - "id" => "C", - "label" => { - "en" => "Radio1 English", - "zh_tw" => "Radio1 Chinese" - }, - "value" => { - "en" => "A_en", - "zh_tw" => "A_zh_tw" - } - }, { - "id" => "D", - "label" => { - "en" => "Radio2 English", - "zh_tw" => "Radio2 Chinese" - }, - "value" => { - "en" => "B_en", - "zh_tw" => "B_zh_tw" - } - }], - "multilanguage" => true - }, - { - "type" => "select", - "id" => "select", - "label" => "Select", - "name" => "journal_papers[select]", - "option" => [{ - "text" => { - "en" => "Option1 English", - "zh_tw" => "Option1 Chinese" - }, - "value" => { - "en" => "A_en", - "zh_tw" => "A_zh_tw" - }, - "selected" => true - },{ - "text" => { - "en" => "Option2 English", - "zh_tw" => "Option2 Chinese" - }, - "value" => { - "en" => "B_en", - "zh_tw" => "B_zh_tw" - } - },{ - "text" => { - "en" => "Option3 English", - "zh_tw" => "Option3 Chinese" - }, - "value" => { - "en" => "C_en", - "zh_tw" => "C_zh_tw" - } - }], - "multilanguage" => true - }, - { - "type" => "textarea", - "id" => "textarea", - "label" => { - "en" => "Textarea English", - "zh_tw" => "Textarea Chinese" - }, - "name" => "journal_papers[textarea]", - "multilanguage" => true - }, - { - "type" => "file", - "id" => "file", - "label" => { - "en" => "File English", - "zh_tw" => "File Chinese" - }, - "name" => "journal_papers[file]", - "multilanguage" => true - } - ] - end - def get_paper_list user = OrbitHelper.current_user user_profile = user.member_profile