Giter Club home page Giter Club logo

spree_blogs's Introduction

spree_blogs

CI Standard Rb

Move your existing Shopify blogs over to Spree bringing all your blog posts and URL's with you.

Features

  • Manage multiple blogs (like Shopify)
  • Multi-store support
  • Draft editing mode
  • Compatable with Rails Action Text and the TRIX rich text editor

Installation

  1. Add the following lines to your Gemfile:

    gem "spree_blogs", github: "matthewkennedy/spree_blogs", branch: "main"
  2. Install the gems using Bundler

    bundle install
  3. Copy & run migration.

    bundle exec rails g spree_blogs:install
  4. Restart your server

If your server was running, restart it so that it can find the assets properly.

Configurations

Action Text - TRIX RTE

To use the Rails built in TRIX Rich Text Editor install and set up Action Text via the Rails guides, and then set the following config to true:

# In initilizers/spree.rb
SpreeBlogs::Config.use_action_text = true

Raw HTML Post Content

If you are not using Action Text, and wish to use raw HTML in your Blog Post content, you can set the following config:

# In initilizers/spree.rb
SpreeBlogs::Config.use_action_text = false
SpreeBlogs::Config.use_raw_post_content = true

Lazy Loading Image Ratio

Spree Blogs takes advantage of the lazy loading images javascript in Spree 4.1 and higher. If you wish to change the image ratio from the default square (1/1), you can do so by setting the config below:

# In initilizers/spree.rb
SpreeBlogs::Config.image_ratio = "16/9" # The default is "1/1" (square).

Usage

  1. Set up Author's

Visit Configurations/Roles and add a new Role named blogger, then assign the new role to any user you wish to appear in the author list.

  1. Create A Blog

Click Blog Posts from the main menu, and then click Manage Blogs in the contextual menu, once you are in the Manage Blogs area click New Blog to create your first blog and assign it to one or more of your stores.

  1. Create A Post

Navigate to Blog Posts area and click the New Post butto to create your first blog post, assign your post to your new Blog and your done.

Add Blogs To Your Homepage

Display blogs on your homepage by adding the following partial and setting the desired blog title and number of posts you wish to display in the locals:

# views/spree/home/index.html.erb
<%= render partial: "spree/shared/drop_in_blog", locals: { blog: "news", post_count: 4 } %>

Testing

First bundle your dependencies, then run rake. rake will default to building the dummy app if it does not exist, then it will run specs. The dummy app can be regenerated by using rake test_app.

bundle
bundle exec rake

When testing your applications integration with this extension you may use it's factories. Simply add this require statement to your spec_helper:

require "spree_blogs/factories"

ToDo

  • Add page caching
  • Write tests
  • Set lazyloading images to be more efficient
  • Have a good tidy up
  • Write more tests

Contributing

If you'd like to contribute, please take a look at the instructions for installing dependencies and crafting a good pull request.

Copyright (c) 2021 Matthew Kennedy, released under the New MIT License

spree_blogs's People

Contributors

matthewkennedy avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.