bbcode-rails 0.5.0 → 0.6.0

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: b5dee9f1d9bccc6961a4781397d3fff6efe259f0
4
- data.tar.gz: 66cb0ca65f32e79335549cd45b0423a06b3ba233
3
+ metadata.gz: eee36ea29830dc83a7843dad8943e85e4ab88cb6
4
+ data.tar.gz: 313b2a3bc3276ae865dc9ef757ff9f575692dce7
5
5
  SHA512:
6
- metadata.gz: e4a638216dea09abdb06a12cccc1a8951cf0b7cbd20110695f2bd13f7bfa46107c96fba736a1d7fcca8ae023313c20c56b4f1e615deb956ad7d1ec9cf74cf64e
7
- data.tar.gz: aa7399efb0d104152b7008bbf12b724b63f765fd72f31f102c080629d285701470d35554e3fc0eada808b3018821966302354e67db3ce07f0078b459924edc6b
6
+ metadata.gz: 8584d458464d83bd45a958fa8d838d205795a18eed3f2edd00811b3ad24b7d657a14e3b925f8d52f10aceb727e6a94acc9dfc5f9f6ab810f8d940b01e2966ee6
7
+ data.tar.gz: c30594d59da3ba541a8d9de1b663cd460055abc6760388c2044cbceebe584136c0c5becb6a652a976cab827638344f9a08b566462affc7467f39e1d19df116dc
data/README.md CHANGED
@@ -40,11 +40,11 @@ tags are not big enough to warrant this, so one can also group them. For example
40
40
 
41
41
  You can use the bbcode generator to quickly setup a new tag, simple run
42
42
 
43
- $ rails generate bbcode tagname
43
+ $ rails generate bb_code:tag tagname
44
44
 
45
45
  For example if we want to create a bbcode tag to easily link to a user
46
46
 
47
- $ rails generate bbcode user
47
+ $ rails generate bb_code:tag user
48
48
 
49
49
  This will create `app/bbcode/user_tag.rb`.
50
50
 
@@ -1,3 +1,3 @@
1
1
  module BBCode
2
- VERSION = "0.5.0"
2
+ VERSION = "0.6.0"
3
3
  end
@@ -1,3 +1,5 @@
1
+ bb_code:tag
2
+
1
3
  Description:
2
4
  Generates a BBCode Tag with the given name.
3
5
 
@@ -6,3 +8,19 @@ Example:
6
8
 
7
9
  This will create:
8
10
  app/bbcode/user_tag.rb
11
+
12
+ bb_code:install
13
+
14
+ Description:
15
+ Generates a few of the most simple tags as examples
16
+
17
+ Example:
18
+ rails generate bbcode:install
19
+
20
+ This will create:
21
+ app/bbcode/i_tag.rb
22
+ app/bbcode/b_tag.rb
23
+ app/bbcode/quote_tag.rb
24
+ app/bbcode/img_tag.rb
25
+ app/views/bbcode/_quote.html.erb
26
+
@@ -0,0 +1,20 @@
1
+ require 'rails/generators'
2
+ require 'rails/generators/named_base'
3
+
4
+ module BbCode
5
+ class InstallGenerator < ::Rails::Generators::Base
6
+ source_root File.expand_path('../templates', __FILE__)
7
+
8
+ def copy_files
9
+ ["i", "b", "quote", "img"].each do |name|
10
+ copy_file "#{name}_tag.rb", "app/bbcode/#{name}_tag.rb"
11
+ end
12
+ copy_file "_quote.html.erb", "app/views/bbcode/_quote.html.erb"
13
+ end
14
+
15
+ private
16
+ def file_name
17
+ name.underscore
18
+ end
19
+ end
20
+ end
@@ -0,0 +1,11 @@
1
+ <blockquote>
2
+ <p><%= raw message%></p>
3
+ <footer>
4
+ <% if user %>
5
+ <%= link_to user.name, user %>
6
+ <% else %>
7
+ <%= user_name %>
8
+ <% end %>
9
+ </footer>
10
+ </blockquote>
11
+
@@ -0,0 +1,8 @@
1
+ class BTag < BBCode::Tag
2
+ block_name :b
3
+
4
+ on_layout do |args|
5
+ "<strong>#{args[1]}</strong>"
6
+ end
7
+ end
8
+
@@ -0,0 +1,8 @@
1
+ class ITag < BBCode::Tag
2
+ block_name :i
3
+
4
+ on_layout do |args|
5
+ "<em>#{args[1]}</em>"
6
+ end
7
+ end
8
+
@@ -0,0 +1,8 @@
1
+ class ImgTag < BBCode::Tag
2
+ block_name :img, :argument, :no_closing_tag
3
+
4
+ on_layout do |args|
5
+ args[1].gsub!(/javascript:/, '')
6
+ "<img src='#{args[1]}'>"
7
+ end
8
+ end
@@ -0,0 +1,8 @@
1
+ class QuoteTag < BBCode::Tag
2
+ block_name :quote, :argument
3
+
4
+ on_layout do |args|
5
+ user = User.find_by_id(args[1])
6
+ render(partial: 'bbcode/quote', locals: { user: user, message: args[2], user_name: args[1] })
7
+ end
8
+ end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: bbcode-rails
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.5.0
4
+ version: 0.6.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Marcel Müller
@@ -59,7 +59,13 @@ files:
59
59
  - lib/bbcode-rails/tag.rb
60
60
  - lib/bbcode-rails/version.rb
61
61
  - lib/generators/bb_code/USAGE
62
+ - lib/generators/bb_code/install_generator.rb
62
63
  - lib/generators/bb_code/tag_generator.rb
64
+ - lib/generators/bb_code/templates/_quote.html.erb
65
+ - lib/generators/bb_code/templates/b_tag.rb
66
+ - lib/generators/bb_code/templates/i_tag.rb
67
+ - lib/generators/bb_code/templates/img_tag.rb
68
+ - lib/generators/bb_code/templates/quote_tag.rb
63
69
  - lib/generators/bb_code/templates/tag.rb
64
70
  homepage: https://github.com/TheNeikos/bbcode-rails
65
71
  licenses: