<commit_before>## Changelog

### 2016.01.11
* `.nodes` and `#node` methods removed from default `acts_as_node` models and controllers
  due to implementing support for multiple node classes.

  If reverse node lookup from content classes is needed, reimplement it
  in the specific application where the needed node class name is known.
* Builder scopes in admin controllers are now inherited from parent controllers up to Releaf::BaseController.
* Magic `Admin::Nodes` builder scope is no longer prepended by `Releaf::Content::NodesController`.

  This is no longer needed because releaf controllers can now be extended
  and the child controllers can have their own builders.

  Note that controller assets are not automatically inherited and need
  to be explicitly loaded by the child controller.

  Updating applications that use custom `Admin::Nodes` builder scope:
  (see Dummy application for a working example)

  1) Create `Admin::NodesController < Releaf::Content::NodesController`

  2) Change releaf menu in `config/initializers/releaf.rb`:

     Instead of
     ```ruby
     {
       :controller => 'releaf/content/nodes',
       :icon => 'sitemap',
     }
     ```

     Use
     ```ruby
     { :controller => 'admin/nodes' }
     ```

  3) Override node resource configuration in `config/initializers/releaf.rb`:

     Add the following:
     ```ruby
     config.content_resources = { 'Node' => { controller: 'Admin::NodesController' } }
     ```

  4) Create `app/assets/javascripts/controllers/admin/nodes.js` with the following content:
    ```
    //= require releaf/controllers/releaf/content/nodes
    ```

  5) Create `app/assets/stylesheets/controllers/admin/nodes.scss` with the following content:
    ```
    @import 'releaf/controllers/releaf/content/nodes';
    ```

  6) Update `default_controller` of existing users in DB to use the new controller name

  7) Update existing role permissions in DB to use the new controller name

* Dummy application now uses an extended `Admin::Nodes` controller
  instead of the default `Releaf::Content::NodesController`

* `releaf_routes_for` helper has been renamed to `node_routes_for`.
* Multiple node models and controllers are now supported.

  Node resource configuration can be overriden via `content_resources` key
  in `config/initializers/releaf.rb`

  There are three typical scenarios:

  1) Default configuration

    Node model is called `Node` and handled by `Releaf::Content::NodesController`

    Nothing needs to be changed for this to work
    except renaming `releaf_routes_for` to `node_routes_for` in `routes.rb`

  2) Custom node model and/or controller

    For example, if a model called `SomeOtherNode` needs to be used instead of `Node`
    and it will be handled in admin by `Admin::NodesController`, then the configuration
    looks as follows:

    ```ruby
    config.content_resources = { 'SomeOtherNode' => { controller: 'Admin::NodesController' } }
    ```

  3) Multiple per-site node models in separate content trees

    When a single application needs to handle multiple separate websites
    with separate content trees, multiple node models can be used.

    An example configuration would look as follows.

    In `config/initializers/releaf.rb`:

    ```ruby
    config.content_resources = {
      'Node' => {
        controller: 'Releaf::Content::NodesController',
        routing: {
          site: "main_site",
          constraints: { host: /^releaf\.local$/ }
        }
      },
      'OtherSite::OtherNode' => {
        controller: 'Admin::OtherSite::OtherNodesController',
        routing: {
          site: "other_site",
          constraints: { host: /^other\.releaf\.local$/ }
        }
      }
    }
    ```

    In `routes.rb`:

    ```ruby
    node_routing( Releaf::Content.routing ) do

      node_routes_for(HomePage) do
        get 'show', as: "home_page"
      end

      node_routes_for(TextPage) do
        get 'show'
      end
    end
    ```

    This configuration would mean that all `HomePage` and `TextPage` nodes
    with `Node` class would have their routes drawn
    constrained to `http:://releaf.local/" host name
    and all `HomePage` and `TextPage` nodes using `OtherSite::OtherNode` node class
    would only have routes for `http://other.releaf.local/` website.

    The drawn routes will have extra parameters `site` and `node_class` passed to them
    that can be used in the public website if needed. See `#node_class` and `#site`
    methods in `application_controller.rb` of Dummy application for example usage.

    Each node tree can have its own structure and content types. Add structure validations
    to specific node models as needed.

    If a node content type needs to only be available in a single site,
    the `node_routing` automation block can be omitted and the corresponding routes
    can be drawn for a specific node class and constrained manually:

    ```ruby
    constraints Releaf::Content.routing['OtherSite::OtherNode'][:constraints] do
      node_routes_for(ContactsController, node_class: 'OtherSite::OtherNode') do
        get 'show', as: "contacts_page"
      end
    end<commit_msg>Fix markdown syntax in changelog<commit_after>## Changelog

### 2016.01.11
* `.nodes` and `#node` methods removed from default `acts_as_node` models and controllers
  due to implementing support for multiple node classes.

  If reverse node lookup from content classes is needed, reimplement it
  in the specific application where the needed node class name is known.
