dhatu 0.1.7 → 0.1.8

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: 5a4404748dd9f2d445924425c4faad29e12a3390
4
- data.tar.gz: 7a0bc391fa6762c9bb7e9b4fc57f90d30f4348f0
3
+ metadata.gz: '081c3b426eb7136d392844e905662d48468f3ca8'
4
+ data.tar.gz: d0d80ccbd33b16435c8c1091d799d9ce5acf3019
5
5
  SHA512:
6
- metadata.gz: 176d1ad23af49d3b5d5c30af59c4935472ba2c9475885b693117965120e224e8c319877d2c3a521dfe736680b54d43fa41e3c381af537b87d43f261c1f23784e
7
- data.tar.gz: b52b928497affa3f4cc9ebf286994e6d65ba2bf94e85a6777cd0e09627628e8dc6384182d51f1a78305e16492224a715b37cc386d54302be74ed7b04711694bf
6
+ metadata.gz: 9064518b345800624470acb3ca70383d3b18e337ab4ebf501bf1d3be8f724d747907c2314f01c76ff5b31aee91995a58b56473e01dbff9af1ee0a447122ae899
7
+ data.tar.gz: b4065b4b48cbc61e1d59eeb7d1ce9e7774fa9f86324ec3d7c1dd0197955288897abf151ac57d41f1833051483fbac98590505be46b29c1ac498c6fbb93c8b793
@@ -1,6 +1,12 @@
1
1
  module Dhatu
2
2
  class BlogPostsController < ResourceController
3
3
 
4
+ def new
5
+ get_category
6
+ @r_object = @blog_post = Dhatu::BlogPost.new(category: @category)
7
+ render_accordingly
8
+ end
9
+
4
10
  private
5
11
 
6
12
  def permitted_params
@@ -9,14 +15,31 @@ module Dhatu
9
15
 
10
16
  def get_collections
11
17
  @relation = Dhatu::BlogPost.includes(:cover_image).where("")
12
- params[:st] = "published" if params[:st].nil?
18
+ get_category
13
19
  parse_filters
14
20
  apply_filters
15
21
  @blog_posts = @r_objects = @relation.page(@current_page).per(@per_page)
16
22
  return true
17
23
  end
18
24
 
25
+ def get_category
26
+ if params[:ct].to_s == "-1"
27
+ @category = Dhatu::Category.new(id: -1, name: "None")
28
+ elsif params[:ct]
29
+ @category = Dhatu::Category.find_by_id(params[:ct])
30
+ end
31
+ @categories = Dhatu::Category.where(category_type: "Dhatu::BlogPost").all
32
+ end
33
+
19
34
  def apply_filters
35
+ if @category
36
+ if @category.id == -1
37
+ @relation = @relation.where("category_id is NULL")
38
+ else
39
+ @relation = @relation.where("category_id = ?", @category.id)
40
+ end
41
+ end
42
+
20
43
  @relation = @relation.search(@query) if @query
21
44
  @relation = @relation.status(@status) if @status
22
45
 
@@ -8,8 +8,7 @@ module Dhatu
8
8
  end
9
9
 
10
10
  def get_collections
11
- category_ids = Dhatu::Price.distinct.pluck(:category_id)
12
- @categories = Dhatu::Category.where(id: category_ids).to_a
11
+ @categories = Dhatu::Category.where(category_type: "Dhatu::Price").all
13
12
  @categories.unshift(Dhatu::Category.new(id: -1, name: "All"))
14
13
 
15
14
  @relation = Dhatu::Price.where("")
@@ -14,7 +14,7 @@
14
14
 
15
15
  <div class="row">
16
16
  <div class="col-md-6 pr-20">
17
- <% options = {assoc_collection: Dhatu::Category.filter_by_category_type("Blog").published.select("id, name").order("name ASC").all, editable: true, assoc_display_method: :name} %>
17
+ <% options = {assoc_collection: Dhatu::Category.filter_by_category_type("Dhatu::BlogPost").published.select("id, name").order("name ASC").all, editable: true, assoc_display_method: :name} %>
18
18
  <%= theme_form_assoc_group(@blog_post, :category_id, label: "Choose Category", form_style: "top-bottom", **options) %>
19
19
  </div>
20
20
  <div class="col-md-6 pl-20">
@@ -5,9 +5,6 @@
5
5
  <th style="text-align: center;width:5%">#</th>
6
6
  <th style="text-align: center;width:100px"><i class="fa fa-photo"></i></th>
7
7
  <th>Title</th>
8
- <th class="hidden-md hidden-sm hidden-xs">Author</th>
9
- <th style="width:100px;" class="hidden-sm hidden-xs">Featured</th>
10
- <th style="width:100px;" class="hidden-sm hidden-xs">Status</th>
11
8
  <% if display_manage_links? %>
12
9
  <th style="text-align: center;" colspan="2" class="hidden-sm hidden-xs">Actions</th>
