desktop experience
This commit is contained in:
parent
04e352e594
commit
229f561594
|
@ -1,5 +1,6 @@
|
||||||
class Admin::ExperiencesController < OrbitMemberController
|
class Admin::ExperiencesController < OrbitMemberController
|
||||||
layout "member_plugin"
|
layout "member_plugin"
|
||||||
|
include Admin::PersonalExperiencesHelper
|
||||||
|
|
||||||
before_action :set_experience, only: [:show, :edit , :update, :destroy]
|
before_action :set_experience, only: [:show, :edit , :update, :destroy]
|
||||||
before_action :set_plugin
|
before_action :set_plugin
|
||||||
|
@ -15,28 +16,48 @@ class Admin::ExperiencesController < OrbitMemberController
|
||||||
def new
|
def new
|
||||||
@member = MemberProfile.find_by(:uid=>params['uid']) rescue nil
|
@member = MemberProfile.find_by(:uid=>params['uid']) rescue nil
|
||||||
@experience = Experience.new
|
@experience = Experience.new
|
||||||
|
if params[:desktop]
|
||||||
|
render :layout => false
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
def create
|
def create
|
||||||
@member = MemberProfile.find(experience_params['member_profile_id']) rescue nil
|
@member = MemberProfile.find(experience_params['member_profile_id']) rescue nil
|
||||||
@experience = Experience.new(experience_params)
|
@experience = Experience.new(experience_params)
|
||||||
@experience.save
|
@experience.save
|
||||||
redirect_to params['referer_url']
|
if params[:desktop] == "true"
|
||||||
|
render json: {"data" => get_paper_list}.to_json
|
||||||
|
else
|
||||||
|
redirect_to params['referer_url']
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
def edit
|
def edit
|
||||||
@member = @experience.member_profile rescue nil
|
@member = @experience.member_profile rescue nil
|
||||||
|
if params[:desktop]
|
||||||
|
render :layout => false
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
def update
|
def update
|
||||||
@member = @experience.member_profile rescue nil
|
@member = @experience.member_profile rescue nil
|
||||||
@experience.update_attributes(experience_params)
|
@experience.update_attributes(experience_params)
|
||||||
@experience.save
|
@experience.save
|
||||||
redirect_to params['referer_url']
|
if params[:desktop] == "true"
|
||||||
|
render json: {"data" => get_paper_list}.to_json
|
||||||
|
else
|
||||||
|
redirect_to params['referer_url']
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
def destroy
|
def destroy
|
||||||
@experience.destroy
|
@experience.destroy
|
||||||
|
respond_to do |format|
|
||||||
|
format.html { redirect_to(admin_experiences_url) }
|
||||||
|
# format.xml { head :ok }
|
||||||
|
format.js
|
||||||
|
format.json {render json: {"success" => true}}
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
def toggle_hide
|
def toggle_hide
|
||||||
|
|
|
@ -0,0 +1,23 @@
|
||||||
|
class Desktop::PersonalExperiencesController < DesktopAdminController
|
||||||
|
include Admin::PersonalExperiencesHelper
|
||||||
|
|
||||||
|
def menu
|
||||||
|
user = OrbitHelper.current_user
|
||||||
|
[
|
||||||
|
{
|
||||||
|
"title" => "List",
|
||||||
|
"layout" => "list"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"title" => "Add/Edit",
|
||||||
|
"layout" => "form",
|
||||||
|
"new_path" => "/admin/members/#{user.member_profile.to_param}/experiences/new"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
end
|
||||||
|
|
||||||
|
def list
|
||||||
|
get_paper_list
|
||||||
|
end
|
||||||
|
|
||||||
|
end
|
|
@ -0,0 +1,20 @@
|
||||||
|
module Admin::PersonalExperiencesHelper
|
||||||
|
|
||||||
|
def get_paper_list
|
||||||
|
user = current_user.nil? ? OrbitHelper.current_user : current_user
|
||||||
|
user_profile = user.member_profile
|
||||||
|
experiences = Experience.where(:member_profile_id => user_profile.id)
|
||||||
|
experiences = experiences.collect do |e|
|
||||||
|
{
|
||||||
|
"id" => e.id.to_s,
|
||||||
|
"edit_url" => "/#{I18n.locale.to_s}/admin/members/#{user_profile.to_param}/experiences/#{e.to_param}/edit",
|
||||||
|
"delete_url" => "/#{I18n.locale.to_s}/admin/experiences/#{e.id.to_s}",
|
||||||
|
"paper_title" => e.organizationt_title,
|
||||||
|
"keywords" => e.keywords,
|
||||||
|
"abstract" => [],
|
||||||
|
"files" => []
|
||||||
|
}
|
||||||
|
end
|
||||||
|
experiences
|
||||||
|
end
|
||||||
|
end
|
|
@ -6,6 +6,7 @@ module PersonalExperience
|
||||||
base_url File.expand_path File.dirname(__FILE__)
|
base_url File.expand_path File.dirname(__FILE__)
|
||||||
personal_plugin :enable => true, :sort_number => '45', :app_name=>"Experience", :intro_app_name=>"PersonalExperienceIntro",:path=>"/plugin/personal_experience/profile",:front_path=>"/profile",:admin_path=>"/admin/experiences",:i18n=>'module_name.personal_experience', :module_app_name=>'PersonalExperience'
|
personal_plugin :enable => true, :sort_number => '45', :app_name=>"Experience", :intro_app_name=>"PersonalExperienceIntro",:path=>"/plugin/personal_experience/profile",:front_path=>"/profile",:admin_path=>"/admin/experiences",:i18n=>'module_name.personal_experience', :module_app_name=>'PersonalExperience'
|
||||||
version "0.1"
|
version "0.1"
|
||||||
|
desktop_enabled true
|
||||||
organization "Rulingcom"
|
organization "Rulingcom"
|
||||||
author "RD dep"
|
author "RD dep"
|
||||||
intro "I am intro"
|
intro "I am intro"
|
||||||
|
|
Loading…
Reference in New Issue