publinator 0.0.16 → 0.0.18

Sign up to get free protection for your applications and to get access to all the features.
@@ -88,11 +88,11 @@ module Publinator
88
88
  @publishable_type = PublishableType.find_by_name("Publinator::Page")
89
89
  @publishable_type_name = @publishable_type.name
90
90
  else
91
- @publishable_class_name = params["publishable_type"].singularize.capitalize
91
+ @publishable_class_name = params["publishable_type"].classify
92
92
  @publishable_collection_name = params["publishable_type"]
93
- @publishable_member_name = @publishable_class_name.downcase
93
+ @publishable_member_name = params["publishable_type"].singularize.downcase
94
94
  @publishable_class = @publishable_class_name.constantize
95
- @publishable_type = PublishableType.find_by_name(params['publishable_type'].singularize.capitalize)
95
+ @publishable_type = PublishableType.find_by_name(params['publishable_type'].classify)
96
96
  @publishable_type_name = @publishable_type.name
97
97
  end
98
98
 
@@ -2,7 +2,7 @@ module Publinator
2
2
  class Publication < ActiveRecord::Base
3
3
  # has_paper_trail
4
4
  attr_accessible :custom_slug, :parent_id, :publication_state_id,
5
- :publishable_id, :publishable_type, :slug, :publish_at,
5
+ :publishable_id, :publishable_type, :slug, :publish_at, :hide_in_submenu,
6
6
  :unpublish_at, :archive_at, :section, :default, :publishable, :site, :section_id
7
7
  belongs_to :publishable, :polymorphic => true
8
8
  belongs_to :section, :class_name => "Publinator::Section"
@@ -23,6 +23,7 @@
23
23
  <%= pub.input :publish_at, :as => :datetime_select, :required => false %>
24
24
  <%= pub.input :unpublish_at, :as => :datetime_select, :required => false %>
25
25
  <%= pub.input :archive_at, :as => :datetime_select, :required => false %>
26
+ <%= pub.input :hide_in_submenu, :as => :boolean, :required => false %>
26
27
  <%= pub.input :section, :as => :select, :required => false, :collection => current_site.sections unless current_site.sections.length == 0 %>
27
28
  <% end %>
28
29
  <% end %>
@@ -23,7 +23,7 @@
23
23
  <%= pub.input :publish_at, :as => :datetime_select, :required => false %>
24
24
  <%= pub.input :unpublish_at, :as => :datetime_select, :required => false %>
25
25
  <%= pub.input :archive_at, :as => :datetime_select, :required => false %>
26
- <%= pub.input :hide_in_nav, :required => false %>
26
+ <%= pub.input :hide_in_submenu, :as => :boolean, :required => false %>
27
27
  <%= pub.input :section, :as => :select, :required => false, :collection => current_site.sections unless current_site.sections.length == 0 %>
28
28
  <% end %>
29
29
  <% end %>
@@ -2,7 +2,7 @@
2
2
  <td><%= link_to summary.my_slug, [:manage, summary] %></td>
3
3
  <td><%= link_to summary.publication.section.name if summary.publication.section %></td>
4
4
  <td><%= summary.updated_at %></td>
5
- <td><%= link_to "edit", send("edit_manage_#{@publishable_type_name.downcase}_path", summary) %></td>
5
+ <td><%= link_to "edit", send("edit_manage_#{@publishable_member_name}_path", summary) %></td>
6
6
  <td><%= link_to "show", [:manage, summary] %></td>
7
7
  <td><%= link_to "public", summary.path %></td>
8
8
  </tr>
@@ -14,4 +14,4 @@
14
14
  <%= render :collection => @publishables, :partial => "summary" %>
15
15
  </table>
16
16
 
17
- <%= link_to "Add #{@publishable_class_name}", send("new_manage_#{@publishable_class_name.downcase}_path") %>
17
+ <%= link_to "Add #{@publishable_class_name}", send("new_manage_#{@publishable_member_name}_path") %>
@@ -10,6 +10,6 @@
10
10
 
11
11
  <div id="controls">
12
12
  <%= link_to "Back", send("manage_#{params[:publishable_type]}_path") %>
13
- <%= link_to "Edit", send("edit_manage_#{params[:publishable_type].singularize}_path", @publishable) %>
13
+ <%= link_to "Edit", send("edit_manage_#{@publishable_collection_name}_path", @publishable) %>
14
14
  <%= link_to "Delete", send("manage_#{params[:publishable_type].singularize}_path", @publishable), :method => :delete, :class => "danger", :confirm => "Delete this #{@publishable.class.to_s}?" %>
15
15
  </div>
@@ -1,9 +1,9 @@
1
1
  class AddShowInNav < ActiveRecord::Migration
2
2
  def up
3
- add_column :publications, :hide_in_submenu, :boolean, :default => false
3
+ add_column :publinator_publications, :hide_in_submenu, :boolean, :default => false
4
4
  end
5
5
 
6
6
  def down
7
- remove_column :publications, :hide_in_submenu
7
+ remove_column :publinator_publications, :hide_in_submenu
8
8
  end
9
9
  end
@@ -0,0 +1,11 @@
1
+ class AddDefaultPosition < ActiveRecord::Migration
2
+ def up
3
+ add_column :publinator_asset_items, :position, :integer
4
+ add_column :publinator_publishable_types, :position, :integer
5
+ end
6
+
7
+ def down
8
+ remove_column :publinator_asset_items, :position
9
+ remove_column :publinator_publishable_types, :position
10
+ end
11
+ end
@@ -1,3 +1,3 @@
1
1
  module Publinator
2
- VERSION = "0.0.16"
2
+ VERSION = "0.0.18"
3
3
  end
data/lib/publinator.rb CHANGED
@@ -35,6 +35,7 @@ module Publinator
35
35
  attr_accessor :default
36
36
 
37
37
  scope :non_index, joins(:publication).where("publication.slug != 'index'")
38
+ default_scope order("position")
38
39
  end
39
40
  end
40
41
 
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: publinator
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.16
4
+ version: 0.0.18
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2012-10-23 00:00:00.000000000 Z
12
+ date: 2012-10-24 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: rails
@@ -325,6 +325,7 @@ files:
325
325
  - db/migrate/20121017134533_create_publinator_pages.rb
326
326
  - db/migrate/20121020181204_create_publinator_asset_items.rb
327
327
  - db/migrate/20121023224457_add_show_in_nav.rb
328
+ - db/migrate/20121024001040_add_default_position.rb
328
329
  - lib/generators/publishable/publishable_generator.rb
329
330
  - lib/generators/publishable/templates/app/models/publishable.html.erb
330
331
  - lib/generators/publishable/templates/app/models/publishable_migration.rb.erb
@@ -351,7 +352,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
351
352
  version: '0'
352
353
  segments:
353
354
  - 0
354
- hash: 2434480295581327704
355
+ hash: -3428793437559641373
355
356
  required_rubygems_version: !ruby/object:Gem::Requirement
356
357
  none: false
357
358
  requirements:
@@ -360,7 +361,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
360
361
  version: '0'
361
362
  segments:
362
363
  - 0
363
- hash: 2434480295581327704
364
+ hash: -3428793437559641373
364
365
  requirements: []
365
366
  rubyforge_project:
366
367
  rubygems_version: 1.8.24