EtsComfyBlog 0.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +7 -0
 - data/.github/issue_template.md +22 -0
 - data/.github/pull_request_template.md +6 -0
 - data/.gitignore +16 -0
 - data/.rubocop.yml +96 -0
 - data/.travis.yml +21 -0
 - data/CONTRIBUTING.md +32 -0
 - data/Gemfile +27 -0
 - data/LICENSE +20 -0
 - data/README.md +42 -0
 - data/Rakefile +5 -0
 - data/app/controllers/comfy/admin/blog/posts_controller.rb +84 -0
 - data/app/controllers/comfy/admin/blog/revisions/post_controller.rb +30 -0
 - data/app/controllers/comfy/blog/posts_controller.rb +50 -0
 - data/app/models/comfy/blog/post.rb +55 -0
 - data/app/views/comfy/admin/blog/partials/_navigation.html.haml +4 -0
 - data/app/views/comfy/admin/blog/posts/_form.html.haml +22 -0
 - data/app/views/comfy/admin/blog/posts/edit.html.haml +9 -0
 - data/app/views/comfy/admin/blog/posts/index.html.haml +37 -0
 - data/app/views/comfy/admin/blog/posts/new.html.haml +5 -0
 - data/app/views/comfy/blog/posts/index.html.haml +28 -0
 - data/app/views/comfy/blog/posts/index.rss.builder +22 -0
 - data/app/views/comfy/blog/posts/show.html.haml +8 -0
 - data/app/views/layouts/comfy/blog/application.html.erb +22 -0
 - data/bin/bundle +3 -0
 - data/bin/rails +4 -0
 - data/bin/rake +4 -0
 - data/bin/setup +36 -0
 - data/bin/update +31 -0
 - data/bin/yarn +11 -0
 - data/comfy_blog.gemspec +28 -0
 - data/config.ru +6 -0
 - data/config/application.rb +39 -0
 - data/config/blog_routes.rb +8 -0
 - data/config/boot.rb +7 -0
 - data/config/database.yml +11 -0
 - data/config/environment.rb +7 -0
 - data/config/environments/development.rb +64 -0
 - data/config/environments/test.rb +51 -0
 - data/config/initializers/comfy_blog.rb +9 -0
 - data/config/locales/ca.yml +38 -0
 - data/config/locales/cs.yml +38 -0
 - data/config/locales/da.yml +38 -0
 - data/config/locales/de.yml +38 -0
 - data/config/locales/en.yml +38 -0
 - data/config/locales/es.yml +38 -0
 - data/config/locales/fi.yml +38 -0
 - data/config/locales/fr.yml +38 -0
 - data/config/locales/gr.yml +38 -0
 - data/config/locales/it.yml +38 -0
 - data/config/locales/ja.yml +38 -0
 - data/config/locales/nb.yml +38 -0
 - data/config/locales/nl.yml +38 -0
 - data/config/locales/pl.yml +38 -0
 - data/config/locales/pt-BR.yml +38 -0
 - data/config/locales/ru.yml +38 -0
 - data/config/locales/sv.yml +38 -0
 - data/config/locales/tr.yml +38 -0
 - data/config/locales/uk.yml +38 -0
 - data/config/locales/zh-CN.yml +38 -0
 - data/config/locales/zh-TW.yml +38 -0
 - data/config/storage.yml +35 -0
 - data/db/migrate/00_create_cms.rb +167 -0
 - data/db/migrate/01_create_blog.rb +24 -0
 - data/lib/comfy_blog.rb +29 -0
 - data/lib/comfy_blog/configuration.rb +24 -0
 - data/lib/comfy_blog/engine.rb +32 -0
 - data/lib/comfy_blog/routes/blog.rb +21 -0
 - data/lib/comfy_blog/routes/blog_admin.rb +23 -0
 - data/lib/comfy_blog/routing.rb +4 -0
 - data/lib/comfy_blog/version.rb +7 -0
 - data/lib/generators/comfy/blog/README +10 -0
 - data/lib/generators/comfy/blog/blog_generator.rb +53 -0
 - metadata +129 -0
 
    
        checksums.yaml
    ADDED
    
    | 
         @@ -0,0 +1,7 @@ 
     | 
|
| 
      
 1 
     | 
    
         
            +
            ---
         
     | 
| 
      
 2 
     | 
    
         
            +
            SHA256:
         
     | 
| 
      
 3 
     | 
    
         
            +
              metadata.gz: f7e721b98500c538d8bdd384127d54d73f5f5115a52eb1e24a40c63bc1ac9f83
         
     | 
| 
      
 4 
     | 
    
         
            +
              data.tar.gz: 629a674deeede0ef98484b53d741fba026511cd4303ad63805a7278a4460469f
         
     | 
| 
      
 5 
     | 
    
         
            +
            SHA512:
         
     | 
| 
      
 6 
     | 
    
         
            +
              metadata.gz: '0059b34da826f41fae235d31896599df418cf8729285c51d0548b3d02e180c0ab5f6d376a0209b00df649c76b1ef4ad9b9bbd3f3e360ebb5dc2a2d0d4384a17d'
         
     | 
| 
      
 7 
     | 
    
         
            +
              data.tar.gz: c0f81ce6c496690dc8f660443cfa5e1669094463fe5aea5d65fd4993ba0e58d9cd64b4e28e2bed19b422bf7e7e0b31703974d9abc8ed3da356cdd2e7453f11ec
         
     | 
| 
         @@ -0,0 +1,22 @@ 
     | 
|
| 
      
 1 
     | 
    
         
            +
            *Note:* For general questions and feature requests please leave a message
         
     | 
