dhatu 0.1.8 → 0.1.9

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: '081c3b426eb7136d392844e905662d48468f3ca8'
4
- data.tar.gz: d0d80ccbd33b16435c8c1091d799d9ce5acf3019
3
+ metadata.gz: 4bf01e6348dbd1e36eda6fdb715f8a0f4b263c23
4
+ data.tar.gz: cd49b8e0823e61004aee6ed689f47a851caccb86
5
5
  SHA512:
6
- metadata.gz: 9064518b345800624470acb3ca70383d3b18e337ab4ebf501bf1d3be8f724d747907c2314f01c76ff5b31aee91995a58b56473e01dbff9af1ee0a447122ae899
7
- data.tar.gz: b4065b4b48cbc61e1d59eeb7d1ce9e7774fa9f86324ec3d7c1dd0197955288897abf151ac57d41f1833051483fbac98590505be46b29c1ac498c6fbb93c8b793
6
+ metadata.gz: b130516a2a5992a155772813047131f0e0b540a2e43d6b7e2b419979b3ac83b8ffdfece6714afbc34642cb492f600c2723b13fc06d3070181bf2b0db642426d6
7
+ data.tar.gz: bef9428021bbf487d6e0291bca54e454c10d52986e33673bde70602ce44c6794cb8a822397fae8be0860864129fad0a1a2c19c9a9b741627d9c3d13c93d07cd9
@@ -2,7 +2,7 @@ module Dhatu
2
2
  class BlogPostsController < ResourceController
3
3
 
4
4
  def new
5
- get_category
5
+ get_category_filters("Dhatu::BlogPost")
6
6
  @r_object = @blog_post = Dhatu::BlogPost.new(category: @category)
7
7
  render_accordingly
8
8
  end
@@ -14,23 +14,14 @@ module Dhatu
14
14
  end
15
15
 
16
16
  def get_collections
17
+ get_category_filters("Dhatu::BlogPost")
17
18
  @relation = Dhatu::BlogPost.includes(:cover_image).where("")
18
- get_category
19
19
  parse_filters
20
20
  apply_filters
21
21
  @blog_posts = @r_objects = @relation.page(@current_page).per(@per_page)
22
22
  return true
23
23
  end
24
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
-
34
25
  def apply_filters
35
26
  if @category
36
27
  if @category.id == -1
@@ -39,11 +30,9 @@ module Dhatu
39
30
  @relation = @relation.where("category_id = ?", @category.id)
40
31
  end
41
32
  end
42
-
43
33
  @relation = @relation.search(@query) if @query
44
34
  @relation = @relation.status(@status) if @status
45
-
46
- @order_by = "created_at desc" unless @order_by
35
+ @order_by = "posted_at desc, created_at desc" unless @order_by
47
36
  @relation = @relation.order(@order_by)
48
37
  end
49
38
 
@@ -53,9 +42,7 @@ module Dhatu
53
42
  { filter_name: :query },
54
43
  { filter_name: :status }
55
44
  ],
56
-
57
45
  boolean_filters: [],
58
-
59
46
  reference_filters: [],
60
47
  variable_filters: [],
61
48
  }
@@ -8,9 +8,7 @@ module Dhatu
8
8
  end
9
9
 
10
10
  def get_collections
11
- @categories = Dhatu::Category.where(category_type: "Dhatu::Price").all
12
- @categories.unshift(Dhatu::Category.new(id: -1, name: "All"))
13
-
11
+ get_category_filters("Dhatu::Price")
14
12
  @relation = Dhatu::Price.where("")
15
13
  parse_filters
16
14
  apply_filters
@@ -19,15 +17,18 @@ module Dhatu
19
17
  end
20
18
 
21
19
  def apply_filters
22
- @category = Dhatu::Category.find_by_id(params[:ct]) || Dhatu::Category.new(id: -1, name: "All")
23
-
24
- if @category && @category.id != -1
25
- @relation = @relation.where("category_id = ?", @category.id)
20
+ if @category
21
+ if @category.id == -1
22
+ @relation = @relation.where("category_id is NULL")
23
+ else
24
+ @relation = @relation.where("category_id = ?", @category.id)
25
+ end
26
26
  end
27
-
27
+
28
28
  @relation = @relation.search(@query) if @query
29
29
  @relation = @relation.status(@status) if @status
30
- @relation = @relation.order("priority ASC, title ASC")
30
+ @order_by = "priority ASC, title ASC" unless @order_by
31
+ @relation = @relation.order(@order_by)
31
32
  end
