new ui member plugin sort fix and user show avatar fix

This commit is contained in:
Spen 2013-09-26 20:02:41 +08:00 committed by saurabhbhatia
parent 622534e5db
commit 9186978551
25 changed files with 85 additions and 46 deletions

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.0 KiB

After

Width:  |  Height:  |  Size: 6.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.0 KiB

View File

@ -4,19 +4,19 @@ class Admin::PluginsController < ApplicationController
def index
@plugins = OrbitApp::Plugin::Registration.all
@plugins = OrbitApp::Plugin::Registration.all
if(!params[:show_plugin_profile].nil?)
@right_partial = OrbitApp::Plugin::Registration.find_by_key(params[:show_plugin_profile]).admin_partial_path
@right_partial = OrbitApp::Plugin::Registration.find_by_app_name(params[:show_plugin_profile]).admin_partial_path
if !@right_partial.blank?
respond_to do |format|
format.html { redirect_to( @right_partial ) }
end
else
@right_partial = ""
end
if !@right_partial.blank?
respond_to do |format|
format.html { redirect_to( @right_partial ) }
end
else
@right_partial = ""
end
else
@right_partial = ""

View File

@ -83,9 +83,18 @@ class Admin::UsersNewInterfaceController < OrbitMemberController
end
def show
@user = User.find(params[:id])
@plugins = OrbitApp::Plugin::Registration.all
@ppname = Array.new
@plugins.each do |aa|
@ppname << [aa.sort_number.to_i, [aa.name, aa.app_name, aa.intro_app_name, aa.front_partial_path]]
end
@plugin_shows = @ppname.sort.collect {|v| {"name"=>v[1][0],"app_name"=>v[1][1],"intro_app_name"=>v[1][2],"front_partial_path"=>v[1][3]} }
@profile_data = []
@teacher_data = []
@student_data = []

View File

@ -271,11 +271,7 @@ module ApplicationHelper
end
def show_avatar(user)
if (user.avatar? rescue false)
image_tag(user.avatar.thumb.url)
else
image_tag "person.png"
end
image_tag(user.avatar.thumb.url)
end
# NTU link

View File

@ -21,6 +21,9 @@ class AvatarUploader < CarrierWave::Uploader::Base
# def default_url
# "/images/fallback/" + [version_name, "default.png"].compact.join('_')
# end
def default_url
[version_name, (Site.first.default_image.file.url rescue "person.png")].compact.join('_')
end
# Process files as they are uploaded:
# process :scale => [200, 300]

View File

@ -7,8 +7,8 @@
<%= link_to t(:all_plugin_summary)%>
<% end -%>
<% @plugins.each do |plugin| %>
<%= content_tag :li, :class=>(params[:show_plugin_profile] == plugin.name ? "active" : nil) do %>
<%= link_to plugin.name, admin_plugins_path(:show_plugin_profile => plugin.name) %>
<%= content_tag :li, :class=>(params[:show_plugin_profile] == plugin.app_name ? "active" : nil) do %>
<%= link_to plugin.name, admin_plugins_path(:show_plugin_profile => plugin.app_name) %>
<% end -%>
<% end -%>

View File

@ -15,7 +15,7 @@
<%= link_to(content_tag(:i, nil, :class => 'icon-key'),'#',:class=>"key" ) if is_admin?%>
<%= link_to(content_tag(:i, nil, :class => 'icon-trash'), admin_users_new_interface_path(user_for_summary, :at=>params[:at]), :confirm => t(:sure?), :method => :delete, :class=>"trash", :remote => true) if is_admin? %>
</div>
<%= show_avatar(user_for_summary) %>
<%= image_tag(user_for_summary.avatar) %>
</div>
<div class="member-info">
<h4 class="member-name"><%= link_to user_for_summary.name,admin_users_new_interface_path(user_for_summary)%></h4>

View File

@ -16,7 +16,7 @@
<%= link_to(content_tag(:i, nil, :class => 'icon-trash'), admin_users_new_interface_path(user_for_thumbnail, :at=>params[:at]), :confirm => t(:sure?), :method => :delete, :class=>"trash", :remote => true) if is_admin? %>
</div>
<%= show_avatar(user_for_thumbnail) %>
<%= image_tag(user_for_thumbnail.avatar) %>
</div>
<h4 class="member-name text-center"><%= link_to user_for_thumbnail.name,admin_users_new_interface_path(user_for_thumbnail)%></h4>
</li>