| 
      
 2 
     | 
    
         
            +
            on Gitter: https://gitter.im/comfy/comfortable-mexican-sofa
         
     | 
| 
      
 3 
     | 
    
         
            +
             
     | 
| 
      
 4 
     | 
    
         
            +
            ### Expected behavior
         
     | 
| 
      
 5 
     | 
    
         
            +
            Tell us what should happen
         
     | 
| 
      
 6 
     | 
    
         
            +
             
     | 
| 
      
 7 
     | 
    
         
            +
            ### Actual behavior
         
     | 
| 
      
 8 
     | 
    
         
            +
            Tell us what happens instead
         
     | 
| 
      
 9 
     | 
    
         
            +
             
     | 
| 
      
 10 
     | 
    
         
            +
            ### Steps to reproduce
         
     | 
| 
      
 11 
     | 
    
         
            +
            Things that help:
         
     | 
| 
      
 12 
     | 
    
         
            +
             
     | 
| 
      
 13 
     | 
    
         
            +
            * Describe issue in detail.
         
     | 
| 
      
 14 
     | 
    
         
            +
            * Add relevant code snippets.
         
     | 
| 
      
 15 
     | 
    
         
            +
            * Create a failing test case.
         
     | 
| 
      
 16 
     | 
    
         
            +
             
     | 
| 
      
 17 
     | 
    
         
            +
            ### System configuration
         
     | 
| 
      
 18 
     | 
    
         
            +
            **Rails version**:
         
     | 
| 
      
 19 
     | 
    
         
            +
             
     | 
| 
      
 20 
     | 
    
         
            +
            **CMS version**:
         
     | 
| 
      
 21 
     | 
    
         
            +
             
     | 
| 
      
 22 
     | 
    
         
            +
            **Ruby version**:
         
     | 
    
        data/.gitignore
    ADDED
    
    
    
        data/.rubocop.yml
    ADDED
    
    | 
         @@ -0,0 +1,96 @@ 
     | 
|
| 
      
 1 
     | 
    
         
            +
            AllCops:
         
     | 
| 
      
 2 
     | 
    
         
            +
              TargetRubyVersion: 2.3
         
     | 
| 
      
 3 
     | 
    
         
            +
              Exclude:
         
     | 
| 
      
 4 
     | 
    
         
            +
                - bin/*
         
     | 
| 
      
 5 
     | 
    
         
            +
                - db/schema.rb
         
     | 
| 
      
 6 
     | 
    
         
            +
                - db/migrate/**/*
         
     | 
| 
      
 7 
     | 
    
         
            +
                - test/fixtures/**/*
         
     | 
| 
      
 8 
     | 
    
         
            +
                - tmp/**/*
         
     | 
| 
      
 9 
     | 
    
         
            +
             
     | 
| 
      
 10 
     | 
    
         
            +
            # -- Performance ---------------------------------------------------------------
         
     | 
| 
      
 11 
     | 
    
         
            +
            Performance/Casecmp:
         
     | 
| 
      
 12 
     | 
    
         
            +
              Enabled: false
         
     | 
| 
      
 13 
     | 
    
         
            +
             
     | 
| 
      
 14 
     | 
    
         
            +
            # -- Metrics -------------------------------------------------------------------
         
     | 
| 
      
 15 
     | 
    
         
            +
            Metrics/PerceivedComplexity:
         
     | 
| 
      
 16 
     | 
    
         
            +
              Enabled: false
         
     | 
| 
      
 17 
     | 
    
         
            +
             
     | 
| 
      
 18 
     | 
    
         
            +
            Metrics/MethodLength:
         
     | 
| 
      
 19 
     | 
    
         
            +
              Enabled: false
         
     | 
| 
      
 20 
     | 
    
         
            +
             
     | 
| 
      
 21 
     | 
    
         
            +
            Metrics/MethodLength:
         
     | 
| 
      
 22 
     | 
    
         
            +
              Enabled: false
         
     | 
| 
      
 23 
     | 
    
         
            +
             
     | 
| 
      
 24 
     | 
    
         
            +
            Metrics/ParameterLists:
         
     | 
| 
      
 25 
     | 
    
         
            +
              Enabled: false
         
     | 
| 
      
 26 
     | 
    
         
            +
             
     | 
| 
      
 27 
     | 
    
         
            +
            Metrics/LineLength:
         
     | 
| 
      
 28 
     | 
    
         
            +
              Max: 120
         
     | 
| 
      
 29 
     | 
    
         
            +
             
     | 
| 
      
 30 
     | 
    
         
            +
            Metrics/CyclomaticComplexity:
         
     | 
| 
      
 31 
     | 
    
         
            +
              Enabled: false
         
     | 
| 
      
 32 
     | 
    
         
            +
             
     | 
| 
      
 33 
     | 
    
         
            +
            Metrics/ClassLength:
         
     | 
| 
      
 34 
     | 
    
         
            +
              Enabled: false
         
     | 
| 
      
 35 
     | 
    
         
            +
             
     | 
| 
      
 36 
     | 
    
         
            +
            Metrics/BlockLength:
         
     | 
| 
      
 37 
     | 
    
         
            +
              Enabled: false
         
     | 
| 
      
 38 
     | 
    
         
            +
             
     | 
| 
      
 39 
     | 
    
         
            +
            Metrics/AbcSize:
         
     | 
| 
      
 40 
     | 
    
         
            +
              Enabled: false
         
     | 
| 
      
 41 
     | 
    
         
            +
             
     | 
| 
      
 42 
     | 
    
         
            +
            # -- Layout --------------------------------------------------------------------
         
     | 
| 
      
 43 
     | 
    
         
            +
            Layout/MultilineOperationIndentation:
         
     | 
