iris_rails 0.2.0 → 1.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +60 -9
- data/bin/console +0 -1
- data/{iris.gemspec → iris_rails.gemspec} +3 -1
- data/lib/generators/iris/install_generator.rb +4 -1
- data/lib/{iris-rails.rb → generators/lib/iris_rails.rb} +0 -0
- data/lib/generators/templates/app/controllers/iris_rails/base_controller.rb +2 -1
- data/lib/generators/templates/app/controllers/iris_rails/posts_controller.rb +13 -2
- data/lib/generators/templates/app/helpers/meta_tags_helper.rb +15 -5
- data/lib/generators/templates/app/views/iris_rails/posts/index.html.erb +55 -49
- data/lib/generators/templates/app/views/iris_rails/posts/show.html.erb +6 -3
- data/lib/generators/templates/config/initializers/iris_rails.rb +1 -1
- data/lib/iris/version.rb +1 -1
- metadata +18 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: a73671f6aac8f0da411ff5bbda15d41e279a8a32e9b82f1efbe7dc4ed71fd0f6
|
4
|
+
data.tar.gz: 46e3ead0ed312e11d6c23960718937df7fe9310701f68f8acc5731caa5cfeecd
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: c6eef5aa751e58609a23f9d69b1993725531d01e0fec6f66a98169de38efe08c8ddb8520f36754f9a3416511fea7bfdebcd144269811f811faff050a99e3ec11
|
7
|
+
data.tar.gz: f46d33786a3aeb6a66a68d59cf7b6a896b1de1b6c3d701733058df7948b97decda0bc8497bdefc005a10ba01ac3866ab163b7677eecae09c187571e9441cc391
|
data/README.md
CHANGED
@@ -9,32 +9,83 @@ TODO: Delete this and the text above, and describe your gem
|
|
9
9
|
Add this line to your application's Gemfile:
|
10
10
|
|
11
11
|
```ruby
|
12
|
-
gem '
|
12
|
+
gem 'iris_rails'
|
13
13
|
```
|
14
14
|
|
15
15
|
And then execute:
|
16
16
|
|
17
|
+
```ruby
|
17
18
|
$ bundle
|
19
|
+
```
|
18
20
|
|
19
21
|
Or install it yourself as:
|
20
22
|
|
21
|
-
|
23
|
+
```ruby
|
24
|
+
$ gem install iris_rails
|
25
|
+
```
|
22
26
|
|
23
27
|
## Usage
|
24
28
|
|
25
|
-
|
29
|
+
After installing, run the genereator provided by the gem:
|
30
|
+
|
31
|
+
```ruby
|
32
|
+
rails generate iris:install
|
33
|
+
```
|
34
|
+
|
35
|
+
The generator creates an initializer file and default controllers and views:
|
36
|
+
|
37
|
+
```
|
38
|
+
|-- app
|
39
|
+
|-- controllers
|
40
|
+
|-- iris_rails
|
41
|
+
|-- base_controller.rb
|
42
|
+
|-- posts_controller.rb
|
43
|
+
|-- views
|
44
|
+
|-- iris_rails
|
45
|
+
|-- posts
|
46
|
+
|-- index.html.erb
|
47
|
+
|-- show.html.erb
|
48
|
+
|-- helpers
|
49
|
+
|-- meta_tags_helper.rb
|
50
|
+
|
51
|
+
|-- config
|
52
|
+
|-- initializers
|
53
|
+
|-- iris_rails.rb
|
54
|
+
|-- lib
|
55
|
+
|-- iris_rails.rb
|
56
|
+
```
|
57
|
+
|
58
|
+
It also adds routes to your `routes.rb` file:
|
59
|
+
|
60
|
+
```ruby
|
61
|
+
scope :module => 'iris_rails' do
|
62
|
+
get '/blog' => 'posts#index', :as => :iris_blog
|
63
|
+
get '/blog/:slug' => 'posts#show', :as => :iris_post
|
64
|
+
end
|
65
|
+
```
|
66
|
+
|
67
|
+
After running the generator, set your API token in `config/initializers/iris_rails.rb`
|
26
68
|
|
27
|
-
|
69
|
+
## Customization
|
28
70
|
|
29
|
-
|
71
|
+
Extending and customizing your blog is easy.
|
72
|
+
|
73
|
+
Define in `app/controllers/iris_rails/base_controller.rb` the layout you will use. If you have some verifications the page, make sure to copy them to IrisRails::BaseController.
|
74
|
+
|
75
|
+
Iris_Rails uses a helper method to define title, meta tags (meta title, meta description and meta keywords) and use CSS with the template defined in iris website (iriseo.com). Make sure you select the template in iris.com/settings so your blog has a nice look! Add the lines below to the layout you will use and and set title and meta tags of your website.
|
76
|
+
|
77
|
+
```ruby
|
78
|
+
iris_meta_tags(head_title: 'INSERT_WEBSITE_TITLE', meta_description: 'INSERT_WEBSITE_META_DESCRIPTION', meta_keywords: 'INSERT_WEBSITE_META_KEYWORDS', meta_author: 'INSERT_WEBSITE_META_AUTHOR')
|
79
|
+
```
|
30
80
|
|
31
|
-
|
81
|
+
Insert your website title in INSERT_WEBSITE_TITLE, meta_description in INSERT_WEBSITE_META_DESCRIPTION, meta_keywords in INSERT_WEBSITE_META_KEYWORDS and meta_author in INSERT_WEBSITE_META_AUTHOR. Don't create a tag with these attributes if you are using the method iris_meta_tags because duplicated attributes lower the SEO score. If you don't have these attributes, just leave it as a whitespace.
|
32
82
|
|
33
|
-
|
83
|
+
Now start your server and to view your blog just access YOUR_URL/blog.
|
84
|
+
Reminder, you have to add posts to your blog in Iris website www.iriseo.com.
|
34
85
|
|
35
86
|
## Contributing
|
36
87
|
|
37
|
-
Bug reports and pull requests are welcome on GitHub at https://github.com/
|
88
|
+
Bug reports and pull requests are welcome on GitHub at https://github.com/horta-tech/iris-rails. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [Contributor Covenant](http://contributor-covenant.org) code of conduct.
|
38
89
|
|
39
90
|
## License
|
40
91
|
|
@@ -42,4 +93,4 @@ The gem is available as open source under the terms of the [MIT License](https:/
|
|
42
93
|
|
43
94
|
## Code of Conduct
|
44
95
|
|
45
|
-
Everyone interacting in the Iris project’s codebases, issue trackers, chat rooms and mailing lists is expected to follow the [code of conduct](https://github.com/
|
96
|
+
Everyone interacting in the Iris project’s codebases, issue trackers, chat rooms and mailing lists is expected to follow the [code of conduct](https://github.com/horta-tech/iris-rails/blob/master/CODE_OF_CONDUCT.md).
|
data/bin/console
CHANGED
@@ -28,7 +28,9 @@ Gem::Specification.new do |spec|
|
|
28
28
|
spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
|
29
29
|
spec.require_paths = ["lib"]
|
30
30
|
|
31
|
+
spec.add_runtime_dependency "rest-client", "~> 2.1.0"
|
32
|
+
|
31
33
|
spec.add_development_dependency "bundler", "~> 2.0"
|
32
34
|
spec.add_development_dependency "rake", "~> 13.0"
|
33
35
|
spec.add_development_dependency "rspec", "~> 3.2"
|
34
|
-
end
|
36
|
+
end
|
@@ -17,7 +17,10 @@ module Iris
|
|
17
17
|
directory "app/views/iris_rails", "app/views/iris_rails"
|
18
18
|
|
19
19
|
# Create helper
|
20
|
-
|
20
|
+
copy_file "app/helpers/meta_tags_helper.rb", "app/helpers/meta_tags_helper.rb"
|
21
|
+
|
22
|
+
# Create iris_rails model
|
23
|
+
copy_file "../lib/iris_rails.rb", "lib/iris_rails.rb"
|
21
24
|
|
22
25
|
# Create default layout
|
23
26
|
# directory "app/views/layouts/iris", "app/views/layouts/iris"
|
File without changes
|
@@ -6,20 +6,31 @@ class IrisRails::PostsController < IrisRails::BaseController
|
|
6
6
|
@first_posts = @posts.first(3)
|
7
7
|
@highlighted_posts = @posts[3, 3]
|
8
8
|
@more_posts = @posts[6, @posts.size - (@posts.length.odd? ? 9 : 6)]
|
9
|
-
|
9
|
+
if @posts.length.odd? && (@posts.length >= 9)
|
10
|
+
@last_posts = @posts.last(3)
|
11
|
+
elsif @posts.length == 7
|
12
|
+
@last_posts = []
|
13
|
+
@last_posts << @posts.last
|
14
|
+
end
|
10
15
|
end
|
11
16
|
|
12
17
|
def show
|
13
18
|
response = IrisRails::Post.find(params[:slug])
|
14
19
|
@post, @related_posts, @account = response
|
15
20
|
@author = author_name_or_email(@post.author)
|
21
|
+
strongkeyphrase = '<strong>' + @post.keyphrase + '</strong>'
|
22
|
+
@post.first_introduction = @post.first_introduction.gsub(@post.keyphrase, strongkeyphrase)
|
23
|
+
@post.second_introduction = @post.second_introduction.gsub(@post.keyphrase, strongkeyphrase)
|
24
|
+
@post.ordered_topics.each do |topic|
|
25
|
+
topic['content'] = topic['content'].gsub(@post.keyphrase, strongkeyphrase)
|
26
|
+
end
|
16
27
|
end
|
17
28
|
|
18
29
|
private
|
19
30
|
|
20
31
|
def author_name_or_email(author)
|
21
32
|
if author['first_name'] || author['last_name']
|
22
|
-
"#{author['first_name']
|
33
|
+
"#{author['first_name'].strip} #{author['last_name'].strip}"
|
23
34
|
else
|
24
35
|
author['email']
|
25
36
|
end
|
@@ -4,25 +4,35 @@ module MetaTagsHelper
|
|
4
4
|
set_title(meta_tags[:head_title]),
|
5
5
|
meta_title(meta_tags[:head_title]),
|
6
6
|
meta_description(meta_tags[:meta_description]),
|
7
|
-
meta_keywords(meta_tags[:meta_keywords])
|
7
|
+
meta_keywords(meta_tags[:meta_keywords]),
|
8
|
+
meta_author(meta_tags[:meta_author]),
|
9
|
+
set_iris_css
|
8
10
|
].join("\n").html_safe
|
9
11
|
end
|
10
12
|
|
11
13
|
private
|
12
14
|
|
13
15
|
def set_title(given_title)
|
14
|
-
content_for?(:title) ? content_tag(:title, '
|
16
|
+
content_for?(:title) ? content_tag(:title, content_for(:account_name) + ' | ' + content_for(:title)) : (content_tag(:title, given_title) if !given_title.nil?)
|
15
17
|
end
|
16
18
|
|
17
19
|
def meta_title(given_meta_title)
|
18
|
-
content_for?(:title) ? tag('meta', :
|
20
|
+
content_for?(:title) ? tag('meta', name: 'title', :content => content_for(:title)) : (tag('meta', :name => 'title', :content => given_meta_title) if !given_meta_title.nil?)
|
19
21
|
end
|
20
22
|
|
21
23
|
def meta_description(given_meta_description)
|
22
|
-
content_for?(:meta_description) ? tag('meta', :
|
24
|
+
content_for?(:meta_description) ? tag('meta', name: 'description', :content => content_for(:meta_description)) : (tag('meta', :name => 'description', :content => given_meta_description) if !given_meta_description.nil?)
|
23
25
|
end
|
24
26
|
|
25
27
|
def meta_keywords(given_meta_keywords)
|
26
|
-
content_for?(:meta_keywords) ? tag('meta', :
|
28
|
+
content_for?(:meta_keywords) ? tag('meta', name: 'keywords', :content => content_for(:meta_keywords)) : (tag('meta', :name => 'keywords', :content => given_meta_keywords) if !given_meta_keywords.nil?)
|
29
|
+
end
|
30
|
+
|
31
|
+
def meta_author(given_meta_author)
|
32
|
+
content_for?(:meta_author) ? tag('meta', name: 'author', :content => content_for(:meta_author)) : (tag('meta', :name => 'author', :content => given_meta_author) if !given_meta_author.nil?)
|
33
|
+
end
|
34
|
+
|
35
|
+
def set_iris_css
|
36
|
+
tag(:link, href: "https://cdn.jsdelivr.net/npm/iris-cms/templates/#{content_for(:iris_css)}.css", rel: 'stylesheet') if content_for?(:iris_css)
|
27
37
|
end
|
28
38
|
end
|
@@ -1,6 +1,8 @@
|
|
1
|
-
<% content_for :title, @account.account_title
|
2
|
-
|
3
|
-
|
1
|
+
<% content_for :title, @account.account_title
|
2
|
+
content_for :account_name, @account.account_name
|
3
|
+
content_for :meta_description, @account.account_description
|
4
|
+
content_for :meta_keywords, @account.account_keyword
|
5
|
+
content_for :iris_css, @account.template %>
|
4
6
|
|
5
7
|
<div id="blog">
|
6
8
|
<div id="iris-main-container">
|
@@ -9,7 +11,7 @@
|
|
9
11
|
<h1 class="sub-title"><%= @account.account_name %></h1>
|
10
12
|
</div>
|
11
13
|
<div class="blog_grid">
|
12
|
-
<% @first_posts
|
14
|
+
<% @first_posts&.each do |post| %>
|
13
15
|
<a href='<%= "/blog/#{post.slug}" %> '>
|
14
16
|
<div class="post-div" style="background-image: url(<%= post.banner_image['url'] %>);">
|
15
17
|
<div class="banner-info">
|
@@ -24,56 +26,60 @@
|
|
24
26
|
</div>
|
25
27
|
</section>
|
26
28
|
<section>
|
27
|
-
|
28
|
-
<
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
<
|
34
|
-
<div class="
|
35
|
-
<
|
36
|
-
|
37
|
-
|
29
|
+
<% if @highlighted_posts %>
|
30
|
+
<div class="sub-title-div">
|
31
|
+
<h2 class="sub-title">EM DESTAQUE</h2>
|
32
|
+
</div>
|
33
|
+
<div class="highlighted-posts">
|
34
|
+
<% @highlighted_posts.each do |post| %>
|
35
|
+
<a href='<%= "/blog/#{post.slug}" %> '>
|
36
|
+
<div class="post-div" style="background-image: url(<%= post.banner_image['url'] %>);">
|
37
|
+
<div class="banner-info">
|
38
|
+
<p class="updatedinfo">Atualizado em <%= post.updated_at.to_time.strftime '%e/%m/%Y' %></p>
|
39
|
+
<hr>
|
40
|
+
<h3><%= post.main_title %></h3>
|
41
|
+
</div>
|
38
42
|
</div>
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
43
|
+
<p class="description"><%= post.secondary_title %></p>
|
44
|
+
</a>
|
45
|
+
<% end %>
|
46
|
+
</div>
|
47
|
+
<% end %>
|
44
48
|
</section>
|
45
49
|
<section>
|
46
|
-
|
47
|
-
<
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
<
|
53
|
-
<div class="
|
54
|
-
<
|
55
|
-
|
56
|
-
|
50
|
+
<% if @more_posts || @last_posts %>
|
51
|
+
<div class="sub-title-div">
|
52
|
+
<h2 class="sub-title">MAIS NOTÍCIAS</h2>
|
53
|
+
</div>
|
54
|
+
<div class="more-posts">
|
55
|
+
<% @more_posts&.each do |post| %>
|
56
|
+
<a href='<%= "/blog/#{post.slug}" %> '>
|
57
|
+
<div class="post-div" style="background-image: url(<%= post.banner_image['url'] %>);">
|
58
|
+
<div class="banner-info">
|
59
|
+
<p class="updatedinfo">Atualizado em <%= post.updated_at.to_time.strftime '%e/%m/%Y' %></p>
|
60
|
+
<hr>
|
61
|
+
<h3><%= post.main_title %></h3>
|
62
|
+
</div>
|
57
63
|
</div>
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
64
|
+
<p class="description"><%= post.secondary_title %></p>
|
65
|
+
</a>
|
66
|
+
<% end %>
|
67
|
+
</div>
|
68
|
+
<div class="last-three-posts">
|
69
|
+
<% @last_posts&.each do |post| %>
|
70
|
+
<a href='<%= "/blog/#{post.slug}" %> '>
|
71
|
+
<div class="post-div" style="background-image: url(<%= post.banner_image['url'] %>);">
|
72
|
+
<div class="banner-info">
|
73
|
+
<p class="updatedinfo">Atualizado em <%= post.updated_at.to_time.strftime '%e/%m/%Y' %></p>
|
74
|
+
<hr>
|
75
|
+
<h3><%= post.main_title %></h3>
|
76
|
+
</div>
|
71
77
|
</div>
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
78
|
+
<p class="description"><%= post.secondary_title %></p>
|
79
|
+
</a>
|
80
|
+
<% end %>
|
81
|
+
</div>
|
82
|
+
<% end %>
|
77
83
|
</section>
|
78
84
|
</div>
|
79
85
|
</div>
|
@@ -1,6 +1,9 @@
|
|
1
|
-
<% content_for :title, @post.main_title
|
2
|
-
|
3
|
-
|
1
|
+
<% content_for :title, @post.main_title
|
2
|
+
content_for :account_name, @account.account_name
|
3
|
+
content_for :meta_description, @post.meta_description
|
4
|
+
content_for :meta_keywords, @post.keyphrase
|
5
|
+
content_for :meta_author, @author
|
6
|
+
content_for :iris_css, @account.template %>
|
4
7
|
|
5
8
|
<main id="blog" style="opacity: 1; transition: all 1s ease 0s;">
|
6
9
|
<article id="iris-main-container">
|
@@ -1,2 +1,2 @@
|
|
1
|
-
require '
|
1
|
+
require 'iris_rails'
|
2
2
|
IrisRails::api_token = ENV['IRIS_TOKEN']
|
data/lib/iris/version.rb
CHANGED
metadata
CHANGED
@@ -1,15 +1,29 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: iris_rails
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 1.0.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Rayan Castro
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2020-
|
11
|
+
date: 2020-04-29 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: rest-client
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - "~>"
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: 2.1.0
|
20
|
+
type: :runtime
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - "~>"
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: 2.1.0
|
13
27
|
- !ruby/object:Gem::Dependency
|
14
28
|
name: bundler
|
15
29
|
requirement: !ruby/object:Gem::Requirement
|
@@ -70,15 +84,15 @@ files:
|
|
70
84
|
- Rakefile
|
71
85
|
- bin/console
|
72
86
|
- bin/setup
|
73
|
-
-
|
87
|
+
- iris_rails.gemspec
|
74
88
|
- lib/generators/iris/install_generator.rb
|
89
|
+
- lib/generators/lib/iris_rails.rb
|
75
90
|
- lib/generators/templates/app/controllers/iris_rails/base_controller.rb
|
76
91
|
- lib/generators/templates/app/controllers/iris_rails/posts_controller.rb
|
77
92
|
- lib/generators/templates/app/helpers/meta_tags_helper.rb
|
78
93
|
- lib/generators/templates/app/views/iris_rails/posts/index.html.erb
|
79
94
|
- lib/generators/templates/app/views/iris_rails/posts/show.html.erb
|
80
95
|
- lib/generators/templates/config/initializers/iris_rails.rb
|
81
|
-
- lib/iris-rails.rb
|
82
96
|
- lib/iris/version.rb
|
83
97
|
homepage: https://github.com/horta-tech/iris-rails
|
84
98
|
licenses:
|