sunrise-posts 0.1.4 → 0.1.5
Sign up to get free protection for your applications and to get access to all the features.
- data/MIT-LICENSE +20 -0
- data/Rakefile +0 -21
- data/app/controllers/manage/posts_controller.rb +4 -8
- data/app/views/manage/posts/_model_filter.html.erb +20 -12
- data/app/views/manage/posts/_post.html.erb +2 -2
- data/db/migrate/sunrise_create_posts.rb +24 -0
- data/lib/sunrise/models/post.rb +2 -0
- data/lib/sunrise/posts/version.rb +1 -1
- metadata +27 -23
data/MIT-LICENSE
ADDED
@@ -0,0 +1,20 @@
|
|
1
|
+
Copyright 2011 AIMBULANCE
|
2
|
+
|
3
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
4
|
+
a copy of this software and associated documentation files (the
|
5
|
+
"Software"), to deal in the Software without restriction, including
|
6
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
7
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
8
|
+
permit persons to whom the Software is furnished to do so, subject to
|
9
|
+
the following conditions:
|
10
|
+
|
11
|
+
The above copyright notice and this permission notice shall be
|
12
|
+
included in all copies or substantial portions of the Software.
|
13
|
+
|
14
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
15
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
16
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
17
|
+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
18
|
+
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
19
|
+
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
20
|
+
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/Rakefile
CHANGED
@@ -23,24 +23,3 @@ Rake::RDocTask.new(:rdoc) do |rdoc|
|
|
23
23
|
rdoc.rdoc_files.include('README')
|
24
24
|
rdoc.rdoc_files.include('lib/**/*.rb')
|
25
25
|
end
|
26
|
-
|
27
|
-
begin
|
28
|
-
require 'jeweler'
|
29
|
-
Jeweler::Tasks.new do |s|
|
30
|
-
s.name = "sunrise-posts"
|
31
|
-
s.version = Sunrise::Posts::VERSION.dup
|
32
|
-
s.summary = "Rails CMS"
|
33
|
-
s.description = "Sunrise is a Aimbulance CMS"
|
34
|
-
s.email = "galeta.igor@gmail.com"
|
35
|
-
s.homepage = "https://github.com/galetahub/sunrise-posts"
|
36
|
-
s.authors = ["Igor Galeta", "Pavlo Galeta"]
|
37
|
-
s.files = FileList["[A-Z]*", "{app,config,lib}/**/*"]
|
38
|
-
s.extra_rdoc_files = FileList["[A-Z]*"] - %w(Gemfile Rakefile)
|
39
|
-
|
40
|
-
s.add_dependency('sunrise-cms')
|
41
|
-
end
|
42
|
-
|
43
|
-
Jeweler::GemcutterTasks.new
|
44
|
-
rescue LoadError
|
45
|
-
puts "Jeweler not available. Install it with: gem install jeweler"
|
46
|
-
end
|
@@ -4,9 +4,10 @@ class Manage::PostsController < Manage::BaseController
|
|
4
4
|
belongs_to :structure, :finder => :find_by_permalink!
|
5
5
|
|
6
6
|
load_and_authorize_resource :post, :through => :structure
|
7
|
-
|
8
|
-
before_filter :make_filter, :only => [:index]
|
9
7
|
cache_sweeper :post_sweeper, :only => [:create, :update, :destroy]
|
8
|
+
|
9
|
+
has_scope :with_title, :as => :title, :only => [:index]
|
10
|
+
order_by :title, :published_at
|
10
11
|
|
11
12
|
def create
|
12
13
|
create!{ manage_structure_posts_path(@structure.id) }
|
@@ -27,11 +28,6 @@ class Manage::PostsController < Manage::BaseController
|
|
27
28
|
end
|
28
29
|
|
29
30
|
def collection
|
30
|
-
@posts = (@posts || end_of_association_chain).
|
31
|
-
end
|
32
|
-
|
33
|
-
def make_filter
|
34
|
-
@search = Sunrise::ModelFilter.new(Post, :attributes=>[ :title, :kind ] )
|
35
|
-
@search.update_attributes(params[:search])
|
31
|
+
@posts = (@posts || end_of_association_chain).order(search_filter.order).page(params[:page])
|
36
32
|
end
|
37
33
|
end
|
@@ -2,28 +2,36 @@
|
|
2
2
|
<div class="filt-bl">
|
3
3
|
<%= link_to_function t('manage.model_filter.title'), "Manage.toggle_element('block_filter')", :class=>"dark-arr" %>
|
4
4
|
|
5
|
-
<%=
|
6
|
-
|
7
|
-
|
8
|
-
|
5
|
+
<%= t('manage.model_filter.total_count') %>: <%= @posts.total_count %>
|
6
|
+
|
7
|
+
<%= cookie_content_tag(:div, :id=>"block_filter", :class=>"filt") do %>
|
8
|
+
<%= form_for search_filter, :url => manage_structure_posts_path(@structure.id), :html =>{ :method => :get } do |f| %>
|
9
|
+
|
10
|
+
<% controller.scopes_configuration.each do |key, value| %>
|
11
|
+
<%= f.label value[:as], t(value[:as], :scope => "activerecord.attributes.post") %>
|
12
|
+
<%= f.text_field value[:as], :class => "text", :name => value[:as] %>
|
13
|
+
<% end %>
|
9
14
|
|
10
15
|
<div class="buts">
|
11
|
-
<%=
|
12
|
-
|
16
|
+
<%= content_tag(:button, :value => "search", :type => "submit", :name => "commit", :class => "gr cupid-green") do %>
|
17
|
+
<%= t('manage.model_filter.search') %>
|
18
|
+
<% end %>
|
19
|
+
|
13
20
|
<%= link_to t('manage.model_filter.clear'), manage_structure_posts_path(@structure.id), :class=>"erase" %>
|
14
21
|
</div>
|
15
22
|
<% end %>
|
23
|
+
|
24
|
+
|
16
25
|
<% end %>
|
17
26
|
</div>
|
18
27
|
<div class="sort">
|
19
28
|
<label><%= t('manage.sort') %></label>
|
20
|
-
<div class="select-input"><%= link_to_function t("manage.posts.sort
|
29
|
+
<div class="select-input"><%= link_to_function t(search_filter.current_order, :scope => "manage.posts.sort"), "SelectList.toggle(event)", :class=>"corn", :id=>'sort_select' %></div>
|
21
30
|
<div id='sort_select_list' class="select-list" style='display:none;'>
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
<%= link_to_sort(t('manage.posts.sort.title_asc'), :name=>"title", :order_type=>'asc') %>
|
31
|
+
<% controller.orders_configuration.each do |key, value| %>
|
32
|
+
<%= link_to_sort(t("#{key}_desc", :scope => "manage.posts.sort"), :name => key, :order_type=>'desc') %>
|
33
|
+
<%= link_to_sort(t("#{key}_asc", :scope => "manage.posts.sort"), :name => key, :order_type=>'asc') %>
|
34
|
+
<% end %>
|
27
35
|
</div>
|
28
36
|
</div>
|
29
37
|
</div>
|
@@ -1,11 +1,11 @@
|
|
1
1
|
<%= content_tag(:div, :id => dom_id(post), :class=>"dinamic-bl") do %>
|
2
2
|
<div class="act-bl" style="display:none;">
|
3
3
|
<% if can? :update, post, :context => :manage %>
|
4
|
-
<%= link_to
|
4
|
+
<%= link_to manage_icon("edit"), edit_manage_structure_post_path(@structure.id, post.id), :class=>"icons" %>
|
5
5
|
<% end %>
|
6
6
|
|
7
7
|
<% if can? :delete, post, :context => :manage %>
|
8
|
-
<%= link_to
|
8
|
+
<%= link_to manage_icon("delete"), manage_structure_post_path(@structure.id, post.id),
|
9
9
|
:method=>:delete, :confirm=>t("manage.confirm_delete"), :class=>"icons" %>
|
10
10
|
<% end %>
|
11
11
|
</div>
|
@@ -0,0 +1,24 @@
|
|
1
|
+
class SunriseCreatePosts < ActiveRecord::Migration
|
2
|
+
def self.up
|
3
|
+
create_table :posts do |t|
|
4
|
+
t.integer :structure_id
|
5
|
+
t.string :title, :null => false
|
6
|
+
# t.string :slug, :limit=>40, :null=>false
|
7
|
+
t.text :content
|
8
|
+
|
9
|
+
t.integer :kind, :limit => 1, :default => 0
|
10
|
+
t.integer :comments_count, :default=>0
|
11
|
+
t.integer :year, :limit => 4
|
12
|
+
|
13
|
+
t.datetime :published_at
|
14
|
+
t.timestamps
|
15
|
+
end
|
16
|
+
|
17
|
+
add_index :posts, :structure_id
|
18
|
+
add_index :posts, :year
|
19
|
+
end
|
20
|
+
|
21
|
+
def self.down
|
22
|
+
drop_table :posts
|
23
|
+
end
|
24
|
+
end
|
data/lib/sunrise/models/post.rb
CHANGED
metadata
CHANGED
@@ -1,22 +1,22 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: sunrise-posts
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 17
|
5
5
|
prerelease:
|
6
6
|
segments:
|
7
7
|
- 0
|
8
8
|
- 1
|
9
|
-
-
|
10
|
-
version: 0.1.
|
9
|
+
- 5
|
10
|
+
version: 0.1.5
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- Igor Galeta
|
14
|
-
-
|
14
|
+
- Pavel Galeta
|
15
15
|
autorequire:
|
16
16
|
bindir: bin
|
17
17
|
cert_chain: []
|
18
18
|
|
19
|
-
date: 2011-
|
19
|
+
date: 2011-09-15 00:00:00 +03:00
|
20
20
|
default_executable:
|
21
21
|
dependencies:
|
22
22
|
- !ruby/object:Gem::Dependency
|
@@ -27,13 +27,15 @@ dependencies:
|
|
27
27
|
requirements:
|
28
28
|
- - ">="
|
29
29
|
- !ruby/object:Gem::Version
|
30
|
-
hash:
|
30
|
+
hash: 23
|
31
31
|
segments:
|
32
32
|
- 0
|
33
|
-
|
33
|
+
- 2
|
34
|
+
- 0
|
35
|
+
version: 0.2.0
|
34
36
|
type: :runtime
|
35
37
|
version_requirements: *id001
|
36
|
-
description:
|
38
|
+
description: Posts plugin for Sunrise CMS via aimbulance
|
37
39
|
email: galeta.igor@gmail.com
|
38
40
|
executables: []
|
39
41
|
|
@@ -42,26 +44,28 @@ extensions: []
|
|
42
44
|
extra_rdoc_files:
|
43
45
|
- README.rdoc
|
44
46
|
files:
|
45
|
-
-
|
46
|
-
- Rakefile
|
47
|
-
- app/controllers/manage/posts_controller.rb
|
48
|
-
- app/sweepers/post_sweeper.rb
|
49
|
-
- app/views/manage/posts/_form.html.erb
|
50
|
-
- app/views/manage/posts/_model_filter.html.erb
|
47
|
+
- app/views/manage/posts/new.html.erb
|
51
48
|
- app/views/manage/posts/_post.html.erb
|
52
49
|
- app/views/manage/posts/edit.html.erb
|
50
|
+
- app/views/manage/posts/_form.html.erb
|
51
|
+
- app/views/manage/posts/_model_filter.html.erb
|
53
52
|
- app/views/manage/posts/index.html.erb
|
54
|
-
- app/
|
55
|
-
-
|
56
|
-
- lib/
|
53
|
+
- app/controllers/manage/posts_controller.rb
|
54
|
+
- app/sweepers/post_sweeper.rb
|
55
|
+
- lib/sunrise/models/post.rb
|
56
|
+
- lib/sunrise/posts/engine.rb
|
57
|
+
- lib/sunrise/posts/version.rb
|
58
|
+
- lib/sunrise/posts.rb
|
57
59
|
- lib/generators/sunrise/posts/install_generator.rb
|
58
60
|
- lib/generators/sunrise/posts/templates/create_posts.rb
|
59
61
|
- lib/generators/sunrise/posts/templates/post.rb
|
62
|
+
- lib/generators/sunrise/posts/USAGE
|
60
63
|
- lib/sunrise-posts.rb
|
61
|
-
-
|
62
|
-
-
|
63
|
-
-
|
64
|
-
-
|
64
|
+
- config/routes.rb
|
65
|
+
- db/migrate/sunrise_create_posts.rb
|
66
|
+
- MIT-LICENSE
|
67
|
+
- Rakefile
|
68
|
+
- README.rdoc
|
65
69
|
has_rdoc: true
|
66
70
|
homepage: https://github.com/galetahub/sunrise-posts
|
67
71
|
licenses: []
|
@@ -91,10 +95,10 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
91
95
|
version: "0"
|
92
96
|
requirements: []
|
93
97
|
|
94
|
-
rubyforge_project:
|
98
|
+
rubyforge_project: sunrise-posts
|
95
99
|
rubygems_version: 1.6.2
|
96
100
|
signing_key:
|
97
101
|
specification_version: 3
|
98
|
-
summary:
|
102
|
+
summary: Posts plugin for sunrise-cms
|
99
103
|
test_files: []
|
100
104
|
|