| 
      
 44 
     | 
    
         
            +
              Enabled: false
         
     | 
| 
      
 45 
     | 
    
         
            +
             
     | 
| 
      
 46 
     | 
    
         
            +
            Layout/MultilineMethodCallIndentation:
         
     | 
| 
      
 47 
     | 
    
         
            +
              EnforcedStyle: indented
         
     | 
| 
      
 48 
     | 
    
         
            +
             
     | 
| 
      
 49 
     | 
    
         
            +
            Layout/MultilineHashBraceLayout:
         
     | 
| 
      
 50 
     | 
    
         
            +
              Enabled: false
         
     | 
| 
      
 51 
     | 
    
         
            +
             
     | 
| 
      
 52 
     | 
    
         
            +
            Layout/IndentArray:
         
     | 
| 
      
 53 
     | 
    
         
            +
              EnforcedStyle: consistent
         
     | 
| 
      
 54 
     | 
    
         
            +
             
     | 
| 
      
 55 
     | 
    
         
            +
            Layout/EmptyLinesAroundModuleBody:
         
     | 
| 
      
 56 
     | 
    
         
            +
              EnforcedStyle: empty_lines_except_namespace
         
     | 
| 
      
 57 
     | 
    
         
            +
             
     | 
| 
      
 58 
     | 
    
         
            +
            Layout/EmptyLinesAroundExceptionHandlingKeywords:
         
     | 
| 
      
 59 
     | 
    
         
            +
              Enabled: false
         
     | 
| 
      
 60 
     | 
    
         
            +
             
     | 
| 
      
 61 
     | 
    
         
            +
            Layout/EmptyLinesAroundClassBody:
         
     | 
| 
      
 62 
     | 
    
         
            +
              EnforcedStyle: empty_lines_except_namespace
         
     | 
| 
      
 63 
     | 
    
         
            +
             
     | 
| 
      
 64 
     | 
    
         
            +
            Layout/AlignParameters:
         
     | 
| 
      
 65 
     | 
    
         
            +
              Enabled: false
         
     | 
| 
      
 66 
     | 
    
         
            +
             
     | 
| 
      
 67 
     | 
    
         
            +
            Layout/AccessModifierIndentation:
         
     | 
| 
      
 68 
     | 
    
         
            +
              EnforcedStyle: outdent
         
     | 
| 
      
 69 
     | 
    
         
            +
             
     | 
| 
      
 70 
     | 
    
         
            +
            # -- Style ---------------------------------------------------------------------
         
     | 
| 
      
 71 
     | 
    
         
            +
            Style/StringLiterals:
         
     | 
| 
      
 72 
     | 
    
         
            +
              EnforcedStyle: double_quotes
         
     | 
| 
      
 73 
     | 
    
         
            +
             
     | 
| 
      
 74 
     | 
    
         
            +
            Style/RegexpLiteral:
         
     | 
| 
      
 75 
     | 
    
         
            +
              EnforcedStyle: percent_r
         
     | 
| 
      
 76 
     | 
    
         
            +
             
     | 
| 
      
 77 
     | 
    
         
            +
            Style/Lambda:
         
     | 
| 
      
 78 
     | 
    
         
            +
              EnforcedStyle: literal
         
     | 
| 
      
 79 
     | 
    
         
            +
             
     | 
| 
      
 80 
     | 
    
         
            +
            Style/IfUnlessModifier:
         
     | 
| 
      
 81 
     | 
    
         
            +
              Enabled: false
         
     | 
| 
      
 82 
     | 
    
         
            +
             
     | 
| 
      
 83 
     | 
    
         
            +
            Style/GuardClause:
         
     | 
| 
      
 84 
     | 
    
         
            +
              Enabled: false
         
     | 
| 
      
 85 
     | 
    
         
            +
             
     | 
| 
      
 86 
     | 
    
         
            +
            Style/Documentation:
         
     | 
| 
      
 87 
     | 
    
         
            +
              Enabled: false
         
     | 
| 
      
 88 
     | 
    
         
            +
             
     | 
| 
      
 89 
     | 
    
         
            +
            Style/DateTime:
         
     | 
| 
      
 90 
     | 
    
         
            +
              Enabled: false
         
     | 
| 
      
 91 
     | 
    
         
            +
             
     | 
| 
      
 92 
     | 
    
         
            +
            Style/ClassAndModuleChildren:
         
     | 
| 
      
 93 
     | 
    
         
            +
              Enabled: false
         
     | 
| 
      
 94 
     | 
    
         
            +
             
     | 
| 
      
 95 
     | 
    
         
            +
            Style/AsciiComments:
         
     | 
| 
      
 96 
     | 
    
         
            +
              Enabled: false
         
     | 
    
        data/.travis.yml
    ADDED
    
    | 
         @@ -0,0 +1,21 @@ 
     | 
|
| 
      
 1 
     | 
    
         
            +
            language: ruby
         
     | 
| 
      
 2 
     | 
    
         
            +
            rvm:
         
     | 
| 
      
 3 
     | 
    
         
            +
              - 2.3.7
         
     | 
| 
      
 4 
     | 
    
         
            +
              - 2.4.4
         
     | 
| 
      
 5 
     | 
    
         
            +
              - 2.5.1
         
     | 
| 
      
 6 
     | 
    
         
            +
              - ruby-head
         
     | 
| 
      
 7 
     | 
    
         
            +
            gemfile:
         
     | 
| 
      
 8 
     | 
    
         
            +
              - test/gemfiles/5.2.gemfile
         
     | 
| 
      
 9 
     | 
    
         
            +
            branches:
         
     | 
| 
      
 10 
     | 
    
         
            +
              only:
         
     | 
| 
      
 11 
     | 
    
         
            +
                - master
         
     | 
