forked from saurabh/orbit4-5
				
			change in parser and widget rendering completed with also lot of changes in kernel
Conflicts: app/helpers/orbit_helper.rb
This commit is contained in:
		
							parent
							
								
									40a0dbb555
								
							
						
					
					
						commit
						d7107f02f4
					
				| 
						 | 
				
			
			@ -65,10 +65,10 @@ if($.support.touch) {
 | 
			
		|||
        $checked.each(function(i) {
 | 
			
		||||
            if($(this).attr('type') == "checkbox") {
 | 
			
		||||
                if($(this).data().disabled) {
 | 
			
		||||
                    console.log("d")
 | 
			
		||||
                    $(this).parent('.togglebox').addClass('disable').closest('li').addClass('disabled');
 | 
			
		||||
                    if($(this).prop('checked')) {
 | 
			
		||||
                        $(this).parent('.togglebox').removeClass('disable').closest('li').removeClass('disabled');
 | 
			
		||||
                        $(this).val("1");
 | 
			
		||||
                    };
 | 
			
		||||
                } else {
 | 
			
		||||
                    if($(this).prop('checked')) {
 | 
			
		||||
| 
						 | 
				
			
			@ -79,6 +79,12 @@ if($.support.touch) {
 | 
			
		|||
                    change: function() {
 | 
			
		||||
                        $(this).parent('.togglebox').toggleClass('disable');
 | 
			
		||||
                        $(this).closest('tr').toggleClass('disable');
 | 
			
		||||
                        if($(this).is(":checked")){
 | 
			
		||||
                            $(this).val("1");
 | 
			
		||||
                        }else{
 | 
			
		||||
                            $(this).val("0");
 | 
			
		||||
                            $(this).prop("checked","checked");
 | 
			
		||||
                        }
 | 
			
		||||
                    }
 | 
			
		||||
                });
 | 
			
		||||
            };
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -25,8 +25,11 @@
 | 
			
		|||
			$.each(data.parts,function(i,part){
 | 
			
		||||
				var page_part = $("*[" + part.name + "]");
 | 
			
		||||
				$.each(part.subparts,function(x,subpart){
 | 
			
		||||
					 var newsub = $("<div data-ps='" + x + "'>" + subpart.module + "/" + subpart.widget + "</div>");
 | 
			
		||||
					 var newsub = (subpart.kind == "module_widget" ? $("<div data-partid='" + part.id + "' data-ps='" + subpart.id + "'>" + subpart.module + "/" + subpart.widget + "</div>") : $("<div data-partid='" + part.id + "' data-ps='" + subpart.id + "'>Text</div>"));
 | 
			
		||||
					 page_part.prepend(newsub);
 | 
			
		||||
					 newsub.click(function(){
 | 
			
		||||
						window.location.href = "/page_parts/edit_sub_part?page_id=" + page_params["id"] + "&part_id=" + $(this).data("partid") + "&sub_part_id=" + $(this).data("ps");
 | 
			
		||||
					})
 | 
			
		||||
				})
 | 
			
		||||
			})
 | 
			
		||||
		})
 | 
			
		||||
| 
						 | 
				
			
			@ -41,8 +44,7 @@
 | 
			
		|||
					window.location.href = "/page_parts/new?part=" + part.data("pp") + "&page_id=" + page_params["id"];
 | 
			
		||||
				}
 | 
			
		||||
			})
 | 
			
		||||
			$(this).append(add_btn);
 | 
			
		||||
			part.append(add_btn);
 | 
			
		||||
		})
 | 
			
		||||
		
 | 
			
		||||
	})
 | 
			
		||||
})();
 | 
			
		||||
| 
						 | 
				
			
			@ -6,6 +6,7 @@ class Admin::SitesController < OrbitAdminController
 | 
			
		|||
	end
 | 
			
		||||
 | 
			
		||||
	def site_info
 | 
			
		||||
    @pages = Page.where(:module=>"page_content")
 | 
			
		||||
	end
 | 
			
		||||
 | 
			
		||||
	def responsive_setting
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -5,8 +5,9 @@ class PagePartsController < ApplicationController
 | 
			
		|||
    @part.sub_parts.build
 | 
			
		||||
    @part_number = params[:part]
 | 
			
		||||
    @page_id = params[:page_id]
 | 
			
		||||
		@modules = ModuleApp.all
 | 
			
		||||
		@modules = ModuleApp.widget_enabled
 | 
			
		||||
    @no_orbit_bar = @no_side_bar = true
 | 
			
		||||
    @select_number = 0
 | 
			
		||||
    @html_class = "page-parts"
 | 
			
		||||
    render :layout => "structure"
 | 
			
		||||
	end
 | 
			
		||||
| 
						 | 
				
			
			@ -16,16 +17,70 @@ class PagePartsController < ApplicationController
 | 
			
		|||
    @part = page.page_parts.where(:part_id => params[:id]).first
 | 
			
		||||
    @part.sub_parts.build
 | 
			
		||||
    @page_id = params[:page_id]
 | 
			
		||||
    @modules = ModuleApp.all
 | 
			
		||||
    @part_number = params[:id]
 | 
			
		||||
    @select_number = @part.sub_parts.count
 | 
			
		||||
    @modules = ModuleApp.widget_enabled
 | 
			
		||||
    @no_orbit_bar = @no_side_bar = true
 | 
			
		||||
    @html_class = "page-parts"
 | 
			
		||||
    render :layout => "structure"
 | 
			
		||||
  end
 | 
			
		||||
 | 
			
		||||
  def edit_sub_part
 | 
			
		||||
    @part = PagePart.find(params[:part_id])
 | 
			
		||||
    @subpart = SubPart.find(params[:sub_part_id])
 | 
			
		||||
    @select_number = @part.sub_parts.index(@subpart)
 | 
			
		||||
    @kind = @subpart.kind
 | 
			
		||||
    @modules = ModuleApp.widget_enabled
 | 
			
		||||
    if @kind == "module_widget"
 | 
			
		||||
      @widget_types = []
 | 
			
		||||
      module_name = @subpart.module
 | 
			
		||||
      Dir.glob("#{Rails.root}/app/templates/#{@key}/modules/#{module_name.downcase}/*").each do |w|
 | 
			
		||||
        w = File.basename(w, ".*") 
 | 
			
		||||
        w = File.basename(w, ".*")
 | 
			
		||||
        @widget_types << w.gsub("_","") if w != "index" && w != "show"
 | 
			
		||||
      end
 | 
			
		||||
       
 | 
			
		||||
      app = ModuleApp.find_by_key(module_name)
 | 
			
		||||
      @categories = app.categories
 | 
			
		||||
      @widget_methods = app.get_registration.get_widget_methods
 | 
			
		||||
      @widget_settings = app.get_registration.get_widget_settings
 | 
			
		||||
      @data_count = nil
 | 
			
		||||
      if !@widget_settings.blank?
 | 
			
		||||
        @data_count = @widget_settings["data_count"] rescue nil
 | 
			
		||||
        if !@widget_settings['override_category_with'].nil?
 | 
			
		||||
          @custom = @widget_settings['override_category_with'].classify.constantize.all
 | 
			
		||||
          @multiselect = @widget_settings['multiselect'] rescue true
 | 
			
		||||
          @display_field = @widget_settings['display_field']
 | 
			
		||||
        end
 | 
			
		||||
      end
 | 
			
		||||
    end
 | 
			
		||||
    @no_orbit_bar = @no_side_bar = true
 | 
			
		||||
    @html_class = "page-parts"
 | 
			
		||||
    render :layout => "structure"
 | 
			
		||||
  end
 | 
			
		||||
 | 
			
		||||
  def update_sub_part
 | 
			
		||||
    subpart = SubPart.find(params[:id])
 | 
			
		||||
    p = part_params["sub_parts_attributes"]
 | 
			
		||||
    keys = p.keys
 | 
			
		||||
    final_params = {}
 | 
			
		||||
    keys.each do |key|
 | 
			
		||||
      p["#{key}"].each do |k,value|
 | 
			
		||||
        final_params["#{k}"] = value
 | 
			
		||||
      end
 | 
			
		||||
    end
 | 
			
		||||
    if final_params["kind"] == "none"
 | 
			
		||||
      subpart.destroy
 | 
			
		||||
    else
 | 
			
		||||
      subpart.update_attributes(final_params)
 | 
			
		||||
    end
 | 
			
		||||
    render :json => {"success"=>true}.to_json
 | 
			
		||||
  end
 | 
			
		||||
 | 
			
		||||
  def getwidgets
 | 
			
		||||
    module_name = params[:module]
 | 
			
		||||
  
 | 
			
		||||
    @select_number = params[:number_of_select]
 | 
			
		||||
    part = PagePart.where(:part_id => params[:part_id], :page_id => params[:page_id]).first
 | 
			
		||||
    @select_number = part.sub_parts.count rescue 0
 | 
			
		||||
    @widget_types = []
 | 
			
		||||
    Dir.glob("#{Rails.root}/app/templates/#{@key}/modules/#{module_name.downcase}/*").each do |w|
 | 
			
		||||
      w = File.basename(w, ".*") 
 | 
			
		||||
| 
						 | 
				
			
			@ -34,7 +89,18 @@ class PagePartsController < ApplicationController
 | 
			
		|||
    end
 | 
			
		||||
      module_name = module_name.downcase.singularize
 | 
			
		||||
    app = ModuleApp.find_by_key(module_name)
 | 
			
		||||
    @categories = app.categories
 | 
			
		||||
    @widget_methods = app.get_registration.get_widget_methods
 | 
			
		||||
    @widget_settings = app.get_registration.get_widget_settings
 | 
			
		||||
    @data_count = nil
 | 
			
		||||
    if !@widget_settings.blank?
 | 
			
		||||
      @data_count = @widget_settings["data_count"] rescue nil
 | 
			
		||||
      if !@widget_settings['override_category_with'].nil?
 | 
			
		||||
        @custom = @widget_settings['override_category_with'].classify.constantize.all
 | 
			
		||||
        @multiselect = @widget_settings['multiselect'] rescue true
 | 
			
		||||
        @display_field = @widget_settings['display_field']
 | 
			
		||||
      end
 | 
			
		||||
    end
 | 
			
		||||
    render :layout => false
 | 
			
		||||
  end
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			@ -47,9 +113,9 @@ class PagePartsController < ApplicationController
 | 
			
		|||
      subparts = part.sub_parts
 | 
			
		||||
      subpart = []
 | 
			
		||||
      subparts.each do |p|
 | 
			
		||||
        subpart << {"module" => p.module, "widget" => p.widget_type}
 | 
			
		||||
        subpart << {"module" => p.module, "widget" => p.widget_type, "id" => p.id.to_s, "kind" => p.kind}
 | 
			
		||||
      end
 | 
			
		||||
      data << {"name" => partid, "subparts" => subpart}
 | 
			
		||||
      data << {"name" => partid, "subparts" => subpart, "id" => part.id.to_s}
 | 
			
		||||
    end
 | 
			
		||||
    render :json => {"parts" => data}.to_json
 | 
			
		||||
  end
 | 
			
		||||
