added site bar settings for logo and title in frontend, fixed role status disbale enable and also added br to text area

This commit is contained in:
Harry Bomrah 2015-06-05 18:55:28 +08:00
parent e594d345cc
commit cfda81a546
12 changed files with 45 additions and 10 deletions

Binary file not shown.

After

Width:  |  Height:  |  Size: 928 B

View File

@ -42,8 +42,11 @@ class Admin::RoleStatusesController < OrbitMemberController
end
def toggle
@role_status.disable = @role_status.disable ? false : true
@role_status.save!
role_status = RoleStatus.find(params[:role_status_id]) rescue nil
if !role_status.nil?
role_status.disable = role_status.disable ? false : true
role_status.save!
end
render action: :index
end

View File

@ -20,10 +20,13 @@ module ApplicationHelper
header_file = File.join('../templates', "#{@key}", "/home/header.html.erb")
header_file_html = render :file => header_file
header = Nokogiri::HTML(header_file_html, nil, "UTF-8")
site_logo = header.css("img[src='{{logo_url}}']")[0]
site_logo.remove if site.site_logo.url.nil?
sub_menu_html = site.sub_menu
html = header.to_s
html = html.gsub("{{site_name}}",(site.title rescue ""))
html = html.gsub("%7B%7Blogo_url%7D%7D",(site.site_logo.url.nil? ? "/assets/site-logo.png" : site.site_logo.url))
t = site.title rescue ""
html = html.gsub("{{site_name}}",(site.display_title_in_frontend ? t : ""))
html = html.gsub("%7B%7Blogo_url%7D%7D",(site.site_logo.url.nil? ? "/assets/default-site-logo.png" : site.site_logo.url))
if site.sitemap_menu_in_header
sitemap = Page.find_by_key(:sitemap).name rescue "Sitemap"
sub_menu_html = sub_menu_html + "<a href='/#{I18n.locale.to_s}#{site.site_map_link}'>#{sitemap}</a>"

View File

@ -46,7 +46,7 @@ class AttributeValue
def get_field_value
if (self.attribute_field.markup.eql?("text_field") || self.attribute_field.markup.eql?("text_area"))
field_value = self.value[I18n.locale]
field_value = self.value[I18n.locale].gsub("\r\n","<br>")
elsif (self.attribute_field.markup.eql?("select") || self.attribute_field.markup.eql?("radio_button"))
field_value = self.attribute_field.markup_value["#{self.value}"][I18n.locale] rescue nil
elsif self.attribute_field.markup.eql?("address")

View File

@ -22,7 +22,7 @@ class MemberProfileFieldValue
index.nil? ? self["val"] : self["val"][index]
# self.member_profile_field.get_data[:cross_lang] ? Hash[VALID_LOCALES.collect{|lang| [lang,self[lang.to_sym]]}] : self["val"] #if !self.member_profile_field.get_data[:cross_lang]
else
self.member_profile_field.get_data["cross_lang"] =="true" ? self["val"] : Hash[site.valid_locales.collect{|lang| [lang,self[lang.to_sym]]}]
self.member_profile_field.get_data["cross_lang"] =="true" ? self["val"].gsub("\r\n","<br>") : Hash[site.valid_locales.collect{|lang| [lang,self[lang.to_sym].gsub("\r\n","<br>")]}]
end
when 'select','radio_button','address'
self["val"]

View File

@ -31,6 +31,7 @@ class Site
field :mobile_bar_color, :type => Array, :default=>[]
field :phone_number, :type => Array,:default=>[]
field :title_always_on, :type => Boolean, :default => false
field :display_title_in_frontend, :type => Boolean, :default => true
field :sitemap_menu_in_header, :type => Boolean, :default => false
field :enable_terms_of_use, :type => Boolean, :default => false
field :search,:type => Hash

View File

@ -12,5 +12,22 @@
<%= render :partial => 'role_status', :collection => @role_statuses %>
</tbody>
</table>
<script type="text/javascript">
$("document").ready(function(){
$(".role_status_checked").on("click",function(){
var el = $(this);
$.ajax({
url : el.data("path"),
type : "post"
})
})
$("input.toggle-check").each(function(){
var el = $(this),
parent = el.parent();
if(el.val() == "1"){
parent.removeClass("disable");
}
})
})
</script>

View File

@ -13,7 +13,7 @@
</td>
<% end %>
<td class="action dsrgsdgsdg">
<%= check_box_tag 'accept', role_status.disable ? 'false' : 'true', false ,{ :class => 'toggle-check role_status_checked', :data=>{:deploy=>"right"}, :data=>{:path=> eval("admin_role_status_toggle_path(role_status)")}, :checked=> role_status.disable} %>
<td class="action">
<%= check_box_tag 'accept', role_status.disable ? '0' : '1', false ,{ :class => 'toggle-check role_status_checked', :data=>{:deploy=>"right"}, :data=>{:path=> eval("admin_role_status_toggle_path(role_status)")}, :checked=> role_status.disable} %>
</td>
</tr>

View File

@ -48,6 +48,15 @@
</div>
</div>
<!-- Title show in frontend -->
<div class="control-group">
<label class="control-label muted"><%= t :display_title_in_frontend %></label>
<div class="controls">
<input type="checkbox" class="toggle-check" name="site[display_title_in_frontend]" data-disabled="true" <%= @site.display_title_in_frontend ? "checked='checked" : "" %> />
</div>
</div>
<hr>
<!-- CKeditor Site Header -->
<% I18n.available_locales.each do |locale|%>

View File

@ -87,6 +87,7 @@ en:
all_plugin_summary: All plugin summary
all_plugins: All plugins
always_display_title: Always displayed in the title bar
display_title_in_frontend: Display title in frontend
apply_change: Apply Change
applying_change: Applying Change
app_auth:

View File

@ -73,6 +73,7 @@ zh_tw:
all_plugin_summary: 所有學術資訊摘要
all_plugins: 所有學術資訊
always_display_title: 永遠顯示標題
display_title_in_frontend: 顯示在前台頁面
apply_change: 套用變更
applying_change: 正在套用變更
app_auth:

View File

@ -67,7 +67,7 @@ def sync_conference_papers(staff_id,mp)
wc.isi_number = conference["number"]
wc.publication_date = "#{conference["publication_year"]}/#{conference["publication_month"]}/01"
wc.rss2_id = conference["rss_id"]
w.year = "#{conference["publication_year"]}"
wc.year = "#{conference["publication_year"]}"
wc.url = conference["url"]
wc.paper_title_translations = conference["title"]
wc.member_profile = mp