Compare commits
1
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
28f3d80c81 |
No files matched your search
@@ -1,18 +0,0 @@
|
||||
$(function() {
|
||||
// for toggle-check
|
||||
$('.role_filter_checked').on({
|
||||
change: function() {
|
||||
var _path = $(this).data('path');
|
||||
// var path = <%= @path %>
|
||||
$.ajax({
|
||||
url: _path,
|
||||
type: 'POST',
|
||||
dataType: 'json',
|
||||
data: {remote: true},
|
||||
})
|
||||
.done(function() {})
|
||||
.fail(function() {})
|
||||
.always(function() {});
|
||||
},
|
||||
});
|
||||
});
|
||||
@@ -12,6 +12,8 @@ class Admin::PagePartsController < OrbitBackendController
|
||||
@module_app_categories = @module_app.categories
|
||||
@module_app_tags = @module_app.tags
|
||||
@widget_paths = ModuleApp.find(@module_app.id).widgets.map{|name, data| [t(data["i18n"]), name]} rescue []
|
||||
@pages = Page.where(:module_app_id => @module_app.id)
|
||||
|
||||
if @part.widget_path.present?
|
||||
if @part.widget_path.eql?("default_widget")
|
||||
@checked_style = @part.widget_style
|
||||
@@ -27,7 +29,10 @@ class Admin::PagePartsController < OrbitBackendController
|
||||
# @frontend_styles = @module_app.widgets[params[:val]]["style"] rescue nil
|
||||
@frontend_styles = @module_app.widgets[@part.widget_path]["style"] rescue nil
|
||||
@partial = 'custom_widget' if @frontend_styles.present?
|
||||
|
||||
end
|
||||
@partial = 'more_link' unless @partial
|
||||
|
||||
end
|
||||
@data_count = @module_app.get_registration.get_data_count.to_a rescue []
|
||||
@no_orbit_bar = @side_bar = @no_header = true
|
||||
@@ -85,6 +90,7 @@ class Admin::PagePartsController < OrbitBackendController
|
||||
def get_display_style
|
||||
@part = PagePart.find(params[:id]) rescue nil
|
||||
@module_app = ModuleApp.find(params[:module_id]) rescue nil
|
||||
@pages = Page.where(:module_app_id => @module_app.id)
|
||||
if @module_app
|
||||
if params[:val].eql?("default_widget")
|
||||
@checked_style = @part.widget_path.present? ? @part.widget_style : nil if @part && @part.widget_path.eql?("default_widget")
|
||||
@@ -99,6 +105,8 @@ class Admin::PagePartsController < OrbitBackendController
|
||||
@frontend_styles = @module_app.widgets[params[:val]]["style"] rescue nil
|
||||
@partial = 'custom_widget' if @frontend_styles.present?
|
||||
end
|
||||
@partial = 'more_link' unless @partial
|
||||
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
@@ -39,8 +39,8 @@ class DefaultWidgetController< OrbitWidgetController
|
||||
end
|
||||
|
||||
def default_widget
|
||||
@search = params["search_query"].blank? ? false : true
|
||||
|
||||
@search = params["search_query"].blank? ? false : true
|
||||
if !params[:id].blank? and !params["clicked_field_name"].blank?
|
||||
clicked_field_name = params["clicked_field_name"].to_sym
|
||||
redirect_to eval("#{@page_part.module_app.widget_fields_link_method[clicked_field_name][:method]}('#{params[:id]}', {inner: #{params[:inner] || true}})")
|
||||
@@ -70,10 +70,7 @@ class DefaultWidgetController< OrbitWidgetController
|
||||
@data_limit = @page_part.widget_data_count.is_a?(Fixnum) ? @page_part.widget_data_count : (@page_part.widget_data_count.to_i rescue 3)
|
||||
end
|
||||
|
||||
if params[:click]
|
||||
@data = get_more_btn_data.page(params[:page_main]).per(@data_limit)
|
||||
|
||||
elsif @paginate || @search
|
||||
if @paginate || @search
|
||||
if @search
|
||||
@data = search_result.page(params[:page_main]).per(@data_limit) rescue []
|
||||
else #regular listing
|
||||
@@ -95,17 +92,10 @@ class DefaultWidgetController< OrbitWidgetController
|
||||
@tag_class = 'default_widget_typeC'
|
||||
@partial = "typeC"
|
||||
end
|
||||
@more_url = Page.find(@page_part.more_link).path rescue nil
|
||||
# debugger
|
||||
end
|
||||
end
|
||||
|
||||
def get_more_btn_data
|
||||
filterids = PagePart.find(params[:part_id]).category
|
||||
model = eval(@default_widget["query"])
|
||||
data = model.where(:category_id.in => filterids)
|
||||
data.available_for_lang(I18n.locale).can_display.desc(:is_top, :postdate)
|
||||
end
|
||||
|
||||
|
||||
|
||||
def get_category_field_name
|
||||
@ori_class_name = @ori_class_name.constantize
|
||||
|
||||
@@ -64,15 +64,12 @@ class PagesController < ApplicationController
|
||||
url = "/#{@item.path}"
|
||||
options = ''
|
||||
options << "#{options.blank? ? '?' : '&'}page_main=#{params[:page_main]}" unless params[:page_main].blank?
|
||||
options << "#{options.blank? ? '?' : '&'}click=#{params[:click]}" unless params[:click].blank?
|
||||
options << "#{options.blank? ? '?' : '&'}part_id=#{params[:page_part_id]}" unless params[:page_part_id].blank?
|
||||
|
||||
if params[:category_id].is_a? Array
|
||||
options << "#{options.blank? ? '?' : '&'}#{convert_array_param('category_id',params[:category_id])}" unless params[:category_id].blank?
|
||||
elsif params[:category_id].is_a? String
|
||||
options << "#{options.blank? ? '?' : '&'}category_id=#{params[:category_id]}" unless params[:category_id].blank?
|
||||
end
|
||||
|
||||
if params[:tag_id].is_a? Array
|
||||
options << "#{options.blank? ? '?' : '&'}#{convert_array_param('tag_id',params[:tag_id])}" unless params[:tag_id].blank?
|
||||
elsif params[:category_id].is_a? String
|
||||
@@ -83,7 +80,7 @@ class PagesController < ApplicationController
|
||||
options << "#{options.blank? ? '?' : '&'}search_query=#{params[:search_query]}" unless params[:search_query].blank?
|
||||
options << "#{options.blank? ? '?' : '&'}name=#{params[:name]}" unless params[:name].blank?
|
||||
uri = URI::escape(url + options)
|
||||
#uri = URI::escape("#{url}?" + params.collect{|k,v| "#{k}=#{v}"}.join('&'))
|
||||
# uri = URI::escape("#{url}?" + params.collect{|k,v| "#{k}=#{v}"}.join('&'))
|
||||
redirect_to(uri)unless save_from_no_lang_for_page
|
||||
end
|
||||
|
||||
@@ -107,78 +104,27 @@ class PagesController < ApplicationController
|
||||
protected
|
||||
|
||||
def get_item
|
||||
# if params[:page_id]
|
||||
# @item = Item.find(params[:page_id])
|
||||
# elsif params[:same_page_id]
|
||||
# @item = Item.find(params[:same_page_id])
|
||||
# else
|
||||
# category_ids = Array(params[:category_id]) unless params[:category_id].nil?
|
||||
# tag_ids = Array(params[:tag_id]) unless params[:tag_id].nil?
|
||||
# module_app = ModuleApp.first(:conditions => {:key => params[:app_name]})
|
||||
|
||||
# default_query = { is_published: true, module_app_id: module_app.id, :app_frontend_url.in => [params[:app_action], 'default_widget'] }
|
||||
# specific_categories = { :category => category_ids }
|
||||
# in_categories = { :category.in => category_ids }
|
||||
# nil_categories = { :category.in => [nil, []] }
|
||||
# specific_tags = { :tag => tag_ids }
|
||||
# in_tags = { :tag.in => tag_ids }
|
||||
# nil_tags = { :tag.in => [nil, []] }
|
||||
|
||||
# if !category_ids.blank? && !tag_ids.blank?
|
||||
# @item = Item.where(default_query.merge(specific_categories).merge(specific_tags)).first
|
||||
# @item = Item.where(default_query.merge(specific_categories).merge(in_tags)).first unless @item
|
||||
# @item = Item.where(default_query.merge(specific_categories).merge(nil_tags)).first unless @item
|
||||
# @item = Item.where(default_query.merge(specific_tags).merge(in_categories)).first unless @item
|
||||
# @item = Item.where(default_query.merge(specific_tags).merge(nil_categories)).first unless @item
|
||||
# @item = Item.where(default_query.merge(in_categories).merge(in_tags)).first unless @item
|
||||
# @item = Item.where(default_query.merge(in_categories).merge(nil_tags)).first unless @item
|
||||
# @item = Item.where(default_query.merge(in_tags).merge(nil_categories)).first unless @item
|
||||
# elsif !category_ids.blank?
|
||||
# @item = Item.where(default_query.merge(specific_categories).merge(nil_tags)).first
|
||||
# @item = Item.where(default_query.merge(specific_categories)).first unless @item
|
||||
# @item = Item.where(default_query.merge(in_categories).merge(nil_tags)).first unless @item
|
||||
# @item = Item.where(default_query.merge(in_categories)).first unless @item
|
||||
# elsif !tag_ids.blank?
|
||||
# @item = Item.where(default_query.merge(specific_tags).merge(nil_categories)).first
|
||||
# @item = Item.where(default_query.merge(specific_tags)).first unless @item
|
||||
# @item = Item.where(default_query.merge(in_tags).merge(nil_categories)).first unless @item
|
||||
# @item = Item.where(default_query.merge(in_tags)).first unless @item
|
||||
# end
|
||||
# @item = Item.find(params[:orig_page]) unless @item || params[:orig_page].blank?
|
||||
# @item = Item.where(default_query.merge(nil_categories).merge(nil_tags)).first unless @item
|
||||
# @item = Item.where(default_query).first unless @item
|
||||
# end
|
||||
# raise PageError, 'Missing Frontend Page' if @item.nil?
|
||||
|
||||
# if params[:page_id]
|
||||
# @item = Item.find(params[:page_id])
|
||||
# elsif params[:same_page_id]
|
||||
# @item = Item.find(params[:same_page_id])
|
||||
# else
|
||||
# category_ids = params[:category_id].is_a?(Array) ? params[:category_id] : [params[:category_id]]
|
||||
# tag_ids = params[:tag_id].is_a?(Array) ? params[:tag_id] : [params[:tag_id]]
|
||||
# module_app = ModuleApp.first(:conditions => {:key => params[:app_name]})
|
||||
# if !category_ids.blank? && !tag_ids.blank?
|
||||
# @item = Item.first(:conditions => {:module_app_id => module_app.id, :app_frontend_url => params[:app_action], :category.in => category_ids, :tag.in => tag_ids})
|
||||
# @item = Item.first(:conditions => {:module_app_id => module_app.id, :app_frontend_url => params[:app_action], :category.in => category_ids, :tag.in => [nil, []]}) unless @item
|
||||
# elsif !category_ids.blank?
|
||||
# @item = Item.where(module_app_id: module_app.id, app_frontend_url: params[:app_action], :category.in => category_ids).any_in(tag: [nil, []]).first
|
||||
# elsif !tag_ids.blank?
|
||||
# @item = Item.where(module_app_id: module_app.id, app_frontend_url: params[:app_action], :tag.in => tag_ids).any_in(category: [nil, []]).first
|
||||
# end
|
||||
# @item = Item.find(params[:orig_page]) unless @item || params[:orig_page].blank?
|
||||
# @item = Item.where(module_app_id: module_app.id, app_frontend_url: params[:app_action]).all_of("tag" => {"$in" => [nil, []]},"category" => { "$in" => [nil, []]}).first unless @item
|
||||
# @item = Item.where(module_app_id: module_app.id, app_frontend_url: 'default_widget').first unless @item
|
||||
# @item = Item.where(module_app_id: module_app.id, app_frontend_url: params[:app_action]).first unless @item
|
||||
# end
|
||||
# raise PageError,'Missing Frontend Page' if @item.nil?
|
||||
|
||||
if params[:page_id]
|
||||
@item = Item.find(params[:page_id])
|
||||
elsif params[:same_page_id]
|
||||
@item = Item.find(params[:same_page_id])
|
||||
else
|
||||
category_ids = params[:category_id].is_a?(Array) ? params[:category_id] : [params[:category_id]]
|
||||
tag_ids = params[:tag_id].is_a?(Array) ? params[:tag_id] : [params[:tag_id]]
|
||||
module_app = ModuleApp.first(:conditions => {:key => params[:app_name]})
|
||||
@item = Item.root.children.where(:module_app_id => module_app.id).first
|
||||
if !category_ids.blank? && !tag_ids.blank?
|
||||
@item = Item.first(:conditions => {:module_app_id => module_app.id, :app_frontend_url => params[:app_action], :category.in => category_ids, :tag.in => tag_ids})
|
||||
@item = Item.first(:conditions => {:module_app_id => module_app.id, :app_frontend_url => params[:app_action], :category.in => category_ids, :tag.in => [nil, []]}) unless @item
|
||||
elsif !category_ids.blank?
|
||||
@item = Item.where(module_app_id: module_app.id, app_frontend_url: params[:app_action], :category.in => category_ids).any_in(tag: [nil, []]).first
|
||||
elsif !tag_ids.blank?
|
||||
@item = Item.where(module_app_id: module_app.id, app_frontend_url: params[:app_action], :tag.in => tag_ids).any_in(category: [nil, []]).first
|
||||
end
|
||||
@item = Item.find(params[:orig_page]) unless @item || params[:orig_page].blank?
|
||||
@item = Item.where(module_app_id: module_app.id, app_frontend_url: params[:app_action]).all_of("tag" => {"$in" => [nil, []]},"category" => { "$in" => [nil, []]}).first unless @item
|
||||
@item = Item.where(module_app_id: module_app.id, app_frontend_url: 'default_widget').first unless @item
|
||||
@item = Item.where(module_app_id: module_app.id, app_frontend_url: params[:app_action]).first unless @item
|
||||
end
|
||||
raise PageError,'Missing Frontend Page' if @item.nil?
|
||||
end
|
||||
|
||||
@@ -12,6 +12,7 @@ class PagePart
|
||||
field :widget_path
|
||||
field :category,type: Array, :default => []
|
||||
field :tag, type: Array,:default => []
|
||||
field :more_link_page_id
|
||||
|
||||
field :widget_style
|
||||
field :widget_field , :type => Array,:default => []
|
||||
|
||||
@@ -4,6 +4,12 @@
|
||||
<%= select 'page_part', 'widget_style', @frontend_styles, {:selected => (@part && @part[:widget_style])}, class: "input-xlarge" %>
|
||||
</div>
|
||||
</div>
|
||||
<div class="control-group input-content">
|
||||
<label class="control-label muted">More Link</label>
|
||||
<div class="controls">
|
||||
<%= select 'page_part', 'more_link_page_id', options_for_select(@pages.collect{|page|[page.title,page.id]},(@part.more_link_page_id rescue nil)), class: "input-xlarge" %>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="control-group input-content">
|
||||
<% @module_app.widget_options.tap { |widget|%>
|
||||
@@ -19,8 +25,8 @@
|
||||
<% else%>
|
||||
<div class="controls">
|
||||
<%= select_tag "page_part[widget_options][#{key}]", options_for_select(options,(@part.widget_options[key] rescue nil)), class: "input-xlarge" %>
|
||||
</div>
|
||||
<% end %>
|
||||
</div>
|
||||
<% end %>
|
||||
<% } %>
|
||||
<% } %>
|
||||
|
||||
@@ -74,6 +74,12 @@
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
<div class="control-group input-content">
|
||||
<label class="control-label muted">More Link</label>
|
||||
<div class="controls">
|
||||
<%= select 'page_part', 'more_link_page_id', options_for_select(@pages.collect{|page|[page.title,page.id]},(@part.more_link_page_id rescue nil)), class: "input-xlarge" %>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<script>
|
||||
$('.typesetting li').each(function(index, el) {
|
||||
|
||||
@@ -0,0 +1,6 @@
|
||||
<div class="control-group input-content">
|
||||
<label class="control-label muted">More Link</label>
|
||||
<div class="controls">
|
||||
<%= select 'page_part', 'more_link_page_id', options_for_select(@pages.collect{|page|[page.title,page.id]},(@part.more_link_page_id rescue nil)), class: "input-xlarge" %>
|
||||
</div>
|
||||
</div>
|
||||
@@ -4,6 +4,10 @@
|
||||
<% if @paginate %>
|
||||
<%= paginate @data, :param_name => :page_main, :params => {:same_page_id => @page_id} %>
|
||||
<% elsif @page_part.module_app %>
|
||||
<%= @page_part.module_app.get_registration.default_widget_setting.link_to_more_tag(request,params) %>
|
||||
|
||||
<%#= @page_part.module_app.get_registration.default_widget_setting.link_to_more_tag(request,params) %>
|
||||
|
||||
<%= @page_part.module_app.get_registration.default_widget_setting.short_link_to_more(request,@more_url) %>
|
||||
|
||||
<% end %>
|
||||
<% end %>
|
||||
@@ -16,9 +16,15 @@ module DefaultWidgetTagHelper
|
||||
end
|
||||
end
|
||||
params_str = params_str + (params_str.eql?("?") ? params.to_param : "&#{params.to_param}" )
|
||||
params_str = params_str + "&click=more_btn&page_part_id=#{@params[:part_id]}"
|
||||
content_tag :div,:class=> 'more' do
|
||||
link_to I18n.t(@more_link[:label_i18n]),[eval("#{@more_link[:path_method]}"),params_str].join()
|
||||
end
|
||||
end
|
||||
|
||||
def short_link_to_more(req,url)
|
||||
@request = req
|
||||
content_tag :div,:class=> 'more' do
|
||||
link_to I18n.t(@more_link[:label_i18n]),url
|
||||
end
|
||||
end
|
||||
end
|
||||
@@ -19,12 +19,12 @@ module ParserFrontEnd
|
||||
end
|
||||
|
||||
def parse_page_content(page,args={})
|
||||
|
||||
args["category_id"] = args["category_id"].gsub(/\"|\[|\]/,'').split(",").each(&:strip!) if !args["category_id"].blank? and args["category_id"].is_a?(String)
|
||||
args["tag_id"] = args["tag_id"].gsub(/\"|\[|\]/,'').split(",").each(&:strip!) if !args["tag_id"].blank? and args["tag_id"].is_a? String
|
||||
# tag = params[:tag_id].blank? ? page[:tag] : params[:tag_id]
|
||||
# category = params[:category_id].blank? ? page[:category] : params[:category_id]
|
||||
body = Nokogiri::HTML(page.content)
|
||||
|
||||
if @edit
|
||||
body.css('.page_part').each do |page_part|
|
||||
part = PagePart.find(page_part['part_id']) rescue nil
|
||||
@@ -41,7 +41,6 @@ module ParserFrontEnd
|
||||
end
|
||||
|
||||
body.css('orbit_front').each do |front|
|
||||
|
||||
if front['value']
|
||||
fragment = Nokogiri::HTML::DocumentFragment.new(body, "<div id='#{front['id']}' class='#{front['class']}'>#{eval(front['value']).to_s}</div>")
|
||||
else
|
||||
|
||||
-1
@@ -9,7 +9,6 @@ class Panel::Announcement::FrontEnd::BulletinsController < OrbitWidgetController
|
||||
end
|
||||
|
||||
def search_result
|
||||
debugger
|
||||
if params[:search_query] == ""
|
||||
@bulletins = get_bulletins_for_index
|
||||
|
||||
|
||||
+1
-2
@@ -11,7 +11,6 @@ class Panel::WebResource::Widget::WebLinksController < OrbitWidgetController
|
||||
def index
|
||||
|
||||
@part = PagePart.find(params[:part_id])
|
||||
|
||||
if @part.widget_data_count
|
||||
@page_num = @part.widget_data_count
|
||||
else
|
||||
@@ -64,7 +63,7 @@ class Panel::WebResource::Widget::WebLinksController < OrbitWidgetController
|
||||
@web_link_datas << { "title" => wlcg.title, "web_links" => web_link_datas } if !@web_links.blank?
|
||||
|
||||
end
|
||||
|
||||
@more_url = Page.find(@part.more_link_page_id).path
|
||||
end
|
||||
|
||||
def get_categorys
|
||||
|
||||
Vendored
+1
-5
@@ -30,9 +30,5 @@
|
||||
</div>
|
||||
|
||||
<div class="pull_right">
|
||||
<% if !params[:category_id].blank? %>
|
||||
<%= link_to t(:more_plus), panel_web_resource_front_end_web_links_path(:category_id => @part.category) %>
|
||||
<% else %>
|
||||
<%= link_to t(:more_plus), panel_web_resource_front_end_web_links_path %>
|
||||
<% end %>
|
||||
<%= link_to t(:more_plus), "/"+@more_url %>
|
||||
</div>
|
||||
Reference in new issue
Block a user