<commit_before><link href="/assets/css/colorbox/colorbox.css" media="all" rel="stylesheet" />
<script src="/assets/js/jquery.colorbox.js"></script>
<%
  path_prefix = nil
  if controller.filters.include?(:preview)
    path_prefix = cms_preview_path(preview_date: params[:preview_date])
  end

  if path_prefix.present? && path_prefix.end_with?('/')
    path_prefix = path_prefix[0..-2]
  end
%>
<%= javascript_include_tag "opendata/public" %>
<%= jquery do %>
//Tabs
SS_Tabs.render("#dataset-tabs-<%= @cur_node.id %>");

  <% if @cur_node.show_point? %>
    //show point
  Opendata_Point.render("<%= path_prefix %><%= @cur_page.point_url %>");
  <% end %>

  //show apps
  $.ajax({
    url: "<%= path_prefix %><%= @cur_page.dataset_apps_url %>",
    success: function (data) {
      $(".dataset-apps").html(data);
    }
  });

  //show ideas
$.ajax({
  url: "<%= path_prefix %><%= @cur_page.dataset_ideas_url %>",
  success: function (data) {
    $(".dataset-ideas").html(data);

  //hide categorise
  }
});
$(".categories a[data-class=other]").click(function () {
  var type;
  type = $(this).attr("class");
  $(".categories a." + type).show();
  $(this).remove();
  return false;
  // preview

});
$("a.content").colorbox({
  fixed: true,
  width: "90%",
  height: "90%"
});
<% end %>

<header>
  <h1 class="name"><%= @cur_page.send :name %></h1>
</header>

<% if @cur_node.show_point? %>
<div class="point">
  <div class="count">
    <span class="label"><%= I18n.t("opendata.labels.iine") %></span>
    <span class="number"><%= @cur_page.point %></span>
  </div>
</div>
<% end %>

<%
max = 3
categories = [
  { items: @cur_page.categories, type: :category, name: :name, key: :category_id, val: :id },
  { items: @cur_page.areas.sort(order: 1), type: :area, name: :name, key: :area_id, val: :id },
  { items: @cur_page.tags, type: :tag, name: :to_s, key: :tag, val: :to_s },
]
%>
<nav class="categories">
  <% categories.each do |cate| %>
    <% cate[:items].each_with_index do |item, idx| %>
      <% hide = (idx >= max) ? "display: none" : nil %>
      <%= link_to item.send(cate[:name]), @search_path.call("s[#{cate[:key]}]" => "#{item.send(cate[:val])}"),
        class: cate[:type], style: hide %>
    <% end %>
    <% if cate[:items].size > max %>
      <%= link_to I18n.t("opendata.labels.other") + "#{cate[:items].size-max}" + I18n.t("opendata.labels.count"), "#",
        class: "#{cate[:type]}", "data-class" => "other" %>
    <% end %>
  <% end %>
</nav>

<div class="text">
  <%= auto_link paragraph(@cur_page.text) %>
</div>

