app/controllers/admin/dashboard_controller.rb in kit_cms-2.3.20 vs app/controllers/admin/dashboard_controller.rb in kit_cms-2.3.22

- old
+ new

@@ -103,12 +103,20 @@ end def system raise Exception("permissions") unless can?(:dashboard, :super) + if request.post? && params[:preference][:name] + name = params[:preference][:name] + value = params[:preference][:value] + Preference.set(_sid, name, value) + end + @preferences = Preference.sys(_sid).where("user_id is null").order(:name) @preferences = @preferences.all + + @preference = Preference.new end def build_system raise Exception("permissions") unless can?(:dashboard, :super) @@ -162,11 +170,10 @@ HtmlAsset.sys(sid).each do |ha| HtmlAsset.fetch(sid, ha.name, ha.file_type) end - @system_id = sid prefs = { date_time_format: "%H:%M %d-%m-%y", app_name: System.find(sid).name.downcase, spam_points_to_ban_user: 5, @@ -388,11 +395,11 @@ indexes = [] search_fields = [] @@to_search.each do |model| if params["include_#{model.pluralize.downcase}".to_sym] - indexes << "kit_#{app_name.downcase}_" + model.tableize + indexes << "#{index_name}_" + model.tableize KitIndexed.indexed_columns(model).collect { |ic| next if ic[:include_in_all]==false next if ic[:index]==:not_analyzed search_fields << ic[:name] } @@ -412,11 +419,11 @@ string search_for, :fields=>search_fields.uniq end filter :term, :system_id=>system_id end - logger.debug "SEARCH: #{indexes.join(',')} #{search.to_json}" + logger.info "SEARCH: #{indexes.join(',')} #{search.to_json}" @results = search.results logger.debug "RESULTS: #{@results.size}" @to_search = @@to_search end @@ -440,17 +447,20 @@ render "activity", :layout=>"cms" end end def help + system_id = _sid + if params[:search] search_for = params[:search] - search = Tire.search "kit_#{app_name}_helps" do + search = Tire.search "#{index_name}_helps" do query do string search_for, :fields=>["name", "body", "path"] end + filter :term, :system_id=>system_id end @helps = search.results render "helps" return else @@ -469,6 +479,20 @@ def warning_message(s) "<span class='check_warning'>#{s}</span>".html_safe end + def broken_links + @broken = [] + Anemone.crawl(Preference.get_cached(_sid, "host"), :skip_query_strings=>true) do |anemone| + anemone.skip_links_like [ /\/db/, /\/page\/\d+\/info/, /\?edit\=1/ ] + anemone.on_every_page do |page| + @broken << page + if page.code == 404 + uri = URI.parse(page.url.to_s) + @broken << uri.path + end + end + end + + end end