forgeos_blog 1.9.0
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.
- data/COPYING +339 -0
- data/COPYING.LESSER +165 -0
- data/LICENSE +2 -0
- data/README.textile +75 -0
- data/app/assets/javascripts/admin/functions/forgeos_blog/comments.js +11 -0
- data/app/assets/javascripts/admin/inits/forgeos_blog/comments.js +57 -0
- data/app/assets/javascripts/admin/inits/forgeos_blog/trees.js +7 -0
- data/app/controllers/admin/categories_controller.rb +4 -0
- data/app/controllers/admin/import_controller.rb +14 -0
- data/app/controllers/admin/papers_controller.rb +135 -0
- data/app/controllers/blog/comments_controller.rb +21 -0
- data/app/controllers/blog/papers_controller.rb +60 -0
- data/app/controllers/blog/tags_controller.rb +35 -0
- data/app/helpers/application_helper.rb +3 -0
- data/app/helpers/blog_helper.rb +22 -0
- data/app/helpers/routes_helper.rb +23 -0
- data/app/models/comment.rb +34 -0
- data/app/models/paper.rb +57 -0
- data/app/models/paper_category.rb +7 -0
- data/app/models/paper_sweeper.rb +44 -0
- data/app/models/paper_viewed_counter.rb +2 -0
- data/app/views/admin/blocks/_tabs.html.haml +8 -0
- data/app/views/admin/menus/_tabs.html.haml +5 -0
- data/app/views/admin/pages/_tabs.html.haml +5 -0
- data/app/views/admin/papers/_comment.html.haml +31 -0
- data/app/views/admin/papers/_comments.html.haml +3 -0
- data/app/views/admin/papers/_form.html.haml +20 -0
- data/app/views/admin/papers/_general.html.haml +42 -0
- data/app/views/admin/papers/_seo.html.haml +31 -0
- data/app/views/admin/papers/_tabs.html.haml +5 -0
- data/app/views/admin/papers/destroy.js.erb +1 -0
- data/app/views/admin/papers/edit.html.haml +1 -0
- data/app/views/admin/papers/index.html.haml +12 -0
- data/app/views/admin/papers/index.json.erb +26 -0
- data/app/views/admin/papers/new.html.haml +1 -0
- data/app/views/admin/papers/show.html.haml +11 -0
- data/app/views/admin/widgets/_tabs.html.haml +8 -0
- data/config/locales/blog/en.yml +23 -0
- data/config/locales/blog/fr.yml +23 -0
- data/config/routes.rb +17 -0
- data/db/migrate/20100309201348_create_paper.rb +17 -0
- data/db/migrate/20100310000756_add_rakismet_attributes_to_comments.rb +19 -0
- data/lib/forgeos/blog/engine.rb +9 -0
- data/lib/forgeos/blog.rb +6 -0
- data/lib/forgeos_blog.rb +1 -0
- data/lib/tasks/install.rake +7 -0
- data/recipes/deploy.rb +9 -0
- metadata +160 -0
@@ -0,0 +1,14 @@
|
|
1
|
+
load File.join(Gem.loaded_specs['forgeos_cms'].full_gem_path, 'app', 'controllers', 'admin', 'import_controller.rb')
|
2
|
+
class Admin::ImportController < Admin::BaseController
|
3
|
+
before_filter :blog_models, :only => :index
|
4
|
+
|
5
|
+
map_fields :create_paper, (Paper.new.attributes.keys + Paper.new.translated_attributes.stringify_keys.keys).sort
|
6
|
+
def create_paper
|
7
|
+
create_model(Paper,nil)
|
8
|
+
end
|
9
|
+
|
10
|
+
private
|
11
|
+
def blog_models
|
12
|
+
@models << 'paper'
|
13
|
+
end
|
14
|
+
end
|
@@ -0,0 +1,135 @@
|
|
1
|
+
class Admin::PapersController < Admin::BaseController
|
2
|
+
cache_sweeper :paper_sweeper, :only => [:create, :update, :destroy]
|
3
|
+
before_filter :get_paper, :only => [:edit, :update, :destroy, :show]
|
4
|
+
before_filter :new_paper, :only => [:new, :create]
|
5
|
+
before_filter :get_tags, :only => [:update, :create]
|
6
|
+
|
7
|
+
def url
|
8
|
+
render :text => Forgeos::url_generator(params[:url])
|
9
|
+
end
|
10
|
+
|
11
|
+
# List Categories
|
12
|
+
def index
|
13
|
+
respond_to do |format|
|
14
|
+
format.html
|
15
|
+
format.json do
|
16
|
+
sort
|
17
|
+
render :layout => false
|
18
|
+
end
|
19
|
+
end
|
20
|
+
end
|
21
|
+
|
22
|
+
def new
|
23
|
+
end
|
24
|
+
|
25
|
+
def show
|
26
|
+
end
|
27
|
+
|
28
|
+
# Create a Paper
|
29
|
+
# ==== Params
|
30
|
+
# * paper = Hash of Paper's attributes
|
31
|
+
#
|
32
|
+
# The Paper can be a child of another Paper.
|
33
|
+
def create
|
34
|
+
if @paper.save
|
35
|
+
flash[:notice] = t('paper.create.success').capitalize
|
36
|
+
redirect_to([forgeos_blog, :admin, :papers])
|
37
|
+
else
|
38
|
+
flash[:error] = t('paper.create.failed').capitalize
|
39
|
+
render :action => 'new'
|
40
|
+
end
|
41
|
+
end
|
42
|
+
|
43
|
+
# Edit a Paper
|
44
|
+
# ==== Params
|
45
|
+
# * id = Paper's id to edit
|
46
|
+
# * paper = Hash of Paper's attributes
|
47
|
+
#
|
48
|
+
# The Paper can be a child of another Paper.
|
49
|
+
def edit
|
50
|
+
end
|
51
|
+
|
52
|
+
def update
|
53
|
+
if @paper.update_attributes(params[:paper])
|
54
|
+
flash[:notice] = t('paper.update.success').capitalize
|
55
|
+
redirect_to([forgeos_blog, :admin, :papers])
|
56
|
+
else
|
57
|
+
flash[:error] = t('paper.update.failed').capitalize
|
58
|
+
render :action => 'edit'
|
59
|
+
end
|
60
|
+
end
|
61
|
+
|
62
|
+
# Destroy a Paper
|
63
|
+
# ==== Params
|
64
|
+
# * id = Paper's id
|
65
|
+
# ==== Output
|
66
|
+
# if destroy succed, return the Categories list
|
67
|
+
def destroy
|
68
|
+
#set page_url for cache sweeper
|
69
|
+
@paper.paper_url = @paper.paper_urls.dup
|
70
|
+
if @paper.destroy
|
71
|
+
flash[:notice] = t('paper.destroy.success').capitalize
|
72
|
+
else
|
73
|
+
flash[:error] = t('paper.destroy.failed').capitalize
|
74
|
+
end
|
75
|
+
end
|
76
|
+
|
77
|
+
private
|
78
|
+
def get_paper
|
79
|
+
unless @paper = Paper.find_by_id(params[:id])
|
80
|
+
flash[:error] = t('paper.not_exist').capitalize
|
81
|
+
return redirect_to([forgeos_blog, :admin, :papers])
|
82
|
+
end
|
83
|
+
end
|
84
|
+
|
85
|
+
def new_paper
|
86
|
+
@paper = Paper.new(params[:paper])
|
87
|
+
end
|
88
|
+
|
89
|
+
def get_tags
|
90
|
+
params[:paper][:tag_list]= params[:tag_list].join(',')
|
91
|
+
end
|
92
|
+
|
93
|
+
def sort
|
94
|
+
columns = %w(paper_translations.name paper_translations.name people.lastname papers.state published_at)
|
95
|
+
|
96
|
+
if params[:sSearch] && !params[:sSearch].blank?
|
97
|
+
columns = %w(name name author)
|
98
|
+
end
|
99
|
+
|
100
|
+
per_page = params[:iDisplayLength].to_i
|
101
|
+
offset = params[:iDisplayStart].to_i
|
102
|
+
page = (offset / per_page) + 1
|
103
|
+
order_column = params[:iSortCol_0].to_i
|
104
|
+
order = "#{columns[order_column]} #{params[:sSortDir_0].upcase}"
|
105
|
+
|
106
|
+
conditions = {}
|
107
|
+
includes = [:translations]
|
108
|
+
options = { :page => page, :per_page => per_page }
|
109
|
+
joins = [:translations]
|
110
|
+
|
111
|
+
if params[:category_id]
|
112
|
+
conditions[:categories_elements] = { :category_id => params[:category_id] }
|
113
|
+
includes << :categories
|
114
|
+
joins = []
|
115
|
+
end
|
116
|
+
|
117
|
+
if params[:ids]
|
118
|
+
conditions[:papers] = { :id => params[:ids].split(',') }
|
119
|
+
end
|
120
|
+
|
121
|
+
options[:conditions] = conditions unless conditions.empty?
|
122
|
+
options[:include] = includes unless includes.empty?
|
123
|
+
options[:order] = order unless order.squeeze.blank?
|
124
|
+
options[:joins] = joins
|
125
|
+
|
126
|
+
if params[:sSearch] && !params[:sSearch].blank?
|
127
|
+
options[:index] = "paper_core.paper_#{ActiveRecord::Base.locale}_core"
|
128
|
+
options[:sql_order] = options.delete(:order)
|
129
|
+
options[:joins] += options.delete(:include)
|
130
|
+
@papers = Paper.search(params[:sSearch],options)
|
131
|
+
else
|
132
|
+
@papers = Paper.paginate(options)
|
133
|
+
end
|
134
|
+
end
|
135
|
+
end
|
@@ -0,0 +1,21 @@
|
|
1
|
+
class Blog::CommentsController < ApplicationController
|
2
|
+
include Rakismet::Controller
|
3
|
+
include BlogHelper
|
4
|
+
rakismet_filter :only => :create
|
5
|
+
cache_sweeper :paper_sweeper, :only => :create
|
6
|
+
skip_before_filter :verify_authenticity_token
|
7
|
+
def create
|
8
|
+
@paper = Paper.find(params[:paper_id])
|
9
|
+
@comment = @paper.comments.build(params[:comment])
|
10
|
+
unless @comment.spam?
|
11
|
+
if @comment.valid?
|
12
|
+
@comment.save
|
13
|
+
else
|
14
|
+
@comment.spam!
|
15
|
+
end
|
16
|
+
else
|
17
|
+
flash[:notice] = @comment.akismet_response
|
18
|
+
end
|
19
|
+
redirect_to([:seo, @paper])
|
20
|
+
end
|
21
|
+
end
|
@@ -0,0 +1,60 @@
|
|
1
|
+
class Blog::PapersController < ApplicationController
|
2
|
+
before_filter :get_defaults
|
3
|
+
caches_page :show, :if => Proc.new { |c| c.request.format != 'js' }
|
4
|
+
|
5
|
+
def index
|
6
|
+
if params[:tag_name]
|
7
|
+
@tags = ActsAsTaggableOn::Tagging.all(:include => :tag, :conditions => { :tags => { :name => params[:tag_name].humanize }})
|
8
|
+
else
|
9
|
+
@category = PaperCategory.find_by_url(params[:blog_category_id]) || PaperCategory.find_by_id(params[:blog_category_id]) if params[:blog_category_id]
|
10
|
+
end
|
11
|
+
|
12
|
+
paginate_options = {:page => page, :per_page => per_page, :conditions => { :state => 'published'}}
|
13
|
+
case params[:sort_by]
|
14
|
+
when 'popularity'
|
15
|
+
paginate_options[:order] = "sum(#{PaperViewedCounter.table_name}.counter) DESC, papers.id DESC"
|
16
|
+
paginate_options[:include] = :viewed_counters
|
17
|
+
paginate_options[:group] = "papers.id"
|
18
|
+
when 'commented'
|
19
|
+
paginate_options[:order] = "COUNT(#{Comment.table_name}.id) DESC, papers.id DESC"
|
20
|
+
paginate_options[:include] = :comments
|
21
|
+
paginate_options[:group] = "papers.id"
|
22
|
+
else
|
23
|
+
paginate_options[:order] = 'papers.published_at DESC, papers.id DESC'
|
24
|
+
end
|
25
|
+
|
26
|
+
if params[:tag_name]
|
27
|
+
@paper = @tags.collect{ |t| t.papers }.paginate(paginate_options)
|
28
|
+
else
|
29
|
+
@papers = @category ? @category.elements.paginate(paginate_options) : Paper.paginate(paginate_options)
|
30
|
+
end
|
31
|
+
|
32
|
+
respond_to do |format|
|
33
|
+
format.html
|
34
|
+
format.atom
|
35
|
+
format.xml
|
36
|
+
format.rss
|
37
|
+
end
|
38
|
+
end
|
39
|
+
|
40
|
+
def show
|
41
|
+
unless @paper = Paper.find_by_url(params[:id])
|
42
|
+
page_not_found
|
43
|
+
end
|
44
|
+
end
|
45
|
+
|
46
|
+
private
|
47
|
+
def get_defaults
|
48
|
+
@last_comments = Comment.latest_paper_comments(:limit => 5)
|
49
|
+
@last_papers = Paper.latest(:limit => 5)
|
50
|
+
@categories = PaperCategory.all
|
51
|
+
end
|
52
|
+
|
53
|
+
def page
|
54
|
+
params[:page].to_i > 0 ? params[:page] : 1
|
55
|
+
end
|
56
|
+
|
57
|
+
def per_page
|
58
|
+
params[:per_page].to_i > 0 ? params[:per_page] : 5
|
59
|
+
end
|
60
|
+
end
|
@@ -0,0 +1,35 @@
|
|
1
|
+
class Blog::TagsController < ApplicationController
|
2
|
+
before_filter :get_defaults
|
3
|
+
|
4
|
+
def index
|
5
|
+
if params[:tag_name]
|
6
|
+
|
7
|
+
paginate_options = {
|
8
|
+
:page => params[:page],
|
9
|
+
:per_page => (params[:per_page] || 5),
|
10
|
+
}
|
11
|
+
|
12
|
+
# OPTIMIZE
|
13
|
+
tags = ActsAsTaggableOn::Tagging.all(
|
14
|
+
:include => :tag,
|
15
|
+
:conditions => {
|
16
|
+
:tags => {
|
17
|
+
:name => params[:tag_name].humanize
|
18
|
+
},
|
19
|
+
:taggable_type => 'Paper'
|
20
|
+
}
|
21
|
+
)
|
22
|
+
papers = tags.map(&:taggable).uniq.select{ |p| p.state == 'published' }
|
23
|
+
unless papers.nil?
|
24
|
+
@papers = papers.paginate(paginate_options)
|
25
|
+
end
|
26
|
+
end
|
27
|
+
end
|
28
|
+
|
29
|
+
|
30
|
+
private
|
31
|
+
def get_defaults
|
32
|
+
@last_papers = Paper.latest(:limit => 5)
|
33
|
+
@categories = PaperCategory.all
|
34
|
+
end
|
35
|
+
end
|
@@ -0,0 +1,22 @@
|
|
1
|
+
module BlogHelper
|
2
|
+
def tags
|
3
|
+
# FIXME count taggable only if it state is 'published'
|
4
|
+
ActsAsTaggableOn::Tag.count(:name, :joins => 'INNER JOIN taggings ON taggings.tag_id = tags.id' , :conditions => { :taggings => { :taggable_type => 'Paper'}}, :group => 'name', :select => 'name', :limit => 100 )
|
5
|
+
end
|
6
|
+
|
7
|
+
def tag_cloud(tags, classes)
|
8
|
+
counts = tags.map(&:last)
|
9
|
+
min = counts.min
|
10
|
+
max = counts.max
|
11
|
+
|
12
|
+
divisor = ((max - min) / classes.size) + 1
|
13
|
+
|
14
|
+
tags.map do |t|
|
15
|
+
yield t[0], classes[(t[1].to_i - min) / divisor]
|
16
|
+
end
|
17
|
+
end
|
18
|
+
|
19
|
+
def resumer(content, options = {})
|
20
|
+
truncate(content.gsub(/<\/?[^>]*>/, ""), { :length => 500 }.update(options))
|
21
|
+
end
|
22
|
+
end
|
@@ -0,0 +1,23 @@
|
|
1
|
+
module RoutesHelper
|
2
|
+
def seo_paper_path(*args)
|
3
|
+
forgeos_blog.blog_paper_path extract_paper_options(args)
|
4
|
+
end
|
5
|
+
|
6
|
+
def seo_paper_url(*args)
|
7
|
+
forgeos_blog.blog_paper_url extract_paper_options(args)
|
8
|
+
end
|
9
|
+
|
10
|
+
def extract_paper_options(args)
|
11
|
+
options = args.extract_options!
|
12
|
+
object = args.first
|
13
|
+
if object.is_a?(Paper)
|
14
|
+
return options.merge(:id => object.url)
|
15
|
+
else
|
16
|
+
args << options
|
17
|
+
end
|
18
|
+
end
|
19
|
+
|
20
|
+
def seo_blog_paper_category_path(category, options={})
|
21
|
+
forgeos_blog.blog_paper_category_path(options.merge(:blog_category_id => category.url))
|
22
|
+
end
|
23
|
+
end
|
@@ -0,0 +1,34 @@
|
|
1
|
+
load File.join(Gem.loaded_specs['forgeos_cms'].full_gem_path,'app','models','comment.rb')
|
2
|
+
class Comment < ActiveRecord::Base
|
3
|
+
include Rakismet::Model
|
4
|
+
validates :author_name, :unless => :skip_validates_presence_of_author_name?, :presence => true
|
5
|
+
validates :author_email, :unless => :skip_validates_presence_of_author_email?, :presence => true
|
6
|
+
validates :comment, :unless => :skip_validates_presence_of_comment?, :presence => true
|
7
|
+
rakismet_attrs :content => :comment, :author => :author_name, :comment_type => 'comment'
|
8
|
+
|
9
|
+
def author_name
|
10
|
+
author ? author.fullname : super
|
11
|
+
end
|
12
|
+
|
13
|
+
def author_email
|
14
|
+
author ? author.email : super
|
15
|
+
end
|
16
|
+
|
17
|
+
private
|
18
|
+
def skip_validates_presence_of_author_name?
|
19
|
+
author
|
20
|
+
end
|
21
|
+
|
22
|
+
def skip_validates_presence_of_author_email?
|
23
|
+
author
|
24
|
+
end
|
25
|
+
|
26
|
+
def skip_validates_presence_of_comment?
|
27
|
+
false
|
28
|
+
end
|
29
|
+
|
30
|
+
def self.latest_paper_comments(options = {})
|
31
|
+
all(options.merge({:conditions => { :commentable_type => 'Paper' }, :order => 'created_at DESC'}))
|
32
|
+
end
|
33
|
+
|
34
|
+
end
|
data/app/models/paper.rb
ADDED
@@ -0,0 +1,57 @@
|
|
1
|
+
class Paper < ActiveRecord::Base
|
2
|
+
acts_as_taggable
|
3
|
+
acts_as_commentable
|
4
|
+
attr_accessor :paper_url
|
5
|
+
accepts_nested_attributes_for :comments, :allow_destroy => true
|
6
|
+
|
7
|
+
belongs_to :picture
|
8
|
+
|
9
|
+
belongs_to :author, :foreign_key => 'person_id', :class_name => 'Person'
|
10
|
+
|
11
|
+
has_one :meta_info, :as => :target
|
12
|
+
accepts_nested_attributes_for :meta_info
|
13
|
+
|
14
|
+
has_and_belongs_to_many :categories, :readonly => true, :join_table => 'categories_elements', :foreign_key => 'element_id', :association_foreign_key => 'category_id', :class_name => 'PaperCategory'
|
15
|
+
|
16
|
+
translates :name, :content, :url, :description
|
17
|
+
|
18
|
+
validates :url, :name, :content, :person_id, :presence => true
|
19
|
+
|
20
|
+
has_many :viewed_counters, :as => :element, :class_name => 'PaperViewedCounter'
|
21
|
+
|
22
|
+
include AASM
|
23
|
+
|
24
|
+
aasm_column :state
|
25
|
+
aasm_initial_state :draft
|
26
|
+
aasm_state :draft
|
27
|
+
aasm_state :published
|
28
|
+
|
29
|
+
aasm_event :publish do
|
30
|
+
transitions :to => :published, :from => :draft
|
31
|
+
end
|
32
|
+
|
33
|
+
aasm_event :throw do
|
34
|
+
transitions :to => :draft, :from => :published
|
35
|
+
end
|
36
|
+
|
37
|
+
def aasm_current_state_with_event_firing=(state)
|
38
|
+
aasm_events_for_current_state.each do |event_name|
|
39
|
+
event = self.class.aasm_events[event_name]
|
40
|
+
aasm_fire_event(event_name,false) if event && event.all_transitions.any?{ |t| t.to == state || t.to == state.to_sym }
|
41
|
+
end
|
42
|
+
end
|
43
|
+
|
44
|
+
alias_method :aasm_current_state_with_event_firing, :aasm_current_state
|
45
|
+
|
46
|
+
scope :popularity, lambda { {
|
47
|
+
:order => "sum(#{PaperViewedCounter.table_name}.counter) DESC, papers.id DESC",
|
48
|
+
:include => :viewed_counters,
|
49
|
+
:group => "papers.id",
|
50
|
+
}
|
51
|
+
}
|
52
|
+
scope :latest, lambda { { :conditions => { :state => 'published' }, :order => 'published_at DESC'} }
|
53
|
+
|
54
|
+
def paper_urls
|
55
|
+
self.translations.collect(&:url)
|
56
|
+
end
|
57
|
+
end
|
@@ -0,0 +1,44 @@
|
|
1
|
+
class PaperSweeper < ActionController::Caching::Sweeper
|
2
|
+
include BlogHelper
|
3
|
+
observe Paper, Comment, PaperCategory
|
4
|
+
|
5
|
+
def after_save(record)
|
6
|
+
expire_cache_for(record)
|
7
|
+
end
|
8
|
+
|
9
|
+
def after_create(record)
|
10
|
+
expire_cache_for(record)
|
11
|
+
end
|
12
|
+
|
13
|
+
def after_destroy(record)
|
14
|
+
expire_cache_for(record)
|
15
|
+
end
|
16
|
+
|
17
|
+
private
|
18
|
+
def expire_cache_for(record)
|
19
|
+
case record
|
20
|
+
when Paper
|
21
|
+
expire_cache_for_paper(record)
|
22
|
+
when PaperCategory
|
23
|
+
expire_all_papers
|
24
|
+
when Comment
|
25
|
+
expire_cache_for_paper(record.commentable) if record.commentable.kind_of?(Paper)
|
26
|
+
else
|
27
|
+
true
|
28
|
+
end
|
29
|
+
end
|
30
|
+
|
31
|
+
def expire_cache_for_paper(paper)
|
32
|
+
urls = (paper.paper_url || paper.paper_urls).compact
|
33
|
+
urls.each do |url|
|
34
|
+
expire_page seo_paper_path(:id => url) if url.present?
|
35
|
+
Rails.logger.info("\033[01;33mURL : #{url.inspect}\033[0m")
|
36
|
+
end
|
37
|
+
end
|
38
|
+
|
39
|
+
def expire_all_papers
|
40
|
+
Paper.all.each do |paper|
|
41
|
+
expire_cache_for_paper(paper)
|
42
|
+
end
|
43
|
+
end
|
44
|
+
end
|
@@ -0,0 +1,8 @@
|
|
1
|
+
%ul.ui-tabs-nav.ui-helper-reset.ui-helper-clearfix.ui-widget-header.ui-corner-all
|
2
|
+
%li.ui-state-default.ui-corner-top= link_to I18n.t('page', :count => 2).capitalize, [forgeos_cms, :admin, :pages]
|
3
|
+
%li.ui-state-default.ui-corner-top.ui-tabs-selected.ui-state-active= link_to I18n.t('block', :count => 2).capitalize, '#content'
|
4
|
+
%li.ui-state-default.ui-corner-top= link_to I18n.t('navigation').capitalize, [forgeos_cms, :admin, :menus]
|
5
|
+
%li.ui-state-default.ui-corner-top= link_to t(:paper, :count => 2).capitalize, [forgeos_blog, :admin, :papers]
|
6
|
+
#blocks-header.backgrounds
|
7
|
+
= link_to I18n.t('static_content_block', :count => 1).capitalize, '#', :class => 'selected'
|
8
|
+
= link_to I18n.t('widget', :count => 2).capitalize, [forgeos_cms, :admin, :widgets]
|
@@ -0,0 +1,5 @@
|
|
1
|
+
%ul.ui-tabs-nav.ui-helper-reset.ui-helper-clearfix.ui-widget-header.ui-corner-all
|
2
|
+
%li.ui-state-default.ui-corner-top= link_to t('page', :count => 2).capitalize, [forgeos_cms, :admin, :pages]
|
3
|
+
%li.ui-state-default.ui-corner-top= link_to t('block', :count => 2).capitalize, [forgeos_cms, :admin, :static_content_blocks]
|
4
|
+
%li.ui-state-default.ui-corner-top.ui-tabs-selected.ui-state-active= link_to t('navigation').capitalize, '#content'
|
5
|
+
%li.ui-state-default.ui-corner-top= link_to t(:paper, :count => 2).capitalize, [forgeos_blog, :admin, :papers]
|
@@ -0,0 +1,5 @@
|
|
1
|
+
%ul.ui-tabs-nav.ui-helper-reset.ui-helper-clearfix.ui-widget-header.ui-corner-all
|
2
|
+
%li.ui-state-default.ui-corner-top.ui-tabs-selected.ui-state-active= link_to t('page', :count => 2).capitalize, '#content'
|
3
|
+
%li.ui-state-default.ui-corner-top= link_to t('block', :count => 2).capitalize, [forgeos_cms, :admin, :static_content_blocks]
|
4
|
+
%li.ui-state-default.ui-corner-top= link_to t('navigation').capitalize, [forgeos_cms, :admin, :menus]
|
5
|
+
%li.ui-state-default.ui-corner-top= link_to t(:paper, :count => 2).capitalize, [forgeos_blog, :admin, :papers]
|
@@ -0,0 +1,31 @@
|
|
1
|
+
- item = f.object
|
2
|
+
- link_id = "item_#{item.id}"
|
3
|
+
|
4
|
+
.block-container.widget-modify.comment{:id => link_id}
|
5
|
+
.inner_block-container
|
6
|
+
.block-type
|
7
|
+
= t('paper.posted', :at => item.created_at, :by => content_tag(:span,item.author_name))
|
8
|
+
.block-type.editing
|
9
|
+
%label
|
10
|
+
= "#{I18n.t('comment.author').capitalize} :"
|
11
|
+
%label
|
12
|
+
= "#{I18n.t('comment.author_email').capitalize} :"
|
13
|
+
%label
|
14
|
+
= "#{I18n.t('comment', :count => 1).capitalize} :"
|
15
|
+
.block-name
|
16
|
+
%p=h item.comment
|
17
|
+
.block-name.editing{:id => "edit_#{link_id}"}
|
18
|
+
= f.hidden_field :_destroy, :class => 'delete'
|
19
|
+
= f.text_field :author_name
|
20
|
+
= f.text_field :author_email
|
21
|
+
= f.text_area :comment, :cols => 10, :rows => 2
|
22
|
+
.actions
|
23
|
+
= link_to_function content_tag(:span,I18n.t('save_changes'), :class => 'small-icons save'), "update_comment($('#item_#{item.id}'), $('#edit_item_#{item.id}'))", :class => 'backgrounds action-button'
|
24
|
+
|
25
|
+
= t('or')
|
26
|
+
= link_to I18n.t('cancel').capitalize, '#', :class => 'back-link'
|
27
|
+
|
28
|
+
.widget-actions
|
29
|
+
= link_to '','#', :class => 'small-icons edit-link', :id => "edit-comment-#{item.id}"
|
30
|
+
= link_to_function '', "remove_comment($(this));", :class => 'small-icons destroy-link', :id => "delete-comment-#{item.id}"
|
31
|
+
.clear
|
@@ -0,0 +1,20 @@
|
|
1
|
+
= render :partial => 'admin/menus/lang_switcher'
|
2
|
+
= render :partial => 'tabs'
|
3
|
+
= form_for [forgeos_blog, :admin, paper], :html => { :id => 'wrap' } do |f|
|
4
|
+
#blocks-header.ui-tabs.ui-widget.ui-widget-content.ui-corner-all
|
5
|
+
%ul.ui-tabs-nav.ui-helper-reset.ui-helper-clearfix.ui-widget-header.ui-corner-all
|
6
|
+
%li.ui-state-default.ui-corner-top.ui-tabs-selected.ui-state-active= link_to t(:general), '#general', :class => 'selected'
|
7
|
+
%li.ui-state-default.ui-corner-top= link_to t(:comment,:count => 2), '#comments'
|
8
|
+
%li.ui-state-default.ui-corner-top= link_to t(:seo), '#seo'
|
9
|
+
.backgrounds.big-header
|
10
|
+
= f.text_field :name, :class => 'field_name big_orange_input'
|
11
|
+
.interact-links
|
12
|
+
= Forgeos_save_buttons [forgeos_blog, :admin, :papers]
|
13
|
+
#general
|
14
|
+
= render :partial => 'general', :locals => {:f => f, :paper => paper }
|
15
|
+
.clear
|
16
|
+
#comments
|
17
|
+
= render :partial => 'comments', :locals => { :f => f, :paper => paper }
|
18
|
+
#seo
|
19
|
+
= render :partial => 'seo', :locals => { :f => f, :paper => paper }
|
20
|
+
.clear
|
@@ -0,0 +1,42 @@
|
|
1
|
+
.grid_12.alpha
|
2
|
+
.inner-content
|
3
|
+
= f.label :description
|
4
|
+
%div= f.text_area :description, :cols => 90, :rows => 5
|
5
|
+
.clear
|
6
|
+
= f.label :content
|
7
|
+
%div= f.text_area :content, :class => 'mceEditor'
|
8
|
+
.clear
|
9
|
+
= display_visual(f.object_name, f.object.picture)
|
10
|
+
|
11
|
+
#right-sidebar.grid_4.omega
|
12
|
+
.step.status.open
|
13
|
+
- states_for_select = Paper.aasm_states.collect{ |state| [t(state.name, :scope => [:paper,:states]),state.name.to_s] }
|
14
|
+
%div= f.select :aasm_current_state_with_event_firing, options_for_select(states_for_select, paper.state)
|
15
|
+
= f.label :person_id, t('paper.author')
|
16
|
+
%div= f.collection_select :person_id,Person.all, :id, :fullname, { :prompt => t(:please_select)}
|
17
|
+
= f.label :published_at, t('paper.published_at')
|
18
|
+
= f.text_field :published_at, :size => 10, :class => 'date-picker'
|
19
|
+
.clear
|
20
|
+
.step.open
|
21
|
+
%a.small-icons.step-title{ :href => "#" }
|
22
|
+
= "#{I18n.t('folder.associated_to').capitalize} :"
|
23
|
+
#association-paper-tree.inner-step.init-tree
|
24
|
+
%ul
|
25
|
+
= render :partial => 'admin/categories/associated_elements', :locals => { :association_id => 'category_ids', :element => paper, :category_ids => paper.category_ids, :categories => PaperCategory.find_all_by_parent_id(nil) }
|
26
|
+
.clear
|
27
|
+
#paper_tags.step.open
|
28
|
+
%a.small-icons.step-title{ :href => "#" }
|
29
|
+
Tags
|
30
|
+
.inner-step.tags
|
31
|
+
.wrap_tags
|
32
|
+
-#TODO write good css for tags to remove inline styles
|
33
|
+
= hidden_field_tag 'tag_list[]', ''
|
34
|
+
%input#tag.backgrounds{ :name => "tag", :type => "text", :title => I18n.t('tag_enter').capitalize, :class => 'defaultValue' }
|
35
|
+
- f.object.tag_list.each do |tag|
|
36
|
+
%span{ :style => 'margin: 5px'}
|
37
|
+
= tag
|
38
|
+
= hidden_field_tag 'tag_list[]', tag
|
39
|
+
= link_to ' ', '#', :class => 'big-icons gray-destroy', :style => 'position: relative !important;float: right;top:0;right: 0;padding: 0; margin: 0 0 0 5px '
|
40
|
+
.clear
|
41
|
+
|
42
|
+
= render :partial => 'admin/visual/visual_popup.html.haml', :locals => {:form => f}
|
@@ -0,0 +1,31 @@
|
|
1
|
+
.grid_12
|
2
|
+
.fieldset.open
|
3
|
+
%h3.permalink
|
4
|
+
= I18n.t('permalink').capitalize
|
5
|
+
\:
|
6
|
+
.option-panel-content
|
7
|
+
= seo_paper_url(f.object.class.new(:url=>'_'))
|
8
|
+
= f.text_field :url
|
9
|
+
.fieldset.open
|
10
|
+
%h3= t(:meta_info, :count => 1)
|
11
|
+
.option-panel-content.meta
|
12
|
+
- f.object.build_meta_info unless f.object.meta_info
|
13
|
+
- f.fields_for :meta_info do |meta_info|
|
14
|
+
%p
|
15
|
+
%span
|
16
|
+
= t(:title).capitalize
|
17
|
+
\:
|
18
|
+
.clear
|
19
|
+
= meta_info.text_field :title, :class => 'text', :size => 90
|
20
|
+
%p
|
21
|
+
%span
|
22
|
+
= t(:description).capitalize
|
23
|
+
\:
|
24
|
+
.clear
|
25
|
+
= meta_info.text_area :description, :class => 'text', :cols => 90, :rows => 5
|
26
|
+
%p
|
27
|
+
%span
|
28
|
+
= t(:keyword, :count => 2).capitalize
|
29
|
+
\:
|
30
|
+
.clear
|
31
|
+
= meta_info.text_area :keywords, :class => 'text', :cols => 90, :rows => 5
|
@@ -0,0 +1,5 @@
|
|
1
|
+
%ul.ui-tabs-nav.ui-helper-reset.ui-helper-clearfix.ui-widget-header.ui-corner-all
|
2
|
+
%li.ui-state-default.ui-corner-top= link_to t('page', :count => 2).capitalize, [forgeos_cms, :admin, :pages]
|
3
|
+
%li.ui-state-default.ui-corner-top= link_to t('block', :count => 2).capitalize, [forgeos_cms, :admin, :static_content_blocks]
|
4
|
+
%li.ui-state-default.ui-corner-top= link_to t('navigation').capitalize, [forgeos_cms, :admin, :menus]
|
5
|
+
%li.ui-state-default.ui-corner-top.ui-tabs-selected.ui-state-active= link_to t(:paper, :count => 2).capitalize, '#content'
|
@@ -0,0 +1 @@
|
|
1
|
+
removedataTablesRow('#destroy_paper_<%= @paper.id-%>');
|
@@ -0,0 +1 @@
|
|
1
|
+
= render :partial => 'form', :locals => { :paper => @paper }
|
@@ -0,0 +1,12 @@
|
|
1
|
+
= render :partial => 'tabs'
|
2
|
+
= render :partial => 'admin/sidebars/left_sidebar', :locals => {:icon_class => 'papers', :sidebar_title => 'paper.all', :tree_id =>'paper-tree' }
|
3
|
+
#content.grid_12.alpha.omega
|
4
|
+
.backgrounds.header
|
5
|
+
= link_to content_tag(:span,t('paper.create.action').capitalize, :class=>'big-icons create-paper'), [forgeos_blog, :new, :admin, :paper], :class=>'backgrounds action-button'
|
6
|
+
#search.right
|
7
|
+
= link_to content_tag(:span, t('search').capitalize, :class => 'small-icons search-span'), '#', :class => 'small-icons left search-link'
|
8
|
+
.backgrounds.search-form
|
9
|
+
.content-background
|
10
|
+
%table#table.datatable.draggable_rows
|
11
|
+
|
12
|
+
= dataTables_tag :url => forgeos_blog.admin_papers_path(:format => :json), :columns => ["{'bSearchable':false,'bSortable':false}","{'sTitle':'#{t :name}'}","{'sTitle':'#{t 'paper.author'}'}","{'sTitle':'#{t :status, :count => 1}'}","{'sTitle':'#{t :published_at, :scope => :paper}'}","{'sClass':'actions-td','bSearchable':false,'bSortable':false}"]
|