Merge branch 'master' into 'master'
add ckeditor to title and add title to a tag See merge request !11
This commit is contained in:
commit
fa62f06c9f
|
@ -332,18 +332,20 @@ class Admin::AnnouncementsController < OrbitAdminController
|
||||||
|
|
||||||
is_sent = bulletin.email.is_sent
|
is_sent = bulletin.email.is_sent
|
||||||
is_sent = !params[:resend_mail].eql?("true") if !params[:resend_mail].blank?
|
is_sent = !params[:resend_mail].eql?("true") if !params[:resend_mail].blank?
|
||||||
|
doc = Nokogiri::HTML(bulletin.title)
|
||||||
|
title = doc.text.empty? ? 'no content' : doc.text
|
||||||
|
|
||||||
bulletin.email.update_attributes(
|
bulletin.email.update_attributes(
|
||||||
:create_user=>current_user,
|
:create_user=>current_user,
|
||||||
:mail_sentdate=>bulletin.email_sentdate,
|
:mail_sentdate=>bulletin.email_sentdate,
|
||||||
:module_app=>@module_app,
|
:module_app=>@module_app,
|
||||||
:mail_lang => I18n.locale,
|
:mail_lang => I18n.locale,
|
||||||
:mail_to=>bulletin.email_addresses,
|
:mail_to=>bulletin.email_addresses,
|
||||||
:mail_subject=>bulletin.title,
|
:mail_subject=>title,
|
||||||
:template=>'announcements/email',
|
:template=>'announcements/email',
|
||||||
:template_data=>{
|
:template_data=>{
|
||||||
"host" => request.host_with_port,
|
"host" => request.host_with_port,
|
||||||
"title" => bulletin.title,
|
"title" => title,
|
||||||
"url" => page_for_bulletin(bulletin)
|
"url" => page_for_bulletin(bulletin)
|
||||||
},
|
},
|
||||||
:is_sent=>is_sent
|
:is_sent=>is_sent
|
||||||
|
|
|
@ -22,6 +22,8 @@ class AnnouncementsController < ApplicationController
|
||||||
desc = (desc.nil? || desc == "" ? "announcement image" : desc)
|
desc = (desc.nil? || desc == "" ? "announcement image" : desc)
|
||||||
link_to_show = a.is_external_link ? a.external_link : OrbitHelper.url_to_show(a.to_param)
|
link_to_show = a.is_external_link ? a.external_link : OrbitHelper.url_to_show(a.to_param)
|
||||||
target = a.is_external_link ? "_blank" : "_self"
|
target = a.is_external_link ? "_blank" : "_self"
|
||||||
|
doc = Nokogiri::HTML(a.title)
|
||||||
|
title = doc.text.empty? ? 'no content' : doc.text
|
||||||
anns << {
|
anns << {
|
||||||
"bulletin_links" => links,
|
"bulletin_links" => links,
|
||||||
"bulletin_files" => files,
|
"bulletin_files" => files,
|
||||||
|
@ -35,7 +37,7 @@ class AnnouncementsController < ApplicationController
|
||||||
"postdate" => a.postdate,
|
"postdate" => a.postdate,
|
||||||
"author" => author,
|
"author" => author,
|
||||||
"is_top" => (a.is_top? ? 1 : 0),
|
"is_top" => (a.is_top? ? 1 : 0),
|
||||||
"link_to_show" => link_to_show,
|
"link_to_show" => link_to_show+"\" title=\"#{title}\"",
|
||||||
"target" => target,
|
"target" => target,
|
||||||
"img_src" => a.image.thumb.url || "/assets/announcement-default.jpg",
|
"img_src" => a.image.thumb.url || "/assets/announcement-default.jpg",
|
||||||
"img_description" => desc,
|
"img_description" => desc,
|
||||||
|
|
|
@ -9,7 +9,7 @@ class Bulletin
|
||||||
include OrbitCategory::Categorizable
|
include OrbitCategory::Categorizable
|
||||||
include Slug
|
include Slug
|
||||||
|
|
||||||
field :title, as: :slug_title, type: String, localize: true
|
field :title, type: String, localize: true
|
||||||
field :subtitle, localize: true
|
field :subtitle, localize: true
|
||||||
field :text, localize: true
|
field :text, localize: true
|
||||||
field :create_user_id
|
field :create_user_id
|
||||||
|
@ -51,7 +51,10 @@ class Bulletin
|
||||||
scope :is_approved, ->{where(:approved => true)}
|
scope :is_approved, ->{where(:approved => true)}
|
||||||
|
|
||||||
before_create :set_expire
|
before_create :set_expire
|
||||||
|
def slug_title
|
||||||
|
doc = Nokogiri::HTML(self.title)
|
||||||
|
title = doc.text.gsub('/','-')
|
||||||
|
end
|
||||||
def set_expire
|
def set_expire
|
||||||
self.expirable_created_at = Time.now if self.is_preview
|
self.expirable_created_at = Time.now if self.is_preview
|
||||||
return true
|
return true
|
||||||
|
|
|
@ -242,7 +242,7 @@
|
||||||
<label class="control-label muted"><%= t(:title) %></label>
|
<label class="control-label muted"><%= t(:title) %></label>
|
||||||
<div class="controls">
|
<div class="controls">
|
||||||
<%= f.fields_for :title_translations do |f| %>
|
<%= f.fields_for :title_translations do |f| %>
|
||||||
<%= f.text_field locale, class: "input-block-level", placeholder: t(:title), value: (@bulletin.title_translations[locale] rescue nil) %>
|
<%= f.text_area locale, class: "ckeditor input-block-level", placeholder: t(:title), value: (@bulletin.title_translations[locale] rescue nil) %>
|
||||||
<% end %>
|
<% end %>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
@ -253,7 +253,7 @@
|
||||||
<div class="controls">
|
<div class="controls">
|
||||||
<div class="textarea">
|
<div class="textarea">
|
||||||
<%= f.fields_for :subtitle_translations do |f| %>
|
<%= f.fields_for :subtitle_translations do |f| %>
|
||||||
<%= f.text_area locale, rows: 2, class: "input-block-level", value: (@bulletin.subtitle_translations[locale] rescue nil) %>
|
<%= f.text_area locale, rows: 2, class: "ckeditor input-block-level", value: (@bulletin.subtitle_translations[locale] rescue nil) %>
|
||||||
<% end %>
|
<% end %>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
@ -26,7 +26,7 @@
|
||||||
<% if b.expired? || (b.category.disable rescue false)%>
|
<% if b.expired? || (b.category.disable rescue false)%>
|
||||||
<%= b.title %>
|
<%= b.title %>
|
||||||
<% else %>
|
<% else %>
|
||||||
<a href="<%= page_for_bulletin(b) %>" target="_blank"><%= b.title %></a>
|
<a href="<%= page_for_bulletin(b) %>" target="_blank"><%= b.title.html_safe %></a>
|
||||||
<% end %>
|
<% end %>
|
||||||
|
|
||||||
<% if b.expired? %>
|
<% if b.expired? %>
|
||||||
|
|
|
@ -1,69 +1,69 @@
|
||||||
<%
|
<%
|
||||||
require 'announcements_helper'
|
require 'announcements_helper'
|
||||||
params = OrbitHelper.params
|
params = OrbitHelper.params
|
||||||
page = Page.where(url:params['url']).first
|
page = Page.where(url:params['url']).first
|
||||||
@show_back_and_next_flag = 0
|
@show_back_and_next_flag = 0
|
||||||
if page.methods.include? 'select_option_items'.to_sym
|
if page.methods.include? 'select_option_items'.to_sym
|
||||||
ModuleApp.all.select{|tmp| tmp.key.to_s=='announcement'}.each do |modile_app|
|
ModuleApp.all.select{|tmp| tmp.key.to_s=='announcement'}.each do |modile_app|
|
||||||
@show_option_items = modile_app.show_option_items rescue nil
|
@show_option_items = modile_app.show_option_items rescue nil
|
||||||
end
|
end
|
||||||
page.select_option_items.each do |select_option_item|
|
page.select_option_items.each do |select_option_item|
|
||||||
if !(@show_option_items.nil?) && select_option_item.field_name == @show_option_items.keys.first.to_s
|
if !(@show_option_items.nil?) && select_option_item.field_name == @show_option_items.keys.first.to_s
|
||||||
value = YAML.load(select_option_item.value)
|
value = YAML.load(select_option_item.value)
|
||||||
if value[I18n.locale] == t('announcement.not_show')
|
if value[I18n.locale] == t('announcement.not_show')
|
||||||
@show_back_and_next_flag = 0
|
@show_back_and_next_flag = 0
|
||||||
elsif value[I18n.locale] == t('announcement.show_top')
|
elsif value[I18n.locale] == t('announcement.show_top')
|
||||||
@show_back_and_next_flag = 1
|
@show_back_and_next_flag = 1
|
||||||
elsif value[I18n.locale] == t('announcement.show_bottom')
|
elsif value[I18n.locale] == t('announcement.show_bottom')
|
||||||
@show_back_and_next_flag = 2
|
@show_back_and_next_flag = 2
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
if @show_back_and_next_flag != 0
|
if @show_back_and_next_flag != 0
|
||||||
uid = params['uid']
|
uid = params['uid']
|
||||||
announcements,sorted = get_sorted_annc
|
announcements,sorted = get_sorted_annc
|
||||||
now_index = sorted.to_enum.with_index.select{|v| v[0].uid==uid}[0][1]
|
now_index = sorted.to_enum.with_index.select{|v| v[0].uid==uid}[0][1]
|
||||||
if now_index != 0
|
if now_index != 0
|
||||||
prev_result = sorted[now_index-1]
|
prev_result = sorted[now_index-1]
|
||||||
prev_url = params['url'] + '/' + prev_result.to_param
|
prev_url = params['url'] + '/' + prev_result.to_param
|
||||||
prev_content = "<a href='#{prev_url}' class='prev'><b>#{t('announcement.prev')}</b><p>#{prev_result['title'][I18n.locale]}</p></a>"
|
prev_content = "<a href='#{prev_url}' title='#{t('announcement.prev')}' class='prev'><b>#{t('announcement.prev')}</b><p>#{prev_result['title'][I18n.locale]}</p></a>"
|
||||||
end
|
end
|
||||||
if now_index != sorted.length-1
|
if now_index != sorted.length-1
|
||||||
next_result = sorted[now_index+1]
|
next_result = sorted[now_index+1]
|
||||||
next_url = params['url'] + '/' + next_result.to_param
|
next_url = params['url'] + '/' + next_result.to_param
|
||||||
next_content = "<a href='#{next_url}' class='next'><b>#{t('announcement.next')}</b><p>#{next_result['title'][I18n.locale]}</p></a>"
|
next_content = "<a href='#{next_url}' title='#{t('announcement.next')}' class='next'><b>#{t('announcement.next')}</b><p>#{next_result['title'][I18n.locale]}</p></a>"
|
||||||
end
|
end
|
||||||
content = "<div class='see_more_boxTitle'>#{prev_content}#{next_content}</div>".html_safe
|
content = "<div class='see_more_boxTitle'>#{prev_content}#{next_content}</div>".html_safe
|
||||||
end
|
end
|
||||||
%>
|
%>
|
||||||
<% if @show_back_and_next_flag!=0 %>
|
<% if @show_back_and_next_flag!=0 %>
|
||||||
<style type="text/css">
|
<style type="text/css">
|
||||||
.see_more_boxTitle{
|
.see_more_boxTitle{
|
||||||
display: flex;
|
display: flex;
|
||||||
margin: 1em 0em;
|
margin: 1em 0em;
|
||||||
padding: 1em;
|
padding: 1em;
|
||||||
border: 0.2em solid;
|
border: 0.2em solid;
|
||||||
}
|
}
|
||||||
a.prev, a.next{
|
a.prev, a.next{
|
||||||
width: 50%;
|
width: 50%;
|
||||||
border: 0.2em solid;
|
border: 0.2em solid;
|
||||||
padding: 1em;
|
padding: 1em;
|
||||||
flex: 1;
|
flex: 1;
|
||||||
}
|
}
|
||||||
a.next{
|
a.next{
|
||||||
margin-left: 1em;
|
margin-left: 1em;
|
||||||
}
|
}
|
||||||
a.prev{
|
a.prev{
|
||||||
margin-right: 1em;
|
margin-right: 1em;
|
||||||
}
|
}
|
||||||
</style>
|
</style>
|
||||||
<% end %>
|
<% end %>
|
||||||
|
|
||||||
<% if @show_back_and_next_flag==1 %>
|
<% if @show_back_and_next_flag==1 %>
|
||||||
<%= content %>
|
<%= content %>
|
||||||
<% end %>
|
<% end %>
|
||||||
<%= render_view %>
|
<%= render_view %>
|
||||||
<% if @show_back_and_next_flag==2 %>
|
<% if @show_back_and_next_flag==2 %>
|
||||||
<%= content %>
|
<%= content %>
|
||||||
<% end %>
|
<% end %>
|
Loading…
Reference in New Issue