| 
      
 12 
     | 
    
         
            +
            before_install:
         
     | 
| 
      
 13 
     | 
    
         
            +
              - gem update --system
         
     | 
| 
      
 14 
     | 
    
         
            +
              - gem update bundler
         
     | 
| 
      
 15 
     | 
    
         
            +
            script:
         
     | 
| 
      
 16 
     | 
    
         
            +
              - bundle exec rake db:migrate
         
     | 
| 
      
 17 
     | 
    
         
            +
              - bundle exec rake test
         
     | 
| 
      
 18 
     | 
    
         
            +
              - bundle exec rubocop
         
     | 
| 
      
 19 
     | 
    
         
            +
            matrix:
         
     | 
| 
      
 20 
     | 
    
         
            +
              allow_failures:
         
     | 
| 
      
 21 
     | 
    
         
            +
                - rvm: ruby-head
         
     | 
    
        data/CONTRIBUTING.md
    ADDED
    
    | 
         @@ -0,0 +1,32 @@ 
     | 
|
| 
      
 1 
     | 
    
         
            +
            # Contributing
         
     | 
| 
      
 2 
     | 
    
         
            +
             
     | 
| 
      
 3 
     | 
    
         
            +
            Contribute your code to ComfyBlog in 5 easy steps:
         
     | 
| 
      
 4 
     | 
    
         
            +
             
     | 
| 
      
 5 
     | 
    
         
            +
            ### 1. Fork it
         
     | 
| 
      
 6 
     | 
    
         
            +
             
     | 
| 
      
 7 
     | 
    
         
            +
            Fork the project. Optionally, create a branch you want to work on.
         
     | 
| 
      
 8 
     | 
    
         
            +
             
     | 
| 
      
 9 
     | 
    
         
            +
            ### 2. Get it running locally
         
     | 
| 
      
 10 
     | 
    
         
            +
             
     | 
| 
      
 11 
     | 
    
         
            +
            - Install gem dependencies with `bundle install`
         
     | 
| 
      
 12 
     | 
    
         
            +
            - There's nothing to configure, by default database is SQLite so it will be created for you.
         
     | 
| 
      
 13 
     | 
    
         
            +
              Just run `rake db:migrate`
         
     | 
| 
      
 14 
     | 
    
         
            +
            - Make sure that existing tests are passing by running `rake test`
         
     | 
| 
      
 15 
     | 
    
         
            +
            - You should be able to start the app via `rails s` and navigate to http://localhost:3000/admin
         
     | 
| 
      
 16 
     | 
    
         
            +
             
     | 
| 
      
 17 
     | 
    
         
            +
            ### 3. Hack away
         
     | 
| 
      
 18 
     | 
    
         
            +
             
     | 
| 
      
 19 
     | 
    
         
            +
            - Create a few small pull requests instead of a humoungous one. I can merge small stuff faster.
         
     | 
| 
      
 20 
     | 
    
         
            +
            - When adding new code just make sure it follows the same slyle as the existing code.
         
     | 
| 
      
 21 
     | 
    
         
            +
            - Avoid adding 3rd party dependencies if you can.
         
     | 
| 
      
 22 
     | 
    
         
            +
            - Tests please, but nothing complicated. UnitTest / Fixtures all the way. Make sure all tests pass.
         
     | 
| 
      
 23 
     | 
    
         
            +
            - Run `bundle exec rubocop` and fix any issues raised.
         
     | 
| 
      
 24 
     | 
    
         
            +
             
     | 
| 
      
 25 
     | 
    
         
            +
            ### 4. Make a pull request
         
     | 
| 
      
 26 
     | 
    
         
            +
             
     | 
| 
      
 27 
     | 
    
         
            +
            - If you never done it before read this: https://help.github.com/articles/using-pull-requests
         
     | 
| 
      
 28 
     | 
    
         
            +
            - When PR is submitted check if TravisCI ran all tests successfully and Rubocop didn't raise any issues
         
     | 
| 
      
 29 
     | 
    
         
            +
             
     | 
| 
      
 30 
     | 
    
         
            +
            ### 5. Done!
         
     | 
| 
      
 31 
     | 
    
         
            +
             
     | 
| 
      
 32 
     | 
    
         
            +
            If everything is good your changes will be merged into master branch. Eventually a new version of gem will be published.
         
     | 
    
        data/Gemfile
    ADDED
    
    | 
         @@ -0,0 +1,27 @@ 
     | 
|
| 
      
 1 
     | 
    
         
            +
            # frozen_string_literal: true
         
     | 
| 
      
 2 
     | 
    
         
            +
             
     | 
| 
      
 3 
     | 
    
         
            +
            source "http://rubygems.org"
         
     | 
| 
      
 4 
     | 
    
         
            +
             
     | 
| 
      
 5 
     | 
    
         
            +
            gemspec
         
     | 
| 
      
 6 
     | 
    
         
            +
             
     | 
| 
      
 7 
     | 
    
         
            +
            # CMS has dependency on prerelease and Bundler chokes on it
         
     | 
| 
      
 8 
     | 
    
         
            +
            gem "rails", "~> 5.2.0.rc1"
         
     | 
| 
      
 9 
     | 
    
         
            +
             
     | 
| 
      
 10 
     | 
    
         
            +
            group :development, :test do
         
     | 
| 
      
 11 
     | 
    
         
            +
              gem "byebug",   "~> 10.0.0", platforms: %i[mri mingw x64_mingw]
         
     | 
| 
      
 12 
     | 
    
         
            +
              gem "kaminari", "~> 1.1.1"
         
     | 
| 
      
 13 
     | 
    
         
            +
              gem "puma",     "~> 3.11.2"
         
     | 