13
10
  <% end %>
@@ -27,13 +24,11 @@
27
24
  <%= display_thumbnail_small(blog_post) %>
28
25
  </td>
29
26
 
30
- <td class="display-link"><%= link_to blog_post.title, blog_post_path(blog_post), remote: true %></td>
31
-
32
- <td class="display-link hidden-md hidden-sm hidden-xs"><%= blog_post.author %></td>
33
-
34
- <td class="hidden-sm hidden-xs"><%= display_featured(blog_post) %></td>
35
-
36
- <td class="hidden-sm hidden-xs"><%= display_publishable_status(blog_post) %></td>
27
+ <td class="display-link">
28
+ <%= link_to blog_post.title, blog_post_path(blog_post), remote: true %><br>
29
+ <%= display_publishable_status(blog_post) %>
30
+ <%= display_featured(blog_post) %>
31
+ </td>
37
32
 
38
33
  <% if display_manage_links? %>
39
34
  <td class="action-links hidden-sm hidden-xs" style="width:10%"><%= display_publishable_links(blog_post) %></td>
@@ -1,5 +1,5 @@
1
1
  <tr id="tr_blog_post_<%= blog_post.id %>">
2
-
2
+
3
3
  <th scope="row" style="text-align: center;">
4
4
  <%= serial_number(i) %>
5
5
  </th>
@@ -8,21 +8,19 @@
8
8
  <%= display_thumbnail_small(blog_post) %>
9
9
  </td>
10
10
 
11
- <td class="blog_post-name"><%= link_to blog_post.title, blog_post_path(blog_post), remote: true %></td>
12
-
13
- <td class="blog_post-name hidden-md hidden-sm hidden-xs"><%= blog_post.author %></td>
14
-
15
- <td class="hidden-sm hidden-xs"><%= display_featured(blog_post) %></td>
16
-
17
- <td class="hidden-sm hidden-xs"><%= display_publishable_status(blog_post) %></td>
11
+ <td class="display-link">
12
+ <%= link_to blog_post.title, blog_post_path(blog_post), remote: true %><br>
13
+ <%= display_publishable_status(blog_post) %>
14
+ <%= display_featured(blog_post) %>
15
+ </td>
18
16
 
19
17
  <% if display_manage_links? %>
20
18
  <td class="action-links hidden-sm hidden-xs" style="width:10%"><%= display_publishable_links(blog_post) %></td>
21
-
19
+
22
20
  <td class="action-links hidden-sm hidden-xs" style="width:10%">
23
21
  <%= display_featurable_links(blog_post) %>
24
22
  <%= display_manage_links(blog_post, @current_user) %>
25
23
  </td>
26
24
  <% end %>
27
-
25
+
28
26
  </tr>
@@ -26,7 +26,13 @@
26
26
 
27
27
  <%= display_featured(@blog_post) %>
28
28
 
29
- <%= clear_tag(20) %>
29
+ <%= clear_tag(10) %>
30
+
31
+ <div class="well">
32
+ <%= raw(@blog_post.meta_description) %>
33
+ </div>
34
+
35
+ <%= clear_tag(10) %>
30
36
 
31
37
  <div class="table-responsive">
32
38
  <table class="table table-striped table-condensed table-bordered">
@@ -63,7 +69,7 @@
63
69
  <li class="active">
64
70
  <a href="#blog_post_details" data-toggle="tab" aria-expanded="true">
65
71
  <span class="visible-xs"><i class="fa-info"></i></span>
66
- <span class="hidden-xs">Blog Details</span>
72
+ <span class="hidden-xs">Article</span>
67
73
  </a>
68
74
  </li>
69
75
  <li class="">
@@ -1,42 +1,60 @@
1
1
  <div class="row">
2
2
 
3
3
  <div class="col-md-12">
4
+
5
+ <div class="tabs-vertical-env">
6
+ <ul id="div_category_types" class="nav tabs-vertical">
7
+ <li class="<%= @category.blank? ? 'active' : '' %>">
8
+ <%= link_to "All", blog_posts_path, style: "text-align:left;" %>
9
+ </li>
10
+ <% @categories.each do |ct| %>
11
+ <li class="<%= @category && @category == ct ? 'active' : '' %>">
12
+ <%= link_to ct.name, blog_posts_path(ct: ct.id), style: "text-align:left;" %>
13
+ </li>
14
+ <% end %>
15
+ <li class="<%= @category && @category.id == -1 ? 'active' : '' %>">
16
+ <%= link_to "None", blog_posts_path(ct: -1), style: "text-align:left;" %>
17
+ </li>
18
+ </ul>
4
19
 