| 
						 | 
				
			
			@ -57,20 +123,20 @@ class PagePartsController < ApplicationController
 | 
			
		|||
  def create
 | 
			
		||||
    @part = PagePart.new(part_params)
 | 
			
		||||
    @part.save!
 | 
			
		||||
    redirect_to pages_edit_view_path(:id => params[:page_part][:page_id])
 | 
			
		||||
    render :json => {"success"=>true}.to_json
 | 
			
		||||
 | 
			
		||||
  end
 | 
			
		||||
 | 
			
		||||
  def update
 | 
			
		||||
    @part = PagePart.find(params[:page_part][:page_part_id])
 | 
			
		||||
    @part = PagePart.find(params[:part_id])
 | 
			
		||||
    @part.update_attributes(part_params)
 | 
			
		||||
    redirect_to pages_edit_view_path(:id => params[:page_part][:page_id])
 | 
			
		||||
 | 
			
		||||
    render :json => {"success"=>true}.to_json
 | 
			
		||||
  end
 | 
			
		||||
 | 
			
		||||
  private
 | 
			
		||||
 | 
			
		||||
  def part_params
 | 
			
		||||
    params.require(:page_part).permit(:part_id, :page_id, sub_parts_attributes: [:module, :widget_type,:widget_method, :id])
 | 
			
		||||
    params.require(:page_part).permit!
 | 
			
		||||
  end
 | 
			
		||||
 | 
			
		||||
end
 | 
			
		||||
| 
						 | 
				
			
			@ -17,7 +17,10 @@ class PagesController < ApplicationController
 | 
			
		|||
    @dataApi = "edit"
 | 
			
		||||
   
 | 
			
		||||
    # @qq = render_to_string(:partial => @p, :layout => false)
 | 
			
		||||
    render get_view
 | 
			
		||||
    view = get_view
 | 
			
		||||
    if File.exists?(view)
 | 
			
		||||
      render view
 | 
			
		||||
    end
 | 
			
		||||
  end
 | 
			
		||||
 | 
			
		||||
  def home
 | 
			
		||||
| 
						 | 
				
			
			@ -69,7 +72,6 @@ class PagesController < ApplicationController
 | 
			
		|||
          end
 | 
			
		||||
 | 
			
		||||
          impressionist(page)
 | 
			
		||||
          # render render_final_page("#{module_app}/#{params[:target_action]}",page)
 | 
			
		||||
          render :html => render_final_page("#{module_app}/#{params[:target_action]}",page,layout).html_safe
 | 
			
		||||
        else
 | 
			
		||||
          render :file => "#{Rails.root}/public/404.html", :layout => false, :status => :not_found
 | 
			
		||||
| 
						 | 
				
			
			@ -176,11 +178,21 @@ class PagesController < ApplicationController
 | 
			
		|||
        subparts = part.sub_parts
 | 
			
		||||
        partials = []
 | 
			
		||||
        subparts.each do |subpart|
 | 
			
		||||
          if subpart.kind == "module_widget"
 | 
			
		||||
            OrbitHelper.set_widget_data_count subpart.data_count
 | 
			
		||||
            OrbitHelper.set_widget_categories subpart.categories
 | 
			
		||||
            OrbitHelper.set_widget_module_app subpart.module
 | 
			
		||||
            custom_value = subpart.custom_string_field || subpart.custom_array_field rescue nil
 | 
			
		||||
            if !custom_value.nil?
 | 
			
		||||
               OrbitHelper.set_widget_custom_value custom_value
 | 
			
		||||
             end
 | 
			
		||||
            partials << render_widget_for_frontend(subpart.module,subpart.widget_method,subpart.widget_type)
 | 
			
		||||
          elsif subpart.kind == "text"
 | 
			
		||||
            partials << subpart.content
 | 
			
		||||
          end
 | 
			
		||||
        end
 | 
			
		||||
        @part_partials["data-pp='#{part.part_id}'"] = partials
 | 
			
		||||
      end
 | 
			
		||||
 | 
			
		||||
      @file = nil
 | 
			
		||||
      @layout_html = nil
 | 
			
		||||
      if original_view == "home"
 | 
			
		||||
| 
						 | 
				
			
			@ -210,14 +222,6 @@ class PagesController < ApplicationController
 | 
			
		|||
    else
 | 
			
		||||
        render_to_string(original_view)
 | 
			
		||||
    end
 | 
			
		||||
    # newlayout = "#{page.name}_layout.html.erb"
 | 
			
		||||
    # file_path = File.join(Rails.root, 'app', 'views', 'frontend', newlayout)
 | 
			
		||||
 | 
			
		||||
    # f = File.open(file_path,"w")
 | 
			
		||||
    # f.write(doc.to_html)
 | 
			
		||||
    # f.close
 | 
			
		||||
    # view_to_render = "frontend/#{newlayout}"
 | 
			
		||||
    # view_to_render
 | 
			
		||||
  end
 | 
			
		||||
 | 
			
		||||
  def get_widget_path(widget)
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -0,0 +1,18 @@
 | 
			
		|||
class SitemapsController < ApplicationController
 | 
			
		||||
	def index
 | 
			
		||||
		pages = Page.root.child_pages_enabled_for_sitemap
 | 
			
		||||
		def create_json(pages)
 | 
			
		||||
			item = {}
 | 
			
		||||
			pages.each do |page|
 | 
			
		||||
				if page.child_page.size > 0
 | 
			
		||||
					item["#{page.name}"] = {"url"=> "/#{locale.to_s}" + page.url, "children"=>create_json(page.sorted_published_child_pages)}
 | 
			
		||||
				else
 | 
			
		||||
					item["#{page.name}"] = {"url"=> "/#{locale.to_s}" + page.url}
 | 
			
		||||
				end
 | 
			
		||||
			end
 | 
			
		||||
			item
 | 
			
		||||
		end
 | 
			
		||||
		items = create_json(pages)
 | 
			
		||||
		items
 | 
			
		||||
	end
 | 
			
		||||
end
 | 
			
		||||
| 
						 | 
				
			
			@ -16,10 +16,42 @@ module ApplicationHelper
 | 
			
		|||
		"/module/#{module_name}/show"
 | 
			
		||||
	end
 | 
			
		||||
 | 
			
		||||
	def render_header
 | 
			
		||||
		site = Site.first
 | 
			
		||||
		key = Template::KEY
 | 
			
		||||
		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")
 | 
			
		||||
		sub_menu_html = site.sub_menu
 | 
			
		||||
		html = header.to_s
 | 
			
		||||
		html = html.gsub("{{site_name}}",site.title)
 | 
			
		||||
		html = html.gsub("%7B%7Blogo_url%7D%7D",(site.default_image.file.url rescue "http://placehold.it/50x50"))
 | 
			
		||||
		if site.sitemap_menu_in_header
 | 
			
		||||
			sub_menu_html = sub_menu_html + "<a href='/#{I18n.locale.to_s}#{site.site_map_link}'>Sitemap</a>"
 | 
			
		||||
		end
 | 
			
		||||
		html = html.gsub("{{header-data}}",sub_menu_html)
 | 
			
		||||
		html.html_safe
 | 
			
		||||
	end
 | 
			
		||||
 | 
			
		||||
	def render_footer
 | 
			
		||||
		site = Site.first
 | 
			
		||||
		key = Template::KEY
 | 
			
		||||
		footer_file = File.join('../templates', "#{key}", '/home/footer.html.erb')
 | 
			
		||||
		footer_file_html = render :file => footer_file
 | 
			
		||||
		footer = Nokogiri::HTML(footer_file_html, nil, "UTF-8")
 | 
			
		||||
		html = footer.to_s
 | 
			
		||||
		site_footer = site.footer
 | 
			
		||||
		if site.enable_terms_of_use
 | 
			
		||||
			site_footer = site_footer + "<a href='/#{I18n.locale.to_s}#{site.terms_of_use_link}'>Terms of use</a>"
 | 
			
		||||
		end
 | 
			
		||||
		html = html.gsub("{{footer-data}}",site_footer)
 | 
			
		||||
		html.html_safe
 | 
			
		||||
	end
 | 
			
		||||
 | 
			
		||||
	def render_menu
 | 
			
		||||
		# json_file = File.read(File.join(Rails.root, 'public', "menu.json"))
 | 
			
		||||
		# @items = JSON.parse(json_file)
 | 
			
		||||
		@pages = Page.where(:parent_page_id.ne => "" , :parent_page_id.exists => false).first.sorted_published_child_pages
 | 
			
		||||
		@pages = Page.root.sorted_published_child_pages
 | 
			
		||||
 | 
			
		||||
		def create_json(pages)
 | 
			
		||||
			item = {}
 | 
			
		||||
| 
						 | 
				
			
			@ -104,8 +136,8 @@ module ApplicationHelper
 | 
			
		|||
						item.each do |key,value|
 | 
			
		||||
							if !value.kind_of?(Array)
 | 
			
		||||
								value = value.nil? ? "" : value
 | 
			
		||||
                  element = element.gsub("{{#{key}}}",value)
 | 
			
		||||
                  element = element.gsub("%7B%7B#{key}%7D%7D",value)
 | 
			
		||||
								element = element.gsub("{{#{key}}}",value.to_s)
 | 
			
		||||
								element = element.gsub("%7B%7B#{key}%7D%7D",value.to_s)
 | 
			
		||||
							end
 | 
			
		||||
						end
 | 
			
		||||
						html_to_render = html_to_render + element
 | 
			
		||||
| 
						 | 
				
			
			@ -137,8 +169,8 @@ module ApplicationHelper
 | 
			
		|||
			if keys[1]
 | 
			
		||||
				(data[keys[1]].kind_of?(Array) ?  data[keys[0]] : data[keys[1]]).each do |key,value|
 | 
			
		||||
					value = value.nil? ? "" : value
 | 
			
		||||
	        html = html.gsub("{{#{key}}}",value)
 | 
			
		||||
	        html = html.gsub("%7B%7B#{key}%7D%7D",value)
 | 
			
		||||
					html = html.gsub("{{#{key}}}",value.to_s)
 | 
			
		||||
					html = html.gsub("%7B%7B#{key}%7D%7D",value.to_s)
 | 
			
		||||
				end
 | 
			
		||||
			end
 | 
			
		||||
			html.html_safe
 | 
			
		||||
| 
						 | 
				
			
			@ -148,6 +180,7 @@ module ApplicationHelper
 | 
			
		|||
			file.close
 | 
			
		||||
			controller = "#{params[:target_controller].capitalize}_controller".classify.constantize.new
 | 
			
		||||
			data = controller.send("#{params[:target_action]}")
 | 
			
		||||
 | 
			
		||||
			if data.blank? || data.empty?
 | 
			
		||||
				file =  File.open("#{Rails.root}/public/404.html")
 | 
			
		||||
				doc = Nokogiri::HTML(file, nil, "UTF-8")
 | 
			
		||||
| 
						 | 
				
			
			@ -170,13 +203,12 @@ module ApplicationHelper
 | 
			
		|||
				wrap_elements = doc.css("*[data-list][data-level='0']")
 | 
			
		||||
				if wrap_elements.count == 0
 | 
			
		||||
					wrap_element_html = doc.to_s
 | 
			
		||||
 | 
			
		||||
					el = wrap_element_html
 | 
			
		||||
					data.each do |key,value|
 | 
			
		||||
			  			next if key.eql? 'impressionist'
 | 
			
		||||
						value = value.nil? ? "" : value
 | 
			
		||||
						el = el.gsub("{{#{key}}}",value)
 | 
			
		||||
						el = el.gsub("%7B%7B#{key}%7D%7D",value)
 | 
			
		||||
						el = el.gsub("{{#{key}}}",value.to_s)
 | 
			
		||||
						el = el.gsub("%7B%7B#{key}%7D%7D",value.to_s)
 | 
			
		||||
					end
 | 
			
		||||
					el.html_safe
 | 
			
		||||
				else
 | 
			
		||||