| 
      
 14 
     | 
    
         
            +
              gem "rubocop",  "~> 0.55.0", require: false
         
     | 
| 
      
 15 
     | 
    
         
            +
              gem "sqlite3",  "~> 1.3.13"
         
     | 
| 
      
 16 
     | 
    
         
            +
            end
         
     | 
| 
      
 17 
     | 
    
         
            +
             
     | 
| 
      
 18 
     | 
    
         
            +
            group :development do
         
     | 
| 
      
 19 
     | 
    
         
            +
              gem "listen",       "~> 3.1.5"
         
     | 
| 
      
 20 
     | 
    
         
            +
              gem "web-console",  "~> 3.5.1"
         
     | 
| 
      
 21 
     | 
    
         
            +
            end
         
     | 
| 
      
 22 
     | 
    
         
            +
             
     | 
| 
      
 23 
     | 
    
         
            +
            group :test do
         
     | 
| 
      
 24 
     | 
    
         
            +
              gem "coveralls",                "~> 0.8.21", require: false
         
     | 
| 
      
 25 
     | 
    
         
            +
              gem "mocha",                    "~> 1.3.0", require: false
         
     | 
| 
      
 26 
     | 
    
         
            +
              gem "rails-controller-testing", "~> 1.0.2"
         
     | 
| 
      
 27 
     | 
    
         
            +
            end
         
     | 
    
        data/LICENSE
    ADDED
    
    | 
         @@ -0,0 +1,20 @@ 
     | 
|
| 
      
 1 
     | 
    
         
            +
            Copyright 2013-2018 Oleg Khabarov
         
     | 
| 
      
 2 
     | 
    
         
            +
             
     | 
| 
      
 3 
     | 
    
         
            +
            Permission is hereby granted, free of charge, to any person obtaining
         
     | 
| 
      
 4 
     | 
    
         
            +
            a copy of this software and associated documentation files (the
         
     | 
| 
      
 5 
     | 
    
         
            +
            "Software"), to deal in the Software without restriction, including
         
     | 
| 
      
 6 
     | 
    
         
            +
            without limitation the rights to use, copy, modify, merge, publish,
         
     | 
| 
      
 7 
     | 
    
         
            +
            distribute, sublicense, and/or sell copies of the Software, and to
         
     | 
| 
      
 8 
     | 
    
         
            +
            permit persons to whom the Software is furnished to do so, subject to
         
     | 
| 
      
 9 
     | 
    
         
            +
            the following conditions:
         
     | 
| 
      
 10 
     | 
    
         
            +
             
     | 
| 
      
 11 
     | 
    
         
            +
            The above copyright notice and this permission notice shall be
         
     | 
| 
      
 12 
     | 
    
         
            +
            included in all copies or substantial portions of the Software.
         
     | 
| 
      
 13 
     | 
    
         
            +
             
     | 
| 
      
 14 
     | 
    
         
            +
            THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
         
     | 
| 
      
 15 
     | 
    
         
            +
            EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
         
     | 
| 
      
 16 
     | 
    
         
            +
            MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
         
     | 
| 
      
 17 
     | 
    
         
            +
            NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
         
     | 
| 
      
 18 
     | 
    
         
            +
            LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
         
     | 
| 
      
 19 
     | 
    
         
            +
            OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
         
     | 
| 
      
 20 
     | 
    
         
            +
            WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
         
     | 
    
        data/README.md
    ADDED
    
    | 
         @@ -0,0 +1,42 @@ 
     | 
|
| 
      
 1 
     | 
    
         
            +
            # ComfyBlog
         
     | 
| 
      
 2 
     | 
    
         
            +
             
     | 