5
- <ul class="nav nav-tabs nav-tabs-justified">
6
- <% Dhatu::BlogPost::STATUS.each do |key, value| %>
7
- <li class="<%= @status == value ? 'active' : '' %>">
8
- <%= link_to blog_posts_path(st: value), "aria-expanded" => "#{ @status == value ? 'true' : 'false' }" do %>
20
+ <!-- <ul class="nav nav-tabs nav-tabs-justified">
21
+ <%# Dhatu::BlogPost::STATUS.each do |key, value| %>
22
+ <li class="<%#= @status == value ? 'active' : '' %>">
23
+ <%#= link_to blog_posts_path(st: value), "aria-expanded" => "#{ @status == value ? 'true' : 'false' }" do %>
9
24
  <span class="visible-xs"><i class="fa-gift"></i></span>
10
- <span class="hidden-xs"><%= key %></span>
11
- <% end %>
25
+ <span class="hidden-xs"><%#= key %></span>
26
+ <%# end %>
12
27
  </li>
13
- <% end %>
14
- </ul>
15
- <div class="tab-content">
16
- <div class="tab-pane active">
17
-
18
- <div id="div_blog_post_action_buttons">
19
-
20
- <div class="row">
21
- <div class="col-sm-6">
22
- <%= theme_button('Add a Blog Post', 'plus', new_blog_post_path(), classes: "pull-left", btn_type: "success") if @current_user.has_create_permission?(Dhatu::BlogPost) %>
23
-
24
- <%= theme_button('Refresh', 'refresh', blog_posts_path(st: @status), classes: "pull-left ml-10", btn_type: "white") %>
25
- </div>
26
- <div class="col-sm-6">
27
- <%= search_form_kuppayam(Dhatu::BlogPost, blog_posts_path, text: @filters[:query]) %>
28
+ <%# end %>
29
+ </ul> -->
30
+
31
+ <div class="tab-content">
32
+ <div class="tab-pane active">
33
+
34
+ <div id="div_blog_post_action_buttons">
35
+
36
+ <div class="row">
37
+ <div class="col-sm-6">
38
+ <%= theme_button('Add a Blog Post', 'plus', new_blog_post_path(ct: @category.try(:id)), classes: "pull-left", btn_type: "success") if @current_user.has_create_permission?(Dhatu::BlogPost) %>
39
+
40
+ <%= theme_button('Refresh', 'refresh', blog_posts_path(ct: @category.try(:id)), classes: "pull-left ml-10", btn_type: "white") %>
41
+ </div>
42
+ <div class="col-sm-6">
43
+ <%= search_form_kuppayam(Dhatu::BlogPost, blog_posts_path, text: @filters[:query]) %>
44
+ </div>
28
45
  </div>
46
+
29
47
  </div>
48
+ <%= clear_tag(10) %>
30
49
 
31
- </div>
32
- <%= clear_tag(10) %>
50
+ <div id="div_blog_post_index">
51
+ <%= render :partial=>"dhatu/blog_posts/index" %>
52
+ </div>
53
+ <%= clear_tag(10) %>
33
54
 
34
- <div id="div_blog_post_index">
35
- <%= render :partial=>"dhatu/blog_posts/index" %>
36
55
  </div>
37
- <%= clear_tag(10) %>
38
-
39
56
  </div>
57
+
40
58
  </div>
41
59
 
42
60
  </div>
@@ -17,7 +17,7 @@
17
17
  <%= theme_form_field(@price, :sub_title, required: false, form_style: "top-bottom", html_options: { placeholder: "" }) %>
18
18
  </div>
19
19
  <div class="col-md-6">
20
- <% options = {assoc_collection: Dhatu::Category.filter_by_category_type("Price").published.select("id, name").order("name ASC").all, editable: true, assoc_display_method: :name} %>
20
+ <% options = {assoc_collection: Dhatu::Category.filter_by_category_type("Dhatu::Price").published.select("id, name").order("name ASC").all, editable: true, assoc_display_method: :name} %>
21
21
  <%= theme_form_assoc_group(@price, :category_id, label: "Choose Category", form_style: "top-bottom", **options) %>
22
22
  </div>
23
23
  </div>
@@ -14,7 +14,7 @@
14
14
 
15
15
  <div class="row">
16
16
  <div class="col-md-4 pr-20">
17
- <% options = {assoc_collection: Dhatu::Category.filter_by_category_type("Service").published.select("id, name").order("name ASC").all, editable: true, assoc_display_method: :name} %>
17
+ <% options = {assoc_collection: Dhatu::Category.filter_by_category_type("Dhatu::Service").published.select("id, name").order("name ASC").all, editable: true, assoc_display_method: :name} %>
18
18
  <%= theme_form_assoc_group(@service, :category_id, label: "Choose Category", form_style: "top-bottom", **options) %>
19
19
  </div>
20
20
  <div class="col-md-4 pl-20">
data/lib/dhatu/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Dhatu
2
- VERSION = '0.1.7'
2
+ VERSION = '0.1.8'
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: dhatu
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.7
4
+ version: 0.1.8
5
5
  platform: ruby
6
6
  authors:
7
7
  - kpvarma