32
33
 
33
34
  def configure_filter_settings
@@ -38,7 +39,6 @@ module Dhatu
38
39
  ],
39
40
 
40
41
  boolean_filters: [],
41
-
42
42
  reference_filters: [],
43
43
  variable_filters: [],
44
44
  }
@@ -83,7 +83,7 @@ module Dhatu
83
83
  end
84
84
 
85
85
  def set_navs
86
- set_nav("price")
86
+ set_nav("dhatu/price")
87
87
  end
88
88
  end
89
89
  end
@@ -9,5 +9,14 @@ module Dhatu
9
9
  before_action :require_update_permission, only: [:update, :update_status, :mark_as_featured, :remove_from_featured]
10
10
  before_action :require_delete_permission, only: [:destroy]
11
11
 
12
+ def get_category_filters(category_type)
13
+ if params[:ct].to_s == "-1"
14
+ @category = Dhatu::Category.new(id: -1, name: "None")
15
+ elsif params[:ct]
16
+ @category = Dhatu::Category.find_by_id(params[:ct])
17
+ end
18
+ @categories = Dhatu::Category.where(category_type: category_type).order("priority ASC, name ASC").all
19
+ end
20
+
12
21
  end
13
22
  end
@@ -148,7 +148,7 @@ class Dhatu::Category < Dhatu::ApplicationRecord
148
148
  end
149
149
 
150
150
  def set_end_node_of_parent
151
- self.parent.set_end_node! if self.parent && self.parent_id_changed?
151
+ self.parent.set_end_node! if self.parent
152
152
  end
153
153
 
154
154
  protected
@@ -20,6 +20,8 @@
20
20
 
21
21
  <%= theme_panel_sub_heading(@blog_post.author, "#") if @blog_post.author %>
22
22
 
23
+ <%= clear_tag(10) %>
24
+ <span class="mr-5 mt-5 badge badge-warning"><%= @blog_post.category.try(:name) %></span>
23
25
  <%= clear_tag(10) %>
24
26
 
25
27
  <%= display_publishable_status(@blog_post) %>
@@ -48,7 +48,8 @@
48
48
  <tr>
49
49
  <th style="text-align: center;width:60px">#</th>
50
50
  <th>Name</th>
51
- <th>Type</th>
51
+ <th>Category Type</th>
52
+ <th>Priority</th>
52
53
  <!-- <th>Parent</th>
53
54
  <th>Top Parent</th> -->
54
55
  <th style="text-align: center;width:100px;">Status</th>
@@ -79,6 +80,7 @@
79
80
  <% end %>
80
81
 
81
82
  <td><%= category.display_category_type %></td>
83
+ <td><%= category.priority %></td>
82
84
 
83
85
  <td class="hidden-sm hidden-xs"><%= display_publishable_status(category) %></td>
84
86
 
@@ -86,6 +88,7 @@
86
88
  <td class="action-links hidden-sm hidden-xs" style="width:10%"><%= display_publishable_links(category) %></td>
87
89
 
88
90
  <td class="action-links hidden-sm hidden-xs" style="width:10%">
91
+ <%= link_to raw("<i class=\"linecons-desktop\"></i> View Details"), category_path(category), :remote=>true, style: "color:#40bbea" %>
89
92
  <%= display_manage_links(category, @current_user) %>
90
93
  </td>
91
94
  <% end %>
@@ -16,75 +16,17 @@
16
16
  <% end %>
17
17
 
18
18
  <td><%= category.display_category_type %></td>
19
+ <td><%= category.priority %></td>
19
20
 
20
- <!--
21
- <%# if category.parent == @current_category %>
22
- <td class="category-name"><%#= category.parent.display_name if category.parent %></td>
23
- <%# else %>
24
- <td class="category-name"><%#= link_to category.parent.display_name, categories_path(parent_id: category.parent.id), remote: true if category.parent %></td>
25
- <%# end %>
26
-
27
- <%# if category.top_parent == @current_category %>
28
- <td class="category-name"><%#= category.top_parent.display_name if category.top_parent %></td>
29
- <%# else %>
30
- <td class="category-name"><%#= link_to category.top_parent.display_name, categories_path(parent_id: category.top_parent.id), remote: true if category.top_parent %></td>
31
- <%# end %>
32
- -->
33
-
34
- <td style="text-align: center;width:100px;">
35
- <% if category.unpublished? %>
36
- <span class="ml-5 mt-5 label label-default">Un-Published</span>
37
- <% elsif category.published? %>
38
- <span class="ml-5 mt-5 label label-success">Published</span>
39
- <% elsif category.removed? %>
40
- <span class="ml-5 mt-5 label label-danger">Disabled</span>
41
- <% end %>
42
- </td>
43
-
44
- <!--
45
- <td style="text-align: center;width:100px;"><%#= category.priority if category.priority %></td>
46
- <td style="text-align: center;width:120px;"><%#= category.end_node.to_s.titleize %></td>
47
- -->
21
+ <td class="hidden-sm hidden-xs"><%= display_publishable_status(category) %></td>
48
22
 