* Builder scopes in admin controllers are now inherited from parent controllers up to `Releaf::BaseController`.
* Magic `Admin::Nodes` builder scope is no longer prepended by `Releaf::Content::NodesController`.

  This is no longer needed because releaf controllers can now be extended
  and the child controllers can have their own builders.

  Note that controller assets are not automatically inherited and need
  to be explicitly loaded by the child controller.

  Updating applications that use custom `Admin::Nodes` builder scope:
  (see Dummy application for a working example)

  1) Create `Admin::NodesController < Releaf::Content::NodesController`

  2) Change releaf menu in `config/initializers/releaf.rb`:

     Instead of
     ```ruby
     {
       :controller => 'releaf/content/nodes',
       :icon => 'sitemap',
     }
     ```

     Use
     ```ruby
     { :controller => 'admin/nodes' }
     ```

  3) Override node resource configuration in `config/initializers/releaf.rb`:

     Add the following:
     ```ruby
     config.content_resources = { 'Node' => { controller: 'Admin::NodesController' } }
     ```

  4) Create `app/assets/javascripts/controllers/admin/nodes.js` with the following content:
    ```
    //= require releaf/controllers/releaf/content/nodes
    ```

  5) Create `app/assets/stylesheets/controllers/admin/nodes.scss` with the following content:
    ```
    @import 'releaf/controllers/releaf/content/nodes';
    ```

  6) Update `default_controller` of existing users in DB to use the new controller name

  7) Update existing role permissions in DB to use the new controller name

* Dummy application now uses an extended `Admin::Nodes` controller
  instead of the default `Releaf::Content::NodesController`

* `releaf_routes_for` helper has been renamed to `node_routes_for`.
* Multiple node models and controllers are now supported.

  Node resource configuration can be overriden via `content_resources` key
  in `config/initializers/releaf.rb`

  There are three typical scenarios:

  1) Default configuration

    Node model is called `Node` and handled by `Releaf::Content::NodesController`

    Nothing needs to be changed for this to work
    except renaming `releaf_routes_for` to `node_routes_for` in `routes.rb`

  2) Custom node model and/or controller

    For example, if a model called `SomeOtherNode` needs to be used instead of `Node`
    and it will be handled in admin by `Admin::NodesController`, then the configuration
    looks as follows:

    ```ruby
    config.content_resources = { 'SomeOtherNode' => { controller: 'Admin::NodesController' } }
    ```

  3) Multiple per-site node models in separate content trees

    When a single application needs to handle multiple separate websites
    with separate content trees, multiple node models can be used.

    An example configuration would look as follows.

    In `config/initializers/releaf.rb`:

    ```ruby
    config.content_resources = {
      'Node' => {
        controller: 'Releaf::Content::NodesController',
        routing: {
          site: "main_site",
          constraints: { host: /^releaf\.local$/ }
        }
      },
      'OtherSite::OtherNode' => {
        controller: 'Admin::OtherSite::OtherNodesController',
        routing: {
          site: "other_site",
          constraints: { host: /^other\.releaf\.local$/ }
        }
      }
    }
    ```

    In `routes.rb`:

    ```ruby
    node_routing( Releaf::Content.routing ) do

      node_routes_for(HomePage) do
        get 'show', as: "home_page"
      end

      node_routes_for(TextPage) do
        get 'show'
      end

    end
    ```

    This configuration would mean that all `HomePage` and `TextPage` nodes
    with `Node` class would have their routes drawn
    constrained to `http:://releaf.local/` host name
    and all `HomePage` and `TextPage` nodes using `OtherSite::OtherNode` node class
    would only have routes for `http://other.releaf.local/` website.

    The drawn routes will have extra parameters `site` and `node_class` passed to them
    that can be used in the public website if needed. See `#node_class` and `#site`
    methods in `application_controller.rb` of Dummy application for example usage.

    Each node tree can have its own structure and content types. Add structure validations
    to specific node models as needed.

    If a node content type needs to only be available in a single site,
    the `node_routing` automation block can be omitted and the corresponding routes
    can be drawn for a specific node class and constrained manually:

    ```ruby
    constraints Releaf::Content.routing['OtherSite::OtherNode'][:constraints] do
      node_routes_for(ContactsController, node_class: 'OtherSite::OtherNode') do
        get 'show', as: "contacts_page"
      end
    end
{'fraction_non_alphanumeric': 0.08778035576179427, 'fraction_numerical': 0.0034802784222737818, 'mean_word_length': 3.3357082984073765, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 17, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3247867', 'n_tokens_mistral': 2859, 'n_tokens_neox': 2747, 'n_words': 1081}