| 
						 | 
				
			
			@ -194,15 +226,14 @@ module ApplicationHelper
 | 
			
		|||
						data["#{not_array_key}"].each do |key,value|
 | 
			
		||||
							next if key.eql? 'impressionist'
 | 
			
		||||
							value = value.nil? ? "" : value
 | 
			
		||||
				        html = html.gsub("{{#{key}}}",value)
 | 
			
		||||
				        html = html.gsub("%7B%7B#{key}%7D%7D",value)
 | 
			
		||||
							html = html.gsub("{{#{key}}}",value.to_s)
 | 
			
		||||
							html = html.gsub("%7B%7B#{key}%7D%7D",value.to_s)
 | 
			
		||||
						end
 | 
			
		||||
					end
 | 
			
		||||
					html.html_safe
 | 
			
		||||
				end
 | 
			
		||||
			end
 | 
			
		||||
		end
 | 
			
		||||
 | 
			
		||||
	end
 | 
			
		||||
 | 
			
		||||
	def action_data
 | 
			
		||||
| 
						 | 
				
			
			@ -249,4 +280,26 @@ module ApplicationHelper
 | 
			
		|||
    	image_tag(user.avatar.thumb.url)
 | 
			
		||||
  	end
 | 
			
		||||
 | 
			
		||||
  	def render_sitemap
 | 
			
		||||
  		items = action_data
 | 
			
		||||
  		def node(items)
 | 
			
		||||
  			html = "<ul>"
 | 
			
		||||
  			items.each do |key,item|
 | 
			
		||||
  				if item["children"] && !item["children"].empty?
 | 
			
		||||
  					url = item["url"]
 | 
			
		||||
  					html = html + "<li><a href='#{url}'>#{key}</a>"
 | 
			
		||||
  					html = html + node(item["children"])
 | 
			
		||||
  					html = html + "</li>"
 | 
			
		||||
  				else
 | 
			
		||||
  					url = item["url"]
 | 
			
		||||
  					html = html + "<li><a href='#{url}'>#{key}</a></li>"
 | 
			
		||||
  				end
 | 
			
		||||
  			end
 | 
			
		||||
  			html = html + "</ul>"
 | 
			
		||||
  			html
 | 
			
		||||
  		end
 | 
			
		||||
  		html = node(items)
 | 
			
		||||
  		html.html_safe
 | 
			
		||||
  	end
 | 
			
		||||
 | 
			
		||||
end
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -22,10 +22,27 @@ module OrbitHelper
 | 
			
		|||
  def self.this_module_app
 | 
			
		||||
   @module_app
 | 
			
		||||
  end
 | 
			
		||||
 | 
			
		||||
  def self.widget_module_app
 | 
			
		||||
    @widget_module_app
 | 
			
		||||
  end
 | 
			
		||||
 | 
			
		||||
  def self.set_this_module_app(module_app)
 | 
			
		||||
   @module_app = ModuleApp.where(:key=>module_app).first
 | 
			
		||||
  end
 | 
			
		||||
 | 
			
		||||
  def self.set_widget_custom_value(value)
 | 
			
		||||
    @widget_custom_value = value
 | 
			
		||||
  end
 | 
			
		||||
 | 
			
		||||
  def self.widget_custom_value
 | 
			
		||||
    @widget_custom_value
 | 
			
		||||
  end
 | 
			
		||||
 | 
			
		||||
  def self.set_widget_module_app(module_app)
 | 
			
		||||
   @widget_module_app = ModuleApp.where(:key=>module_app).first 
 | 
			
		||||
  end
 | 
			
		||||
 | 
			
		||||
  def self.params
 | 
			
		||||
    @params
 | 
			
		||||
  end
 | 
			
		||||
| 
						 | 
				
			
			@ -47,6 +64,22 @@ module OrbitHelper
 | 
			
		|||
    @site_locale = locale
 | 
			
		||||
  end
 | 
			
		||||
 | 
			
		||||
  def self.set_widget_data_count(data_count)
 | 
			
		||||
    @widget_data_count = data_count
 | 
			
		||||
  end
 | 
			
		||||
 | 
			
		||||
  def self.widget_data_count
 | 
			
		||||
    @widget_data_count
 | 
			
		||||
  end
 | 
			
		||||
 | 
			
		||||
  def self.set_widget_categories(categories)
 | 
			
		||||
    @widget_categories = categories
 | 
			
		||||
  end
 | 
			
		||||
 | 
			
		||||
  def self.widget_categories
 | 
			
		||||
    @widget_categories
 | 
			
		||||
  end
 | 
			
		||||
 | 
			
		||||
  def self.get_site_locale
 | 
			
		||||
    @site_locale
 | 
			
		||||
  end
 | 
			
		||||
| 
						 | 
				
			
			@ -62,6 +95,9 @@ module OrbitHelper
 | 
			
		|||
  def get_item_module_infos(page)
 | 
			
		||||
    if page.parent_page_id.nil?
 | 
			
		||||
      ["Home","icons-house"]
 | 
			
		||||
    elsif page.module == "sitemap"
 | 
			
		||||
       module_app = ModuleApp.find_by_key("page_content")
 | 
			
		||||
       [module_app.title, module_app.get_registration.icon_class]
 | 
			
		||||
    else
 | 
			
		||||
      module_app = ModuleApp.where(:key => page.module).first
 | 
			
		||||
      unless module_app.nil?
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -12,6 +12,39 @@ module PagesHelper
 | 
			
		|||
  end
 | 
			
		||||
 | 
			
		||||
  def render_widget_for_frontend(controller_name, widget_method, widget_file)
 | 
			
		||||
    def parsing_repeats_again(elements,d,level)
 | 
			
		||||
        newhtml = []
 | 
			
		||||
        oldhtml = []
 | 
			
		||||
        elements.each do |el|
 | 
			
		||||
          html_to_render = ""
 | 
			
		||||
          data_name = el.attr("data-list")
 | 
			
		||||
          wrap_elements = el.css("*[data-list][data-level='#{level}']")
 | 
			
		||||
          if d["#{data_name}"]
 | 
			
		||||
            d["#{data_name}"].each_with_index do |item,i|
 | 
			
		||||
              element = el.inner_html
 | 
			
		||||
              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])      
 | 
			
		||||
                end
 | 
			
		||||
              end
 | 
			
		||||
              item.each do |key,value|
 | 
			
		||||
                if !value.kind_of?(Array)
 | 
			
		||||
                  value = value.nil? ? "" : value
 | 
			
		||||
                  element = element.gsub("{{#{key}}}",value.to_s)
 | 
			
		||||
                  element = element.gsub("%7B%7B#{key}%7D%7D",value.to_s)
 | 
			
		||||
                end
 | 
			
		||||
              end
 | 
			
		||||
              html_to_render = html_to_render + element
 | 
			
		||||
            end
 | 
			
		||||
            temp = el.to_s
 | 
			
		||||
            oldhtml << temp
 | 
			
		||||
            temp = temp.gsub(el.inner_html, html_to_render)
 | 
			
		||||
            newhtml << temp
 | 
			
		||||
          end
 | 
			
		||||
        end
 | 
			
		||||
        [oldhtml,newhtml]
 | 
			
		||||
      end
 | 
			
		||||
    controller_name = controller_name.downcase.singularize
 | 
			
		||||
    f = File.join('../templates', current_site.template, 'modules', "#{controller_name}", "_#{widget_file}.html.erb");
 | 
			
		||||
    s = render_to_string(f)
 | 
			
		||||
| 
						 | 
				
			
			@ -21,24 +54,16 @@ module PagesHelper
 | 
			
		|||
    OrbitHelper.set_current_widget_module controller_name
 | 
			
		||||
    data = controller.send("#{widget_method}")
 | 
			
		||||
    keys = data.keys
 | 
			
		||||
    wrap_elements.each do |wrap_element|
 | 
			
		||||
      html_to_render = ""
 | 
			
		||||
      (data[keys[0]].kind_of?(Array) ? data[keys[0]] : data[keys[1]]).each do |item|
 | 
			
		||||
        el = wrap_element.inner_html
 | 
			
		||||
        item.each do |key,value|
 | 
			
		||||
          value = value.nil? ? "" : value
 | 
			
		||||
          el = el.gsub("{{#{key}}}",value.to_s)
 | 
			
		||||
          el = el.gsub("%7B%7B#{key}%7D%7D",value.to_s)
 | 
			
		||||
    wrap_elements = doc.css("*[data-list][data-level='0']")
 | 
			
		||||
    htmls = parsing_repeats_again(wrap_elements,data,1)
 | 
			
		||||
    html = doc.to_s
 | 
			
		||||
    htmls[0].each_with_index do |h,i|
 | 
			
		||||
      html = html.gsub(h,htmls[1][i])
 | 
			
		||||
    end
 | 
			
		||||
        html_to_render = html_to_render + el
 | 
			
		||||
      end
 | 
			
		||||
      wrap_element.inner_html = html_to_render
 | 
			
		||||
    end
 | 
			
		||||
    html = doc.to_html
 | 
			
		||||
    if keys[1]
 | 
			
		||||
      (data[keys[1]].kind_of?(Array) ?  data[keys[0]] : data[keys[1]]).each do |key,value|
 | 
			
		||||
        html = html.gsub("{{#{key}}}",value)
 | 
			
		||||
        html = html.gsub("%7B%7B#{key}%7D%7D",value)
 | 
			
		||||
        html = html.gsub("{{#{key}}}",value.to_s)
 | 
			
		||||
        html = html.gsub("%7B%7B#{key}%7D%7D",value.to_s)
 | 
			
		||||
      end
 | 
			
		||||
    end
 | 
			
		||||
    html.html_safe
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -10,12 +10,14 @@ class ModuleApp
 | 
			
		|||
  field :frontend_enable, type: Boolean, default: false
 | 
			
		||||
  field :sidebar_order,type: Integer,default: 0
 | 
			
		||||
  field :authorizable_models, type: Array
 | 
			
		||||
  field :widget_enable, type: Boolean, default: false
 | 
			
		||||
  
 | 
			
		||||
  has_many :categories, dependent: :destroy, :autosave => true
 | 
			
		||||
  has_and_belongs_to_many :tags, dependent: :destroy, :autosave => true
 | 
			
		||||
  has_many :authorizations
 | 
			
		||||
 | 
			
		||||
  scope :frontend_enabled, ->{ where(:frontend_enable => true)}
 | 
			
		||||
  scope :widget_enabled, ->{ where(:widget_enable => true)}
 | 
			
		||||
 | 
			
		||||
  def refetch_setting!(reg)
 | 
			
		||||
    self[:taggable] = reg.is_taggable
 | 
			
		||||