View File

@ -50,9 +50,9 @@
<a data-toggle="dropdown" class="dropdown-toggle" href="#">Module List <b class="caret"></b></a>
<ul class="dropdown-menu">
<% @plugins.each do |plugin| %>
<%= content_tag :li, :class=>(params[:show_plugin_profile] == plugin.app_name ? "active" : nil) do %>
<%= link_to plugin.name, :show_plugin_profile => plugin.app_name %>
<% @plugin_shows.each do |plugin| %>
<%= content_tag :li, :class=>(params[:show_plugin_profile] == plugin["app_name"] ? "active" : nil) do %>
<%= link_to plugin["name"], :show_plugin_profile => plugin["app_name"] %>
<% end -%>
<% end -%>

View File

@ -53,6 +53,7 @@ module OrbitApp
def initialize(name,partial=nil,*args ,&block)
@base_path = args[0][:base_path]
@name = partial[0][:i18n].nil? ? name : lambda{ I18n.t(partial[0][:i18n]) }
@sort_number = partial[0][:sort_number]
@app_name = partial[0][:app_name]
@intro_app_name = partial[0][:intro_app_name]
@partial_path = ''
@ -68,6 +69,10 @@ module OrbitApp
block.arity < 1 ? instance_eval(&block) : block.call(self) if block_given?
end
def sort_number
return @sort_number
end
def app_name
return @app_name
end

View File

@ -50,6 +50,13 @@ class Panel::Member::FrontEnd::MemberListsController < OrbitWidgetController
@plugins = OrbitApp::Plugin::Registration.all
@ppname = Array.new
@plugins.each do |aa|
@ppname << [aa.sort_number.to_i, [aa.name, aa.app_name, aa.intro_app_name, aa.front_partial_path]]
end
@plugin_shows = @ppname.sort.collect {|v| {"name"=>v[1][0],"app_name"=>v[1][1],"intro_app_name"=>v[1][2],"front_partial_path"=>v[1][3]} }
@profile_data = []
attribute_values = @member.attribute_values.asc("_id")

View File

@ -18,6 +18,8 @@
<div class="o-members">
<% @member_status.each do |ms| %>
<% if @member_lists.where(:role_status_ids=>ms.id).count > 0 %>
<h3 class="o-members-category h3"><%= ms.title %></h3>
<ul class="o-members-list">
@ -28,7 +30,14 @@
<div class="o-members-pic"><%= show_avatar(member) %></div>
<ul class="o-members-info">
<li><b class="o-members-label"><%= t("users.name")%></b><%= link_to member.name, panel_member_front_end_member_list_path(member.id), {:class => "o-members-link"} %></li>
<li><b class="o-members-label"><%= @member_lists.get_member_list_attribute_field_name("teacher","job_title") %></b><%= show_attribute_value(@member_lists.get_member_list_attribute_value(member.id,"teacher","job_title").get_value_by_locale(I18n.locale)) %></li>
<% @job_title = show_attribute_value(@member_lists.get_member_list_attribute_value(member.id,"teacher","job_title").get_value_by_locale(I18n.locale))
if @job_title != 'NoData' and !@job_title.blank?
%>
<li><b class="o-members-label">
<%= @member_lists.get_member_list_attribute_field_name("teacher","job_title") %></b>
<%= @job_title %>
</li>
<% end %>
<li><b class="o-members-label"><%= t("users.email")%></b><%= member.email %></li>
<li><b class="o-members-label"><%= t("users.office_tel")%></b><%= member.office_tel %></li>
</ul>
@ -40,6 +49,8 @@
<% end %>
<% end %>
</div>
<% elsif @item.frontend_style == 'Two' or @item.frontend_style.blank? %>
@ -52,6 +63,8 @@
<% @member_status.each do |ms| %>
<% if @member_lists.where(:role_status_ids=>ms.id).count > 0 %>
<h3 class="o-members-category h3"><%= ms.title %></h3>
<ul class="o-members-list">
@ -61,7 +74,11 @@
<div class="o-members-pic"><%= show_avatar(member) %></div>
<ul class="o-members-info">
<li><b class="o-members-label"><%= t("users.name")%></b><%= link_to member.name, panel_member_front_end_member_list_path(member.id), {:class => "o-members-link"} %></li>
<li><b class="o-members-label"><%= @member_lists.get_member_list_attribute_field_name("teacher","job_title") %></b><%= show_attribute_value(@member_lists.get_member_list_attribute_value(member.id,"teacher","job_title").get_value_by_locale(I18n.locale)) %></li>
<% @job_title = show_attribute_value(@member_lists.get_member_list_attribute_value(member.id,"teacher","job_title").get_value_by_locale(I18n.locale))
if @job_title != 'NoData' and !@job_title.blank?
%>
<li><b class="o-members-label"><%= @member_lists.get_member_list_attribute_field_name("teacher","job_title") %></b><%= @job_title %></li>
<% end %>
<li><b class="o-members-label"><%= t("users.email")%></b> <%= member.email %></li>
<li><b class="o-members-label"><%= t("users.office_tel")%></b><%= member.office_tel %></li>
</ul>
@ -73,6 +90,8 @@
<% end %>
<% end %>
</div>
<% end %>

