browsercms 3.0.5 → 3.0.6

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,2 +1,5 @@
1
1
  class Cms::CategoriesController < Cms::ContentBlockController
2
- end
2
+ def show
3
+ redirect_to cms_categories_url
4
+ end
5
+ end
@@ -2,8 +2,8 @@ class Cms::LinksController < Cms::BaseController
2
2
 
3
3
  before_filter :set_toolbar_tab
4
4
  before_filter :load_section, :only => [:new, :create, :move_to]
5
- before_filter :load_link, :only => [:destroy]
6
- before_filter :load_draft_link, :only => [:edit, :update]
5
+ before_filter :load_link, :only => [:destroy, :update]
6
+ before_filter :load_draft_link, :only => [:edit]
7
7
 
8
8
  def new
9
9
  @link = Link.new(:section => @section)
@@ -2,7 +2,7 @@ class Cms::PortletsController < Cms::ContentBlockController
2
2
 
3
3
  protected
4
4
  def load_blocks
5
- @blocks = Portlet.paginate(
5
+ @blocks = Portlet.search(params[:search]).paginate(
6
6
  :page => params[:page],
7
7
  :order => params[:order] || "name",
8
8
  :conditions => ["deleted = ?", false]
@@ -37,4 +37,4 @@ class Cms::PortletsController < Cms::ContentBlockController
37
37
  def blocks_path
38
38
  cms_portlets_path
39
39
  end
40
- end
40
+ end
@@ -6,4 +6,7 @@ class Cms::TagsController < Cms::ContentBlockController
6
6
  format.js { render :inline => "var tags = #{@blocks.map{|e| e.name}.to_json}" }
7
7
  end
8
8
  end
9
- end
9
+ def show
10
+ redirect_to cms_tags_url
11
+ end
12
+ end
@@ -1,21 +1,3 @@
1
1
  # Any code for core CMS should go in /cms/application_helper.rb rather than here.
2
2
  module ApplicationHelper
3
-
4
- def require_stylesheet_link(sources=(), content_area=:html_head)
5
- @required_stylesheet_links ||= []
6
- new_links = sources.to_a - @required_stylesheet_links
7
- if !new_links.empty?
8
- @required_stylesheet_links |= new_links
9
- content_for(content_area, stylesheet_link_tag(new_links))
10
- end
11
- end
12
-
13
- def require_javascript_include(sources=(), content_area=:html_head)
14
- @required_javascript_includes ||= []
15
- new_links = sources.to_a - @required_javascript_includes
16
- if !new_links.empty?
17
- @required_javascript_includes |= new_links
18
- content_for(content_area, javascript_include_tag(new_links))
19
- end
20
- end
21
3
  end
@@ -1,6 +1,24 @@
1
1
  # Methods added to this helper will be available to all templates in the cms.
2
2
  module Cms
3
3
  module ApplicationHelper
4
+
5
+ def require_stylesheet_link(sources=(), content_area=:html_head)
6
+ @required_stylesheet_links ||= []
7
+ new_links = sources.to_a - @required_stylesheet_links
8
+ if !new_links.empty?
9
+ @required_stylesheet_links |= new_links
10
+ content_for(content_area, stylesheet_link_tag(new_links))
11
+ end
12
+ end
13
+
14
+ def require_javascript_include(sources=(), content_area=:html_head)
15
+ @required_javascript_includes ||= []
16
+ new_links = sources.to_a - @required_javascript_includes
17
+ if !new_links.empty?
18
+ @required_javascript_includes |= new_links
19
+ content_for(content_area, javascript_include_tag(new_links))
20
+ end
21
+ end
4
22
 
5
23
  def searchable_sections(selected = nil)
6
24
  root = Section.root.first
@@ -1,6 +1,7 @@
1
1
  class Portlet < ActiveRecord::Base
2
2
 
3
3
  validates_presence_of :name
4
+ is_searchable
4
5
 
5
6
  #These are here simply to temporarily hold these values
6
7
  #Makes it easy to pass them through the process of selecting a portlet type
@@ -154,4 +155,4 @@ class Portlet < ActiveRecord::Base
154
155
  end
155
156
  end
156
157
 
157
- end
158
+ end
data/app/models/tag.rb CHANGED
@@ -5,7 +5,7 @@ class Tag < ActiveRecord::Base
5
5
  validates_uniqueness_of :name
6
6
 
7
7
  attr_accessor :size
8
-
8
+ is_searchable
9
9
  named_scope :named, lambda{|tag| {:conditions => ["tags.name = ? ", tag]} }
10
10
 
11
11
  # Returns an array of tags with a count attribute
data/app/models/user.rb CHANGED
@@ -74,6 +74,14 @@ class User < ActiveRecord::Base
74
74
  "#{full_name} (#{login})"
75
75
  end
76
76
 
77
+ def full_name_or_login
78
+ if full_name.strip.blank?
79
+ login
80
+ else
81
+ full_name
82
+ end
83
+ end
84
+
77
85
  # This is to show a formated date on the input form. I'm unsure that
78
86
  # this is the best way to solve this, but it works.
79
87
  def expires_at_formatted
@@ -18,4 +18,10 @@
18
18
  <%= render_connectable connectable %>
19
19
  </div>
20
20
  <% require_javascript_include ['jquery', 'cms/application'] %>
21
-
21
+ <% content_for :html_head do %>
22
+ <% if @authenticity_token_loaded.nil? && protect_against_forgery? %><script type="text/javascript">
23
+ jQuery(function($){
24
+ $.cms.authenticity_token = '<%= form_authenticity_token %>'
25
+ })
26
+ </script><% end %><% @authenticity_token_loaded = true %>
27
+ <% end %>
@@ -26,7 +26,7 @@
26
26
  <% @users.each do |user|%>
27
27
  <tr>
28
28
  <td class="first"></td>
29
- <td><div class="dividers"><%= link_to "#{user.first_name} #{user.last_name}", edit_cms_user_path(user) %></div></td>
29
+ <td><div class="dividers"><%= link_to "#{user.full_name_or_login}", edit_cms_user_path(user) %></div></td>
30
30
  <td><div class="dividers"><%= link_to user.email, "mailto:#{user.email}" %></div></td>
31
31
  <td>
32
32
  <div class="dividers">
data/browsercms.gemspec CHANGED
@@ -5,11 +5,11 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = %q{browsercms}
8
- s.version = "3.0.5"
8
+ s.version = "3.0.6"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = ["BrowserMedia"]
12
- s.date = %q{2009-12-23}
12
+ s.date = %q{2009-12-30}
13
13
  s.email = %q{github@browsermedia.com}
14
14
  s.extra_rdoc_files = [
15
15
  "LICENSE.txt",
@@ -26,9 +26,6 @@ class Cms::ApplicationHelperTest < ActionView::TestCase
26
26
  assert_equal "bar", determine_order("foo", "bar")
27
27
  end
28
28
 
29
- end
30
-
31
- class ApplicationHelperTest < ActionView::TestCase
32
29
  # returns content supplied to this method for testing
33
30
  def content_for(name, content = nil, &block)
34
31
  return name, content
@@ -66,7 +66,18 @@ class UserTest < ActiveSupport::TestCase
66
66
  assert !@user.valid?
67
67
  end
68
68
  end
69
-
69
+ test "full name or login" do
70
+ login = 'robbo'
71
+ fn = 'Bob'
72
+ ln = 'Smith'
73
+ u = User.new(:login => 'robbo')
74
+ assert_equal login, u.full_name_or_login
75
+ u.first_name = fn
76
+ assert_equal fn, u.full_name_or_login
77
+ u.last_name = ln
78
+ assert_equal fn + ' ' + ln, u.full_name_or_login
79
+
80
+ end
70
81
  end
71
82
 
72
83
  class UserPermissionsTest < ActiveSupport::TestCase
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: browsercms
3
3
  version: !ruby/object:Gem::Version
4
- version: 3.0.5
4
+ version: 3.0.6
5
5
  platform: ruby
6
6
  authors:
7
7
  - BrowserMedia
@@ -9,7 +9,7 @@ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
11
 
12
- date: 2009-12-23 00:00:00 -05:00
12
+ date: 2009-12-30 00:00:00 -05:00
13
13
  default_executable:
14
14
  dependencies: []
15
15