forge-cli 0.1.2 → 0.1.3

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: 93164ce3ded841c7e1386103fdafe25682b7a2e2
4
- data.tar.gz: 9d915a573f35fec067b6ca3ebe472c2e22f776bf
3
+ metadata.gz: 3b3d1320e7a05a69b6ece89788ed2e3482339a41
4
+ data.tar.gz: 3cff55052ce0d38c2fcff392b91f4f2e5a200f67
5
5
  SHA512:
6
- metadata.gz: 9fedc0a81b91b7332ef5c28a43bae50d195c4eba255e30d0f4c793d928120bc7933a856f8dd2002f1c5dabd857c2eb41ddf567d3be75d5337c0527cfa5f39653
7
- data.tar.gz: ac85e5eeffc9069a8af2e23d055439d2bd42af70969df7b95d0ebe1f8e6dc46f81f503ab7d9a9a4402d296f438ef04453d64e23d29e20040afaaf14815998bc6
6
+ metadata.gz: 7500f26b32b9112a8e86dafe52f6d9e4df8b3a596db8fe820306f2bd1d0d53e9f61ed4b84bdd151dc136272e8d4562f060363011e676578cf7dd4480b4c0d3ee
7
+ data.tar.gz: c8b04edd0fe995318206e7e02c4937a9275418811f610d2006cdf11819da358fa4e5d93ef7f37fff47a45171357b1d4166d72c39e7930a93798e34c7372c4e81
@@ -1,3 +1,3 @@
1
1
  class ForgeCLI
2
- VERSION = '0.1.2'
2
+ VERSION = '0.1.3'
3
3
  end
@@ -9,9 +9,10 @@ class Forge::PagesController < ForgeController
9
9
  @pages = @pages.order(:lft)
10
10
  }
11
11
  format.js {
12
- ids = Page.where("title LIKE :q OR content LIKE :q", {:q => "%#{params[:q]}%"}).collect {|p| p.top_parent.id}
12
+ params[:q] ||= ''
13
+ ids = Page.where("LOWER(title) LIKE :q OR LOWER(content) LIKE :q", {:q => "%#{params[:q].downcase}%"}).collect {|p| p.top_parent.id}
13
14
  @pages = Page.top.where("id IN (?)", ids)
14
- render :partial => "page", :collection => @pages
15
+ render :partial => "page_list", :locals => { :pages => @pages }
15
16
  }
16
17
  end
17
18
  end
@@ -7,7 +7,8 @@ class Forge::PostsController < ForgeController
7
7
  respond_to do |format|
8
8
  format.html { @posts = Post.paginate(:per_page => 10, :page => params[:page]) }
9
9
  format.js {
10
- @posts = Post.where("title LIKE :q OR content LIKE :q", {:q => "%#{params[:q]}%"})
10
+ params[:q] ||= ''
11
+ @posts = Post.where("LOWER(title) LIKE :q OR LOWER(content) LIKE :q", {:q => "%#{params[:q].downcase}%"})
11
12
  render :partial => "post", :collection => @posts
12
13
  }
13
14
  end
@@ -30,6 +30,7 @@ class PostsController < ApplicationController
30
30
 
31
31
  def show
32
32
  @post, @page_title = get_post
33
+ flash.now[:notice] = "This post is not yet posted and will not appear on your live website." unless @post.posted?
33
34
  @comment = Comment.create_comment(@post, session[:comment]) if @post.allow_comments?
34
35
  respond_to do |format|
35
36
  format.html {}
@@ -51,7 +52,7 @@ class PostsController < ApplicationController
51
52
 
52
53
  private
53
54
  def get_post
54
- post = Post.posted.find(params[:id])
55
+ post = current_user.blank? ? Post.posted.find(params[:id]) : Post.find(params[:id])
55
56
  page_title = post.seo_title.blank? ? post.title : post.seo_title
56
57
  return post, page_title
57
58
  end
@@ -5,7 +5,7 @@ module Forge::TreeHelper
5
5
 
6
6
  return '' if objects.size == 0
7
7
 
8
- output = %{<ul id="item-list">\n<li class="top">\n<div class="item-content">\n}
8
+ output = %{<li class="top">\n<div class="item-content">\n}
9
9
  path = [nil]
10
10
 
11
11
  objects.each_with_index do |o, i|
@@ -41,7 +41,7 @@ module Forge::TreeHelper
41
41
  if p
42
42
  output << %{\n</li>\n</ul>}
43
43
  else
44
- output << %{\n</div>\n</li>\n</ul>}
44
+ output << %{\n</div>\n</li>}
45
45
  end
46
46
  end
47
47
 
@@ -84,4 +84,4 @@ module Forge::TreeHelper
84
84
  end
85
85
  end
86
86
  end
87
- end
87
+ end
@@ -54,6 +54,10 @@ class Post < ActiveRecord::Base
54
54
  Post.where("created_at < ?", created_at)[0]
55
55
  end
56
56
 
57
+ def posted?
58
+ self.published && self.created_at <= Time.now
59
+ end
60
+
57
61
  private
58
62
  def set_created_at
59
63
  created_at_date && created_at_time && self.created_at = "#{created_at_date} #{created_at_time}"
@@ -17,10 +17,5 @@
17
17
  %p.info These are all of the regular pages in your site. You can drag &amp; drop pages and subpages to change their order.
18
18
 
19
19
  = render :partial => "forge/shared/section_header", :locals => {:item => Page}
20
- = sorted_nested_li(@pages, :list_order) do |page|
21
- - page = page[0] if page.is_a?(Array)
22
- - if page.parent_id
23
- = render "subpage", :subpage => page
24
- - else
25
- = render "page", :page => page
26
- #item-list-bottom
20
+ %ul#item-list= render :partial => "page_list", :locals => { :pages => @pages }
21
+ #item-list-bottom
@@ -0,0 +1,6 @@
1
+ = sorted_nested_li(pages, :list_order) do |page|
2
+ - page = page[0] if page.is_a?(Array)
3
+ - if page.parent_id
4
+ = render "subpage", :subpage => page
5
+ - else
6
+ = render "page", :page => page
@@ -17,8 +17,8 @@
17
17
  });
18
18
 
19
19
  function runUpdate() {
20
- var currentValue = $(this).attr('value');
21
-
20
+ var currentValue = $(this).val();
21
+
22
22
  // Do nothing if the search hasn't changed
23
23
  if (currentValue == previousValue) {
24
24
  return;
@@ -73,7 +73,5 @@
73
73
  $('#item-list-bottom div.regular').fadeIn('fast');
74
74
  });
75
75
  }
76
-
77
-
78
76
  }
79
77
  })(jQuery);
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: forge-cli
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.2
4
+ version: 0.1.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - factor[e] design initiative
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2013-09-17 00:00:00.000000000 Z
11
+ date: 2013-09-18 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rake
@@ -539,6 +539,7 @@ files:
539
539
  - lib/forge/app/views/orders/checkout.html.haml
540
540
  - lib/forge/app/views/orders/edit_cart.html.haml
541
541
  - lib/forge/app/views/orders/paid.html.haml
542
+ - lib/forge/app/views/pages/_page_list.html.haml
542
543
  - lib/forge/app/views/pages/show.html.haml
543
544
  - lib/forge/app/views/posts/_archive_months.html.haml
544
545
  - lib/forge/app/views/posts/_categories.html.haml