View File

@ -43,29 +43,29 @@
</div>
<div class="member-pic">
<%= show_avatar(@member) %>
<%= image_tag(@member.avatar) %>
</div>
<div class="member-module">
<div class="module-nav">
<ul>
<%
@plugins.each do |plugin|
@plugin_shows.each do |plugin|
@data = plugin.app_name.classify.constantize.where(is_hidden: false, :create_user_id=>@member.id)
@intro_data = plugin.intro_app_name.classify.constantize.where(:user_id=>@member.id).first
@data = plugin["app_name"].classify.constantize.where(is_hidden: false, :create_user_id=>@member.id)
@intro_data = plugin["intro_app_name"].classify.constantize.where(:user_id=>@member.id).first
%>
<% if !@intro_data.blank? %>
<% if !@intro_data.brief_intro.blank? or !@intro_data.complete_list.blank? %>
<li><a href="#<%= plugin.name %>"><%= plugin.name %></a></li>
<li><a href="#<%= plugin["name"] %>"><%= plugin["name"] %></a></li>
<% end %>
<% else %>
<% if !@data.blank? %>
<li><a href="#<%= plugin.name %>"><%= plugin.name %></a></li>
<li><a href="#<%= plugin["name"] %>"><%= plugin["name"] %></a></li>
<% end %>
<% end %>
@ -75,18 +75,18 @@
</div>
<div class="module-content">
<%
@plugins.each do |plugin|
@plugin_shows.each do |plugin|
@plugin_partial = !plugin.front_partial_path.blank? ? OrbitApp::Plugin::Registration.find_by_key(plugin.name).front_partial_path : nil
@plugin_partial = !plugin["front_partial_path"].blank? ? OrbitApp::Plugin::Registration.find_by_key(plugin["name"]).front_partial_path : nil
@data = plugin.app_name.classify.constantize.where(:create_user_id=>@member.id)
@intro_data = plugin.intro_app_name.classify.constantize.where(:user_id=>@member.id).first
@data = plugin["app_name"].classify.constantize.where(:create_user_id=>@member.id)
@intro_data = plugin["intro_app_name"].classify.constantize.where(:user_id=>@member.id).first
%>
<% if !@intro_data.blank? %>
<% if !@intro_data.brief_intro.blank? or !@intro_data.complete_list.blank? %>
<div class="module-pane" id="<%= plugin.name %>">
<div class="module-pane" id="<%= plugin["name"] %>">
<%= render :partial => @plugin_partial if !@plugin_partial.blank? %>
</div>
<% end %>
@ -94,7 +94,7 @@
<% else %>
<% if !@data.blank? %>
<div class="module-pane" id="<%= plugin.name %>">
<div class="module-pane" id="<%= plugin["name"] %>">
<%= render :partial => @plugin_partial if !@plugin_partial.blank? %>
</div>
<% end %>

View File

@ -2,7 +2,7 @@ module PersonalBook
OrbitApp.registration "PersonalBook",:type=> 'ModuleApp' do
module_label 'module_name.personal_book'
base_url File.expand_path File.dirname(__FILE__)
personal_plugin :enable => true, :app_name=>"WritingBook", :intro_app_name=>"PersonalBookIntro",:path=>"panel/personal_book/plugin/profile",:front_path=>"panel/personal_book/front_end/profile",:admin_path=>"/panel/personal_book/back_end/writing_books",:i18n=>'module_name.personal_book'
personal_plugin :enable => true, :sort_number => '25', :app_name=>"WritingBook", :intro_app_name=>"PersonalBookIntro",:path=>"panel/personal_book/plugin/profile",:front_path=>"panel/personal_book/front_end/profile",:admin_path=>"/panel/personal_book/back_end/writing_books",:i18n=>'module_name.personal_book'

View File

@ -2,7 +2,7 @@ module PersonalConference
OrbitApp.registration "PersonalConference",:type=> 'ModuleApp' do
module_label 'module_name.personal_conference'
base_url File.expand_path File.dirname(__FILE__)
personal_plugin :enable => true, :app_name=>"WritingConference", :intro_app_name=>"PersonalConferenceIntro",:path=>"panel/personal_conference/plugin/profile",:front_path=>"panel/personal_conference/front_end/profile",:admin_path=>"/panel/personal_conference/back_end/writing_conferences",:i18n=>'module_name.personal_conference'
personal_plugin :enable => true, :sort_number => '10', :app_name=>"WritingConference", :intro_app_name=>"PersonalConferenceIntro",:path=>"panel/personal_conference/plugin/profile",:front_path=>"panel/personal_conference/front_end/profile",:admin_path=>"/panel/personal_conference/back_end/writing_conferences",:i18n=>'module_name.personal_conference'

View File

@ -2,7 +2,7 @@ module PersonalDiploma
OrbitApp.registration "PersonalDiploma",:type=> 'ModuleApp' do
module_label 'module_name.personal_diploma'
base_url File.expand_path File.dirname(__FILE__)
personal_plugin :enable => true, :app_name=>"Diploma", :intro_app_name=>"PersonalDiplomaIntro",:path=>"panel/personal_diploma/plugin/profile",:front_path=>"panel/personal_diploma/front_end/profile",:admin_path=>"/panel/personal_diploma/back_end/diplomas",:i18n=>'module_name.personal_diploma'
personal_plugin :enable => true, :sort_number => '40', :app_name=>"Diploma", :intro_app_name=>"PersonalDiplomaIntro",:path=>"panel/personal_diploma/plugin/profile",:front_path=>"panel/personal_diploma/front_end/profile",:admin_path=>"/panel/personal_diploma/back_end/diplomas",:i18n=>'module_name.personal_diploma'

View File

@ -2,7 +2,7 @@ module PersonalExperience
OrbitApp.registration "PersonalExperience",:type=> 'ModuleApp' do
module_label 'module_name.personal_experience'
base_url File.expand_path File.dirname(__FILE__)
personal_plugin :enable => true, :app_name=>"Experience", :intro_app_name=>"PersonalExperienceIntro",:path=>"panel/personal_experience/plugin/profile",:front_path=>"panel/personal_experience/front_end/profile",:admin_path=>"/panel/personal_experience/back_end/experiences",:i18n=>'module_name.personal_experience'
personal_plugin :enable => true, :sort_number => '45', :app_name=>"Experience", :intro_app_name=>"PersonalExperienceIntro",:path=>"panel/personal_experience/plugin/profile",:front_path=>"panel/personal_experience/front_end/profile",:admin_path=>"/panel/personal_experience/back_end/experiences",:i18n=>'module_name.personal_experience'

View File

@ -2,7 +2,7 @@ module PersonalHonor
OrbitApp.registration "PersonalHonor",:type=> 'ModuleApp' do
module_label 'module_name.personal_honor'
base_url File.expand_path File.dirname(__FILE__)
personal_plugin :enable => true, :app_name=>"Honor", :intro_app_name=>"PersonalHonorIntro",:path=>"panel/personal_honor/plugin/profile",:front_path=>"panel/personal_honor/front_end/profile",:admin_path=>"/panel/personal_honor/back_end/honors",:i18n=>'module_name.personal_honor'
personal_plugin :enable => true, :sort_number => '50', :app_name=>"Honor", :intro_app_name=>"PersonalHonorIntro",:path=>"panel/personal_honor/plugin/profile",:front_path=>"panel/personal_honor/front_end/profile",:admin_path=>"/panel/personal_honor/back_end/honors",:i18n=>'module_name.personal_honor'

View File

@ -1,6 +1,6 @@
zh_tw:
module_name:
personal_journal: 期刊著作
personal_journal: 期刊論文
personal_journal:
paper_title : "論文名稱"
journal_title : "期刊名稱"

View File

