deluxe_publisher 0.0.5 → 0.0.6

Sign up to get free protection for your applications and to get access to all the features.
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.0.5
1
+ 0.0.6
@@ -9,7 +9,7 @@ class DeluxePublisher::PageTypesController < ApplicationController
9
9
  # GET /deluxe_publisher/page_types
10
10
  # GET /deluxe_publisher/page_types.xml
11
11
  def index
12
- @deluxe_publisher_page_types = DeluxePublisher::PageType.all
12
+ @deluxe_publisher_page_types = DeluxePublisher::PageType.all(:order =>"position")
13
13
 
14
14
  respond_to do |format|
15
15
  format.html # index.html.erb
@@ -40,11 +40,17 @@ class DeluxePublisher::PresenterController < ApplicationController
40
40
  @tags = DeluxePublisher::Page.tag_counts_on(:tags)
41
41
  end
42
42
 
43
+ if @page.alias?
44
+ layout_page = DeluxePublisher::Page.find(@page.alias_page_id)
45
+ else
46
+ layout_page = @page
47
+ end
48
+
43
49
 
44
- if @page.page_type.layout.blank?
45
- render :template => "/deluxe_publisher/templates/#{@page.page_type.template}", :layout => false
50
+ if layout_page.page_type.layout.blank?
51
+ render :template => "/deluxe_publisher/templates/#{layout_page.page_type.template}", :layout => false
46
52
  else
47
- render :template => "/deluxe_publisher/templates/#{@page.page_type.template}", :layout => @page.page_type.layout
53
+ render :template => "/deluxe_publisher/templates/#{layout_page.page_type.template}", :layout => layout_page.page_type.layout
48
54
  end
49
55
  else
50
56
  page_not_found
@@ -3,6 +3,14 @@ module DeluxePublisher::PresenterHelper
3
3
 
4
4
  include ActsAsTaggableOn::TagsHelper
5
5
 
6
+ def contents
7
+ if @page.alias?
8
+ DeluxePublisher::Page.find(@page.alias_page_id).contents
9
+ else
10
+ @page.contents
11
+ end
12
+ end
13
+
6
14
 
7
15
  def blog_archive_list(blog)
8
16
 
@@ -98,7 +106,17 @@ module DeluxePublisher::PresenterHelper
98
106
  state = @nav_ancestor_ids.include?(page.id) ? "on":"off"
99
107
  current = @nav_current_id == page.id ? "current_page":""
100
108
  @tree.li({:id => "#{@nav_id_prefix}_#{page.dom_id}", :class => "level_#{level} #{state} #{current}"}) do
101
- @tree << link_to(page.menu_title, page.path)
109
+ if page.external_link?
110
+ href = page.external_url
111
+ else
112
+ href = page.path
113
+ end
114
+
115
+ if page.target_window.blank?
116
+ @tree << link_to(page.menu_title, href)
117
+ else
118
+ @tree << link_to(page.menu_title, href, :target =>page.target_window)
119
+ end
102
120
  unless page.leaf? || level >= @nav_depth
103
121
  @tree.ul(:class => "nav_directory") do
104
122
  pages.select{|i| i.parent_id == page.id}.sort_by{|p| [p.position, p.publish_at]}.each do |child_page|
@@ -20,10 +20,10 @@ class DeluxePublisher::Page < ActiveRecord::Base
20
20
  accepts_nested_attributes_for :contents
21
21
 
22
22
  validates_presence_of [:site_id, :parent_id, :footer_position, :page_type_id, :position,
23
- :browser_title, :page_title, :menu_title, :file_name], :unless => Proc.new {|page| page.menu_title == "ROOT"}
23
+ :browser_title, :page_title, :menu_title, :file_name], :unless => Proc.new {|page| page.menu_title == "ROOT"}
24
24
 
25
25
  # validates_format_of :file_name, :with => /\A[\w\-_\.]+\Z/
26
-
26
+
27
27
  acts_as_nested_set
28
28
 
29
29
  def init_stash