49
23
  <% if display_manage_links? %>
50
- <% edit_link = edit_category_path(id: category.id) %>
51
- <% delete_link = category_path(id: category.id) %>
52
-
53
- <td class="action-links" style="width:10%">
54
-
55
- <% case category.status %>
56
- <% when "published" %>
57
- <!-- Un-Publish -->
58
- <%= link_to raw("<i class=\"fa fa-circle mr-5\"></i> Un-Publish"), update_status_category_path(:id =>category.id, :status =>'unpublished'), :method =>'PUT', :remote=>true, role: "menuitem", tabindex: "-1", :class=>"category_status" if category.can_be_unpublished? %>
59
-
60
- <!-- Remove -->
61
- <%= link_to raw("<i class=\"fa fa-edit mr-5\"></i> Remove"), update_status_category_path(:id =>category.id, :status =>'removed'), :method =>'PUT', :remote=>true, role: "menuitem", tabindex: "-1", :class=>"category_status" if category.can_be_removed? %>
62
- <% when "unpublished" %>
63
- <!-- Publish -->
64
- <%= link_to raw("<i class=\"fa fa-circle-o mr-5\"></i> Publish"), update_status_category_path(:id =>category.id, :status =>'published'), :method =>'PUT', :remote=>true, role: "menuitem", tabindex: "-1", :class=>"category_status" if category.can_be_published? %>
65
- <!-- Remove -->
66
- <%= link_to raw("<i class=\"fa fa-edit mr-5\"></i> Remove"), update_status_category_path(:id =>category.id, :status =>'removed'), :method =>'PUT', :remote=>true, role: "menuitem", tabindex: "-1", :class=>"category_status" if category.can_be_removed? %>
67
- <% when "removed" %>
68
- <!-- Un-Publish -->
69
- <%= link_to raw("<i class=\"fa fa-circle mr-5\"></i> Un-Publish"), update_status_category_path(:id =>category.id, :status =>'unpublished'), :method =>'PUT', :remote=>true, role: "menuitem", tabindex: "-1", :class=>"category_status" if category.can_be_unpublished? %>
70
- <!-- Publish -->
71
- <%= link_to raw("<i class=\"fa fa-circle-o mr-5\"></i> Publish"), update_status_category_path(:id =>category.id, :status =>'published'), :method =>'PUT', :remote=>true, role: "menuitem", tabindex: "-1",:class=>"category_status" if category.can_be_published? %>
72
- <% end %>
73
-
74
- </td>
75
-
76
- <td class="action-links" style="width:10%">
24
+ <td class="action-links hidden-sm hidden-xs" style="width:10%"><%= display_publishable_links(category) %></td>
77
25
 
26
+ <td class="action-links hidden-sm hidden-xs" style="width:10%">
78
27
  <%= link_to raw("<i class=\"linecons-desktop\"></i> View Details"), category_path(category), :remote=>true, style: "color:#40bbea" %>
79
-
80
- <%= link_to raw("<i class=\"fa-plus\"></i> Add Sub Category"), new_category_path(parent_id: category.id), :remote=>true, class: "edit" %>
81
-
82
- <%= link_to raw("<i class=\"linecons-pencil\"></i> Edit Category"), edit_link, :remote=>true, class: "edit1" if category.can_be_edited? %>
83
-
84
- <%= link_to raw("<i class=\"linecons-trash\"></i> Delete"), delete_link, method: :delete, role: "menuitem", tabindex: "-1", data: { confirm: 'Are you sure?' }, :remote=>true, class: "delete" if category.can_be_deleted? && display_delete_links? %>
85
-
28
+ <%= display_manage_links(category, @current_user) %>
86
29
  </td>
87
-
88
30
  <% end %>
89
31
 
90
32
  </tr>