@ -2,7 +2,7 @@ module PersonalJournal
OrbitApp.registration "PersonalJournal",:type=> 'ModuleApp' do
module_label 'module_name.personal_journal'
base_url File.expand_path File.dirname(__FILE__)
personal_plugin :enable => true, :app_name=>"WritingJournal", :intro_app_name=>"PersonalJournalIntro",:path=>"panel/personal_journal/plugin/profile",:front_path=>"panel/personal_journal/front_end/profile",:admin_path=>"/panel/personal_journal/back_end/writing_journals",:i18n=>'module_name.personal_journal'
personal_plugin :enable => true, :sort_number => '5', :app_name=>"WritingJournal", :intro_app_name=>"PersonalJournalIntro",:path=>"panel/personal_journal/plugin/profile",:front_path=>"panel/personal_journal/front_end/profile",:admin_path=>"/panel/personal_journal/back_end/writing_journals",:i18n=>'module_name.personal_journal'

View File

@ -2,7 +2,7 @@ module PersonalLab
OrbitApp.registration "PersonalLab",:type=> 'ModuleApp' do
module_label 'module_name.personal_lab'
base_url File.expand_path File.dirname(__FILE__)
personal_plugin :enable => true, :app_name=>"Lab", :intro_app_name=>"PersonalLabIntro",:path=>"panel/personal_lab/plugin/profile",:front_path=>"panel/personal_lab/front_end/profile",:admin_path=>"/panel/personal_lab/back_end/labs",:i18n=>'module_name.personal_lab'
personal_plugin :enable => true, :sort_number => '30', :app_name=>"Lab", :intro_app_name=>"PersonalLabIntro",:path=>"panel/personal_lab/plugin/profile",:front_path=>"panel/personal_lab/front_end/profile",:admin_path=>"/panel/personal_lab/back_end/labs",:i18n=>'module_name.personal_lab'
end

View File

@ -2,7 +2,7 @@ module PersonalPatent
OrbitApp.registration "PersonalPatent",:type=> 'ModuleApp' do
module_label 'module_name.personal_patent'
base_url File.expand_path File.dirname(__FILE__)
personal_plugin :enable => true, :app_name=>"WritingPatent", :intro_app_name=>"PersonalPatentIntro",:path=>"panel/personal_patent/plugin/profile",:front_path=>"panel/personal_patent/front_end/profile",:admin_path=>"/panel/personal_patent/back_end/writing_patents",:i18n=>'module_name.personal_patent'
personal_plugin :enable => true, :sort_number => '35', :app_name=>"WritingPatent", :intro_app_name=>"PersonalPatentIntro",:path=>"panel/personal_patent/plugin/profile",:front_path=>"panel/personal_patent/front_end/profile",:admin_path=>"/panel/personal_patent/back_end/writing_patents",:i18n=>'module_name.personal_patent'

View File

@ -2,7 +2,7 @@ module PersonalProject
OrbitApp.registration "PersonalProject",:type=> 'ModuleApp' do
module_label 'module_name.personal_project'
base_url File.expand_path File.dirname(__FILE__)
personal_plugin :enable => true, :app_name=>"Project", :intro_app_name=>"PersonalProjectIntro",:path=>"panel/personal_project/plugin/profile",:front_path=>"panel/personal_project/front_end/profile",:admin_path=>"/panel/personal_project/back_end/projects",:i18n=>'module_name.personal_project'
personal_plugin :enable => true, :sort_number => '15', :app_name=>"Project", :intro_app_name=>"PersonalProjectIntro",:path=>"panel/personal_project/plugin/profile",:front_path=>"panel/personal_project/front_end/profile",:admin_path=>"/panel/personal_project/back_end/projects",:i18n=>'module_name.personal_project'

View File

@ -2,7 +2,7 @@ module PersonalResearch
OrbitApp.registration "PersonalResearch",:type=> 'ModuleApp' do
module_label 'module_name.personal_research'
base_url File.expand_path File.dirname(__FILE__)
personal_plugin :enable => true, :app_name=>"Research", :intro_app_name=>"PersonalResearchIntro",:path=>"panel/personal_research/plugin/profile",:front_path=>"panel/personal_research/front_end/profile",:admin_path=>"/panel/personal_research/back_end/researchs",:i18n=>'module_name.personal_research'
personal_plugin :enable => true, :sort_number => '20', :app_name=>"Research", :intro_app_name=>"PersonalResearchIntro",:path=>"panel/personal_research/plugin/profile",:front_path=>"panel/personal_research/front_end/profile",:admin_path=>"/panel/personal_research/back_end/researchs",:i18n=>'module_name.personal_research'