added hashtags
This commit is contained in:
parent
4ed76d7b82
commit
d85140127c
|
|
@ -132,7 +132,8 @@ class AnnouncementsController < ApplicationController
|
|||
"img_src" => image_url || DefaultImgSrc,
|
||||
"img_description" => desc,
|
||||
"more" => t("announcement.more"),
|
||||
"view_count" => a.view_count
|
||||
"view_count" => a.view_count,
|
||||
"orbithashtags" => a.hashtags_for_frontend
|
||||
}
|
||||
else
|
||||
a
|
||||
|
|
@ -300,7 +301,7 @@ class AnnouncementsController < ApplicationController
|
|||
end
|
||||
max_all_count = [OrbitHelper.widget_data_count,anns.count].min
|
||||
if @tab_option != 0
|
||||
OrbitHelper.set_widget_title(OrbitHelper.widget_title +
|
||||
OrbitHelper.set_widget_title(OrbitHelper.widget_title +
|
||||
"<div style=\"clear: both;\"></div>" +
|
||||
"<ul class=\"nav_tabs_filter\">" +
|
||||
(use_tag ? tags.map.with_index{|tag,i|
|
||||
|
|
@ -310,7 +311,7 @@ class AnnouncementsController < ApplicationController
|
|||
if tag != "all"
|
||||
begin
|
||||
read_more_text = I18n.t("announcement.more_") + tags_translations[tag]
|
||||
rescue
|
||||
rescue
|
||||
nil
|
||||
end
|
||||
end
|
||||
|
|
@ -322,7 +323,7 @@ class AnnouncementsController < ApplicationController
|
|||
if cat != "all"
|
||||
begin
|
||||
read_more_text = I18n.t("announcement.more_") + cats_translations[cat]
|
||||
rescue
|
||||
rescue
|
||||
nil
|
||||
end
|
||||
end
|
||||
|
|
@ -361,19 +362,19 @@ class AnnouncementsController < ApplicationController
|
|||
}
|
||||
}
|
||||
var wpexLocalize = {
|
||||
"lightboxType": "iLightbox",
|
||||
"iLightbox": { "auto": false, "skin": "minimal", "path": "horizontal",
|
||||
"lightboxType": "iLightbox",
|
||||
"iLightbox": { "auto": false, "skin": "minimal", "path": "horizontal",
|
||||
"infinite": false, "maxScale": 1, "minScale": 0, "width": 1400, "height": "",
|
||||
"slideshow": { "pauseTime": 3000, "startPaused": true },
|
||||
"effects": { "reposition": true, "repositionSpeed": 200, "switchSpeed": 300,
|
||||
"loadedFadeSpeed": 50, "fadeSpeed": 500
|
||||
},
|
||||
"show": { "title": true, "speed": 200 },
|
||||
"hide": { "speed": 200 },
|
||||
"slideshow": { "pauseTime": 3000, "startPaused": true },
|
||||
"effects": { "reposition": true, "repositionSpeed": 200, "switchSpeed": 300,
|
||||
"loadedFadeSpeed": 50, "fadeSpeed": 500
|
||||
},
|
||||
"show": { "title": true, "speed": 200 },
|
||||
"hide": { "speed": 200 },
|
||||
"overlay": { "blur": true, "opacity": "0.9" },
|
||||
"slideShow": "Slideshow", "next": "Next", "previous": "Previous" ,
|
||||
"thumbnails": { "maxWidth": 120, "maxHeight": 80 }
|
||||
}
|
||||
"slideShow": "Slideshow", "next": "Next", "previous": "Previous" ,
|
||||
"thumbnails": { "maxWidth": 120, "maxHeight": 80 }
|
||||
}
|
||||
};
|
||||
$(document).ready(function(){
|
||||
var first_filter_tab = $("[data-subpart-id=\"'+subpart.id.to_s+'\"] .filter_tab").eq(0);
|
||||
|
|
@ -403,7 +404,7 @@ class AnnouncementsController < ApplicationController
|
|||
if cats.count == 1 && cats[0] != "all"
|
||||
begin
|
||||
read_more_text = I18n.t("announcement.more_") + ((all_tags.count == 1 && all_tags[0] != 'all') ? tags_translations[tags[0]] : cats_translations[cats[0]])
|
||||
rescue
|
||||
rescue
|
||||
nil
|
||||
end
|
||||
end
|
||||
|
|
@ -581,7 +582,7 @@ class AnnouncementsController < ApplicationController
|
|||
first_deadline = sorted_anns.pluck(:deadline).compact.sort[0]
|
||||
first_postdate = anns_for_locale.open_in_future.limit(1).pluck(:postdate)[0]
|
||||
invalid_date = [first_postdate,first_deadline].compact.sort[0]
|
||||
|
||||
|
||||
if devide_flag
|
||||
now_anns = sorted_anns.to_a
|
||||
top_anns = now_anns.select{|v| v.is_top}.map{|v| data_to_human_type(v,set_tags)}
|
||||
|
|
@ -832,7 +833,8 @@ class AnnouncementsController < ApplicationController
|
|||
"hide_class" => announcement.display_img? ? announcement.image_display_class : ' hide',
|
||||
"alt_title" => desc,
|
||||
"carousel_html" => carousel_html,
|
||||
"sub_anncs_text" => sub_anncs_text
|
||||
"sub_anncs_text" => sub_anncs_text,
|
||||
"orbithashtags" => announcement.hashtags_for_frontend
|
||||
},
|
||||
"comments" => announcement.comments,
|
||||
"show_comment_flag" => show_comment_flag,
|
||||
|
|
|
|||
|
|
@ -140,9 +140,15 @@ module AnnouncementsHelper
|
|||
}
|
||||
end
|
||||
if !params["source"].present?
|
||||
announcements = Bulletin.can_display_and_sorted
|
||||
if params["orbithashtag"].present?
|
||||
announcements = Bulletin.can_display_and_sorted
|
||||
.filter_by_categories(categories, false).filter_by_hashtag(OrbitHelper.page_hashtag_id).filter_by_tags(tags)
|
||||
.where(:title.nin => ["",nil])
|
||||
else
|
||||
announcements = Bulletin.can_display_and_sorted
|
||||
.filter_by_categories(categories, false).filter_by_tags(tags)
|
||||
.where(:title.nin => ["",nil])
|
||||
end
|
||||
if !extra_match_cond.empty?
|
||||
announcements = announcements.and(extra_match_cond)
|
||||
end
|
||||
|
|
@ -218,7 +224,7 @@ module AnnouncementsHelper
|
|||
if wrap_elements.count > 0
|
||||
htmls = parsing_repeats_again(wrap_elements,d[data_name][i], level + 1)
|
||||
htmls[0].each_with_index do |html,i|
|
||||
element = element.gsub(html,htmls[1][i])
|
||||
element = element.gsub(html,htmls[1][i])
|
||||
end
|
||||
end
|
||||
item.each do |key,value|
|
||||
|
|
@ -254,11 +260,11 @@ module AnnouncementsHelper
|
|||
doc = Nokogiri::HTML(file, nil, "UTF-8")
|
||||
file.close
|
||||
controller = AnnouncementsController.new
|
||||
begin
|
||||
begin
|
||||
data = @data# rescue nil
|
||||
rescue Exception => e
|
||||
rescue Exception => e
|
||||
write_debug_file(e,'announcements',@target_action) if Site::DEBUG
|
||||
end
|
||||
end
|
||||
if !data.nil?
|
||||
wrap_elements = doc.css("*[data-list][data-level='0']")
|
||||
htmls = parsing_repeats_again(wrap_elements,data,1)
|
||||
|
|
@ -291,11 +297,11 @@ module AnnouncementsHelper
|
|||
doc = Nokogiri::HTML(file, nil, "UTF-8")
|
||||
file.close
|
||||
controller = AnnouncementsController.new
|
||||
begin
|
||||
begin
|
||||
data = @data# rescue nil
|
||||
rescue Exception => e
|
||||
rescue Exception => e
|
||||
write_debug_file(e,'announcements',@target_action) if Site::DEBUG
|
||||
end
|
||||
end
|
||||
if data.nil?
|
||||
return "<div class='well'> No content to show. </div>".html_safe
|
||||
end
|
||||
|
|
@ -400,8 +406,8 @@ module AnnouncementsHelper
|
|||
if layout_types.empty?
|
||||
Dir.glob("#{Rails.root}/app/templates/#{@key}/modules/#{module_app}/*").each do |w|
|
||||
next if File.ftype(w).eql?("directory")
|
||||
w = File.basename(w, ".*")
|
||||
w = File.basename(w, ".*")
|
||||
w = File.basename(w, ".*")
|
||||
w = File.basename(w, ".*")
|
||||
if w[0,1] != "_" && w[0,1] != "s" && w != "info"
|
||||
layout_types << w
|
||||
end
|
||||
|
|
@ -434,7 +440,7 @@ module AnnouncementsHelper
|
|||
<p><strong class=\"carousel__description\">#{e['description']}</strong></p>
|
||||
</div>
|
||||
<div class=\"transitionfade\"></div>
|
||||
</div>"
|
||||
</div>"
|
||||
end.join+
|
||||
"</div>
|
||||
<ul class=\"controlplay\"><a class=\"resume-slide\" title = \"#{data['resume_btn_title']}\"><i></i></a><a class=\"pause-slide\" title = \"#{data['pause_btn_title']}\"><i></i></a></ul>
|
||||
|
|
|
|||
|
|
@ -6,6 +6,7 @@ class Bulletin
|
|||
include OrbitModel::Impression
|
||||
# encoding: utf-8
|
||||
include OrbitTag::Taggable
|
||||
include OrbitHashtag::Hashtaggable
|
||||
include OrbitCategory::Categorizable
|
||||
include Slug
|
||||
require 'announcement/cache'
|
||||
|
|
@ -505,7 +506,7 @@ class Bulletin
|
|||
feed_cache = BulletinFeedCache.where(uid: uid, start: startdt, end: enddt, date: dt)
|
||||
if force_update
|
||||
feed_cache = nil
|
||||
else
|
||||
else
|
||||
feed_cache_old = feed_cache.all_of([{:invalid_date.ne=>nil},{:invalid_date.lte => Time.now}]).last
|
||||
feed_cache.all_of([{:invalid_date.ne=>nil},{:invalid_date.lte => Time.now}]).destroy
|
||||
count = feed_cache.count
|
||||
|
|
|
|||
|
|
@ -80,6 +80,7 @@
|
|||
<li><a href="#status" data-toggle="tab"><%= t(:status) %></a></li>
|
||||
<% end %>
|
||||
<li><a href="#tag" data-toggle="tab"><%= t(:tags) %></a></li>
|
||||
<li><a href="#hashtag" data-toggle="tab"><%= t(:hashtags) %></a></li>
|
||||
<li><a href="#imageupload" data-toggle="tab"><%= t('announcement.image') %></a></li>
|
||||
<li><a href="#carousel_image_upload" data-toggle="tab" title="<%= t('announcement.carousel_image_title') %>"><%= t('announcement.carousel_image') %></a></li>
|
||||
<li><a href="#relation_announcements_list" data-toggle="tab" title="<%= t('announcement.relation_announcements_list') %>"><%= t('announcement.relation_announcements_list') %></a></li>
|
||||
|
|
@ -297,6 +298,14 @@
|
|||
</div>
|
||||
</div>
|
||||
|
||||
<!-- Hashtag Module -->
|
||||
<div class="tab-pane fade" id="hashtag">
|
||||
<div class="control-group">
|
||||
<label class="control-label muted"><%= t(:hashtags) %></label>
|
||||
<%= select_hashtags(f, @module_app) %>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- Images Module -->
|
||||
<div class="tab-pane fade" id="imageupload">
|
||||
|
||||
|
|
|
|||
|
|
@ -93,6 +93,7 @@ module Announcement
|
|||
widget_methods ["widget","random_announcement_widget", "tag_cloud"]
|
||||
widget_settings [{"data_count"=>30}]
|
||||
taggable "Bulletin"
|
||||
hashtaggable "Bulletin"
|
||||
categorizable
|
||||
authorizable
|
||||
frontend_enabled
|
||||
|
|
@ -133,7 +134,7 @@ module Announcement
|
|||
:priority=>2,
|
||||
:active_for_action=>{'admin/announcement'=>'edit_sort'},
|
||||
:available_for => 'managers'
|
||||
context_link 'new_',
|
||||
context_link 'new_',
|
||||
:link_path=>"new_admin_announcement_path" ,
|
||||
:priority=>3,
|
||||
:active_for_action=>{'admin/announcements'=>'new'},
|
||||
|
|
@ -172,9 +173,9 @@ module Announcement
|
|||
# temp = YAML.load_file(File.join(Rails.root,"config","mongoid.yml"))
|
||||
# dbsettings = temp["production"]["sessions"]["default"]
|
||||
# s = Moped::Session.new(dbsettings["hosts"])
|
||||
# s.use dbsettings["database"]
|
||||
# s.use dbsettings["database"]
|
||||
# s[:bulletins].indexes.create({expirable_created_at: 1},{ expireAfterSeconds: 180 })
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
|||
Loading…
Reference in New Issue