@@ -5,14 +5,4 @@
5
5
  <%= render partial: "usman/dashboard/super_admin_index" if @current_user.super_admin? %>
6
6
 
7
7
  <!-- Manage Location -->
8
- <%= render partial: "pattana/dashboard/index" %>
9
-
10
- <div style="border-top:1px solid #FFF;margin-top:50px;margin-bottom:70px;"></div>
11
-
12
- <div class="dx-warning mt-60">
13
- <div>
14
- <h2>Usman - API Documentation</h2>
15
- <p>All APIs are documented with all cases and examples.</p>
16
- <a class="btn btn-success" href="/docs/api/v1/register" target="_blank">Go to the API Documentation</a>
17
- </div>
18
- </div>
8
+ <%= render partial: "pattana/dashboard/index" %>
@@ -5,6 +5,7 @@
5
5
  <th style="text-align: center;width:5%">#</th>
6
6
  <th>Item</th>
7
7
  <th style="width:200px">Price</th>
8
+ <th>Priority</th>
8
9
  <th style="width:100px;" class="hidden-sm hidden-xs">Status</th>
9
10
  <% if display_manage_links? %>
10
11
  <th style="text-align: center;" colspan="2" class="hidden-sm hidden-xs" >Actions</th>
@@ -26,7 +27,7 @@
26
27
  </td>
27
28
 
28
29
  <td class="hidden-sm hidden-xs"><%= price.price %></td>
29
-
30
+ <td class="hidden-sm hidden-xs"><%= price.priority %></td>
30
31
  <td class="hidden-sm hidden-xs"><%= display_publishable_status(price) %></td>
31
32
 
32
33
  <% if display_manage_links? %>
@@ -5,11 +5,17 @@
5
5
  <div class="tabs-vertical-env">
6
6
 
7
7
  <ul id="div_category_types" class="nav tabs-vertical">
8
+ <li class="<%= @category.blank? ? 'active' : '' %>">
9
+ <%= link_to "All", prices_path, style: "text-align:left;" %>
10
+ </li>
8
11
  <% @categories.each do |ct| %>
9
- <li class="<%= ct == @category ? 'active' : '' %>">
10
- <%= link_to ct.name, prices_path(ct: ct.id) %>
12
+ <li class="<%= @category && @category == ct ? 'active' : '' %>">
13
+ <%= link_to ct.name, prices_path(ct: ct.id), style: "text-align:left;" %>
11
14
  </li>
12
15
  <% end %>
16
+ <li class="<%= @category && @category.id == -1 ? 'active' : '' %>">
17
+ <%= link_to "None", prices_path(ct: -1), style: "text-align:left;" %>
18
+ </li>
13
19
  </ul>
14
20
 
15
21
  <!-- <ul class="nav nav-tabs nav-tabs-justified">
@@ -137,7 +137,7 @@
137
137
  <header class="logo-env">
138
138
  <!-- logo -->
139
139
  <div class="logo">
140
- <a href="/" class="logo-expanded"><img src="/assets/logo.png" width="180" alt="" /></a>
140
+ <a href="/" class="logo-expanded"><img src="/assets/logo-white.png" width="180" alt="" /></a>
141
141
  <a href="/" class="logo-collapsed"><img src="/assets/logo-small.png" width="40" alt="" /></a>
142
142
  </div>
143
143
 
@@ -1,3 +1,3 @@
1
1
  module Dhatu
2
- VERSION = '0.1.8'
2
+ VERSION = '0.1.9'
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: dhatu
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.8
4
+ version: 0.1.9
5
5
  platform: ruby
6
6
  authors:
7
7
  - kpvarma
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2017-11-13 00:00:00.000000000 Z
11
+ date: 2017-11-14 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails
@@ -147,7 +147,7 @@ dependencies:
147
147
  version: '0.3'
148
148
  - - ">="
149
149
  - !ruby/object:Gem::Version
150
- version: 0.3.17
150
+ version: 0.3.18
151
151
  type: :runtime
152
152
  prerelease: false
153
153
  version_requirements: !ruby/object:Gem::Requirement
@@ -157,7 +157,7 @@ dependencies:
157
157
  version: '0.3'
158
158
  - - ">="
159
159
  - !ruby/object:Gem::Version
160
- version: 0.3.17
160
+ version: 0.3.18
161
161
  - !ruby/object:Gem::Dependency
162
162
  name: bcrypt
163
163
  requirement: !ruby/object:Gem::Requirement