| 
						 | 
				
			
			@ -23,6 +25,7 @@ class ModuleApp
 | 
			
		|||
    self[:authorizable] = reg.is_authorizable
 | 
			
		||||
    self[:authorizable_models] = reg.get_authorizable_models
 | 
			
		||||
    self[:frontend_enable] = reg.is_frontend_enabled
 | 
			
		||||
    self[:widget_enable] = reg.is_widget_enabled
 | 
			
		||||
  end
 | 
			
		||||
 | 
			
		||||
  def get_registration
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -41,6 +41,10 @@ class Page
 | 
			
		|||
		self.child_page.where(:menu_enabled_for => I18n.locale).asc(:number)
 | 
			
		||||
	end
 | 
			
		||||
 | 
			
		||||
	def child_pages_enabled_for_sitemap
 | 
			
		||||
	 	self.child_page.where(:enabled_for_sitemap => I18n.locale)
 | 
			
		||||
	end
 | 
			
		||||
 | 
			
		||||
	def published_child_pages
 | 
			
		||||
	    self.child_page.where(:menu_enabled_for => I18n.locale)
 | 
			
		||||
	end
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -8,7 +8,8 @@ class Site
 | 
			
		|||
  field :address, type: String
 | 
			
		||||
  field :footer, localize: true
 | 
			
		||||
  field :sub_menu, localize: true
 | 
			
		||||
  field :terms_of_use, localize: true
 | 
			
		||||
  field :site_map_link, type: String, :default => "/sitemap"
 | 
			
		||||
  field :terms_of_use_link, type: String
 | 
			
		||||
  field :google_analytics, type: String
 | 
			
		||||
  field :in_use_locales, :type => Array
 | 
			
		||||
  field :valid_locales, :type => Array
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -3,10 +3,15 @@ class SubPart
 | 
			
		|||
  include Mongoid::Timestamps
 | 
			
		||||
 | 
			
		||||
	field :module
 | 
			
		||||
	field :title, localize: true
 | 
			
		||||
	field :widget_type
 | 
			
		||||
	field :widget_method
 | 
			
		||||
	field :kind, default: "none"
 | 
			
		||||
 | 
			
		||||
	field :content, localize: true
 | 
			
		||||
	field :data_count, type: Integer, default: 10
 | 
			
		||||
	field :categories, type: Array, :default => []
 | 
			
		||||
	field :custom_string_field, type: String
 | 
			
		||||
	field :custom_array_field, type: Array, :default => []
 | 
			
		||||
 | 
			
		||||
  belongs_to :page_part
 | 
			
		||||
end
 | 
			
		||||
| 
						 | 
				
			
			@ -0,0 +1,7 @@
 | 
			
		|||
<footer class="footer">
 | 
			
		||||
  <div class="container footer-inner">
 | 
			
		||||
    <div>
 | 
			
		||||
     {{footer-data}}
 | 
			
		||||
    </div>
 | 
			
		||||
  </div>
 | 
			
		||||
</footer>
 | 
			
		||||
| 
						 | 
				
			
			@ -3,14 +3,13 @@
 | 
			
		|||
    <div class="header-title pull-left">
 | 
			
		||||
      <h1>
 | 
			
		||||
        <a href="/">
 | 
			
		||||
          <img src="http://placehold.it/150x60">
 | 
			
		||||
          <img src="{{logo_url}}">
 | 
			
		||||
          <span>{{site_name}}</span>
 | 
			
		||||
        </a>
 | 
			
		||||
      </h1>
 | 
			
		||||
    </div>
 | 
			
		||||
    <div class="header-nav pull-right" >
 | 
			
		||||
        <a href="#">Sitemap</a>
 | 
			
		||||
        <a href="#">Contact</a>
 | 
			
		||||
      {{header-data}}
 | 
			
		||||
    </div>
 | 
			
		||||
  </div>
 | 
			
		||||
  <%= render_partial("menu") %>
 | 
			
		||||
| 
						 | 
				
			
			@ -5,10 +5,10 @@
 | 
			
		|||
</head>
 | 
			
		||||
<body>
 | 
			
		||||
  <div class="warp container">
 | 
			
		||||
    <%= render_partial("header") %>
 | 
			
		||||
   <%= render_header %>
 | 
			
		||||
    <!-- Site Banner -->
 | 
			
		||||
    <section class="main-slide" data-banner="true">
 | 
			
		||||
      <%= render_widget "ad_banner/widget" %>
 | 
			
		||||
    <section class="main-slide" data-pp="4">
 | 
			
		||||
      <%#= render_widget "ad_banner/widget" %>
 | 
			
		||||
    </section><!-- Site Banner end -->
 | 
			
		||||
 | 
			
		||||
    <div class="warp-inner">
 | 
			
		||||
| 
						 | 
				
			
			@ -29,7 +29,7 @@
 | 
			
		|||
        </aside>
 | 
			
		||||
      </div>
 | 
			
		||||
    </div>
 | 
			
		||||
    <%= render_partial("footer") %>
 | 
			
		||||
    <%= render_footer %>
 | 
			
		||||
  </div>
 | 
			
		||||
</body>
 | 
			
		||||
</html>
 | 
			
		||||
| 
						 | 
				
			
			@ -1,6 +1,6 @@
 | 
			
		|||
<ul class="nav navbar-nav" data-menu-level="0">
 | 
			
		||||
  <li class="dropdown">
 | 
			
		||||
    <a href="#" class="dropdown-toggle" data-toggle="dropdown" data-menu-link="true">{{link_name}}</a>
 | 
			
		||||
    <a href="#" class="dropdown-toggle" data-menu-link="true">{{link_name}}</a>
 | 
			
		||||
    <ul class="dropdown-menu" data-menu-level="1">
 | 
			
		||||
      <li>
 | 
			
		||||
        <a href="index.html" data-menu-link="true">{{link_name}}</a>
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -5,10 +5,10 @@
 | 
			
		|||
</head>
 | 
			
		||||
<body>
 | 
			
		||||
  <div class="warp container">
 | 
			
		||||
    <%= render_partial("header") %>
 | 
			
		||||
   <%= render_header %>
 | 
			
		||||
    <!-- Site Banner -->
 | 
			
		||||
    <section class="main-slide" data-banner="true">
 | 
			
		||||
      <%= render_widget "ad_banner/widget" %>
 | 
			
		||||
    <section class="main-slide" data-pp="4">
 | 
			
		||||
      <%#= render_widget "ad_banner/widget" %>
 | 
			
		||||
    </section><!-- Site Banner end -->
 | 
			
		||||
 | 
			
		||||
    <div class="warp-inner">
 | 
			
		||||
| 
						 | 
				
			
			@ -29,7 +29,7 @@
 | 
			
		|||
        </aside>
 | 
			
		||||
      </div>
 | 
			
		||||
    </div>
 | 
			
		||||
    <%= render_partial("footer") %>
 | 
			
		||||
    <%= render_footer %>
 | 
			
		||||
  </div>
 | 
			
		||||
</body>
 | 
			
		||||
</html>
 | 
			
		||||
| 
						 | 
				
			
			@ -1,43 +1,6 @@
 | 
			
		|||
<!-- <div class="widget" module="banner">
 | 
			
		||||
  <div class="cycle-slideshow" data-cycle-fx="scrollHorz">
 | 
			
		||||
    <img src="http://placehold.it/768x320" alt="">
 | 
			
		||||
    <img src="http://placehold.it/768x320" alt="">
 | 
			
		||||
    <img src="http://placehold.it/768x320" alt="">
 | 
			
		||||
  </div>
 | 
			
		||||
</div> -->
 | 
			
		||||
<div id="carousel-example-captions" class="carousel slide" data-ride="carousel">
 | 
			
		||||
  <ol class="carousel-indicators">
 | 
			
		||||
    <li data-target="#carousel-example-captions" data-slide-to="0" class="active"></li>
 | 
			
		||||
    <li data-target="#carousel-example-captions" data-slide-to="1" class=""></li>
 | 
			
		||||
    <li data-target="#carousel-example-captions" data-slide-to="2" class=""></li>
 | 
			
		||||
  </ol>
 | 
			
		||||
  <div class="carousel-inner">
 | 
			
		||||
    <div class="item active">
 | 
			
		||||
      <img src="http://placehold.it/768x320" alt="">
 | 
			
		||||
      <div class="carousel-caption">
 | 
			
		||||
        <h3>First slide label</h3>
 | 
			
		||||
        <p>Nulla vitae elit libero, a pharetra augue mollis interdum.</p>
 | 
			
		||||
<div class="slide" >
 | 
			
		||||
  <div class="cycle-slideshow carousel-inner" data-list="images" data-level="0">
 | 
			
		||||
  {{caption}}
 | 
			
		||||
    <img class="{{class}} click-img" src="{{image_link}}" alt="" style="height:{{height}}px;" data-link="{{link}}" data-cycle-title="{{title}}" data-cycle-desc="{{context}}">
 | 
			
		||||
  </div>
 | 
			
		||||
</div>
 | 
			
		||||
    <div class="item">
 | 
			
		||||
      <img src="http://placehold.it/768x320" alt="">
 | 
			
		||||
      <div class="carousel-caption">
 | 
			
		||||
        <h3>Second slide label</h3>
 | 
			
		||||
        <p>Lorem ipsum dolor sit amet, consectetur adipiscing elit.</p>
 | 
			
		||||
      </div>
 | 
			
		||||
    </div>
 | 
			
		||||
    <div class="item">
 | 
			
		||||
      <img src="http://placehold.it/768x320" alt="">
 | 
			
		||||
      <div class="carousel-caption">
 | 
			
		||||
        <h3>Third slide label</h3>
 | 
			
		||||
        <p>Praesent commodo cursus magna, vel scelerisque nisl consectetur.</p>
 | 
			
		||||
      </div>
 | 
			
		||||
    </div>
 | 
			
		||||
  </div>
 | 
			
		||||
  <a class="left carousel-control" href="#carousel-example-captions" data-slide="prev">
 | 
			
		||||
    <span class="glyphicon glyphicon-chevron-left"></span>
 | 
			
		||||
  </a>
 | 
			
		||||
  <a class="right carousel-control" href="#carousel-example-captions" data-slide="next">
 | 
			
		||||
    <span class="glyphicon glyphicon-chevron-right"></span>
 | 
			
		||||
  </a>
 | 
			
		||||
</div>
 | 
			
		||||
| 
						 | 
				
			
			@ -1,15 +1,15 @@
 | 
			
		|||
<div class="widget-1 row" module="announcement" data-repeat="3" data-module="announcement" data-ps="">
 | 
			
		||||
<div class="widget-1 row" module="announcement" data-level="0" data-list="announcements" data-ps="">
 | 
			
		||||
  <div class="box col-sm-4">
 | 
			
		||||
    <!-- .box-inner -->
 | 
			
		||||
    <div class="box-inner">
 | 
			
		||||
      <div class="pic">
 | 
			
		||||
        <img src="http://placehold.it/360x200" alt="">
 | 
			
		||||
        <img src="{{img_src}}" alt="">
 | 
			
		||||
      </div>
 | 
			
		||||
      <div class="box-excerpt">
 | 
			
		||||
        <h3 class="box-title">{{title}}</h3>
 | 
			
		||||
        <span>{{postdate}}</span>
 | 
			
		||||
        <p>{{subtitle}}</p>
 | 
			
		||||
        <p><a href="{{link_to_show}}">Some Link</a></p>
 | 
			
		||||
        <p><a href="{{link_to_show}}">Read More</a></p>
 | 
			
		||||
      </div>
 | 
			
		||||
    </div><!-- /.box-inner -->
 | 
			
		||||
  </div><!-- /.box -->
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -1,12 +1,12 @@
 | 
			
		|||
<div class="widget-2" module="announcement" data-ps="">
 | 
			
		||||
  <h2 class="widget-title">{{widget-title}}</h2>
 | 
			
		||||
  <ul class="widget-list" data-repeat="6" data-module="announcement">
 | 
			
		||||
  <ul class="widget-list"data-level="0" data-list="announcements">
 | 
			
		||||
    <li>
 | 
			
		||||
      <a href="{{link_to_show}}"><i class="fa fa-chevron-right"></i>{{title}}<span>{{postdate}}</span></a>
 | 
			
		||||
    </li>
 | 
			
		||||
  </ul>
 | 
			
		||||
  <p class="more">
 | 
			
		||||
    <a class="btn btn-sm btn-info" href="/module/announcement">More</a>
 | 
			
		||||
    <a class="btn btn-sm btn-info" href="#">More</a>
 | 
			
		||||
  </p>
 | 
			
		||||
