clean add/edit page and add conference list page
This commit is contained in:
1 parent
16fda25ace
commit
13c757e8a9
9 files changed
+367
-175
No files matched your search
+48
-1
@@ -26,13 +26,60 @@ class Panel::PersonalConference::Desktop::ConferencePagesController < Applicatio
|
||||
end
|
||||
|
||||
def edit
|
||||
@writing_conference = WritingConference.new
|
||||
@writing_conference = WritingConference.find(params[:id])
|
||||
@paper_types = ConferencePaperType.all
|
||||
@author_types = ConferenceAuthorType.all
|
||||
respond_to do |format|
|
||||
format.html { render :layout => false}
|
||||
end
|
||||
end
|
||||
|
||||
def create
|
||||
params[:writing_conference][:create_user_id] = current_user.id
|
||||
@writing_conference = WritingConference.new(params[:writing_conference])
|
||||
|
||||
if @writing_conference.save
|
||||
render json: {success: true, msg: t('create.success.paper')}.to_json
|
||||
else
|
||||
error_msg = @writing_conference.errors.full_messages.join("<br />")
|
||||
render json: {success: false, msg: error_msg}.to_json
|
||||
end
|
||||
end
|
||||
|
||||
def update
|
||||
params[:writing_conference][:update_user_id] = current_user.id
|
||||
@writing_conference= WritingConference.find(params[:id])
|
||||
|
||||
if @writing_conference.update_attributes(params[:writing_conference])
|
||||
render json: {success: true, msg: t('update.success.paper')}.to_json
|
||||
else
|
||||
error_msg = @writing_conference.errors.full_messages.join("<br />")
|
||||
render json: {success: false, msg: error_msg}.to_json
|
||||
end
|
||||
end
|
||||
|
||||
def destroy
|
||||
@writing_conference = WritingConference.find(params[:id])
|
||||
@writing_conference.destroy
|
||||
render :json => {success: true, msg: t('delete.success.paper')}
|
||||
end
|
||||
|
||||
def conference_type
|
||||
conference_types = ConferencePaperType.all
|
||||
all_conference_lists = WritingConference.where(create_user_id: current_user.id)
|
||||
all_conference_lists = all_conference_lists.map do |j|
|
||||
[ j.conference_title,
|
||||
j.conference_paper_type_ids.map do |type|
|
||||
conference_types.find(type).title
|
||||
end
|
||||
]
|
||||
end
|
||||
|
||||
@conference_lists = all_conference_lists.uniq
|
||||
|
||||
respond_to do |format|
|
||||
format.html { render :layout => false}
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
+139
-68
@@ -34,41 +34,44 @@
|
||||
class: "s_grid_6 s_grid",
|
||||
size: "20x2",
|
||||
placeholder: t("personal_conference.paper_title"),
|
||||
value: (@writing_conference.paper_title_translations[locale] rescue nil) %>
|
||||
value: (@writing_conference.paper_title_translations[locale.to_s] rescue nil) %>
|
||||
<% end %>
|
||||
</li>
|
||||
|
||||
<li class="s_grid_row">
|
||||
<%= f.fields_for :conference_title_translations do |f| %>
|
||||
<%= f.text_field locale,
|
||||
size: "20",
|
||||
placeholder: t("personal_conference.conference_title"),
|
||||
class: "s_grid_6 s_grid",
|
||||
# "autocomplete-list" => "conference_title_autocomplete_list",
|
||||
value: (@writing_conference.conferece_title_translations[locale] rescue nil) %>
|
||||
<% end %>
|
||||
<span class="icon-plus input_append"></span>
|
||||
<%= f.fields_for :conference_title_translations do |f| %>
|
||||
<%= f.text_field locale,
|
||||
size: "20",
|
||||
placeholder: t("personal_conference.conference_title"),
|
||||
class: "s_grid_6 s_grid",
|
||||
# "autocomplete-list" => "conference_title_autocomplete_list",
|
||||
value: (@writing_conference.conference_title_translations[locale.to_s] rescue nil) %>
|
||||
<% end %>
|
||||
<span class="icon-plus input_append"></span>
|
||||
</li>
|
||||
|
||||
<li class="s_grid_row">
|
||||
<div>
|
||||
<%= label_tag("", t("personal_conference.paper_type")) %>
|
||||
<ul>
|
||||
<% @paper_types.each_with_index do |paper_type, i| %>
|
||||
<li class="s_grid_row">
|
||||
<%= radio_button_tag "writing_conference[conference_paper_type_ids][]",
|
||||
paper_type.id,
|
||||
@writing_conference.conference_paper_type_ids.include?(paper_type.id),
|
||||
id: "field-#{i}"
|
||||
%><%= label_tag("field-#{i}", paper_type.title) %>
|
||||
</li>
|
||||
<li class="s_grid_row">
|
||||
<%= radio_button_tag "writing_conference[conference_paper_type_ids][]",
|
||||
paper_type.id,
|
||||
@writing_conference.conference_paper_type_ids.include?(paper_type.id),
|
||||
id: "field-#{i}"
|
||||
%><%= label_tag("field-#{i}", paper_type.title) %>
|
||||
</li>
|
||||
<% end %>
|
||||
</ul>
|
||||
</div>
|
||||
|
||||
<li class="s_grid_row">
|
||||
<%= f.text_field :keywords, size: "20", placeholder: t("personal_conference.keywords"), class: "s_grid_6 s_grid"%>
|
||||
</li>
|
||||
|
||||
<li class="s_grid_row">
|
||||
<%= f.text_field :keywords, size: "20", placeholder: t("personal_conference.keywords"), class: "s_grid_6 s_grid"%>
|
||||
</li>
|
||||
|
||||
<li class="s_grid_row">
|
||||
<div>
|
||||
<%= label_tag("", t("personal_conference.conference_time")) %>
|
||||
<ul>
|
||||
@@ -83,67 +86,135 @@
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
|
||||
<li class="s_grid_row">
|
||||
<%= label_tag("", t("personal_conference.sponsor"), class: "s_grid_2 s_grid") %><%= f.text_field :sponsor, size: "20", placeholder: "Sponsor", class: "s_grid_4 s_grid"%>
|
||||
</li>
|
||||
<li class="s_grid_row">
|
||||
<%= label_tag("", t("personal_conference.location"), class: "s_grid_2 s_grid") %><%= f.text_field :location, size: "20", placeholder: "Location", class: "s_grid_4 s_grid"%>
|
||||
</li>
|
||||
|
||||
<li class="s_grid_row">
|
||||
<%= label_tag("", t("personal_conference.url"), class: "s_grid_2 s_grid") %><%= f.text_field :url, size: "20", placeholder: "www.sample.com", class: "s_grid_4 s_grid"%>
|
||||
<%= label_tag("", t("personal_conference.sponsor"), class: "s_grid_2 s_grid") %><%= f.text_field :sponsor, size: "20", placeholder: "Sponsor", class: "s_grid_4 s_grid"%>
|
||||
</li>
|
||||
|
||||
<div class="s_grid_con s_form">
|
||||
<ul>
|
||||
<li class="s_grid_row">
|
||||
<%= label_tag("", t("personal_conference.location"), class: "s_grid_2 s_grid") %><%= f.text_field :location, size: "20", placeholder: "Location", class: "s_grid_4 s_grid"%>
|
||||
</li>
|
||||
|
||||
<li class="s_grid_row">
|
||||
<%= label_tag("", t("personal_conference.url"), class: "s_grid_2 s_grid") %><%= f.text_field :url, size: "20", placeholder: "www.sample.com", class: "s_grid_4 s_grid"%>
|
||||
</li>
|
||||
|
||||
</div>
|
||||
<div class="s_grid_con s_form">
|
||||
<ul>
|
||||
<li class="s_grid_row">
|
||||
<%= f.fields_for :authors_translations do |f| %>
|
||||
<%= f.text_area locale,
|
||||
class: "s_grid_6 s_grid",
|
||||
size: "20x2",
|
||||
placeholder: t("personal_conference.authors"),
|
||||
# "autocomplete-list" => "coauthor_autocomplete_list",
|
||||
value: (@writing_conference.authors_translations[locale] rescue nil) %>
|
||||
# "autocomplete-list" => "coauthor_autocomplete_list",
|
||||
value: (@writing_conference.authors_translations[locale.to_s] rescue nil) %>
|
||||
<% end %>
|
||||
<span class="icon-plus input_append"></span>
|
||||
|
||||
<select name="writing_conference[conference_author_type_ids][]" id="" class="s_grid s_grid_4">
|
||||
<%= options_for_select(
|
||||
[t("personal_conference.author_type")] +
|
||||
@author_types.map do |author_type|
|
||||
[author_type.title, author_type.id]
|
||||
end
|
||||
)
|
||||
%>
|
||||
</select>
|
||||
|
||||
<select name="" id="" class="s_grid s_grid_2">
|
||||
<option value="">Status</option>
|
||||
<option value="">Published</option>
|
||||
<option value="">Pending</option>
|
||||
<option value="">Writing</option>
|
||||
</select>
|
||||
</li>
|
||||
|
||||
<li class="s_grid_row">
|
||||
<%= label_tag("", t("personal_conference.publication_date"), class: "s_grid_3 s_grid") %>
|
||||
<%= f.date_select :publication_date, {:use_month_numbers => true, :start_year => Time.now.year, :end_year => 1930, :order => [:year, :month, :day] }, {:class => 's_grid_1 s_grid'} %>
|
||||
</li>
|
||||
|
||||
<li class="s_grid_row"><input class="s_grid s_grid_6" type="text" value="Tags"><span class="icon-plus input_append"></li>
|
||||
|
||||
<li class="s_grid_row">
|
||||
<%= f.text_area :abstract, size: "20x22", placeholder: t("personal_conference.abstract"), class: "s_grid_6 s_grid full_height"%>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
<div class="s_grid_con s_form">
|
||||
|
||||
<li class="s_grid_row">
|
||||
<ul>
|
||||
<%= f.text_area :note, size: "20x22", placeholder: t("personal_journal.note"), class: "s_grid_6 s_grid full_height"%>
|
||||
</ul>
|
||||
<select name="writing_conference[conference_author_type_ids][]" id="" class="s_grid s_grid_6">
|
||||
<%= options_for_select(
|
||||
[t("personal_conference.author_type")] +
|
||||
@author_types.map do |author_type|
|
||||
[author_type.title, author_type.id]
|
||||
end
|
||||
)
|
||||
%>
|
||||
</select>
|
||||
</li>
|
||||
|
||||
<li class="s_grid_row">
|
||||
<select name="" id="" class="s_grid s_grid_6">
|
||||
<option value="">Status</option>
|
||||
<option value="">Published</option>
|
||||
<option value="">Pending</option>
|
||||
<option value="">Writing</option>
|
||||
</select>
|
||||
</li>
|
||||
|
||||
<li class="s_grid_row">
|
||||
<%= label_tag("", t("personal_conference.publication_date"), class: "s_grid_3 s_grid") %>
|
||||
<%= f.date_select :publication_date, {:use_month_numbers => true, :start_year => Time.now.year, :end_year => 1930, :order => [:year, :month, :day] }, {:class => 's_grid_1 s_grid'} %>
|
||||
</li>
|
||||
|
||||
<li class="s_grid_row">
|
||||
<%= f.label :year, t("personal_conference.year"), :class => "s_grid_2 s_grid" %>
|
||||
<%= select_year((@writing_conference.year ? @writing_conference.year.to_i : DateTime.now.year), {:start_year => DateTime.now.year, :end_year => 1930}, {:name => 'writing_conference[year]', :class => "s_grid_4 s_grid"} ) %>
|
||||
</li>
|
||||
|
||||
<li class="s_grid_row"><input class="s_grid s_grid_6" type="text" placeholder=<%= t("tags") %>><span class="icon-plus input_append"></li>
|
||||
|
||||
<li class="s_grid_row">
|
||||
<%= f.text_area :abstract, size: "20x22", placeholder: t("personal_conference.abstract"), class: "s_grid_6 s_grid full_height"%>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
<div class="s_grid_con s_form">
|
||||
<ul>
|
||||
<li class="s_grid_row">
|
||||
<table class="s_table">
|
||||
<thead>
|
||||
<tr>
|
||||
<th class="s_grid_2"><%= t("personal_conference.file")%></th>
|
||||
<th class="s_grid_3"><%= t("personal_conference.file_name")%></th>
|
||||
<th class="s_grid_1"><%= t("personal_conference.description") %></th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tfoot>
|
||||
<tr>
|
||||
<td colspan="3">
|
||||
<div id='add_plugin_file' class="info_input plugin_files_block s_action">
|
||||
<%= hidden_field_tag 'plugin_file_field_count', @writing_conference.writing_conference_files.count %>
|
||||
<a class="add setting_btn thmc1 thmtxt w1 hh2 hp" href=""><i class="icon-plus icon-white"></i> add</a>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
</tfoot>
|
||||
<tbody>
|
||||
<% @writing_conference.writing_conference_files.each_with_index do |writing_conference_file, i| %>
|
||||
<%= f.fields_for :writing_conference_files, writing_conference_file do |f| %>
|
||||
<%= render :partial => 'form_file', :object => writing_conference_file, :locals => {:f => f, :i => i} %>
|
||||
<% end %>
|
||||
<% end %>
|
||||
</tbody>
|
||||
</table>
|
||||
</li>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="s_grid_con s_form">
|
||||
<li class="s_grid_row">
|
||||
<ul>
|
||||
<%= f.text_area :note, size: "20x22", placeholder: t("personal_conference.note"), class: "s_grid_6 s_grid full_height"%>
|
||||
</ul>
|
||||
</li>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<script type="text/javascript">
|
||||
orbitDesktop.prototype.initializeJournalPapers.conference_title_autocomplete_list = <%= @conference_candidate.to_json.html_safe %>;
|
||||
orbitDesktop.prototype.initializeJournalPapers.coauthor_autocomplete_list = <%= @co_author_candidate.to_json.html_safe %>;
|
||||
</script>
|
||||
|
||||
<script>
|
||||
$('#add_plugin_file a.add').click(function(){
|
||||
var new_id = $(this).prev().attr('value');
|
||||
var old_id = new RegExp("new_writing_conference_files", "g");
|
||||
$(this).prev().attr('value', parseInt(new_id) + 1);
|
||||
var newfield = $(("<%= escape_javascript(add_attribute 'form_file', f, :writing_conference_files) %>").replace(old_id, new_id));
|
||||
$(this).parents('table').append(newfield);
|
||||
newfield.find('.action a.delete').click(function(){
|
||||
newfield.remove();
|
||||
});
|
||||
return false;
|
||||
});
|
||||
|
||||
$('.action a.remove_existing_record').click(function(){
|
||||
$(this).next('.should_destroy').attr('value', 1);
|
||||
$("tr#add_plugin_file_" + $(this).prev().attr('value')).hide();
|
||||
});
|
||||
|
||||
</script>
|
||||
+31
@@ -0,0 +1,31 @@
|
||||
<tr id="<%= "plugin_file_#{form_file.id}" if !form_file.new_record? %>" class="list_item">
|
||||
<td>
|
||||
<div>
|
||||
<% if form_file.new_record? %>
|
||||
<%= f.file_field :file, class: "s_grid_2 s_grid" %>
|
||||
<% end %>
|
||||
</div>
|
||||
</td>
|
||||
<td>
|
||||
<%= f.text_field :title %>
|
||||
<%= f.fields_for :file_title_translations do |f| %>
|
||||
<%= f.text_field locale,
|
||||
class: 's_grid_3 s_grid',
|
||||
value: (form_file.file_title_translations[locale] rescue nil) %>
|
||||
<% end %>
|
||||
</td>
|
||||
|
||||
<td>
|
||||
<span class="action">
|
||||
<% if form_file.new_record? %>
|
||||
<a class="delete"><i class="icon-remove"></i></a>
|
||||
<% else %>
|
||||
<%= f.hidden_field :id %>
|
||||
<a class="remove_existing_record"><i class="icon-remove"></i></a>
|
||||
<%= f.hidden_field :should_destroy, :value => nil, :class => 'should_destroy' %>
|
||||
<% end %>
|
||||
<%= form_file.file.file ? ( link_to '', form_file.file.url, {:class => 'icon-eye-open', :target => '_blank', :title => t(:view)} ) : '' %>
|
||||
</span>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
+40
@@ -0,0 +1,40 @@
|
||||
<div class="toolbar hh2">
|
||||
<div class="hh2 hp sdm">
|
||||
<div class="sdm_t hh2">Share</div>
|
||||
<div class="admbg sdm_o">
|
||||
<ul>
|
||||
<li><a class="hp hh2 admtxt" href="">Friends</a></li>
|
||||
<li><a class="hp hh2 admtxt" href="">Private</a></li>
|
||||
<li><a class="hp hh2 admtxt" href="">Group</a></li>
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
<div class="hh2 hp sdm">
|
||||
<div class="sdm_t hh2"><span class="icon-question-sign"></span></div>
|
||||
</div>
|
||||
</div>
|
||||
<div id="conference_list" class="tinycanvas vp">
|
||||
<div class="scrollbar sb_h vp"><div class="track"><div class="thumb thmc2"><div class="end"></div></div></div></div>
|
||||
<div class="viewport">
|
||||
<div class="overview">
|
||||
<% @conference_lists.each_with_index do |conference_list,i| %>
|
||||
<% if ( i % 5 ) == 0 %>
|
||||
<div class="g_col">
|
||||
<ul>
|
||||
<% end %>
|
||||
<li class="list_t_item">
|
||||
<div class="list_item_action">
|
||||
<i class="icon-file"></i>
|
||||
</div>
|
||||
<% title, level = conference_list %>
|
||||
<div class="list_t_title"><%= title %></div>
|
||||
<div class="list_t_desc"><%= level.join(",") %></div>
|
||||
</li>
|
||||
<% if ( i % 5 ) == 4 %>
|
||||
</ul>
|
||||
</div>
|
||||
<% end %>
|
||||
<% end %>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
+4
@@ -0,0 +1,4 @@
|
||||
<%= form_for @writing_conference, html: { multipart: true, "form-type"=>"ajax_form", "callback-method"=>"formCallback"}, url: panel_personal_conference_desktop_conference_page_path(@writing_conference) do |f| %>
|
||||
<%= render partial: 'form', locals: {:f => f} %>
|
||||
<%end%>
|
||||
|
||||
+1
-1
@@ -15,7 +15,7 @@
|
||||
<ul id='setting_left_nav'>
|
||||
<li><a href="<%= panel_personal_conference_desktop_conference_pages_path %>" load="true" callback-method="list" class="hh2 w2 hp active thmc1 thmtxt" onclick='return false;'>List</a></li>
|
||||
<li><a href="<%= new_panel_personal_conference_desktop_conference_page_path %>" callback-method="addconference" custom-load="add" class="admtxt hh2 w2 hp" onclick='return false;'>Add/Edit</a></li>
|
||||
<li><a href="" callback-method="conference" class="admtxt hh2 w2 hp" onclick='return false;'>Conference</a></li>
|
||||
<li><a href="<%= panel_personal_conference_desktop_conference_type_path %>" callback-method="conference" class="admtxt hh2 w2 hp" onclick='return false;'>Conference</a></li>
|
||||
<li><a href="" callback-method="coauthor" class="admtxt hh2 w2 hp" onclick='return false;'>Co-Authors</a></li>
|
||||
<li><a href="" class="admtxt hh2 w2 hp" onclick='return false;'>Tags & Keywords</a></li>
|
||||
<li><a href="" class="admtxt hh2 w2 hp" onclick='return false;'>Analysis</a></li>
|
||||
|
||||
@@ -4,6 +4,7 @@ Rails.application.routes.draw do
|
||||
namespace :personal_conference do
|
||||
namespace :desktop do
|
||||
match 'conference_window' => 'conference_windows#conference_window'
|
||||
match 'conference_type' => 'conference_pages#conference_type'
|
||||
resources :conference_pages
|
||||
end
|
||||
namespace :back_end do
|
||||
|
||||
Reference in new issue
Block a user