@@ -50,7 +50,7 @@ class DeluxePublisher::Page < ActiveRecord::Base
50
50
  self.path[1..-1]
51
51
  end
52
52
  def save_the_children # to update their paths
53
- # I believe the children are the future
53
+ # I believe the children are the future
54
54
  self.children.each do |child|
55
55
  child.save #they will save their children in turn
56
56
  end
@@ -82,9 +82,21 @@ class DeluxePublisher::Page < ActiveRecord::Base
82
82
  end
83
83
 
84
84
  def alias?
85
- false #TODO
85
+ if self.page_type.nil?
86
+ false #when parent is Root
87
+ else
88
+ self.page_type.function_as == "alias"
89
+ end
86
90
  end
87
-
91
+
92
+ def external_link?
93
+ if self.page_type.nil?
94
+ false #when parent is Root
95
+ else
96
+ self.page_type.function_as == "external_link"
97
+ end
98
+ end
99
+
88
100
  def blog_stories(options = {})
89
101
 
90
102
  options = {:limit => 10}.merge(options)
@@ -105,10 +117,10 @@ class DeluxePublisher::Page < ActiveRecord::Base
105
117
  end_date = start_date + 1.year
106
118
  end
107
119
 
108
-
120
+
109
121
  self.children.published.find(:all,
110
- :conditions => ["publish_at >= ? and publish_at < ?", start_date, end_date],
111
- :order => "publish_at desc")
122
+ :conditions => ["publish_at >= ? and publish_at < ?", start_date, end_date],
123
+ :order => "publish_at desc")
112
124
  end
113
125
  end
114
126
 
@@ -128,7 +140,7 @@ class DeluxePublisher::Page < ActiveRecord::Base
128
140
 
129
141
  def descriptor_for_position(position)
130
142
  unless self.page_type.nil?
131
- descriptor = self.page_type.content_descriptors.first(:conditions => {:position => position})
143
+ descriptor = self.page_type.content_descriptors.first(:conditions => {:position => position})
132
144
  else
133
145
  descriptor = DeluxePublisher::ContentDescriptor.new({:title => "Content", :content_type => "text"})
134
146
  end
@@ -197,7 +209,7 @@ class DeluxePublisher::Page < ActiveRecord::Base
197
209
  end
198
210
  end
199
211
 
200
- page
212
+ page
201
213
  end
202
214
 
203
215
 
@@ -33,6 +33,8 @@
33
33
  <%= f.radio_button :function_as, "web_page" %> <%= f.label :function_as_web_page, "Web Page"%>
34
34
  <%= f.radio_button :function_as, "blog_page" %> <%= f.label :function_as_blog_page, "Blog Page"%>
35
35
  <%= f.radio_button :function_as, "blog_story" %> <%= f.label :function_as_blog_story, "Blog Story"%>
36
+ <%= f.radio_button :function_as, "alias" %> <%= f.label :function_as_alias, "Alias"%>
37
+ <%= f.radio_button :function_as, "external_link" %> <%= f.label :function_as_external_link, "External Link"%>
36
38
  </div>
37
39
  <div class="field">
38
40
  <%= f.label :number_of_content_areas %><br />
@@ -47,12 +47,17 @@
47
47
  <%= f.label :page_type_id %>
48
48
  <%= f.select :page_type_id, (@page.child_of_a_blog? ? story_type_options : page_type_options) %>
49
49
  </div>
50
- <% if @page.alias? %>
51
- <div class="field">
52
- <%= f.label :alias_page_id %>
53
- <%= f.select :alias_page_id, sorted_nested_set_options(@root_page, sort_method) {|i, level| "#{'-' * level} #{limit_length(i.menu_title, 25, false)}" } %>
54
- </div>
55
- <% end %>
50
+
51
+ <div id= "alias_field" class="field" <%= "style='display:none;'" unless @page.alias? %> >
52
+ <%= f.label :alias_page_id %>
53
+ <%= f.select :alias_page_id, sorted_nested_set_options(@root_page, sort_method) {|i, level| "#{'-' * level} #{limit_length(i.menu_title, 25, false)}" } %>
54
+ </div>
55
+
56
+ <div id= "external_url_field" class="field" <%= "style='display:none;'" unless @page.external_link? %> >
57
+ <%= f.label :external_url %>
58
+ <%= f.text_field :external_url %>
59
+ </div>
60
+
56
61
  <% if @page.child_of_a_blog? %>
