Commit 13f0e3e1 authored by Rene Saarsoo's avatar Rene Saarsoo
Browse files

Initial crap version of new members in this verison.

parent 17b7cc8e
Loading
Loading
Loading
Loading
+8 −4
Original line number Diff line number Diff line
@@ -273,10 +273,14 @@ task :touch2 => :sass do
    "--output", OUT_DIR,
    "--config", "#{SDK_DIR}/touch/docs/config.json",
    "--examples-base-url", "touch-build/examples/production/",
    # "--import", "Touch 1.1:../docs.sencha.com/exports/touch-1.1",
    # "--import", "Touch 2.0:../docs.sencha.com/exports/touch-2.0.1",
    # "--import", "Touch 2.1.0:../docs.sencha.com/exports/touch-2.1.0",
    # "--import", "Touch 2.1.1",
    # "--import", "1.1.0:../docs.sencha.com/exports/touch-1.1.0",
    # "--import", "1.1.1:../docs.sencha.com/exports/touch-1.1.1",
    # "--import", "2.0.0:../docs.sencha.com/exports/touch-2.0.0",
    # "--import", "2.0.1:../docs.sencha.com/exports/touch-2.0.1",
    # "--import", "2.1.0:../docs.sencha.com/exports/touch-2.1.0",
    "--import", "2.1.1:../docs.sencha.com/exports/touch-2.1.1",
    # "--import", "2.2.0:../docs.sencha.com/exports/touch-2.2.0",
    "--import", "2.2.1",
    "--seo"
  )

+3 −0
Original line number Diff line number Diff line
@@ -6,6 +6,7 @@ require 'jsduck/videos'
require 'jsduck/examples'
require 'jsduck/categories'
require 'jsduck/doc_formatter'
require 'jsduck/news'

module JsDuck

@@ -22,6 +23,7 @@ module JsDuck
    attr_reader :videos
    attr_reader :examples
    attr_reader :categories
    attr_reader :news

    def initialize(relations, opts)
      @relations = relations
@@ -35,6 +37,7 @@ module JsDuck
      @videos = Videos.create(@opts.videos)
      @examples = Examples.create(@opts.examples, @opts)
      @categories = Categories.create(@opts.categories_path, doc_formatter, @relations)
      @news = News.create(@relations, doc_formatter, @opts)
    end

    # Writes out the assets that can be written out separately:
+1 −0
Original line number Diff line number Diff line
@@ -37,6 +37,7 @@ module JsDuck
        "{data_path}" => File.basename(@opts.data_path),
        "{welcome}" => @assets.welcome.to_html("display:none"),
        "{categories}" => @assets.categories.to_html("display:none"),
        "{news}" => @assets.news.to_html("display:none"),
        "{guides}" => @assets.guides.to_html("display:none"),
        "{head_html}" => @opts.head_html,
        "{body_html}" => @opts.body_html,

lib/jsduck/news.rb

0 → 100644
+50 −0
Original line number Diff line number Diff line
require 'jsduck/util/null_object'

module JsDuck

  class News
    # Creates News object from relations data when --import option
    # specified.
    def self.create(relations, doc_formatter, opts)
      if opts[:imports].length > 0
        News.new(relations, doc_formatter)
      else
        Util::NullObject.new(:to_html => "")
      end
    end

    # Generates list of new classes & members in this version.
    def initialize(relations, doc_formatter)
      @doc_formatter = doc_formatter
      @new_members = []
      relations.each do |cls|
        if !cls[:meta][:private]
          cls.all_local_members.each do |m|
            @new_members << m if m[:meta][:new] && !m[:meta][:private] && !m[:meta][:hide]
          end
        end
      end
    end

    # Returns the HTML
    def to_html(style="")
      html = "<ul>" + @new_members.map {|m| "<li>#{link(m)}</li>" }.join + "</ul>"

      return <<-EOHTML
      <div id='news-content' style='#{style}'>
        <h1>New in this version</h1>
        <div class='section'>
          <h1>Members</h1>
          #{html}
        </div>
      </div>
      EOHTML
    end

    def link(m)
      @doc_formatter.link(m[:owner], m[:name], "#{m[:owner]}.#{m[:name]}", m[:tagname], m[:meta][:static])
    end

  end

end
+4 −2
Original line number Diff line number Diff line
@@ -19,11 +19,13 @@ Ext.define('Docs.view.cls.Index', {
            '<tpl if="notice">',
                '<div class="notice">{notice}</div>',
            '</tpl>',
            '{categories}'
            '{categories}',
            '{news}'
        );
        this.data = {
            notice: Docs.data.message || Docs.ContentGrabber.get("notice-text"),
            categories: Docs.ContentGrabber.get("categories-content")
            categories: Docs.ContentGrabber.get("categories-content"),
            news: Docs.ContentGrabber.get("news-content")
        };

        this.callParent(arguments);
Loading