simple_hashtag 0.1.0 → 0.1.2

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: e8124940426b09197f994c911e96bc38f9e9e5c6
4
- data.tar.gz: caea8d6daeab342ad2f59293811dfd31d4f83a28
3
+ metadata.gz: e98a7fc288581be35b953cd9a69648e221ddc17b
4
+ data.tar.gz: 66215811d045e8c74a2700f0fc1eb18c067e143d
5
5
  SHA512:
6
- metadata.gz: 437c0a695584060eb1d62d244f8dab530eb08275ee578ef098140e4d472df5ee8aa258139453755a46afa8965ba1064277c4074548b439154180b32bdcc35529
7
- data.tar.gz: 911e3593a7869ff82bb6198f1b06a78bea959e5f2691b5b22544665f679734503fe082b28a8fadc0164d02c98a59f6a770d5843fc022d63c950aa0e8eaa7f4c8
6
+ metadata.gz: db17a33e4af18dba5cd3f37d0bc3ecb5111b0d14746e757cc5685872bfad4e6b0ae87506046deb2cb2bac0abd38a99c0a26405b76485347a93d03afa0e9e845b
7
+ data.tar.gz: 44e0ebbc7adbb16ea093a2324f6f31ff7356fab7e1e5a57e1e0aa4a23965f247b081c7403ab372febb2523dd368496268324c20931010a720b750197da36b9b3
data/README.md CHANGED
@@ -1,5 +1,7 @@
1
1
  # SimpleHashtag
2
2
 
3
+ [![Gem Version](https://badge.fury.io/rb/simple_hashtag.png)](http://badge.fury.io/rb/simple_hashtag)
4
+
3
5
  Ruby gem for Rails that parses, stores, retreives and formats hashtags in your model.
4
6
 
5
7
  _Simple Hashtag_ is a mix between–well–hashtags, as we know them, and categories.
@@ -71,18 +73,33 @@ Helpers are also available to create a link when displaying the text.
71
73
 
72
74
  ### Controller and Views
73
75
  If you don't want to bother looking at the genrerated controller and views, here is a quick peek.
74
- In a Controller, search for a Hashtag, and its associated records:
76
+ In a Controller, display all hashtags, or search for a Hashtag and its associated records:
75
77
  ```ruby
76
78
  class HashtagsController < ApplicationController
77
79
  def index
80
+ @hashtags = SimpleHashtag::Hashtag.all
81
+ end
82
+
83
+ def show
78
84
  @hashtag = SimpleHashtag::Hashtag.find_by_name(params[:hashtag])
79
85
  @hashtagged = @hashtag.hashtaggables if @hashtag
80
86
  end
81
87
  end
82
88
  ```
83
89
 
90
+ The views could resemble something like this:
91
+
92
+ Index:
93
+ ```erb
94
+ <h1>Hashtags</h1>
95
+ <ul>
96
+ <% @hashtags.each do |hashtag| %>
97
+ <li><%= link_to hashtag.name, hashtag_path(hashtag.name) %></li>
98
+ <% end -%>
99
+ </ul>
100
+ ```
84
101
 
85
- The index view could resemble something like this:
102
+ Show:
86
103
  ```erb
87
104
  <h1><%= params[:hashtag] %></h1>
88
105
  <% if @hashtagged %>
@@ -100,9 +117,10 @@ In the gem it is actually extracted in a helper.
100
117
 
101
118
  ### Routes
102
119
 
103
- If you use the provided controller and views, add this line to your `config/routes.rb` file:
120
+ If you use the provided controller and views, the generator will add two routes to your app:
104
121
  ```ruby
105
- get 'hashtags/:hashtag', to: 'hashtags#index', as: :hashtag
122
+ get 'hashtags/', to: 'hashtags#index', as: :hashtags
123
+ get 'hashtags/:hashtag', to: 'hashtags#show', as: :hashtag
106
124
  ```
107
125
 
108
126
  The helper generating the link relies on it.
@@ -1,6 +1,10 @@
1
1
  class HashtagsController < ApplicationController
2
2
 
3
3
  def index
4
+ @hashtags = SimpleHashtag::Hashtag.all
5
+ end
6
+
7
+ def show
4
8
  @hashtag = SimpleHashtag::Hashtag.find_by_name(params[:hashtag])
5
9
  @hashtagged = @hashtag.hashtaggables if @hashtag
6
10
  end
@@ -1,8 +1,6 @@
1
- <h1><%= params[:hashtag] %></h1>
2
- <% if @hashtagged %>
3
- <% @hashtagged.each do |hashtagged| %>
4
- <%= render_hashtaggable hashtagged %>
5
- <% end -%>
6
- <% else -%>
7
- <p>There is no match for the <em><%= params[:hashtag] %></em> hashtag.</p>
1
+ <h1>Hashtags</h1>
2
+ <ul>
3
+ <% @hashtags.each do |hashtag| %>
4
+ <li><%= link_to hashtag.name, hashtag_path(hashtag.name) %></li>
8
5
  <% end -%>
6
+ </ul>
@@ -0,0 +1,8 @@
1
+ <h1><%= params[:hashtag] %></h1>
2
+ <% if @hashtagged %>
3
+ <% @hashtagged.each do |hashtagged| %>
4
+ <%= render_hashtaggable hashtagged %>
5
+ <% end -%>
6
+ <% else -%>
7
+ <p>There is no match for the <em><%= params[:hashtag] %></em> hashtag.</p>
8
+ <% end -%>
@@ -8,6 +8,10 @@ module SimpleHashtag
8
8
  copy_file "views/hashtags_controller.rb", "app/controllers/hashtags_controller.rb"
9
9
  copy_file "views/hashtags_helper.rb", "app/helpers/hashtags_helper.rb"
10
10
  copy_file "views/hashtags_index.html.erb", "app/views/hashtags/index.html.erb"
11
+ copy_file "views/hashtags_show.html.erb", "app/views/hashtags/show.html.erb"
12
+
13
+ route 'get "hashtags", to: "hashtags#index", as: :hashtags'
14
+ route 'get "hashtags/:hashtag", to: "hashtags#show", as: :hashtag'
11
15
  end
12
16
  end
13
17
  end
@@ -1,3 +1,3 @@
1
1
  module SimpleHashtag
2
- VERSION = "0.1.0"
2
+ VERSION = "0.1.2"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: simple_hashtag
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.1.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Raphael Campardou
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2013-10-06 00:00:00.000000000 Z
11
+ date: 2013-10-07 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails
@@ -89,7 +89,6 @@ extra_rdoc_files: []
89
89
  files:
90
90
  - .gitignore
91
91
  - .rspec
92
- - .travis.yml
93
92
  - Gemfile
94
93
  - LICENSE.txt
95
94
  - README.md
@@ -100,6 +99,7 @@ files:
100
99
  - lib/generators/simple_hashtag/templates/views/hashtags_controller.rb
101
100
  - lib/generators/simple_hashtag/templates/views/hashtags_helper.rb
102
101
  - lib/generators/simple_hashtag/templates/views/hashtags_index.html.erb
102
+ - lib/generators/simple_hashtag/templates/views/hashtags_show.html.erb
103
103
  - lib/generators/simple_hashtag/views_generator.rb
104
104
  - lib/simple_hashtag.rb
105
105
  - lib/simple_hashtag/hashtag.rb
data/.travis.yml DELETED
@@ -1,6 +0,0 @@
1
- rvm:
2
- - 1.9.3
3
- - 2.0.0
4
- notifications:
5
- recipients:
6
- - ralovely@gmail.com