</div>
 | 
			
		||||
<hr class="dotted">
 | 
			
		||||
| 
						 | 
				
			
			@ -1,40 +1,10 @@
 | 
			
		|||
<div class="widget" module="archive" data-ps="">
 | 
			
		||||
  <h2 class="widget-title">{{widget-title}}</h2>
 | 
			
		||||
  <div class="list-group">
 | 
			
		||||
    <div class="list-group-item">
 | 
			
		||||
      <h4 class="list-group-item-heading">{{title}}</h4>
 | 
			
		||||
      <ul class="list-group-item-text">
 | 
			
		||||
        <li>Service Updates</li>
 | 
			
		||||
        <li>Help Desk</li>
 | 
			
		||||
        <li>Validate License</li>
 | 
			
		||||
        <li>Privacy Policy</li>
 | 
			
		||||
      </ul>
 | 
			
		||||
    </div>
 | 
			
		||||
    <div class="list-group-item">
 | 
			
		||||
      <h4 class="list-group-item-heading">{{title}}</h4>
 | 
			
		||||
      <ul class="list-group-item-text">
 | 
			
		||||
        <li>Service Updates</li>
 | 
			
		||||
        <li>Help Desk</li>
 | 
			
		||||
        <li>Validate License</li>
 | 
			
		||||
        <li>Privacy Policy</li>
 | 
			
		||||
      </ul>
 | 
			
		||||
    </div>
 | 
			
		||||
    <div class="list-group-item">
 | 
			
		||||
      <h4 class="list-group-item-heading">{{title}}</h4>
 | 
			
		||||
      <ul class="list-group-item-text">
 | 
			
		||||
        <li>Service Updates</li>
 | 
			
		||||
        <li>Help Desk</li>
 | 
			
		||||
        <li>Validate License</li>
 | 
			
		||||
        <li>Privacy Policy</li>
 | 
			
		||||
      </ul>
 | 
			
		||||
    </div>
 | 
			
		||||
    <div class="list-group-item">
 | 
			
		||||
      <h4 class="list-group-item-heading">{{title}}</h4>
 | 
			
		||||
      <ul class="list-group-item-text">
 | 
			
		||||
        <li>Service Updates</li>
 | 
			
		||||
        <li>Help Desk</li>
 | 
			
		||||
        <li>Validate License</li>
 | 
			
		||||
        <li>Privacy Policy</li>
 | 
			
		||||
    <div class="list-group-item" data-list="categories" data-level="0">
 | 
			
		||||
      <h4 class="list-group-item-heading">{{category-title}}</h4>
 | 
			
		||||
      <ul class="list-group-item-text" data-list="archives" data-level="1">
 | 
			
		||||
        <li>{{archive-title}}</li>
 | 
			
		||||
      </ul>
 | 
			
		||||
    </div>
 | 
			
		||||
  </div>
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -1,17 +1,12 @@
 | 
			
		|||
<div class="widget-1 row" module="announcement" data-repeat="3" data-module="announcement" data-ps="">
 | 
			
		||||
  <div class="box col-sm-4">
 | 
			
		||||
    <!-- .box-inner -->
 | 
			
		||||
    <div class="box-inner">
 | 
			
		||||
      <div class="pic">
 | 
			
		||||
        <img src="http://placehold.it/360x200" alt="">
 | 
			
		||||
      </div>
 | 
			
		||||
      <div class="box-excerpt">
 | 
			
		||||
        <h3 class="box-title">{{title}}</h3>
 | 
			
		||||
        <span>{{postdate}}</span>
 | 
			
		||||
        <p>{{subtitle}}</p>
 | 
			
		||||
        <p><a href="{{link_to_show}}">Some Link</a></p>
 | 
			
		||||
      </div>
 | 
			
		||||
    </div><!-- /.box-inner -->
 | 
			
		||||
  </div><!-- /.box -->
 | 
			
		||||
<div class="widget-2" module="announcement" data-ps="">
 | 
			
		||||
  <h2 class="widget-title">{{widget-title}}</h2>
 | 
			
		||||
  <ul class="widget-list" data-level="0" data-list="faqs" >
 | 
			
		||||
    <li>
 | 
			
		||||
      <a href="{{link_to_show}}"><i class="fa fa-chevron-right"></i>{{title}}<span>{{postdate}}</span></a>
 | 
			
		||||
    </li>
 | 
			
		||||
  </ul>
 | 
			
		||||
  <p class="more">
 | 
			
		||||
    <a class="btn btn-sm btn-info" href="/module/announcement">More</a>
 | 
			
		||||
  </p>
 | 
			
		||||
</div>
 | 
			
		||||
<hr class="dotted">
 | 
			
		||||
| 
						 | 
				
			
			@ -1,12 +0,0 @@
 | 
			
		|||
<div class="widget-2" module="announcement" data-ps="">
 | 
			
		||||
  <h2 class="widget-title">{{widget-title}}</h2>
 | 
			
		||||
  <ul class="widget-list" data-repeat="6" data-module="announcement">
 | 
			
		||||
    <li>
 | 
			
		||||
      <a href="{{link_to_show}}"><i class="fa fa-chevron-right"></i>{{title}}<span>{{postdate}}</span></a>
 | 
			
		||||
    </li>
 | 
			
		||||
  </ul>
 | 
			
		||||
  <p class="more">
 | 
			
		||||
    <a class="btn btn-sm btn-info" href="/module/announcement">More</a>
 | 
			
		||||
  </p>
 | 
			
		||||
</div>
 | 
			
		||||
<hr class="dotted">
 | 
			
		||||
| 
						 | 
				
			
			@ -1,18 +1,7 @@
 | 
			
		|||
<div class="widget" module="gallery" data-ps="">
 | 
			
		||||
  <h2 class="widget-title">{{widget-title}}</h2>
 | 
			
		||||
  <ul class="row">
 | 
			
		||||
    <li class="col-md-4 col-sm-6 col-xs-3"><a href="{{link_to_show}}"><img class="img-rounded" src="http://placehold.it/320x320" alt=""></a></li>
 | 
			
		||||
    <li class="col-md-4 col-sm-6 col-xs-3"><a href="{{link_to_show}}"><img class="img-rounded" src="http://placehold.it/320x320" alt=""></a></li>
 | 
			
		||||
    <li class="col-md-4 col-sm-6 col-xs-3"><a href="{{link_to_show}}"><img class="img-rounded" src="http://placehold.it/320x320" alt=""></a></li>
 | 
			
		||||
    <li class="col-md-4 col-sm-6 col-xs-3"><a href="{{link_to_show}}"><img class="img-rounded" src="http://placehold.it/320x320" alt=""></a></li>
 | 
			
		||||
    <li class="col-md-4 col-sm-6 col-xs-3"><a href="{{link_to_show}}"><img class="img-rounded" src="http://placehold.it/320x320" alt=""></a></li>
 | 
			
		||||
    <li class="col-md-4 col-sm-6 col-xs-3"><a href="{{link_to_show}}"><img class="img-rounded" src="http://placehold.it/320x320" alt=""></a></li>
 | 
			
		||||
    <li class="col-md-4 col-sm-6 col-xs-3"><a href="{{link_to_show}}"><img class="img-rounded" src="http://placehold.it/320x320" alt=""></a></li>
 | 
			
		||||
    <li class="col-md-4 col-sm-6 col-xs-3"><a href="{{link_to_show}}"><img class="img-rounded" src="http://placehold.it/320x320" alt=""></a></li>
 | 
			
		||||
    <li class="col-md-4 col-sm-6 col-xs-3"><a href="{{link_to_show}}"><img class="img-rounded" src="http://placehold.it/320x320" alt=""></a></li>
 | 
			
		||||
    <li class="col-md-4 col-sm-6 col-xs-3"><a href="{{link_to_show}}"><img class="img-rounded" src="http://placehold.it/320x320" alt=""></a></li>
 | 
			
		||||
    <li class="col-md-4 col-sm-6 col-xs-3"><a href="{{link_to_show}}"><img class="img-rounded" src="http://placehold.it/320x320" alt=""></a></li>
 | 
			
		||||
    <li class="col-md-4 col-sm-6 col-xs-3"><a href="{{link_to_show}}"><img class="img-rounded" src="http://placehold.it/320x320" alt=""></a></li>
 | 
			
		||||
  <ul class="row" data-list="images" data-level="0">
 | 
			
		||||
    <li class="col-md-4 col-sm-6 col-xs-3"><a href="{{link_to_show}}"><img class="img-rounded" src="{{thumb-src}}" alt=""></a></li>
 | 
			
		||||
  </ul>
 | 
			
		||||
  <p class="more">
 | 
			
		||||
    <a class="btn btn-sm btn-info" href="/module/gallery">More</a>
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -1,9 +0,0 @@
 | 
			
		|||
<footer class="footer">
 | 
			
		||||
  <div class="container footer-inner">
 | 
			
		||||
    <address>
 | 
			
		||||
      <p>This is a simulate website with all fake data!!!</p>
 | 
			
		||||
    </address>
 | 
			
		||||
    <div data-pp="4">
 | 
			
		||||
    </div>
 | 
			
		||||
  </div>
 | 
			
		||||
</footer>
 | 
			
		||||
| 
						 | 
				
			
			@ -6,6 +6,7 @@
 | 
			
		|||
  <%= javascript_include_tag "lib/jquery-1.11.0.min"%>
 | 
			
		||||
  <%= javascript_include_tag "bootstrap"%>
 | 
			
		||||
  <%= javascript_include_tag "plugin/jquery.lite.image.resize"%>
 | 
			
		||||
  <%= javascript_include_tag "plugin/jquery.cycle2.min"%>
 | 
			
		||||
  <%= javascript_include_tag "app"%>
 | 
			
		||||
  <%= javascript_include_tag "#{@dataApi}" if @dataApi != nil%>
 | 
			
		||||
  <!--[if lt IE 9]>
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -44,7 +44,7 @@
 | 
			
		|||
                    <label class="control-label muted"><%= t :always_display_title %>
 | 
			
		||||
                    </label>
 | 
			
		||||
                    <div class="controls">
 | 
			
		||||
                      <%= f.check_box :title_always_on, :class => "toggle-check", :data => { :title => t('site_title_always_display') } %> 
 | 
			
		||||
                        <input type="checkbox" class="toggle-check" name="site[title_always_on]" data-disabled="true" <%= @site.title_always_on ? "checked='checked" : "" %> data-title="<%= t('site_title_always_display') %>" />
 | 
			
		||||
                    </div>
 | 
			
		||||
                  </div>
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			@ -68,7 +68,7 @@
 | 
			
		|||
                      <label class="control-label muted"><%= t :sitemap_menu_in_header %>
 | 
			
		||||
                      </label>
 | 
			
		||||
                      <div class="controls">
 | 
			
		||||
                      <%= f.check_box :sitemap_menu_in_header, :class => "toggle-check" %> 
 | 
			
		||||
                      <input type="checkbox" class="toggle-check" name="site[sitemap_menu_in_header]" data-disabled="true" <%= @site.sitemap_menu_in_header ? "checked='checked" : "" %> />
 | 
			
		||||
                      </div>
 | 
			
		||||
                    </div>
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			@ -93,24 +93,17 @@
 | 
			
		|||
                  <div class="control-group">
 | 
			
		||||
                    <label class="control-label muted"><%= t('site.terms_of_use')%></label>
 | 
			
		||||
                    <div class="controls">
 | 
			
		||||
                      <%= f.check_box :enable_terms_of_use, :class => "toggle-check", :data => { :title => t('site.terms_display_in_footer') } %> 
 | 
			
		||||
                       <input type="checkbox" class="toggle-check for_tou" name="site[enable_terms_of_use]" data-disabled="true" <%= @site.enable_terms_of_use ? "checked='checked'" : "" %>  data-title="Display in footer" />
 | 
			
		||||
                    </div>
 | 
			
		||||
                  </div>
 | 
			
		||||
 | 
			
		||||
                  <!-- CKeditor Site Footer -->
 | 
			
		||||
                  <% I18n.available_locales.each do |locale|%>
 | 
			
		||||
                  <%= content_tag :div, :class => "tab-pane fade #{active_when_current_locale_eq locale} #{locale}" do %>
 | 
			
		||||
                    <label class="control-label muted"><%= t('site.terms_of_use_content')%></label>
 | 
			
		||||
                   <div class="control-group <%= @site.enable_terms_of_use ? "" : "hide" %>" id="link_select">
 | 
			
		||||
                    <label class="control-label muted">Select Page</label>
 | 
			
		||||
                    <div class="controls">
 | 
			
		||||
                      <div class="textarea">
 | 
			
		||||
                        <%= f.fields_for :terms_of_use_translations do |f| %>
 | 
			
		||||
                          <%= f.text_area locale, :class => "ckeditor input-block-level", :value => (@site.terms_of_use_translations[locale] rescue nil) %>
 | 
			
		||||
                        <% end %>
 | 
			
		||||
                      <%= f.select(:terms_of_use_link, @pages.map{|p| [p.name,p.url]},{:include_blank => true}) %>
 | 
			
		||||
                    </div>
 | 
			
		||||
                  </div>     
 | 
			
		||||
                     <%end%>
 | 
			
		||||
                    <%end%>
 | 
			
		||||
            
 | 
			
		||||
 | 
			
		||||
                 <!-- Form Actions -->
 | 
			
		||||
                <div class="form-actions">
 | 
			
		||||
| 
						 | 
				
			
			@ -122,3 +115,16 @@
 | 
			
		|||
 | 
			
		||||
          </fieldset>
 | 
			
		||||
        <% end %>
 | 
			
		||||
<script type="text/javascript">
 | 
			
		||||
$(document).ready(function(){
 | 
			
		||||
  $(".for_tou").click(function(){
 | 
			
		||||
    if($(this).is(":checked")){
 | 
			
		||||
      $("#link_select").removeClass("hide");
 | 
			
		||||
    }else{
 | 
			
		||||
      $("#link_select").addClass("hide");
 | 
			
		||||
    }
 | 
			
		||||
  })
 | 
			
		||||
})
 | 
			
		||||
</script>
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -1,29 +1,26 @@
 | 
			
		|||
 | 
			
		||||
 | 
			
		||||
 <div class="btn-group" data-toggle="buttons-radio">
 | 
			
		||||
   <%= f.fields_for :sub_parts do |sub| %>
 | 
			
		||||
    <label href="#none" class="btn btn-large" data-toggle="tab">
 | 
			
		||||
    <label href="#none" class="btn btn-large <%= @subpart.kind == "none" ? 'active' : '' rescue nil %>" data-toggle="tab">
 | 
			
		||||
      <%= t("page_part_kinds.none") %>
 | 
			
		||||
      <%= sub.radio_button :kind, "none", class: "hide" %>
 | 
			
		||||
      <input type="radio" <%= @subpart.kind == "none" ? "checked" : "" rescue nil %> class="hide" value="none" name="page_part[sub_parts_attributes][<%= @select_number %>][kind]" />
 | 
			
		||||
    </label>
 | 
			
		||||
    <label href="#text" class="btn btn-large" data-toggle="tab">
 | 
			
		||||
    <label href="#text" class="btn btn-large <%= @subpart.kind == "text" ? 'active' : '' rescue nil %>" data-toggle="tab">
 | 
			
		||||
      <%= t("page_part_kinds.text") %>
 | 
			
		||||
      <%= sub.radio_button :kind, "text", class: "hide" %>
 | 
			
		||||
      <input type="radio" class="hide" <%= @subpart.kind == "text" ? "checked" : "" rescue nil %> value="text" name="page_part[sub_parts_attributes][<%= @select_number %>][kind]" />
 | 
			
		||||
    </label>
 | 
			
		||||
    <!-- <label href="#public_r_tag" class="btn btn-large" data-toggle="tab"> -->
 | 
			
		||||
      <%#= t("page_part_kinds.public_r_tag") %>
 | 
			
		||||
      <%#= sub.radio_button :kind, "public_r_tag", class: "hide" %>
 | 
			
		||||
    <!-- </label> -->
 | 
			
		||||
    <label href="#module_widget" class="btn btn-large" data-toggle="tab">
 | 
			
		||||
    <label href="#module_widget" class="btn btn-large <%= @subpart.kind == "module_widget" ? 'active' : '' rescue nil %>" data-toggle="tab">
 | 
			
		||||
      <%= t("page_part_kinds.module_widget") %>
 | 
			
		||||
      <%= sub.radio_button :kind, "module_widget", class: "hide" %>
 | 
			
		||||
      <input type="radio" class="hide" value="module_widget" <%= @subpart.kind == "module_widget" ? "checked" : "" rescue nil %> name="page_part[sub_parts_attributes][<%= @select_number %>][kind]" />
 | 
			
		||||
 | 
			
		||||
    </label>
 | 
			
		||||
  	<% end %>  
 | 
			
		||||
  </div>
 | 
			
		||||
  <fieldset>
 | 
			
		||||
    <div class="input-area tab-content">
 | 
			
		||||
      <div id="none" class="parts-none tab-pane fade in"><%= t(:select_one_function) %></div>
 | 
			
		||||
      <div id="text" class="tab-pane fade in">
 | 
			
		||||
      <div id="none" class="parts-none tab-pane fade in <%= @subpart.kind == "none" ? 'active' : '' rescue nil %>"><%= t(:select_one_function) %></div>
 | 
			
		||||
      <div id="text" class="tab-pane fade in <%= @subpart.kind == "text" ? 'active' : '' rescue nil %>">
 | 
			
		||||
        <div class="nav-name">
 | 
			
		||||
          <strong><%= t(:language) %></strong>
 | 
			
		||||
        </div>
 | 
			
		||||
| 
						 | 
				
			
			@ -41,11 +38,7 @@
 | 
			
		|||
                <label class="control-label muted"><%= t(:content) %></label>
 | 
			
		||||
                <div class="controls">
 | 
			
		||||
                  <div class="textarea">
 | 
			
		||||
                    <%= f.fields_for :sub_parts do |sub| %>
 | 
			
		||||
	                    <%= sub.fields_for :content_translations do |f| %>
 | 
			
		||||
	                       <%= f.text_area locale, class: "ckeditor input-block-level", value: (@part.content_translations[locale] rescue nil) %>
 | 
			
		||||
	                    <% end %>
 | 
			
		||||
	                <% end %>
 | 
			
		||||
                    <textarea name="page_part[sub_parts_attributes][<%= @select_number %>][content_translations][<%= locale.to_s %>]" class="ckeditor input-block-level"><%= @subpart.content_translations[locale] rescue nil %></textarea>
 | 
			
		||||
                  </div>
 | 
			
		||||
                </div>
 | 
			
		||||
              </div>
 | 
			
		||||
| 
						 | 
				
			
			@ -54,42 +47,25 @@
 | 
			
		|||
        </div>
 | 
			
		||||
      </div>
 | 
			
		||||
 | 
			
		||||
      <div id="module_widget" class="tab-pane fade in">
 | 
			
		||||
      <div id="module_widget" class="tab-pane fade in <%= @subpart.kind == "module_widget" ? 'active' : '' rescue nil %>">
 | 
			
		||||
          <% I18n.available_locales.each do |locale| %>
 | 
			
		||||
            <div class="control-group input-content">
 | 
			
		||||
          <%= f.label :module_app_id, t(:module), class: "control-label muted" %>
 | 
			
		||||
              <label class="control-label muted">Widget name (<%= t(locale.to_s) %>) :</label>
 | 
			
		||||
              <div class="controls">
 | 
			
		||||
          <%= f.fields_for :sub_parts do |sub| %>
 | 
			
		||||
          	<%= sub.select(:module, @modules.map{|m| [m.title,m.key]},{:include_blank => true}, "class" => "input-xlarge change module_name") %>
 | 
			
		||||
                <input name="page_part[sub_parts_attributes][<%= @select_number %>][title_translations][<%= locale.to_s %>]" value="<%= @subpart.title_translations[locale.to_s] rescue nil %>" />
 | 
			
		||||
              </div>
 | 
			
		||||
            </div>
 | 
			
		||||
          <% end %>
 | 
			
		||||
          </div>
 | 
			
		||||
        </div>
 | 
			
		||||
     <!--    <div id="front_url" class="control-group input-content <%#= 'hide' if @widget_paths.blank? %>">
 | 
			
		||||
          <%#= f.label :widget_path, t('front_page.display_mode'), class: "control-label muted" %>
 | 
			
		||||
        <div class="control-group input-content">
 | 
			
		||||
          <%= f.label :module_app_id, t(:module) + " :", class: "control-label muted" %>
 | 
			
		||||
          <div class="controls">
 | 
			
		||||
            <%#= f.select :widget_path, @widget_paths, {}, selected: (@part.widget_path rescue nil), class: "input-xlarge change" %>
 | 
			
		||||
          	<%= select_tag("page_part[sub_parts_attributes][#{@select_number}][module]", options_for_select(@modules.map{|m| [m.title,m.key]}, (@subpart.module rescue nil)),{:include_blank => true,"class" => "input-xlarge change module_name"}) %>
 | 
			
		||||
          </div>
 | 
			
		||||
        </div>
 | 
			
		||||
        <div class="control-group input-content checkbox-groups <%#= 'hide' if @module_app_categories.blank? %>" id="page-category-groups" data-for="category">
 | 
			
		||||
          <%#= f.label :categories, t(:categories), class: "control-label muted" %>
 | 
			
		||||
          <div class="controls">
 | 
			
		||||
            <%#= content_tag :label, class: "checkbox" do %>
 | 
			
		||||
              <%#= check_box_tag nil, nil, (@part.category.size ==  @module_app_categories.size ? true : false), class: "select_all" %> <%#= t(:all) %>
 | 
			
		||||
            <%# end %>
 | 
			
		||||
            <div class="groups" id="page-category">
 | 
			
		||||
              <%#= content_tag_for(:label, @module_app_categories, class: "checkbox inline") do |category|%>
 | 
			
		||||
                <%#= check_box_tag("page_part[category][]", category.id, (@part.category.include?(category.id.to_s) rescue false) ) %>
 | 
			
		||||
                <%#= category.title %>
 | 
			
		||||
              <%# end if @module_app_categories %>
 | 
			
		||||
              <input type="hidden" value>
 | 
			
		||||
            </div>
 | 
			
		||||
          </div>
 | 
			
		||||
        </div>  -->
 | 
			
		||||
     
 | 
			
		||||
        <div class="control-group input-content widget_count <%= 'hide' if @module_app.blank? || !@module_app.enable_widget_data_count %>">
 | 
			
		||||
          <%= f.label :widget_data_count, t(:widget_data_count), class: "control-label muted" %>
 | 
			
		||||
          <div class="controls">
 | 
			
		||||
            <%#= f.select :widget_data_count, options_for_select(@data_count, @part.widget_data_count), {}, class: "input-mini", id: "page_count" %>
 | 
			
		||||
          </div>
 | 
			
		||||
        <div id="widgets_selection_area">
 | 
			
		||||
        <% if params[:action] == "edit_sub_part" && @kind == "module_widget"%>
 | 
			
		||||
          <%= render :partial => "widget_form" %>
 | 
			
		||||
        <% end %>
 | 
			
		||||
        </div>
 | 
			
		||||
      </div>
 | 
			
		||||
    </div>
 | 
			
		||||
