Revert "more button fix and also new way to select more page."

This reverts commit e129b25554.
This commit is contained in:
saurabhbhatia 2013-11-15 16:58:27 +08:00
parent dc5ef21516
commit ce8e9c0a5f
12 changed files with 14 additions and 50 deletions

View File

@ -12,8 +12,6 @@ class Admin::PagePartsController < OrbitBackendController
@module_app_categories = @module_app.categories @module_app_categories = @module_app.categories
@module_app_tags = @module_app.tags @module_app_tags = @module_app.tags
@widget_paths = ModuleApp.find(@module_app.id).widgets.map{|name, data| [t(data["i18n"]), name]} rescue [] @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.present?
if @part.widget_path.eql?("default_widget") if @part.widget_path.eql?("default_widget")
@checked_style = @part.widget_style @checked_style = @part.widget_style
@ -29,10 +27,7 @@ class Admin::PagePartsController < OrbitBackendController
# @frontend_styles = @module_app.widgets[params[:val]]["style"] rescue nil # @frontend_styles = @module_app.widgets[params[:val]]["style"] rescue nil
@frontend_styles = @module_app.widgets[@part.widget_path]["style"] rescue nil @frontend_styles = @module_app.widgets[@part.widget_path]["style"] rescue nil
@partial = 'custom_widget' if @frontend_styles.present? @partial = 'custom_widget' if @frontend_styles.present?
end end
@partial = 'more_link' unless @partial
end end
@data_count = @module_app.get_registration.get_data_count.to_a rescue [] @data_count = @module_app.get_registration.get_data_count.to_a rescue []
@no_orbit_bar = @side_bar = @no_header = true @no_orbit_bar = @side_bar = @no_header = true
@ -79,7 +74,6 @@ class Admin::PagePartsController < OrbitBackendController
def get_display_style def get_display_style
@part = PagePart.find(params[:id]) rescue nil @part = PagePart.find(params[:id]) rescue nil
@module_app = ModuleApp.find(params[:module_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 @module_app
if params[:val].eql?("default_widget") if params[:val].eql?("default_widget")
@checked_style = @part.widget_path.present? ? @part.widget_style : nil if @part && @part.widget_path.eql?("default_widget") @checked_style = @part.widget_path.present? ? @part.widget_style : nil if @part && @part.widget_path.eql?("default_widget")
@ -94,8 +88,6 @@ class Admin::PagePartsController < OrbitBackendController
@frontend_styles = @module_app.widgets[params[:val]]["style"] rescue nil @frontend_styles = @module_app.widgets[params[:val]]["style"] rescue nil
@partial = 'custom_widget' if @frontend_styles.present? @partial = 'custom_widget' if @frontend_styles.present?
end end
@partial = 'more_link' unless @partial
end end
end end

View File

@ -39,7 +39,6 @@ class DefaultWidgetController< OrbitWidgetController
end end
def default_widget 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? if !params[:id].blank? and !params["clicked_field_name"].blank?
clicked_field_name = params["clicked_field_name"].to_sym clicked_field_name = params["clicked_field_name"].to_sym
@ -92,8 +91,6 @@ class DefaultWidgetController< OrbitWidgetController
@tag_class = 'default_widget_typeC' @tag_class = 'default_widget_typeC'
@partial = "typeC" @partial = "typeC"
end end
@more_url = Page.find(@page_part.more_link).path rescue nil
# debugger
end end
end end

View File

@ -70,6 +70,7 @@ class PagesController < ApplicationController
elsif params[:category_id].is_a? String elsif params[:category_id].is_a? String
options << "#{options.blank? ? '?' : '&'}category_id=#{params[:category_id]}" unless params[:category_id].blank? options << "#{options.blank? ? '?' : '&'}category_id=#{params[:category_id]}" unless params[:category_id].blank?
end end
if params[:tag_id].is_a? Array if params[:tag_id].is_a? Array
options << "#{options.blank? ? '?' : '&'}#{convert_array_param('tag_id',params[:tag_id])}" unless params[:tag_id].blank? options << "#{options.blank? ? '?' : '&'}#{convert_array_param('tag_id',params[:tag_id])}" unless params[:tag_id].blank?
elsif params[:category_id].is_a? String elsif params[:category_id].is_a? String
@ -104,7 +105,6 @@ class PagesController < ApplicationController
protected protected
def get_item def get_item
if params[:page_id] if params[:page_id]
@item = Item.find(params[:page_id]) @item = Item.find(params[:page_id])
elsif params[:same_page_id] elsif params[:same_page_id]

View File

@ -12,7 +12,6 @@ class PagePart
field :widget_path field :widget_path
field :category,type: Array, :default => [] field :category,type: Array, :default => []
field :tag, type: Array,:default => [] field :tag, type: Array,:default => []
field :more_link_page_id
field :widget_style field :widget_style
field :widget_field , :type => Array,:default => [] field :widget_field , :type => Array,:default => []

View File

@ -4,12 +4,6 @@
<%= select 'page_part', 'widget_style', @frontend_styles, {:selected => (@part && @part[:widget_style])}, class: "input-xlarge" %> <%= select 'page_part', 'widget_style', @frontend_styles, {:selected => (@part && @part[:widget_style])}, class: "input-xlarge" %>
</div> </div>
</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"> <div class="control-group input-content">
<% @module_app.widget_options.tap { |widget|%> <% @module_app.widget_options.tap { |widget|%>
@ -25,8 +19,8 @@
<% else%> <% else%>
<div class="controls"> <div class="controls">
<%= select_tag "page_part[widget_options][#{key}]", options_for_select(options,(@part.widget_options[key] rescue nil)), class: "input-xlarge" %> <%= select_tag "page_part[widget_options][#{key}]", options_for_select(options,(@part.widget_options[key] rescue nil)), class: "input-xlarge" %>
</div>
<% end %> <% end %>
</div>
<% end %> <% end %>
<% } %> <% } %>
<% } %> <% } %>

