caboose-cms 0.9.45 → 0.9.46

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: e45d310e511ea1133be2c81e81d4f9aa9fe8398c
4
- data.tar.gz: c2491ae0770cb1eee05adb3607f7e7f2d5f25156
3
+ metadata.gz: 4f5e900afbb5c23ac007b1169cf8372b78aaa663
4
+ data.tar.gz: 1b882f005892a0a85f132d77d40e06e5cb205956
5
5
  SHA512:
6
- metadata.gz: d487a8fa40d900ec40578c8d7016274b172786c9041830b96a5a74431ce99607a621a968d4106e628e87b43510982a2a062a345a219e9673997d272abd50cbcd
7
- data.tar.gz: 50b8e3e8bb22855e7be22a111054715cef712b8ded6b54acdad874baaafd5063d9768f10e57f625ab1a36fd68ac55e5995e6ce5d54cb44db2e030e772092e82e
6
+ metadata.gz: 609840c9b65abd91007bebfde356a3abf74d3f4efe396345092570fbc322ecdcf248294555cb2487c0b528079d748982e5e56cc249f783bc9408ec09c7b2bc4e
7
+ data.tar.gz: b3560befbc405e208a55c16cf73f5073bb6508f27d1a920383f4758549175b2d4f321644d7fb95fc4ee8a03810d13f026f774b8ca92069c087a3694c3940ff9c
@@ -1,5 +1,6 @@
1
1
  module Caboose
2
2
  class PostsController < ApplicationController
3
+ layout 'caboose/admin'
3
4
 
4
5
  helper :application
5
6
 
@@ -32,21 +33,30 @@ module Caboose
32
33
  # Admin actions
33
34
  #=============================================================================
34
35
 
36
+ # @route_priority 100
35
37
  # @route GET /admin/posts
36
38
  def admin_index
39
+ return if !user_is_allowed('posts', 'view')
40
+ end
41
+
42
+ # @route GET /admin/posts/json
43
+ def admin_json
37
44
  return if !user_is_allowed('posts', 'view')
38
45
 
