publinator 0.0.24 → 0.0.25
Sign up to get free protection for your applications and to get access to all the features.
- data/app/assets/javascripts/publinator/manage/publishables.js +2 -0
- data/app/assets/javascripts/publinator/manage.js +19 -1
- data/app/assets/stylesheets/publinator/manage.css.scss +24 -1
- data/app/controllers/publinator/application_controller.rb +22 -6
- data/app/controllers/publinator/manage/pages_controller.rb +17 -4
- data/app/controllers/publinator/manage/publishable_controller.rb +10 -0
- data/app/controllers/publinator/manage/sections_controller.rb +31 -1
- data/app/helpers/publinator/application_helper.rb +6 -7
- data/app/models/publinator/page.rb +2 -0
- data/app/models/publinator/section.rb +19 -5
- data/app/views/layouts/publinator/manage.html.erb +2 -1
- data/app/views/publinator/manage/index.html.erb +4 -3
- data/app/views/publinator/manage/pages/_form.html.erb +8 -2
- data/app/views/publinator/manage/pages/_summary.html.erb +9 -8
- data/app/views/publinator/manage/pages/index.html.erb +2 -12
- data/app/views/publinator/manage/pages/show.html.erb +1 -0
- data/app/views/publinator/manage/publishable/_form.html.erb +9 -1
- data/app/views/publinator/manage/publishable/_summary.html.erb +7 -8
- data/app/views/publinator/manage/publishable/index.html.erb +2 -12
- data/app/views/publinator/manage/sections/_form.html.erb +20 -2
- data/app/views/publinator/manage/sections/index.html.erb +4 -1
- data/app/views/publinator/manage/sections/show.html.erb +4 -2
- data/app/views/publinator/publishable/show.html.erb +1 -1
- data/config/locales/en.yml +9 -0
- data/config/routes.rb +15 -3
- data/db/migrate/20121025220506_centralize_position_attributes.rb +9 -0
- data/lib/publinator/version.rb +1 -1
- data/lib/publinator.rb +5 -12
- metadata +39 -4
@@ -12,4 +12,22 @@
|
|
12
12
|
//
|
13
13
|
//= require jquery
|
14
14
|
//= require jquery_ujs
|
15
|
-
//=
|
15
|
+
//= require jquery.ui.all
|
16
|
+
//= require_directory "./manage"
|
17
|
+
//= require_self
|
18
|
+
|
19
|
+
$(function() {
|
20
|
+
$(".sortable_list").sortable({
|
21
|
+
update: function(){
|
22
|
+
$.ajax({
|
23
|
+
type: 'post',
|
24
|
+
data: $('.sortable_list').sortable('serialize'),
|
25
|
+
dataType: 'script',
|
26
|
+
complete: function(request){ $('.sortable_list').effect('highlight');},
|
27
|
+
url: $(".sortable_list").attr("sorturl")
|
28
|
+
})
|
29
|
+
}
|
30
|
+
});
|
31
|
+
$(".sortable_list").disableSelection();
|
32
|
+
});
|
33
|
+
|
@@ -9,12 +9,13 @@
|
|
9
9
|
* compiled file, but it's generally better to create a new file per style scope.
|
10
10
|
*
|
11
11
|
*= require_self
|
12
|
+
*= require jquery.ui.all
|
12
13
|
*= require './manage/publishable.css.scss'
|
13
14
|
*/
|
14
15
|
|
15
16
|
body {
|
16
17
|
font-family: "helvetica neue", helvetica, verdana, arial, helvetica, "sans-serif";
|
17
|
-
font-size:
|
18
|
+
font-size: 1em;
|
18
19
|
background-color: #ccc;
|
19
20
|
margin: 0;
|
20
21
|
padding: 0;
|
@@ -33,6 +34,28 @@ body {
|
|
33
34
|
background-color: #fff;
|
34
35
|
margin: 0;
|
35
36
|
padding: 2em;
|
37
|
+
|
38
|
+
table {
|
39
|
+
th {
|
40
|
+
text-align: left;
|
41
|
+
}
|
42
|
+
tr {
|
43
|
+
td {
|
44
|
+
padding: 0.3em;
|
45
|
+
}
|
46
|
+
}
|
47
|
+
}
|
48
|
+
|
49
|
+
ul#publishables {
|
50
|
+
list-style-type: none;
|
51
|
+
|
52
|
+
li {
|
53
|
+
width: 400px;
|
54
|
+
border: 1px solid silver;
|
55
|
+
margin: 6px;
|
56
|
+
padding: 8px;
|
57
|
+
}
|
58
|
+
}
|
36
59
|
}
|
37
60
|
|
38
61
|
#footer {
|
@@ -2,12 +2,7 @@ module Publinator
|
|
2
2
|
class ApplicationController < ActionController::Base
|
3
3
|
layout :current_layout
|
4
4
|
before_filter :in_a_site
|
5
|
-
helper_method :current_site, :current_domain, :current_layout, :current_site_name
|
6
|
-
|
7
|
-
def current_site_name
|
8
|
-
return "Publinator" if current_site.nil?
|
9
|
-
@current_site_name ||= current_site.name
|
10
|
-
end
|
5
|
+
helper_method :current_site, :current_domain, :current_layout, :current_site_name, :body_id, :current_controller
|
11
6
|
|
12
7
|
def current_site
|
13
8
|
return nil if current_domain.nil?
|
@@ -26,6 +21,27 @@ module Publinator
|
|
26
21
|
end
|
27
22
|
end
|
28
23
|
|
24
|
+
def current_site_name
|
25
|
+
return "Publinator" if current_site.nil?
|
26
|
+
@current_site_name ||= current_site.name
|
27
|
+
end
|
28
|
+
|
29
|
+
def current_controller
|
30
|
+
body_id.pluralize.camelize
|
31
|
+
end
|
32
|
+
|
33
|
+
def body_id
|
34
|
+
if @section
|
35
|
+
return @section.slug
|
36
|
+
elsif @page
|
37
|
+
return @page.section.slug
|
38
|
+
elsif @publishable
|
39
|
+
return @publishable.class.to_s.downcase
|
40
|
+
else
|
41
|
+
return "home"
|
42
|
+
end
|
43
|
+
end
|
44
|
+
|
29
45
|
private
|
30
46
|
|
31
47
|
def in_a_site
|
@@ -7,6 +7,14 @@ module Publinator
|
|
7
7
|
before_filter :get_pages
|
8
8
|
before_filter :get_page, :only => [:show, :edit, :update, :destroy]
|
9
9
|
|
10
|
+
def sort
|
11
|
+
@pages.each do |page|
|
12
|
+
page.position = params['page'].index(page.id.to_s) + 1
|
13
|
+
page.save
|
14
|
+
end
|
15
|
+
render :nothing => true
|
16
|
+
end
|
17
|
+
|
10
18
|
def index
|
11
19
|
begin
|
12
20
|
render "manage/pages/index"
|
@@ -53,7 +61,8 @@ module Publinator
|
|
53
61
|
|
54
62
|
def create
|
55
63
|
@page = Publinator::Page.new(params[:page])
|
56
|
-
@page.site = current_site
|
64
|
+
@page.publication.site = current_site
|
65
|
+
|
57
66
|
if @page.save
|
58
67
|
redirect_to "/manage/pages", :notice => "Page created."
|
59
68
|
else
|
@@ -67,9 +76,13 @@ module Publinator
|
|
67
76
|
|
68
77
|
def update
|
69
78
|
@page.update_attributes(params[:page])
|
70
|
-
@page.site = current_site
|
79
|
+
@page.publication.site = current_site
|
71
80
|
if @page.save
|
72
|
-
|
81
|
+
if @page.publication.section
|
82
|
+
redirect_to manage_section_path(@page.publication.section), :notice => "Page updated."
|
83
|
+
else
|
84
|
+
redirect_to "/manage/pages", :notice => "Page updated."
|
85
|
+
end
|
73
86
|
else
|
74
87
|
begin
|
75
88
|
render "manage/page/edit", :notice => "Page could not be updated."
|
@@ -82,7 +95,7 @@ module Publinator
|
|
82
95
|
private
|
83
96
|
|
84
97
|
def get_pages
|
85
|
-
@pages = Publinator::Page.where(:site_id => current_site.id).order("updated_at desc")
|
98
|
+
@pages = Publinator::Page.unscoped.where(:site_id => current_site.id).order("updated_at desc")
|
86
99
|
end
|
87
100
|
|
88
101
|
def get_page
|
@@ -78,6 +78,16 @@ module Publinator
|
|
78
78
|
end
|
79
79
|
end
|
80
80
|
|
81
|
+
def sort
|
82
|
+
collection_class = @publishable.collection_name.singularize.downcase
|
83
|
+
@publishable.menu_collection.each do |item|
|
84
|
+
item.position = params[collection_class].index(item.id.to_s) + 1
|
85
|
+
item.save
|
86
|
+
end
|
87
|
+
render :nothing => true
|
88
|
+
end
|
89
|
+
|
90
|
+
|
81
91
|
private
|
82
92
|
|
83
93
|
def get_publishable
|
@@ -10,15 +10,45 @@ module Publinator
|
|
10
10
|
end
|
11
11
|
|
12
12
|
def show
|
13
|
+
render :edit
|
13
14
|
end
|
14
15
|
|
15
16
|
def edit
|
16
17
|
end
|
17
18
|
|
18
19
|
def new
|
19
|
-
@section = Section.new(:
|
20
|
+
@section = Section.new(:site => current_site)
|
20
21
|
end
|
21
22
|
|
23
|
+
def create
|
24
|
+
@section = Section.new(params[:section])
|
25
|
+
@section.site_id = current_site.id
|
26
|
+
if @section.save
|
27
|
+
redirect_to manage_sections_path, :notice => "Section created."
|
28
|
+
else
|
29
|
+
render :new, :notice => "Section could not be created."
|
30
|
+
end
|
31
|
+
end
|
32
|
+
|
33
|
+
def update
|
34
|
+
@section.update_attributes(params[:section])
|
35
|
+
@section.site_id = current_site.id
|
36
|
+
if @section.save
|
37
|
+
redirect_to manage_sections_path, :notice => "Section updated."
|
38
|
+
else
|
39
|
+
render :edit, :notice => "Section could not be updated."
|
40
|
+
end
|
41
|
+
end
|
42
|
+
|
43
|
+
def sort
|
44
|
+
@section.publications.each do |publication|
|
45
|
+
publication.position = params['publication'].index(publication.id.to_s) + 1
|
46
|
+
publication.save
|
47
|
+
end
|
48
|
+
render :nothing => true
|
49
|
+
end
|
50
|
+
|
51
|
+
|
22
52
|
private
|
23
53
|
|
24
54
|
def get_section
|
@@ -64,22 +64,21 @@ module Publinator
|
|
64
64
|
end
|
65
65
|
|
66
66
|
def submenu(object)
|
67
|
-
|
68
|
-
content_tag(:div, :class => 'submenu', :id => obj_slug) do
|
67
|
+
content_tag(:div, :class => 'submenu', :id => object.slug) do
|
69
68
|
div_content = ""
|
70
69
|
ul_content = ""
|
71
70
|
div_content += content_tag(:ul) do
|
72
|
-
object.menu_collection.each
|
71
|
+
object.menu_collection.each do |mco|
|
72
|
+
unless mco.respond_to?(:hide_in_submenu) && mco.hide_in_submenu
|
73
|
+
ul_content += li_tag(mco)
|
74
|
+
end
|
75
|
+
end
|
73
76
|
ul_content.html_safe
|
74
77
|
end
|
75
78
|
div_content.html_safe
|
76
79
|
end
|
77
80
|
end
|
78
81
|
|
79
|
-
#def menu_item(obj)
|
80
|
-
#menu_section(obj.title, obj.path, obj.menu_collection)
|
81
|
-
#end
|
82
|
-
|
83
82
|
def publishable_asset(pub, asset_type)
|
84
83
|
return if !pub
|
85
84
|
asset = pub.asset_file(asset_type)
|
@@ -3,6 +3,7 @@ module Publinator
|
|
3
3
|
self.table_name = 'publinator_pages'
|
4
4
|
acts_as_publishable
|
5
5
|
attr_accessible :body, :kicker, :subtitle, :teaser, :title, :section, :asset_items, :asset_item, :asset_file
|
6
|
+
belongs_to :section, :class_name => "Publinator::Page"
|
6
7
|
|
7
8
|
def asset_types
|
8
9
|
['header']
|
@@ -11,5 +12,6 @@ module Publinator
|
|
11
12
|
def name
|
12
13
|
title
|
13
14
|
end
|
15
|
+
|
14
16
|
end
|
15
17
|
end
|
@@ -1,9 +1,11 @@
|
|
1
|
-
# TODO Validate
|
1
|
+
# TODO Validate: section_slug can't conflict with publishable_types
|
2
|
+
# TODO Validate: section_slug is url friendly
|
3
|
+
# TODO Validate: children have to have the same site_id as parents
|
2
4
|
module Publinator
|
3
5
|
class Section < ActiveRecord::Base
|
4
|
-
attr_accessible :layout, :name, :parent_id, :site, :section_slug
|
5
|
-
|
6
|
-
has_many :publications, :class_name => "Publinator::Publication"
|
6
|
+
attr_accessible :layout, :name, :parent_id, :site, :section_slug
|
7
|
+
|
8
|
+
has_many :publications, :class_name => "Publinator::Publication", :order => "position"
|
7
9
|
before_create :generate_section_slug
|
8
10
|
alias_attribute :title, :name
|
9
11
|
alias_attribute :slug, :section_slug
|
@@ -27,15 +29,27 @@ module Publinator
|
|
27
29
|
end
|
28
30
|
|
29
31
|
def menu_collection
|
30
|
-
publications
|
32
|
+
publications + child_sections
|
31
33
|
end
|
32
34
|
|
33
35
|
def publishable
|
34
36
|
self
|
35
37
|
end
|
36
38
|
|
39
|
+
def publishables
|
40
|
+
publications
|
41
|
+
end
|
42
|
+
|
37
43
|
def generate_section_slug
|
38
44
|
self.section_slug = name.strip.downcase.gsub(/[^a-zA-Z0-9\-\_]/, '_') if section_slug.blank?
|
39
45
|
end
|
46
|
+
|
47
|
+
def child_sections
|
48
|
+
Section.where(:parent_id => id)
|
49
|
+
end
|
50
|
+
|
51
|
+
def parent_section
|
52
|
+
Section.where(:id => parent_id).first if parent_id
|
53
|
+
end
|
40
54
|
end
|
41
55
|
end
|
@@ -8,7 +8,7 @@
|
|
8
8
|
</head>
|
9
9
|
<body>
|
10
10
|
<div id="header">
|
11
|
-
<h3><%= link_to "Managing", manage_path %> <%= link_to (current_site_name || "Publinator"),
|
11
|
+
<h3><%= link_to "Managing", manage_path %> :: <%= link_to (current_site_name || "Publinator"), manage_path %></h3>
|
12
12
|
</div>
|
13
13
|
<div id="content">
|
14
14
|
<%= alert if alert %>
|
@@ -16,6 +16,7 @@
|
|
16
16
|
<%= yield %>
|
17
17
|
</div>
|
18
18
|
<div id="footer">
|
19
|
+
<%= link_to "Public Site", "/", :target => "_new"%>
|
19
20
|
</div>
|
20
21
|
</body>
|
21
22
|
</html>
|
@@ -1,13 +1,14 @@
|
|
1
1
|
<h2>Content Manager Home Page</h2>
|
2
2
|
|
3
|
-
<%= link_to "
|
3
|
+
<%= link_to "Sections", "/manage/sections" %><br>
|
4
|
+
<%= link_to "Pages", manage_pages_path %><br>
|
5
|
+
|
4
6
|
<% @publishable_types.each do |pt| %>
|
5
|
-
<% unless pt.name == "Page" %>
|
6
7
|
<%= link_to pt.name.pluralize, send("manage_#{pt.name.tableize}_path") %><br>
|
7
|
-
<% end %>
|
8
8
|
<% end %>
|
9
9
|
|
10
10
|
<h3>Site Settings</h3>
|
11
11
|
|
12
12
|
<%= link_to "Publishable Types", "/manage/publishable_types" %><br>
|
13
13
|
|
14
|
+
|
@@ -6,7 +6,11 @@
|
|
6
6
|
<% end %>
|
7
7
|
<%= form.inputs "Page" do %>
|
8
8
|
<% @field_names.each do |field| %>
|
9
|
-
|
9
|
+
<% if field == 'section_id' %>
|
10
|
+
<%= form.input field, :as => :select, :collection => current_site.sections %>
|
11
|
+
<% else %>
|
12
|
+
<%= form.input field %>
|
13
|
+
<% end %>
|
10
14
|
<% end %>
|
11
15
|
<% end %>
|
12
16
|
<% if @page.asset_types.length > 0 %>
|
@@ -22,6 +26,9 @@
|
|
22
26
|
<% end %>
|
23
27
|
<%= form.semantic_fields_for :publication do |pub| %>
|
24
28
|
<%= pub.inputs "Publication Settings" do %>
|
29
|
+
<%= pub.input :section, :as => :select, :required => false, :collection => current_site.sections unless current_site.sections.length == 0 %>
|
30
|
+
<% end %>
|
31
|
+
<%= pub.inputs "Advanced Publication Settings" do %>
|
25
32
|
<%= pub.input :custom_slug, :required => false %>
|
26
33
|
<%= pub.input :collection_publishable_type_id, :as => :select, :collection => Publinator::PublishableType.all, :required => false %>
|
27
34
|
<%= pub.input :collection_scope, :required => false %>
|
@@ -29,7 +36,6 @@
|
|
29
36
|
<%= pub.input :unpublish_at, :as => :datetime_select, :required => false %>
|
30
37
|
<%= pub.input :archive_at, :as => :datetime_select, :required => false %>
|
31
38
|
<%= pub.input :hide_in_submenu, :as => :boolean, :required => false %>
|
32
|
-
<%= pub.input :section, :as => :select, :required => false, :collection => current_site.sections unless current_site.sections.length == 0 %>
|
33
39
|
<% end %>
|
34
40
|
<% end %>
|
35
41
|
<%= form.actions do %>
|
@@ -1,8 +1,9 @@
|
|
1
|
-
<
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
1
|
+
<li class="ui-state-default" id="page_<%= summary.id %>">
|
2
|
+
<%= link_to summary.publication.slug, edit_manage_page_path(summary) %><br>
|
3
|
+
<%= truncate(summary.title, :length => 80) %>
|
4
|
+
<%= link_to summary.section.name if summary.section %>
|
5
|
+
<%=l summary.updated_at, :format => :short %>
|
6
|
+
<%= link_to "edit", edit_manage_page_path(summary) %>
|
7
|
+
<%= link_to "show", manage_page_path(summary) %>
|
8
|
+
<%= link_to "public", summary.path %>
|
9
|
+
</li>
|
@@ -1,17 +1,7 @@
|
|
1
1
|
<h2>Pages</h2>
|
2
2
|
|
3
|
-
<
|
4
|
-
<thead>
|
5
|
-
<tr>
|
6
|
-
<th>Page Title</th>
|
7
|
-
<th>Section</th>
|
8
|
-
<th>Last Updated At</th>
|
9
|
-
<th>Edit</th>
|
10
|
-
<th>Show</th>
|
11
|
-
<th>Public Link</th>
|
12
|
-
</tr>
|
13
|
-
</thead>
|
3
|
+
<ul id="publishables">
|
14
4
|
<%= render :collection => @pages, :partial => "summary" %>
|
15
|
-
</
|
5
|
+
</ul>
|
16
6
|
|
17
7
|
<%= link_to "Add Page", "/manage/pages/new" %>
|
@@ -12,5 +12,6 @@
|
|
12
12
|
<div id="controls">
|
13
13
|
<%= link_to "Back", manage_pages_path %>
|
14
14
|
<%= link_to "Edit", edit_manage_page_path(@page) %>
|
15
|
+
<%= link_to "Public", @page.path, :target => "_new" %>
|
15
16
|
<%= link_to "Delete", manage_page_path(@page), :method => :delete, :class => "danger", :confirm => "Delete this #{@publishable.class.to_s}?" %>
|
16
17
|
</div>
|
@@ -29,7 +29,6 @@
|
|
29
29
|
<%= pub.input :unpublish_at, :as => :datetime_select, :required => false %>
|
30
30
|
<%= pub.input :archive_at, :as => :datetime_select, :required => false %>
|
31
31
|
<%= pub.input :hide_in_submenu, :as => :boolean, :required => false %>
|
32
|
-
<%= pub.input :section, :as => :select, :required => false, :collection => current_site.sections unless current_site.sections.length == 0 %>
|
33
32
|
<% end %>
|
34
33
|
<% end %>
|
35
34
|
<%= form.actions do %>
|
@@ -37,3 +36,12 @@
|
|
37
36
|
<%= form.action :cancel, :as => :link %>
|
38
37
|
<% end %>
|
39
38
|
<% end %>
|
39
|
+
|
40
|
+
<% if @publishable.menu_collection %>
|
41
|
+
<h3><%= @publishable.collection_name %></h3>
|
42
|
+
<ul class="sortable_list" sorturl="sort">
|
43
|
+
<% @publishable.menu_collection.each do |mcp| %>
|
44
|
+
<li id="<%= "#{mcp.class.to_s.downcase}_#{mcp.id}" %>"><%= mcp.title %></li>
|
45
|
+
<% end %>
|
46
|
+
</ul>
|
47
|
+
<% end %>
|
@@ -1,8 +1,7 @@
|
|
1
|
-
<
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
</tr>
|
1
|
+
<li class="ui-state-default" id="publishable_<%= summary.id %>">
|
2
|
+
<%= link_to summary.my_slug, [:manage, summary] %><br>
|
3
|
+
<%= summary.updated_at %> [
|
4
|
+
<%= link_to "edit", send("edit_manage_#{@publishable_member_name}_path", summary) %>
|
5
|
+
<%= link_to "show", [:manage, summary] %>
|
6
|
+
<%= link_to "public", summary.path %> ]
|
7
|
+
</li>
|
@@ -1,17 +1,7 @@
|
|
1
1
|
<h2><%= @publishable_class_name.capitalize.pluralize %></h2>
|
2
2
|
|
3
|
-
<
|
4
|
-
<thead>
|
5
|
-
<tr>
|
6
|
-
<th><%= @publishable_class_name %> Slug</th>
|
7
|
-
<th>Section</th>
|
8
|
-
<th>Last Updated At</th>
|
9
|
-
<th>Edit</th>
|
10
|
-
<th>Show</th>
|
11
|
-
<th>Public Link</th>
|
12
|
-
</tr>
|
13
|
-
</thead>
|
3
|
+
<ul id="publishables">
|
14
4
|
<%= render :collection => @publishables, :partial => "summary" %>
|
15
|
-
</
|
5
|
+
</ul>
|
16
6
|
|
17
7
|
<%= link_to "Add #{@publishable_class_name}", send("new_manage_#{@publishable_member_name}_path") %>
|
@@ -1,10 +1,28 @@
|
|
1
|
-
<%= semantic_form_for [:manage, @section]
|
1
|
+
<%= semantic_form_for [:manage, @section] do |form| %>
|
2
2
|
<%= form.inputs do %>
|
3
3
|
<%= form.input :name %>
|
4
|
-
<%= form.input :
|
4
|
+
<%= form.input :section_slug %>
|
5
|
+
<%= form.input :layout, :label => "Use a Custom Layout?" %>
|
6
|
+
<%= form.input :parent_id, :as => :select, :collection => current_site.sections, :label => "Parent Section" %>
|
5
7
|
<% end %>
|
6
8
|
<%= form.actions do %>
|
7
9
|
<%= form.action :submit, :as => :button %>
|
8
10
|
<%= form.action :cancel, :as => :link %>
|
9
11
|
<% end %>
|
10
12
|
<% end %>
|
13
|
+
|
14
|
+
<h3>Subsections</h3>
|
15
|
+
|
16
|
+
<% current_site.sections.where(:parent_id => @section.id).each do |sec| %>
|
17
|
+
<%= link_to sec.name, manage_section_path(sec) %><br>
|
18
|
+
<% end %>
|
19
|
+
|
20
|
+
<%= link_to "sort", sort_manage_section_path(@section) %>
|
21
|
+
|
22
|
+
<h3>Pages</h3>
|
23
|
+
|
24
|
+
<ul class="sortable_list" sorturl="<%= manage_section_path(@section) %>/sort">
|
25
|
+
<% @section.publications.each do |mcp| %>
|
26
|
+
<li id="<%= "#{mcp.class.to_s.demodulize.downcase}_#{mcp.id}" %>"><%= mcp.title %> (<%= link_to "edit", edit_manage_page_path(mcp.publishable_id) %>)</li>
|
27
|
+
<% end %>
|
28
|
+
</ul>
|
@@ -0,0 +1,9 @@
|
|
1
|
+
# Sample localization file for English. Add more files in this directory for other locales.
|
2
|
+
# See https://github.com/svenfuchs/rails-i18n/tree/master/rails%2Flocale for starting points.
|
3
|
+
|
4
|
+
en:
|
5
|
+
hello: "Hello world"
|
6
|
+
time:
|
7
|
+
formats:
|
8
|
+
calendar_date: "%B %e, %Y"
|
9
|
+
short: "%m/%d/%y %I:%M:%S"
|
data/config/routes.rb
CHANGED
@@ -5,7 +5,11 @@ Publinator::Engine.routes.draw do
|
|
5
5
|
namespace :manage do
|
6
6
|
|
7
7
|
Publinator::PublishableType.all.each do |pt|
|
8
|
-
resources pt.name.tableize.to_sym, :controller => "publishable", :publishable_type => pt.name.tableize
|
8
|
+
resources pt.name.tableize.to_sym, :controller => "publishable", :publishable_type => pt.name.tableize do
|
9
|
+
member do
|
10
|
+
post :sort
|
11
|
+
end
|
12
|
+
end
|
9
13
|
end
|
10
14
|
|
11
15
|
#constraints(Publinator::PublishableType) do
|
@@ -32,9 +36,17 @@ Publinator::Engine.routes.draw do
|
|
32
36
|
#}, :as => "publishable"
|
33
37
|
#end
|
34
38
|
|
35
|
-
resources :pages
|
39
|
+
resources :pages do
|
40
|
+
collection do
|
41
|
+
post :sort
|
42
|
+
end
|
43
|
+
end
|
36
44
|
resources :sites
|
37
|
-
resources :sections
|
45
|
+
resources :sections do
|
46
|
+
member do
|
47
|
+
post :sort
|
48
|
+
end
|
49
|
+
end
|
38
50
|
resources :publishable_types
|
39
51
|
end
|
40
52
|
|
data/lib/publinator/version.rb
CHANGED
data/lib/publinator.rb
CHANGED
@@ -25,18 +25,16 @@ module Publinator
|
|
25
25
|
accepts_nested_attributes_for :asset_items, :reject_if => :all_blank
|
26
26
|
|
27
27
|
before_validation :verify_publication
|
28
|
-
belongs_to :site, :class_name => "Publinator::Site"
|
29
|
-
belongs_to :section, :class_name => "Publinator::Section"
|
30
28
|
|
31
29
|
attr_accessible :site, :publication, :section, :default,
|
32
30
|
:position, :asset_items_attributes,
|
33
|
-
:custom_slug,
|
31
|
+
:custom_slug, :site_id, :section_id,
|
34
32
|
:publication_attributes
|
35
33
|
|
36
34
|
attr_accessor :default
|
37
35
|
|
38
36
|
scope :non_index, joins(:publication).where("publication.slug != 'index'")
|
39
|
-
|
37
|
+
delegate :site, :section, :slug, :to => :publication
|
40
38
|
end
|
41
39
|
end
|
42
40
|
|
@@ -54,12 +52,7 @@ module Publinator
|
|
54
52
|
end
|
55
53
|
|
56
54
|
def my_slug
|
57
|
-
|
58
|
-
unless self.slug.blank?
|
59
|
-
return slug
|
60
|
-
end
|
61
|
-
end
|
62
|
-
publication.slug
|
55
|
+
slug
|
63
56
|
end
|
64
57
|
|
65
58
|
def related_items(scope)
|
@@ -67,13 +60,13 @@ module Publinator
|
|
67
60
|
end
|
68
61
|
|
69
62
|
def editable_fields
|
70
|
-
attribute_names - ["id", "created_at", "updated_at"
|
63
|
+
attribute_names - ["id", "created_at", "updated_at"]
|
71
64
|
end
|
72
65
|
|
73
66
|
def path
|
74
67
|
raise "publication not found" if !self.publication
|
75
68
|
if self.publication.section
|
76
|
-
"
|
69
|
+
"#{self.publication.section.path}/#{self.publication.slug}"
|
77
70
|
else
|
78
71
|
"/#{self.class.to_s.tableize}/#{self.publication.slug}"
|
79
72
|
end
|
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.
|
4
|
+
version: 0.0.25
|
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-
|
12
|
+
date: 2012-10-25 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: rails
|
@@ -107,6 +107,22 @@ dependencies:
|
|
107
107
|
- - ! '>='
|
108
108
|
- !ruby/object:Gem::Version
|
109
109
|
version: '0'
|
110
|
+
- !ruby/object:Gem::Dependency
|
111
|
+
name: jquery-ui-rails
|
112
|
+
requirement: !ruby/object:Gem::Requirement
|
113
|
+
none: false
|
114
|
+
requirements:
|
115
|
+
- - ! '>='
|
116
|
+
- !ruby/object:Gem::Version
|
117
|
+
version: '0'
|
118
|
+
type: :runtime
|
119
|
+
prerelease: false
|
120
|
+
version_requirements: !ruby/object:Gem::Requirement
|
121
|
+
none: false
|
122
|
+
requirements:
|
123
|
+
- - ! '>='
|
124
|
+
- !ruby/object:Gem::Version
|
125
|
+
version: '0'
|
110
126
|
- !ruby/object:Gem::Dependency
|
111
127
|
name: rdiscount
|
112
128
|
requirement: !ruby/object:Gem::Requirement
|
@@ -139,6 +155,22 @@ dependencies:
|
|
139
155
|
- - ~>
|
140
156
|
- !ruby/object:Gem::Version
|
141
157
|
version: '3.0'
|
158
|
+
- !ruby/object:Gem::Dependency
|
159
|
+
name: acts_as_list
|
160
|
+
requirement: !ruby/object:Gem::Requirement
|
161
|
+
none: false
|
162
|
+
requirements:
|
163
|
+
- - ! '>='
|
164
|
+
- !ruby/object:Gem::Version
|
165
|
+
version: '0'
|
166
|
+
type: :runtime
|
167
|
+
prerelease: false
|
168
|
+
version_requirements: !ruby/object:Gem::Requirement
|
169
|
+
none: false
|
170
|
+
requirements:
|
171
|
+
- - ! '>='
|
172
|
+
- !ruby/object:Gem::Version
|
173
|
+
version: '0'
|
142
174
|
- !ruby/object:Gem::Dependency
|
143
175
|
name: sqlite3
|
144
176
|
requirement: !ruby/object:Gem::Requirement
|
@@ -243,6 +275,7 @@ extensions: []
|
|
243
275
|
extra_rdoc_files: []
|
244
276
|
files:
|
245
277
|
- app/assets/javascripts/publinator/home.js
|
278
|
+
- app/assets/javascripts/publinator/manage/publishables.js
|
246
279
|
- app/assets/javascripts/publinator/manage/sections.js
|
247
280
|
- app/assets/javascripts/publinator/manage.js
|
248
281
|
- app/assets/javascripts/publinator/site.js
|
@@ -311,6 +344,7 @@ files:
|
|
311
344
|
- app/views/publinator/publishable/index.html.erb
|
312
345
|
- app/views/publinator/publishable/show.html.erb
|
313
346
|
- config/initializers/paperclip.rb
|
347
|
+
- config/locales/en.yml
|
314
348
|
- config/routes.rb
|
315
349
|
- db/migrate/20120725194854_create_publinator_sites.rb
|
316
350
|
- db/migrate/20120725200404_create_publinator_domain_names.rb
|
@@ -327,6 +361,7 @@ files:
|
|
327
361
|
- db/migrate/20121023224457_add_show_in_nav.rb
|
328
362
|
- db/migrate/20121024001040_add_default_position.rb
|
329
363
|
- db/migrate/20121024141632_add_publication_collections.rb
|
364
|
+
- db/migrate/20121025220506_centralize_position_attributes.rb
|
330
365
|
- lib/generators/publishable/publishable_generator.rb
|
331
366
|
- lib/generators/publishable/templates/app/models/publishable.html.erb
|
332
367
|
- lib/generators/publishable/templates/app/models/publishable_migration.rb.erb
|
@@ -353,7 +388,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
353
388
|
version: '0'
|
354
389
|
segments:
|
355
390
|
- 0
|
356
|
-
hash:
|
391
|
+
hash: -287124976149533528
|
357
392
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
358
393
|
none: false
|
359
394
|
requirements:
|
@@ -362,7 +397,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
362
397
|
version: '0'
|
363
398
|
segments:
|
364
399
|
- 0
|
365
|
-
hash:
|
400
|
+
hash: -287124976149533528
|
366
401
|
requirements: []
|
367
402
|
rubyforge_project:
|
368
403
|
rubygems_version: 1.8.24
|