View File

@ -74,12 +74,6 @@
</table> </table>
</div> </div>
</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> <script>
$('.typesetting li').each(function(index, el) { $('.typesetting li').each(function(index, el) {

View File

@ -1,6 +0,0 @@
<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>

View File

@ -4,10 +4,6 @@
<% if @paginate %> <% if @paginate %>
<%= paginate @data, :param_name => :page_main, :params => {:same_page_id => @page_id} %> <%= paginate @data, :param_name => :page_main, :params => {:same_page_id => @page_id} %>
<% elsif @page_part.module_app %> <% 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 %>
<% end %> <% end %>

View File

@ -8,13 +8,13 @@ defaults: &defaults
development: development:
<<: *defaults <<: *defaults
database: orbit_site_new database: test_site
test: test:
<<: *defaults <<: *defaults
database: orbit_site_new database: test_site
# set these environment variables on your prod server # set these environment variables on your prod server
production: production:

View File

@ -12,19 +12,12 @@ module DefaultWidgetTagHelper
if param.is_a?(Array) and !param.blank? if param.is_a?(Array) and !param.blank?
params_str << param.collect{|t| "#{index}[]=#{t}"}.join("&") params_str << param.collect{|t| "#{index}[]=#{t}"}.join("&")
params.delete index params.delete index
params_str = params_str + "&"
end end
end end
params_str = params_str + (params_str.eql?("?") ? params.to_param : "&#{params.to_param}" ) params_str = params_str + (params_str.eql?("?") ? params.to_param : "&#{params.to_param}" )
content_tag :div,:class=> 'more' do content_tag :div,:class=> 'more' do
link_to I18n.t(@more_link[:label_i18n]),[eval("#{@more_link[:path_method]}"),params_str].join() link_to I18n.t(@more_link[:label_i18n]),[eval("#{@more_link[:path_method]}"),params_str].join()
end end
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 end

View File

@ -11,6 +11,7 @@ class Panel::WebResource::Widget::WebLinksController < OrbitWidgetController
def index def index
@part = PagePart.find(params[:part_id]) @part = PagePart.find(params[:part_id])
if @part.widget_data_count if @part.widget_data_count
@page_num = @part.widget_data_count @page_num = @part.widget_data_count
else else
@ -63,7 +64,7 @@ class Panel::WebResource::Widget::WebLinksController < OrbitWidgetController
@web_link_datas << { "title" => wlcg.title, "web_links" => web_link_datas } if !@web_links.blank? @web_link_datas << { "title" => wlcg.title, "web_links" => web_link_datas } if !@web_links.blank?
end end
@more_url = Page.find(@part.more_link_page_id).path
end end
def get_categorys def get_categorys

View File

@ -30,5 +30,9 @@
</div> </div>
<div class="pull_right"> <div class="pull_right">
<%= link_to t(:more_plus), "/"+@more_url %> <% 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 %>
</div> </div>