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,24 +16,39 @@ 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
redirect_to params['referer_url']
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
redirect_to params['referer_url']
if params[:desktop] == "true"
render json: get_paper_list.to_json
else
redirect_to params['referer_url']
end
end
def 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

@ -7,7 +7,7 @@
<% content_for :page_specific_javascript do %>
<%= javascript_include_tag "lib/bootstrap-datetimepicker" %>
<%= javascript_include_tag "lib/datetimepicker/datetimepicker.js" %>
<%= javascript_include_tag "lib/bootstrap-fileupload" %>
<%= javascript_include_tag "lib/bootstrap-fileupload" %>
<%= javascript_include_tag "lib/file-type" %>
<%= javascript_include_tag "lib/module-area" %>
<% end %>
@ -15,7 +15,7 @@
<!-- Input Area -->
<div class="input-area">
<!-- Module Tabs -->
<!-- Module Tabs -->
<div class="nav-name"><strong><%= t(:module) %></strong></div>
<ul class="nav nav-pills module-nav">
<li></li>
@ -39,7 +39,7 @@
<%= @member.name rescue ''%>
<%= f.hidden_field :member_profile_id, :value => @member.id if !@member.nil? %>
</div>
</div>
</div>
<!-- year -->
<div class="control-group">
@ -61,7 +61,7 @@
<% end %>
<% end %>
</div>
</div>
</div>
<!-- paper_level -->
<div class="control-group">
@ -75,7 +75,7 @@
<% end %>
<% end %>
</div>
</div>
</div>
<!-- author_type -->
<div class="control-group">
@ -89,7 +89,7 @@
<% end %>
<% end %>
</div>
</div>
</div>
<!-- number_of_authors -->
<div class="control-group">
@ -97,7 +97,7 @@
<div class="controls">
<%= f.text_field :number_of_authors, :class=>'span1' %>
</div>
</div>
</div>
<!-- period_start_date -->
<div class="control-group">
@ -105,7 +105,7 @@
<div class="controls">
<%= f.datetime_picker :period_start_date, :no_label => true, :format=>"yyyy/MM/dd", :placeholder=>"YYYY/MM/DD" %>
</div>
</div>
</div>
<!-- period_end_date -->
<div class="control-group">
@ -113,7 +113,7 @@
<div class="controls">
<%= f.datetime_picker :period_end_date, :no_label => true, :format=>"yyyy/MM/dd", :placeholder=>"YYYY/MM/DD" %>
</div>
</div>
</div>
<!-- publication_date -->
<div class="control-group">
@ -121,7 +121,7 @@
<div class="controls">
<%= f.datetime_picker :publication_date, :no_label => true, :format=>"yyyy/MM/dd", :placeholder=>"YYYY/MM/DD" %>
</div>
</div>
</div>
<!-- language -->
<div class="control-group">
@ -133,7 +133,7 @@
<% end %>
</select>
</div>
</div>
</div>
<!-- ISBN -->
<div class="control-group">
@ -141,7 +141,7 @@
<div class="controls">
<%= f.text_field :isbn %>
</div>
</div>
</div>
<!-- ISI Numebr -->
<div class="control-group">
@ -149,7 +149,7 @@
<div class="controls">
<%= f.text_field :isi_number %>
</div>
</div>
</div>
<!-- url -->
<div class="control-group">
@ -157,7 +157,7 @@
<div class="controls">
<%= f.text_field :url , :class => "span6" %>
</div>
</div>
</div>
<!-- keywords -->
<div class="control-group">
@ -165,7 +165,7 @@
<div class="controls">
<%= f.text_field :keywords, :class => "span6" %>
</div>
</div>
</div>
<!-- abstract -->
<div class="control-group">
@ -173,7 +173,7 @@
<div class="controls">
<%= f.text_area :abstract, rows: 2, class: "input-block-level" %>
</div>
</div>
</div>
<!-- note -->
<div class="control-group">
@ -181,7 +181,7 @@
<div class="controls">
<%= f.text_area :note, rows: 2, class: "input-block-level" %>
</div>
</div>
</div>
</div>
@ -216,7 +216,7 @@
<div class="tab-content language-area">
<% @site_in_use_locales.each_with_index do |locale, i| %>
<div class="<%= locale %> tab-pane fade <%= ( i == 0 ) ? "in active" : '' %>">
<!-- paper_title-->
@ -286,7 +286,7 @@
<%= f.fields_for :writing_conference_files, archive_file_multiple do |f| %>
<%= render :partial => 'form_file', :object => archive_file_multiple, :locals => {:f => f, :i => i} %>
<% end %>
<% end %>
<% end %>
<hr>
</div>
<% end %>
@ -303,46 +303,43 @@
</div>
</div>
</div>
</div>
<!-- Form Actions -->
<div class="form-actions">
<%= f.hidden_field :user_id, :value => params[:user_id] if !params[:user_id].blank? %>
<input type="hidden" name="referer_url" value="<%= request.referer %>">
<%= f.submit t('submit'), class: 'btn btn-primary' %>
<%= link_to t('cancel'), get_go_back, :class=>"btn" %>
<%= link_to t('cancel'), get_go_back, :class=>"btn" %>
</div>
<% content_for :page_specific_javascript do %>
<script>
$(document).ready(function() {
$('.main-forms .add-on').tooltip();
$(document).on('click', '#add_file', function(){
var new_id = $(this).prev().attr('value');
var old_id = new RegExp("new_writing_conference_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, :writing_conference_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');
});
formTip();
});
$(document).on('click', '.delete_file', function(){
$(this).parents('.input-prepend').remove();
<script>
$('.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();
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, :writing_conference_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');
});
$(document).on('click', '.remove_existing_record', function(){
if(confirm("<%= I18n.t(:sure?)%>")){
$(this).children('.should_destroy').attr('value', 1);
$(this).parents('.start-line').hide();
}
});
});
</script>
<% end %>
formTip();
$('.add-on').tooltip();
} else if($(this).hasClass('delete_file')) {
$(this).parents('.input-prepend').remove();
} 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>

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"