39
- @gen = Caboose::PageBarGenerator.new(params, {
46
+ pager = PageBarGenerator.new(params, {
40
47
  'site_id' => @site.id,
41
- 'name' => ''
48
+ 'title_like' => '',
42
49
  },{
43
50
  'model' => 'Caboose::Post',
44
- 'sort' => 'created_at DESC',
45
- 'desc' => false,
46
- 'base_url' => '/admin/posts'
51
+ 'sort' => 'created_at',
52
+ 'desc' => true,
53
+ 'base_url' => '/admin/posts',
54
+ 'use_url_params' => false
47
55
  })
48
- @posts = @gen.items
49
- render :layout => 'caboose/admin'
56
+ render :json => {
57
+ :pager => pager,
58
+ :models => pager.items.as_json()
59
+ }
50
60
  end
51
61
 
52
62
  # @route GET /admin/posts/:id/json
@@ -218,7 +218,7 @@ module Caboose
218
218
  invalid_cost = false
219
219
  self.line_items.each do |li|
220
220
  invalid_cost = true if li.variant.nil? || li.variant.cost.nil?
221
- x = x + (li.variant.cost * li.quantity)
221
+ x = (x + (li.variant.cost * li.quantity)) if (!li.variant.cost.blank? && !li.quantity.blank?)
222
222
  end
223
223
  return 0.00 if invalid_cost
224
224
  return x
@@ -9,7 +9,7 @@ body { margin: 0; padding: 0; text-align: center; }
9
9
  </head>
10
10
  <body>
11
11
  <div class="container">
12
- <p>We apologize for the inconvenience, but we're in the process of upgrading our site. We'll be finished very soon!</p>
12
+ <p>We apologize for the inconvenience, but we're in the process of upgrading our site.&nbsp;We'll be finished very soon!</p>
13
13
  </div>
14
14
  </body>
15
15
  </html>
@@ -1,37 +1,36 @@
1
1
  <h1>Posts</h1>
2
- <p><input type='button' value='New Post' onclick="window.location='/admin/posts/new';" /></p>
3
-
4
- <% if @posts && @posts.count > 0 %>
5
- <table class='data'>
6
- <tr>
7
- <%= raw @gen.sortable_table_headings({
8
- 'id' => 'ID #',
9
- 'published' => 'Published',
10
- 'title' => 'Title',
11
- # 'body' => 'Body',
12
- 'created_at' => 'Date Created'
13
- })
14
- %>
15
- </tr>
16
- <% @posts.each do |p| %>
17
- <tr onclick="window.location='/admin/posts/<%= p.id %>';">
18
- <td><%= raw p.id %></td>
19
- <td><%= p.published ? "Yes" : "No" %></td>
20
- <td><%= raw p.title %></td>
21
-
22
- <td><%= p.created_at.strftime("%m/%d/%Y") %></td>
23
- </tr>
24
- <% end %>
25
- </table>
26
- <p><%= raw @gen.generate %></p>
27
- <% else %>
28
- <p>There are no posts right now.</p>
29
- <% end %>
2
+ <div id='posts'></div>
30
3
 
31
4
  <% content_for :caboose_js do %>
5
+ <%= javascript_include_tag 'caboose/model/all' %>
32
6
  <script type='text/javascript'>
33
- $(document).ready(function() {
34
- var modal = new CabooseModal(800);
7
+
8
+ $(document).ready(function() {
9
+ var that = this;
10
+ var table = new IndexTable({
11
+ form_authenticity_token: '<%= form_authenticity_token %>',
12
+ container: 'posts',
13
+ base_url: '/admin/posts',
14
+ allow_bulk_import: false ,
15
+ allow_bulk_edit: false ,
16
+ allow_bulk_delete: false ,
17
+ allow_duplicate: false ,
18
+ allow_advanced_edit: true ,
19
+ fields: [
20
+ { show: true , bulk_edit: false , name: 'title' , nice_name: 'Title' , sort: 'title' , type: 'text' , value: function(p) { return p.title }, width: 300, editable: false },
21
+ { show: true , bulk_edit: false , name: 'published' , nice_name: 'Published' , sort: 'published' , type: 'checkbox' , value: function(p) { return p.published ? 'Yes' : 'No' }, width: 100, editable: false },
22
+ { show: true , bulk_edit: false , name: 'created_at' , nice_name: 'Date Created' , sort: 'created_at' , type: 'date' , value: function(p) { return new Date(p.created_at).toLocaleDateString() }, width: 100, editable: false },
23
+ ],
24
+ new_model_text: 'New Post',
25
+ no_models_text: 'There are no posts right now.',
26
+ new_model_fields: [
27
+ { name: 'title', nice_name: 'Title', type: 'text', width: 400 }
28
+ ],
29
+ search_fields: [
30
+ { name: 'title_like', nice_name: 'Title' , type: 'text', width: 400 },
31
+ ],
32
+ });
35
33
  });
34
+
36
35
  </script>
37
- <% end %>
36
+ <% end %>
@@ -1,3 +1,3 @@
1
1
  module Caboose
2
- VERSION = '0.9.45'
2
+ VERSION = '0.9.46'
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: caboose-cms
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.9.45
4
+ version: 0.9.46
5
5
  platform: ruby
6
6
  authors:
7
7
  - William Barry
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2017-02-02 00:00:00.000000000 Z
11
+ date: 2017-02-27 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: pg
@@ -1317,7 +1317,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
1317
1317
  version: '0'
1318
1318
  requirements: []
1319
1319
  rubyforge_project:
1320
- rubygems_version: 2.5.1
1320
+ rubygems_version: 2.2.0
1321
1321
  signing_key:
1322
1322
  specification_version: 4
1323
1323
  summary: CMS built on rails.