| 
						 | 
				
			
			@ -98,3 +74,10 @@
 | 
			
		|||
      <button type="button" class="btn" onclick="window.history.back()"><%= t(:cancel) %></button>
 | 
			
		||||
    </div>
 | 
			
		||||
  </fieldset>
 | 
			
		||||
 | 
			
		||||
  <script type="text/javascript">
 | 
			
		||||
    $('*[data-toggle=buttons-radio] label').click(function(){
 | 
			
		||||
      $('*[data-toggle=buttons-radio] input[type=radio]').removeAttr("checked");
 | 
			
		||||
      $(this).find("input[type=radio]").prop("checked","checked");
 | 
			
		||||
    })
 | 
			
		||||
  </script>
 | 
			
		||||
| 
						 | 
				
			
			@ -0,0 +1,54 @@
 | 
			
		|||
<div class="control-group input-content">
 | 
			
		||||
	<label class="control-label muted">Select Widget Type :</label>
 | 
			
		||||
	<div class="controls">
 | 
			
		||||
		<%= select_tag("page_part[sub_parts_attributes][#{@select_number}][widget_type]",options_for_select(@widget_types, (@subpart.widget_type rescue nil))) %>
 | 
			
		||||
	</div>
 | 
			
		||||
</div>
 | 
			
		||||
<div class="control-group input-content">
 | 
			
		||||
	<label class="control-label muted">Select Widget Method :</label>
 | 
			
		||||
	<div class="controls">
 | 
			
		||||
		<%= select_tag("page_part[sub_parts_attributes][#{@select_number}][widget_method]",options_for_select(@widget_methods, (@subpart.widget_method rescue nil))) %>
 | 
			
		||||
	</div>
 | 
			
		||||
</div>
 | 
			
		||||
<% if @widget_settings['override_category_with'].nil? %>
 | 
			
		||||
	<div class="control-group">
 | 
			
		||||
		<label class="control-label muted">Category List :</label>
 | 
			
		||||
		<div class="controls">
 | 
			
		||||
			<% @categories.each do |category| %>
 | 
			
		||||
				<label class="checkbox">
 | 
			
		||||
					<input type="checkbox" <%= @subpart.categories.include?(category.id.to_s) ? "checked='checked'" : "" rescue nil %> value="<%= category.id.to_s %>" name="page_part[sub_parts_attributes][<%= @select_number %>][categories][]">
 | 
			
		||||
					<%= category.title %>
 | 
			
		||||
				</label>
 | 
			
		||||
			<% end %>
 | 
			
		||||
		</div>
 | 
			
		||||
	</div>
 | 
			
		||||
<% else %>
 | 
			
		||||
	<% if @multiselect %>
 | 
			
		||||
		<div class="control-group">
 | 
			
		||||
			<label class="control-label muted"><%= @widget_settings['override_category_with'].classify %> List :</label>
 | 
			
		||||
			<div class="controls">
 | 
			
		||||
				<% @custom.each do |c| %>
 | 
			
		||||
					<label class="checkbox">
 | 
			
		||||
						<input type="checkbox" <%= @subpart.custom_array_field.include?(c.id.to_s) ? "checked='checked'" : "" rescue nil %> value="<%= c.id.to_s %>" name="page_part[sub_parts_attributes][<%= @select_number %>][custom_array_field][]">
 | 
			
		||||
						<%= c["#{@display_field}"] %>
 | 
			
		||||
					</label>
 | 
			
		||||
				<% end %>
 | 
			
		||||
			</div>
 | 
			
		||||
		</div>
 | 
			
		||||
	<% else %>
 | 
			
		||||
		<div class="control-group input-content">
 | 
			
		||||
			<label class="control-label muted">Select <%= @widget_settings['override_category_with'].classify %> :</label>
 | 
			
		||||
			<div class="controls">
 | 
			
		||||
				<%= select_tag("page_part[sub_parts_attributes][#{@select_number}][custom_string_field]",options_for_select(@custom.map{|c| [c["#{@display_field}"],c.id]}, (@subpart.custom_string_field rescue nil))) %>
 | 
			
		||||
			</div>
 | 
			
		||||
		</div>
 | 
			
		||||
	<% end %>
 | 
			
		||||
<% end %>
 | 
			
		||||
<% if !@data_count.nil? %>
 | 
			
		||||
	<div class="control-group input-content">
 | 
			
		||||
		<label class="control-label muted">Data count:</label>
 | 
			
		||||
		<div class="controls">
 | 
			
		||||
			<%= select_tag("page_part[sub_parts_attributes][#{@select_number}][data_count]",options_for_select(1..@data_count,(@subpart.data_count rescue nil))) %>
 | 
			
		||||
		</div>
 | 
			
		||||
	</div>
 | 
			
		||||
<% end %>
 | 
			
		||||
| 
						 | 
				
			
			@ -1,52 +1,29 @@
 | 
			
		|||
<%#= form_for @part, url: {action: "update"} do |f| %>
 | 
			
		||||
	<%#= f.hidden_field :page_part_id, value: @part.id.to_s %>
 | 
			
		||||
	<%#= render :partial => "form", :locals => { :f => f } %>
 | 
			
		||||
<%# end %>
 | 
			
		||||
<% content_for :page_specific_css do %>
 | 
			
		||||
  <%= stylesheet_link_tag "lib/main-forms" %>
 | 
			
		||||
<% end %>
 | 
			
		||||
<%= form_for @part, url: {action: "update"}, :remote=>true, html: { class: "form-horizontal main-forms"} do |f| %>
 | 
			
		||||
	<%= f.hidden_field :page_part_id, value: @part.id.to_s %>
 | 
			
		||||
	<input type="hidden" name="part_id" value="<%= @part.id.to_s %>" />
 | 
			
		||||
	<input type="hidden" name="page_id" value="<%= params[:page_id] %>" />
 | 
			
		||||
 | 
			
		||||
	<%= render :partial => "form", :locals => { :f => f } %>
 | 
			
		||||
<% end %>
 | 
			
		||||
 | 
			
		||||
<script>
 | 
			
		||||
  $('.btn-group input[type="radio"]').each(function(index, el) {
 | 
			
		||||
    if($(this).prop('checked')) {
 | 
			
		||||
    	$(this).closest('label').addClass('active');
 | 
			
		||||
    	$("#" + $(this).val()).addClass('active');
 | 
			
		||||
    }
 | 
			
		||||
  });
 | 
			
		||||
  
 | 
			
		||||
  $('.btn-group').on("click", 'label', function(event) {
 | 
			
		||||
    $(this).find('input').prop('checked', true);
 | 
			
		||||
    event.preventDefault();
 | 
			
		||||
  });
 | 
			
		||||
 | 
			
		||||
  $("#public_r_tag").on("change", "#tag_list select", function() {
 | 
			
		||||
    $.getScript($(this).attr('rel') + '?type=' + $(this).val() + "&id=" + "<%= @part.id %>" );
 | 
			
		||||
  });
 | 
			
		||||
</script>
 | 
			
		||||
<script>
 | 
			
		||||