57
62
  <div class="field">
58
63
  <%= f.label :tag_list, "Tags: (separated by commas)" %>
@@ -79,6 +84,10 @@
79
84
  <%= f.label :publish_at %>
80
85
  <%= f.datetime_select :publish_at, :use_short_month => true, :order => [:month, :day, :year] %>
81
86
  </div>
87
+ <div class="field">
88
+ <%= f.label :target_window %>
89
+ <%= f.text_field :target_window %>
90
+ </div>
82
91
  </div>
83
92
  <div class="field">
84
93
  <div class="check_box_field">
@@ -95,14 +104,14 @@
95
104
 
96
105
  <!-- for future use -->
97
106
  <!--<fieldset><legend>Super Admin Tools</legend>-->
98
- <!--<div class="field">-->
99
- <!--<%= f.check_box :is_navigation_locked %>-->
100
- <!--<%= f.label :is_navigation_locked, "Lock Navigation" %>-->
101
- <!--</div>-->
107
+ <!--<div class="field">-->
108
+ <!--<%= f.check_box :is_navigation_locked %>-->
109
+ <!--<%= f.label :is_navigation_locked, "Lock Navigation" %>-->
110
+ <!--</div>-->
102
111
 
103
- <!--<div class="field">-->
104
- <!--<%= f.check_box :is_content_locked %>-->
105
- <!--<%= f.label :is_content_locked, "Lock Content" %>-->
106
- <!--</div>-->
112
+ <!--<div class="field">-->
113
+ <!--<%= f.check_box :is_content_locked %>-->
114
+ <!--<%= f.label :is_content_locked, "Lock Content" %>-->
115
+ <!--</div>-->
107
116
 
108
117
  </fieldset>
@@ -1,3 +1,15 @@
1
1
  <%= fields_for @page do |f|%>
2
2
  $("#page_content").html("<%= escape_javascript( render(:partial => "page_content", :locals => {:f => f})) %>");
3
3
  <% end %>
4
+
5
+ <% if @page.alias? %>
6
+ $("#alias_field").show();
7
+ <% else %>
8
+ $("#alias_field").hide();
9
+ <% end %>
10
+
11
+ <% if @page.external_link? %>
12
+ $("#external_url_field").show();
13
+ <% else %>
14
+ $("#external_url_field").hide();
15
+ <% end %>
@@ -5,7 +5,7 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = %q{deluxe_publisher}
8
- s.version = "0.0.5"
8
+ s.version = "0.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 = ["Paul Raupach"]
@@ -1,4 +1,4 @@
1
1
 
2
2
  <article class="page_content">
3
- <%= raw @page.contents[0].html %>
3
+ <%= raw contents[0].html %>
4
4
  </article>
@@ -58,6 +58,8 @@ class CreateDeluxePublisherTables < ActiveRecord::Migration
58
58
  t.string "path"
59
59
  t.boolean "is_shown_in_main_navigation", :default => false
60
60
  t.boolean "is_shown_in_secondary_navigation", :default => false
61
+ t.string "target_window"
62
+ t.string "external_url"
61
63
  t.boolean "is_published", :default => false
62
64
  t.boolean "is_landing_page", :default => false
63
65
  t.datetime "publish_at"
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: deluxe_publisher
3
3
  version: !ruby/object:Gem::Version
4
- hash: 21
4
+ hash: 19
5
5
  prerelease: false
6
6
  segments:
7
7
  - 0
8
8
  - 0
9
- - 5
10
- version: 0.0.5
9
+ - 6
10
+ version: 0.0.6
11
11
  platform: ruby
12
12
  authors:
13
13
  - Paul Raupach