<div class="dataset-tabs tabs"  id="dataset-tabs-<%= @cur_node.id %>">
  <article class="tab" id="cms-tab-<%= @cur_node.id %>-0">
    <header><h2><%= I18n.t("opendata.labels.resource") %></h2></header>
    <div class="pages">
      <div class="info-wrap">
        <div class="resources">
          <header>
            <h1><%= I18n.t("opendata.labels.resource") %></h1>
          </header>

          <% @cur_page.resources.order(name: 1).each do |rs| %>
          <div class="resource">
            <div class="info">
              <div class="name format-<%= rs.format.downcase %>">
                <%= rs.name %> (<%= rs.format %> <%= number_to_human_size(rs.size) %>)
              </div>
              <% if rs.text.present? %>
              <div class="text">
                <%= auto_link paragraph(rs.text) %>
              </div>
              <% end %>
              <% if rs.rdf_iri.present? %>
              <div class="sparql">
                <%= rs.t :rdf_iri %> <%= link_to rs.rdf_iri, "#{sparql_path}?graph_name=#{rs.rdf_iri}" %>
              </div>
              <% end %>
            </div>
            <div class="icons">
              <% if license = rs.license %>
              <span class="license">
                <% label = tryb { image_tag license.file.url, alt: license.name } || license.name %>
                <% if license.related_url.present? %>
                  <%= link_to label, license.related_url, target: "_blank" %>
                <% else %>
                  <%= label %>
                <% end %>
              </span>
              <% end %>
              <div class="content-wrap"><%= link_to I18n.t("opendata.labels.preview"), rs.content_url, class: "content" if rs.tsv_present? %></div>
              <div class="download-wrap"><%= link_to I18n.t("opendata.labels.downloaded"), rs.url, class: "download" %></div>
            </div>
          </div>
          <% end %>

          <% @cur_page.url_resources.order(name: 1).each do |urs| %>
          <div class="url-resource">
            <div class="info">
              <div class="name format-<%= urs.format.downcase %>">
                <%= urs.name %> (<%= urs.format %> <%= number_to_human_size(urs.size) %>)
              </div>
              <% if urs.text.present? %>
              <div class="text">
                <%= auto_link paragraph(urs.text) %>
              </div>
              <% end %>
              <% if urs.rdf_iri.present? %>
              <div class="sparql">
                <%= urs.t :rdf_iri %> <%= link_to urs.rdf_iri, "#{sparql_path}?graph_name=#{urs.rdf_iri}" %>
              </div>
              <% end %>
            </div><commit_msg>[fix] opendata : resource download in preview (#2414)<commit_after><link href="/assets/css/colorbox/colorbox.css" media="all" rel="stylesheet" />
<script src="/assets/js/jquery.colorbox.js"></script>
<%
  path_prefix = nil
  if controller.filters.include?(:preview)
    path_prefix = cms_preview_path(preview_date: params[:preview_date])
  end

  if path_prefix.present? && path_prefix.end_with?('/')
    path_prefix = path_prefix[0..-2]
  end
%>
<%= javascript_include_tag "opendata/public" %>
<%= jquery do %>
//Tabs
SS_Tabs.render("#dataset-tabs-<%= @cur_node.id %>");

  <% if @cur_node.show_point? %>
    //show point
  Opendata_Point.render("<%= path_prefix %><%= @cur_page.point_url %>");
  <% end %>

  //show apps
  $.ajax({
    url: "<%= path_prefix %><%= @cur_page.dataset_apps_url %>",
    success: function (data) {
      $(".dataset-apps").html(data);
    }
  });

  //show ideas
$.ajax({
  url: "<%= path_prefix %><%= @cur_page.dataset_ideas_url %>",
  success: function (data) {
    $(".dataset-ideas").html(data);

  //hide categorise
  }
});
$(".categories a[data-class=other]").click(function () {
  var type;
  type = $(this).attr("class");
  $(".categories a." + type).show();
  $(this).remove();
  return false;
  // preview

});
$("a.content").colorbox({
  fixed: true,
  width: "90%",
  height: "90%"
});
<% end %>

<header>
  <h1 class="name"><%= @cur_page.send :name %></h1>
</header>

<% if @cur_node.show_point? %>
<div class="point">
  <div class="count">
    <span class="label"><%= I18n.t("opendata.labels.iine") %></span>
    <span class="number"><%= @cur_page.point %></span>
  </div>
</div>
<% end %>

<%
max = 3
categories = [
  { items: @cur_page.categories, type: :category, name: :name, key: :category_id, val: :id },
  { items: @cur_page.areas.sort(order: 1), type: :area, name: :name, key: :area_id, val: :id },
  { items: @cur_page.tags, type: :tag, name: :to_s, key: :tag, val: :to_s },
]
%>
<nav class="categories">
  <% categories.each do |cate| %>
    <% cate[:items].each_with_index do |item, idx| %>
      <% hide = (idx >= max) ? "display: none" : nil %>
      <%= link_to item.send(cate[:name]), @search_path.call("s[#{cate[:key]}]" => "#{item.send(cate[:val])}"),
        class: cate[:type], style: hide %>
    <% end %>
    <% if cate[:items].size > max %>
      <%= link_to I18n.t("opendata.labels.other") + "#{cate[:items].size-max}" + I18n.t("opendata.labels.count"), "#",
        class: "#{cate[:type]}", "data-class" => "other" %>
    <% end %>
  <% end %>
</nav>

<div class="text">
  <%= auto_link paragraph(@cur_page.text) %>
</div>

<div class="dataset-tabs tabs"  id="dataset-tabs-<%= @cur_node.id %>">
  <article class="tab" id="cms-tab-<%= @cur_node.id %>-0">
    <header><h2><%= I18n.t("opendata.labels.resource") %></h2></header>
    <div class="pages">
      <div class="info-wrap">
        <div class="resources">
          <header>
            <h1><%= I18n.t("opendata.labels.resource") %></h1>
          </header>

          <% @cur_page.resources.order(name: 1).each do |rs| %>
          <div class="resource">
            <div class="info">
              <div class="name format-<%= rs.format.downcase %>">
                <%= rs.name %> (<%= rs.format %> <%= number_to_human_size(rs.size) %>)
              </div>
              <% if rs.text.present? %>
              <div class="text">
                <%= auto_link paragraph(rs.text) %>
              </div>
              <% end %>
              <% if rs.rdf_iri.present? %>
              <div class="sparql">
                <%= rs.t :rdf_iri %> <%= link_to rs.rdf_iri, "#{sparql_path}?graph_name=#{rs.rdf_iri}" %>
              </div>
              <% end %>
            </div>
            <div class="icons">
              <% if license = rs.license %>
              <span class="license">
                <% label = tryb { image_tag license.file.url, alt: license.name } || license.name %>
                <% if license.related_url.present? %>
                  <%= link_to label, license.related_url, target: "_blank" %>
                <% else %>
                  <%= label %>
                <% end %>
              </span>
              <% end %>
              <div class="content-wrap"><%= link_to I18n.t("opendata.labels.preview"), rs.content_url, class: "content" if rs.tsv_present? %></div>
              <div class="download-wrap">
                <% if controller.preview_path? %>
                  <%= link_to I18n.t("opendata.labels.downloaded"), rs.file.url, class: "download" %>
                <% else %>
                  <%= link_to I18n.t("opendata.labels.downloaded"), rs.url, class: "download" %>
                <% end %>
              </div>
            </div>
          </div>
          <% end %>

          <% @cur_page.url_resources.order(name: 1).each do |urs| %>
          <div class="url-resource">
            <div class="info">
              <div class="name format-<%= urs.format.downcase %>">
                <%= urs.name %> (<%= urs.format %> <%= number_to_human_size(urs.size) %>)
              </div>
              <% if urs.text.present? %>
              <div class="text">
                <%= auto_link paragraph(urs.text) %>
              </div>
              <% end %>
              <% if urs.rdf_iri.present? %>
              <div class="sparql">
                <%= urs.t :rdf_iri %> <%= link_to urs.rdf_iri, "#{sparql_path}?graph_name=#{urs.rdf_iri}" %>
              </div>
              <% end %>
            </div>
{'fraction_non_alphanumeric': 0.21305038795924092, 'fraction_numerical': 0.0063569225016359724, 'mean_word_length': 2.2546394888956494, 'pattern_counts': {'":': 0, '<': 261, '<?xml version=': 0, '>': 269, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 9, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4938792', 'n_tokens_mistral': 3982, 'n_tokens_neox': 3625, 'n_words': 658}