function toggleChecked(status) {
 | 
			
		||||
  $(".checkbox").each( function() {
 | 
			
		||||
    $(this).attr("checked",status);
 | 
			
		||||
 	$("select.module_name").on("change",function(){
 | 
			
		||||
		var select = $(this),
 | 
			
		||||
			widget_area = $("#widgets_selection_area");
 | 
			
		||||
		if(select.val()){
 | 
			
		||||
			$.ajax({
 | 
			
		||||
				url : "/page_parts/getwidgets",
 | 
			
		||||
				dataType : "html",
 | 
			
		||||
				data : {"module" : select.val(), "page_id" : "<%= params[:page_id] %>", "part_id" : <%= @part_number %>},
 | 
			
		||||
				type : "get"
 | 
			
		||||
			}).done(function(html){
 | 
			
		||||
				widget_area.html(html);
 | 
			
		||||
			})
 | 
			
		||||
		}
 | 
			
		||||
</script>
 | 
			
		||||
<script type="text/javascript">
 | 
			
		||||
	// $("select.module_name").on("change",function(){
 | 
			
		||||
	// 	var select = $(this);
 | 
			
		||||
	// 	if(select.val()){
 | 
			
		||||
	// 		$.ajax({
 | 
			
		||||
	// 			url : "/page_parts/getwidgets",
 | 
			
		||||
	// 			dataType : "html",
 | 
			
		||||
	// 			data : {"module" : select.val(),"number_of_select" : select.data("number").replace("pp_","")},
 | 
			
		||||
	// 			type : "get"
 | 
			
		||||
	// 		}).done(function(html){
 | 
			
		||||
	// 			$("span[for=" + select.data("number") + "]").html(html);
 | 
			
		||||
	// 		})
 | 
			
		||||
	// 	}
 | 
			
		||||
	// })
 | 
			
		||||
 | 
			
		||||
	})
 | 
			
		||||
	$("form").on("ajax:success",function(){
 | 
			
		||||
		window.location.href = "/pages/edit_view?id=<%= params[:page_id] %>";
 | 
			
		||||
	})
 | 
			
		||||
</script>
 | 
			
		||||
| 
						 | 
				
			
			@ -0,0 +1,28 @@
 | 
			
		|||
<% content_for :page_specific_css do %>
 | 
			
		||||
  <%= stylesheet_link_tag "lib/main-forms" %>
 | 
			
		||||
<% end %>
 | 
			
		||||
<%= form_for @part, url: update_sub_part_page_part_path(@subpart), :remote=>true, html: { class: "form-horizontal main-forms"} do |f| %>
 | 
			
		||||
	<input type="hidden" name="part_id" value="<%= @part.id.to_s %>" />
 | 
			
		||||
	<input type="hidden" name="page_id" value="<%= params[:page_id] %>" />
 | 
			
		||||
	<%= render :partial => "form", :locals => { :f => f } %>
 | 
			
		||||
<% end %>
 | 
			
		||||
 | 
			
		||||
<script>
 | 
			
		||||
 	$("select.module_name").on("change",function(){
 | 
			
		||||
		var select = $(this),
 | 
			
		||||
			widget_area = $("#widgets_selection_area");
 | 
			
		||||
		if(select.val()){
 | 
			
		||||
			$.ajax({
 | 
			
		||||
				url : "/page_parts/getwidgets",
 | 
			
		||||
				dataType : "html",
 | 
			
		||||
				data : {"module" : select.val(), "page_id" : "<%= params[:page_id] %>", "part_id" : <%= @part.part_id %>},
 | 
			
		||||
				type : "get"
 | 
			
		||||
			}).done(function(html){
 | 
			
		||||
				widget_area.html(html);
 | 
			
		||||
			})
 | 
			
		||||
		}
 | 
			
		||||
	})
 | 
			
		||||
	$("form").on("ajax:success",function(){
 | 
			
		||||
		window.location.href = "/pages/edit_view?id=<%= params[:page_id] %>";
 | 
			
		||||
	})
 | 
			
		||||
</script>
 | 
			
		||||
| 
						 | 
				
			
			@ -1,4 +1 @@
 | 
			
		|||
Select Widget Type
 | 
			
		||||
<%= select_tag("page_part[sub_parts_attributes][#{@select_number}][widget_type]",options_for_select(@widget_types),{:include_blank => true}) %>
 | 
			
		||||
Select Widget Method
 | 
			
		||||
<%= select_tag("page_part[sub_parts_attributes][#{@select_number}][widget_method]",options_for_select(@widget_methods),{:include_blank => true}) %>
 | 
			
		||||
<%= render :partial => "widget_form" %>
 | 
			
		||||
| 
						 | 
				
			
			@ -1,38 +1,28 @@
 | 
			
		|||
<% content_for :page_specific_css do %>
 | 
			
		||||
  <%= stylesheet_link_tag "lib/main-forms" %>
 | 
			
		||||
<% end %>
 | 
			
		||||
<%= form_for @part, url: {action: "create"}, :remote=>true, html: { class: "form-horizontal main-forms"} do |f| %>
 | 
			
		||||
	<%= f.hidden_field :part_id, value: @part_number %>
 | 
			
		||||
<%= form_for @part, url: {:action => "create"}, :remote=>true, html: { class: "form-horizontal main-forms"} do |f| %>
 | 
			
		||||
	<%= f.hidden_field :part_id, value: @part_number,:class => "hidden_part_id" %>
 | 
			
		||||
	<%= f.hidden_field :page_id, value: @page_id,:class => "hidden_page_id" %>
 | 
			
		||||
	<%= render :partial => "form", :locals => { :f => f } %>
 | 
			
		||||
<% end %>
 | 
			
		||||
 | 
			
		||||
<script type="text/javascript">
 | 
			
		||||
	$("select.module_name").on("change",function(){
 | 
			
		||||
		var select = $(this);
 | 
			
		||||
		var select = $(this),
 | 
			
		||||
			widget_area = $("#widgets_selection_area");
 | 
			
		||||
		if(select.val()){
 | 
			
		||||
			$.ajax({
 | 
			
		||||
				url : "/page_parts/getwidgets",
 | 
			
		||||
				dataType : "html",
 | 
			
		||||
				data : {"module" : select.val(),"number_of_select" : select.data("number").replace("pp_","")},
 | 
			
		||||
				data : {"module" : select.val(),"part_id" : <%= @part_number %>, "page_id" : "<%= params[:page_id] %>"},
 | 
			
		||||
				type : "get"
 | 
			
		||||
			}).done(function(html){
 | 
			
		||||
				$("span[for=" + select.data("number") + "]").html(html);
 | 
			
		||||
				widget_area.html(html);
 | 
			
		||||
			})
 | 
			
		||||
		}
 | 
			
		||||
	})
 | 
			
		||||
	$('.btn-group input[type="radio"]').each(function(index, el) {
 | 
			
		||||
	    if($(this).prop('checked')) {
 | 
			
		||||
	    	$(this).closest('label').addClass('active');
 | 
			
		||||
	    	$("#" + $(this).val()).addClass('active');
 | 
			
		||||
	    }
 | 
			
		||||
	 });
 | 
			
		||||
	  
 | 
			
		||||
  $('.btn-group').on("click", 'label', function(event) {
 | 
			
		||||
    $(this).find('input').prop('checked', true);
 | 
			
		||||
    event.preventDefault();
 | 
			
		||||
  });
 | 
			
		||||
 | 
			
		||||
  $("#public_r_tag").on("change", "#tag_list select", function() {
 | 
			
		||||
    $.getScript($(this).attr('rel') + '?type=' + $(this).val() + "&id=" + "<%= @part.id %>" );
 | 
			
		||||
  });
 | 
			
		||||
	$("form").on("ajax:success",function(){
 | 
			
		||||
		window.location.href = "/pages/edit_view?id=<%= params[:page_id] %>";
 | 
			
		||||
	})
 | 
			
		||||
</script>
 | 
			
		||||
| 
						 | 
				
			
			@ -0,0 +1 @@
 | 
			
		|||
Template doesnt exists for this page.
 | 
			
		||||
| 
						 | 
				
			
			@ -0,0 +1 @@
 | 
			
		|||
<%= render_sitemap %>
 | 
			
		||||
| 
						 | 
				
			
			@ -1,7 +1,12 @@
 | 
			
		|||
gem 'announcement', git: 'git@gitlab.tp.rulingcom.com:saurabh/announcement-test.git'
 | 
			
		||||
gem 'ad_banner', git: 'git@gitlab.tp.rulingcom.com:saurabh/adbanner-test.git'
 | 
			
		||||
gem "archive", git: 'git@gitlab.tp.rulingcom.com:saurabh/archive.git'
 | 
			
		||||
gem 'gallery', git: 'git@gitlab.tp.rulingcom.com:saurabh/gallery.git'
 | 
			
		||||
# gem 'announcement', git: 'git@gitlab.tp.rulingcom.com:saurabh/announcement-test.git'
 | 
			
		||||
gem 'announcement', path: '/Volumes/MyData/github/Orbit4.5/new_modules/announcement'
 | 
			
		||||
# gem 'ad_banner', git: 'git@gitlab.tp.rulingcom.com:saurabh/adbanner-test.git'
 | 
			
		||||
gem 'ad_banner', path: '/Volumes/MyData/github/Orbit4.5/new_modules/adbanner-test'
 | 
			
		||||
# gem "archive", git: 'git@gitlab.tp.rulingcom.com:saurabh/archive.git'
 | 
			
		||||
gem "archive", path: '/Volumes/MyData/github/Orbit4.5/new_modules/archive'
 | 
			
		||||
# gem 'gallery', git: 'git@gitlab.tp.rulingcom.com:saurabh/gallery.git'
 | 
			
		||||
gem 'gallery', path: '/Volumes/MyData/github/Orbit4.5/new_modules/gallery'
 | 
			
		||||
gem 'links', git: 'git@gitlab.tp.rulingcom.com:saurabh/links.git'
 | 
			
		||||
gem 'page_content', git: 'git@gitlab.tp.rulingcom.com:saurabh/pagecontent.git'
 | 
			
		||||
gem 'faq', git: 'git@gitlab.tp.rulingcom.com:saurabh/faq.git'
 | 
			
		||||
# gem 'faq', git: 'git@gitlab.tp.rulingcom.com:saurabh/faq.git'
 | 
			
		||||
gem 'faq', path: '/Volumes/MyData/github/Orbit4.5/new_modules/faq'
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -14,10 +14,15 @@ Orbit::Application.routes.draw do
 | 
			
		|||
 | 
			
		||||
  get "/page_parts/getwidgets" => "page_parts#getwidgets"
 | 
			
		||||
  get "/page_parts/info" => "page_parts#info"
 | 
			
		||||
  get "/page_parts/edit_sub_part" => "page_parts#edit_sub_part"
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
  resources :pages
 | 
			
		||||
  resources :page_parts
 | 
			
		||||
  resources :page_parts do 
 | 
			
		||||
      member do
 | 
			
		||||
        patch 'update_sub_part'
 | 
			
		||||
      end
 | 
			
		||||
    end
 | 
			
		||||
 
 | 
			
		||||
  get "/module/:name" => "home#index"
 | 
			
		||||
  get "/module/:name/show" => "home#show"
 | 
			
		||||
| 
						 | 
				
			
			@ -43,6 +48,8 @@ Orbit::Application.routes.draw do
 | 
			
		|||
 | 
			
		||||
    resources :passwords
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
    namespace :admin do
 | 
			
		||||
      resources :dashboards do
 | 
			
		||||
        collection do
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -31,7 +31,7 @@ module OrbitApp
 | 
			
		|||
      end
 | 
			
		||||
 | 
			
		||||
      class RegisteredModule
 | 
			
		||||
        attr_reader :name,:key,:module_label,:widget_methods,:authorizable_models,:is_authorizable, :data_count
 | 
			
		||||
        attr_reader :name,:key,:module_label,:widget_methods,:authorizable_models,:is_authorizable, :data_count, :widget_settings
 | 
			
		||||
 | 
			
		||||
        def initialize(name,&block)
 | 
			
		||||
          @name = name
 | 
			
		||||
| 
						 | 
				
			
			@ -39,6 +39,7 @@ module OrbitApp
 | 
			
		|||
          @side_bar = nil
 | 
			
		||||
          @module_label = @name
 | 
			
		||||
          @widget_methods = [] 
 | 
			
		||||
          @widget_settings = {}
 | 
			
		||||
          @is_taggable = false
 | 
			
		||||
          @authorizable_models = []
 | 
			
		||||
          @is_authorizable = false
 | 
			
		||||
| 
						 | 
				
			
			@ -77,6 +78,14 @@ module OrbitApp
 | 
			
		|||
          @widget_methods
 | 
			
		||||
        end
 | 
			
		||||
 | 
			
		||||
        def widget_settings(settings)
 | 
			
		||||
          @widget_settings = settings.first
 | 
			
		||||
        end
 | 
			
		||||
 | 
			
		||||
        def get_widget_settings
 | 
			
		||||
          @widget_settings
 | 
			
		||||
        end
 | 
			
		||||
 | 
			
		||||
        def get_icon_class
 | 
			
		||||
          @side_bar.get_icon_class
 | 
			
		||||
        end
 | 
			
		||||
| 
						 | 
				
			
			@ -84,6 +93,7 @@ module OrbitApp
 | 
			
		|||
        def side_bar(&block) #setter for side_bar from init
 | 
			
		||||
          @side_bar = SideBarRegistration::SideBar.new(@name,@key,method(:get_module_app), &block)
 | 
			
		||||
        end
 | 
			
		||||
 | 
			
		||||
        def get_side_bar
 | 
			
		||||
          @side_bar
 | 
			
		||||
        end
 | 
			
		||||
| 
						 | 
				
			
			@ -138,6 +148,10 @@ module OrbitApp
 | 
			
		|||
          @is_frontend_enabled
 | 
			
		||||
        end
 | 
			
		||||
 | 
			
		||||
        def is_widget_enabled
 | 
			
		||||
          !@widget_methods.blank?
 | 
			
		||||
        end
 | 
			
		||||
 | 
			
		||||
        def data_count(range)
 | 
			
		||||
          @data_count = range
 | 
			
		||||
        end
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -27,6 +27,27 @@ module OrbitCategory
 | 
			
		|||
          end
 | 
			
		||||
      end
 | 
			
		||||
 | 
			
		||||
       def filter_by_widget_categories(categories=[])
 | 
			
		||||
          categories = OrbitHelper.widget_categories if categories.blank?
 | 
			
		||||
          if !categories.blank?
 | 
			
		||||
            if categories.first == "all"
 | 
			
		||||
              if OrbitHelper.widget_data_count == 0
 | 
			
		||||
                self.all
 | 
			
		||||
              else
 | 
			
		||||
                self.all.limit(OrbitHelper.widget_data_count)
 | 
			
		||||
              end
 | 
			
		||||
            else
 | 
			
		||||
               if OrbitHelper.widget_data_count == 0
 | 
			
		||||
                self.where(:category_id.in => categories) rescue []
 | 
			
		||||
              else
 | 
			
		||||
                self.where(:category_id.in => categories).limit(OrbitHelper.widget_data_count) rescue []
 | 
			
		||||
              end
 | 
			
		||||
            end
 | 
			
		||||
          else
 | 
			
		||||
            []
 | 
			
		||||
          end
 | 
			
		||||
      end
 | 
			
		||||
 | 
			
		||||
       def with_categories(categories=[])
 | 
			
		||||
        if categories.blank?
 | 
			
		||||
          self.all
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
		Reference in New Issue