desktop conference

This commit is contained in:
JiangRu 2014-12-03 17:52:16 +08:00
parent 8239dd9ef8
commit e5815dccd7
6 changed files with 132 additions and 50 deletions

View File

@ -0,0 +1,15 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- <?xml-stylesheet href="/assets/unit/svg-stylesheet.css" type="text/css"?> -->
<svg version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
viewBox="0 0 120 120" style="enable-background:new 0 0 120 120;" xml:space="preserve">
<g id="personal_conference" width="100%" height="100%">
<rect x="56" y="186" width="35" height="4"/>
<rect x="56" y="197" width="35" height="4"/>
<path d="M44.219,187.604c0.208-0.588-0.034-1.257-0.598-1.569c-0.628-0.346-1.418-0.118-1.765,0.51L20.662,219.1
l-7.667-7.198c-0.537-0.502-1.355-0.639-2.043-0.279c-0.87,0.456-1.206,1.531-0.75,2.401l0.172,0.329l6.812,13.003
c0.559,1.062,1.509,1.933,2.73,2.363c2.569,0.905,5.018-0.594,6.29-3.013L27.686,224l16.496-36.292L44.219,187.604z"/>
<path d="M91.329,148.672L72.657,130H67H30c-4.962,0-9,4.038-9,9v55h8v-55c0-0.542,0.458-1,1-1h37v15H56v4h11v7H56v4
h11.95c1.476,2.958,4.525,5,8.05,5h26v48c0,0.542-0.458,1-1,1H34v8h67c4.963,0,9-4.037,9-9v-48v-5.657L91.329,148.672z"/>
<path d="M52,153H37v15h15V153z M48,164h-7v-7h7V164z"/>
</g>
</svg>

After

Width:  |  Height:  |  Size: 1.1 KiB

View File

@ -1,5 +1,6 @@
class Admin::WritingConferencesController < OrbitMemberController
layout "member_plugin"
include Admin::PersonalConferencesHelper
before_action :set_writing_conference, only: [:show, :edit , :update, :destroy]
before_action :set_plugin
@ -15,25 +16,40 @@ class Admin::WritingConferencesController < OrbitMemberController
def new
@member = MemberProfile.find_by(:uid=>params['uid']) rescue nil
@writing_conference = WritingConference.new
if params[:desktop]
render :layout => false
end
end
def create
@member = MemberProfile.find(conference_params['member_profile_id']) rescue nil
@writing_conference = WritingConference.new(conference_params)
@writing_conference.save
if params[:desktop] == "true"
render json: get_paper_list.to_json
else
redirect_to params['referer_url']
end
end
def edit
@member = @writing_conference.member_profile
if params[:desktop]
render :layout => false
end
end
def update
@member = @writing_conference.member_profile
@writing_conference.update_attributes(conference_params)
@writing_conference.save
if params[:desktop] == "true"
render json: get_paper_list.to_json
else
redirect_to params['referer_url']
end
end
def destroy
@writing_conference.destroy

View File

@ -0,0 +1,23 @@
class Desktop::PersonalConferencesController < DesktopAdminController
include Admin::PersonalConferencesHelper
def menu
user = OrbitHelper.current_user
[
{
"title" => "List",
"layout" => "list"
},
{
"title" => "Add/Edit",
"layout" => "form",
"new_path" => "/admin/members/#{user.member_profile.to_param}/writing_conferences/new"
}
]
end
def list
get_paper_list
end
end

View File

@ -0,0 +1,30 @@
module Admin::PersonalConferencesHelper
def get_paper_list
user = current_user.nil? ? OrbitHelper.current_user : current_user
user_profile = user.member_profile
conferences = WritingConference.where(:member_profile_id => user_profile.id)
conferences = conferences.collect do |c|
files = c.writing_conference_files.collect do |wcf|
{
"title" => wcf.title,
"description" => wcf.description,
"link" => wcf.file.url,
"extension" => (wcf.file.url.split(".").last rescue "")
}
end
{
"id" => c.id.to_s,
"edit_url" => "/#{I18n.locale.to_s}/admin/members/#{user_profile.to_param}/writing_conferences/#{c.to_param}/edit",
"delete_url" => "/#{I18n.locale.to_s}/admin/writing_conferences/#{c.id.to_s}",
"paper_title" => c.paper_title,
"conference_title" => c.conference_title,
"keywords" => c.keywords,
"abstract" => c.abstract,
"files" => files
}
end
conferences
end
end

View File

@ -315,11 +315,10 @@
<% content_for :page_specific_javascript do %>
<script>
$(document).ready(function() {
$('.main-forms .add-on').tooltip();
$(document).on('click', '#add_file', function(){
$('.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_writing_conference_files", "g");
var on = $('.language-nav li.active').index();
@ -330,19 +329,17 @@
$(this).children('.tab-pane').eq(on).addClass('in active').siblings().removeClass('in active');
});
formTip();
});
$(document).on('click', '.delete_file', function(){
$('.add-on').tooltip();
} else if($(this).hasClass('delete_file')) {
$(this).parents('.input-prepend').remove();
});
$(document).on('click', '.remove_existing_record', function(){
} else if($(this).hasClass('remove_existing_record')) {
if(confirm("<%= I18n.t(:sure?)%>")){
$(this).children('.should_destroy').attr('value', 1);
$(this).parents('.start-line').hide();
}
});
}
});
</script>
<% end %>

View File

@ -7,6 +7,7 @@ module PersonalConference
personal_plugin :enable => true, :sort_number => '6', :app_name=>"WritingConference", :intro_app_name=>"PersonalConferenceIntro",:path=>"/plugin/personal_conference/profile",:front_path=>"/profile",:admin_path=>"/admin/writing_conferences",:i18n=>'module_name.personal_conference', :module_app_name=>'PersonalConference'
version "0.1"
desktop_enabled true
organization "Rulingcom"
author "RD dep"
intro "I am intro"