| 
      
 3 
     | 
    
         
            +
            ComfyBlog is a simple blog management engine for [ComfortableMexicanSofa](https://github.com/comfy/comfortable-mexican-sofa)
         
     | 
| 
      
 4 
     | 
    
         
            +
             
     | 
| 
      
 5 
     | 
    
         
            +
            [](http://rubygems.org/gems/comfy_blog)
         
     | 
| 
      
 6 
     | 
    
         
            +
            [](http://rubygems.org/gems/comfy_blog)
         
     | 
| 
      
 7 
     | 
    
         
            +
            [](https://travis-ci.org/comfy/comfy-blog)
         
     | 
| 
      
 8 
     | 
    
         
            +
            [](https://coveralls.io/r/comfy/comfy-blog?branch=master)
         
     | 
| 
      
 9 
     | 
    
         
            +
            [](https://gitter.im/comfy/comfortable-mexican-sofa)
         
     | 
| 
      
 10 
     | 
    
         
            +
             
     | 
| 
      
 11 
     | 
    
         
            +
            ## Dependencies
         
     | 
| 
      
 12 
     | 
    
         
            +
             
     | 
| 
      
 13 
     | 
    
         
            +
            Make sure that you have [ComfortableMexicanSofa](https://github.com/comfy/comfortable-mexican-sofa) installed first.
         
     | 
| 
      
 14 
     | 
    
         
            +
             
     | 
| 
      
 15 
     | 
    
         
            +
            ## Installation
         
     | 
| 
      
 16 
     | 
    
         
            +
             
     | 
| 
      
 17 
     | 
    
         
            +
            Add gem definition to your Gemfile:
         
     | 
| 
      
 18 
     | 
    
         
            +
             
     | 
| 
      
 19 
     | 
    
         
            +
            ```ruby
         
     | 
| 
      
 20 
     | 
    
         
            +
            gem "comfy_blog", "~> 2.0.0"
         
     | 
| 
      
 21 
     | 
    
         
            +
            ```
         
     | 
| 
      
 22 
     | 
    
         
            +
             
     | 
| 
      
 23 
     | 
    
         
            +
            Then from the Rails project's root run:
         
     | 
| 
      
 24 
     | 
    
         
            +
             
     | 
| 
      
 25 
     | 
    
         
            +
                bundle install
         
     | 
| 
      
 26 
     | 
    
         
            +
                rails generate comfy:blog
         
     | 
| 
      
 27 
     | 
    
         
            +
                rake db:migrate
         
     | 
| 
      
 28 
     | 
    
         
            +
             
     | 
| 
      
 29 
     | 
    
         
            +
            Take a look inside your `config/routes.rb` file and you should see following lines there:
         
     | 
| 
      
 30 
     | 
    
         
            +
             
     | 
| 
      
 31 
     | 
    
         
            +
            ```ruby
         
     | 
| 
      
 32 
     | 
    
         
            +
            comfy_route :blog_admin, path: "admin"
         
     | 
| 
      
 33 
     | 
    
         
            +
            comfy_route :blog, path: "blog"
         
     | 
| 
      
 34 
     | 
    
         
            +
            ```
         
     | 
| 
      
 35 
     | 
    
         
            +
             
     | 
| 
      
 36 
     | 
    
         
            +
            You should also find view templates in `/app/views/blog` folder. Feel free to adjust them as you see fit.
         
     | 
| 
      
 37 
     | 
    
         
            +
             
     | 
| 
      
 38 
     | 
    
         
            +
            
         
     | 
| 
      
 39 
     | 
    
         
            +
             
     | 
| 
      
 40 
     | 
    
         
            +
            ---
         
     | 
| 
      
 41 
     | 
    
         
            +
             
     | 
| 
      
 42 
     | 
    
         
            +
            Copyright 2009-2018 Oleg Khabarov
         
     | 
    
        data/Rakefile
    ADDED
    
    
| 
         @@ -0,0 +1,84 @@ 
     | 
|
| 
      
 1 
     | 
    
         
            +
            # frozen_string_literal: true
         
     | 
| 
      
 2 
     | 
    
         
            +
             
     | 
| 
      
 3 
     | 
    
         
            +
            class Comfy::Admin::Blog::PostsController < Comfy::Admin::Cms::BaseController
         
     | 
| 
      
 4 
     | 
    
         
            +
             
     | 
| 
      
 5 
     | 
    
         
            +
              before_action :build_post, only: %i[new create]
         
     | 
| 
      
 6 
     | 
    
         
            +
              before_action :load_post,  only: %i[edit update destroy]
         
     | 
| 
      
 7 
     | 
    
         
            +
              before_action :authorize
         
     | 
| 
      
 8 
     | 
    
         
            +
             
     | 
| 
      
 9 
     | 
    
         
            +
              def index
         
     | 
| 
      
 10 
     | 
    
         
            +
                return redirect_to action: :new if @site.blog_posts.count.zero?
         
     | 
| 
      
 11 
     | 
    
         
            +
             
     | 
| 
      
 12 
     | 
    
         
            +
                posts_scope = @site.blog_posts
         
     | 
| 
      
 13 
     | 
    
         
            +
                  .includes(:categories)
         
     | 
| 
      
 14 
     | 
    
         
            +
                  .for_category(params[:categories])
         
     | 
| 
      
 15 
     | 
    
         
            +
                  .order(published_at: :desc)
         
     | 
| 
      
 16 
     | 
    
         
            +
                @posts = comfy_paginate(posts_scope)
         
     | 
| 
      
 17 
     | 
    
         
            +
              end
         
     | 
| 
      
 18 
     | 
    
         
            +
             
     | 
| 
      
 19 
     | 
    
         
            +
              def new
         
     | 
| 
      
 20 
     | 
    
         
            +
                render
         
     | 
| 
      
 21 
     | 
    
         
            +
              end
         
     | 
| 
      
 22 
     | 
    
         
            +
             
     | 
| 
      
 23 
     | 
    
         
            +
              def create
         
     | 
| 
      
 24 
     | 
    
         
            +
                @post.save!
         
     | 
| 
      
 25 
     | 
    
         
            +
                flash[:success] = t(".created")
         
     | 
| 
      
 26 
     | 
    
         
            +
                redirect_to action: :edit, id: @post
         
     | 
| 
      
 27 
     | 
    
         
            +
             
     | 
| 
      
 28 
     | 
    
         
            +
              rescue ActiveRecord::RecordInvalid
         
     | 
| 
      
 29 
     | 
    
         
            +
                flash.now[:danger] = t(".create_failure")
         
     | 
| 
      
 30 
     | 
    
         
            +
                render action: :new
         
     | 
| 
      
 31 
     | 
    
         
            +
              end
         
     | 
| 
      
 32 
     | 
    
         
            +
             
     | 
| 
      
 33 
     | 
    
         
            +
              def edit
         
     | 
| 
      
 34 
     | 
    
         
            +
                render
         
     | 
| 
      
 35 
     | 
    
         
            +
              end
         
     | 
| 
      
 36 
     | 
    
         
            +
             
     | 
| 
      
 37 
     | 
    
         
            +
              def update
         
     | 
| 
      
 38 
     | 
    
         
            +
                @post.update_attributes!(post_params)
         
     | 
| 
      
 39 
     | 
    
         
            +
                flash[:success] = t(".updated")
         
     | 
| 
      
 40 
     | 
    
         
            +
                redirect_to action: :edit, id: @post
         
     | 
| 
      
 41 
     | 
    
         
            +
             
     | 
| 
      
 42 
     | 
    
         
            +
              rescue ActiveRecord::RecordInvalid
         
     | 
| 
      
 43 
     | 
    
         
            +
                flash.now[:danger] = t(".update_failure")
         
     | 
| 
      
 44 
     | 
    
         
            +
                render action: :edit
         
     | 
| 
      
 45 
     | 
    
         
            +
              end
         
     | 
| 
      
 46 
     | 
    
         
            +
             
     | 
| 
      
 47 
     | 
    
         
            +
              def destroy
         
     | 
| 
      
 48 
     | 
    
         
            +
                @post.destroy
         
     | 
| 
      
 49 
     | 
    
         
            +
                flash[:success] = t(".deleted")
         
     | 
| 
      
 50 
     | 
    
         
            +
                redirect_to action: :index
         
     | 
| 
      
 51 
     | 
    
         
            +
              end
         
     | 
| 
      
 52 
     | 
    
         
            +
             
     | 
| 
      
 53 
     | 
    
         
            +
              def form_fragments
         
     | 
| 
      
 54 
     | 
    
         
            +
                @post = @site.blog_posts.find_by(id: params[:id]) || @site.blog_posts.new
         
     | 
| 
      
 55 
     | 
    
         
            +
                @post.layout = @site.layouts.find_by(id: params[:layout_id])
         
     | 
| 
      
 56 
     | 
    
         
            +
             
     | 
| 
      
 57 
     | 
    
         
            +
                render(
         
     | 
| 
      
 58 
     | 
    
         
            +
                  partial:  "comfy/admin/cms/fragments/form_fragments",
         
     | 
| 
      
 59 
     | 
    
         
            +
                  locals:   { record: @post, scope: :post },
         
     | 
| 
      
 60 
     | 
    
         
            +
                  layout:   false
         
     | 
| 
      
 61 
     | 
    
         
            +
                )
         
     | 
| 
      
 62 
     | 
    
         
            +
              end
         
     | 
| 
      
 63 
     | 
    
         
            +
             
     | 
| 
      
 64 
     | 
    
         
            +
            protected
         
     | 
| 
      
 65 
     | 
    
         
            +
             
     | 
| 
      
 66 
     | 
    
         
            +
              def load_post
         
     | 
| 
      
 67 
     | 
    
         
            +
                @post = @site.blog_posts.find(params[:id])
         
     | 
| 
      
 68 
     | 
    
         
            +
              rescue ActiveRecord::RecordNotFound
         
     | 
| 
      
 69 
     | 
    
         
            +
                flash[:danger] = t(".not_found")
         
     | 
| 
      
 70 
     | 
    
         
            +
                redirect_to action: :index
         
     | 
| 
      
 71 
     | 
    
         
            +
              end
         
     | 
| 
      
 72 
     | 
    
         
            +
             
     | 
| 
      
 73 
     | 
    
         
            +
              def build_post
         
     | 
| 
      
 74 
     | 
    
         
            +
                layout = (@site.blog_posts.order(:created_at).last.try(:layout) || @site.layouts.order(:created_at).first)
         
     | 
| 
      
 75 
     | 
    
         
            +
                @post = @site.blog_posts.new(post_params)
         
     | 
| 
      
 76 
     | 
    
         
            +
                @post.published_at ||= Time.zone.now
         
     | 
| 
      
 77 
     | 
    
         
            +
                @post.layout ||= layout
         
     | 
| 
      
 78 
     | 
    
         
            +
              end
         
     | 
| 
      
 79 
     | 
    
         
            +
             
     | 
| 
      
 80 
     | 
    
         
            +
              def post_params
         
     | 
| 
      
 81 
     | 
    
         
            +
                params.fetch(:post, {}).permit!
         
     | 
| 
      
 82 
     | 
    
         
            +
              end
         
     | 
| 
      
 83 
     | 
    
         
            +
             
     | 
| 
      
 84 
     | 
    
         
            +
            end
         
     | 
| 
         @@ -0,0 +1,30 @@ 
     | 
|
| 
      
 1 
     | 
    
         
            +
            # frozen_string_literal: true
         
     | 
| 
      
 2 
     | 
    
         
            +
             
     | 
| 
      
 3 
     | 
    
         
            +
            class Comfy::Admin::Blog::Revisions::PostController < Comfy::Admin::Cms::Revisions::BaseController
         
     | 
| 
      
 4 
     | 
    
         
            +
             
     | 
| 
      
 5 
     | 
    
         
            +
              def show
         
     | 
| 
      
 6 
     | 
    
         
            +
                @current_content = @record.fragments.each_with_object({}) do |b, c|
         
     | 
| 
      
 7 
     | 
    
         
            +
                  c[b.identifier] = b.content
         
     | 
| 
      
 8 
     | 
    
         
            +
                end
         
     | 
| 
      
 9 
     | 
    
         
            +
                @versioned_content = @record.fragments.each_with_object({}) do |b, c|
         
     | 
| 
      
 10 
     | 
    
         
            +
                  data = @revision.data["fragments_attributes"].detect { |r| r[:identifier] == b.identifier }
         
     | 
| 
      
 11 
     | 
    
         
            +
                  c[b.identifier] = data.try(:[], :content)
         
     | 
| 
      
 12 
     | 
    
         
            +
                end
         
     | 
| 
      
 13 
     | 
    
         
            +
             
     | 
| 
      
 14 
     | 
    
         
            +
                render "comfy/admin/cms/revisions/show"
         
     | 
| 
      
 15 
     | 
    
         
            +
              end
         
     | 
| 
      
 16 
     | 
    
         
            +
             
     | 
| 
      
 17 
     | 
    
         
            +
            private
         
     | 
| 
      
 18 
     | 
    
         
            +
             
     | 
| 
      
 19 
     | 
    
         
            +
              def load_record
         
     | 
| 
      
 20 
     | 
    
         
            +
                @record = @site.blog_posts.find(params[:blog_post_id])
         
     | 
| 
      
 21 
     | 
    
         
            +
              rescue ActiveRecord::RecordNotFound
         
     | 
| 
      
 22 
     | 
    
         
            +
                flash[:danger] = I18n.t("comfy.admin.cms.revisions.record_not_found")
         
     | 
| 
      
 23 
     | 
    
         
            +
                redirect_to comfy_admin_blog_posts_path(@site)
         
     | 
| 
      
 24 
     | 
    
         
            +
              end
         
     | 
| 
      
 25 
     | 
    
         
            +
             
     | 
| 
      
 26 
     | 
    
         
            +
              def record_path
         
     | 
| 
      
 27 
     | 
    
         
            +
                edit_comfy_admin_blog_post_path(@site, @record)
         
     | 
| 
      
 28 
     | 
    
         
            +
              end
         
     | 
| 
      
 29 
     | 
    
         
            +
             
     | 
| 
      
 30 
     | 
    
         
            +
            end
         
     | 
| 
         @@ -0,0 +1,50 @@ 
     | 
|
| 
      
 1 
     | 
    
         
            +
            # frozen_string_literal: true
         
     | 
| 
      
 2 
     | 
    
         
            +
             
     | 
| 
      
 3 
     | 
    
         
            +
            class Comfy::Blog::PostsController < Comfy::Cms::BaseController
         
     | 
| 
      
 4 
     | 
    
         
            +
             
     | 
| 
      
 5 
     | 
    
         
            +
              include Comfy::Paginate
         
     | 
| 
      
 6 
     | 
    
         
            +
             
     | 
| 
      
 7 
     | 
    
         
            +
              def index
         
     | 
| 
      
 8 
     | 
    
         
            +
                scope =
         
     | 
| 
      
 9 
     | 
    
         
            +
                  if params[:year]
         
     | 
| 
      
 10 
     | 
    
         
            +
                    scope = @cms_site.blog_posts.published.for_year(params[:year])
         
     | 
| 
      
 11 
     | 
    
         
            +
                    params[:month] ? scope.for_month(params[:month]) : scope
         
     | 
| 
      
 12 
     | 
    
         
            +
                  else
         
     | 
| 
      
 13 
     | 
    
         
            +
                    @cms_site.blog_posts.published
         
     | 
| 
      
 14 
     | 
    
         
            +
                  end
         
     | 
| 
      
 15 
     | 
    
         
            +
             
     | 
| 
      
 16 
     | 
    
         
            +
                scope = scope.for_category(params[:category]) if params[:category]
         
     | 
| 
      
 17 
     | 
    
         
            +
                scope = scope.order(:published_at).reverse_order
         
     | 
| 
      
 18 
     | 
    
         
            +
             
     | 
| 
      
 19 
     | 
    
         
            +
                @blog_posts = comfy_paginate(scope, per_page: ComfyBlog.config.posts_per_page)
         
     | 
| 
      
 20 
     | 
    
         
            +
                render layout: ComfyBlog.config.app_layout
         
     | 
| 
      
 21 
     | 
    
         
            +
              end
         
     | 
| 
      
 22 
     | 
    
         
            +
             
     | 
| 
      
 23 
     | 
    
         
            +
              def show
         
     | 
| 
      
 24 
     | 
    
         
            +
                load_post
         
     | 
| 
      
 25 
     | 
    
         
            +
             
     | 
| 
      
 26 
     | 
    
         
            +
                render layout: app_layout
         
     | 
| 
      
 27 
     | 
    
         
            +
             
     | 
| 
      
 28 
     | 
    
         
            +
              rescue ActiveRecord::RecordNotFound
         
     | 
| 
      
 29 
     | 
    
         
            +
                render cms_page: "/404", status: 404
         
     | 
| 
      
 30 
     | 
    
         
            +
              end
         
     | 
| 
      
 31 
     | 
    
         
            +
             
     | 
| 
      
 32 
     | 
    
         
            +
            private
         
     | 
| 
      
 33 
     | 
    
         
            +
             
     | 
| 
      
 34 
     | 
    
         
            +
              def load_post
         
     | 
| 
      
 35 
     | 
    
         
            +
                post_scope = @cms_site.blog_posts.published.where(slug: params[:slug])
         
     | 
| 
      
 36 
     | 
    
         
            +
                @cms_post =
         
     | 
| 
      
 37 
     | 
    
         
            +
                  if params[:year] && params[:month]
         
     | 
| 
      
 38 
     | 
    
         
            +
                    post_scope.where(year: params[:year], month: params[:month]).first!
         
     | 
| 
      
 39 
     | 
    
         
            +
                  else
         
     | 
| 
      
 40 
     | 
    
         
            +
                    post_scope.first!
         
     | 
| 
      
 41 
     | 
    
         
            +
                  end
         
     | 
| 
      
 42 
     | 
    
         
            +
                @cms_layout = @cms_post.layout
         
     | 
| 
      
 43 
     | 
    
         
            +
              end
         
     | 
| 
      
 44 
     | 
    
         
            +
             
     | 
| 
      
 45 
     | 
    
         
            +
              def app_layout
         
     | 
| 
      
 46 
     | 
    
         
            +
                return false unless @cms_layout
         
     | 
| 
      
 47 
     | 
    
         
            +
                @cms_layout.app_layout.present? ? @cms_layout.app_layout : false
         
     | 
| 
      
 48 
     | 
    
         
            +
              end
         
     | 
| 
      
 49 
     | 
    
         
            +
             
     | 
| 
      
 50 
     | 
    
         
            +
            end
         
     |